Example #1
0
 def execute(self, query):
     functions = {
         'fetch': self.fetch,
         'calculate': self.calculate
     }
     grammar = make_grammar(self.GRAMMAR, functions)
     return grammar(query).expr()
Example #2
0
 def execute(self, query):
     functions = {'fetch': self.fetch, 'calculate': self.calculate}
     grammar = make_grammar(self.GRAMMAR, functions)
     return grammar(query).expr()
Example #3
0
            if key in key_group:
                raise Duplicated.in_group(key, subgroup)

            key_group[key] = key_group = {}

        for key, value in values:
            if key in key_group:
                raise Duplicated.in_group(key, subgroup)
            key_group[key] = value

    return doc


_TOMLParser = make_grammar(
    toml_grammar,
    bindings={"document" : document, "datetime" : datetime.datetime},
    name="TOMLParser",
    unwrap=True,
)


class TOMLParser(_TOMLParser):
    """
    A TOML parser.

    """

    def __init__(self, toml, homogeneous_arrays=True):
        """
        Initialize me.

        :argument str toml: some TOML
Example #4
0
File: core.py Project: Julian/pb
@attributes(
    [
        Attribute(name="name"),
        Attribute(name="fields", default_factory=list),
    ],
)
class Message(object):
    pass


@attributes(
    [
        Attribute(name="name"),
        Attribute(name="type"),
    ],
)
class Field(object):
    pass


_GRAMMAR = make_grammar(
    source=pkgutil.get_data(__package__, "protobuf.parsley"),
    bindings={
        "Protobuf": Protobuf,
        "Message": Message,
        "Field": Field,
        "types": types,
    },
)