File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,22 @@ def default(self, obj):
1212 return json .JSONEncoder .default (self , obj )
1313
1414
15- class Config :
15+ class SingletonMeta (type ):
16+ _instance = {}
1617
18+ def __call__ (cls , * args , ** kwargs ):
19+ if cls not in cls ._instance :
20+ cls ._instance [cls ] = super (SingletonMeta , cls ).__call__ (* args , ** kwargs )
21+ return cls ._instance [cls ]
22+
23+
24+ class Config (metaclass = SingletonMeta ):
1725 def __init__ (self ):
1826 conf = self .__load ()
1927
20- self .suffix = set (conf ['suffix' ])
21- self .comment = set (conf ['comment' ])
22- self .ignore = set (conf ['ignore' ])
28+ self .suffix : set = set (conf ['suffix' ])
29+ self .comment : set = set (conf ['comment' ])
30+ self .ignore : set = set (conf ['ignore' ])
2331
2432 def invoke (self , args ):
2533 if args .restore :
You can’t perform that action at this time.
0 commit comments