repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
gccxml/pygccxml
pygccxml/declarations/class_declaration.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/class_declaration.py#L494-L504
def top_class(self): """reference to a parent class, which contains this class and defined within a namespace if this class is defined under a namespace, self will be returned""" curr = self parent = self.parent while isinstance(parent, class_t): curr = paren...
[ "def", "top_class", "(", "self", ")", ":", "curr", "=", "self", "parent", "=", "self", ".", "parent", "while", "isinstance", "(", "parent", ",", "class_t", ")", ":", "curr", "=", "parent", "parent", "=", "parent", ".", "parent", "return", "curr" ]
reference to a parent class, which contains this class and defined within a namespace if this class is defined under a namespace, self will be returned
[ "reference", "to", "a", "parent", "class", "which", "contains", "this", "class", "and", "defined", "within", "a", "namespace" ]
python
train
caktus/django-timepiece
timepiece/entries/views.py
https://github.com/caktus/django-timepiece/blob/52515dec027664890efbc535429e1ba1ee152f40/timepiece/entries/views.py#L336-L345
def get_hours_for_week(self, week_start=None): """ Gets all ProjectHours entries in the 7-day period beginning on week_start. """ week_start = week_start if week_start else self.week_start week_end = week_start + relativedelta(days=7) return ProjectHours.objects....
[ "def", "get_hours_for_week", "(", "self", ",", "week_start", "=", "None", ")", ":", "week_start", "=", "week_start", "if", "week_start", "else", "self", ".", "week_start", "week_end", "=", "week_start", "+", "relativedelta", "(", "days", "=", "7", ")", "retu...
Gets all ProjectHours entries in the 7-day period beginning on week_start.
[ "Gets", "all", "ProjectHours", "entries", "in", "the", "7", "-", "day", "period", "beginning", "on", "week_start", "." ]
python
train
geophysics-ubonn/crtomo_tools
lib/crtomo/parManager.py
https://github.com/geophysics-ubonn/crtomo_tools/blob/27c3e21a557f8df1c12455b96c4c2e00e08a5b4a/lib/crtomo/parManager.py#L213-L246
def save_to_rho_file(self, filename, cid_mag, cid_pha=None): """Save one or two parameter sets in the rho.dat forward model format Parameters ---------- filename: string (file path) output filename cid_mag: int ID of magnitude parameter set cid_ph...
[ "def", "save_to_rho_file", "(", "self", ",", "filename", ",", "cid_mag", ",", "cid_pha", "=", "None", ")", ":", "mag_data", "=", "self", ".", "parsets", "[", "cid_mag", "]", "if", "cid_pha", "is", "None", ":", "pha_data", "=", "np", ".", "zeros", "(", ...
Save one or two parameter sets in the rho.dat forward model format Parameters ---------- filename: string (file path) output filename cid_mag: int ID of magnitude parameter set cid_pha: int, optional ID of phase parameter set. If not set, will...
[ "Save", "one", "or", "two", "parameter", "sets", "in", "the", "rho", ".", "dat", "forward", "model", "format" ]
python
train
funilrys/PyFunceble
PyFunceble/directory_structure.py
https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/directory_structure.py#L156-L179
def _restore_replace(self): """ Check if we need to replace ".gitignore" to ".keep". :return: The replacement status. :rtype: bool """ if PyFunceble.path.isdir(self.base + ".git"): # The `.git` directory exist. if "PyFunceble" not in Command("gi...
[ "def", "_restore_replace", "(", "self", ")", ":", "if", "PyFunceble", ".", "path", ".", "isdir", "(", "self", ".", "base", "+", "\".git\"", ")", ":", "# The `.git` directory exist.", "if", "\"PyFunceble\"", "not", "in", "Command", "(", "\"git remote show origin\...
Check if we need to replace ".gitignore" to ".keep". :return: The replacement status. :rtype: bool
[ "Check", "if", "we", "need", "to", "replace", ".", "gitignore", "to", ".", "keep", "." ]
python
test
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L455-L464
def maybe_send(self, recipient: Address, message: Message): """ Send message to recipient if the transport is running. """ if not is_binary_address(recipient): raise InvalidAddress('Invalid address {}'.format(pex(recipient))) messagedata = message.encode() host_port = self....
[ "def", "maybe_send", "(", "self", ",", "recipient", ":", "Address", ",", "message", ":", "Message", ")", ":", "if", "not", "is_binary_address", "(", "recipient", ")", ":", "raise", "InvalidAddress", "(", "'Invalid address {}'", ".", "format", "(", "pex", "("...
Send message to recipient if the transport is running.
[ "Send", "message", "to", "recipient", "if", "the", "transport", "is", "running", "." ]
python
train
numenta/htmresearch
htmresearch/algorithms/apical_tiebreak_temporal_memory.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/algorithms/apical_tiebreak_temporal_memory.py#L567-L601
def _calculatePredictedCells(self, activeBasalSegments, activeApicalSegments): """ Calculate the predicted cells, given the set of active segments. An active basal segment is enough to predict a cell. An active apical segment is *not* enough to predict a cell. When a cell has both types of segment...
[ "def", "_calculatePredictedCells", "(", "self", ",", "activeBasalSegments", ",", "activeApicalSegments", ")", ":", "cellsForBasalSegments", "=", "self", ".", "basalConnections", ".", "mapSegmentsToCells", "(", "activeBasalSegments", ")", "cellsForApicalSegments", "=", "se...
Calculate the predicted cells, given the set of active segments. An active basal segment is enough to predict a cell. An active apical segment is *not* enough to predict a cell. When a cell has both types of segments active, other cells in its minicolumn must also have both types of segments to be con...
[ "Calculate", "the", "predicted", "cells", "given", "the", "set", "of", "active", "segments", "." ]
python
train
inveniosoftware/invenio-stats
invenio_stats/aggregations.py
https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/aggregations.py#L149-L175
def get_bookmark(self): """Get last aggregation date.""" if not Index(self.aggregation_alias, using=self.client).exists(): if not Index(self.event_index, using=self.client).exists(): return datetime.date.today() return...
[ "def", "get_bookmark", "(", "self", ")", ":", "if", "not", "Index", "(", "self", ".", "aggregation_alias", ",", "using", "=", "self", ".", "client", ")", ".", "exists", "(", ")", ":", "if", "not", "Index", "(", "self", ".", "event_index", ",", "using...
Get last aggregation date.
[ "Get", "last", "aggregation", "date", "." ]
python
valid
cebel/pyctd
src/pyctd/manager/query.py
https://github.com/cebel/pyctd/blob/38ba02adaddb60cef031d3b75516773fe8a046b5/src/pyctd/manager/query.py#L489-L538
def get_chemical_diseases(self, direct_evidence=None, inference_gene_symbol=None, inference_score=None, inference_score_operator=None, cas_rn=None, chemical_name=None, chemical_id=None, chemical_definition=None, disease_definition=None, ...
[ "def", "get_chemical_diseases", "(", "self", ",", "direct_evidence", "=", "None", ",", "inference_gene_symbol", "=", "None", ",", "inference_score", "=", "None", ",", "inference_score_operator", "=", "None", ",", "cas_rn", "=", "None", ",", "chemical_name", "=", ...
Get chemical–disease associations with inference gene :param direct_evidence: direct evidence :param inference_gene_symbol: inference gene symbol :param inference_score: inference score :param inference_score_operator: inference score operator :param cas_rn: :par...
[ "Get", "chemical–disease", "associations", "with", "inference", "gene", ":", "param", "direct_evidence", ":", "direct", "evidence", ":", "param", "inference_gene_symbol", ":", "inference", "gene", "symbol", ":", "param", "inference_score", ":", "inference", "score", ...
python
train
acorg/dark-matter
dark/summarize.py
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/summarize.py#L7-L38
def summarizeReads(file_handle, file_type): """ open a fasta or fastq file, prints number of of reads, average length of read, total number of bases, longest, shortest and median read, total number and average of individual base (A, T, G, C, N). """ base_counts = defaultdict(int) read_nu...
[ "def", "summarizeReads", "(", "file_handle", ",", "file_type", ")", ":", "base_counts", "=", "defaultdict", "(", "int", ")", "read_number", "=", "0", "total_length", "=", "0", "length_list", "=", "[", "]", "records", "=", "SeqIO", ".", "parse", "(", "file_...
open a fasta or fastq file, prints number of of reads, average length of read, total number of bases, longest, shortest and median read, total number and average of individual base (A, T, G, C, N).
[ "open", "a", "fasta", "or", "fastq", "file", "prints", "number", "of", "of", "reads", "average", "length", "of", "read", "total", "number", "of", "bases", "longest", "shortest", "and", "median", "read", "total", "number", "and", "average", "of", "individual"...
python
train
quintusdias/glymur
glymur/codestream.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L801-L852
def _parse_tlm_segment(self, fptr): """Parse the TLM segment. Parameters ---------- fptr : file Open file object. Returns ------- TLMSegment The current TLM segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
[ "def", "_parse_tlm_segment", "(", "self", ",", "fptr", ")", ":", "offset", "=", "fptr", ".", "tell", "(", ")", "-", "2", "read_buffer", "=", "fptr", ".", "read", "(", "2", ")", "length", ",", "=", "struct", ".", "unpack", "(", "'>H'", ",", "read_bu...
Parse the TLM segment. Parameters ---------- fptr : file Open file object. Returns ------- TLMSegment The current TLM segment.
[ "Parse", "the", "TLM", "segment", "." ]
python
train
materialsproject/pymatgen
pymatgen/core/ion.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/ion.py#L70-L81
def formula(self): """ Returns a formula string, with elements sorted by electronegativity, e.g., Li4 Fe4 P4 O16. """ formula = super().formula chg_str = "" if self.charge > 0: chg_str = " +" + formula_double_format(self.charge, False) elif sel...
[ "def", "formula", "(", "self", ")", ":", "formula", "=", "super", "(", ")", ".", "formula", "chg_str", "=", "\"\"", "if", "self", ".", "charge", ">", "0", ":", "chg_str", "=", "\" +\"", "+", "formula_double_format", "(", "self", ".", "charge", ",", "...
Returns a formula string, with elements sorted by electronegativity, e.g., Li4 Fe4 P4 O16.
[ "Returns", "a", "formula", "string", "with", "elements", "sorted", "by", "electronegativity", "e", ".", "g", ".", "Li4", "Fe4", "P4", "O16", "." ]
python
train
ralphje/imagemounter
imagemounter/volume.py
https://github.com/ralphje/imagemounter/blob/86213781c366cad65096447d91f522f0a3fb4b93/imagemounter/volume.py#L166-L184
def _get_blkid_type(self): """Retrieves the FS type from the blkid command.""" try: result = _util.check_output_(['blkid', '-p', '-O', str(self.offset), self.get_raw_path()]) if not result: return None # noinspection PyTypeChecker blkid_re...
[ "def", "_get_blkid_type", "(", "self", ")", ":", "try", ":", "result", "=", "_util", ".", "check_output_", "(", "[", "'blkid'", ",", "'-p'", ",", "'-O'", ",", "str", "(", "self", ".", "offset", ")", ",", "self", ".", "get_raw_path", "(", ")", "]", ...
Retrieves the FS type from the blkid command.
[ "Retrieves", "the", "FS", "type", "from", "the", "blkid", "command", "." ]
python
train
fuhrysteve/marshmallow-jsonschema
marshmallow_jsonschema/base.py
https://github.com/fuhrysteve/marshmallow-jsonschema/blob/3e0891a79d586c49deb75188d9ee1728597d093b/marshmallow_jsonschema/base.py#L96-L107
def _get_default_mapping(self, obj): """Return default mapping if there are no special needs.""" mapping = {v: k for k, v in obj.TYPE_MAPPING.items()} mapping.update({ fields.Email: text_type, fields.Dict: dict, fields.Url: text_type, fields.List: ...
[ "def", "_get_default_mapping", "(", "self", ",", "obj", ")", ":", "mapping", "=", "{", "v", ":", "k", "for", "k", ",", "v", "in", "obj", ".", "TYPE_MAPPING", ".", "items", "(", ")", "}", "mapping", ".", "update", "(", "{", "fields", ".", "Email", ...
Return default mapping if there are no special needs.
[ "Return", "default", "mapping", "if", "there", "are", "no", "special", "needs", "." ]
python
train
limix/limix-core
limix_core/mean/mean_efficient.py
https://github.com/limix/limix-core/blob/5c590b4d351409f83ca320844b4897ce92203814/limix_core/mean/mean_efficient.py#L223-L232
def XanyKXany(self): """ compute self covariance for any """ result = np.empty((self.P,self.F_any.shape[1],self.F_any.shape[1]), order='C') for p in range(self.P): X1D = self.Fstar_any * self.D[:,p:p+1] X1X2 = X1D.T.dot(self.Fstar_any) result[p...
[ "def", "XanyKXany", "(", "self", ")", ":", "result", "=", "np", ".", "empty", "(", "(", "self", ".", "P", ",", "self", ".", "F_any", ".", "shape", "[", "1", "]", ",", "self", ".", "F_any", ".", "shape", "[", "1", "]", ")", ",", "order", "=", ...
compute self covariance for any
[ "compute", "self", "covariance", "for", "any" ]
python
train
klen/starter
starter/core.py
https://github.com/klen/starter/blob/24a65c10d4ac5a9ca8fc1d8b3d54b3fb13603f5f/starter/core.py#L180-L211
def copy(self): """ Prepare and paste self templates. """ templates = self.prepare_templates() if self.params.interactive: keys = list(self.parser.default) for key in keys: if key.startswith('_'): continue prompt = "{0} ...
[ "def", "copy", "(", "self", ")", ":", "templates", "=", "self", ".", "prepare_templates", "(", ")", "if", "self", ".", "params", ".", "interactive", ":", "keys", "=", "list", "(", "self", ".", "parser", ".", "default", ")", "for", "key", "in", "keys"...
Prepare and paste self templates.
[ "Prepare", "and", "paste", "self", "templates", "." ]
python
train
mottosso/be
be/vendor/requests/packages/chardet/chardistribution.py
https://github.com/mottosso/be/blob/0f3d4f3597c71223f616d78c6d9b2c8dffcd8a71/be/vendor/requests/packages/chardet/chardistribution.py#L82-L96
def get_confidence(self): """return confidence based on existing data""" # if we didn't receive any character in our consideration range, # return negative answer if self._mTotalChars <= 0 or self._mFreqChars <= MINIMUM_DATA_THRESHOLD: return SURE_NO if self._mTotalC...
[ "def", "get_confidence", "(", "self", ")", ":", "# if we didn't receive any character in our consideration range,", "# return negative answer", "if", "self", ".", "_mTotalChars", "<=", "0", "or", "self", ".", "_mFreqChars", "<=", "MINIMUM_DATA_THRESHOLD", ":", "return", "...
return confidence based on existing data
[ "return", "confidence", "based", "on", "existing", "data" ]
python
train
radujica/baloo
baloo/weld/weld_group.py
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_group.py#L219-L284
def weld_groupby_aggregate(grouped_df, weld_types, by_indices, aggregation, result_type=None): """Perform aggregation on grouped data. Parameters ---------- grouped_df : WeldObject DataFrame which has been grouped through weld_groupby. weld_types : list of WeldType Corresponding to ...
[ "def", "weld_groupby_aggregate", "(", "grouped_df", ",", "weld_types", ",", "by_indices", ",", "aggregation", ",", "result_type", "=", "None", ")", ":", "obj_id", ",", "weld_obj", "=", "create_weld_object", "(", "grouped_df", ")", "all_indices", "=", "list", "("...
Perform aggregation on grouped data. Parameters ---------- grouped_df : WeldObject DataFrame which has been grouped through weld_groupby. weld_types : list of WeldType Corresponding to data. by_indices : list of int Indices of which arrays to group by. aggregation : {'+'...
[ "Perform", "aggregation", "on", "grouped", "data", "." ]
python
train
fabioz/PyDev.Debugger
third_party/pep8/pycodestyle.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/pycodestyle.py#L1846-L1849
def get_count(self, prefix=''): """Return the total count of errors and warnings.""" return sum([self.counters[key] for key in self.messages if key.startswith(prefix)])
[ "def", "get_count", "(", "self", ",", "prefix", "=", "''", ")", ":", "return", "sum", "(", "[", "self", ".", "counters", "[", "key", "]", "for", "key", "in", "self", ".", "messages", "if", "key", ".", "startswith", "(", "prefix", ")", "]", ")" ]
Return the total count of errors and warnings.
[ "Return", "the", "total", "count", "of", "errors", "and", "warnings", "." ]
python
train
Yelp/venv-update
venv_update.py
https://github.com/Yelp/venv-update/blob/6feae7ab09ee870c582b97443cfa8f0dc8626ba7/venv_update.py#L426-L438
def raise_on_failure(mainfunc): """raise if and only if mainfunc fails""" try: errors = mainfunc() if errors: exit(errors) except CalledProcessError as error: exit(error.returncode) except SystemExit as error: if error.code: raise except Keyboa...
[ "def", "raise_on_failure", "(", "mainfunc", ")", ":", "try", ":", "errors", "=", "mainfunc", "(", ")", "if", "errors", ":", "exit", "(", "errors", ")", "except", "CalledProcessError", "as", "error", ":", "exit", "(", "error", ".", "returncode", ")", "exc...
raise if and only if mainfunc fails
[ "raise", "if", "and", "only", "if", "mainfunc", "fails" ]
python
train
boriel/zxbasic
arch/zx48k/optimizer.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/optimizer.py#L605-L614
def rrc(self, r): """ Does a ROTATION to the RIGHT |>> """ if not is_number(self.regs[r]): self.set(r, None) self.set_flag(None) return v_ = self.getv(self.regs[r]) & 0xFF self.regs[r] = str((v_ >> 1) | ((v_ & 1) << 7))
[ "def", "rrc", "(", "self", ",", "r", ")", ":", "if", "not", "is_number", "(", "self", ".", "regs", "[", "r", "]", ")", ":", "self", ".", "set", "(", "r", ",", "None", ")", "self", ".", "set_flag", "(", "None", ")", "return", "v_", "=", "self"...
Does a ROTATION to the RIGHT |>>
[ "Does", "a", "ROTATION", "to", "the", "RIGHT", "|", ">>" ]
python
train
teffland/pytorch-monitor
build/lib/pytorch_monitor/monitor.py
https://github.com/teffland/pytorch-monitor/blob/56dce63ba85c0f9faf9df11df78161ee60f5fae9/build/lib/pytorch_monitor/monitor.py#L19-L35
def set_monitoring(module): """ Defines the monitoring method on the module. """ def monitoring(is_monitoring, track_data=None, track_grad=None, track_update=None, track_update_ratio=None): """ Turn monitoring on or off....
[ "def", "set_monitoring", "(", "module", ")", ":", "def", "monitoring", "(", "is_monitoring", ",", "track_data", "=", "None", ",", "track_grad", "=", "None", ",", "track_update", "=", "None", ",", "track_update_ratio", "=", "None", ")", ":", "\"\"\"\n Tu...
Defines the monitoring method on the module.
[ "Defines", "the", "monitoring", "method", "on", "the", "module", "." ]
python
train
gregreen/dustmaps
dustmaps/json_serializers.py
https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/json_serializers.py#L105-L125
def serialize_ndarray_b64(o): """ Serializes a :obj:`numpy.ndarray` in a format where the datatype and shape are human-readable, but the array data itself is binary64 encoded. Args: o (:obj:`numpy.ndarray`): :obj:`ndarray` to be serialized. Returns: A dictionary that can be passed ...
[ "def", "serialize_ndarray_b64", "(", "o", ")", ":", "if", "o", ".", "flags", "[", "'C_CONTIGUOUS'", "]", ":", "o_data", "=", "o", ".", "data", "else", ":", "o_data", "=", "np", ".", "ascontiguousarray", "(", "o", ")", ".", "data", "data_b64", "=", "b...
Serializes a :obj:`numpy.ndarray` in a format where the datatype and shape are human-readable, but the array data itself is binary64 encoded. Args: o (:obj:`numpy.ndarray`): :obj:`ndarray` to be serialized. Returns: A dictionary that can be passed to :obj:`json.dumps`.
[ "Serializes", "a", ":", "obj", ":", "numpy", ".", "ndarray", "in", "a", "format", "where", "the", "datatype", "and", "shape", "are", "human", "-", "readable", "but", "the", "array", "data", "itself", "is", "binary64", "encoded", "." ]
python
train
biocore/deblur
deblur/parallel_deblur.py
https://github.com/biocore/deblur/blob/4b4badccdbac8fe9d8f8b3f1349f3700e31b5d7b/deblur/parallel_deblur.py#L77-L142
def parallel_deblur(inputs, params, pos_ref_db_fp, neg_ref_dp_fp, jobs_to_start=1): """Dispatch execution over a pool of processors This code was adopted from the American Gut project: https://github.com/biocore/American-Gut/blob/master/americangut/parallel.py Parameters ------...
[ "def", "parallel_deblur", "(", "inputs", ",", "params", ",", "pos_ref_db_fp", ",", "neg_ref_dp_fp", ",", "jobs_to_start", "=", "1", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "logger", ".", "info", "(", "'parallel deblur starte...
Dispatch execution over a pool of processors This code was adopted from the American Gut project: https://github.com/biocore/American-Gut/blob/master/americangut/parallel.py Parameters ---------- inputs : iterable of str File paths to input per-sample sequence files params : list of st...
[ "Dispatch", "execution", "over", "a", "pool", "of", "processors" ]
python
train
duniter/duniter-python-api
duniterpy/api/bma/blockchain.py
https://github.com/duniter/duniter-python-api/blob/3a1e5d61a2f72f5afaf29d010c6cf4dff3648165/duniterpy/api/bma/blockchain.py#L414-L426
async def blocks(client: Client, count: int, start: int) -> list: """ GET list of blocks from the blockchain :param client: Client to connect to the api :param count: Number of blocks :param start: First block number :return: """ assert type(count) is int assert type(start) is int ...
[ "async", "def", "blocks", "(", "client", ":", "Client", ",", "count", ":", "int", ",", "start", ":", "int", ")", "->", "list", ":", "assert", "type", "(", "count", ")", "is", "int", "assert", "type", "(", "start", ")", "is", "int", "return", "await...
GET list of blocks from the blockchain :param client: Client to connect to the api :param count: Number of blocks :param start: First block number :return:
[ "GET", "list", "of", "blocks", "from", "the", "blockchain" ]
python
train
galaxy-genome-annotation/python-apollo
apollo/__init__.py
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/__init__.py#L65-L83
def accessible_organisms(user, orgs): """Get the list of organisms accessible to a user, filtered by `orgs`""" permission_map = { x['organism']: x['permissions'] for x in user.organismPermissions if 'WRITE' in x['permissions'] or 'READ' in x['permissions'] or 'ADMINISTRAT...
[ "def", "accessible_organisms", "(", "user", ",", "orgs", ")", ":", "permission_map", "=", "{", "x", "[", "'organism'", "]", ":", "x", "[", "'permissions'", "]", "for", "x", "in", "user", ".", "organismPermissions", "if", "'WRITE'", "in", "x", "[", "'perm...
Get the list of organisms accessible to a user, filtered by `orgs`
[ "Get", "the", "list", "of", "organisms", "accessible", "to", "a", "user", "filtered", "by", "orgs" ]
python
train
yolothreat/utilitybelt
utilitybelt/utilitybelt.py
https://github.com/yolothreat/utilitybelt/blob/55ac6c31f87963d5e97be0402a4343c84846d118/utilitybelt/utilitybelt.py#L356-L367
def urlvoid_check(name, api_key): """Checks URLVoid.com for info on a domain""" if not is_fqdn(name): return None url = 'http://api.urlvoid.com/api1000/{key}/host/{name}'.format(key=api_key, name=name) response = requests.get(url) tree = ET.fromstring(response.text) if tree.find('./dete...
[ "def", "urlvoid_check", "(", "name", ",", "api_key", ")", ":", "if", "not", "is_fqdn", "(", "name", ")", ":", "return", "None", "url", "=", "'http://api.urlvoid.com/api1000/{key}/host/{name}'", ".", "format", "(", "key", "=", "api_key", ",", "name", "=", "na...
Checks URLVoid.com for info on a domain
[ "Checks", "URLVoid", ".", "com", "for", "info", "on", "a", "domain" ]
python
train
wilson-eft/wilson
wilson/translate/wet.py
https://github.com/wilson-eft/wilson/blob/4164f55ff663d4f668c6e2b4575fd41562662cc9/wilson/translate/wet.py#L174-L189
def _Bern_to_JMS_II(C, udlnu): """From BernII to JMS basis for charged current process semileptonic operators. `udlnu` should be of the form 'udl_enu_tau', 'cbl_munu_e' etc.""" u = uflav[udlnu[0]] d = dflav[udlnu[1]] l = lflav[udlnu[4:udlnu.find('n')]] lp = lflav[udlnu[udlnu.find('_',5)+1:len(ud...
[ "def", "_Bern_to_JMS_II", "(", "C", ",", "udlnu", ")", ":", "u", "=", "uflav", "[", "udlnu", "[", "0", "]", "]", "d", "=", "dflav", "[", "udlnu", "[", "1", "]", "]", "l", "=", "lflav", "[", "udlnu", "[", "4", ":", "udlnu", ".", "find", "(", ...
From BernII to JMS basis for charged current process semileptonic operators. `udlnu` should be of the form 'udl_enu_tau', 'cbl_munu_e' etc.
[ "From", "BernII", "to", "JMS", "basis", "for", "charged", "current", "process", "semileptonic", "operators", ".", "udlnu", "should", "be", "of", "the", "form", "udl_enu_tau", "cbl_munu_e", "etc", "." ]
python
train
secnot/rectpack
rectpack/maxrects.py
https://github.com/secnot/rectpack/blob/21d46be48fd453500ea49de699bc9eabc427bdf7/rectpack/maxrects.py#L155-L185
def add_rect(self, width, height, rid=None): """ Add rectangle of widthxheight dimensions. Arguments: width (int, float): Rectangle width height (int, float): Rectangle height rid: Optional rectangle user id Returns: Rectangle: Rectangle ...
[ "def", "add_rect", "(", "self", ",", "width", ",", "height", ",", "rid", "=", "None", ")", ":", "assert", "(", "width", ">", "0", "and", "height", ">", "0", ")", "# Search best position and orientation", "rect", ",", "_", "=", "self", ".", "_select_posit...
Add rectangle of widthxheight dimensions. Arguments: width (int, float): Rectangle width height (int, float): Rectangle height rid: Optional rectangle user id Returns: Rectangle: Rectangle with placemente coordinates None: If the rectangle co...
[ "Add", "rectangle", "of", "widthxheight", "dimensions", "." ]
python
train
pypa/pipenv
pipenv/patched/notpip/_vendor/ipaddress.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/ipaddress.py#L1663-L1673
def is_global(self): """Test if this address is allocated for public networks. Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry. """ return (not (self.network_address in IPv4Network('100.64.0.0/10') and self....
[ "def", "is_global", "(", "self", ")", ":", "return", "(", "not", "(", "self", ".", "network_address", "in", "IPv4Network", "(", "'100.64.0.0/10'", ")", "and", "self", ".", "broadcast_address", "in", "IPv4Network", "(", "'100.64.0.0/10'", ")", ")", "and", "no...
Test if this address is allocated for public networks. Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry.
[ "Test", "if", "this", "address", "is", "allocated", "for", "public", "networks", "." ]
python
train
zhexiao/ezhost
ezhost/BigDataArchi.py
https://github.com/zhexiao/ezhost/blob/4146bc0be14bb1bfe98ec19283d19fab420871b3/ezhost/BigDataArchi.py#L94-L103
def install_config_kibana(self): """ install and config kibana :return: """ if self.prompt_check("Download and install kibana"): self.kibana_install() if self.prompt_check("Configure and autostart kibana"): self.kibana_config()
[ "def", "install_config_kibana", "(", "self", ")", ":", "if", "self", ".", "prompt_check", "(", "\"Download and install kibana\"", ")", ":", "self", ".", "kibana_install", "(", ")", "if", "self", ".", "prompt_check", "(", "\"Configure and autostart kibana\"", ")", ...
install and config kibana :return:
[ "install", "and", "config", "kibana", ":", "return", ":" ]
python
train
ewels/MultiQC
multiqc/modules/qualimap/QM_BamQC.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/qualimap/QM_BamQC.py#L158-L193
def parse_insert_size(self, f): """ Parse the contents of the Qualimap BamQC Insert Size Histogram file """ # Get the sample name from the parent parent directory # Typical path: <sample name>/raw_data_qualimapReport/insert_size_histogram.txt s_name = self.get_s_name(f) d = dict() zero_insertsi...
[ "def", "parse_insert_size", "(", "self", ",", "f", ")", ":", "# Get the sample name from the parent parent directory", "# Typical path: <sample name>/raw_data_qualimapReport/insert_size_histogram.txt", "s_name", "=", "self", ".", "get_s_name", "(", "f", ")", "d", "=", "dict",...
Parse the contents of the Qualimap BamQC Insert Size Histogram file
[ "Parse", "the", "contents", "of", "the", "Qualimap", "BamQC", "Insert", "Size", "Histogram", "file" ]
python
train
fp12/achallonge
challonge/participant.py
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/participant.py#L120-L133
async def check_in(self): """ Checks this participant in |methcoro| Warning: |unstable| Raises: APIException """ res = await self.connection('POST', 'tournaments/{}/participants/{}/check_in'.format(self._tournament_id, self._id)) self._...
[ "async", "def", "check_in", "(", "self", ")", ":", "res", "=", "await", "self", ".", "connection", "(", "'POST'", ",", "'tournaments/{}/participants/{}/check_in'", ".", "format", "(", "self", ".", "_tournament_id", ",", "self", ".", "_id", ")", ")", "self", ...
Checks this participant in |methcoro| Warning: |unstable| Raises: APIException
[ "Checks", "this", "participant", "in" ]
python
train
mk-fg/feedjack
feedjack/fjcloud.py
https://github.com/mk-fg/feedjack/blob/3fe65c0f66dc2cfdf45834aaa7235ec9f81b3ca3/feedjack/fjcloud.py#L52-L81
def cloudata(site): """ Returns a dictionary with all the tag clouds related to a site. """ # XXX: this looks like it can be done via ORM tagdata = getquery(""" SELECT feedjack_post.feed_id, feedjack_tag.name, COUNT(*) FROM feedjack_post, feedjack_subscriber, feedjack_tag, feedjack_post_tags WHERE feedjack...
[ "def", "cloudata", "(", "site", ")", ":", "# XXX: this looks like it can be done via ORM", "tagdata", "=", "getquery", "(", "\"\"\"\n\t\tSELECT feedjack_post.feed_id, feedjack_tag.name, COUNT(*)\n\t\tFROM feedjack_post, feedjack_subscriber, feedjack_tag,\n\t\tfeedjack_post_tags\n\t\tWHERE feed...
Returns a dictionary with all the tag clouds related to a site.
[ "Returns", "a", "dictionary", "with", "all", "the", "tag", "clouds", "related", "to", "a", "site", "." ]
python
train
spyder-ide/spyder
spyder/utils/syntaxhighlighters.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L1161-L1186
def make_charlist(self): """Parses the complete text and stores format for each character.""" def worker_output(worker, output, error): """Worker finished callback.""" self._charlist = output if error is None and output: self._allow_highlight =...
[ "def", "make_charlist", "(", "self", ")", ":", "def", "worker_output", "(", "worker", ",", "output", ",", "error", ")", ":", "\"\"\"Worker finished callback.\"\"\"", "self", ".", "_charlist", "=", "output", "if", "error", "is", "None", "and", "output", ":", ...
Parses the complete text and stores format for each character.
[ "Parses", "the", "complete", "text", "and", "stores", "format", "for", "each", "character", "." ]
python
train
undertherain/pycontextfree
setup_boilerplate.py
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L59-L63
def find_packages(root_directory: str = '.') -> t.List[str]: """Find packages to pack.""" exclude = ['test*', 'test.*'] if ('bdist_wheel' in sys.argv or 'bdist' in sys.argv) else [] packages_list = setuptools.find_packages(root_directory, exclude=exclude) return packages_list
[ "def", "find_packages", "(", "root_directory", ":", "str", "=", "'.'", ")", "->", "t", ".", "List", "[", "str", "]", ":", "exclude", "=", "[", "'test*'", ",", "'test.*'", "]", "if", "(", "'bdist_wheel'", "in", "sys", ".", "argv", "or", "'bdist'", "in...
Find packages to pack.
[ "Find", "packages", "to", "pack", "." ]
python
train
inveniosoftware/invenio-files-rest
invenio_files_rest/helpers.py
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/helpers.py#L193-L211
def make_path(base_uri, path, filename, path_dimensions, split_length): """Generate a path as base location for file instance. :param base_uri: The base URI. :param path: The relative path. :param path_dimensions: Number of chunks the path should be split into. :param split_length: The length of an...
[ "def", "make_path", "(", "base_uri", ",", "path", ",", "filename", ",", "path_dimensions", ",", "split_length", ")", ":", "assert", "len", "(", "path", ")", ">", "path_dimensions", "*", "split_length", "uri_parts", "=", "[", "]", "for", "i", "in", "range",...
Generate a path as base location for file instance. :param base_uri: The base URI. :param path: The relative path. :param path_dimensions: Number of chunks the path should be split into. :param split_length: The length of any chunk. :returns: A string representing the full path.
[ "Generate", "a", "path", "as", "base", "location", "for", "file", "instance", "." ]
python
train
zagaran/mongobackup
mongobackup/s3.py
https://github.com/zagaran/mongobackup/blob/d090d0cca44ecd066974c4de80edca5f26b7eeea/mongobackup/s3.py#L33-L41
def s3_connect(bucket_name, s3_access_key_id, s3_secret_key): """ Returns a Boto connection to the provided S3 bucket. """ conn = connect_s3(s3_access_key_id, s3_secret_key) try: return conn.get_bucket(bucket_name) except S3ResponseError as e: if e.status == 403: raise Except...
[ "def", "s3_connect", "(", "bucket_name", ",", "s3_access_key_id", ",", "s3_secret_key", ")", ":", "conn", "=", "connect_s3", "(", "s3_access_key_id", ",", "s3_secret_key", ")", "try", ":", "return", "conn", ".", "get_bucket", "(", "bucket_name", ")", "except", ...
Returns a Boto connection to the provided S3 bucket.
[ "Returns", "a", "Boto", "connection", "to", "the", "provided", "S3", "bucket", "." ]
python
train
ambv/retype
retype.py
https://github.com/ambv/retype/blob/03137abd4d9c9845f3cced1006190b5cca64d879/retype.py#L1103-L1111
def parse_type_comment(type_comment): """Parse a type comment string into AST nodes.""" try: result = ast3.parse(type_comment, '<type_comment>', 'eval') except SyntaxError: raise ValueError(f"invalid type comment: {type_comment!r}") from None assert isinstance(result, ast3.Expression) ...
[ "def", "parse_type_comment", "(", "type_comment", ")", ":", "try", ":", "result", "=", "ast3", ".", "parse", "(", "type_comment", ",", "'<type_comment>'", ",", "'eval'", ")", "except", "SyntaxError", ":", "raise", "ValueError", "(", "f\"invalid type comment: {type...
Parse a type comment string into AST nodes.
[ "Parse", "a", "type", "comment", "string", "into", "AST", "nodes", "." ]
python
valid
datastax/python-driver
cassandra/cluster.py
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/cluster.py#L1127-L1172
def add_execution_profile(self, name, profile, pool_wait_timeout=5): """ Adds an :class:`.ExecutionProfile` to the cluster. This makes it available for use by ``name`` in :meth:`.Session.execute` and :meth:`.Session.execute_async`. This method will raise if the profile already exists. N...
[ "def", "add_execution_profile", "(", "self", ",", "name", ",", "profile", ",", "pool_wait_timeout", "=", "5", ")", ":", "if", "not", "isinstance", "(", "profile", ",", "ExecutionProfile", ")", ":", "raise", "TypeError", "(", "\"profile must be an instance of Execu...
Adds an :class:`.ExecutionProfile` to the cluster. This makes it available for use by ``name`` in :meth:`.Session.execute` and :meth:`.Session.execute_async`. This method will raise if the profile already exists. Normally profiles will be injected at cluster initialization via ``Cluster(execution_profi...
[ "Adds", "an", ":", "class", ":", ".", "ExecutionProfile", "to", "the", "cluster", ".", "This", "makes", "it", "available", "for", "use", "by", "name", "in", ":", "meth", ":", ".", "Session", ".", "execute", "and", ":", "meth", ":", ".", "Session", "....
python
train
glomex/gcdt
gcdt/kumo_start_stop.py
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L88-L107
def _filter_db_instances_by_status(awsclient, db_instances, status_list): """helper to select dbinstances. :param awsclient: :param db_instances: :param status_list: :return: list of db_instances that match the filter """ client_rds = awsclient.get_client('rds') db_instances_with_status...
[ "def", "_filter_db_instances_by_status", "(", "awsclient", ",", "db_instances", ",", "status_list", ")", ":", "client_rds", "=", "awsclient", ".", "get_client", "(", "'rds'", ")", "db_instances_with_status", "=", "[", "]", "for", "db", "in", "db_instances", ":", ...
helper to select dbinstances. :param awsclient: :param db_instances: :param status_list: :return: list of db_instances that match the filter
[ "helper", "to", "select", "dbinstances", "." ]
python
train
elastic/elasticsearch-py
elasticsearch/client/xpack/security.py
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/xpack/security.py#L386-L403
def put_user(self, username, body, params=None): """ `<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html>`_ :arg username: The username of the User :arg body: The user to add :arg refresh: If `true` (the default) then refresh the affected...
[ "def", "put_user", "(", "self", ",", "username", ",", "body", ",", "params", "=", "None", ")", ":", "for", "param", "in", "(", "username", ",", "body", ")", ":", "if", "param", "in", "SKIP_IN_PATH", ":", "raise", "ValueError", "(", "\"Empty value passed ...
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html>`_ :arg username: The username of the User :arg body: The user to add :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wai...
[ "<https", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "security", "-", "api", "-", "put", "-", "user", ".", "html", ">", "_" ]
python
train
esterhui/pypu
scripts/build_json_from_gps.py
https://github.com/esterhui/pypu/blob/cc3e259d59f024c2c4c0fbb9c8a1547e51de75ec/scripts/build_json_from_gps.py#L154-L167
def parsePositionFile(filename): """ Parses Android GPS logger csv file and returns list of dictionaries """ l=[] with open( filename, "rb" ) as theFile: reader = csv.DictReader( theFile ) for line in reader: # Convert the time string to something # a bit more...
[ "def", "parsePositionFile", "(", "filename", ")", ":", "l", "=", "[", "]", "with", "open", "(", "filename", ",", "\"rb\"", ")", "as", "theFile", ":", "reader", "=", "csv", ".", "DictReader", "(", "theFile", ")", "for", "line", "in", "reader", ":", "#...
Parses Android GPS logger csv file and returns list of dictionaries
[ "Parses", "Android", "GPS", "logger", "csv", "file", "and", "returns", "list", "of", "dictionaries" ]
python
train
zhanglab/psamm
psamm/lpsolver/cplex.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/cplex.py#L223-L270
def set_objective(self, expression): """Set objective expression of the problem.""" if isinstance(expression, numbers.Number): # Allow expressions with no variables as objective, # represented as a number expression = Expression(offset=expression) linear = [...
[ "def", "set_objective", "(", "self", ",", "expression", ")", ":", "if", "isinstance", "(", "expression", ",", "numbers", ".", "Number", ")", ":", "# Allow expressions with no variables as objective,", "# represented as a number", "expression", "=", "Expression", "(", ...
Set objective expression of the problem.
[ "Set", "objective", "expression", "of", "the", "problem", "." ]
python
train
dj-stripe/dj-stripe
djstripe/management/commands/djstripe_sync_plans_from_stripe.py
https://github.com/dj-stripe/dj-stripe/blob/a5308a3808cd6e2baba49482f7a699f3a8992518/djstripe/management/commands/djstripe_sync_plans_from_stripe.py#L14-L18
def handle(self, *args, **options): """Call sync_from_stripe_data for each plan returned by api_list.""" for plan_data in Plan.api_list(): plan = Plan.sync_from_stripe_data(plan_data) print("Synchronized plan {0}".format(plan.id))
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "for", "plan_data", "in", "Plan", ".", "api_list", "(", ")", ":", "plan", "=", "Plan", ".", "sync_from_stripe_data", "(", "plan_data", ")", "print", "(", "\"Synchronize...
Call sync_from_stripe_data for each plan returned by api_list.
[ "Call", "sync_from_stripe_data", "for", "each", "plan", "returned", "by", "api_list", "." ]
python
train
BerkeleyAutomation/autolab_core
autolab_core/points.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L587-L596
def mean(self): """Returns the average point in the cloud. Returns ------- :obj:`Point` The mean point in the PointCloud. """ mean_point_data = np.mean(self._data, axis=1) return Point(mean_point_data, self._frame)
[ "def", "mean", "(", "self", ")", ":", "mean_point_data", "=", "np", ".", "mean", "(", "self", ".", "_data", ",", "axis", "=", "1", ")", "return", "Point", "(", "mean_point_data", ",", "self", ".", "_frame", ")" ]
Returns the average point in the cloud. Returns ------- :obj:`Point` The mean point in the PointCloud.
[ "Returns", "the", "average", "point", "in", "the", "cloud", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xfilepathedit.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xfilepathedit.py#L433-L444
def setHint(self, hint): """ Sets the hint for this filepath. :param hint | <str> """ if self.normalizePath(): filepath = os.path.normpath(nativestring(hint)) else: filepath = os.path.normpath(nativestring(hint)).replace('\\', '/'...
[ "def", "setHint", "(", "self", ",", "hint", ")", ":", "if", "self", ".", "normalizePath", "(", ")", ":", "filepath", "=", "os", ".", "path", ".", "normpath", "(", "nativestring", "(", "hint", ")", ")", "else", ":", "filepath", "=", "os", ".", "path...
Sets the hint for this filepath. :param hint | <str>
[ "Sets", "the", "hint", "for", "this", "filepath", ".", ":", "param", "hint", "|", "<str", ">" ]
python
train
RedHatInsights/insights-core
insights/core/__init__.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/core/__init__.py#L959-L974
def scan(cls, result_key, func): """ Define computed fields based on a string to "grep for". This is preferred to utilizing raw log lines in plugins because computed fields will be serialized, whereas raw log lines will not. """ if result_key in cls.scanner_keys: ...
[ "def", "scan", "(", "cls", ",", "result_key", ",", "func", ")", ":", "if", "result_key", "in", "cls", ".", "scanner_keys", ":", "raise", "ValueError", "(", "\"'%s' is already a registered scanner key\"", "%", "result_key", ")", "def", "scanner", "(", "self", "...
Define computed fields based on a string to "grep for". This is preferred to utilizing raw log lines in plugins because computed fields will be serialized, whereas raw log lines will not.
[ "Define", "computed", "fields", "based", "on", "a", "string", "to", "grep", "for", ".", "This", "is", "preferred", "to", "utilizing", "raw", "log", "lines", "in", "plugins", "because", "computed", "fields", "will", "be", "serialized", "whereas", "raw", "log"...
python
train
mkorpela/pabot
pabot/pabotlib.py
https://github.com/mkorpela/pabot/blob/b7d85546a58e398d579bb14fd9135858ec08a031/pabot/pabotlib.py#L169-L178
def set_parallel_value_for_key(self, key, value): """ Set a globally available key and value that can be accessed from all the pabot processes. """ if self._remotelib: self._remotelib.run_keyword('set_parallel_value_for_key', [k...
[ "def", "set_parallel_value_for_key", "(", "self", ",", "key", ",", "value", ")", ":", "if", "self", ".", "_remotelib", ":", "self", ".", "_remotelib", ".", "run_keyword", "(", "'set_parallel_value_for_key'", ",", "[", "key", ",", "value", "]", ",", "{", "}...
Set a globally available key and value that can be accessed from all the pabot processes.
[ "Set", "a", "globally", "available", "key", "and", "value", "that", "can", "be", "accessed", "from", "all", "the", "pabot", "processes", "." ]
python
train
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/datastructures/eperiodical_semantic_info.py
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/datastructures/eperiodical_semantic_info.py#L53-L131
def from_xml(xml): """ Pick informations from :class:`.MARCXMLRecord` object and use it to build :class:`.SemanticInfo` structure. Args: xml (str/MARCXMLRecord): MarcXML which will be converted to SemanticInfo. In case of str, ``<record>`` tag is required. ...
[ "def", "from_xml", "(", "xml", ")", ":", "hasAcquisitionFields", "=", "False", "acquisitionFields", "=", "[", "]", "isClosed", "=", "False", "isSummaryRecord", "=", "False", "contentOfFMT", "=", "\"\"", "parsedSummaryRecordSysNumber", "=", "\"\"", "summaryRecordSysN...
Pick informations from :class:`.MARCXMLRecord` object and use it to build :class:`.SemanticInfo` structure. Args: xml (str/MARCXMLRecord): MarcXML which will be converted to SemanticInfo. In case of str, ``<record>`` tag is required. Returns: structure: ...
[ "Pick", "informations", "from", ":", "class", ":", ".", "MARCXMLRecord", "object", "and", "use", "it", "to", "build", ":", "class", ":", ".", "SemanticInfo", "structure", "." ]
python
train
fracpete/python-weka-wrapper3
python/weka/classifiers.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/classifiers.py#L924-L936
def apply_cost_matrix(self, data, rnd): """ Applies the cost matrix to the data. :param data: the data to apply to :type data: Instances :param rnd: the random number generator :type rnd: Random """ return Instances( javabridge.call( ...
[ "def", "apply_cost_matrix", "(", "self", ",", "data", ",", "rnd", ")", ":", "return", "Instances", "(", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"applyCostMatrix\"", ",", "\"(Lweka/core/Instances;Ljava/util/Random;)Lweka/core/Instances;\"", ",", ...
Applies the cost matrix to the data. :param data: the data to apply to :type data: Instances :param rnd: the random number generator :type rnd: Random
[ "Applies", "the", "cost", "matrix", "to", "the", "data", "." ]
python
train
dropbox/stone
stone/frontend/parser.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/frontend/parser.py#L662-L670
def p_attr_field(self, p): """attr_field : ID EQ primitive NL | ID EQ tag_ref NL""" if p[3] is NullToken: p[0] = AstAttrField( self.path, p.lineno(1), p.lexpos(1), p[1], None) else: p[0] = AstAttrField( self.path, p.li...
[ "def", "p_attr_field", "(", "self", ",", "p", ")", ":", "if", "p", "[", "3", "]", "is", "NullToken", ":", "p", "[", "0", "]", "=", "AstAttrField", "(", "self", ".", "path", ",", "p", ".", "lineno", "(", "1", ")", ",", "p", ".", "lexpos", "(",...
attr_field : ID EQ primitive NL | ID EQ tag_ref NL
[ "attr_field", ":", "ID", "EQ", "primitive", "NL", "|", "ID", "EQ", "tag_ref", "NL" ]
python
train
spyder-ide/conda-manager
conda_manager/api/conda_api.py
https://github.com/spyder-ide/conda-manager/blob/89a2126cbecefc92185cf979347ccac1c5ee5d9d/conda_manager/api/conda_api.py#L1094-L1108
def _pip_search(stdout, stderr): """Callback for pip search.""" result = {} lines = to_text_string(stdout).split('\n') while '' in lines: lines.remove('') for line in lines: if ' - ' in line: parts = line.split(' - ') name ...
[ "def", "_pip_search", "(", "stdout", ",", "stderr", ")", ":", "result", "=", "{", "}", "lines", "=", "to_text_string", "(", "stdout", ")", ".", "split", "(", "'\\n'", ")", "while", "''", "in", "lines", ":", "lines", ".", "remove", "(", "''", ")", "...
Callback for pip search.
[ "Callback", "for", "pip", "search", "." ]
python
train
alberanid/python-iplib
iplib.py
https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L205-L213
def is_bits_nm(nm): """Return true if the netmask is in bits notatation.""" try: bits = int(str(nm)) except ValueError: return False if bits > 32 or bits < 0: return False return True
[ "def", "is_bits_nm", "(", "nm", ")", ":", "try", ":", "bits", "=", "int", "(", "str", "(", "nm", ")", ")", "except", "ValueError", ":", "return", "False", "if", "bits", ">", "32", "or", "bits", "<", "0", ":", "return", "False", "return", "True" ]
Return true if the netmask is in bits notatation.
[ "Return", "true", "if", "the", "netmask", "is", "in", "bits", "notatation", "." ]
python
valid
saltstack/salt
salt/states/jenkins.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/jenkins.py#L47-L101
def present(name, config=None, **kwargs): ''' Ensure the job is present in the Jenkins configured jobs name The unique name for the Jenkins job config The Salt URL for the file to use for configuring the job ''' ret = {'name': name, 'result':...
[ "def", "present", "(", "name", ",", "config", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "[", "'Job {0} is up to date.'...
Ensure the job is present in the Jenkins configured jobs name The unique name for the Jenkins job config The Salt URL for the file to use for configuring the job
[ "Ensure", "the", "job", "is", "present", "in", "the", "Jenkins", "configured", "jobs" ]
python
train
pudo-attic/scrapekit
scrapekit/http.py
https://github.com/pudo-attic/scrapekit/blob/cfd258120922fcd571430cdf00ba50f3cf18dc15/scrapekit/http.py#L95-L112
def make_session(scraper): """ Instantiate a session with the desired configuration parameters, including the cache policy. """ cache_path = os.path.join(scraper.config.data_path, 'cache') cache_policy = scraper.config.cache_policy cache_policy = cache_policy.lower().strip() session = ScraperSes...
[ "def", "make_session", "(", "scraper", ")", ":", "cache_path", "=", "os", ".", "path", ".", "join", "(", "scraper", ".", "config", ".", "data_path", ",", "'cache'", ")", "cache_policy", "=", "scraper", ".", "config", ".", "cache_policy", "cache_policy", "=...
Instantiate a session with the desired configuration parameters, including the cache policy.
[ "Instantiate", "a", "session", "with", "the", "desired", "configuration", "parameters", "including", "the", "cache", "policy", "." ]
python
train
h2oai/h2o-3
h2o-py/h2o/model/autoencoder.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/autoencoder.py#L11-L24
def anomaly(self, test_data, per_feature=False): """ Obtain the reconstruction error for the input test_data. :param H2OFrame test_data: The dataset upon which the reconstruction error is computed. :param bool per_feature: Whether to return the square reconstruction error per feature. ...
[ "def", "anomaly", "(", "self", ",", "test_data", ",", "per_feature", "=", "False", ")", ":", "if", "test_data", "is", "None", "or", "test_data", ".", "nrow", "==", "0", ":", "raise", "ValueError", "(", "\"Must specify test data\"", ")", "j", "=", "h2o", ...
Obtain the reconstruction error for the input test_data. :param H2OFrame test_data: The dataset upon which the reconstruction error is computed. :param bool per_feature: Whether to return the square reconstruction error per feature. Otherwise, return the mean square error. :returns...
[ "Obtain", "the", "reconstruction", "error", "for", "the", "input", "test_data", "." ]
python
test
callsign-viper/Flask-GraphQL-Auth
flask_graphql_auth/decorators.py
https://github.com/callsign-viper/Flask-GraphQL-Auth/blob/27897a6ef81e12f87e9695fbaf6659ff025ae782/flask_graphql_auth/decorators.py#L122-L139
def mutation_jwt_required(fn): """ A decorator to protect a mutation. If you decorate a mutation with this, it will ensure that the requester has a valid access token before allowing the mutation to be called. This does not check the freshness of the access token. """ @wraps(fn) def wra...
[ "def", "mutation_jwt_required", "(", "fn", ")", ":", "@", "wraps", "(", "fn", ")", "def", "wrapper", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "token", "=", "kwargs", ".", "pop", "(", "current_app", ".", "config", "[", "'JWT_...
A decorator to protect a mutation. If you decorate a mutation with this, it will ensure that the requester has a valid access token before allowing the mutation to be called. This does not check the freshness of the access token.
[ "A", "decorator", "to", "protect", "a", "mutation", "." ]
python
train
BlueBrain/NeuroM
neurom/fst/_neuronfunc.py
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuronfunc.py#L89-L92
def trunk_origin_radii(nrn, neurite_type=NeuriteType.all): '''radii of the trunk sections of neurites in a neuron''' neurite_filter = is_type(neurite_type) return [s.root_node.points[0][COLS.R] for s in nrn.neurites if neurite_filter(s)]
[ "def", "trunk_origin_radii", "(", "nrn", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "neurite_filter", "=", "is_type", "(", "neurite_type", ")", "return", "[", "s", ".", "root_node", ".", "points", "[", "0", "]", "[", "COLS", ".", "R",...
radii of the trunk sections of neurites in a neuron
[ "radii", "of", "the", "trunk", "sections", "of", "neurites", "in", "a", "neuron" ]
python
train
gebn/wood
wood/entities.py
https://github.com/gebn/wood/blob/efc71879890dbd2f2d7a0b1a65ed22a0843139dd/wood/entities.py#L186-L197
def from_path(cls, path: pathlib.Path) -> 'Directory': """ Create a directory entity from a directory path. :param path: The path of the directory. :return: A directory entity instance representing the directory. :raises ValueError: If the path does not point to a directory. ...
[ "def", "from_path", "(", "cls", ",", "path", ":", "pathlib", ".", "Path", ")", "->", "'Directory'", ":", "if", "not", "path", ".", "is_dir", "(", ")", ":", "raise", "ValueError", "(", "'Path does not point to a directory'", ")", "return", "Directory", "(", ...
Create a directory entity from a directory path. :param path: The path of the directory. :return: A directory entity instance representing the directory. :raises ValueError: If the path does not point to a directory.
[ "Create", "a", "directory", "entity", "from", "a", "directory", "path", "." ]
python
train
dnanexus/dx-toolkit
src/python/dxpy/system_requirements.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/system_requirements.py#L79-L95
def from_sys_requirements(cls, system_requirements, _type='all'): """ Returns SystemRequirementsDict encapsulating system requirements. It can extract only entrypoints with specific fields ('clusterSpec', 'instanceType', etc), depending on the value of _type. """ if _type...
[ "def", "from_sys_requirements", "(", "cls", ",", "system_requirements", ",", "_type", "=", "'all'", ")", ":", "if", "_type", "not", "in", "(", "'all'", ",", "'clusterSpec'", ",", "'instanceType'", ")", ":", "raise", "DXError", "(", "\"Expected '_type' to be eith...
Returns SystemRequirementsDict encapsulating system requirements. It can extract only entrypoints with specific fields ('clusterSpec', 'instanceType', etc), depending on the value of _type.
[ "Returns", "SystemRequirementsDict", "encapsulating", "system", "requirements", ".", "It", "can", "extract", "only", "entrypoints", "with", "specific", "fields", "(", "clusterSpec", "instanceType", "etc", ")", "depending", "on", "the", "value", "of", "_type", "." ]
python
train
aio-libs/aioredis
aioredis/commands/set.py
https://github.com/aio-libs/aioredis/blob/e8c33e39558d4cc91cf70dde490d8b330c97dc2e/aioredis/commands/set.py#L42-L44
def smove(self, sourcekey, destkey, member): """Move a member from one set to another.""" return self.execute(b'SMOVE', sourcekey, destkey, member)
[ "def", "smove", "(", "self", ",", "sourcekey", ",", "destkey", ",", "member", ")", ":", "return", "self", ".", "execute", "(", "b'SMOVE'", ",", "sourcekey", ",", "destkey", ",", "member", ")" ]
Move a member from one set to another.
[ "Move", "a", "member", "from", "one", "set", "to", "another", "." ]
python
train
PMEAL/OpenPNM
openpnm/core/Base.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/core/Base.py#L1465-L1507
def check_data_health(self, props=[], element=None): r""" Check the health of pore and throat data arrays. Parameters ---------- element : string, optional Can be either 'pore' or 'throat', which will limit the checks to only those data arrays. p...
[ "def", "check_data_health", "(", "self", ",", "props", "=", "[", "]", ",", "element", "=", "None", ")", ":", "health", "=", "HealthDict", "(", ")", "if", "props", "==", "[", "]", ":", "props", "=", "self", ".", "props", "(", "element", ")", "else",...
r""" Check the health of pore and throat data arrays. Parameters ---------- element : string, optional Can be either 'pore' or 'throat', which will limit the checks to only those data arrays. props : list of pore (or throat) properties, optional ...
[ "r", "Check", "the", "health", "of", "pore", "and", "throat", "data", "arrays", "." ]
python
train
gagneurlab/concise
concise/metrics.py
https://github.com/gagneurlab/concise/blob/d15262eb1e590008bc96ba31e93bfbdbfa1a9fd4/concise/metrics.py#L62-L66
def fnr(y, z): """False negative rate `fn / (fn + tp)` """ tp, tn, fp, fn = contingency_table(y, z) return fn / (fn + tp)
[ "def", "fnr", "(", "y", ",", "z", ")", ":", "tp", ",", "tn", ",", "fp", ",", "fn", "=", "contingency_table", "(", "y", ",", "z", ")", "return", "fn", "/", "(", "fn", "+", "tp", ")" ]
False negative rate `fn / (fn + tp)`
[ "False", "negative", "rate", "fn", "/", "(", "fn", "+", "tp", ")" ]
python
train
barrust/mediawiki
mediawiki/mediawiki.py
https://github.com/barrust/mediawiki/blob/292e0be6c752409062dceed325d74839caf16a9b/mediawiki/mediawiki.py#L269-L314
def login(self, username, password, strict=True): """ Login as specified user Args: username (str): The username to log in with password (str): The password for the user strict (bool): `True` to thow an error on failure Returns: ...
[ "def", "login", "(", "self", ",", "username", ",", "password", ",", "strict", "=", "True", ")", ":", "# get login token", "params", "=", "{", "\"action\"", ":", "\"query\"", ",", "\"meta\"", ":", "\"tokens\"", ",", "\"type\"", ":", "\"login\"", ",", "\"for...
Login as specified user Args: username (str): The username to log in with password (str): The password for the user strict (bool): `True` to thow an error on failure Returns: bool: `True` if successfully logged in; `False` otherwis...
[ "Login", "as", "specified", "user" ]
python
train
e7dal/bubble3
behave4cmd0/command_steps.py
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_steps.py#L55-L73
def on_error_print_details(actual, expected): """ Print text details in case of assertation failed errors. .. sourcecode:: python with on_error_print_details(actual_text, expected_text): ... # Do something """ try: yield except Exception: diff = difflib.ndif...
[ "def", "on_error_print_details", "(", "actual", ",", "expected", ")", ":", "try", ":", "yield", "except", "Exception", ":", "diff", "=", "difflib", ".", "ndiff", "(", "expected", ".", "splitlines", "(", ")", ",", "actual", ".", "splitlines", "(", ")", ")...
Print text details in case of assertation failed errors. .. sourcecode:: python with on_error_print_details(actual_text, expected_text): ... # Do something
[ "Print", "text", "details", "in", "case", "of", "assertation", "failed", "errors", "." ]
python
train
dereneaton/ipyrad
ipyrad/analysis/bucky.py
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L413-L462
def run_mrbayes(self, ipyclient, force=False, quiet=False): """ calls the mrbayes block in each nexus file. """ ## get all the nexus files for this object minidir = os.path.realpath(os.path.join(self.workdir, self.name)) nexus_files = glob.glob(os.path.join(minidir, "*.n...
[ "def", "run_mrbayes", "(", "self", ",", "ipyclient", ",", "force", "=", "False", ",", "quiet", "=", "False", ")", ":", "## get all the nexus files for this object", "minidir", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "join", "(...
calls the mrbayes block in each nexus file.
[ "calls", "the", "mrbayes", "block", "in", "each", "nexus", "file", "." ]
python
valid
tensorflow/tensorboard
tensorboard/plugins/hparams/backend_context.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/backend_context.py#L198-L240
def _compute_metric_names(self): """Computes the list of metric names from all the scalar (run, tag) pairs. The return value is a list of (tag, group) pairs representing the metric names. The list is sorted in Python tuple-order (lexicographical). For example, if the scalar (run, tag) pairs are: (...
[ "def", "_compute_metric_names", "(", "self", ")", ":", "session_runs", "=", "self", ".", "_build_session_runs_set", "(", ")", "metric_names_set", "=", "set", "(", ")", "run_to_tag_to_content", "=", "self", ".", "multiplexer", ".", "PluginRunToTagToContent", "(", "...
Computes the list of metric names from all the scalar (run, tag) pairs. The return value is a list of (tag, group) pairs representing the metric names. The list is sorted in Python tuple-order (lexicographical). For example, if the scalar (run, tag) pairs are: ("exp/session1", "loss") ("exp/sessio...
[ "Computes", "the", "list", "of", "metric", "names", "from", "all", "the", "scalar", "(", "run", "tag", ")", "pairs", "." ]
python
train
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/core_v1_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/core_v1_api.py#L691-L717
def connect_get_namespaced_pod_attach(self, name, namespace, **kwargs): # noqa: E501 """connect_get_namespaced_pod_attach # noqa: E501 connect GET requests to attach of Pod # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, ple...
[ "def", "connect_get_namespaced_pod_attach", "(", "self", ",", "name", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", ...
connect_get_namespaced_pod_attach # noqa: E501 connect GET requests to attach of Pod # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.connect_get_namespaced_pod_attach(name, namespac...
[ "connect_get_namespaced_pod_attach", "#", "noqa", ":", "E501" ]
python
train
pydata/xarray
xarray/core/nanops.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/nanops.py#L14-L20
def _replace_nan(a, val): """ replace nan in a by val, and returns the replaced array and the nan position """ mask = isnull(a) return where_method(val, mask, a), mask
[ "def", "_replace_nan", "(", "a", ",", "val", ")", ":", "mask", "=", "isnull", "(", "a", ")", "return", "where_method", "(", "val", ",", "mask", ",", "a", ")", ",", "mask" ]
replace nan in a by val, and returns the replaced array and the nan position
[ "replace", "nan", "in", "a", "by", "val", "and", "returns", "the", "replaced", "array", "and", "the", "nan", "position" ]
python
train
bitesofcode/projexui
projexui/widgets/xnavigationedit.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnavigationedit.py#L624-L632
def scrollParts( self, amount ): """ Scrolls the parts to offset the scrolling amount. :param amount | <int> """ change = self._scrollAmount - amount self._partsWidget.scroll(change, 0) self._scrollAmount = amount
[ "def", "scrollParts", "(", "self", ",", "amount", ")", ":", "change", "=", "self", ".", "_scrollAmount", "-", "amount", "self", ".", "_partsWidget", ".", "scroll", "(", "change", ",", "0", ")", "self", ".", "_scrollAmount", "=", "amount" ]
Scrolls the parts to offset the scrolling amount. :param amount | <int>
[ "Scrolls", "the", "parts", "to", "offset", "the", "scrolling", "amount", ".", ":", "param", "amount", "|", "<int", ">" ]
python
train
zhelev/python-afsapi
afsapi/__init__.py
https://github.com/zhelev/python-afsapi/blob/bb1990cf1460ae42f2dde75f2291625ddac2c0e4/afsapi/__init__.py#L169-L175
def handle_long(self, item): """Helper method for fetching a long value. Result is integer.""" doc = yield from self.handle_get(item) if doc is None: return None return int(doc.value.u32.text) or None
[ "def", "handle_long", "(", "self", ",", "item", ")", ":", "doc", "=", "yield", "from", "self", ".", "handle_get", "(", "item", ")", "if", "doc", "is", "None", ":", "return", "None", "return", "int", "(", "doc", ".", "value", ".", "u32", ".", "text"...
Helper method for fetching a long value. Result is integer.
[ "Helper", "method", "for", "fetching", "a", "long", "value", ".", "Result", "is", "integer", "." ]
python
valid
google/grr
grr/server/grr_response_server/aff4.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L773-L832
def MultiOpen(self, urns, mode="rw", token=None, aff4_type=None, age=NEWEST_TIME, follow_symlinks=True): """Opens a bunch of urns efficiently.""" if not data_store.AFF4Enabled(): raise NotImplementedError("AFF...
[ "def", "MultiOpen", "(", "self", ",", "urns", ",", "mode", "=", "\"rw\"", ",", "token", "=", "None", ",", "aff4_type", "=", "None", ",", "age", "=", "NEWEST_TIME", ",", "follow_symlinks", "=", "True", ")", ":", "if", "not", "data_store", ".", "AFF4Enab...
Opens a bunch of urns efficiently.
[ "Opens", "a", "bunch", "of", "urns", "efficiently", "." ]
python
train
Esri/ArcREST
src/arcrest/common/domain.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/domain.py#L172-L175
def maxValue(self, value): """gets/sets the min value""" if isinstance(value, [int, float, long]): self._rangeMax = value
[ "def", "maxValue", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "[", "int", ",", "float", ",", "long", "]", ")", ":", "self", ".", "_rangeMax", "=", "value" ]
gets/sets the min value
[ "gets", "/", "sets", "the", "min", "value" ]
python
train
Kozea/pygal
pygal/svg.py
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/svg.py#L448-L457
def pre_render(self): """Last things to do before rendering""" self.add_styles() self.add_scripts() self.root.set( 'viewBox', '0 0 %d %d' % (self.graph.width, self.graph.height) ) if self.graph.explicit_size: self.root.set('width', str(self.graph.w...
[ "def", "pre_render", "(", "self", ")", ":", "self", ".", "add_styles", "(", ")", "self", ".", "add_scripts", "(", ")", "self", ".", "root", ".", "set", "(", "'viewBox'", ",", "'0 0 %d %d'", "%", "(", "self", ".", "graph", ".", "width", ",", "self", ...
Last things to do before rendering
[ "Last", "things", "to", "do", "before", "rendering" ]
python
train
samuelcolvin/arq
arq/cron.py
https://github.com/samuelcolvin/arq/blob/1434646b48c45bd27e392f0162976404e4d8021d/arq/cron.py#L128-L191
def cron( coroutine: Union[str, Callable], *, name: Optional[str] = None, month: Union[None, set, int] = None, day: Union[None, set, int] = None, weekday: Union[None, set, int, str] = None, hour: Union[None, set, int] = None, minute: Union[None, set, int] = None, second: Union[None, ...
[ "def", "cron", "(", "coroutine", ":", "Union", "[", "str", ",", "Callable", "]", ",", "*", ",", "name", ":", "Optional", "[", "str", "]", "=", "None", ",", "month", ":", "Union", "[", "None", ",", "set", ",", "int", "]", "=", "None", ",", "day"...
Create a cron job, eg. it should be executed at specific times. Workers will enqueue this job at or just after the set times. If ``unique`` is true (the default) the job will only be run once even if multiple workers are running. :param coroutine: coroutine function to run :param name: name of the job...
[ "Create", "a", "cron", "job", "eg", ".", "it", "should", "be", "executed", "at", "specific", "times", "." ]
python
train
numenta/nupic
src/nupic/algorithms/connections.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/connections.py#L395-L407
def numSegments(self, cell=None): """ Returns the number of segments. :param cell: (int) Optional parameter to get the number of segments on a cell. :returns: (int) Number of segments on all cells if cell is not specified, or on a specific specified cell """ if cell ...
[ "def", "numSegments", "(", "self", ",", "cell", "=", "None", ")", ":", "if", "cell", "is", "not", "None", ":", "return", "len", "(", "self", ".", "_cells", "[", "cell", "]", ".", "_segments", ")", "return", "self", ".", "_nextFlatIdx", "-", "len", ...
Returns the number of segments. :param cell: (int) Optional parameter to get the number of segments on a cell. :returns: (int) Number of segments on all cells if cell is not specified, or on a specific specified cell
[ "Returns", "the", "number", "of", "segments", "." ]
python
valid
facetoe/zenpy
zenpy/lib/api.py
https://github.com/facetoe/zenpy/blob/34c54c7e408b9ed01604ddf8b3422204c8bf31ea/zenpy/lib/api.py#L197-L212
def _process_response(self, response, object_mapping=None): """ Attempt to find a ResponseHandler that knows how to process this response. If no handler can be found, raise an Exception. """ try: pretty_response = response.json() except ValueError: ...
[ "def", "_process_response", "(", "self", ",", "response", ",", "object_mapping", "=", "None", ")", ":", "try", ":", "pretty_response", "=", "response", ".", "json", "(", ")", "except", "ValueError", ":", "pretty_response", "=", "response", "for", "handler", ...
Attempt to find a ResponseHandler that knows how to process this response. If no handler can be found, raise an Exception.
[ "Attempt", "to", "find", "a", "ResponseHandler", "that", "knows", "how", "to", "process", "this", "response", ".", "If", "no", "handler", "can", "be", "found", "raise", "an", "Exception", "." ]
python
train
se-esss-litterbox/Pynac
Pynac/Elements.py
https://github.com/se-esss-litterbox/Pynac/blob/97e20aa85d20112cd114faa54a8197c5d0f61209/Pynac/Elements.py#L398-L406
def dynacRepresentation(self): """ Return the Dynac representation of this steerer instance. """ if self.plane.val == 'H': p = 0 elif self.plane.val == 'V': p = 1 return ['STEER', [[self.field_strength.val], [p]]]
[ "def", "dynacRepresentation", "(", "self", ")", ":", "if", "self", ".", "plane", ".", "val", "==", "'H'", ":", "p", "=", "0", "elif", "self", ".", "plane", ".", "val", "==", "'V'", ":", "p", "=", "1", "return", "[", "'STEER'", ",", "[", "[", "s...
Return the Dynac representation of this steerer instance.
[ "Return", "the", "Dynac", "representation", "of", "this", "steerer", "instance", "." ]
python
train
bcbio/bcbio-nextgen
scripts/utils/broad_redo_analysis.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/broad_redo_analysis.py#L150-L185
def get_genome_ref(genome_build, aligner, galaxy_base): """Retrieve the reference genome file location from galaxy configuration. """ ref_files = dict( bowtie = "bowtie_indices.loc", bwa = "bwa_index.loc", samtools = "sam_fa_indices.loc", maq = "bowtie_indices...
[ "def", "get_genome_ref", "(", "genome_build", ",", "aligner", ",", "galaxy_base", ")", ":", "ref_files", "=", "dict", "(", "bowtie", "=", "\"bowtie_indices.loc\"", ",", "bwa", "=", "\"bwa_index.loc\"", ",", "samtools", "=", "\"sam_fa_indices.loc\"", ",", "maq", ...
Retrieve the reference genome file location from galaxy configuration.
[ "Retrieve", "the", "reference", "genome", "file", "location", "from", "galaxy", "configuration", "." ]
python
train
paramiko/paramiko
paramiko/transport.py
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/transport.py#L536-L592
def start_client(self, event=None, timeout=None): """ Negotiate a new SSH2 session as a client. This is the first step after creating a new `.Transport`. A separate thread is created for protocol negotiation. If an event is passed in, this method returns immediately. When ...
[ "def", "start_client", "(", "self", ",", "event", "=", "None", ",", "timeout", "=", "None", ")", ":", "self", ".", "active", "=", "True", "if", "event", "is", "not", "None", ":", "# async, return immediately and let the app poll for completion", "self", ".", "...
Negotiate a new SSH2 session as a client. This is the first step after creating a new `.Transport`. A separate thread is created for protocol negotiation. If an event is passed in, this method returns immediately. When negotiation is done (successful or not), the given ``Event`` will...
[ "Negotiate", "a", "new", "SSH2", "session", "as", "a", "client", ".", "This", "is", "the", "first", "step", "after", "creating", "a", "new", ".", "Transport", ".", "A", "separate", "thread", "is", "created", "for", "protocol", "negotiation", "." ]
python
train
scieloorg/publicationstatsapi
publicationstats/queries.py
https://github.com/scieloorg/publicationstatsapi/blob/118995d75ef9478f64d5707107f4ce1640a0aa8e/publicationstats/queries.py#L39-L115
def journal_composition(collection, issn, raw=False): """ This method retrieve the total of documents, articles (citable documents), issues and bibliografic references of a journal arguments collection: SciELO 3 letters Acronym issn: Journal ISSN return for journal context { "c...
[ "def", "journal_composition", "(", "collection", ",", "issn", ",", "raw", "=", "False", ")", ":", "tc", "=", "ThriftClient", "(", ")", "body", "=", "{", "\"query\"", ":", "{", "\"filtered\"", ":", "{", "}", "}", "}", "fltr", "=", "{", "}", "query", ...
This method retrieve the total of documents, articles (citable documents), issues and bibliografic references of a journal arguments collection: SciELO 3 letters Acronym issn: Journal ISSN return for journal context { "citable": 12140, "non_citable": 20, "docs": 12160, ...
[ "This", "method", "retrieve", "the", "total", "of", "documents", "articles", "(", "citable", "documents", ")", "issues", "and", "bibliografic", "references", "of", "a", "journal" ]
python
train
City-of-Helsinki/django-helusers
helusers/utils.py
https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/utils.py#L20-L30
def username_to_uuid(username): """ Convert username to UUID. >>> username_to_uuid('u-ad52zgilvnpgnduefzlh5jgr6y') UUID('00fbac99-0bab-5e66-8e84-2e567ea4d1f6') """ if not username.startswith('u-') or len(username) != 28: raise ValueError('Not an UUID based username: %r' % (username,)) ...
[ "def", "username_to_uuid", "(", "username", ")", ":", "if", "not", "username", ".", "startswith", "(", "'u-'", ")", "or", "len", "(", "username", ")", "!=", "28", ":", "raise", "ValueError", "(", "'Not an UUID based username: %r'", "%", "(", "username", ",",...
Convert username to UUID. >>> username_to_uuid('u-ad52zgilvnpgnduefzlh5jgr6y') UUID('00fbac99-0bab-5e66-8e84-2e567ea4d1f6')
[ "Convert", "username", "to", "UUID", "." ]
python
train
twitterdev/tweet_parser
tweet_parser/getter_methods/tweet_text.py
https://github.com/twitterdev/tweet_parser/blob/3435de8367d36b483a6cfd8d46cc28694ee8a42e/tweet_parser/getter_methods/tweet_text.py#L285-L306
def remove_links(text): """ Helper function to remove the links from the input text Args: text (str): A string Returns: str: the same text, but with any substring that matches the regex for a link removed and replaced with a space Example: >>> from tweet_parser.get...
[ "def", "remove_links", "(", "text", ")", ":", "tco_link_regex", "=", "re", ".", "compile", "(", "\"https?://t.co/[A-z0-9].*\"", ")", "generic_link_regex", "=", "re", ".", "compile", "(", "\"(https?://)?(\\w*[.]\\w+)+([/?=&]+\\w+)*\"", ")", "remove_tco", "=", "re", "...
Helper function to remove the links from the input text Args: text (str): A string Returns: str: the same text, but with any substring that matches the regex for a link removed and replaced with a space Example: >>> from tweet_parser.getter_methods.tweet_text import remove...
[ "Helper", "function", "to", "remove", "the", "links", "from", "the", "input", "text" ]
python
train
PmagPy/PmagPy
pmagpy/pmagplotlib.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmagplotlib.py#L2423-L2441
def plot_xft(fignum, XF, T, e, b): """ function to plot series of chi measurements as a function of temperature, holding field constant and varying frequency """ plt.figure(num=fignum) plt.clf() if not isServer: plt.figtext(.02, .01, version_num) plt.xlabel('Frequency (Hz)') plt.ylab...
[ "def", "plot_xft", "(", "fignum", ",", "XF", ",", "T", ",", "e", ",", "b", ")", ":", "plt", ".", "figure", "(", "num", "=", "fignum", ")", "plt", ".", "clf", "(", ")", "if", "not", "isServer", ":", "plt", ".", "figtext", "(", ".02", ",", ".01...
function to plot series of chi measurements as a function of temperature, holding field constant and varying frequency
[ "function", "to", "plot", "series", "of", "chi", "measurements", "as", "a", "function", "of", "temperature", "holding", "field", "constant", "and", "varying", "frequency" ]
python
train
sorgerlab/indra
indra/sources/bel/api.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L20-L71
def process_ndex_neighborhood(gene_names, network_id=None, rdf_out='bel_output.rdf', print_output=True): """Return a BelRdfProcessor for an NDEx network neighborhood. Parameters ---------- gene_names : list A list of HGNC gene symbols to search the neighborhood of....
[ "def", "process_ndex_neighborhood", "(", "gene_names", ",", "network_id", "=", "None", ",", "rdf_out", "=", "'bel_output.rdf'", ",", "print_output", "=", "True", ")", ":", "logger", ".", "warning", "(", "'This method is deprecated and the results are not '", "'guarantee...
Return a BelRdfProcessor for an NDEx network neighborhood. Parameters ---------- gene_names : list A list of HGNC gene symbols to search the neighborhood of. Example: ['BRAF', 'MAP2K1'] network_id : Optional[str] The UUID of the network in NDEx. By default, the BEL Large Corpus ...
[ "Return", "a", "BelRdfProcessor", "for", "an", "NDEx", "network", "neighborhood", "." ]
python
train
nicolargo/glances
glances/outputs/glances_curses.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_curses.py#L182-L295
def _init_colors(self): """Init the Curses color layout.""" # Set curses options try: if hasattr(curses, 'start_color'): curses.start_color() if hasattr(curses, 'use_default_colors'): curses.use_default_colors() except Exception as...
[ "def", "_init_colors", "(", "self", ")", ":", "# Set curses options", "try", ":", "if", "hasattr", "(", "curses", ",", "'start_color'", ")", ":", "curses", ".", "start_color", "(", ")", "if", "hasattr", "(", "curses", ",", "'use_default_colors'", ")", ":", ...
Init the Curses color layout.
[ "Init", "the", "Curses", "color", "layout", "." ]
python
train
DataBiosphere/toil
src/toil/common.py
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/common.py#L821-L844
def getJobStore(cls, locator): """ Create an instance of the concrete job store implementation that matches the given locator. :param str locator: The location of the job store to be represent by the instance :return: an instance of a concrete subclass of AbstractJobStore :rtyp...
[ "def", "getJobStore", "(", "cls", ",", "locator", ")", ":", "name", ",", "rest", "=", "cls", ".", "parseLocator", "(", "locator", ")", "if", "name", "==", "'file'", ":", "from", "toil", ".", "jobStores", ".", "fileJobStore", "import", "FileJobStore", "re...
Create an instance of the concrete job store implementation that matches the given locator. :param str locator: The location of the job store to be represent by the instance :return: an instance of a concrete subclass of AbstractJobStore :rtype: toil.jobStores.abstractJobStore.AbstractJobStore
[ "Create", "an", "instance", "of", "the", "concrete", "job", "store", "implementation", "that", "matches", "the", "given", "locator", "." ]
python
train
spacetelescope/drizzlepac
drizzlepac/linearfit.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/linearfit.py#L188-L210
def fit_shifts(xy, uv): """ Performs a simple fit for the shift only between matched lists of positions 'xy' and 'uv'. Output: (same as for fit_arrays) ================================= DEVELOPMENT NOTE: Checks need to be put in place to verify that enough ob...
[ "def", "fit_shifts", "(", "xy", ",", "uv", ")", ":", "diff_pts", "=", "xy", "-", "uv", "Pcoeffs", "=", "np", ".", "array", "(", "[", "1.0", ",", "0.0", ",", "diff_pts", "[", ":", ",", "0", "]", ".", "mean", "(", "dtype", "=", "np", ".", "floa...
Performs a simple fit for the shift only between matched lists of positions 'xy' and 'uv'. Output: (same as for fit_arrays) ================================= DEVELOPMENT NOTE: Checks need to be put in place to verify that enough objects are available for a fit. ...
[ "Performs", "a", "simple", "fit", "for", "the", "shift", "only", "between", "matched", "lists", "of", "positions", "xy", "and", "uv", "." ]
python
train
bihealth/vcfpy
examples/bench_parse.py
https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/examples/bench_parse.py#L63-L72
def main(argv=None): """Main program entry point for parsing command line arguments""" parser = argparse.ArgumentParser(description="Parser benchmark") parser.add_argument("--debug", default=False, action="store_true", help="Enable debugging") parser.add_argument("--repetitions", type=int, default=10, ...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Parser benchmark\"", ")", "parser", ".", "add_argument", "(", "\"--debug\"", ",", "default", "=", "False", ",", "action", "=", ...
Main program entry point for parsing command line arguments
[ "Main", "program", "entry", "point", "for", "parsing", "command", "line", "arguments" ]
python
train
CellProfiler/centrosome
centrosome/cpmorphology.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/cpmorphology.py#L3109-L3128
def clean(image, mask=None, iterations = 1): '''Remove isolated pixels 0 0 0 0 0 0 0 1 0 -> 0 0 0 0 0 0 0 0 0 Border pixels and pixels adjoining masks are removed unless one valid neighbor is true. ''' global clean_table if mask is None: masked_image = imag...
[ "def", "clean", "(", "image", ",", "mask", "=", "None", ",", "iterations", "=", "1", ")", ":", "global", "clean_table", "if", "mask", "is", "None", ":", "masked_image", "=", "image", "else", ":", "masked_image", "=", "image", ".", "astype", "(", "bool"...
Remove isolated pixels 0 0 0 0 0 0 0 1 0 -> 0 0 0 0 0 0 0 0 0 Border pixels and pixels adjoining masks are removed unless one valid neighbor is true.
[ "Remove", "isolated", "pixels", "0", "0", "0", "0", "0", "0", "0", "1", "0", "-", ">", "0", "0", "0", "0", "0", "0", "0", "0", "0", "Border", "pixels", "and", "pixels", "adjoining", "masks", "are", "removed", "unless", "one", "valid", "neighbor", ...
python
train
Erotemic/utool
utool/util_graph.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_graph.py#L1319-L1380
def reverse_path(dict_, root, child_to_parents): """ CommandLine: python -m utool.util_graph --exec-reverse_path --show Example: >>> # ENABLE_DOCTEST >>> from utool.util_graph import * # NOQA >>> import utool as ut >>> child_to_parents = { >>> 'chip': ['...
[ "def", "reverse_path", "(", "dict_", ",", "root", ",", "child_to_parents", ")", ":", "# Hacky but illustrative", "# TODO; implement non-hacky version", "allkeys", "=", "get_allkeys", "(", "dict_", ")", "mat", "=", "np", ".", "zeros", "(", "(", "len", "(", "allke...
CommandLine: python -m utool.util_graph --exec-reverse_path --show Example: >>> # ENABLE_DOCTEST >>> from utool.util_graph import * # NOQA >>> import utool as ut >>> child_to_parents = { >>> 'chip': ['dummy_annot'], >>> 'chipmask': ['dummy_annot'], ...
[ "CommandLine", ":", "python", "-", "m", "utool", ".", "util_graph", "--", "exec", "-", "reverse_path", "--", "show" ]
python
train
pantsbuild/pants
src/python/pants/pantsd/process_manager.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/pantsd/process_manager.py#L54-L65
def iter_processes(self, proc_filter=None): """Yields processes from psutil.process_iter with an optional filter and swallows psutil errors. If a psutil exception is raised during execution of the filter, that process will not be yielded but subsequent processes will. On the other hand, if psutil.process_i...
[ "def", "iter_processes", "(", "self", ",", "proc_filter", "=", "None", ")", ":", "with", "swallow_psutil_exceptions", "(", ")", ":", "# process_iter may raise", "for", "proc", "in", "psutil", ".", "process_iter", "(", ")", ":", "with", "swallow_psutil_exceptions",...
Yields processes from psutil.process_iter with an optional filter and swallows psutil errors. If a psutil exception is raised during execution of the filter, that process will not be yielded but subsequent processes will. On the other hand, if psutil.process_iter raises an exception, no more processes will...
[ "Yields", "processes", "from", "psutil", ".", "process_iter", "with", "an", "optional", "filter", "and", "swallows", "psutil", "errors", "." ]
python
train
DarkEnergySurvey/ugali
ugali/utils/healpix.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/healpix.py#L521-L593
def read_map(filename, nest=False, hdu=None, h=False, verbose=True): """Read a healpix map from a fits file. Partial-sky files, if properly identified, are expanded to full size and filled with UNSEEN. Uses fitsio to mirror much (but not all) of the functionality of healpy.read_map Parameters: ...
[ "def", "read_map", "(", "filename", ",", "nest", "=", "False", ",", "hdu", "=", "None", ",", "h", "=", "False", ",", "verbose", "=", "True", ")", ":", "data", ",", "hdr", "=", "fitsio", ".", "read", "(", "filename", ",", "header", "=", "True", ",...
Read a healpix map from a fits file. Partial-sky files, if properly identified, are expanded to full size and filled with UNSEEN. Uses fitsio to mirror much (but not all) of the functionality of healpy.read_map Parameters: ----------- filename : str the fits file name nest : bool, o...
[ "Read", "a", "healpix", "map", "from", "a", "fits", "file", ".", "Partial", "-", "sky", "files", "if", "properly", "identified", "are", "expanded", "to", "full", "size", "and", "filled", "with", "UNSEEN", ".", "Uses", "fitsio", "to", "mirror", "much", "(...
python
train
quantmind/pulsar-odm
odm/dialects/postgresql/green.py
https://github.com/quantmind/pulsar-odm/blob/5955c20beca0a89270c2b390335838deb7d5915e/odm/dialects/postgresql/green.py#L36-L62
def _wait_fd(conn, read=True): '''Wait for an event on file descriptor ``fd``. :param conn: file descriptor :param read: wait for a read event if ``True``, otherwise a wait for write event. This function must be invoked from a coroutine with parent, therefore invoking it from the main gree...
[ "def", "_wait_fd", "(", "conn", ",", "read", "=", "True", ")", ":", "current", "=", "getcurrent", "(", ")", "parent", "=", "current", ".", "parent", "assert", "parent", ",", "'\"_wait_fd\" must be called by greenlet with a parent'", "try", ":", "fileno", "=", ...
Wait for an event on file descriptor ``fd``. :param conn: file descriptor :param read: wait for a read event if ``True``, otherwise a wait for write event. This function must be invoked from a coroutine with parent, therefore invoking it from the main greenlet will raise an exception.
[ "Wait", "for", "an", "event", "on", "file", "descriptor", "fd", "." ]
python
train
jespino/anillo
anillo/handlers/routing.py
https://github.com/jespino/anillo/blob/901a84fd2b4fa909bc06e8bd76090457990576a7/anillo/handlers/routing.py#L158-L172
def _build_rules(specs): """Adapts the list of anillo urlmapping specs into a list of werkzeug rules or rules subclasses. :param list specs: A list of anillo url mapping specs. :return: generator """ for spec in specs: if "context" in spec: yield Context(spec["context"], lis...
[ "def", "_build_rules", "(", "specs", ")", ":", "for", "spec", "in", "specs", ":", "if", "\"context\"", "in", "spec", ":", "yield", "Context", "(", "spec", "[", "\"context\"", "]", ",", "list", "(", "_build_rules", "(", "spec", ".", "get", "(", "\"route...
Adapts the list of anillo urlmapping specs into a list of werkzeug rules or rules subclasses. :param list specs: A list of anillo url mapping specs. :return: generator
[ "Adapts", "the", "list", "of", "anillo", "urlmapping", "specs", "into", "a", "list", "of", "werkzeug", "rules", "or", "rules", "subclasses", "." ]
python
train
Clinical-Genomics/housekeeper
housekeeper/store/api.py
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/store/api.py#L106-L109
def files_ondisk(self, file_objs: models.File) -> set: """Returns a list of files that are not on disk.""" return set([ file_obj for file_obj in file_objs if Path(file_obj.full_path).is_file() ])
[ "def", "files_ondisk", "(", "self", ",", "file_objs", ":", "models", ".", "File", ")", "->", "set", ":", "return", "set", "(", "[", "file_obj", "for", "file_obj", "in", "file_objs", "if", "Path", "(", "file_obj", ".", "full_path", ")", ".", "is_file", ...
Returns a list of files that are not on disk.
[ "Returns", "a", "list", "of", "files", "that", "are", "not", "on", "disk", "." ]
python
train
uw-it-aca/uw-restclients-iasystem
uw_iasystem/evaluation.py
https://github.com/uw-it-aca/uw-restclients-iasystem/blob/f65f169d54b0d39e2d732cba529ccd8b6cb49f8a/uw_iasystem/evaluation.py#L43-L84
def _json_to_evaluation(data): """ Only keep the data for online evaluations. Two scenarios for multiple instructors: 1) all of the co-instructors may be evaluated online as a group, sharing the eval URL. 2) each co-instructor may be evaluated individually, with separate eval URLs. ...
[ "def", "_json_to_evaluation", "(", "data", ")", ":", "if", "data", "is", "None", ":", "return", "None", "evaluations", "=", "[", "]", "collection_items", "=", "data", ".", "get", "(", "'collection'", ")", ".", "get", "(", "'items'", ")", "for", "item", ...
Only keep the data for online evaluations. Two scenarios for multiple instructors: 1) all of the co-instructors may be evaluated online as a group, sharing the eval URL. 2) each co-instructor may be evaluated individually, with separate eval URLs.
[ "Only", "keep", "the", "data", "for", "online", "evaluations", ".", "Two", "scenarios", "for", "multiple", "instructors", ":", "1", ")", "all", "of", "the", "co", "-", "instructors", "may", "be", "evaluated", "online", "as", "a", "group", "sharing", "the",...
python
train
arista-eosplus/pyeapi
pyeapi/api/vlans.py
https://github.com/arista-eosplus/pyeapi/blob/96a74faef1fe3bd79c4e900aed29c9956a0587d6/pyeapi/api/vlans.py#L188-L198
def delete(self, vid): """ Deletes a VLAN from the running configuration Args: vid (str): The VLAN ID to delete Returns: True if the operation was successful otherwise False """ command = 'no vlan %s' % vid return self.configure(command) if isvla...
[ "def", "delete", "(", "self", ",", "vid", ")", ":", "command", "=", "'no vlan %s'", "%", "vid", "return", "self", ".", "configure", "(", "command", ")", "if", "isvlan", "(", "vid", ")", "else", "False" ]
Deletes a VLAN from the running configuration Args: vid (str): The VLAN ID to delete Returns: True if the operation was successful otherwise False
[ "Deletes", "a", "VLAN", "from", "the", "running", "configuration" ]
python
train
pjuren/pyokit
src/pyokit/scripts/genomicIntersection.py
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/genomicIntersection.py#L47-L78
def getUI(args): """ build and return a UI object for this script. :param args: raw arguments to parse """ programName = os.path.basename(sys.argv[0]) longDescription = "takes a file with a list of p-values and applies " +\ "Benjamini and Hochberg FDR to convert to q-values " shortDes...
[ "def", "getUI", "(", "args", ")", ":", "programName", "=", "os", ".", "path", ".", "basename", "(", "sys", ".", "argv", "[", "0", "]", ")", "longDescription", "=", "\"takes a file with a list of p-values and applies \"", "+", "\"Benjamini and Hochberg FDR to convert...
build and return a UI object for this script. :param args: raw arguments to parse
[ "build", "and", "return", "a", "UI", "object", "for", "this", "script", "." ]
python
train
google/grumpy
third_party/pythonparser/parser.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L1159-L1165
def assert_stmt(self, assert_loc, test, msg): """assert_stmt: 'assert' test [',' test]""" loc = assert_loc.join(test.loc) if msg: loc = loc.join(msg.loc) return ast.Assert(test=test, msg=msg, loc=loc, keyword_loc=assert_loc)
[ "def", "assert_stmt", "(", "self", ",", "assert_loc", ",", "test", ",", "msg", ")", ":", "loc", "=", "assert_loc", ".", "join", "(", "test", ".", "loc", ")", "if", "msg", ":", "loc", "=", "loc", ".", "join", "(", "msg", ".", "loc", ")", "return",...
assert_stmt: 'assert' test [',' test]
[ "assert_stmt", ":", "assert", "test", "[", "test", "]" ]
python
valid