/opt/imh-python/lib/python3.9/site-packages/rads
NameSizeModeActions
__pycache__/-0755rm
color.py22860644editdlrm
rads.json8560644editdlrm
semaphore.py37790644editdlrm
ssh.py39350644editdlrm
vz.py179710644editdlrm
_email.py27810644editdlrm
_fsquota.py80360644editdlrm
_globals.py31030644editdlrm
_input.py26610644editdlrm
_locking.py20750644editdlrm
_logging.py67140644editdlrm
_sa.py31410644editdlrm
_users.py186900644editdlrm
_yaml.py13120644editdlrm
__init__.py49090644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/rads/_yaml.py (1312B)
"""Helpers for yaml parsing""" import yaml class DumbYamlConstructor(yaml.constructor.SafeConstructor): """Subclass of SafeYamlConstructor that leaves bool/null/int as strs""" ignored_tags = [ 'tag:yaml.org,2002:bool', 'tag:yaml.org,2002:null', 'tag:yaml.org,2002:int', ] def __init__(self): super().__init__() for tag in self.ignored_tags: self.add_constructor(tag, DumbYamlConstructor.return_unchanged) def return_unchanged(self, node): """Handler for scalars that shouldn't be converted""" return self.construct_scalar(node) class DumbYamlLoader( yaml.reader.Reader, yaml.scanner.Scanner, yaml.parser.Parser, yaml.composer.Composer, DumbYamlConstructor, yaml.resolver.Resolver, ): """Custom YAML loader that leaves bool/null/int as strs, for use parsing cPanel's /etc/ YAML files Example: yaml.load(file_handle, rads.DumbYamlLoader) """ __module__ = 'rads' def __init__(self, stream): yaml.reader.Reader.__init__(self, stream) yaml.scanner.Scanner.__init__(self) yaml.parser.Parser.__init__(self) yaml.composer.Composer.__init__(self) DumbYamlConstructor.__init__(self) yaml.resolver.Resolver.__init__(self)