@@ -27,7 +27,7 @@ class SingletonMeta(abc.ABCMeta):
2727 Main goals: not need to implement __new__ in singleton classes
2828 """
2929
30- _instances = {} # type: typing.Dict[typing.Type , typing.Any]
30+ _instances = {} # type: typing.Dict[type , typing.Any]
3131 _lock = threading .RLock () # type: threading.RLock
3232
3333 def __call__ (cls : "SingletonMeta" , * args : typing .Any , ** kwargs : typing .Any ) -> typing .Any :
@@ -40,8 +40,8 @@ def __call__(cls: "SingletonMeta", *args: typing.Any, **kwargs: typing.Any) -> t
4040
4141 @classmethod
4242 def __prepare__ ( # pylint: disable=unused-argument
43- mcs : typing .Type ["SingletonMeta" ], name : str , bases : typing .Iterable [typing . Type ], ** kwargs : typing .Any
44- ) -> collections .OrderedDict :
43+ mcs : typing .Type ["SingletonMeta" ], name : str , bases : typing .Iterable [type ], ** kwargs : typing .Any
44+ ) -> " collections.OrderedDict[str, typing.Any]" :
4545 """Metaclass magic for object storage.
4646
4747 .. versionadded:: 1.2.0
@@ -58,8 +58,12 @@ def __init__(cls, name: str, bases: typing.Tuple[type, ...], namespace: typing.D
5858 cls .__lock = threading .RLock ()
5959
6060 def __new__ ( # pylint: disable=arguments-differ
61- mcs , name : str , bases : typing .Tuple [type , ...], namespace : typing .Dict [str , typing .Any ], ** kwargs : typing .Any
62- ) -> typing .Type :
61+ mcs : typing .Type ["SingleLock" ],
62+ name : str ,
63+ bases : typing .Tuple [type , ...],
64+ namespace : typing .Dict [str , typing .Any ],
65+ ** kwargs : typing .Any
66+ ) -> "SingleLock" :
6367 """Create lock property for class instances."""
6468 namespace ["lock" ] = property (fget = lambda self : self .__class__ .lock )
6569 return super ().__new__ (mcs , name , bases , namespace , ** kwargs ) # type: ignore
@@ -71,8 +75,8 @@ def lock(cls) -> threading.RLock:
7175
7276 @classmethod
7377 def __prepare__ ( # pylint: disable=unused-argument
74- mcs : typing .Type ["SingleLock" ], name : str , bases : typing .Iterable [typing . Type ], ** kwargs : typing .Any
75- ) -> collections .OrderedDict :
78+ mcs : typing .Type ["SingleLock" ], name : str , bases : typing .Iterable [type ], ** kwargs : typing .Any
79+ ) -> " collections.OrderedDict[str, typing.Any]" :
7680 """Metaclass magic for object storage.
7781
7882 .. versionadded:: 1.2.0
0 commit comments