From b685df501a21e4c59371804385fedc4a2bc01823 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 30 Jun 2016 23:18:59 +0100 Subject: Remove every now-useless usage of the Singleton function. --- poezio/singleton.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 poezio/singleton.py (limited to 'poezio/singleton.py') diff --git a/poezio/singleton.py b/poezio/singleton.py deleted file mode 100644 index 7f12796b..00000000 --- a/poezio/singleton.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2010-2011 Florent Le Coz -# -# This file is part of Poezio. -# -# Poezio is free software: you can redistribute it and/or modify -# it under the terms of the zlib license. See the COPYING file. - -""" -Defines a Singleton function that initialize an object -of the given class if it was never instantiated yet. Else, returns -the previously instantiated object. -This method is the only one that I can come up with that do not call -__init__() each time. -""" - -_instances = {} -def Singleton(cls, *args, **kwargs): - if not cls in _instances: - _instances[cls] = cls(*args, **kwargs) - return _instances[cls] -- cgit v1.2.3