How to use the yay.ast.Scalarish function in yay

To help you get started, we’ve selected a few yay examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yaybu / yaybu / yaybu / core / argument.py View on Github external
)


# we abuse urlparse for our parsing needs
urlparse.uses_netloc.append("package")


class Property(object):

    def __init__(self, klass, **kwargs):
        self.klass = klass
        self.kwargs = kwargs
        self.__doc__ = kwargs.pop("help", None)


class Argument(ast.Pythonic, ast.Scalarish, ast.AST):

    """
    Adds a property descriptor to a class that automatically validates and
    resolves members of a yay AST node.

    It is immutable.
    """

    def __init__(self, resource, node, **kwargs):
        super(Argument, self).__init__()
        self.resource = resource
        self.node = node
        self.anchor = node.inner.anchor
        self.parent = node.inner
        self.default = kwargs.pop("default", '')
        self.__doc__ = kwargs.pop("help", None)