File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import json
22from os import path
3+ from typing import Any
34from schema import Schema , SchemaError
45
56class Config (object ):
@@ -38,18 +39,16 @@ def __get_file_buff(cls, path_file:str):
3839 raise ConfigFileOpenReadError (str (e ))
3940
4041 @classmethod
41- def __dict_2_obj (cls , data :any ):
42+ def __dict_2_obj (cls , data : Any ):
4243 _type = type (data )
4344
4445 if _type is dict :
4546 obj = object .__new__ (cls )
46- for key in data :
47- setattr (obj , key , cls .__dict_2_obj (data [ key ] ))
47+ for key , value in data . items () :
48+ setattr (obj , key , cls .__dict_2_obj (value ))
4849 return obj
49- if _type is list :
50- for i in range (len (data )):
51- data [i ] = cls .__dict_2_obj (data [i ])
52- return data
50+ if _type in (list , set , tuple ):
51+ return list (map (lambda value : cls .__dict_2_obj (value ), data ))
5352 else :
5453 return data
5554
Original file line number Diff line number Diff line change 55
66setuptools .setup (
77 name = "python-json-config-parser" ,
8- version = "1.0.6 " ,
8+ version = "1.0.7 " ,
99 author = "Bruno Silva de Andrade" ,
1010 author_email = "brunojf.andrade@gmail.com" ,
1111 description = "Project created to given the possibility of create dynamics Json config files" ,
You can’t perform that action at this time.
0 commit comments