INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Keyword scan for ids. | def keyword_scan_ids(self, query_id=None, query_fc=None):
'''Keyword scan for ids.
This performs a keyword scan using the query given. A keyword
scan searches for FCs with terms in each of the query's indexed
fields.
At least one of ``query_id`` or ``query_fc`` must be provided... |
Low - level keyword index scan for ids. | def index_scan_ids(self, fname, val):
'''Low-level keyword index scan for ids.
Retrieves identifiers of FCs that have a feature value
``val`` in the feature named ``fname``. Note that
``fname`` must be indexed.
:param str fname: Feature name.
:param str val: Feature val... |
Maps feature names to ES s _source field. | def _source(self, feature_names):
'''Maps feature names to ES's "_source" field.'''
if feature_names is None:
return True
elif isinstance(feature_names, bool):
return feature_names
else:
return map(lambda n: 'fc.' + n, feature_names) |
Creates ES filters for key ranges used in scanning. | def _range_filters(self, *key_ranges):
'Creates ES filters for key ranges used in scanning.'
filters = []
for s, e in key_ranges:
if isinstance(s, basestring):
s = eid(s)
if isinstance(e, basestring):
# Make the range inclusive.
... |
Create the index | def _create_index(self):
'Create the index'
try:
self.conn.indices.create(
index=self.index, timeout=60, request_timeout=60, body={
'settings': {
'number_of_shards': self.shards,
'number_of_replicas': self.re... |
Create the field type mapping. | def _create_mappings(self):
'Create the field type mapping.'
self.conn.indices.put_mapping(
index=self.index, doc_type=self.type,
timeout=60, request_timeout=60,
body={
self.type: {
'dynamic_templates': [{
'd... |
Retrieve the field mappings. Useful for debugging. | def _get_index_mappings(self):
'Retrieve the field mappings. Useful for debugging.'
maps = {}
for fname in self.indexed_features:
config = self.indexes.get(fname, {})
print(fname, config)
maps[fname_to_idx_name(fname)] = {
'type': config.get('e... |
Retrieve the field types. Useful for debugging. | def _get_field_types(self):
'Retrieve the field types. Useful for debugging.'
mapping = self.conn.indices.get_mapping(
index=self.index, doc_type=self.type)
return mapping[self.index]['mappings'][self.type]['properties'] |
Creates a disjunction for keyword scan queries. | def _fc_index_disjunction_from_query(self, query_fc, fname):
'Creates a disjunction for keyword scan queries.'
if len(query_fc.get(fname, [])) == 0:
return []
terms = query_fc[fname].keys()
disj = []
for fname in self.indexes[fname]['feature_names']:
disj... |
Take a feature collection in dict form and count its size in bytes. | def fc_bytes(self, fc_dict):
'''Take a feature collection in dict form and count its size in bytes.
'''
num_bytes = 0
for _, feat in fc_dict.iteritems():
num_bytes += len(feat)
return num_bytes |
Count bytes of all feature collections whose key satisfies one of the predicates in filter_preds. The byte counts are binned by filter predicate. | def count_bytes(self, filter_preds):
'''Count bytes of all feature collections whose key satisfies one of
the predicates in ``filter_preds``. The byte counts are binned
by filter predicate.
'''
num_bytes = defaultdict(int)
for hit in self._scan():
for filter_p... |
construct a nice looking string for an FC | def pretty_string(fc):
'''construct a nice looking string for an FC
'''
s = []
for fname, feature in sorted(fc.items()):
if isinstance(feature, StringCounter):
feature = [u'%s: %d' % (k, v)
for (k,v) in feature.most_common()]
feature = u'\n\t' + u'\... |
module_name -- > str: module name to retrieve resource libpath -- > str: shared library filename with optional path c_hdr -- > str: C - style header definitions for functions to wrap Returns -- > ( ffi lib ) | def get_lib_ffi_resource(module_name, libpath, c_hdr):
'''
module_name-->str: module name to retrieve resource
libpath-->str: shared library filename with optional path
c_hdr-->str: C-style header definitions for functions to wrap
Returns-->(ffi, lib)
Use this method when you are loading a pack... |
libpath -- > str: shared library filename with optional path c_hdr -- > str: C - style header definitions for functions to wrap Returns -- > ( ffi lib ) | def get_lib_ffi_shared(libpath, c_hdr):
'''
libpath-->str: shared library filename with optional path
c_hdr-->str: C-style header definitions for functions to wrap
Returns-->(ffi, lib)
'''
lib = SharedLibWrapper(libpath, c_hdr)
ffi = lib.ffi
return (ffi, lib) |
Actual ( lazy ) dlopen () only when an attribute is accessed | def __openlib(self):
'''
Actual (lazy) dlopen() only when an attribute is accessed
'''
if self.__getattribute__('_libloaded'):
return
libpath_list = self.__get_libres()
for p in libpath_list:
try:
libres = resource_filename(self._mo... |
Computes libpath based on whether module_name is set or not Returns -- > list of str lib paths to try | def __get_libres(self):
'''
Computes libpath based on whether module_name is set or not
Returns-->list of str lib paths to try
PEP3140: ABI version tagged .so files:
https://www.python.org/dev/peps/pep-3149/
There's still one unexplained bit: pypy adds '-' + sys._mu... |
Take care of command line options | def process_docopts(): # type: ()->None
"""
Take care of command line options
"""
arguments = docopt(__doc__, version="Find Known Secrets {0}".format(__version__))
logger.debug(arguments)
# print(arguments)
if arguments["here"]:
# all default
go()
else:
# user ... |
Gets data from a postcode.: param request: The aiohttp request. | async def api_postcode(request):
"""
Gets data from a postcode.
:param request: The aiohttp request.
"""
postcode: Optional[str] = request.match_info.get('postcode', None)
try:
coroutine = get_postcode_random() if postcode == "random" else get_postcode(postcode)
postcode: Option... |
Gets wikipedia articles near a given postcode.: param request: The aiohttp request. | async def api_nearby(request):
"""
Gets wikipedia articles near a given postcode.
:param request: The aiohttp request.
"""
postcode: Optional[str] = request.match_info.get('postcode', None)
try:
limit = int(request.match_info.get('limit', 10))
except ValueError:
raise web.HT... |
Escape the error and wrap it in a span with class error - message | def default_formatter(error):
"""Escape the error, and wrap it in a span with class ``error-message``"""
quoted = formencode.htmlfill.escape_formatter(error)
return u'<span class="error-message">{0}</span>'.format(quoted) |
Create a human - readable representation of a link on the TO - side | def pretty_to_link(inst, link):
'''
Create a human-readable representation of a link on the 'TO'-side
'''
values = ''
prefix = ''
metaclass = xtuml.get_metaclass(inst)
for name, ty in metaclass.attributes:
if name in link.key_map:
value = getattr(inst, name)
... |
Create a human - readable representation a unique identifier. | def pretty_unique_identifier(inst, identifier):
'''
Create a human-readable representation a unique identifier.
'''
values = ''
prefix = ''
metaclass = xtuml.get_metaclass(inst)
for name, ty in metaclass.attributes:
if name in metaclass.identifying_attributes:
value ... |
Check the model for uniqueness constraint violations. | def check_uniqueness_constraint(m, kind=None):
'''
Check the model for uniqueness constraint violations.
'''
if kind is None:
metaclasses = m.metaclasses.values()
else:
metaclasses = [m.find_metaclass(kind)]
res = 0
for metaclass in metaclasses:
id_map = dict()
... |
Check the model for integrity violations on an association in a particular direction. | def check_link_integrity(m, link):
'''
Check the model for integrity violations on an association in a particular direction.
'''
res = 0
for inst in link.from_metaclass.select_many():
q_set = list(link.navigate(inst))
if(len(q_set) < 1 and not link.conditional) or (
(len(q... |
Check the model for integrity violations across a subtype association. | def check_subtype_integrity(m, super_kind, rel_id):
'''
Check the model for integrity violations across a subtype association.
'''
if isinstance(rel_id, int):
rel_id = 'R%d' % rel_id
res = 0
for inst in m.select_many(super_kind):
if not xtuml.navigate_subtype(inst, rel_id):
... |
Check the model for integrity violations on association ( s ). | def check_association_integrity(m, rel_id=None):
'''
Check the model for integrity violations on association(s).
'''
if isinstance(rel_id, int):
rel_id = 'R%d' % rel_id
res = 0
for ass in m.associations:
if rel_id in [ass.rel_id, None]:
res += check_link_... |
This will exclude all of the modules from the traceback: param modules: list of modules to exclude: return: None | def skip_module(*modules):
"""
This will exclude all of the "modules" from the traceback
:param modules: list of modules to exclude
:return: None
"""
modules = (modules and isinstance(modules[0], list)) and \
modules[0] or modules
for module in modules:
if n... |
This will exclude all modules from the traceback except these modules: param modules: list of modules to report in traceback: return: None | def only_module(*modules):
"""
This will exclude all modules from the traceback except these "modules"
:param modules: list of modules to report in traceback
:return: None
"""
modules = (modules and isinstance(modules[0], list)) and \
modules[0] or modules
for module... |
This will exclude all modules that start from this path: param paths: list of str of the path of modules to exclude: return: None | def skip_path(*paths):
"""
This will exclude all modules that start from this path
:param paths: list of str of the path of modules to exclude
:return: None
"""
paths = (paths and isinstance(paths[0], list)) and paths[0] or paths
for path in paths:
if not path in SKIPPED_PAT... |
Returns a index creation function. | def feature_index(*feature_names):
'''Returns a index creation function.
Returns a valid index ``create`` function for the feature names
given. This can be used with the :meth:`Store.define_index`
method to create indexes on any combination of features in a
feature collection.
:type feature_na... |
A basic transform for strings and integers. | def basic_transform(val):
'''A basic transform for strings and integers.'''
if isinstance(val, int):
return struct.pack('>i', val)
else:
return safe_lower_utf8(val) |
x. lower (). encode ( utf - 8 ) where x can be None str or unicode | def safe_lower_utf8(x):
'''x.lower().encode('utf-8') where x can be None, str, or unicode'''
if x is None:
return None
x = x.lower()
if isinstance(x, unicode):
return x.encode('utf-8')
return x |
Retrieve a feature collection from the store. This is the same as get_many ( [ content_id ] ) | def get(self, content_id):
'''Retrieve a feature collection from the store. This is the same as
get_many([content_id])
If the feature collection does not exist ``None`` is
returned.
:type content_id: str
:rtype: :class:`dossier.fc.FeatureCollection`
'''
... |
Yield ( content_id data ) tuples for ids in list. | def get_many(self, content_id_list):
'''Yield (content_id, data) tuples for ids in list.
As with :meth:`get`, if a content_id in the list is missing,
then it is yielded with a data value of `None`.
:type content_id_list: list<str>
:rtype: yields tuple(str, :class:`dossier.fc.Fe... |
Add feature collections to the store. | def put(self, items, indexes=True):
'''Add feature collections to the store.
Given an iterable of tuples of the form
``(content_id, feature collection)``, add each to the store
and overwrite any that already exist.
This method optionally accepts a keyword argument `indexes`,
... |
Deletes all storage. | def delete_all(self):
'''Deletes all storage.
This includes every content object and all index data.
'''
self.kvl.clear_table(self.TABLE)
self.kvl.clear_table(self.INDEX_TABLE) |
Retrieve feature collections in a range of ids. | def scan(self, *key_ranges):
'''Retrieve feature collections in a range of ids.
Returns a generator of content objects corresponding to the
content identifier ranges given. `key_ranges` can be a possibly
empty list of 2-tuples, where the first element of the tuple
is the beginni... |
Retrieve content ids in a range of ids. | def scan_ids(self, *key_ranges):
'''Retrieve content ids in a range of ids.
Returns a generator of ``content_id`` corresponding to the
content identifier ranges given. `key_ranges` can be a possibly
empty list of 2-tuples, where the first element of the tuple
is the beginning of... |
Returns ids that match an indexed value. | def index_scan(self, idx_name, val):
'''Returns ids that match an indexed value.
Returns a generator of content identifiers that have an entry
in the index ``idx_name`` with value ``val`` (after index
transforms are applied).
If the index named by ``idx_name`` is not registered... |
Returns ids that match a prefix of an indexed value. | def index_scan_prefix(self, idx_name, val_prefix):
'''Returns ids that match a prefix of an indexed value.
Returns a generator of content identifiers that have an entry
in the index ``idx_name`` with prefix ``val_prefix`` (after
index transforms are applied).
If the index named... |
Returns ids that match a prefix of an indexed value and the specific key that matched the search prefix. | def index_scan_prefix_and_return_key(self, idx_name, val_prefix):
'''Returns ids that match a prefix of an indexed value, and the
specific key that matched the search prefix.
Returns a generator of (index key, content identifier) that
have an entry in the index ``idx_name`` with prefix
... |
Implementation for index_scan_prefix and index_scan_prefix_and_return_key parameterized on return value function. | def _index_scan_prefix_impl(self, idx_name, val_prefix, retfunc):
'''Implementation for index_scan_prefix and
index_scan_prefix_and_return_key, parameterized on return
value function.
retfunc gets passed a key tuple from the index:
(index name, index value, content_id)
'... |
Add an index to this store instance. | def define_index(self, idx_name, create, transform):
'''Add an index to this store instance.
Adds an index transform to the current FC store. Once an index
with name ``idx_name`` is added, it will be available in all
``index_*`` methods. Additionally, the index will be automatically
... |
Add new index values. | def _index_put(self, idx_name, *ids_and_fcs):
'''Add new index values.
Adds new index values for index ``idx_name`` for the pairs
given. Each pair should be a content identifier and a
:class:`dossier.fc.FeatureCollection`.
:type idx_name: unicode
:type ids_and_fcs: ``[(... |
Add new raw index values. | def _index_put_raw(self, idx_name, content_id, val):
'''Add new raw index values.
Adds a new index key corresponding to
``(idx_name, transform(val), content_id)``.
This method bypasses the *creation* of indexes from content
objects, but values are still transformed.
:t... |
Returns a generator of index triples. | def _index_keys_for(self, idx_name, *ids_and_fcs):
'''Returns a generator of index triples.
Returns a generator of index keys for the ``ids_and_fcs`` pairs
given. The index keys have the form ``(idx_name, idx_val,
content_id)``.
:type idx_name: unicode
:type ids_and_fcs... |
Returns index transforms for name. | def _index(self, name):
'''Returns index transforms for ``name``.
:type name: unicode
:rtype: ``{ create |--> function, transform |--> function }``
'''
name = name.decode('utf-8')
try:
return self._indexes[name]
except KeyError:
raise KeyE... |
Gets the twitter feed for a given handle.: param handle: The twitter handle.: return: A list of entries in a user s feed.: raises ApiError: When the api couldn t connect.: raises CircuitBreakerError: When the circuit breaker is open. | async def fetch_twitter(handle: str) -> List:
"""
Gets the twitter feed for a given handle.
:param handle: The twitter handle.
:return: A list of entries in a user's feed.
:raises ApiError: When the api couldn't connect.
:raises CircuitBreakerError: When the circuit breaker is open.
"""
... |
Gets wikipedia articles near a given set of coordinates.: raise ApiError: When there was an error connecting to the API. | async def fetch_nearby(lat: float, long: float, limit: int = 10) -> Optional[List[Dict]]:
"""
Gets wikipedia articles near a given set of coordinates.
:raise ApiError: When there was an error connecting to the API.
todo cache
"""
request_url = f"https://en.wikipedia.org/w/api.php?action=query" ... |
Execute shell command and return stdout txt: param command:: return: | def execute_get_text(command): # type: (str) ->str
"""
Execute shell command and return stdout txt
:param command:
:return:
"""
try:
completed = subprocess.run(
command,
check=True,
shell=True,
stdout=subprocess.PIPE,
stderr=su... |
If a task succeeds & is re - run and didn t change we might not want to re - run it if it depends * only * on source code: return: | def has_source_code_tree_changed(self):
"""
If a task succeeds & is re-run and didn't change, we might not
want to re-run it if it depends *only* on source code
:return:
"""
global CURRENT_HASH
directory = self.where
# if CURRENT_HASH is None:
# p... |
Check if a package name exists on pypi. | def check_pypi_name(pypi_package_name, pypi_registry_host=None):
"""
Check if a package name exists on pypi.
TODO: Document the Registry URL construction.
It may not be obvious how pypi_package_name and pypi_registry_host are used
I'm appending the simple HTTP API parts of the registry stan... |
Adds direction to the element | def add_direction(value, arg=u"rtl_only"):
"""Adds direction to the element
:arguments:
arg
* rtl_only: Add the direction only in case of a
right-to-left language (default)
* both: add the direction in both case
* ltr_only: Add the direction only in cas... |
Gets a postcode object from the lat and long.: param lat: The latitude to look up.: param long: The longitude to look up.: return: The mapping corresponding to the lat and long or none if the postcode does not exist.: raises ApiError: When there was an error connecting to the API.: raises CircuitBreakerError: When the ... | async def fetch_postcodes_from_coordinates(lat: float, long: float) -> Optional[List[Postcode]]:
"""
Gets a postcode object from the lat and long.
:param lat: The latitude to look up.
:param long: The longitude to look up.
:return: The mapping corresponding to the lat and long or none if the postcod... |
get the xsd name of a S_DT | def get_type_name(s_dt):
'''
get the xsd name of a S_DT
'''
s_cdt = nav_one(s_dt).S_CDT[17]()
if s_cdt and s_cdt.Core_Typ in range(1, 6):
return s_dt.Name
s_edt = nav_one(s_dt).S_EDT[17]()
if s_edt:
return s_dt.Name
s_udt = nav_one(s_dt).S_UDT[17]()
if s_udt... |
Get the the referred attribute. | def get_refered_attribute(o_attr):
'''
Get the the referred attribute.
'''
o_attr_ref = nav_one(o_attr).O_RATTR[106].O_BATTR[113].O_ATTR[106]()
if o_attr_ref:
return get_refered_attribute(o_attr_ref)
else:
return o_attr |
Build an xsd simpleType out of a S_CDT. | def build_core_type(s_cdt):
'''
Build an xsd simpleType out of a S_CDT.
'''
s_dt = nav_one(s_cdt).S_DT[17]()
if s_dt.name == 'void':
type_name = None
elif s_dt.name == 'boolean':
type_name = 'xs:boolean'
elif s_dt.name == 'integer':
type_name = 'xs:inte... |
Build an xsd simpleType out of a S_EDT. | def build_enum_type(s_edt):
'''
Build an xsd simpleType out of a S_EDT.
'''
s_dt = nav_one(s_edt).S_DT[17]()
enum = ET.Element('xs:simpleType', name=s_dt.name)
enum_list = ET.SubElement(enum, 'xs:restriction', base='xs:string')
first_filter = lambda selected: not nav_one(selected).S_ENU... |
Build an xsd complexType out of a S_SDT. | def build_struct_type(s_sdt):
'''
Build an xsd complexType out of a S_SDT.
'''
s_dt = nav_one(s_sdt).S_DT[17]()
struct = ET.Element('xs:complexType', name=s_dt.name)
first_filter = lambda selected: not nav_one(selected).S_MBR[46, 'succeeds']()
s_mbr = nav_any(s_sdt).S_MBR[44](first... |
Build an xsd simpleType out of a S_UDT. | def build_user_type(s_udt):
'''
Build an xsd simpleType out of a S_UDT.
'''
s_dt_user = nav_one(s_udt).S_DT[17]()
s_dt_base = nav_one(s_udt).S_DT[18]()
base_name = get_type_name(s_dt_base)
if base_name:
user = ET.Element('xs:simpleType', name=s_dt_user.name)
ET.SubElemen... |
Build a partial xsd tree out of a S_DT and its sub types S_CDT S_EDT S_SDT and S_UDT. | def build_type(s_dt):
'''
Build a partial xsd tree out of a S_DT and its sub types S_CDT, S_EDT, S_SDT and S_UDT.
'''
s_cdt = nav_one(s_dt).S_CDT[17]()
if s_cdt:
return build_core_type(s_cdt)
s_edt = nav_one(s_dt).S_EDT[17]()
if s_edt:
return build_enum_type(s_edt)
... |
Build an xsd complex element out of a O_OBJ including its O_ATTR. | def build_class(o_obj):
'''
Build an xsd complex element out of a O_OBJ, including its O_ATTR.
'''
cls = ET.Element('xs:element', name=o_obj.key_lett, minOccurs='0', maxOccurs='unbounded')
attributes = ET.SubElement(cls, 'xs:complexType')
for o_attr in nav_many(o_obj).O_ATTR[102]():
o_at... |
Build an xsd complex element out of a C_C including its packaged S_DT and O_OBJ. | def build_component(m, c_c):
'''
Build an xsd complex element out of a C_C, including its packaged S_DT and O_OBJ.
'''
component = ET.Element('xs:element', name=c_c.name)
classes = ET.SubElement(component, 'xs:complexType')
classes = ET.SubElement(classes, 'xs:sequence')
scope_filt... |
Build an xsd schema from a bridgepoint component. | def build_schema(m, c_c):
'''
Build an xsd schema from a bridgepoint component.
'''
schema = ET.Element('xs:schema')
schema.set('xmlns:xs', 'http://www.w3.org/2001/XMLSchema')
global_filter = lambda selected: ooaofooa.is_global(selected)
for s_dt in m.select_many('S_DT', global_filter):
... |
Indent an xml string with four spaces and add an additional line break after each node. | def prettify(xml_string):
'''
Indent an xml string with four spaces, and add an additional line break after each node.
'''
reparsed = xml.dom.minidom.parseString(xml_string)
return reparsed.toprettyxml(indent=" ") |
Gets the full list of bikes from the bikeregister site. The data is hidden behind a form post request and so we need to extract an xsrf and session token with bs4. | async def fetch_bikes() -> List[dict]:
"""
Gets the full list of bikes from the bikeregister site.
The data is hidden behind a form post request and so
we need to extract an xsrf and session token with bs4.
todo add pytest tests
:return: All the currently registered bikes.
:raise ApiError:... |
set positional information on a node | def set_positional_info(node, p):
'''
set positional information on a node
'''
node.position = Position()
node.position.label = p.lexer.label
node.position.start_stream = p.lexpos(1)
node.position.start_line = p.lineno(1)
node.position.start_column = find_column(p.lexer.lexdata,
... |
decorator for adding positional information to returning nodes | def track_production(f):
'''
decorator for adding positional information to returning nodes
'''
@wraps(f)
def wrapper(self, p):
r = f(self, p)
node = p[0]
if isinstance(node, Node) and len(p) > 1:
set_positional_info(node, p)
return r
return wrapp... |
r \/ \/. * \ n | def t_SL_STRING(self, t):
r'\/\/.*\n'
t.lexer.lineno += t.value.count('\n')
t.endlexpos = t.lexpos + len(t.value) |
r \ [ ^ \ ] * \ | def t_TICKED_PHRASE(self, t):
r"\'[^\']*\'"
t.endlexpos = t.lexpos + len(t.value)
return t |
r [ ^ \ n ] * | def t_STRING(self, t):
r'"[^"\n]*"'
t.endlexpos = t.lexpos + len(t.value)
return t |
r ( ?i ) end [ \ s ] + for | def t_END_FOR(self, t):
r"(?i)end[\s]+for"
t.endlexpos = t.lexpos + len(t.value)
return t |
r ( ?i ) end [ \ s ] + if | def t_END_IF(self, t):
r"(?i)end[\s]+if"
t.endlexpos = t.lexpos + len(t.value)
return t |
r ( ?i ) end [ \ s ] + while | def t_END_WHILE(self, t):
r"(?i)end[\s]+while"
t.endlexpos = t.lexpos + len(t.value)
return t |
r ( [ 0 - 9a - zA - Z_ ] ) + ( ? =:: ) | def t_NAMESPACE(self, t):
r"([0-9a-zA-Z_])+(?=::)"
t.endlexpos = t.lexpos + len(t.value)
return t |
r [ a - zA - Z_ ] [ 0 - 9a - zA - Z_ ] * | [ a - zA - Z ] [ 0 - 9a - zA - Z_ ] * [ 0 - 9a - zA - Z_ ] + | def t_ID(self, t):
r"[a-zA-Z_][0-9a-zA-Z_]*|[a-zA-Z][0-9a-zA-Z_]*[0-9a-zA-Z_]+"
t.endlexpos = t.lexpos + len(t.value)
value = t.value.upper()
if value in self.keywords:
t.type = value
return t |
r:: | def t_DOUBLECOLON(self, t):
r"::"
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ = \ = | def t_DOUBLEEQUAL(self, t):
r"\=\="
t.endlexpos = t.lexpos + len(t.value)
return t |
r ! \ = | def t_NOTEQUAL(self, t):
r"!\="
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ - \ > | def t_ARROW(self, t):
r"\-\>"
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ < \ = | def t_LE(self, t):
r"\<\="
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ > \ = | def t_GE(self, t):
r"\>\="
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ = | def t_EQUAL(self, t):
r"\="
t.endlexpos = t.lexpos + len(t.value)
return t |
r \. | def t_DOT(self, t):
r"\."
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ * | def t_TIMES(self, t):
r"\*"
t.endlexpos = t.lexpos + len(t.value)
return t |
r: | def t_COLON(self, t):
r":"
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ [ | def t_LSQBR(self, t):
r"\["
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ ] | def t_RSQBR(self, t):
r"\]"
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ ? | def t_QMARK(self, t):
r"\?"
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ < | def t_LESSTHAN(self, t):
r"\<"
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ > | def t_GT(self, t):
r"\>"
t.endlexpos = t.lexpos + len(t.value)
return t |
r \ + | def t_PLUS(self, t):
r"\+"
t.endlexpos = t.lexpos + len(t.value)
return t |
r/ | def t_DIV(self, t):
r"/"
t.endlexpos = t.lexpos + len(t.value)
return t |
r % | def t_MOD(self, t):
r"%"
t.endlexpos = t.lexpos + len(t.value)
return t |
statement_list: statement SEMICOLON statement_list | def p_statement_list_1(self, p):
'''statement_list : statement SEMICOLON statement_list'''
p[0] = p[3]
if p[1] is not None:
p[0].children.insert(0, p[1]) |
statement_list: statement SEMICOLON | def p_statement_list_2(self, p):
'''statement_list : statement SEMICOLON'''
p[0] = StatementListNode()
if p[1] is not None:
p[0].children.insert(0, p[1]) |
statement: BRIDGE variable_access EQUAL implicit_invocation | def p_bridge_assignment_statement(self, p):
'''statement : BRIDGE variable_access EQUAL implicit_invocation'''
p[4].__class__ = BridgeInvocationNode
p[0] = AssignmentNode(variable_access=p[2],
expression=p[4]) |
statement: TRANSFORM variable_access EQUAL implicit_invocation | def p_class_invocation_assignment_statement(self, p):
'''statement : TRANSFORM variable_access EQUAL implicit_invocation'''
p[4].__class__ = ClassInvocationNode
p[0] = AssignmentNode(variable_access=p[2],
expression=p[4]) |
statement: SEND variable_access EQUAL implicit_invocation | def p_port_invocation_assignment_statement(self, p):
'''statement : SEND variable_access EQUAL implicit_invocation'''
p[4].__class__ = PortInvocationNode
p[0] = AssignmentNode(variable_access=p[2],
expression=p[4]) |
statement: SEND namespace DOUBLECOLON identifier LPAREN parameter_list RPAREN TO expression | def p_port_event_generation(self, p):
'''statement : SEND namespace DOUBLECOLON identifier LPAREN parameter_list RPAREN TO expression'''
p[0] = GeneratePortEventNode(port_name=p[2],
action_name=p[4],
parameter_list=p[6],
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.