@@ -12,6 +12,9 @@ class PumConfig:
1212 def __init__ (self , ** kwargs ):
1313 """
1414 Initialize the configuration with key-value pairs.
15+
16+ Args:
17+ **kwargs: Key-value pairs representing configuration settings.
1518 """
1619 self .pg_restore_exe : str | None = kwargs .get ("pg_restore_exe" ) or os .getenv (
1720 "PG_RESTORE_EXE"
@@ -43,27 +46,49 @@ def __init__(self, **kwargs):
4346 "parameters must be a list of dictionaries or MigrationParameterDefintion instances"
4447 )
4548
46- def get (self , key , default = None ):
47- """
48- Get a configuration value by key, with an optional default.
49- """
50- return getattr (self , key , default )
49+ # def get(self, key, default=None) -> any:
50+ # """
51+ # Get a configuration value by key, with an optional default.
52+ # This method allows dynamic retrieval of attributes from the PumConfig instance.
53+ # Args:
54+ # key (str): The name of the attribute to retrieve.
55+ # default: The default value to return if the attribute does not exist.
56+ # Returns:
57+ # any: The value of the attribute, or the default value if the attribute does not exist.
58+ # """
59+ # return getattr(self, key, default)
5160
52- def set (self , key , value ):
53- """
54- Set a configuration value by key.
55- """
56- setattr (self , key , value )
61+ # def set(self, key, value):
62+ # """
63+ # Set a configuration value by key.
64+ # This method allows dynamic setting of attributes on the PumConfig instance.
65+
66+ # Args:
67+ # key (str): The name of the attribute to set.
68+ # value: The value to assign to the attribute.
69+ # Raises:
70+ # AttributeError: If the attribute does not exist.
71+ # """
72+ # setattr(self, key, value)
5773
58- def parameters (self ):
74+ def parameters (self ) -> dict [ str , MigrationParameterDefintion ] :
5975 """
60- Get all changelogs parameters as a dictionary.
76+ Get all migration parameters as a dictionary.
77+
78+ Returns:
79+ dict[str, MigrationParameterDefintion]: A dictionary of migration parameters.
80+ The keys are parameter names, and the values are MigrationParameterDefintion instances.
6181 """
6282 return self .parameter_definitions
6383
64- def parameter (self , name ):
84+ def parameter (self , name ) -> MigrationParameterDefintion :
6585 """
66- Get a specific changelog parameter by name.
86+ Get a specific migration parameter by name.
87+
88+ Returns:
89+ MigrationParameterDefintion: The migration parameter definition.
90+ Raises:
91+ KeyError: If the parameter name does not exist.
6792 """
6893 return self .parameter_definitions [name ]
6994
0 commit comments