_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q279100 | Worker.work | test | def work(self, socket, call, args, kwargs, topics=()):
"""Calls a function and send results to the collector. It supports
all of function actions. A function could return, yield, raise any
packable objects.
"""
task_id = uuid4_bytes()
reply_socket, topics = self.replier... | python | {
"resource": ""
} |
q279101 | Worker.accept | test | def accept(self, reply_socket, channel):
"""Sends ACCEPT reply."""
info = self.info or b''
self.send_raw(reply_socket, ACCEPT, info, *channel) | python | {
"resource": ""
} |
q279102 | Worker.reject | test | def reject(self, reply_socket, call_id, topics=()):
"""Sends REJECT reply."""
info = self.info or b''
self.send_raw(reply_socket, REJECT, info, call_id, b'', topics) | python | {
"resource": ""
} |
q279103 | Worker.raise_ | test | def raise_(self, reply_socket, channel, exc_info=None):
"""Sends RAISE reply."""
if not reply_socket:
return
if exc_info is None:
exc_info = sys.exc_info()
exc_type, exc, tb = exc_info
while tb.tb_next is not None:
tb = tb.tb_next
if is... | python | {
"resource": ""
} |
q279104 | _Caller._call_wait | test | def _call_wait(self, hints, name, args, kwargs, topics=(), raw=False,
limit=None, retry=False, max_retries=None):
"""Allocates a call id and emit."""
col = self.collector
if not col.is_running():
col.start()
call_id = uuid4_bytes()
reply_to = (DUPLE... | python | {
"resource": ""
} |
q279105 | Collector.establish | test | def establish(self, call_id, timeout, limit=None,
retry=None, max_retries=None):
"""Waits for the call is accepted by workers and starts to collect the
results.
"""
rejected = 0
retried = 0
results = []
result_queue = self.result_queues[call_id]
... | python | {
"resource": ""
} |
q279106 | Collector.dispatch_reply | test | def dispatch_reply(self, reply, value):
"""Dispatches the reply to the proper queue."""
method = reply.method
call_id = reply.call_id
task_id = reply.task_id
if method & ACK:
try:
result_queue = self.result_queues[call_id]
except KeyError:
... | python | {
"resource": ""
} |
q279107 | guess_type_name | test | def guess_type_name(value):
'''
Guess the type name of a serialized value.
'''
value = str(value)
if value.upper() in ['TRUE', 'FALSE']:
return 'BOOLEAN'
elif re.match(r'(-)?(\d+)(\.\d+)', value):
return 'REAL'
elif re.match(r'(-)?(\d+)', value):
return... | python | {
"resource": ""
} |
q279108 | deserialize_value | test | def deserialize_value(ty, value):
'''
Deserialize a value of some type
'''
uty = ty.upper()
if uty == 'BOOLEAN':
if value.isdigit():
return bool(int(value))
elif value.upper() == 'FALSE':
return False
elif value.upper() == 'TRUE':
retu... | python | {
"resource": ""
} |
q279109 | ModelLoader.t_LPAREN | test | def t_LPAREN(self, t):
r'\('
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279110 | ModelLoader.t_RPAREN | test | def t_RPAREN(self, t):
r'\)'
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279111 | ElasticStore.get | test | def get(self, content_id, feature_names=None):
'''Retrieve a feature collection.
If a feature collection with the given id does not
exist, then ``None`` is returned.
:param str content_id: Content identifier.
:param [str] feature_names:
A list of feature names to retr... | python | {
"resource": ""
} |
q279112 | ElasticStore.get_many | test | def get_many(self, content_ids, feature_names=None):
'''Returns an iterable of feature collections.
This efficiently retrieves multiple FCs corresponding to the
list of ids given. Tuples of identifier and feature collection
are yielded. If the feature collection for a given id does not
... | python | {
"resource": ""
} |
q279113 | ElasticStore.put | test | def put(self, items, indexes=True):
'''Adds feature collections to the store.
This efficiently adds multiple FCs to the store. The iterable
of ``items`` given should yield tuples of ``(content_id, FC)``.
:param items: Iterable of ``(content_id, FC)``.
:param [str] feature_names... | python | {
"resource": ""
} |
q279114 | ElasticStore.delete | test | def delete(self, content_id):
'''Deletes the corresponding feature collection.
If the FC does not exist, then this is a no-op.
'''
try:
self.conn.delete(index=self.index, doc_type=self.type,
id=eid(content_id))
except NotFoundError:
... | python | {
"resource": ""
} |
q279115 | ElasticStore.delete_all | test | def delete_all(self):
'''Deletes all feature collections.
This does not destroy the ES index, but instead only
deletes all FCs with the configured document type
(defaults to ``fc``).
'''
try:
self.conn.indices.delete_mapping(
index=self.index,... | python | {
"resource": ""
} |
q279116 | ElasticStore.delete_index | test | def delete_index(self):
'''Deletes the underlying ES index.
Only use this if you know what you're doing. This destroys
the entire underlying ES index, which could be shared by
multiple distinct ElasticStore instances.
'''
if self.conn.indices.exists(index=self.index):
... | python | {
"resource": ""
} |
q279117 | ElasticStore.scan | test | def scan(self, *key_ranges, **kwargs):
'''Scan for FCs in the given id ranges.
:param key_ranges:
``key_ranges`` should be a list of pairs of ranges. The first
value is the lower bound id and the second value is the
upper bound id. Use ``()`` in either position to leave it... | python | {
"resource": ""
} |
q279118 | ElasticStore.scan_ids | test | def scan_ids(self, *key_ranges, **kwargs):
'''Scan for ids only in the given id ranges.
:param key_ranges:
``key_ranges`` should be a list of pairs of ranges. The first
value is the lower bound id and the second value is the
upper bound id. Use ``()`` in either position to... | python | {
"resource": ""
} |
q279119 | ElasticStore.scan_prefix | test | def scan_prefix(self, prefix, feature_names=None):
'''Scan for FCs with a given prefix.
:param str prefix: Identifier prefix.
:param [str] feature_names:
A list of feature names to retrieve. When ``None``, all
features are retrieved. Wildcards are allowed.
:rtype: It... | python | {
"resource": ""
} |
q279120 | ElasticStore.scan_prefix_ids | test | def scan_prefix_ids(self, prefix):
'''Scan for ids with a given prefix.
:param str prefix: Identifier prefix.
:param [str] feature_names:
A list of feature names to retrieve. When ``None``, all
features are retrieved. Wildcards are allowed.
:rtype: Iterable of ``cont... | python | {
"resource": ""
} |
q279121 | ElasticStore.fulltext_scan | test | def fulltext_scan(self, query_id=None, query_fc=None, feature_names=None,
preserve_order=True, indexes=None):
'''Fulltext search.
Yields an iterable of triples (score, identifier, FC)
corresponding to the search results of the fulltext search
in ``query``. This wil... | python | {
"resource": ""
} |
q279122 | ElasticStore.fulltext_scan_ids | test | def fulltext_scan_ids(self, query_id=None, query_fc=None,
preserve_order=True, indexes=None):
'''Fulltext search for identifiers.
Yields an iterable of triples (score, identifier)
corresponding to the search results of the fulltext search
in ``query``. This wil... | python | {
"resource": ""
} |
q279123 | ElasticStore.keyword_scan | test | def keyword_scan(self, query_id=None, query_fc=None, feature_names=None):
'''Keyword scan for feature collections.
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`` ... | python | {
"resource": ""
} |
q279124 | ElasticStore.keyword_scan_ids | test | 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... | python | {
"resource": ""
} |
q279125 | ElasticStore.index_scan_ids | test | 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... | python | {
"resource": ""
} |
q279126 | ElasticStore._source | test | 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) | python | {
"resource": ""
} |
q279127 | ElasticStore._range_filters | test | 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.
... | python | {
"resource": ""
} |
q279128 | ElasticStore._create_index | test | 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... | python | {
"resource": ""
} |
q279129 | ElasticStore._create_mappings | test | 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... | python | {
"resource": ""
} |
q279130 | ElasticStore._get_index_mappings | test | 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... | python | {
"resource": ""
} |
q279131 | ElasticStore._get_field_types | test | 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'] | python | {
"resource": ""
} |
q279132 | ElasticStore._fc_index_disjunction_from_query | test | 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... | python | {
"resource": ""
} |
q279133 | ElasticStore.fc_bytes | test | 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 | python | {
"resource": ""
} |
q279134 | ElasticStore.count_bytes | test | 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... | python | {
"resource": ""
} |
q279135 | pretty_string | test | 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'\... | python | {
"resource": ""
} |
q279136 | process_docopts | test | 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 ... | python | {
"resource": ""
} |
q279137 | default_formatter | test | 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) | python | {
"resource": ""
} |
q279138 | pretty_to_link | test | 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)
... | python | {
"resource": ""
} |
q279139 | pretty_unique_identifier | test | 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 ... | python | {
"resource": ""
} |
q279140 | check_uniqueness_constraint | test | 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()
... | python | {
"resource": ""
} |
q279141 | check_link_integrity | test | 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... | python | {
"resource": ""
} |
q279142 | check_subtype_integrity | test | 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):
... | python | {
"resource": ""
} |
q279143 | feature_index | test | 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... | python | {
"resource": ""
} |
q279144 | basic_transform | test | 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) | python | {
"resource": ""
} |
q279145 | Store.put | test | 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`,
... | python | {
"resource": ""
} |
q279146 | Store.delete_all | test | 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) | python | {
"resource": ""
} |
q279147 | Store.scan | test | 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... | python | {
"resource": ""
} |
q279148 | Store.scan_ids | test | 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... | python | {
"resource": ""
} |
q279149 | Store.index_scan | test | 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... | python | {
"resource": ""
} |
q279150 | Store.index_scan_prefix | test | 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... | python | {
"resource": ""
} |
q279151 | Store.index_scan_prefix_and_return_key | test | 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
... | python | {
"resource": ""
} |
q279152 | Store._index_scan_prefix_impl | test | 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)
'... | python | {
"resource": ""
} |
q279153 | Store.define_index | test | 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
... | python | {
"resource": ""
} |
q279154 | Store._index_put | test | 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: ``[(... | python | {
"resource": ""
} |
q279155 | Store._index_put_raw | test | 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... | python | {
"resource": ""
} |
q279156 | Store._index_keys_for | test | 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... | python | {
"resource": ""
} |
q279157 | Store._index | test | 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... | python | {
"resource": ""
} |
q279158 | check_pypi_name | test | 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... | python | {
"resource": ""
} |
q279159 | add_direction | test | 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... | python | {
"resource": ""
} |
q279160 | get_type_name | test | 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... | python | {
"resource": ""
} |
q279161 | get_refered_attribute | test | 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 | python | {
"resource": ""
} |
q279162 | build_core_type | test | 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... | python | {
"resource": ""
} |
q279163 | build_enum_type | test | 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... | python | {
"resource": ""
} |
q279164 | build_struct_type | test | 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... | python | {
"resource": ""
} |
q279165 | build_user_type | test | 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... | python | {
"resource": ""
} |
q279166 | build_type | test | 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)
... | python | {
"resource": ""
} |
q279167 | build_class | test | 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... | python | {
"resource": ""
} |
q279168 | build_component | test | 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... | python | {
"resource": ""
} |
q279169 | build_schema | test | 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):
... | python | {
"resource": ""
} |
q279170 | prettify | test | 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=" ") | python | {
"resource": ""
} |
q279171 | fetch_bikes | test | 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:... | python | {
"resource": ""
} |
q279172 | set_positional_info | test | 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,
... | python | {
"resource": ""
} |
q279173 | track_production | test | 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... | python | {
"resource": ""
} |
q279174 | OALParser.t_DOUBLEEQUAL | test | def t_DOUBLEEQUAL(self, t):
r"\=\="
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279175 | OALParser.t_NOTEQUAL | test | def t_NOTEQUAL(self, t):
r"!\="
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279176 | OALParser.t_ARROW | test | def t_ARROW(self, t):
r"\-\>"
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279177 | OALParser.t_LE | test | def t_LE(self, t):
r"\<\="
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279178 | OALParser.t_GE | test | def t_GE(self, t):
r"\>\="
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279179 | OALParser.t_EQUAL | test | def t_EQUAL(self, t):
r"\="
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279180 | OALParser.t_DOT | test | def t_DOT(self, t):
r"\."
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279181 | OALParser.t_LSQBR | test | def t_LSQBR(self, t):
r"\["
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279182 | OALParser.t_RSQBR | test | def t_RSQBR(self, t):
r"\]"
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279183 | OALParser.t_QMARK | test | def t_QMARK(self, t):
r"\?"
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279184 | OALParser.t_LESSTHAN | test | def t_LESSTHAN(self, t):
r"\<"
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279185 | OALParser.t_GT | test | def t_GT(self, t):
r"\>"
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279186 | OALParser.t_PLUS | test | def t_PLUS(self, t):
r"\+"
t.endlexpos = t.lexpos + len(t.value)
return t | python | {
"resource": ""
} |
q279187 | RequestCmd.create_queue | test | def create_queue(self, name, strict=True, auto_delete=False, auto_delete_timeout=0):
"""Create message content and properties to create queue with QMFv2
:param name: Name of queue to create
:type name: str
:param strict: Whether command should fail when unrecognized properties are provi... | python | {
"resource": ""
} |
q279188 | RequestCmd.delete_queue | test | def delete_queue(self, name):
"""Create message content and properties to delete queue with QMFv2
:param name: Name of queue to delete
:type name: str
:returns: Tuple containing content and method properties
"""
content = {"_object_id": {"_object_name": self.object_name... | python | {
"resource": ""
} |
q279189 | RequestCmd.list_queues | test | def list_queues(self):
"""Create message content and properties to list all queues with QMFv2
:returns: Tuple containing content and query properties
"""
content = {"_what": "OBJECT",
"_schema_id": {"_class_name": "queue"}}
logger.debug("Message content -> {0}... | python | {
"resource": ""
} |
q279190 | RequestCmd.list_exchanges | test | def list_exchanges(self):
"""Create message content and properties to list all exchanges with QMFv2
:returns: Tuple containing content and query properties
"""
content = {"_what": "OBJECT",
"_schema_id": {"_class_name": "exchange"}}
logger.debug("Message conte... | python | {
"resource": ""
} |
q279191 | RequestCmd.purge_queue | test | def purge_queue(self, name):
"""Create message content and properties to purge queue with QMFv2
:param name: Name of queue to purge
:type name: str
:returns: Tuple containing content and method properties
"""
content = {"_object_id": {"_object_name": "org.apache.qpid.br... | python | {
"resource": ""
} |
q279192 | Gmailer._create_msg | test | def _create_msg(self, to, subject, msgHtml, msgPlain, attachments=None):
'''
attachments should be a list of paths
'''
sender = self.sender
if attachments and isinstance(attachments, str):
attachments = [attachments]
else:
attachments = list(attach... | python | {
"resource": ""
} |
q279193 | OCR.read | test | def read(self):
"""
Returns the text from an image at a given url.
"""
# Only download the image if it has changed
if self.connection.has_changed():
image_path = self.connection.download_image()
image = Image.open(image_path)
self.text_cache =... | python | {
"resource": ""
} |
q279194 | OCR.text_visible | test | def text_visible(self):
"""
Returns true or false based on if the OCR process has read
actual words. This is needed to prevent non-words from being
added to the queue since the ocr process can sometimes return
values that are not meaningfull.
"""
# Split the inpu... | python | {
"resource": ""
} |
q279195 | main | test | def main():
'''
Parse command line options and launch the interpreter
'''
parser = optparse.OptionParser(usage="%prog [options] <model_path> [another_model_path..]",
version=xtuml.version.complete_string,
formatter=optparse.TitledHelp... | python | {
"resource": ""
} |
q279196 | serialize_value | test | def serialize_value(value, ty):
'''
Serialize a value from an xtuml metamodel instance.
'''
ty = ty.upper()
null_value = {
'BOOLEAN' : False,
'INTEGER' : 0,
'REAL' : 0.0,
'STRING' : '',
'UNIQUE_ID' : 0
}
transfer_fn = {
'B... | python | {
"resource": ""
} |
q279197 | serialize_association | test | def serialize_association(ass):
'''
Serialize an xtuml metamodel association.
'''
s1 = '%s %s (%s)' % (ass.source_link.cardinality,
ass.source_link.to_metaclass.kind,
', '.join(ass.source_keys))
if ass.target_link.phrase:
s1 += " PHRASE '%s'... | python | {
"resource": ""
} |
q279198 | serialize_class | test | def serialize_class(Cls):
'''
Serialize an xtUML metamodel class.
'''
metaclass = xtuml.get_metaclass(Cls)
attributes = ['%s %s' % (name, ty.upper()) for name, ty in metaclass.attributes]
s = 'CREATE TABLE %s (\n ' % metaclass.kind
s += ',\n '.join(attributes)
s += '\n);\n'
... | python | {
"resource": ""
} |
q279199 | main | test | def main():
"""Function for command line execution"""
parser = ArgumentParser(description="search files using n-grams")
parser.add_argument('--path', dest='path', help="where to search", nargs=1, action="store", default=getcwd())
parser.add_argument('--update', dest='update', help="update the index", a... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.