summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-05-20 22:01:10 +0100
committerBenjamin Schubert <contact@benschubert.me>2019-05-29 19:49:46 +0100
commit8d1022bb610364e6bad563eef05f011b0d6a17c6 (patch)
tree803e4c0748839263bfc1638913a767b74bd44dd0
parent865fbce3570fd0a07bb46e80db76d2dc9f3fa0e5 (diff)
downloadbuildstream-8d1022bb610364e6bad563eef05f011b0d6a17c6.tar.gz
_yaml: Internalize `ProvenanceInformation`
-rw-r--r--src/buildstream/_yaml.pyx27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/buildstream/_yaml.pyx b/src/buildstream/_yaml.pyx
index 9ad5b34ce..3a81595bb 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 __init__(self, Node nodeish):
self.node = nodeish
if (nodeish is None) or (nodeish.file_index is None):
self.filename = ""
@@ -1239,7 +1234,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 += '-'