partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | ElasticStore.keyword_scan_ids | 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.
If ``query_fc`` is ``None``, then the query is retrieved
... | dossier/store/elastic.py | 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... | 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... | [
"Keyword",
"scan",
"for",
"ids",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L420-L438 | [
"def",
"keyword_scan_ids",
"(",
"self",
",",
"query_id",
"=",
"None",
",",
"query_fc",
"=",
"None",
")",
":",
"it",
"=",
"self",
".",
"_keyword_scan",
"(",
"query_id",
",",
"query_fc",
",",
"feature_names",
"=",
"False",
")",
"for",
"hit",
"in",
"it",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore.index_scan_ids | 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 value.
:rtype: Iterable of ``content_id`` | dossier/store/elastic.py | 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... | 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... | [
"Low",
"-",
"level",
"keyword",
"index",
"scan",
"for",
"ids",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L440-L464 | [
"def",
"index_scan_ids",
"(",
"self",
",",
"fname",
",",
"val",
")",
":",
"disj",
"=",
"[",
"]",
"for",
"fname2",
"in",
"self",
".",
"indexes",
"[",
"fname",
"]",
"[",
"'feature_names'",
"]",
":",
"disj",
".",
"append",
"(",
"{",
"'term'",
":",
"{"... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore._source | Maps feature names to ES's "_source" field. | dossier/store/elastic.py | 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) | 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) | [
"Maps",
"feature",
"names",
"to",
"ES",
"s",
"_source",
"field",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L642-L649 | [
"def",
"_source",
"(",
"self",
",",
"feature_names",
")",
":",
"if",
"feature_names",
"is",
"None",
":",
"return",
"True",
"elif",
"isinstance",
"(",
"feature_names",
",",
"bool",
")",
":",
"return",
"feature_names",
"else",
":",
"return",
"map",
"(",
"lam... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore._range_filters | Creates ES filters for key ranges used in scanning. | dossier/store/elastic.py | 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.
... | 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.
... | [
"Creates",
"ES",
"filters",
"for",
"key",
"ranges",
"used",
"in",
"scanning",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L651-L674 | [
"def",
"_range_filters",
"(",
"self",
",",
"*",
"key_ranges",
")",
":",
"filters",
"=",
"[",
"]",
"for",
"s",
",",
"e",
"in",
"key_ranges",
":",
"if",
"isinstance",
"(",
"s",
",",
"basestring",
")",
":",
"s",
"=",
"eid",
"(",
"s",
")",
"if",
"isi... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore._create_index | Create the index | dossier/store/elastic.py | 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... | 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",
"index"
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L676-L689 | [
"def",
"_create_index",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"conn",
".",
"indices",
".",
"create",
"(",
"index",
"=",
"self",
".",
"index",
",",
"timeout",
"=",
"60",
",",
"request_timeout",
"=",
"60",
",",
"body",
"=",
"{",
"'settings'",... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore._create_mappings | Create the field type mapping. | dossier/store/elastic.py | 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... | 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... | [
"Create",
"the",
"field",
"type",
"mapping",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L691-L720 | [
"def",
"_create_mappings",
"(",
"self",
")",
":",
"self",
".",
"conn",
".",
"indices",
".",
"put_mapping",
"(",
"index",
"=",
"self",
".",
"index",
",",
"doc_type",
"=",
"self",
".",
"type",
",",
"timeout",
"=",
"60",
",",
"request_timeout",
"=",
"60",... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore._get_index_mappings | Retrieve the field mappings. Useful for debugging. | dossier/store/elastic.py | 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... | 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",
"mappings",
".",
"Useful",
"for",
"debugging",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L722-L739 | [
"def",
"_get_index_mappings",
"(",
"self",
")",
":",
"maps",
"=",
"{",
"}",
"for",
"fname",
"in",
"self",
".",
"indexed_features",
":",
"config",
"=",
"self",
".",
"indexes",
".",
"get",
"(",
"fname",
",",
"{",
"}",
")",
"print",
"(",
"fname",
",",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore._get_field_types | Retrieve the field types. Useful for debugging. | dossier/store/elastic.py | 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'] | 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'] | [
"Retrieve",
"the",
"field",
"types",
".",
"Useful",
"for",
"debugging",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L741-L745 | [
"def",
"_get_field_types",
"(",
"self",
")",
":",
"mapping",
"=",
"self",
".",
"conn",
".",
"indices",
".",
"get_mapping",
"(",
"index",
"=",
"self",
".",
"index",
",",
"doc_type",
"=",
"self",
".",
"type",
")",
"return",
"mapping",
"[",
"self",
".",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore._fc_index_disjunction_from_query | Creates a disjunction for keyword scan queries. | dossier/store/elastic.py | 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... | 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... | [
"Creates",
"a",
"disjunction",
"for",
"keyword",
"scan",
"queries",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L782-L791 | [
"def",
"_fc_index_disjunction_from_query",
"(",
"self",
",",
"query_fc",
",",
"fname",
")",
":",
"if",
"len",
"(",
"query_fc",
".",
"get",
"(",
"fname",
",",
"[",
"]",
")",
")",
"==",
"0",
":",
"return",
"[",
"]",
"terms",
"=",
"query_fc",
"[",
"fnam... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore.fc_bytes | Take a feature collection in dict form and count its size in bytes. | dossier/store/elastic.py | 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 | 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 | [
"Take",
"a",
"feature",
"collection",
"in",
"dict",
"form",
"and",
"count",
"its",
"size",
"in",
"bytes",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L820-L827 | [
"def",
"fc_bytes",
"(",
"self",
",",
"fc_dict",
")",
":",
"num_bytes",
"=",
"0",
"for",
"_",
",",
"feat",
"in",
"fc_dict",
".",
"iteritems",
"(",
")",
":",
"num_bytes",
"+=",
"len",
"(",
"feat",
")",
"return",
"num_bytes"
] | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | ElasticStore.count_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. | dossier/store/elastic.py | 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... | 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... | [
"Count",
"bytes",
"of",
"all",
"feature",
"collections",
"whose",
"key",
"satisfies",
"one",
"of",
"the",
"predicates",
"in",
"filter_preds",
".",
"The",
"byte",
"counts",
"are",
"binned",
"by",
"filter",
"predicate",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L829-L840 | [
"def",
"count_bytes",
"(",
"self",
",",
"filter_preds",
")",
":",
"num_bytes",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"hit",
"in",
"self",
".",
"_scan",
"(",
")",
":",
"for",
"filter_pred",
"in",
"filter_preds",
":",
"if",
"filter_pred",
"(",
"did",... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | pretty_string | construct a nice looking string for an FC | dossier/store/run.py | 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'\... | 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'\... | [
"construct",
"a",
"nice",
"looking",
"string",
"for",
"an",
"FC"
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/run.py#L167-L177 | [
"def",
"pretty_string",
"(",
"fc",
")",
":",
"s",
"=",
"[",
"]",
"for",
"fname",
",",
"feature",
"in",
"sorted",
"(",
"fc",
".",
"items",
"(",
")",
")",
":",
"if",
"isinstance",
"(",
"feature",
",",
"StringCounter",
")",
":",
"feature",
"=",
"[",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | get_lib_ffi_resource | 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 package-specific shared library
If you want to load a system-wide s... | cffi_utils/sowrapper.py | 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... | 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... | [
"module_name",
"--",
">",
"str",
":",
"module",
"name",
"to",
"retrieve",
"resource",
"libpath",
"--",
">",
"str",
":",
"shared",
"library",
"filename",
"with",
"optional",
"path",
"c_hdr",
"--",
">",
"str",
":",
"C",
"-",
"style",
"header",
"definitions",... | sundarnagarajan/cffi_utils | python | https://github.com/sundarnagarajan/cffi_utils/blob/1d5ab2d2fcb962372228033106bc23f1d73d31fa/cffi_utils/sowrapper.py#L48-L61 | [
"def",
"get_lib_ffi_resource",
"(",
"module_name",
",",
"libpath",
",",
"c_hdr",
")",
":",
"lib",
"=",
"SharedLibWrapper",
"(",
"libpath",
",",
"c_hdr",
",",
"module_name",
"=",
"module_name",
")",
"ffi",
"=",
"lib",
".",
"ffi",
"return",
"(",
"ffi",
",",
... | 1d5ab2d2fcb962372228033106bc23f1d73d31fa |
test | get_lib_ffi_shared | libpath-->str: shared library filename with optional path
c_hdr-->str: C-style header definitions for functions to wrap
Returns-->(ffi, lib) | cffi_utils/sowrapper.py | 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) | 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) | [
"libpath",
"--",
">",
"str",
":",
"shared",
"library",
"filename",
"with",
"optional",
"path",
"c_hdr",
"--",
">",
"str",
":",
"C",
"-",
"style",
"header",
"definitions",
"for",
"functions",
"to",
"wrap",
"Returns",
"--",
">",
"(",
"ffi",
"lib",
")"
] | sundarnagarajan/cffi_utils | python | https://github.com/sundarnagarajan/cffi_utils/blob/1d5ab2d2fcb962372228033106bc23f1d73d31fa/cffi_utils/sowrapper.py#L64-L72 | [
"def",
"get_lib_ffi_shared",
"(",
"libpath",
",",
"c_hdr",
")",
":",
"lib",
"=",
"SharedLibWrapper",
"(",
"libpath",
",",
"c_hdr",
")",
"ffi",
"=",
"lib",
".",
"ffi",
"return",
"(",
"ffi",
",",
"lib",
")"
] | 1d5ab2d2fcb962372228033106bc23f1d73d31fa |
test | SharedLibWrapper.__openlib | Actual (lazy) dlopen() only when an attribute is accessed | cffi_utils/sowrapper.py | 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... | 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... | [
"Actual",
"(",
"lazy",
")",
"dlopen",
"()",
"only",
"when",
"an",
"attribute",
"is",
"accessed"
] | sundarnagarajan/cffi_utils | python | https://github.com/sundarnagarajan/cffi_utils/blob/1d5ab2d2fcb962372228033106bc23f1d73d31fa/cffi_utils/sowrapper.py#L104-L140 | [
"def",
"__openlib",
"(",
"self",
")",
":",
"if",
"self",
".",
"__getattribute__",
"(",
"'_libloaded'",
")",
":",
"return",
"libpath_list",
"=",
"self",
".",
"__get_libres",
"(",
")",
"for",
"p",
"in",
"libpath_list",
":",
"try",
":",
"libres",
"=",
"reso... | 1d5ab2d2fcb962372228033106bc23f1d73d31fa |
test | SharedLibWrapper.__get_libres | 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._multiarch()
at the end (looks like 'x8... | cffi_utils/sowrapper.py | 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... | 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... | [
"Computes",
"libpath",
"based",
"on",
"whether",
"module_name",
"is",
"set",
"or",
"not",
"Returns",
"--",
">",
"list",
"of",
"str",
"lib",
"paths",
"to",
"try"
] | sundarnagarajan/cffi_utils | python | https://github.com/sundarnagarajan/cffi_utils/blob/1d5ab2d2fcb962372228033106bc23f1d73d31fa/cffi_utils/sowrapper.py#L153-L207 | [
"def",
"__get_libres",
"(",
"self",
")",
":",
"if",
"self",
".",
"_module_name",
"is",
"None",
":",
"return",
"[",
"]",
"ending",
"=",
"'.so'",
"base",
"=",
"self",
".",
"_libpath",
".",
"rsplit",
"(",
"ending",
",",
"1",
")",
"[",
"0",
"]",
"abi",... | 1d5ab2d2fcb962372228033106bc23f1d73d31fa |
test | process_docopts | Take care of command line options | find_known_secrets/main.py | 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 ... | 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 ... | [
"Take",
"care",
"of",
"command",
"line",
"options"
] | matthewdeanmartin/find_known_secrets | python | https://github.com/matthewdeanmartin/find_known_secrets/blob/f25735c1ab4512bad85ade33af7021f6fac1d13b/find_known_secrets/main.py#L40-L57 | [
"def",
"process_docopts",
"(",
")",
":",
"# type: ()->None",
"arguments",
"=",
"docopt",
"(",
"__doc__",
",",
"version",
"=",
"\"Find Known Secrets {0}\"",
".",
"format",
"(",
"__version__",
")",
")",
"logger",
".",
"debug",
"(",
"arguments",
")",
"# print(argum... | f25735c1ab4512bad85ade33af7021f6fac1d13b |
test | api_postcode | Gets data from a postcode.
:param request: The aiohttp request. | hyperion/api/geo.py | 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... | 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",
"data",
"from",
"a",
"postcode",
".",
":",
"param",
"request",
":",
"The",
"aiohttp",
"request",
"."
] | arlyon/hyperion | python | https://github.com/arlyon/hyperion/blob/d8de0388ba98b85ce472e0f49ac18fecb14d3343/hyperion/api/geo.py#L13-L31 | [
"async",
"def",
"api_postcode",
"(",
"request",
")",
":",
"postcode",
":",
"Optional",
"[",
"str",
"]",
"=",
"request",
".",
"match_info",
".",
"get",
"(",
"'postcode'",
",",
"None",
")",
"try",
":",
"coroutine",
"=",
"get_postcode_random",
"(",
")",
"if... | d8de0388ba98b85ce472e0f49ac18fecb14d3343 |
test | api_nearby | Gets wikipedia articles near a given postcode.
:param request: The aiohttp request. | hyperion/api/geo.py | 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... | 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... | [
"Gets",
"wikipedia",
"articles",
"near",
"a",
"given",
"postcode",
".",
":",
"param",
"request",
":",
"The",
"aiohttp",
"request",
"."
] | arlyon/hyperion | python | https://github.com/arlyon/hyperion/blob/d8de0388ba98b85ce472e0f49ac18fecb14d3343/hyperion/api/geo.py#L34-L63 | [
"async",
"def",
"api_nearby",
"(",
"request",
")",
":",
"postcode",
":",
"Optional",
"[",
"str",
"]",
"=",
"request",
".",
"match_info",
".",
"get",
"(",
"'postcode'",
",",
"None",
")",
"try",
":",
"limit",
"=",
"int",
"(",
"request",
".",
"match_info"... | d8de0388ba98b85ce472e0f49ac18fecb14d3343 |
test | default_formatter | Escape the error, and wrap it in a span with class ``error-message`` | formencode_jinja2/formfill.py | 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) | 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) | [
"Escape",
"the",
"error",
"and",
"wrap",
"it",
"in",
"a",
"span",
"with",
"class",
"error",
"-",
"message"
] | Kroisse/FormEncode-Jinja2 | python | https://github.com/Kroisse/FormEncode-Jinja2/blob/5e8c97ec282bd85aa39f9ff83cf31fd27ed7b594/formencode_jinja2/formfill.py#L114-L117 | [
"def",
"default_formatter",
"(",
"error",
")",
":",
"quoted",
"=",
"formencode",
".",
"htmlfill",
".",
"escape_formatter",
"(",
"error",
")",
"return",
"u'<span class=\"error-message\">{0}</span>'",
".",
"format",
"(",
"quoted",
")"
] | 5e8c97ec282bd85aa39f9ff83cf31fd27ed7b594 |
test | pretty_to_link | Create a human-readable representation of a link on the 'TO'-side | xtuml/consistency_check.py | 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)
... | 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",
"of",
"a",
"link",
"on",
"the",
"TO",
"-",
"side"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/consistency_check.py#L31-L47 | [
"def",
"pretty_to_link",
"(",
"inst",
",",
"link",
")",
":",
"values",
"=",
"''",
"prefix",
"=",
"''",
"metaclass",
"=",
"xtuml",
".",
"get_metaclass",
"(",
"inst",
")",
"for",
"name",
",",
"ty",
"in",
"metaclass",
".",
"attributes",
":",
"if",
"name",... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | pretty_unique_identifier | Create a human-readable representation a unique identifier. | xtuml/consistency_check.py | 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 ... | 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 ... | [
"Create",
"a",
"human",
"-",
"readable",
"representation",
"a",
"unique",
"identifier",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/consistency_check.py#L68-L83 | [
"def",
"pretty_unique_identifier",
"(",
"inst",
",",
"identifier",
")",
":",
"values",
"=",
"''",
"prefix",
"=",
"''",
"metaclass",
"=",
"xtuml",
".",
"get_metaclass",
"(",
"inst",
")",
"for",
"name",
",",
"ty",
"in",
"metaclass",
".",
"attributes",
":",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | check_uniqueness_constraint | Check the model for uniqueness constraint violations. | xtuml/consistency_check.py | 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()
... | 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",
"uniqueness",
"constraint",
"violations",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/consistency_check.py#L86-L130 | [
"def",
"check_uniqueness_constraint",
"(",
"m",
",",
"kind",
"=",
"None",
")",
":",
"if",
"kind",
"is",
"None",
":",
"metaclasses",
"=",
"m",
".",
"metaclasses",
".",
"values",
"(",
")",
"else",
":",
"metaclasses",
"=",
"[",
"m",
".",
"find_metaclass",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | check_link_integrity | Check the model for integrity violations on an association in a particular direction. | xtuml/consistency_check.py | 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... | 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",
"on",
"an",
"association",
"in",
"a",
"particular",
"direction",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/consistency_check.py#L133-L149 | [
"def",
"check_link_integrity",
"(",
"m",
",",
"link",
")",
":",
"res",
"=",
"0",
"for",
"inst",
"in",
"link",
".",
"from_metaclass",
".",
"select_many",
"(",
")",
":",
"q_set",
"=",
"list",
"(",
"link",
".",
"navigate",
"(",
"inst",
")",
")",
"if",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | check_subtype_integrity | Check the model for integrity violations across a subtype association. | xtuml/consistency_check.py | 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):
... | 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",
"across",
"a",
"subtype",
"association",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/consistency_check.py#L152-L166 | [
"def",
"check_subtype_integrity",
"(",
"m",
",",
"super_kind",
",",
"rel_id",
")",
":",
"if",
"isinstance",
"(",
"rel_id",
",",
"int",
")",
":",
"rel_id",
"=",
"'R%d'",
"%",
"rel_id",
"res",
"=",
"0",
"for",
"inst",
"in",
"m",
".",
"select_many",
"(",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | check_association_integrity | Check the model for integrity violations on association(s). | xtuml/consistency_check.py | 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_... | 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_... | [
"Check",
"the",
"model",
"for",
"integrity",
"violations",
"on",
"association",
"(",
"s",
")",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/consistency_check.py#L169-L182 | [
"def",
"check_association_integrity",
"(",
"m",
",",
"rel_id",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"rel_id",
",",
"int",
")",
":",
"rel_id",
"=",
"'R%d'",
"%",
"rel_id",
"res",
"=",
"0",
"for",
"ass",
"in",
"m",
".",
"associations",
":",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | skip_module | This will exclude all of the "modules" from the traceback
:param modules: list of modules to exclude
:return: None | seaborn_logger/skip_traceback.py | 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... | 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",
"of",
"the",
"modules",
"from",
"the",
"traceback",
":",
"param",
"modules",
":",
"list",
"of",
"modules",
"to",
"exclude",
":",
"return",
":",
"None"
] | SeabornGames/Logger | python | https://github.com/SeabornGames/Logger/blob/fb8b1700557aaea8d3216bd4c4df33c302bece7f/seaborn_logger/skip_traceback.py#L17-L29 | [
"def",
"skip_module",
"(",
"*",
"modules",
")",
":",
"modules",
"=",
"(",
"modules",
"and",
"isinstance",
"(",
"modules",
"[",
"0",
"]",
",",
"list",
")",
")",
"and",
"modules",
"[",
"0",
"]",
"or",
"modules",
"for",
"module",
"in",
"modules",
":",
... | fb8b1700557aaea8d3216bd4c4df33c302bece7f |
test | only_module | This will exclude all modules from the traceback except these "modules"
:param modules: list of modules to report in traceback
:return: None | seaborn_logger/skip_traceback.py | 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... | 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",
"from",
"the",
"traceback",
"except",
"these",
"modules",
":",
"param",
"modules",
":",
"list",
"of",
"modules",
"to",
"report",
"in",
"traceback",
":",
"return",
":",
"None"
] | SeabornGames/Logger | python | https://github.com/SeabornGames/Logger/blob/fb8b1700557aaea8d3216bd4c4df33c302bece7f/seaborn_logger/skip_traceback.py#L32-L43 | [
"def",
"only_module",
"(",
"*",
"modules",
")",
":",
"modules",
"=",
"(",
"modules",
"and",
"isinstance",
"(",
"modules",
"[",
"0",
"]",
",",
"list",
")",
")",
"and",
"modules",
"[",
"0",
"]",
"or",
"modules",
"for",
"module",
"in",
"modules",
":",
... | fb8b1700557aaea8d3216bd4c4df33c302bece7f |
test | skip_path | This will exclude all modules that start from this path
:param paths: list of str of the path of modules to exclude
:return: None | seaborn_logger/skip_traceback.py | 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... | 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... | [
"This",
"will",
"exclude",
"all",
"modules",
"that",
"start",
"from",
"this",
"path",
":",
"param",
"paths",
":",
"list",
"of",
"str",
"of",
"the",
"path",
"of",
"modules",
"to",
"exclude",
":",
"return",
":",
"None"
] | SeabornGames/Logger | python | https://github.com/SeabornGames/Logger/blob/fb8b1700557aaea8d3216bd4c4df33c302bece7f/seaborn_logger/skip_traceback.py#L46-L56 | [
"def",
"skip_path",
"(",
"*",
"paths",
")",
":",
"paths",
"=",
"(",
"paths",
"and",
"isinstance",
"(",
"paths",
"[",
"0",
"]",
",",
"list",
")",
")",
"and",
"paths",
"[",
"0",
"]",
"or",
"paths",
"for",
"path",
"in",
"paths",
":",
"if",
"not",
... | fb8b1700557aaea8d3216bd4c4df33c302bece7f |
test | feature_index | 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_names: list(unicode)
:rtype: ``(val -> i... | dossier/store/store.py | 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... | 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... | [
"Returns",
"a",
"index",
"creation",
"function",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L21-L44 | [
"def",
"feature_index",
"(",
"*",
"feature_names",
")",
":",
"def",
"_",
"(",
"trans",
",",
"(",
"cid",
",",
"fc",
")",
")",
":",
"for",
"fname",
"in",
"feature_names",
":",
"feat",
"=",
"fc",
".",
"get",
"(",
"fname",
")",
"if",
"feat",
"is",
"N... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | basic_transform | A basic transform for strings and integers. | dossier/store/store.py | 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) | 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) | [
"A",
"basic",
"transform",
"for",
"strings",
"and",
"integers",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L47-L52 | [
"def",
"basic_transform",
"(",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"int",
")",
":",
"return",
"struct",
".",
"pack",
"(",
"'>i'",
",",
"val",
")",
"else",
":",
"return",
"safe_lower_utf8",
"(",
"val",
")"
] | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | safe_lower_utf8 | x.lower().encode('utf-8') where x can be None, str, or unicode | dossier/store/store.py | 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 | 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 | [
"x",
".",
"lower",
"()",
".",
"encode",
"(",
"utf",
"-",
"8",
")",
"where",
"x",
"can",
"be",
"None",
"str",
"or",
"unicode"
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L55-L62 | [
"def",
"safe_lower_utf8",
"(",
"x",
")",
":",
"if",
"x",
"is",
"None",
":",
"return",
"None",
"x",
"=",
"x",
".",
"lower",
"(",
")",
"if",
"isinstance",
"(",
"x",
",",
"unicode",
")",
":",
"return",
"x",
".",
"encode",
"(",
"'utf-8'",
")",
"retur... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.get | 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` | dossier/store/store.py | 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`
'''
... | 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`
'''
... | [
"Retrieve",
"a",
"feature",
"collection",
"from",
"the",
"store",
".",
"This",
"is",
"the",
"same",
"as",
"get_many",
"(",
"[",
"content_id",
"]",
")"
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L134-L149 | [
"def",
"get",
"(",
"self",
",",
"content_id",
")",
":",
"rows",
"=",
"list",
"(",
"self",
".",
"kvl",
".",
"get",
"(",
"self",
".",
"TABLE",
",",
"(",
"content_id",
",",
")",
")",
")",
"assert",
"len",
"(",
"rows",
")",
"<",
"2",
",",
"'more th... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.get_many | 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.FeatureCollection`) | dossier/store/store.py | 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... | 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... | [
"Yield",
"(",
"content_id",
"data",
")",
"tuples",
"for",
"ids",
"in",
"list",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L151-L167 | [
"def",
"get_many",
"(",
"self",
",",
"content_id_list",
")",
":",
"content_id_keys",
"=",
"[",
"tuplify",
"(",
"x",
")",
"for",
"x",
"in",
"content_id_list",
"]",
"for",
"row",
"in",
"self",
".",
"kvl",
".",
"get",
"(",
"self",
".",
"TABLE",
",",
"*"... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.put | 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`,
which by default is set to ``True``. When... | dossier/store/store.py | 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`,
... | 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`,
... | [
"Add",
"feature",
"collections",
"to",
"the",
"store",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L169-L211 | [
"def",
"put",
"(",
"self",
",",
"items",
",",
"indexes",
"=",
"True",
")",
":",
"# So why accept an iterable? Ideally, some day, `kvlayer.put` would",
"# accept an iterable, so we should too.",
"#",
"# But we have to transform it to a list in order to update indexes",
"# anyway. Well... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.delete_all | Deletes all storage.
This includes every content object and all index data. | dossier/store/store.py | 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) | 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) | [
"Deletes",
"all",
"storage",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L224-L230 | [
"def",
"delete_all",
"(",
"self",
")",
":",
"self",
".",
"kvl",
".",
"clear_table",
"(",
"self",
".",
"TABLE",
")",
"self",
".",
"kvl",
".",
"clear_table",
"(",
"self",
".",
"INDEX_TABLE",
")"
] | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.scan | 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 beginning of a range and the second element is ... | dossier/store/store.py | 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... | 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",
"feature",
"collections",
"in",
"a",
"range",
"of",
"ids",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L232-L253 | [
"def",
"scan",
"(",
"self",
",",
"*",
"key_ranges",
")",
":",
"# (id, id) -> ((id,), (id,))",
"key_ranges",
"=",
"[",
"(",
"tuplify",
"(",
"s",
")",
",",
"tuplify",
"(",
"e",
")",
")",
"for",
"s",
",",
"e",
"in",
"key_ranges",
"]",
"return",
"imap",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.scan_ids | 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 a range and the second element is the end
... | dossier/store/store.py | 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... | 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... | [
"Retrieve",
"content",
"ids",
"in",
"a",
"range",
"of",
"ids",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L255-L275 | [
"def",
"scan_ids",
"(",
"self",
",",
"*",
"key_ranges",
")",
":",
"# (id, id) -> ((id,), (id,))",
"key_ranges",
"=",
"[",
"(",
"tuplify",
"(",
"s",
")",
",",
"tuplify",
"(",
"e",
")",
")",
"for",
"s",
",",
"e",
"in",
"key_ranges",
"]",
"scanner",
"=",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.index_scan | 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, then a
:exc:`~exceptions.KeyError` is ... | dossier/store/store.py | 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... | 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",
"an",
"indexed",
"value",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L298-L317 | [
"def",
"index_scan",
"(",
"self",
",",
"idx_name",
",",
"val",
")",
":",
"idx",
"=",
"self",
".",
"_index",
"(",
"idx_name",
")",
"[",
"'transform'",
"]",
"key",
"=",
"(",
"idx",
"(",
"val",
")",
",",
"idx_name",
".",
"encode",
"(",
"'utf-8'",
")",... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.index_scan_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 by ``idx_name`` is not registered, then a
:exc:`~exce... | dossier/store/store.py | 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... | 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",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L319-L336 | [
"def",
"index_scan_prefix",
"(",
"self",
",",
"idx_name",
",",
"val_prefix",
")",
":",
"return",
"self",
".",
"_index_scan_prefix_impl",
"(",
"idx_name",
",",
"val_prefix",
",",
"lambda",
"k",
":",
"k",
"[",
"2",
"]",
")"
] | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.index_scan_prefix_and_return_key | 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
``val_prefix`` (after index transforms are applied).
If the ... | dossier/store/store.py | 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
... | 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
... | [
"Returns",
"ids",
"that",
"match",
"a",
"prefix",
"of",
"an",
"indexed",
"value",
"and",
"the",
"specific",
"key",
"that",
"matched",
"the",
"search",
"prefix",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L338-L357 | [
"def",
"index_scan_prefix_and_return_key",
"(",
"self",
",",
"idx_name",
",",
"val_prefix",
")",
":",
"return",
"self",
".",
"_index_scan_prefix_impl",
"(",
"idx_name",
",",
"val_prefix",
",",
"lambda",
"k",
":",
"(",
"k",
"[",
"0",
"]",
",",
"k",
"[",
"2"... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store._index_scan_prefix_impl | 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) | dossier/store/store.py | 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)
'... | 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)
'... | [
"Implementation",
"for",
"index_scan_prefix",
"and",
"index_scan_prefix_and_return_key",
"parameterized",
"on",
"return",
"value",
"function",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L359-L374 | [
"def",
"_index_scan_prefix_impl",
"(",
"self",
",",
"idx_name",
",",
"val_prefix",
",",
"retfunc",
")",
":",
"idx",
"=",
"self",
".",
"_index",
"(",
"idx_name",
")",
"[",
"'transform'",
"]",
"val_prefix",
"=",
"idx",
"(",
"val_prefix",
")",
"idx_name",
"="... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store.define_index | 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
updated on calls to :meth:`~dossier.fc.store.Store.put`.
... | dossier/store/store.py | 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
... | 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",
"an",
"index",
"to",
"this",
"store",
"instance",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L376-L419 | [
"def",
"define_index",
"(",
"self",
",",
"idx_name",
",",
"create",
",",
"transform",
")",
":",
"assert",
"isinstance",
"(",
"idx_name",
",",
"(",
"str",
",",
"unicode",
")",
")",
"idx_name",
"=",
"idx_name",
".",
"decode",
"(",
"'utf-8'",
")",
"self",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store._index_put | 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: ``[(content_id, FeatureCollection)]`` | dossier/store/store.py | 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: ``[(... | 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",
"index",
"values",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L431-L444 | [
"def",
"_index_put",
"(",
"self",
",",
"idx_name",
",",
"*",
"ids_and_fcs",
")",
":",
"keys",
"=",
"self",
".",
"_index_keys_for",
"(",
"idx_name",
",",
"*",
"ids_and_fcs",
")",
"with_vals",
"=",
"map",
"(",
"lambda",
"k",
":",
"(",
"k",
",",
"'0'",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store._index_put_raw | 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.
:type idx_name: unicode
:type content_id: str
:typ... | dossier/store/store.py | 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... | 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... | [
"Add",
"new",
"raw",
"index",
"values",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L446-L461 | [
"def",
"_index_put_raw",
"(",
"self",
",",
"idx_name",
",",
"content_id",
",",
"val",
")",
":",
"idx",
"=",
"self",
".",
"_index",
"(",
"idx_name",
")",
"[",
"'transform'",
"]",
"key",
"=",
"(",
"idx",
"(",
"val",
")",
",",
"idx_name",
".",
"encode",... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store._index_keys_for | 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: ``[(content_id, FeatureCollection)]``
:rtype: genera... | dossier/store/store.py | 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... | 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",
"a",
"generator",
"of",
"index",
"triples",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L463-L488 | [
"def",
"_index_keys_for",
"(",
"self",
",",
"idx_name",
",",
"*",
"ids_and_fcs",
")",
":",
"idx",
"=",
"self",
".",
"_index",
"(",
"idx_name",
")",
"icreate",
",",
"itrans",
"=",
"idx",
"[",
"'create'",
"]",
",",
"idx",
"[",
"'transform'",
"]",
"if",
... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | Store._index | Returns index transforms for ``name``.
:type name: unicode
:rtype: ``{ create |--> function, transform |--> function }`` | dossier/store/store.py | 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... | 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... | [
"Returns",
"index",
"transforms",
"for",
"name",
"."
] | dossier/dossier.store | python | https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/store.py#L490-L501 | [
"def",
"_index",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"name",
".",
"decode",
"(",
"'utf-8'",
")",
"try",
":",
"return",
"self",
".",
"_indexes",
"[",
"name",
"]",
"except",
"KeyError",
":",
"raise",
"KeyError",
"(",
"'Index \"%s\" has not bee... | b22ffe2470bba9fcc98a30cb55b437bfa1521e7f |
test | fetch_twitter | 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. | hyperion/fetch/twitter.py | 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.
"""
... | 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",
"the",
"twitter",
"feed",
"for",
"a",
"given",
"handle",
".",
":",
"param",
"handle",
":",
"The",
"twitter",
"handle",
".",
":",
"return",
":",
"A",
"list",
"of",
"entries",
"in",
"a",
"user",
"s",
"feed",
".",
":",
"raises",
"ApiError",
":",... | arlyon/hyperion | python | https://github.com/arlyon/hyperion/blob/d8de0388ba98b85ce472e0f49ac18fecb14d3343/hyperion/fetch/twitter.py#L15-L34 | [
"async",
"def",
"fetch_twitter",
"(",
"handle",
":",
"str",
")",
"->",
"List",
":",
"async",
"with",
"ClientSession",
"(",
")",
"as",
"session",
":",
"try",
":",
"async",
"with",
"session",
".",
"get",
"(",
"f\"http://twitrss.me/twitter_user_to_rss/?user={handle... | d8de0388ba98b85ce472e0f49ac18fecb14d3343 |
test | fetch_nearby | Gets wikipedia articles near a given set of coordinates.
:raise ApiError: When there was an error connecting to the API.
todo cache | hyperion/fetch/wikipedia.py | 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" ... | 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" ... | [
"Gets",
"wikipedia",
"articles",
"near",
"a",
"given",
"set",
"of",
"coordinates",
".",
":",
"raise",
"ApiError",
":",
"When",
"there",
"was",
"an",
"error",
"connecting",
"to",
"the",
"API",
"."
] | arlyon/hyperion | python | https://github.com/arlyon/hyperion/blob/d8de0388ba98b85ce472e0f49ac18fecb14d3343/hyperion/fetch/wikipedia.py#L15-L48 | [
"async",
"def",
"fetch_nearby",
"(",
"lat",
":",
"float",
",",
"long",
":",
"float",
",",
"limit",
":",
"int",
"=",
"10",
")",
"->",
"Optional",
"[",
"List",
"[",
"Dict",
"]",
"]",
":",
"request_url",
"=",
"f\"https://en.wikipedia.org/w/api.php?action=query\... | d8de0388ba98b85ce472e0f49ac18fecb14d3343 |
test | execute_get_text | Execute shell command and return stdout txt
:param command:
:return: | build_utils.py | 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... | 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... | [
"Execute",
"shell",
"command",
"and",
"return",
"stdout",
"txt",
":",
"param",
"command",
":",
":",
"return",
":"
] | matthewdeanmartin/find_known_secrets | python | https://github.com/matthewdeanmartin/find_known_secrets/blob/f25735c1ab4512bad85ade33af7021f6fac1d13b/build_utils.py#L142-L161 | [
"def",
"execute_get_text",
"(",
"command",
")",
":",
"# type: (str) ->str",
"try",
":",
"completed",
"=",
"subprocess",
".",
"run",
"(",
"command",
",",
"check",
"=",
"True",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
... | f25735c1ab4512bad85ade33af7021f6fac1d13b |
test | BuildState.has_source_code_tree_changed | 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: | build_utils.py | 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... | 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... | [
"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",
":"
] | matthewdeanmartin/find_known_secrets | python | https://github.com/matthewdeanmartin/find_known_secrets/blob/f25735c1ab4512bad85ade33af7021f6fac1d13b/build_utils.py#L58-L91 | [
"def",
"has_source_code_tree_changed",
"(",
"self",
")",
":",
"global",
"CURRENT_HASH",
"directory",
"=",
"self",
".",
"where",
"# if CURRENT_HASH is None:",
"# print(\"hashing \" + directory)",
"# print(os.listdir(directory))",
"CURRENT_HASH",
"=",
"dirhash",
"(",
"directory... | f25735c1ab4512bad85ade33af7021f6fac1d13b |
test | check_pypi_name | 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 standard specification.
It will return True if the package name, or any equi... | src/check_pypi_name/__init__.py | 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... | 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... | [
"Check",
"if",
"a",
"package",
"name",
"exists",
"on",
"pypi",
"."
] | techdragon/python-check-pypi-name | python | https://github.com/techdragon/python-check-pypi-name/blob/2abfa98878755ed9073b4f5448f4380f88e3e8f3/src/check_pypi_name/__init__.py#L7-L86 | [
"def",
"check_pypi_name",
"(",
"pypi_package_name",
",",
"pypi_registry_host",
"=",
"None",
")",
":",
"if",
"pypi_registry_host",
"is",
"None",
":",
"pypi_registry_host",
"=",
"'pypi.python.org'",
"# Just a helpful reminder why this bytearray size was chosen.",
"# ... | 2abfa98878755ed9073b4f5448f4380f88e3e8f3 |
test | add_direction | 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 case of a
left-to-right language
{... | bidiutils/templatetags/bidiutils_tags.py | 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... | 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... | [
"Adds",
"direction",
"to",
"the",
"element"
] | MeirKriheli/django-bidi-utils | python | https://github.com/MeirKriheli/django-bidi-utils/blob/48a8c481fe728fbccf486582999e79454195036e/bidiutils/templatetags/bidiutils_tags.py#L10-L42 | [
"def",
"add_direction",
"(",
"value",
",",
"arg",
"=",
"u\"rtl_only\"",
")",
":",
"if",
"arg",
"==",
"u'rtl_only'",
":",
"directions",
"=",
"(",
"u''",
",",
"u'_rtl'",
")",
"elif",
"arg",
"==",
"u'both'",
":",
"directions",
"=",
"(",
"u'_ltr'",
",",
"u... | 48a8c481fe728fbccf486582999e79454195036e |
test | fetch_postcodes_from_coordinates | 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 CircuitBre... | hyperion/fetch/postcode.py | 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... | 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... | [
"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",
"m... | arlyon/hyperion | python | https://github.com/arlyon/hyperion/blob/d8de0388ba98b85ce472e0f49ac18fecb14d3343/hyperion/fetch/postcode.py#L61-L71 | [
"async",
"def",
"fetch_postcodes_from_coordinates",
"(",
"lat",
":",
"float",
",",
"long",
":",
"float",
")",
"->",
"Optional",
"[",
"List",
"[",
"Postcode",
"]",
"]",
":",
"postcode_lookup",
"=",
"f\"/postcodes?lat={lat}&lon={long}\"",
"return",
"await",
"_get_po... | d8de0388ba98b85ce472e0f49ac18fecb14d3343 |
test | get_type_name | get the xsd name of a S_DT | bridgepoint/gen_xsd_schema.py | 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... | 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",
"xsd",
"name",
"of",
"a",
"S_DT"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L43-L57 | [
"def",
"get_type_name",
"(",
"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",
".",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | get_refered_attribute | Get the the referred attribute. | bridgepoint/gen_xsd_schema.py | 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 | 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 | [
"Get",
"the",
"the",
"referred",
"attribute",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L64-L72 | [
"def",
"get_refered_attribute",
"(",
"o_attr",
")",
":",
"o_attr_ref",
"=",
"nav_one",
"(",
"o_attr",
")",
".",
"O_RATTR",
"[",
"106",
"]",
".",
"O_BATTR",
"[",
"113",
"]",
".",
"O_ATTR",
"[",
"106",
"]",
"(",
")",
"if",
"o_attr_ref",
":",
"return",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | build_core_type | Build an xsd simpleType out of a S_CDT. | bridgepoint/gen_xsd_schema.py | 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... | 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_CDT",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L75-L105 | [
"def",
"build_core_type",
"(",
"s_cdt",
")",
":",
"s_dt",
"=",
"nav_one",
"(",
"s_cdt",
")",
".",
"S_DT",
"[",
"17",
"]",
"(",
")",
"if",
"s_dt",
".",
"name",
"==",
"'void'",
":",
"type_name",
"=",
"None",
"elif",
"s_dt",
".",
"name",
"==",
"'boole... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | build_enum_type | Build an xsd simpleType out of a S_EDT. | bridgepoint/gen_xsd_schema.py | 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... | 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",
"simpleType",
"out",
"of",
"a",
"S_EDT",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L108-L123 | [
"def",
"build_enum_type",
"(",
"s_edt",
")",
":",
"s_dt",
"=",
"nav_one",
"(",
"s_edt",
")",
".",
"S_DT",
"[",
"17",
"]",
"(",
")",
"enum",
"=",
"ET",
".",
"Element",
"(",
"'xs:simpleType'",
",",
"name",
"=",
"s_dt",
".",
"name",
")",
"enum_list",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | build_struct_type | Build an xsd complexType out of a S_SDT. | bridgepoint/gen_xsd_schema.py | 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... | 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",
"complexType",
"out",
"of",
"a",
"S_SDT",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L126-L142 | [
"def",
"build_struct_type",
"(",
"s_sdt",
")",
":",
"s_dt",
"=",
"nav_one",
"(",
"s_sdt",
")",
".",
"S_DT",
"[",
"17",
"]",
"(",
")",
"struct",
"=",
"ET",
".",
"Element",
"(",
"'xs:complexType'",
",",
"name",
"=",
"s_dt",
".",
"name",
")",
"first_fil... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | build_user_type | Build an xsd simpleType out of a S_UDT. | bridgepoint/gen_xsd_schema.py | 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... | 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",
"an",
"xsd",
"simpleType",
"out",
"of",
"a",
"S_UDT",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L145-L157 | [
"def",
"build_user_type",
"(",
"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_t... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | build_type | Build a partial xsd tree out of a S_DT and its sub types S_CDT, S_EDT, S_SDT and S_UDT. | bridgepoint/gen_xsd_schema.py | 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)
... | 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",
"a",
"partial",
"xsd",
"tree",
"out",
"of",
"a",
"S_DT",
"and",
"its",
"sub",
"types",
"S_CDT",
"S_EDT",
"S_SDT",
"and",
"S_UDT",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L160-L174 | [
"def",
"build_type",
"(",
"s_dt",
")",
":",
"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_ED... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | build_class | Build an xsd complex element out of a O_OBJ, including its O_ATTR. | bridgepoint/gen_xsd_schema.py | 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... | 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",
"O_OBJ",
"including",
"its",
"O_ATTR",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L181-L198 | [
"def",
"build_class",
"(",
"o_obj",
")",
":",
"cls",
"=",
"ET",
".",
"Element",
"(",
"'xs:element'",
",",
"name",
"=",
"o_obj",
".",
"key_lett",
",",
"minOccurs",
"=",
"'0'",
",",
"maxOccurs",
"=",
"'unbounded'",
")",
"attributes",
"=",
"ET",
".",
"Sub... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | build_component | Build an xsd complex element out of a C_C, including its packaged S_DT and O_OBJ. | bridgepoint/gen_xsd_schema.py | 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... | 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",
"complex",
"element",
"out",
"of",
"a",
"C_C",
"including",
"its",
"packaged",
"S_DT",
"and",
"O_OBJ",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L201-L216 | [
"def",
"build_component",
"(",
"m",
",",
"c_c",
")",
":",
"component",
"=",
"ET",
".",
"Element",
"(",
"'xs:element'",
",",
"name",
"=",
"c_c",
".",
"name",
")",
"classes",
"=",
"ET",
".",
"SubElement",
"(",
"component",
",",
"'xs:complexType'",
")",
"... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | build_schema | Build an xsd schema from a bridgepoint component. | bridgepoint/gen_xsd_schema.py | 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):
... | 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):
... | [
"Build",
"an",
"xsd",
"schema",
"from",
"a",
"bridgepoint",
"component",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L219-L241 | [
"def",
"build_schema",
"(",
"m",
",",
"c_c",
")",
":",
"schema",
"=",
"ET",
".",
"Element",
"(",
"'xs:schema'",
")",
"schema",
".",
"set",
"(",
"'xmlns:xs'",
",",
"'http://www.w3.org/2001/XMLSchema'",
")",
"global_filter",
"=",
"lambda",
"selected",
":",
"oo... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | prettify | Indent an xml string with four spaces, and add an additional line break after each node. | bridgepoint/gen_xsd_schema.py | 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=" ") | 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=" ") | [
"Indent",
"an",
"xml",
"string",
"with",
"four",
"spaces",
"and",
"add",
"an",
"additional",
"line",
"break",
"after",
"each",
"node",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/gen_xsd_schema.py#L244-L249 | [
"def",
"prettify",
"(",
"xml_string",
")",
":",
"reparsed",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parseString",
"(",
"xml_string",
")",
"return",
"reparsed",
".",
"toprettyxml",
"(",
"indent",
"=",
"\" \"",
")"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | fetch_bikes | 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: When there was an error connecting to the API. | hyperion/fetch/bikeregister.py | 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:... | 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:... | [
"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"... | arlyon/hyperion | python | https://github.com/arlyon/hyperion/blob/d8de0388ba98b85ce472e0f49ac18fecb14d3343/hyperion/fetch/bikeregister.py#L16-L78 | [
"async",
"def",
"fetch_bikes",
"(",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"async",
"with",
"ClientSession",
"(",
")",
"as",
"session",
":",
"try",
":",
"async",
"with",
"session",
".",
"get",
"(",
"'https://www.bikeregister.com/stolen-bikes'",
")",
"as",... | d8de0388ba98b85ce472e0f49ac18fecb14d3343 |
test | set_positional_info | set positional information on a node | bridgepoint/oal.py | 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,
... | 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,
... | [
"set",
"positional",
"information",
"on",
"a",
"node"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L781-L798 | [
"def",
"set_positional_info",
"(",
"node",
",",
"p",
")",
":",
"node",
".",
"position",
"=",
"Position",
"(",
")",
"node",
".",
"position",
".",
"label",
"=",
"p",
".",
"lexer",
".",
"label",
"node",
".",
"position",
".",
"start_stream",
"=",
"p",
".... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | track_production | decorator for adding positional information to returning nodes | bridgepoint/oal.py | 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... | 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... | [
"decorator",
"for",
"adding",
"positional",
"information",
"to",
"returning",
"nodes"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L800-L812 | [
"def",
"track_production",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"self",
",",
"p",
")",
":",
"r",
"=",
"f",
"(",
"self",
",",
"p",
")",
"node",
"=",
"p",
"[",
"0",
"]",
"if",
"isinstance",
"(",
"node",
",",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_SL_STRING | r'\/\/.*\n | bridgepoint/oal.py | def t_SL_STRING(self, t):
r'\/\/.*\n'
t.lexer.lineno += t.value.count('\n')
t.endlexpos = t.lexpos + len(t.value) | def t_SL_STRING(self, t):
r'\/\/.*\n'
t.lexer.lineno += t.value.count('\n')
t.endlexpos = t.lexpos + len(t.value) | [
"r",
"\\",
"/",
"\\",
"/",
".",
"*",
"\\",
"n"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L950-L953 | [
"def",
"t_SL_STRING",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"lexer",
".",
"lineno",
"+=",
"t",
".",
"value",
".",
"count",
"(",
"'\\n'",
")",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_TICKED_PHRASE | r"\'[^\']*\ | bridgepoint/oal.py | def t_TICKED_PHRASE(self, t):
r"\'[^\']*\'"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_TICKED_PHRASE(self, t):
r"\'[^\']*\'"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"[",
"^",
"\\",
"]",
"*",
"\\"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L955-L958 | [
"def",
"t_TICKED_PHRASE",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_STRING | r'"[^"\n]*" | bridgepoint/oal.py | def t_STRING(self, t):
r'"[^"\n]*"'
t.endlexpos = t.lexpos + len(t.value)
return t | def t_STRING(self, t):
r'"[^"\n]*"'
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"[",
"^",
"\\",
"n",
"]",
"*"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L960-L963 | [
"def",
"t_STRING",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_END_FOR | r"(?i)end[\s]+for | bridgepoint/oal.py | def t_END_FOR(self, t):
r"(?i)end[\s]+for"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_END_FOR(self, t):
r"(?i)end[\s]+for"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"(",
"?i",
")",
"end",
"[",
"\\",
"s",
"]",
"+",
"for"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L965-L968 | [
"def",
"t_END_FOR",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_END_IF | r"(?i)end[\s]+if | bridgepoint/oal.py | def t_END_IF(self, t):
r"(?i)end[\s]+if"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_END_IF(self, t):
r"(?i)end[\s]+if"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"(",
"?i",
")",
"end",
"[",
"\\",
"s",
"]",
"+",
"if"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L970-L973 | [
"def",
"t_END_IF",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_END_WHILE | r"(?i)end[\s]+while | bridgepoint/oal.py | def t_END_WHILE(self, t):
r"(?i)end[\s]+while"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_END_WHILE(self, t):
r"(?i)end[\s]+while"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"(",
"?i",
")",
"end",
"[",
"\\",
"s",
"]",
"+",
"while"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L975-L978 | [
"def",
"t_END_WHILE",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_NAMESPACE | r"([0-9a-zA-Z_])+(?=::) | bridgepoint/oal.py | def t_NAMESPACE(self, t):
r"([0-9a-zA-Z_])+(?=::)"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_NAMESPACE(self, t):
r"([0-9a-zA-Z_])+(?=::)"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"(",
"[",
"0",
"-",
"9a",
"-",
"zA",
"-",
"Z_",
"]",
")",
"+",
"(",
"?",
"=",
"::",
")"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L980-L983 | [
"def",
"t_NAMESPACE",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_ID | r"[a-zA-Z_][0-9a-zA-Z_]*|[a-zA-Z][0-9a-zA-Z_]*[0-9a-zA-Z_]+ | bridgepoint/oal.py | 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 | 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",
"[",
"a",
"-",
"zA",
"-",
"Z_",
"]",
"[",
"0",
"-",
"9a",
"-",
"zA",
"-",
"Z_",
"]",
"*",
"|",
"[",
"a",
"-",
"zA",
"-",
"Z",
"]",
"[",
"0",
"-",
"9a",
"-",
"zA",
"-",
"Z_",
"]",
"*",
"[",
"0",
"-",
"9a",
"-",
"zA",
"-",
"Z_"... | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L985-L993 | [
"def",
"t_ID",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"value",
"=",
"t",
".",
"value",
".",
"upper",
"(",
")",
"if",
"value",
"in",
"self",
".",
"keywords",
":... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_DOUBLECOLON | r":: | bridgepoint/oal.py | def t_DOUBLECOLON(self, t):
r"::"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_DOUBLECOLON(self, t):
r"::"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"::"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1005-L1008 | [
"def",
"t_DOUBLECOLON",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_DOUBLEEQUAL | r"\=\= | bridgepoint/oal.py | def t_DOUBLEEQUAL(self, t):
r"\=\="
t.endlexpos = t.lexpos + len(t.value)
return t | def t_DOUBLEEQUAL(self, t):
r"\=\="
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"=",
"\\",
"="
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1010-L1013 | [
"def",
"t_DOUBLEEQUAL",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_NOTEQUAL | r"!\= | bridgepoint/oal.py | def t_NOTEQUAL(self, t):
r"!\="
t.endlexpos = t.lexpos + len(t.value)
return t | def t_NOTEQUAL(self, t):
r"!\="
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"!",
"\\",
"="
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1015-L1018 | [
"def",
"t_NOTEQUAL",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_ARROW | r"\-\> | bridgepoint/oal.py | def t_ARROW(self, t):
r"\-\>"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_ARROW(self, t):
r"\-\>"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"-",
"\\",
">"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1020-L1023 | [
"def",
"t_ARROW",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_LE | r"\<\= | bridgepoint/oal.py | def t_LE(self, t):
r"\<\="
t.endlexpos = t.lexpos + len(t.value)
return t | def t_LE(self, t):
r"\<\="
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"<",
"\\",
"="
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1025-L1028 | [
"def",
"t_LE",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_GE | r"\>\= | bridgepoint/oal.py | def t_GE(self, t):
r"\>\="
t.endlexpos = t.lexpos + len(t.value)
return t | def t_GE(self, t):
r"\>\="
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
">",
"\\",
"="
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1030-L1033 | [
"def",
"t_GE",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_EQUAL | r"\= | bridgepoint/oal.py | def t_EQUAL(self, t):
r"\="
t.endlexpos = t.lexpos + len(t.value)
return t | def t_EQUAL(self, t):
r"\="
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"="
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1040-L1043 | [
"def",
"t_EQUAL",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_DOT | r"\. | bridgepoint/oal.py | def t_DOT(self, t):
r"\."
t.endlexpos = t.lexpos + len(t.value)
return t | def t_DOT(self, t):
r"\."
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"."
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1045-L1048 | [
"def",
"t_DOT",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_TIMES | r"\* | bridgepoint/oal.py | def t_TIMES(self, t):
r"\*"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_TIMES(self, t):
r"\*"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"*"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1060-L1063 | [
"def",
"t_TIMES",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_COLON | r": | bridgepoint/oal.py | def t_COLON(self, t):
r":"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_COLON(self, t):
r":"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
":"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1065-L1068 | [
"def",
"t_COLON",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_LSQBR | r"\[ | bridgepoint/oal.py | def t_LSQBR(self, t):
r"\["
t.endlexpos = t.lexpos + len(t.value)
return t | def t_LSQBR(self, t):
r"\["
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"["
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1075-L1078 | [
"def",
"t_LSQBR",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_RSQBR | r"\] | bridgepoint/oal.py | def t_RSQBR(self, t):
r"\]"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_RSQBR(self, t):
r"\]"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"]"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1080-L1083 | [
"def",
"t_RSQBR",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_QMARK | r"\? | bridgepoint/oal.py | def t_QMARK(self, t):
r"\?"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_QMARK(self, t):
r"\?"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"?"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1085-L1088 | [
"def",
"t_QMARK",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_LESSTHAN | r"\< | bridgepoint/oal.py | def t_LESSTHAN(self, t):
r"\<"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_LESSTHAN(self, t):
r"\<"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"<"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1090-L1093 | [
"def",
"t_LESSTHAN",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_GT | r"\> | bridgepoint/oal.py | def t_GT(self, t):
r"\>"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_GT(self, t):
r"\>"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
">"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1095-L1098 | [
"def",
"t_GT",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_PLUS | r"\+ | bridgepoint/oal.py | def t_PLUS(self, t):
r"\+"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_PLUS(self, t):
r"\+"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"\\",
"+"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1100-L1103 | [
"def",
"t_PLUS",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_DIV | r"/ | bridgepoint/oal.py | def t_DIV(self, t):
r"/"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_DIV(self, t):
r"/"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"/"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1110-L1113 | [
"def",
"t_DIV",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.t_MOD | r"% | bridgepoint/oal.py | def t_MOD(self, t):
r"%"
t.endlexpos = t.lexpos + len(t.value)
return t | def t_MOD(self, t):
r"%"
t.endlexpos = t.lexpos + len(t.value)
return t | [
"r",
"%"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1115-L1118 | [
"def",
"t_MOD",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"endlexpos",
"=",
"t",
".",
"lexpos",
"+",
"len",
"(",
"t",
".",
"value",
")",
"return",
"t"
] | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.p_statement_list_1 | statement_list : statement SEMICOLON statement_list | bridgepoint/oal.py | 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]) | 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",
"statement_list"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1150-L1154 | [
"def",
"p_statement_list_1",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"3",
"]",
"if",
"p",
"[",
"1",
"]",
"is",
"not",
"None",
":",
"p",
"[",
"0",
"]",
".",
"children",
".",
"insert",
"(",
"0",
",",
"p",
"[",
"1... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.p_statement_list_2 | statement_list : statement SEMICOLON | bridgepoint/oal.py | 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]) | 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_list",
":",
"statement",
"SEMICOLON"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1157-L1161 | [
"def",
"p_statement_list_2",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"StatementListNode",
"(",
")",
"if",
"p",
"[",
"1",
"]",
"is",
"not",
"None",
":",
"p",
"[",
"0",
"]",
".",
"children",
".",
"insert",
"(",
"0",
",",
"p",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.p_bridge_assignment_statement | statement : BRIDGE variable_access EQUAL implicit_invocation | bridgepoint/oal.py | 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]) | 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",
":",
"BRIDGE",
"variable_access",
"EQUAL",
"implicit_invocation"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1211-L1215 | [
"def",
"p_bridge_assignment_statement",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"4",
"]",
".",
"__class__",
"=",
"BridgeInvocationNode",
"p",
"[",
"0",
"]",
"=",
"AssignmentNode",
"(",
"variable_access",
"=",
"p",
"[",
"2",
"]",
",",
"expression",
"="... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.p_class_invocation_assignment_statement | statement : TRANSFORM variable_access EQUAL implicit_invocation | bridgepoint/oal.py | 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]) | 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",
":",
"TRANSFORM",
"variable_access",
"EQUAL",
"implicit_invocation"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1241-L1245 | [
"def",
"p_class_invocation_assignment_statement",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"4",
"]",
".",
"__class__",
"=",
"ClassInvocationNode",
"p",
"[",
"0",
"]",
"=",
"AssignmentNode",
"(",
"variable_access",
"=",
"p",
"[",
"2",
"]",
",",
"expressio... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.p_port_invocation_assignment_statement | statement : SEND variable_access EQUAL implicit_invocation | bridgepoint/oal.py | 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]) | 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",
"variable_access",
"EQUAL",
"implicit_invocation"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1254-L1258 | [
"def",
"p_port_invocation_assignment_statement",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"4",
"]",
".",
"__class__",
"=",
"PortInvocationNode",
"p",
"[",
"0",
"]",
"=",
"AssignmentNode",
"(",
"variable_access",
"=",
"p",
"[",
"2",
"]",
",",
"expression"... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
test | OALParser.p_port_event_generation | statement : SEND namespace DOUBLECOLON identifier LPAREN parameter_list RPAREN TO expression | bridgepoint/oal.py | 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],
... | 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],
... | [
"statement",
":",
"SEND",
"namespace",
"DOUBLECOLON",
"identifier",
"LPAREN",
"parameter_list",
"RPAREN",
"TO",
"expression"
] | xtuml/pyxtuml | python | https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1261-L1266 | [
"def",
"p_port_event_generation",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"GeneratePortEventNode",
"(",
"port_name",
"=",
"p",
"[",
"2",
"]",
",",
"action_name",
"=",
"p",
"[",
"4",
"]",
",",
"parameter_list",
"=",
"p",
"[",
"6",
... | 7dd9343b9a0191d1db1887ab9288d0a026608d9a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.