PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/thread-self/root/proc/self/root/proc/self/root/opt/saltstack/salt/extras-3.10/rads/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/thread-self/root/proc/self/root/proc/self/root/opt/saltstack/salt/extras-3.10/rads/_yaml.py

"""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)