function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def update(
self,
update_object,
processor="sparql",
initNs=None,
initBindings=None,
use_store_provided=True,
**kwargs, | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def n3(self):
"""Return an n3 identifier for the Graph"""
return "[%s]" % self.identifier.n3() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def isomorphic(self, other):
"""
does a very basic check if these graphs are the same
If no BNodes are involved, this is accurate.
See rdflib.compare for a correct implementation of isomorphism checks
"""
# TODO: this is only an approximation.
if len(self) != len... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def all_nodes(self):
res = set(self.objects())
res.update(self.subjects())
return res | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def resource(self, identifier):
"""Create a new ``Resource`` instance.
Parameters:
- ``identifier``: a URIRef or BNode instance.
Example::
>>> graph = Graph()
>>> uri = URIRef("http://example.org/resource")
>>> resource = graph.resource(uri)
... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def skolemize(self, new_graph=None, bnode=None, authority=None, basepath=None):
def do_skolemize(bnode, t):
(s, p, o) = t
if s == bnode:
s = s.skolemize(authority=authority, basepath=basepath)
if o == bnode:
o = o.skolemize(authority=authority,... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def do_de_skolemize(uriref, t):
(s, p, o) = t
if s == uriref:
s = s.de_skolemize()
if o == uriref:
o = o.de_skolemize()
return s, p, o | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def cbd(self, resource):
"""Retrieves the Concise Bounded Description of a Resource from a Graph
Concise Bounded Description (CBD) is defined in [1] as:
Given a particular node (the starting node) in a particular RDF graph (the source graph), a subgraph of that
particular graph, taken ... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __init__(
self,
store: Union[Store, str] = "default",
identifier: Optional[Union[IdentifiedNode, str]] = None,
default_graph_base: Optional[str] = None, | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __str__(self):
pattern = (
"[a rdflib:ConjunctiveGraph;rdflib:storage "
"[a rdflib:Store;rdfs:label '%s']]"
)
return pattern % self.store.__class__.__name__ | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def _spoc(
self,
triple_or_quad: Union[
Tuple[Node, Node, Node, Optional[Any]], Tuple[Node, Node, Node]
],
default: bool = False, | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def _spoc(
self,
triple_or_quad: None,
default: bool = False, | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def _spoc(
self,
triple_or_quad: Optional[
Union[Tuple[Node, Node, Node, Optional[Any]], Tuple[Node, Node, Node]]
],
default: bool = False, | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __contains__(self, triple_or_quad):
"""Support for 'triple/quad in graph' syntax"""
s, p, o, c = self._spoc(triple_or_quad)
for t in self.triples((s, p, o), context=c):
return True
return False | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def _graph(self, c: Union[Graph, Node, str]) -> Graph:
... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def _graph(self, c: None) -> None:
... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def addN(self, quads: Iterable[Tuple[Node, Node, Node, Any]]):
"""Add a sequence of triples with context"""
self.store.addN(
(s, p, o, self._graph(c)) for s, p, o, c in quads if _assertnode(s, p, o)
)
return self | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def triples(self, triple_or_quad, context=None):
"""
Iterate over all the triples in the entire conjunctive graph
For legacy reasons, this can take the context to query either
as a fourth element of the quad, or as the explicit context
keyword parameter. The kw param takes prece... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def triples_choices(self, triple, context=None):
"""Iterate over all the triples in the entire conjunctive graph"""
s, p, o = triple
if context is None:
if not self.default_union:
context = self.default_context
else:
context = self._graph(context)
... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def contexts(self, triple=None):
"""Iterate over all contexts in the graph
If triple is specified, iterate over all contexts the triple is in.
"""
for context in self.store.contexts(triple):
if isinstance(context, Graph):
# TODO: One of these should never hap... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def remove_context(self, context):
"""Removes the given context from the graph"""
self.store.remove((None, None, None), context) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def parse(
self,
source: Optional[
Union[IO[bytes], TextIO, InputSource, str, bytes, pathlib.PurePath]
] = None,
publicID: Optional[str] = None,
format: Optional[str] = None,
location: Optional[str] = None,
file: Optional[Union[BinaryIO, TextIO]] = Non... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __reduce__(self):
return ConjunctiveGraph, (self.store, self.identifier) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __init__(self, store="default", default_union=False, default_graph_base=None):
super(Dataset, self).__init__(store=store, identifier=None)
if not self.store.graph_aware:
raise Exception("DataSet must be backed by a graph-aware store!")
self.default_context = Graph(
s... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __reduce__(self):
return (type(self), (self.store, self.default_union)) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __setstate__(self, state):
self.store, self.identifier, self.default_context, self.default_union = state | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def parse(
self,
source=None,
publicID=None,
format=None,
location=None,
file=None,
data=None,
**args, | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def add_graph(self, g):
"""alias of graph for consistency"""
return self.graph(g) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def contexts(self, triple=None):
default = False
for c in super(Dataset, self).contexts(triple):
default |= c.identifier == DATASET_DEFAULT_GRAPH_ID
yield c
if not default:
yield self.graph(DATASET_DEFAULT_GRAPH_ID) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def quads(self, quad):
for s, p, o, c in super(Dataset, self).quads(quad):
if c.identifier == self.default_context:
yield s, p, o, None
else:
yield s, p, o, c.identifier | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __init__(self, store, identifier):
super(QuotedGraph, self).__init__(store, identifier) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def addN(self, quads: Tuple[Node, Node, Node, Any]) -> "QuotedGraph": # type: ignore[override]
"""Add a sequence of triple with context"""
self.store.addN(
(s, p, o, c)
for s, p, o, c in quads
if isinstance(c, QuotedGraph)
and c.identifier is self.identi... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __str__(self):
identifier = self.identifier.n3()
label = self.store.__class__.__name__
pattern = (
"{this rdflib.identifier %s;rdflib:storage "
"[a rdflib:Store;rdfs:label '%s']}"
)
return pattern % (identifier, label) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __init__(self, graph, subject):
"""Parameters:
- graph:
the graph containing the Seq
- subject:
the subject of a Seq. Note that the init does not
check whether this is a Seq, this is done in whoever
creates this instance!
"""
... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __iter__(self):
"""Generator over the items in the Seq"""
for _, item in self._list:
yield item | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __getitem__(self, index):
"""Item given by index from the Seq"""
index, item = self._list.__getitem__(index)
return item | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __init__(self):
pass | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __init__(self):
pass | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __init__(self, graphs, store="default"):
if store is not None:
super(ReadOnlyGraphAggregate, self).__init__(store)
Graph.__init__(self, store)
self.__namespace_manager = None
assert (
isinstance(graphs, list)
and graphs
and [g ... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def destroy(self, configuration):
raise ModificationException() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def commit(self):
raise ModificationException() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def open(self, configuration, create=False):
# TODO: is there a use case for this method?
for graph in self.graphs:
graph.open(self, configuration, create) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def add(self, triple):
raise ModificationException() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def remove(self, triple):
raise ModificationException() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __contains__(self, triple_or_quad):
context = None
if len(triple_or_quad) == 4:
context = triple_or_quad[3]
for graph in self.graphs:
if context is None or graph.identifier == context.identifier:
if triple_or_quad[:3] in graph:
retu... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __len__(self):
return sum(len(g) for g in self.graphs) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __cmp__(self, other):
if other is None:
return -1
elif isinstance(other, Graph):
return -1
elif isinstance(other, ReadOnlyGraphAggregate):
return (self.graphs > other.graphs) - (self.graphs < other.graphs)
else:
return -1 | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __isub__(self, other):
raise ModificationException() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def triples_choices(self, triple, context=None):
subject, predicate, object_ = triple
for graph in self.graphs:
choices = graph.triples_choices((subject, predicate, object_))
for (s, p, o) in choices:
yield s, p, o | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def compute_qname(self, uri, generate=True):
if hasattr(self, "namespace_manager") and self.namespace_manager:
return self.namespace_manager.compute_qname(uri, generate)
raise UnSupportedAggregateOperation() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def namespaces(self):
if hasattr(self, "namespace_manager"):
for prefix, namespace in self.namespace_manager.namespaces():
yield prefix, namespace
else:
for graph in self.graphs:
for prefix, namespace in graph.namespaces():
yiel... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def parse(self, source, publicID=None, format=None, **args):
raise ModificationException() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __reduce__(self):
raise UnSupportedAggregateOperation() | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __init__(self, graph: Graph, batch_size: int = 1000, batch_addn: bool = False):
if not batch_size or batch_size < 2:
raise ValueError("batch_size must be a positive number")
self.graph = graph
self.__graph_tuple = (graph,)
self.__batch_size = batch_size
self.__bat... | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def add(
self,
triple_or_quad: Union[Tuple[Node, Node, Node], Tuple[Node, Node, Node, Any]], | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def addN(self, quads: Iterable[Tuple[Node, Node, Node, Any]]):
if self.__batch_addn:
for q in quads:
self.add(q)
else:
self.graph.addN(quads)
return self | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def __exit__(self, *exc):
if exc[0] is None:
self.graph.addN(self.batch) | RDFLib/rdflib | [
1851,
516,
1851,
221,
1328248153
] |
def activate_user(self, activation_key):
"""Validate an activation key and activate the corresponding
``User`` if valid.
If the key is valid and has not expired, return the ``User``
after activating.
If the key is not valid or has expired, return ``False``.
If the key ... | bruth/django-registration2 | [
11,
7,
11,
1,
1306440552
] |
def test_exception_for_no_callbacks(self) -> None:
m = SomeModel()
with pytest.raises(ValueError):
m.js_on_change('foo') | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_with_propname(self) -> None:
cb = CustomJS(code="")
m0 = SomeModel()
for name in m0.properties():
m = SomeModel()
m.js_on_change(name, cb)
assert m.js_property_callbacks == {"change:%s" % name: [cb]} | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_with_multple_callbacks(self) -> None:
cb1 = CustomJS(code="")
cb2 = CustomJS(code="")
m = SomeModel()
m.js_on_change('foo', cb1, cb2)
assert m.js_property_callbacks == {"foo": [cb1, cb2]} | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_ignores_dupe_callbacks(self) -> None:
cb = CustomJS(code="")
m = SomeModel()
m.js_on_change('foo', cb, cb)
assert m.js_property_callbacks == {"foo": [cb]} | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_with_multple_callbacks(self) -> None:
cb1 = CustomJS(code="foo")
cb2 = CustomJS(code="bar")
m = SomeModel()
m.js_on_event("some", cb1, cb2)
assert m.js_event_callbacks == {"some": [cb1, cb2]} | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_ignores_dupe_callbacks(self) -> None:
cb = CustomJS(code="foo")
m = SomeModel()
m.js_on_event("some", cb, cb)
assert m.js_event_callbacks == {"some": [cb]} | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_value_error_on_bad_attr(self) -> None:
m1 = SomeModel()
m2 = SomeModel()
with pytest.raises(ValueError) as e:
m1.js_link('junk', m2, 'b')
assert str(e.value).endswith("%r is not a property of self (%r)" % ("junk", m1)) | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_value_error_on_bad_other_attr(self) -> None:
m1 = SomeModel()
m2 = SomeModel()
with pytest.raises(ValueError) as e:
m1.js_link('a', m2, 'junk')
assert str(e.value).endswith("%r is not a property of other (%r)" % ("junk", m2)) | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_attr_selector_creates_customjs_int(self) -> None:
m1 = SomeModel()
m2 = SomeModel()
assert len(m1.js_property_callbacks) == 0
m1.js_link('a', m2, 'b', 1)
assert len(m1.js_property_callbacks) == 1
assert "change:a" in m1.js_property_callbacks
cbs = m1.js_p... | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_attr_selector_creates_customjs_str(self) -> None:
m1 = SomeModel()
m2 = SomeModel()
assert len(m1.js_property_callbacks) == 0
m1.js_link('a', m2, 'b', "test")
assert len(m1.js_property_callbacks) == 1
assert "change:a" in m1.js_property_callbacks
cbs = m1... | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def test_select() -> None:
# we aren't trying to replace test_query here, only test
# our wrappers around it, so no need to try every kind of
# query
d = document.Document()
root1 = SomeModel(a=42, name='a')
root2 = SomeModel(a=43, name='c')
root3 = SomeModel(a=44, name='d')
root4 = Some... | bokeh/bokeh | [
17326,
4066,
17326,
698,
1332776401
] |
def authenticateWebAppUser(self, username, password):
""" Attempts to validate authenticate the supplied username/password
Attempt to authenticate the user against the list of users in
web_app_user table. If successful, a dict with user innformation is
returned. If not, the function ret... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def addAGLogin(self, email, name, address, city, state, zip_, country):
"""Adds a new login or returns the login_id if email already exists
Parameters
----------
email : str
Email to register for user
name : str
Name to register for user
address :... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def getAGSurveyDetails(self, survey_id, language):
"""Returns survey information of a specific survey_id and language
Parameters
----------
survey_id : str
the id of the survey group
language : str
the language the survey is intended for
Returns
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def getKnownLanguages(self):
"""Returns all known language locales
Returns
-------
list of strings
List of language locales used for surveys
Raises
------
ValueError
Languages were not able to be found
"""
sql = """SELECT ... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def registerHandoutKit(self, ag_login_id, supplied_kit_id):
"""Registeres a handout kit to a user
Parameters
----------
ag_login_id : str
UUID4 formatted string of login ID to associate with kit
supplied_kit_id : str
kit ID for the handout kit
Re... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def deleteAGParticipantSurvey(self, ag_login_id, participant_name):
# Remove user from new schema
with TRN:
sql = """SELECT survey_id, participant_email
FROM ag_login_surveys
JOIN ag_consent USING (ag_login_id, participant_name)
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def getConsent(self, survey_id):
with TRN:
TRN.add("""SELECT agc.participant_name,
agc.participant_email,
agc.parent_1_name,
agc.parent_2_name,
agc.is_juvenile,
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def deleteSample(self, barcode, ag_login_id):
""" Removes by either releasing barcode back for relogging or withdraw
Parameters
----------
barcode : str
Barcode to delete
ag_login_id : UUID4
Login ID for the barcode
Notes
-----
St... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def associate_barcode_to_survey_id(self, ag_login_id, participant_name,
barcode, survey_id):
"""Associate a barcode to a survey ID
Parameters
----------
ag_login_id : str
A valid AG login ID
participant_name : str
Th... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def get_vioscreen_status(self, survey_id):
"""Retrieves the vioscreen status for a survey_id
Parameters
----------
survey_id : str
The survey to get status for
Returns
-------
int
Vioscreen status
Raises
------
Va... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def getParticipantSamples(self, ag_login_id, participant_name):
sql = """SELECT DISTINCT
ag_kit_barcodes.barcode,
ag_kit_barcodes.site_sampled,
ag_kit_barcodes.sample_date,
ag_kit_barcodes.sample_time,
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def getAvailableBarcodes(self, ag_login_id):
sql = """SELECT barcode
FROM ag_kit_barcodes
INNER JOIN ag_kit USING (ag_kit_id)
WHERE coalesce(sample_date::text, '') = ''
AND kit_verified = 'y' AND ag_login_id = %s"""
with TRN:
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def _get_unverified_kits(self):
"""Gets list of unverified kit IDs, Helper function for tests"""
sql = """SELECT supplied_kit_id
FROM AG_KIT
WHERE NOT kit_verified = 'y'"""
with TRN:
TRN.add(sql)
return TRN.execute_fetchflatten() | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def handoutCheck(self, username, password):
with TRN:
password = password.encode('utf-8')
sql = "SELECT password FROM ag.ag_handout_kits WHERE kit_id = %s"
TRN.add(sql, [username])
to_check = TRN.execute_fetchindex()
if not to_check:
r... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def getAGKitIDsByEmail(self, email):
"""Returns a list of kitids based on email
email is email address of login
returns a list of kit_id's associated with the email or an empty list
"""
with TRN:
sql = """SELECT supplied_kit_id
FROM ag_kit
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def ag_update_kit_password(self, kit_id, password):
"""updates ag_kit table with password
kit_id is supplied_kit_id in the ag_kit table
password is the new password
"""
with TRN:
password = password.encode('utf-8')
password = bcrypt.hashpw(password, bcryp... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def getBarcodesByKit(self, kitid):
"""Returns a list of barcodes in a kit
kitid is the supplied_kit_id from the ag_kit table
"""
sql = """SELECT barcode
FROM ag_kit_barcodes
INNER JOIN ag_kit USING (ag_kit_id)
WHERE supplied_kit_id = %s... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def checkPrintResults(self, kit_id):
"""Checks whether or not results are available for a given `kit_id`
Parameters
----------
kit_id : str
The supplied kit identifier to check for results availability.
Returns
-------
bool
Whether or not... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def get_menu_items(self, supplied_kit_id):
"""Returns information required to populate the menu of the website"""
with TRN:
ag_login_id = self.get_user_for_kit(supplied_kit_id)
info = self.getAGKitDetails(supplied_kit_id)
kit_verified = False
if info['kit... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def get_user_info(self, supplied_kit_id):
with TRN:
sql = """SELECT CAST(ag_login_id AS VARCHAR(100)) AS ag_login_id,
email, name, address, city, state, zip, country
FROM ag_login
INNER JOIN ag_kit USING(ag_login_id)
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def get_login_info(self, ag_login_id):
"""Get kit registration information
Parameters
----------
ag_login_id : str
A valid login ID, that should be a test as a valid UUID
Returns
-------
list of dict
A list of registration information ass... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def get_participants_surveys(self, ag_login_id, participant_name,
locale='american'):
"""Returns all surveys (except external) for one participant for a
AG login.
Parameters
----------
ag_login_id : str
A valid login ID, that shoul... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def get_countries(self):
"""
Returns
-------
list of str
All country names in database"""
with TRN:
sql = 'SELECT country FROM ag.iso_country_lookup ORDER BY country'
TRN.add(sql)
return TRN.execute_fetchflatten() | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def ut_get_arbitrary_supplied_kit_id_scanned_unconsented(self):
""" Returns arbitrarily chosen supplied_kit_id and barcode which has
been scanned but is without consent.
For unit testing only!
Returns
-------
list of str: [supplied_kit_id, barcode]
example: [... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def ut_get_arbitrary_email(self):
""" Return arbitrarily chosen email.
For unit testing only!
Returns
-------
str: email
Example: 'a03E9u6ZAu@glA+)./Vn'
Raises
------
ValueError
If no emails be found in the DB."""
with TRN... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def ut_get_email_from_ag_login_id(self, ag_login_id):
""" Returns email for a given ag_login_id.
For unit testing only!
Parameters
----------
ag_login_id : str
Existing ag_login_id.
Returns
-------
str: email
Example: 'xX/tEv7O+T@... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def ut_get_participant_names_from_ag_login_id(self, ag_login_id):
""" Returns all participant_name(s) for a given ag_login_id.
For unit testing only!
Parameters
----------
ag_login_id : str
Existing ag_login_id.
Returns
-------
[[str]]
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def ut_get_arbitrary_supplied_kit_id_unverified(self):
""" Returns a randomly chosen supplied_kit_id that is unverified.
For unit testing only!
Returns
-------
str: supplied_kit_id
Example: 'FajNh'
Raises
------
... | biocore/american-gut-web | [
5,
24,
5,
54,
1407188842
] |
def test_model_definition_pickle():
defn = model_definition(10, [bb, niw(3)])
bstr = pickle.dumps(defn)
defn1 = pickle.loads(bstr)
assert_equals(defn.n(), defn1.n())
assert_equals(len(defn.models()), len(defn1.models()))
for a, b in zip(defn.models(), defn1.models()):
assert_equals(a.nam... | datamicroscopes/mixturemodel | [
12,
3,
12,
2,
1403576375
] |
def extractToomtummootstranslationsWordpressCom(item):
'''
Parser for 'toomtummootstranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', ... | fake-name/ReadableWebProxy | [
191,
16,
191,
3,
1437712243
] |
def handle_sharp_command(command, user, randomuri, implant_id):
# alias mapping
for alias in cs_alias:
if alias[0] == command[:len(command.rstrip())]:
command = alias[1]
# alias replace
for alias in cs_replace:
if command.startswith(alias[0]):
command = command.... | nettitude/PoshC2 | [
1460,
291,
1460,
19,
1532336012
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.