bittensor.config
#
Implementation of the config class, which manages the config of different bittensor modules.
Module Contents#
Classes#
Implementation of the config class, which manages the config of different bittensor modules. |
|
A Config with a set of default values. |
Attributes#
- class bittensor.config.config(parser=None, args=None, strict=False, default=None)#
Bases:
munch.DefaultMunch
Implementation of the config class, which manages the config of different bittensor modules.
- Parameters:
parser (argparse.ArgumentParser) –
args (Optional[List[str]]) –
strict (bool) –
default (Optional[Any]) –
- __is_set: Dict[str, bool]#
Translates the passed parser into a nested Bittensor config. :param parser: Command line parser object. :type parser: argparse.ArgumentParser :param strict: If true, the command line arguments are strictly parsed. :type strict: bool :param args: Command line arguments. :type args: list of str :param default: Default value for the Config. Defaults to None.
This default will be returned for attributes that are undefined.
- Returns:
Nested config object created from parser arguments.
- Return type:
- static __split_params__(params, _config)#
- Parameters:
params (argparse.Namespace) –
_config (config) –
- static __parse_args__(args, parser=None, strict=False)#
Parses the passed args use the passed parser. :param args: List of arguments to parse. :type args: List[str] :param parser: Command line parser object. :type parser: argparse.ArgumentParser :param strict: If true, the command line arguments are strictly parsed. :type strict: bool
- Returns:
Namespace object created from parser arguments.
- Return type:
Namespace
- Parameters:
args (List[str]) –
parser (argparse.ArgumentParser) –
strict (bool) –
- __repr__()#
Invertible* string-form of a Munch.
>>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') >>> print (repr(b)) Munch({'ponies': 'are pretty!', 'foo': Munch({'lol': True}), 'hello': 42}) >>> eval(repr(b)) Munch({'ponies': 'are pretty!', 'foo': Munch({'lol': True}), 'hello': 42})
>>> with_spaces = Munch({1: 2, 'a b': 9, 'c': Munch({'simple': 5})}) >>> print (repr(with_spaces)) Munch({'a b': 9, 1: 2, 'c': Munch({'simple': 5})}) >>> eval(repr(with_spaces)) Munch({'a b': 9, 1: 2, 'c': Munch({'simple': 5})})
(*) Invertible so long as collection contents are each repr-invertible.
- Return type:
- static _remove_private_keys(d)#
- update_with_kwargs(kwargs)#
Add config to self
- classmethod _merge(a, b)#
Merge two configurations recursively. If there is a conflict, the value from the second configuration will take precedence.
- merge(b)#
Merges the current config with another config.
- Parameters:
b – Another config to merge.
- classmethod merge_all(configs)#
Merge all configs in the list into one config. If there is a conflict, the value from the last configuration in the list will take precedence.
- bittensor.config.T#
- class bittensor.config.DefaultConfig(parser=None, args=None, strict=False, default=None)#
Bases:
config
A Config with a set of default values.
- Parameters:
parser (argparse.ArgumentParser) –
args (Optional[List[str]]) –
strict (bool) –
default (Optional[Any]) –
- abstract classmethod default()#
Get default config.
- Return type:
T