_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q245900 | QuerySet.only | train | def only(self, *fields):
"""
Essentially, the opposite of defer. Only the fields passed into this
method and that are not already specified as deferred are loaded
immediately | python | {
"resource": ""
} |
q245901 | QuerySet.using | train | def using(self, alias):
"""
Selects which database this QuerySet should excecute its query against.
"""
| python | {
"resource": ""
} |
q245902 | QuerySet.from_qs | train | def from_qs(cls, qs, **kwargs):
"""
Creates a new queryset using class `cls` using `qs'` data.
:param qs: The query set to clone
:keyword kwargs: The kwargs | python | {
"resource": ""
} |
q245903 | SettingsBuilder.add_mapping | train | def add_mapping(self, data, name=None):
"""
Add a new mapping
"""
from .mappings import DocumentObjectField
from .mappings import NestedObject
from .mappings import ObjectField
if isinstance(data, (DocumentObjectField, ObjectField, NestedObject)):
sel... | python | {
"resource": ""
} |
q245904 | get_field | train | def get_field(name, data, default="object", document_object_field=None, is_document=False):
"""
Return a valid Field by given data
"""
if isinstance(data, AbstractField):
return data
data = keys_to_string(data)
_type = data.get('type', default)
if _type == "string":
return St... | python | {
"resource": ""
} |
q245905 | ObjectField.get_properties_by_type | train | def get_properties_by_type(self, type, recursive=True, parent_path=""):
"""
Returns a sorted list of fields that match the type.
:param type the type of the field "string","integer" or a list of types
:param recursive recurse to sub object
:returns a sorted list of fields the ma... | python | {
"resource": ""
} |
q245906 | ObjectField.get_property_by_name | train | def get_property_by_name(self, name):
"""
Returns a mapped object.
:param name the name of the property
:returns the mapped object or exception NotFoundMapping
"""
if "." not in name and name in self.properties:
return self.properties[name]
tokens =... | python | {
"resource": ""
} |
q245907 | ObjectField.get_available_facets | train | def get_available_facets(self):
"""
Returns Available facets for the document
"""
result = []
for k, v in list(self.properties.items()):
if isinstance(v, DateField):
if not v.tokenize:
result.append((k, "date"))
elif isi... | python | {
"resource": ""
} |
q245908 | ObjectField.get_datetime_properties | train | def get_datetime_properties(self, recursive=True):
"""
Returns a dict of property.path and property.
:param recursive the name of the property
:returns a dict
"""
res = {}
for name, field in self.properties.items():
if isinstance(field, DateField):
... | python | {
"resource": ""
} |
q245909 | DocumentObjectField.get_meta | train | def get_meta(self, subtype=None):
"""
Return the meta data.
| python | {
"resource": ""
} |
q245910 | Mapper._process | train | def _process(self, data):
"""
Process indexer data
"""
indices = []
for indexname, indexdata in list(data.items()):
idata = []
for docname, docdata in list(indexdata.get("mappings", {}).items()):
o = get_field(docname, docdata, document_obj... | python | {
"resource": ""
} |
q245911 | Mapper.get_doctypes | train | def get_doctypes(self, index, edges=True):
"""
Returns a list of doctypes given an index | python | {
"resource": ""
} |
q245912 | Mapper.get_doctype | train | def get_doctype(self, index, name):
"""
Returns a doctype given an index and a name
| python | {
"resource": ""
} |
q245913 | Mapper.get_property | train | def get_property(self, index, doctype, name):
"""
Returns a property of a given type
:return a mapped property
| python | {
"resource": ""
} |
q245914 | Mapper.migrate | train | def migrate(self, mapping, index, doc_type):
"""
Migrate a ES mapping
:param mapping: new mapping
:param index: index of old mapping
:param doc_type: type of old mapping
:return: The diff mapping
"""
old_mapping = self.get_doctype(index, doc_type)
... | python | {
"resource": ""
} |
q245915 | ScriptFields.add_field | train | def add_field(self, name, script, lang=None, params=None, ignore_failure=False):
"""
Add a field to script_fields
"""
data = {}
if lang:
data["lang"] = lang
if script:
data['script'] = script
else:
raise ScriptFieldsError("Scri... | python | {
"resource": ""
} |
q245916 | ScriptFields.add_parameter | train | def add_parameter(self, field_name, param_name, param_value):
"""
Add a parameter to a field into script_fields
The ScriptFields object will be returned, so calls to this can be chained.
"""
try:
self.fields[field_name]['params'][param_name] = | python | {
"resource": ""
} |
q245917 | Suggest.add | train | def add(self, text, name, field, type='term', size=None, params=None):
"""
Set the suggester of given type.
:param text: text
:param name: name of suggest
:param field: field to be used
:param type: type of suggester to add, available types are: completion,
... | python | {
"resource": ""
} |
q245918 | Search.add_highlight | train | def add_highlight(self, field, fragment_size=None,
number_of_fragments=None, fragment_offset=None, type=None):
"""Add a highlight field.
The Search object will be returned, so calls to this can be chained.
"""
if self._highlight is None:
| python | {
"resource": ""
} |
q245919 | Search.add_index_boost | train | def add_index_boost(self, index, boost):
"""Add a boost on an index.
The Search object will be returned, so calls to this can be chained.
"""
if boost is None:
if | python | {
"resource": ""
} |
q245920 | ConstantScoreQuery.add | train | def add(self, filter_or_query):
"""Add a filter, or a list of filters, to the query.
If a sequence of filters is supplied, they are all added, and will be
combined with an ANDFilter.
If a sequence of queries is supplied, they are all added, and will be
combined with an BooleanQ... | python | {
"resource": ""
} |
q245921 | get_names | train | def get_names():
"""
Return a list of names.
"""
return [n.strip() for n in | python | {
"resource": ""
} |
q245922 | ext_process | train | def ext_process(listname, hostname, url, filepath, msg):
"""Here's where you put your code to deal with the just archived message.
Arguments here are the list name, the host name, the URL to the just
archived message, the file system path to the just archived message and
the message object.
These ... | python | {
"resource": ""
} |
q245923 | main | train | def main():
"""This is the mainline.
It first invokes the pipermail archiver to add the message to the archive,
then calls the function above to do whatever with the archived message
after it's URL and path are known.
"""
listname = sys.argv[2]
hostname = sys.argv[1]
# We must get the... | python | {
"resource": ""
} |
q245924 | make_path | train | def make_path(*path_components):
"""
Smash together the path components. Empty components will be ignored.
"""
path_components = [quote(component) for component in path_components if component]
| python | {
"resource": ""
} |
q245925 | clean_string | train | def clean_string(text):
"""
Remove Lucene reserved characters from query string
"""
if isinstance(text, six.string_types):
| python | {
"resource": ""
} |
q245926 | keys_to_string | train | def keys_to_string(data):
"""
Function to convert all the unicode keys in string keys
"""
if isinstance(data, dict):
for key in list(data.keys()):
if isinstance(key, six.string_types):
value = data[key]
| python | {
"resource": ""
} |
q245927 | ESRange.negate | train | def negate(self):
"""Reverse the range"""
self.from_value, self.to_value = self.to_value, self.from_value
| python | {
"resource": ""
} |
q245928 | raise_if_error | train | def raise_if_error(status, result, request=None):
"""Raise an appropriate exception if the result is an error.
Any result with a status code of 400 or higher is considered an error.
The exception raised will either be an ElasticSearchException, or a more
specific subclass of ElasticSearchException if ... | python | {
"resource": ""
} |
q245929 | QuerySet._django_to_es_field | train | def _django_to_es_field(self, field):
"""We use this function in value_list and ordering to get the correct fields name"""
from django.db import models
prefix = ""
if field.startswith("-"):
prefix = "-"
field = field.lstrip("-")
if field in ["id", "pk"]:... | python | {
"resource": ""
} |
q245930 | QuerySet.none | train | def none(self):
"""
Returns an empty QuerySet.
"""
| python | {
"resource": ""
} |
q245931 | QuerySet.rescorer | train | def rescorer(self, rescorer):
"""
Returns a new QuerySet with a set rescorer.
"""
| python | {
"resource": ""
} |
q245932 | QuerySet._get_filter_modifier | train | def _get_filter_modifier(self, field):
"""Detect the filter modifier"""
tokens = field.split(FIELD_SEPARATOR)
| python | {
"resource": ""
} |
q245933 | QuerySet._prepare_value | train | def _prepare_value(self, value, dj_field=None):
"""Cook the value"""
from django.db import models
if isinstance(value, (six.string_types, int, float)):
return value
elif isinstance(value, SimpleLazyObject):
return value.pk
elif isinstance(value, models.Mo... | python | {
"resource": ""
} |
q245934 | QuerySet.order_by | train | def order_by(self, *field_names):
"""
Returns a new QuerySet instance with the ordering changed.
We have a special field "_random"
"""
obj = self._clone()
| python | {
"resource": ""
} |
q245935 | QuerySet.index | train | def index(self, alias):
"""
Selects which database this QuerySet should execute its query against.
"""
| python | {
"resource": ""
} |
q245936 | QuerySet.size | train | def size(self, size):
"""
Set the query size of this QuerySet should execute its query against.
"""
| python | {
"resource": ""
} |
q245937 | QuerySet.refresh | train | def refresh(self):
"""Refresh an index"""
connection = self.model._meta.dj_connection
return | python | {
"resource": ""
} |
q245938 | Indices.create_index_if_missing | train | def create_index_if_missing(self, index, settings=None):
"""Creates an index if it doesn't already exist.
If supplied, settings must be a dictionary.
:param index: the name of the index
:keyword settings: a settings object or a dict containing settings
"""
| python | {
"resource": ""
} |
q245939 | Indices.get_indices | train | def get_indices(self, include_aliases=False):
"""
Get a dict holding an entry for each index which exists.
If include_alises is True, the dict will also contain entries for
aliases.
The key for each entry in the dict is the index or alias name. The
value is a dict hold... | python | {
"resource": ""
} |
q245940 | Indices.get_closed_indices | train | def get_closed_indices(self):
"""
Get all closed indices.
"""
state = self.conn.cluster.state()
status = self.status()
indices_metadata = set(state['metadata']['indices'].keys())
| python | {
"resource": ""
} |
q245941 | Indices.analyze | train | def analyze(self, text, index=None, analyzer=None, tokenizer=None, filters=None, field=None):
"""
Performs the analysis process on a text and return the tokens breakdown of the text
(See :ref:`es-guide-reference-api-admin-indices-optimize`)
"""
if filters is None:
f... | python | {
"resource": ""
} |
q245942 | ElasticSearchModel.save | train | def save(self, bulk=False, id=None, parent=None, routing=None, force=False):
"""
Save the object and returns id
"""
meta = self._meta
conn = meta['connection']
id = id or meta.get("id", None)
parent = parent or meta.get('parent', None)
routing = routing or... | python | {
"resource": ""
} |
q245943 | ElasticSearchModel.get_id | train | def get_id(self):
""" Force the object saveing to get an id"""
_id = self._meta.get("id", None)
if | python | {
"resource": ""
} |
q245944 | ElasticSearchModel.get_bulk | train | def get_bulk(self, create=False):
"""Return bulk code"""
result = []
op_type = "index"
if create:
op_type = "create"
meta = self._meta
cmd = {op_type: {"_index": meta.index, "_type": meta.type}}
if meta.parent:
| python | {
"resource": ""
} |
q245945 | SortedDict.insert | train | def insert(self, index, key, value):
"""Inserts the key, value pair before the item with the given index."""
if key in self.keyOrder:
n = self.keyOrder.index(key)
del self.keyOrder[n]
| python | {
"resource": ""
} |
q245946 | connect | train | def connect(servers=None, framed_transport=False, timeout=None,
retry_time=60, recycle=None, round_robin=None, max_retries=3):
"""
Constructs a single ElasticSearch connection. Connects to a randomly chosen
server on the list.
If the connection fails, it will attempt to connect to each serv... | python | {
"resource": ""
} |
q245947 | ThreadLocalConnection._ensure_connection | train | def _ensure_connection(self):
"""Make certain we have a valid connection and return it."""
conn = self.connect()
if conn.recycle and conn.recycle < time.time():
logger.debug('Client session | python | {
"resource": ""
} |
q245948 | ThreadLocalConnection.connect | train | def connect(self):
"""Create new connection unless we already have one."""
if not getattr(self._local, 'conn', None):
try:
server = self._servers.get()
logger.debug('Connecting to %s', server)
self._local.conn = ClientTransport(server, self._fr... | python | {
"resource": ""
} |
q245949 | ThreadLocalConnection.close | train | def close(self):
"""If a connection is open, close its transport."""
if self._local.conn:
| python | {
"resource": ""
} |
q245950 | Connection.execute | train | def execute(self, request):
"""Execute a request and return a response"""
url = request.uri
if request.parameters:
url += '?' + urlencode(request.parameters)
if request.headers:
headers = dict(self._headers, **request.headers)
else:
headers = ... | python | {
"resource": ""
} |
q245951 | list_dirs | train | def list_dirs(directory):
"""Returns all directories in a given directory | python | {
"resource": ""
} |
q245952 | list_files | train | def list_files(directory):
"""Returns all files in a given directory
"""
return | python | {
"resource": ""
} |
q245953 | setup_files | train | def setup_files(class_dir, seed):
"""Returns shuffled files
"""
# make sure its reproducible
random.seed(seed)
| python | {
"resource": ""
} |
q245954 | split_files | train | def split_files(files, split_train, split_val, use_test):
"""Splits the files along the provided indices
"""
files_train = files[:split_train]
files_val = files[split_train:split_val] if use_test else files[split_train:]
li = [(files_train, 'train'), (files_val, 'val')]
| python | {
"resource": ""
} |
q245955 | copy_files | train | def copy_files(files_type, class_dir, output):
"""Copies the files from the input folder to the output folder
"""
# get the last part within the file
class_name = path.split(class_dir)[1]
for (files, folder_type) in files_type:
full_path | python | {
"resource": ""
} |
q245956 | NewsClient.get_config | train | def get_config(self):
"""
function to get current configuration
"""
config = {
'location': self.location,
| python | {
"resource": ""
} |
q245957 | NewsClient.params_dict | train | def params_dict(self):
"""
function to get params dict for HTTP request
"""
location_code = 'US'
language_code = 'en'
if len(self.location):
location_code = locationMap[process.extractOne(self.location, self.locations)[0]]
| python | {
"resource": ""
} |
q245958 | NewsClient.get_news | train | def get_news(self):
"""
function to get news articles
"""
if self.topic is None or self.topic is 'Top Stories':
resp = requests.get(top_news_url, params=self.params_dict)
else:
| python | {
"resource": ""
} |
q245959 | NewsClient.parse_feed | train | def parse_feed(content):
"""
utility function to parse feed
"""
feed = feedparser.parse(content)
articles = []
for entry in feed['entries']:
article = {
'title': entry['title'],
'link': entry['link']
}
tr... | python | {
"resource": ""
} |
q245960 | validate_signature | train | def validate_signature(uri, nonce, signature, auth_token=''):
"""
Validates requests made by Plivo to your servers.
:param uri: Your server URL
:param nonce: X-Plivo-Signature-V2-Nonce
:param signature: X-Plivo-Signature-V2 header
:param auth_token: Plivo Auth token
:return: True if the req... | python | {
"resource": ""
} |
q245961 | fetch_credentials | train | def fetch_credentials(auth_id, auth_token):
"""Fetches the right credentials either from params or from environment"""
if not (auth_id and auth_token):
try:
auth_id = os.environ['PLIVO_AUTH_ID']
auth_token = os.environ['PLIVO_AUTH_TOKEN']
except KeyError:
rai... | python | {
"resource": ""
} |
q245962 | Client.process_response | train | def process_response(self,
method,
response,
response_type=None,
objects_type=None):
"""Processes the API response based on the status codes and method used
to access the API
"""
try:
... | python | {
"resource": ""
} |
q245963 | jackknife_indexes | train | def jackknife_indexes(data):
"""
Given data points data, where axis 0 is considered to delineate points, return
a list of arrays where each array is a set of jackknife indexes.
For a given set of data Y, the jackknife sample J[i] is defined | python | {
"resource": ""
} |
q245964 | bootstrap_indexes_moving_block | train | def bootstrap_indexes_moving_block(data, n_samples=10000,
block_length=3, wrap=False):
"""Generate moving-block bootstrap samples.
Given data points `data`, where axis 0 is considered to delineate points,
return a generator for sets of bootstrap indexes. This can be used as a
lis... | python | {
"resource": ""
} |
q245965 | get_protein_substitution_language | train | def get_protein_substitution_language() -> ParserElement:
"""Build a protein substitution parser."""
parser_element = psub_tag + nest(
amino_acid(PSUB_REFERENCE),
| python | {
"resource": ""
} |
q245966 | postpend_location | train | def postpend_location(bel_string: str, location_model) -> str:
"""Rip off the closing parentheses and adds canonicalized modification.
I did this because writing a whole new parsing model for the data would be sad and difficult
:param bel_string: BEL string representing node
:param dict location_model... | python | {
"resource": ""
} |
q245967 | _decanonicalize_edge_node | train | def _decanonicalize_edge_node(node: BaseEntity, edge_data: EdgeData, node_position: str) -> str:
"""Canonicalize a node with its modifiers stored in the given edge to a BEL string.
:param node: A PyBEL node data dictionary
:param edge_data: A PyBEL edge data dictionary
:param node_position: Either :dat... | python | {
"resource": ""
} |
q245968 | edge_to_bel | train | def edge_to_bel(u: BaseEntity, v: BaseEntity, data: EdgeData, sep: Optional[str] = None) -> str:
"""Take two nodes and gives back a BEL string representing the statement.
:param u: The edge's source's PyBEL node data dictionary
:param v: The edge's target's PyBEL node data dictionary
:param data: The e... | python | {
"resource": ""
} |
q245969 | sort_qualified_edges | train | def sort_qualified_edges(graph) -> Iterable[EdgeTuple]:
"""Return the qualified edges, sorted first by citation, then by evidence, then by annotations.
:param BELGraph graph: A BEL graph
"""
qualified_edges = (
(u, v, k, d)
for u, | python | {
"resource": ""
} |
q245970 | _citation_sort_key | train | def _citation_sort_key(t: EdgeTuple) -> str:
"""Make a confusing 4 tuple sortable | python | {
"resource": ""
} |
q245971 | _set_annotation_to_str | train | def _set_annotation_to_str(annotation_data: Mapping[str, Mapping[str, bool]], key: str) -> str:
"""Return a set annotation string."""
value = annotation_data[key]
if len(value) == 1:
| python | {
"resource": ""
} |
q245972 | _unset_annotation_to_str | train | def _unset_annotation_to_str(keys: List[str]) -> str:
"""Return an unset annotation string."""
if len(keys) == 1:
return 'UNSET {}'.format(list(keys)[0]) | python | {
"resource": ""
} |
q245973 | _to_bel_lines_header | train | def _to_bel_lines_header(graph) -> Iterable[str]:
"""Iterate the lines of a BEL graph's corresponding BEL script's header.
:param pybel.BELGraph graph: A BEL graph
"""
yield '# This document was created by PyBEL v{} and bel-resources v{} on {}\n'.format(
VERSION, bel_resources.constants.VERSION... | python | {
"resource": ""
} |
q245974 | group_citation_edges | train | def group_citation_edges(edges: Iterable[EdgeTuple]) -> Iterable[Tuple[str, Iterable[EdgeTuple]]]:
"""Return an iterator over pairs of citation | python | {
"resource": ""
} |
q245975 | group_evidence_edges | train | def group_evidence_edges(edges: Iterable[EdgeTuple]) -> Iterable[Tuple[str, Iterable[EdgeTuple]]]:
"""Return an iterator over pairs of evidence | python | {
"resource": ""
} |
q245976 | _to_bel_lines_body | train | def _to_bel_lines_body(graph) -> Iterable[str]:
"""Iterate the lines of a BEL graph's corresponding BEL script's body.
:param pybel.BELGraph graph: A BEL graph
"""
qualified_edges = sort_qualified_edges(graph)
for citation, citation_edges in group_citation_edges(qualified_edges):
yield 'SE... | python | {
"resource": ""
} |
q245977 | _to_bel_lines_footer | train | def _to_bel_lines_footer(graph) -> Iterable[str]:
"""Iterate the lines of a BEL graph's corresponding BEL script's footer.
:param pybel.BELGraph graph: A BEL graph
"""
unqualified_edges_to_serialize = [
(u, v, d)
for u, v, d in graph.edges(data=True)
if d[RELATION] in UNQUALIFIE... | python | {
"resource": ""
} |
q245978 | to_bel_path | train | def to_bel_path(graph, path: str, mode: str = 'w', **kwargs) -> None:
"""Write the BEL graph as a canonical BEL Script to the given path.
:param BELGraph graph: the BEL Graph to output as a BEL Script
:param path: A file | python | {
"resource": ""
} |
q245979 | calculate_canonical_name | train | def calculate_canonical_name(data: BaseEntity) -> str:
"""Calculate the canonical name for a given node.
If it is a simple node, uses the already given name. Otherwise, it uses the BEL string.
"""
if data[FUNCTION] == COMPLEX and NAMESPACE in data:
return data[NAME]
if VARIANTS in data:
... | python | {
"resource": ""
} |
q245980 | graph_from_edges | train | def graph_from_edges(edges: Iterable[Edge], **kwargs) -> BELGraph:
"""Build a BEL graph from | python | {
"resource": ""
} |
q245981 | QueryManager.query_nodes | train | def query_nodes(self,
bel: Optional[str] = None,
type: Optional[str] = None,
namespace: Optional[str] = None,
name: Optional[str] = None,
) -> List[Node]:
"""Query nodes in the database.
:param bel: BEL ... | python | {
"resource": ""
} |
q245982 | QueryManager.get_edges_with_citation | train | def get_edges_with_citation(self, citation: Citation) -> List[Edge]:
"""Get the edges with the given citation."""
| python | {
"resource": ""
} |
q245983 | QueryManager.get_edges_with_citations | train | def get_edges_with_citations(self, citations: Iterable[Citation]) -> List[Edge]:
"""Get edges | python | {
"resource": ""
} |
q245984 | QueryManager.search_edges_with_evidence | train | def search_edges_with_evidence(self, evidence: str) -> List[Edge]:
"""Search edges with the given evidence.
:param evidence: A string to search evidences. Can use wildcard percent symbol (%).
| python | {
"resource": ""
} |
q245985 | QueryManager.search_edges_with_bel | train | def search_edges_with_bel(self, bel: str) -> List[Edge]:
"""Search edges with given BEL.
:param bel: A BEL string to use as | python | {
"resource": ""
} |
q245986 | QueryManager._add_edge_function_filter | train | def _add_edge_function_filter(query, edge_node_id, node_type):
"""See usage in self.query_edges."""
| python | {
"resource": ""
} |
q245987 | QueryManager.query_edges | train | def query_edges(self,
bel: Optional[str] = None,
source_function: Optional[str] = None,
source: Union[None, str, Node] = None,
target_function: Optional[str] = None,
target: Union[None, str, Node] = None,
... | python | {
"resource": ""
} |
q245988 | QueryManager.query_citations | train | def query_citations(self,
type: Optional[str] = None,
reference: Optional[str] = None,
name: Optional[str] = None,
author: Union[None, str, List[str]] = None,
date: Union[None, str, datetime.date] = N... | python | {
"resource": ""
} |
q245989 | QueryManager.query_edges_by_pubmed_identifiers | train | def query_edges_by_pubmed_identifiers(self, pubmed_identifiers: List[str]) -> List[Edge]:
"""Get all edges annotated to the documents identified by the given PubMed identifiers."""
fi = and_(Citation.type == CITATION_TYPE_PUBMED, | python | {
"resource": ""
} |
q245990 | QueryManager._edge_both_nodes | train | def _edge_both_nodes(nodes: List[Node]):
"""Get edges where both the source and target are in the list of nodes."""
| python | {
"resource": ""
} |
q245991 | QueryManager._edge_one_node | train | def _edge_one_node(nodes: List[Node]):
"""Get edges where either the source or target are in the list of nodes.
Note: doing this with the nodes directly is not yet supported by SQLAlchemy
.. code-block:: python
return or_(
Edge.source.in_(nodes),
Ed... | python | {
"resource": ""
} |
q245992 | QueryManager.query_neighbors | train | def query_neighbors(self, nodes: List[Node]) -> List[Edge]:
"""Get all edges incident | python | {
"resource": ""
} |
q245993 | get_subgraphs_by_annotation | train | def get_subgraphs_by_annotation(graph, annotation, sentinel=None):
"""Stratify the given graph into sub-graphs based on the values for edges' annotations.
:param pybel.BELGraph graph: A BEL graph
:param str annotation: The annotation to group by
:param Optional[str] sentinel: The value to stick unannot... | python | {
"resource": ""
} |
q245994 | extract_shared_optional | train | def extract_shared_optional(bel_resource, definition_header: str = 'Namespace'):
"""Get the optional annotations shared by BEL namespace and annotation resource documents.
:param dict bel_resource: A configuration dictionary representing a BEL resource
:param definition_header: ``Namespace`` or ``Annotatio... | python | {
"resource": ""
} |
q245995 | update_insert_values | train | def update_insert_values(bel_resource: Mapping, mapping: Mapping[str, Tuple[str, str]], values: Dict[str, str]) -> None:
"""Update the value dictionary with a BEL resource dictionary."""
for database_column, (section, key) in mapping.items():
| python | {
"resource": ""
} |
q245996 | int_or_str | train | def int_or_str(v: Optional[str]) -> Union[None, int, str]:
"""Safe converts an string represent an integer to an integer or passes through ``None``."""
if v is None:
| python | {
"resource": ""
} |
q245997 | from_web | train | def from_web(network_id: int, host: Optional[str] = None) -> BELGraph:
"""Retrieve a public network from BEL Commons.
In the future, this function may be extended to support authentication.
:param int network_id: The BEL Commons network identifier
:param Optional[str] host: The location of the BEL Com... | python | {
"resource": ""
} |
q245998 | get_fusion_language | train | def get_fusion_language(identifier: ParserElement, permissive: bool = True) -> ParserElement:
"""Build a fusion parser."""
range_coordinate = Suppress('"') + range_coordinate_unquoted + Suppress('"')
if permissive: # permissive to wrong quoting
range_coordinate = range_coordinate | range_coordinat... | python | {
"resource": ""
} |
q245999 | get_legacy_fusion_langauge | train | def get_legacy_fusion_langauge(identifier: ParserElement, reference: str) -> ParserElement:
"""Build a legacy fusion parser."""
break_start = (ppc.integer | '?').setParseAction(_fusion_break_handler_wrapper(reference, start=True))
break_end = (ppc.integer | '?').setParseAction(_fusion_break_handler_wrapper(... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.