1616import warnings
1717from copy import deepcopy
1818from dataclasses import dataclass , field
19- from typing import NamedTuple , Optional , Any , Union
19+ from typing import Any , NamedTuple , Optional , Union
2020
2121import json5
2222import requests
@@ -50,12 +50,11 @@ class ConfigFile:
5050 """
5151 Class used to represent a single config file.
5252
53- Mainly it will have the following details :
53+ Mainly it will have the following details:
5454 1. Type ("User Config" or "Team Config")
55- -------
56- User Configs override Team Configs.
57- User Configs are used to have personalised config details
58- that the user don't want to have in the Team Config.
55+ - User Configs override Team Configs.
56+ - User Configs are used to have personalised config details
57+ - that the user don't want to have in the Team Config.
5958 2. Directory in which the file is located.
6059 3. Name (excluding .config.json or .config.user.json)
6160 4. Contents of the file.
@@ -75,7 +74,7 @@ class ConfigFile:
7574 jsonc : Optional [dict [str , Any ]] = None
7675 _missing_secure_props : list [str ] = field (default_factory = list )
7776
78- __suppress_config_file_warnings : Optional [bool ] = True ,
77+ __suppress_config_file_warnings : Optional [bool ] = True
7978 __logger = Log .register_logger (__name__ )
8079
8180 @property
@@ -111,10 +110,7 @@ def location(self, dirname: str) -> None:
111110 self .__logger .error (f"given path { dirname } is not valid" )
112111 raise FileNotFoundError (f"given path { dirname } is not valid" )
113112
114- def init_from_file (
115- self ,
116- validate_schema : Optional [bool ] = True
117- ) -> None :
113+ def init_from_file (self , validate_schema : Optional [bool ] = True ) -> None :
118114 """
119115 Initialize the class variable after setting filepath (or if not set, autodiscover the file).
120116
@@ -276,7 +272,7 @@ def get_profile(
276272
277273 if profile_name is None :
278274 profile_name = self .get_profilename_from_profiletype (profile_type = profile_type or "" )
279-
275+
280276 props : dict [str , Any ] = self .load_profile_properties (profile_name = profile_name )
281277
282278 return Profile (props , profile_name , self ._missing_secure_props )
@@ -387,7 +383,7 @@ def find_profile(self, path: str, profiles: dict[str, Any]) -> Optional[dict[str
387383 for k , v in profiles .items ():
388384 if not isinstance (v , dict ): # Ensure v is a dictionary
389385 if not self .__suppress_config_file_warnings :
390- self .__logger .warning ("Invalid profile passed when schame validation is off" )
386+ self .__logger .warning ("Invalid profile passed when schame validation is off" )
391387 continue # Skip invalid entries
392388
393389 if segments [0 ] == k :
@@ -666,15 +662,14 @@ def get_profile_path_from_name(self, short_path: str) -> str:
666662 Returns the full profile path
667663 """
668664 return re .sub (r"(^|\.)" , r"\1profiles." , short_path )
669-
665+
670666 def suppress_config_warnings (self , value : bool ) -> None :
671667 """
672668 Suppress warnings in config files.
673669
674670 Parameters
675671 ----------
676672 value: bool
677- Warnings are shown or not
673+ Warnings are shown or not
678674 """
679675 self .__suppress_config_file_warnings = value
680-
0 commit comments