diff options
author | Benjamin Schubert <contact@benschubert.me> | 2019-05-20 22:01:10 +0100 |
---|---|---|
committer | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-05-22 18:40:03 +0100 |
commit | 251e53a83bbe6df8f303a03d3225260c6beb9f1a (patch) | |
tree | 588016160112f6685b7b54a93d679ff7aa3830d6 | |
parent | 0d6970dd04e952296200b8857f29948f24b4e78f (diff) | |
download | buildstream-251e53a83bbe6df8f303a03d3225260c6beb9f1a.tar.gz |
WIP: Cythonize ProvenanceInformation
-rw-r--r-- | src/buildstream/_yaml.pyx | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/buildstream/_yaml.pyx b/src/buildstream/_yaml.pyx index 204acf048..f261e4111 100644 --- a/src/buildstream/_yaml.pyx +++ b/src/buildstream/_yaml.pyx @@ -90,21 +90,16 @@ _SYNTHETIC_COUNTER = count(start=-1, step=-1) # Returned from node_get_provenance -class ProvenanceInformation: - - __slots__ = ( - "filename", - "shortname", - "displayname", - "line", - "col", - "toplevel", - "node", - "project", - "is_synthetic", - ) - - def __init__(self, nodeish): +cdef class ProvenanceInformation: + + cdef public Node node + cdef str displayname + cdef public str filename, shortname + cdef public int col, line + cdef public object project, toplevel + cdef public bint is_synthetic + + def __cinit__(self, Node nodeish): self.node = nodeish if (nodeish is None) or (nodeish.file_index is None): self.filename = "" @@ -1231,7 +1226,7 @@ def _list_final_assertions(Node values): # Note that dashes are generally preferred for variable names and # usage in YAML, but things such as option names which will be # evaluated with jinja2 cannot use dashes. -def assert_symbol_name(object provenance, str symbol_name, str purpose, *, bint allow_dashes=True): +def assert_symbol_name(ProvenanceInformation provenance, str symbol_name, str purpose, *, bint allow_dashes=True): cdef str valid_chars = string.digits + string.ascii_letters + '_' if allow_dashes: valid_chars += '-' |