hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
9db9802c2c14ca1ae4ec26fee9851c6dacfeb078
dsh0416/qiskit-terra
qiskit/unroll/_printerbackend.py
[ "Apache-2.0" ]
Python
barrier
null
def barrier(self, qubitlists): """Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples. """ if self.listen: if "barrier" not in self.basis: self.basis.append("barrier") names = [] for qubitlist in qubitlists: ...
Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples.
Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples.
[ "Barrier", "instruction", ".", "qubitlists", "is", "a", "list", "of", "lists", "of", "(", "regname", "idx", ")", "tuples", "." ]
def barrier(self, qubitlists): if self.listen: if "barrier" not in self.basis: self.basis.append("barrier") names = [] for qubitlist in qubitlists: if len(qubitlist) == 1: names.append("%s[%d]" % (qubitlist[0][0], qubitlist[...
[ "def", "barrier", "(", "self", ",", "qubitlists", ")", ":", "if", "self", ".", "listen", ":", "if", "\"barrier\"", "not", "in", "self", ".", "basis", ":", "self", ".", "basis", ".", "append", "(", "\"barrier\"", ")", "names", "=", "[", "]", "for", ...
Barrier instruction.
[ "Barrier", "instruction", "." ]
[ "\"\"\"Barrier instruction.\n\n qubitlists is a list of lists of (regname, idx) tuples.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "qubitlists", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "qubitlists", "type": null, "docstring": null, "docstring_toke...
9db9802c2c14ca1ae4ec26fee9851c6dacfeb078
dsh0416/qiskit-terra
qiskit/unroll/_printerbackend.py
[ "Apache-2.0" ]
Python
start_gate
null
def start_gate(self, name, args, qubits, nested_scope=None, extra_fields=None): """Begin a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables ...
Begin a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
Begin a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
[ "Begin", "a", "custom", "gate", ".", "name", "is", "name", "string", ".", "args", "is", "list", "of", "Node", "expression", "objects", ".", "qubits", "is", "list", "of", "(", "regname", "idx", ")", "tuples", ".", "nested_scope", "is", "a", "list", "of"...
def start_gate(self, name, args, qubits, nested_scope=None, extra_fields=None): if self.listen and self.comments: print("// start %s, %s, %s" % (name, list(map(lambda x: str(x.sym(nested_scope)), ...
[ "def", "start_gate", "(", "self", ",", "name", ",", "args", ",", "qubits", ",", "nested_scope", "=", "None", ",", "extra_fields", "=", "None", ")", ":", "if", "self", ".", "listen", "and", "self", ".", "comments", ":", "print", "(", "\"// start %s, %s, %...
Begin a custom gate.
[ "Begin", "a", "custom", "gate", "." ]
[ "\"\"\"Begin a custom gate.\n\n name is name string.\n args is list of Node expression objects.\n qubits is list of (regname, idx) tuples.\n nested_scope is a list of dictionaries mapping expression variables\n to Node expression objects in order of increasing nesting depth.\n ...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "args", "type": null }, { "param": "qubits", "type": null }, { "param": "nested_scope", "type": null }, { "param": "extra_fields", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
9db9802c2c14ca1ae4ec26fee9851c6dacfeb078
dsh0416/qiskit-terra
qiskit/unroll/_printerbackend.py
[ "Apache-2.0" ]
Python
end_gate
null
def end_gate(self, name, args, qubits, nested_scope=None): """End a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables to Node expression ...
End a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
End a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
[ "End", "a", "custom", "gate", ".", "name", "is", "name", "string", ".", "args", "is", "list", "of", "Node", "expression", "objects", ".", "qubits", "is", "list", "of", "(", "regname", "idx", ")", "tuples", ".", "nested_scope", "is", "a", "list", "of", ...
def end_gate(self, name, args, qubits, nested_scope=None): if name == self.in_gate: self.in_gate = "" self.listen = True if self.listen and self.comments: print("// end %s, %s, %s" % (name, list(map(lambda x: ...
[ "def", "end_gate", "(", "self", ",", "name", ",", "args", ",", "qubits", ",", "nested_scope", "=", "None", ")", ":", "if", "name", "==", "self", ".", "in_gate", ":", "self", ".", "in_gate", "=", "\"\"", "self", ".", "listen", "=", "True", "if", "se...
End a custom gate.
[ "End", "a", "custom", "gate", "." ]
[ "\"\"\"End a custom gate.\n\n name is name string.\n args is list of Node expression objects.\n qubits is list of (regname, idx) tuples.\n nested_scope is a list of dictionaries mapping expression variables\n to Node expression objects in order of increasing nesting depth.\n ...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "args", "type": null }, { "param": "qubits", "type": null }, { "param": "nested_scope", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
aefead0c1b7df8da045324c17b87dcd01c9fad99
dsh0416/qiskit-terra
qiskit/unroll/_dagbackend.py
[ "Apache-2.0" ]
Python
u
null
def u(self, arg, qubit, nested_scope=None): """Fundamental single qubit gate. arg is 3-tuple of Node expression objects. qubit is (regname,idx) tuple. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting de...
Fundamental single qubit gate. arg is 3-tuple of Node expression objects. qubit is (regname,idx) tuple. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
Fundamental single qubit gate. arg is 3-tuple of Node expression objects. qubit is (regname,idx) tuple. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
[ "Fundamental", "single", "qubit", "gate", ".", "arg", "is", "3", "-", "tuple", "of", "Node", "expression", "objects", ".", "qubit", "is", "(", "regname", "idx", ")", "tuple", ".", "nested_scope", "is", "a", "list", "of", "dictionaries", "mapping", "express...
def u(self, arg, qubit, nested_scope=None): if self.listen: if self.creg is not None: condition = (self.creg, self.cval) else: condition = None if "U" not in self.basis: self.basis.append("U") self.circuit.add_ba...
[ "def", "u", "(", "self", ",", "arg", ",", "qubit", ",", "nested_scope", "=", "None", ")", ":", "if", "self", ".", "listen", ":", "if", "self", ".", "creg", "is", "not", "None", ":", "condition", "=", "(", "self", ".", "creg", ",", "self", ".", ...
Fundamental single qubit gate.
[ "Fundamental", "single", "qubit", "gate", "." ]
[ "\"\"\"Fundamental single qubit gate.\n\n arg is 3-tuple of Node expression objects.\n qubit is (regname,idx) tuple.\n nested_scope is a list of dictionaries mapping expression variables\n to Node expression objects in order of increasing nesting depth.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "arg", "type": null }, { "param": "qubit", "type": null }, { "param": "nested_scope", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg", "type": null, "docstring": null, "docstring_tokens": []...
aefead0c1b7df8da045324c17b87dcd01c9fad99
dsh0416/qiskit-terra
qiskit/unroll/_dagbackend.py
[ "Apache-2.0" ]
Python
barrier
null
def barrier(self, qubitlists): """Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples. """ if self.listen: names = [] for qubit in qubitlists: for j, _ in enumerate(qubit): names.append(qubit[j]) ...
Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples.
Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples.
[ "Barrier", "instruction", ".", "qubitlists", "is", "a", "list", "of", "lists", "of", "(", "regname", "idx", ")", "tuples", "." ]
def barrier(self, qubitlists): if self.listen: names = [] for qubit in qubitlists: for j, _ in enumerate(qubit): names.append(qubit[j]) if "barrier" not in self.basis: self.basis.append("barrier") self.circui...
[ "def", "barrier", "(", "self", ",", "qubitlists", ")", ":", "if", "self", ".", "listen", ":", "names", "=", "[", "]", "for", "qubit", "in", "qubitlists", ":", "for", "j", ",", "_", "in", "enumerate", "(", "qubit", ")", ":", "names", ".", "append", ...
Barrier instruction.
[ "Barrier", "instruction", "." ]
[ "\"\"\"Barrier instruction.\n\n qubitlists is a list of lists of (regname, idx) tuples.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "qubitlists", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "qubitlists", "type": null, "docstring": null, "docstring_toke...
aefead0c1b7df8da045324c17b87dcd01c9fad99
dsh0416/qiskit-terra
qiskit/unroll/_dagbackend.py
[ "Apache-2.0" ]
Python
start_gate
null
def start_gate(self, name, args, qubits, nested_scope=None, extra_fields=None): """Begin a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables ...
Begin a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
Begin a custom gate. name is name string. args is list of Node expression objects. qubits is list of (regname, idx) tuples. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
[ "Begin", "a", "custom", "gate", ".", "name", "is", "name", "string", ".", "args", "is", "list", "of", "Node", "expression", "objects", ".", "qubits", "is", "list", "of", "(", "regname", "idx", ")", "tuples", ".", "nested_scope", "is", "a", "list", "of"...
def start_gate(self, name, args, qubits, nested_scope=None, extra_fields=None): if self.listen and name not in self.basis \ and self.gates[name]["opaque"]: raise BackendError("opaque gate %s not in basis" % name) if self.listen and name in self.basis: if self.creg...
[ "def", "start_gate", "(", "self", ",", "name", ",", "args", ",", "qubits", ",", "nested_scope", "=", "None", ",", "extra_fields", "=", "None", ")", ":", "if", "self", ".", "listen", "and", "name", "not", "in", "self", ".", "basis", "and", "self", "."...
Begin a custom gate.
[ "Begin", "a", "custom", "gate", "." ]
[ "\"\"\"Begin a custom gate.\n\n name is name string.\n args is list of Node expression objects.\n qubits is list of (regname, idx) tuples.\n nested_scope is a list of dictionaries mapping expression variables\n to Node expression objects in order of increasing nesting depth.\n ...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "args", "type": null }, { "param": "qubits", "type": null }, { "param": "nested_scope", "type": null }, { "param": "extra_fields", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
74e8d6688da1333b3d70c7a4057547ae7b462a84
dsh0416/qiskit-terra
qiskit/backends/ibmq/ibmqbackend.py
[ "Apache-2.0" ]
Python
jobs
<not_specific>
def jobs(self, limit=50, skip=0, status=None, db_filter=None): """Attempt to get the jobs submitted to the backend. Args: limit (int): number of jobs to retrieve skip (int): starting index of retrieval status (None or JobStatus or str): only get jobs with this status...
Attempt to get the jobs submitted to the backend. Args: limit (int): number of jobs to retrieve skip (int): starting index of retrieval status (None or JobStatus or str): only get jobs with this status, where status is e.g. `JobStatus.RUNNING` or `'RUNNING'` ...
Attempt to get the jobs submitted to the backend.
[ "Attempt", "to", "get", "the", "jobs", "submitted", "to", "the", "backend", "." ]
def jobs(self, limit=50, skip=0, status=None, db_filter=None): backend_name = self.configuration()['name'] api_filter = {'backend.name': backend_name} if status: if isinstance(status, str): status = JobStatus[status] if status == JobStatus.RUNNING: ...
[ "def", "jobs", "(", "self", ",", "limit", "=", "50", ",", "skip", "=", "0", ",", "status", "=", "None", ",", "db_filter", "=", "None", ")", ":", "backend_name", "=", "self", ".", "configuration", "(", ")", "[", "'name'", "]", "api_filter", "=", "{"...
Attempt to get the jobs submitted to the backend.
[ "Attempt", "to", "get", "the", "jobs", "submitted", "to", "the", "backend", "." ]
[ "\"\"\"Attempt to get the jobs submitted to the backend.\n\n Args:\n limit (int): number of jobs to retrieve\n skip (int): starting index of retrieval\n status (None or JobStatus or str): only get jobs with this status,\n where status is e.g. `JobStatus.RUNNING...
[ { "param": "self", "type": null }, { "param": "limit", "type": null }, { "param": "skip", "type": null }, { "param": "status", "type": null }, { "param": "db_filter", "type": null } ]
{ "returns": [ { "docstring": "list of IBMQJob instances", "docstring_tokens": [ "list", "of", "IBMQJob", "instances" ], "type": "list(IBMQJob)" } ], "raises": [ { "docstring": "status keyword value unrecognized", "docstring_tokens": ...
74e8d6688da1333b3d70c7a4057547ae7b462a84
dsh0416/qiskit-terra
qiskit/backends/ibmq/ibmqbackend.py
[ "Apache-2.0" ]
Python
retrieve_job
<not_specific>
def retrieve_job(self, job_id): """Attempt to get the specified job by job_id Args: job_id (str): the job id of the job to retrieve Returns: IBMQJob: class instance Raises: IBMQBackendError: if retrieval failed """ try: j...
Attempt to get the specified job by job_id Args: job_id (str): the job id of the job to retrieve Returns: IBMQJob: class instance Raises: IBMQBackendError: if retrieval failed
Attempt to get the specified job by job_id
[ "Attempt", "to", "get", "the", "specified", "job", "by", "job_id" ]
def retrieve_job(self, job_id): try: job_info = self._api.get_job(job_id) if 'error' in job_info: raise IBMQBackendError('Failed to get job "{}": {}' .format(job_id, job_info['error'])) except ApiError as ex: rais...
[ "def", "retrieve_job", "(", "self", ",", "job_id", ")", ":", "try", ":", "job_info", "=", "self", ".", "_api", ".", "get_job", "(", "job_id", ")", "if", "'error'", "in", "job_info", ":", "raise", "IBMQBackendError", "(", "'Failed to get job \"{}\": {}'", "."...
Attempt to get the specified job by job_id
[ "Attempt", "to", "get", "the", "specified", "job", "by", "job_id" ]
[ "\"\"\"Attempt to get the specified job by job_id\n\n Args:\n job_id (str): the job id of the job to retrieve\n\n Returns:\n IBMQJob: class instance\n\n Raises:\n IBMQBackendError: if retrieval failed\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "job_id", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "IBMQJob" } ], "raises": [ { "docstring": "if retrieval failed", "docstring_tokens": [ "if", "retrieval", "failed" ], "type": "IBMQBackendError" ...
9c8b3644725cf402424cf3b3692129d08a2bcef6
dsh0416/qiskit-terra
qiskit/unroll/_jsonbackend.py
[ "Apache-2.0" ]
Python
u
null
def u(self, arg, qubit, nested_scope=None): """Fundamental single-qubit gate. arg is 3-tuple of Node expression objects. qubit is (regname, idx) tuple. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting d...
Fundamental single-qubit gate. arg is 3-tuple of Node expression objects. qubit is (regname, idx) tuple. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
Fundamental single-qubit gate. arg is 3-tuple of Node expression objects. qubit is (regname, idx) tuple. nested_scope is a list of dictionaries mapping expression variables to Node expression objects in order of increasing nesting depth.
[ "Fundamental", "single", "-", "qubit", "gate", ".", "arg", "is", "3", "-", "tuple", "of", "Node", "expression", "objects", ".", "qubit", "is", "(", "regname", "idx", ")", "tuple", ".", "nested_scope", "is", "a", "list", "of", "dictionaries", "mapping", "...
def u(self, arg, qubit, nested_scope=None): if self.listen: if "U" not in self.basis: self.basis.append("U") qubit_indices = [self._qubit_order_internal.get(qubit)] self.circuit['instructions'].append({ 'name': "U", 'params': [f...
[ "def", "u", "(", "self", ",", "arg", ",", "qubit", ",", "nested_scope", "=", "None", ")", ":", "if", "self", ".", "listen", ":", "if", "\"U\"", "not", "in", "self", ".", "basis", ":", "self", ".", "basis", ".", "append", "(", "\"U\"", ")", "qubit...
Fundamental single-qubit gate.
[ "Fundamental", "single", "-", "qubit", "gate", "." ]
[ "\"\"\"Fundamental single-qubit gate.\n\n arg is 3-tuple of Node expression objects.\n qubit is (regname, idx) tuple.\n nested_scope is a list of dictionaries mapping expression variables\n to Node expression objects in order of increasing nesting depth.\n \"\"\"", "# TODO: keep...
[ { "param": "self", "type": null }, { "param": "arg", "type": null }, { "param": "qubit", "type": null }, { "param": "nested_scope", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg", "type": null, "docstring": null, "docstring_tokens": []...
9c8b3644725cf402424cf3b3692129d08a2bcef6
dsh0416/qiskit-terra
qiskit/unroll/_jsonbackend.py
[ "Apache-2.0" ]
Python
_add_condition
null
def _add_condition(self): """Check for a condition (self.creg) and add fields if necessary. Fields are added to the last operation in the circuit. """ if self.creg is not None: mask = 0 for cbit, index in self._cbit_order_internal.items(): if cbit...
Check for a condition (self.creg) and add fields if necessary. Fields are added to the last operation in the circuit.
Check for a condition (self.creg) and add fields if necessary. Fields are added to the last operation in the circuit.
[ "Check", "for", "a", "condition", "(", "self", ".", "creg", ")", "and", "add", "fields", "if", "necessary", ".", "Fields", "are", "added", "to", "the", "last", "operation", "in", "the", "circuit", "." ]
def _add_condition(self): if self.creg is not None: mask = 0 for cbit, index in self._cbit_order_internal.items(): if cbit[0] == self.creg: mask |= (1 << index) conditional = { 'type': "equals", '...
[ "def", "_add_condition", "(", "self", ")", ":", "if", "self", ".", "creg", "is", "not", "None", ":", "mask", "=", "0", "for", "cbit", ",", "index", "in", "self", ".", "_cbit_order_internal", ".", "items", "(", ")", ":", "if", "cbit", "[", "0", "]",...
Check for a condition (self.creg) and add fields if necessary.
[ "Check", "for", "a", "condition", "(", "self", ".", "creg", ")", "and", "add", "fields", "if", "necessary", "." ]
[ "\"\"\"Check for a condition (self.creg) and add fields if necessary.\n\n Fields are added to the last operation in the circuit.\n \"\"\"", "# Would be nicer to zero pad the mask, but we", "# need to know the total number of cbits.", "# format_spec = \"{0:#0{%d}X}\" % number_of_clbits", "# for...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9c8b3644725cf402424cf3b3692129d08a2bcef6
dsh0416/qiskit-terra
qiskit/unroll/_jsonbackend.py
[ "Apache-2.0" ]
Python
barrier
null
def barrier(self, qubitlists): """Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples. """ if self.listen: if "barrier" not in self.basis: self.basis.append("barrier") qubit_indices = [] for qubitlist in qubitli...
Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples.
Barrier instruction. qubitlists is a list of lists of (regname, idx) tuples.
[ "Barrier", "instruction", ".", "qubitlists", "is", "a", "list", "of", "lists", "of", "(", "regname", "idx", ")", "tuples", "." ]
def barrier(self, qubitlists): if self.listen: if "barrier" not in self.basis: self.basis.append("barrier") qubit_indices = [] for qubitlist in qubitlists: for qubits in qubitlist: qubit_indices.append(self._qubit_order_inte...
[ "def", "barrier", "(", "self", ",", "qubitlists", ")", ":", "if", "self", ".", "listen", ":", "if", "\"barrier\"", "not", "in", "self", ".", "basis", ":", "self", ".", "basis", ".", "append", "(", "\"barrier\"", ")", "qubit_indices", "=", "[", "]", "...
Barrier instruction.
[ "Barrier", "instruction", "." ]
[ "\"\"\"Barrier instruction.\n\n qubitlists is a list of lists of (regname, idx) tuples.\n \"\"\"", "# no conditions on barrier, even when it appears", "# in body of conditioned gate" ]
[ { "param": "self", "type": null }, { "param": "qubitlists", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "qubitlists", "type": null, "docstring": null, "docstring_toke...
4f5473b5d80790ed99c73c6bd9b7e3212d69b0d9
dsh0416/qiskit-terra
qiskit/transpiler/_receiver.py
[ "Apache-2.0" ]
Python
add_channel
<not_specific>
def add_channel(self, transmitter): """Add channel to the recievers channels. Parameters: transmitter (object): Object to be added to channels. Returns: int: Id of added channel. """ self._channels[self.channel_id] = transmitter _channel_id = sel...
Add channel to the recievers channels. Parameters: transmitter (object): Object to be added to channels. Returns: int: Id of added channel.
Add channel to the recievers channels.
[ "Add", "channel", "to", "the", "recievers", "channels", "." ]
def add_channel(self, transmitter): self._channels[self.channel_id] = transmitter _channel_id = self.channel_id self.channel_id += 1 return _channel_id
[ "def", "add_channel", "(", "self", ",", "transmitter", ")", ":", "self", ".", "_channels", "[", "self", ".", "channel_id", "]", "=", "transmitter", "_channel_id", "=", "self", ".", "channel_id", "self", ".", "channel_id", "+=", "1", "return", "_channel_id" ]
Add channel to the recievers channels.
[ "Add", "channel", "to", "the", "recievers", "channels", "." ]
[ "\"\"\"Add channel to the recievers channels.\n\n Parameters:\n transmitter (object): Object to be added to channels.\n\n Returns:\n int: Id of added channel.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "transmitter", "type": null } ]
{ "returns": [ { "docstring": "Id of added channel.", "docstring_tokens": [ "Id", "of", "added", "channel", "." ], "type": "int" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
4f5473b5d80790ed99c73c6bd9b7e3212d69b0d9
dsh0416/qiskit-terra
qiskit/transpiler/_receiver.py
[ "Apache-2.0" ]
Python
remove_channel
null
def remove_channel(self, index): """Remove a channel from the receiver by index number. Parameters: index (int): Index fo channel to remove. Raises: QISKitError: Index not in receiver keys. """ if index in self._channels.keys(): del self._cha...
Remove a channel from the receiver by index number. Parameters: index (int): Index fo channel to remove. Raises: QISKitError: Index not in receiver keys.
Remove a channel from the receiver by index number.
[ "Remove", "a", "channel", "from", "the", "receiver", "by", "index", "number", "." ]
def remove_channel(self, index): if index in self._channels.keys(): del self._channels[index] else: raise QISKitError('Index not in receiver channels.')
[ "def", "remove_channel", "(", "self", ",", "index", ")", ":", "if", "index", "in", "self", ".", "_channels", ".", "keys", "(", ")", ":", "del", "self", ".", "_channels", "[", "index", "]", "else", ":", "raise", "QISKitError", "(", "'Index not in receiver...
Remove a channel from the receiver by index number.
[ "Remove", "a", "channel", "from", "the", "receiver", "by", "index", "number", "." ]
[ "\"\"\"Remove a channel from the receiver by index number.\n\n Parameters:\n index (int): Index fo channel to remove.\n\n Raises:\n QISKitError: Index not in receiver keys.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "index", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "Index not in receiver keys.", "docstring_tokens": [ "Index", "not", "in", "receiver", "keys", "." ], "type": "QISKitError" } ], "params": [ { "identifier": "self", "type":...
6b9d64db8b4ac48da0ece912e0ecf6a537e61fc5
RainerStaude/hass-becker-component-plus-pybecker
cover.py
[ "MIT" ]
Python
async_setup_platform
null
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the becker platform.""" covers = [] device = config.get(CONF_DEVICE) filename = config.get(CONF_FILENAME) _LOGGER.debug("%s: %s; %s: %s", CONF_DEVICE, device, CONF_FILENAME, filename) PyBecker.setup(...
Set up the becker platform.
Set up the becker platform.
[ "Set", "up", "the", "becker", "platform", "." ]
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): covers = [] device = config.get(CONF_DEVICE) filename = config.get(CONF_FILENAME) _LOGGER.debug("%s: %s; %s: %s", CONF_DEVICE, device, CONF_FILENAME, filename) PyBecker.setup(hass, device=device, filename=filename...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "covers", "=", "[", "]", "device", "=", "config", ".", "get", "(", "CONF_DEVICE", ")", "filename", "=", "config", "...
Set up the becker platform.
[ "Set", "up", "the", "becker", "platform", "." ]
[ "\"\"\"Set up the becker platform.\"\"\"", "# Initialize all missing units in the db file and send stop command for sync" ]
[ { "param": "hass", "type": null }, { "param": "config", "type": null }, { "param": "async_add_entities", "type": null }, { "param": "discovery_info", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hass", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": null, "docstring": null, "docstring_tokens":...
6b9d64db8b4ac48da0ece912e0ecf6a537e61fc5
RainerStaude/hass-becker-component-plus-pybecker
cover.py
[ "MIT" ]
Python
is_opening
<not_specific>
def is_opening(self): """Return if the cover is opening or not.""" action = False if self._cover_features & SUPPORT_SET_POSITION: action = self._tc.is_opening() return action
Return if the cover is opening or not.
Return if the cover is opening or not.
[ "Return", "if", "the", "cover", "is", "opening", "or", "not", "." ]
def is_opening(self): action = False if self._cover_features & SUPPORT_SET_POSITION: action = self._tc.is_opening() return action
[ "def", "is_opening", "(", "self", ")", ":", "action", "=", "False", "if", "self", ".", "_cover_features", "&", "SUPPORT_SET_POSITION", ":", "action", "=", "self", ".", "_tc", ".", "is_opening", "(", ")", "return", "action" ]
Return if the cover is opening or not.
[ "Return", "if", "the", "cover", "is", "opening", "or", "not", "." ]
[ "\"\"\"Return if the cover is opening or not.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b9d64db8b4ac48da0ece912e0ecf6a537e61fc5
RainerStaude/hass-becker-component-plus-pybecker
cover.py
[ "MIT" ]
Python
is_closing
<not_specific>
def is_closing(self): """Return if the cover is closing or not.""" action = False if self._cover_features & SUPPORT_SET_POSITION: action = self._tc.is_closing() return action
Return if the cover is closing or not.
Return if the cover is closing or not.
[ "Return", "if", "the", "cover", "is", "closing", "or", "not", "." ]
def is_closing(self): action = False if self._cover_features & SUPPORT_SET_POSITION: action = self._tc.is_closing() return action
[ "def", "is_closing", "(", "self", ")", ":", "action", "=", "False", "if", "self", ".", "_cover_features", "&", "SUPPORT_SET_POSITION", ":", "action", "=", "self", ".", "_tc", ".", "is_closing", "(", ")", "return", "action" ]
Return if the cover is closing or not.
[ "Return", "if", "the", "cover", "is", "closing", "or", "not", "." ]
[ "\"\"\"Return if the cover is closing or not.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b9d64db8b4ac48da0ece912e0ecf6a537e61fc5
RainerStaude/hass-becker-component-plus-pybecker
cover.py
[ "MIT" ]
Python
async_set_cover_position
null
async def async_set_cover_position(self, **kwargs): """Move the cover to a specific position.""" # Feature only available if SUPPORT_SET_POSITION is set if ATTR_POSITION in kwargs: pos = kwargs[ATTR_POSITION] travel_time = self._travel_to_position(pos) if self...
Move the cover to a specific position.
Move the cover to a specific position.
[ "Move", "the", "cover", "to", "a", "specific", "position", "." ]
async def async_set_cover_position(self, **kwargs): if ATTR_POSITION in kwargs: pos = kwargs[ATTR_POSITION] travel_time = self._travel_to_position(pos) if self._tc.is_closing(): await self._becker.move_down(self._channel) elif self._tc.is_opening()...
[ "async", "def", "async_set_cover_position", "(", "self", ",", "**", "kwargs", ")", ":", "if", "ATTR_POSITION", "in", "kwargs", ":", "pos", "=", "kwargs", "[", "ATTR_POSITION", "]", "travel_time", "=", "self", ".", "_travel_to_position", "(", "pos", ")", "if"...
Move the cover to a specific position.
[ "Move", "the", "cover", "to", "a", "specific", "position", "." ]
[ "\"\"\"Move the cover to a specific position.\"\"\"", "# Feature only available if SUPPORT_SET_POSITION is set" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b9d64db8b4ac48da0ece912e0ecf6a537e61fc5
RainerStaude/hass-becker-component-plus-pybecker
cover.py
[ "MIT" ]
Python
_travel_to_position
<not_specific>
def _travel_to_position(self, position): """Start TravelCalculator and update ha-state.""" # In TravelCalculator 0 is open, 100 is closed. travel_time = self._tc._calculate_travel_time( self.current_cover_position - position ) if self._template is None: _L...
Start TravelCalculator and update ha-state.
Start TravelCalculator and update ha-state.
[ "Start", "TravelCalculator", "and", "update", "ha", "-", "state", "." ]
def _travel_to_position(self, position): travel_time = self._tc._calculate_travel_time( self.current_cover_position - position ) if self._template is None: _LOGGER.debug( "%s is travelling from position %s to %s in %s seconds", self.name, s...
[ "def", "_travel_to_position", "(", "self", ",", "position", ")", ":", "travel_time", "=", "self", ".", "_tc", ".", "_calculate_travel_time", "(", "self", ".", "current_cover_position", "-", "position", ")", "if", "self", ".", "_template", "is", "None", ":", ...
Start TravelCalculator and update ha-state.
[ "Start", "TravelCalculator", "and", "update", "ha", "-", "state", "." ]
[ "\"\"\"Start TravelCalculator and update ha-state.\"\"\"", "# In TravelCalculator 0 is open, 100 is closed." ]
[ { "param": "self", "type": null }, { "param": "position", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "position", "type": null, "docstring": null, "docstring_tokens...
6b9d64db8b4ac48da0ece912e0ecf6a537e61fc5
RainerStaude/hass-becker-component-plus-pybecker
cover.py
[ "MIT" ]
Python
_travel_stop
null
def _travel_stop(self): """Stop TravelCalculator and update ha-state.""" self._tc.stop() if not (self._cover_features & SUPPORT_SET_POSITION) and self._template is None: self._tc.set_position(50) _LOGGER.debug("%s stopped at position %s", self.name, self.current_cover_positio...
Stop TravelCalculator and update ha-state.
Stop TravelCalculator and update ha-state.
[ "Stop", "TravelCalculator", "and", "update", "ha", "-", "state", "." ]
def _travel_stop(self): self._tc.stop() if not (self._cover_features & SUPPORT_SET_POSITION) and self._template is None: self._tc.set_position(50) _LOGGER.debug("%s stopped at position %s", self.name, self.current_cover_position) self._update_scheduled_ha_state_callback(0)
[ "def", "_travel_stop", "(", "self", ")", ":", "self", ".", "_tc", ".", "stop", "(", ")", "if", "not", "(", "self", ".", "_cover_features", "&", "SUPPORT_SET_POSITION", ")", "and", "self", ".", "_template", "is", "None", ":", "self", ".", "_tc", ".", ...
Stop TravelCalculator and update ha-state.
[ "Stop", "TravelCalculator", "and", "update", "ha", "-", "state", "." ]
[ "\"\"\"Stop TravelCalculator and update ha-state.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b9d64db8b4ac48da0ece912e0ecf6a537e61fc5
RainerStaude/hass-becker-component-plus-pybecker
cover.py
[ "MIT" ]
Python
_update_scheduled_ha_state_callback
null
def _update_scheduled_ha_state_callback(self, delay=None): """ Update ha-state callback None: unsubscibe pending callback 0: update now > 0: update now and setup callback after delay later """ # unsubscribe outdated pending callbacks self._callbacks.po...
Update ha-state callback None: unsubscibe pending callback 0: update now > 0: update now and setup callback after delay later
Update ha-state callback None: unsubscibe pending callback 0: update now > 0: update now and setup callback after delay later
[ "Update", "ha", "-", "state", "callback", "None", ":", "unsubscibe", "pending", "callback", "0", ":", "update", "now", ">", "0", ":", "update", "now", "and", "setup", "callback", "after", "delay", "later" ]
def _update_scheduled_ha_state_callback(self, delay=None): self._callbacks.pop('update_ha', lambda: None)() if delay is not None: _LOGGER.debug("%s update ha-state now", self._name) self.async_schedule_update_ha_state() if delay > 0: _LOGGER.debug( ...
[ "def", "_update_scheduled_ha_state_callback", "(", "self", ",", "delay", "=", "None", ")", ":", "self", ".", "_callbacks", ".", "pop", "(", "'update_ha'", ",", "lambda", ":", "None", ")", "(", ")", "if", "delay", "is", "not", "None", ":", "_LOGGER", ".",...
Update ha-state callback None: unsubscibe pending callback 0: update now > 0: update now and setup callback after delay later
[ "Update", "ha", "-", "state", "callback", "None", ":", "unsubscibe", "pending", "callback", "0", ":", "update", "now", ">", "0", ":", "update", "now", "and", "setup", "callback", "after", "delay", "later" ]
[ "\"\"\"\n Update ha-state callback\n None: unsubscibe pending callback\n 0: update now\n > 0: update now and setup callback after delay later\n \"\"\"", "# unsubscribe outdated pending callbacks", "# Schedule callback to update ha-state at end of travel", "# Update ha-st...
[ { "param": "self", "type": null }, { "param": "delay", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "delay", "type": null, "docstring": null, "docstring_tokens": ...
6b9d64db8b4ac48da0ece912e0ecf6a537e61fc5
RainerStaude/hass-becker-component-plus-pybecker
cover.py
[ "MIT" ]
Python
_update_scheduled_stop_travel_callback
null
def _update_scheduled_stop_travel_callback(self, delay=None): """ Update ha-state callback None: unsubscibe pending callback >= 0: setup callback stop after delay later """ # unsubscribe outdated pending callbacks self._callbacks.pop('travel_stop', lambda: None)()...
Update ha-state callback None: unsubscibe pending callback >= 0: setup callback stop after delay later
Update ha-state callback None: unsubscibe pending callback >= 0: setup callback stop after delay later
[ "Update", "ha", "-", "state", "callback", "None", ":", "unsubscibe", "pending", "callback", ">", "=", "0", ":", "setup", "callback", "stop", "after", "delay", "later" ]
def _update_scheduled_stop_travel_callback(self, delay=None): self._callbacks.pop('travel_stop', lambda: None)() if delay is not None: if delay >= 0: _LOGGER.debug( "%s setup stop travel callback in %s seconds", self.name, delay, ...
[ "def", "_update_scheduled_stop_travel_callback", "(", "self", ",", "delay", "=", "None", ")", ":", "self", ".", "_callbacks", ".", "pop", "(", "'travel_stop'", ",", "lambda", ":", "None", ")", "(", ")", "if", "delay", "is", "not", "None", ":", "if", "del...
Update ha-state callback None: unsubscibe pending callback >= 0: setup callback stop after delay later
[ "Update", "ha", "-", "state", "callback", "None", ":", "unsubscibe", "pending", "callback", ">", "=", "0", ":", "setup", "callback", "stop", "after", "delay", "later" ]
[ "\"\"\"\n Update ha-state callback\n None: unsubscibe pending callback\n >= 0: setup callback stop after delay later\n \"\"\"", "# unsubscribe outdated pending callbacks", "# schedule callback to stop travelling at end of travel", "# Stop now or later" ]
[ { "param": "self", "type": null }, { "param": "delay", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "delay", "type": null, "docstring": null, "docstring_tokens": ...
914968814fc35c512718356a2015141e5fbe9c44
RainerStaude/hass-becker-component-plus-pybecker
pybecker/becker.py
[ "MIT" ]
Python
init_unconfigured_unit
null
async def init_unconfigured_unit(self, channel, name=None): """Init unconfigured units in database and send init call""" # check if unit is configured un, ch = self._split_channel(channel) # pylint: disable=unused-variable unit = self.db.get_unit(un) if unit[2] == 0: ...
Init unconfigured units in database and send init call
Init unconfigured units in database and send init call
[ "Init", "unconfigured", "units", "in", "database", "and", "send", "init", "call" ]
async def init_unconfigured_unit(self, channel, name=None): un, ch = self._split_channel(channel) unit = self.db.get_unit(un) if unit[2] == 0: _LOGGER.warning( "Unit %s%s with channel %s not registered in database file %s!", un, " of...
[ "async", "def", "init_unconfigured_unit", "(", "self", ",", "channel", ",", "name", "=", "None", ")", ":", "un", ",", "ch", "=", "self", ".", "_split_channel", "(", "channel", ")", "unit", "=", "self", ".", "db", ".", "get_unit", "(", "un", ")", "if"...
Init unconfigured units in database and send init call
[ "Init", "unconfigured", "units", "in", "database", "and", "send", "init", "call" ]
[ "\"\"\"Init unconfigured units in database and send init call\"\"\"", "# check if unit is configured", "# pylint: disable=unused-variable", "# set the unit as configured", "# send init call to sync with database (5 required for my Roto cover)", "# 0.5 to 0.9 seconds (works with my Roto cover)" ]
[ { "param": "self", "type": null }, { "param": "channel", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "channel", "type": null, "docstring": null, "docstring_tokens"...
c89464e3659ef13e0d46202bb5951c49d148d596
RainerStaude/hass-becker-component-plus-pybecker
rf_device.py
[ "MIT" ]
Python
handle_pair
null
async def handle_pair(cls, call): """Service to pair with a cover receiver.""" channel = call.data.get(CONF_CHANNEL) unit = call.data.get(CONF_UNIT, 1) await cls.becker.pair(f"{unit}:{channel}")
Service to pair with a cover receiver.
Service to pair with a cover receiver.
[ "Service", "to", "pair", "with", "a", "cover", "receiver", "." ]
async def handle_pair(cls, call): channel = call.data.get(CONF_CHANNEL) unit = call.data.get(CONF_UNIT, 1) await cls.becker.pair(f"{unit}:{channel}")
[ "async", "def", "handle_pair", "(", "cls", ",", "call", ")", ":", "channel", "=", "call", ".", "data", ".", "get", "(", "CONF_CHANNEL", ")", "unit", "=", "call", ".", "data", ".", "get", "(", "CONF_UNIT", ",", "1", ")", "await", "cls", ".", "becker...
Service to pair with a cover receiver.
[ "Service", "to", "pair", "with", "a", "cover", "receiver", "." ]
[ "\"\"\"Service to pair with a cover receiver.\"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "call", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "call", "type": null, "docstring": null, "docstring_tokens": []...
c89464e3659ef13e0d46202bb5951c49d148d596
RainerStaude/hass-becker-component-plus-pybecker
rf_device.py
[ "MIT" ]
Python
handle_log_units
null
async def handle_log_units(cls, call): """Service that logs all paired units.""" units = await cls.becker.list_units() # Apparently the SQLite results are implicitly returned in unit id # order. This seems pretty dirty to rely on. unit_id = 1 _LOGGER.info("Configured Bec...
Service that logs all paired units.
Service that logs all paired units.
[ "Service", "that", "logs", "all", "paired", "units", "." ]
async def handle_log_units(cls, call): units = await cls.becker.list_units() unit_id = 1 _LOGGER.info("Configured Becker centronic units:") for row in units: unit_code, increment = row[0:2] _LOGGER.info( "Unit id %d, unit code %s, increment %d", un...
[ "async", "def", "handle_log_units", "(", "cls", ",", "call", ")", ":", "units", "=", "await", "cls", ".", "becker", ".", "list_units", "(", ")", "unit_id", "=", "1", "_LOGGER", ".", "info", "(", "\"Configured Becker centronic units:\"", ")", "for", "row", ...
Service that logs all paired units.
[ "Service", "that", "logs", "all", "paired", "units", "." ]
[ "\"\"\"Service that logs all paired units.\"\"\"", "# Apparently the SQLite results are implicitly returned in unit id", "# order. This seems pretty dirty to rely on." ]
[ { "param": "cls", "type": null }, { "param": "call", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "call", "type": null, "docstring": null, "docstring_tokens": []...
a60c26170eb2665e12e7d89b35c3f7119cab1464
VunkLai/ndk
ndk/stack.py
[ "MIT" ]
Python
push
null
def push(self, obj): """Push a new Nagios Object to this stack. Args: obj (NagiosObject): The base class of Nagios. """ construct = import_module('.construct', package='ndk') assert isinstance( obj, construct.Construct), f'{obj} must be Construct instance...
Push a new Nagios Object to this stack. Args: obj (NagiosObject): The base class of Nagios.
Push a new Nagios Object to this stack.
[ "Push", "a", "new", "Nagios", "Object", "to", "this", "stack", "." ]
def push(self, obj): construct = import_module('.construct', package='ndk') assert isinstance( obj, construct.Construct), f'{obj} must be Construct instance' self.objects[obj.__object_type__][obj.pk] = obj
[ "def", "push", "(", "self", ",", "obj", ")", ":", "construct", "=", "import_module", "(", "'.construct'", ",", "package", "=", "'ndk'", ")", "assert", "isinstance", "(", "obj", ",", "construct", ".", "Construct", ")", ",", "f'{obj} must be Construct instance'"...
Push a new Nagios Object to this stack.
[ "Push", "a", "new", "Nagios", "Object", "to", "this", "stack", "." ]
[ "\"\"\"Push a new Nagios Object to this stack.\n\n Args:\n obj (NagiosObject): The base class of Nagios.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "obj", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "obj", "type": null, "docstring": "The base class of Nagios.", ...
0d386b0fa64627b2d2c088edd546d8862fbc2ca7
dhruvhs/label-studio
label_studio/labels_manager/serializers.py
[ "Apache-2.0" ]
Python
create
<not_specific>
def create(self, validated_data): ''' Bulk creation objects of Label model with related LabelLink reusing already existing labels ''' from webhooks.utils import emit_webhooks_for_instance with transaction.atomic(): # loading already existing labels titles...
Bulk creation objects of Label model with related LabelLink reusing already existing labels
Bulk creation objects of Label model with related LabelLink reusing already existing labels
[ "Bulk", "creation", "objects", "of", "Label", "model", "with", "related", "LabelLink", "reusing", "already", "existing", "labels" ]
def create(self, validated_data): from webhooks.utils import emit_webhooks_for_instance with transaction.atomic(): titles = [item['title'] for item in validated_data] existing_labels = Label.objects.filter( organization=self.context['request'].user.active_organiza...
[ "def", "create", "(", "self", ",", "validated_data", ")", ":", "from", "webhooks", ".", "utils", "import", "emit_webhooks_for_instance", "with", "transaction", ".", "atomic", "(", ")", ":", "titles", "=", "[", "item", "[", "'title'", "]", "for", "item", "i...
Bulk creation objects of Label model with related LabelLink reusing already existing labels
[ "Bulk", "creation", "objects", "of", "Label", "model", "with", "related", "LabelLink", "reusing", "already", "existing", "labels" ]
[ "''' Bulk creation objects of Label model with related LabelLink\n reusing already existing labels\n '''", "# loading already existing labels", "# create objects for labels, that we need to create", "# connect existing and created labels to project with LabelLink", "# webhooks processing", "...
[ { "param": "self", "type": null }, { "param": "validated_data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "validated_data", "type": null, "docstring": null, "docstring_...
bb824538ed9d34bd74d52aa93cbabce27448979f
dhruvhs/label-studio
label_studio/data_manager/actions/basic.py
[ "Apache-2.0" ]
Python
delete_tasks_annotations
<not_specific>
def delete_tasks_annotations(project, queryset, **kwargs): """ Delete all annotations by tasks ids :param project: project instance :param queryset: filtered tasks db queryset """ task_ids = queryset.values_list('id', flat=True) annotations = Annotation.objects.filter(task__id__in=task_ids) ...
Delete all annotations by tasks ids :param project: project instance :param queryset: filtered tasks db queryset
Delete all annotations by tasks ids
[ "Delete", "all", "annotations", "by", "tasks", "ids" ]
def delete_tasks_annotations(project, queryset, **kwargs): task_ids = queryset.values_list('id', flat=True) annotations = Annotation.objects.filter(task__id__in=task_ids) count = annotations.count() real_task_ids = set(list(annotations.values_list('task__id', flat=True))) annotations_ids = list(anno...
[ "def", "delete_tasks_annotations", "(", "project", ",", "queryset", ",", "**", "kwargs", ")", ":", "task_ids", "=", "queryset", ".", "values_list", "(", "'id'", ",", "flat", "=", "True", ")", "annotations", "=", "Annotation", ".", "objects", ".", "filter", ...
Delete all annotations by tasks ids
[ "Delete", "all", "annotations", "by", "tasks", "ids" ]
[ "\"\"\" Delete all annotations by tasks ids\n\n :param project: project instance\n :param queryset: filtered tasks db queryset\n \"\"\"", "# take only tasks where annotations were deleted" ]
[ { "param": "project", "type": null }, { "param": "queryset", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "project", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": null }, { "identifier": "queryset", "type": null, "docstring": "fil...
71bfc3d4f122b11cfee2935e76b86c946bf25f49
dhruvhs/label-studio
label_studio/projects/functions/next_task.py
[ "Apache-2.0" ]
Python
_try_ground_truth
<not_specific>
def _try_ground_truth(tasks, project, user): """Returns task from ground truth set""" ground_truth = Annotation.objects.filter(task=OuterRef('pk'), ground_truth=True) not_solved_tasks_with_ground_truths = tasks.annotate(has_ground_truths=Exists(ground_truth)).filter( has_ground_truths=True ) ...
Returns task from ground truth set
Returns task from ground truth set
[ "Returns", "task", "from", "ground", "truth", "set" ]
def _try_ground_truth(tasks, project, user): ground_truth = Annotation.objects.filter(task=OuterRef('pk'), ground_truth=True) not_solved_tasks_with_ground_truths = tasks.annotate(has_ground_truths=Exists(ground_truth)).filter( has_ground_truths=True ) if not_solved_tasks_with_ground_truths.exist...
[ "def", "_try_ground_truth", "(", "tasks", ",", "project", ",", "user", ")", ":", "ground_truth", "=", "Annotation", ".", "objects", ".", "filter", "(", "task", "=", "OuterRef", "(", "'pk'", ")", ",", "ground_truth", "=", "True", ")", "not_solved_tasks_with_g...
Returns task from ground truth set
[ "Returns", "task", "from", "ground", "truth", "set" ]
[ "\"\"\"Returns task from ground truth set\"\"\"" ]
[ { "param": "tasks", "type": null }, { "param": "project", "type": null }, { "param": "user", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "tasks", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "project", "type": null, "docstring": null, "docstring_tokens...
71bfc3d4f122b11cfee2935e76b86c946bf25f49
dhruvhs/label-studio
label_studio/projects/functions/next_task.py
[ "Apache-2.0" ]
Python
_try_tasks_with_overlap
<not_specific>
def _try_tasks_with_overlap(tasks): """Filter out tasks without overlap (doesn't return next task)""" tasks_with_overlap = tasks.filter(overlap__gt=1) if tasks_with_overlap.exists(): return None, tasks_with_overlap else: return None, tasks.filter(overlap=1)
Filter out tasks without overlap (doesn't return next task)
Filter out tasks without overlap (doesn't return next task)
[ "Filter", "out", "tasks", "without", "overlap", "(", "doesn", "'", "t", "return", "next", "task", ")" ]
def _try_tasks_with_overlap(tasks): tasks_with_overlap = tasks.filter(overlap__gt=1) if tasks_with_overlap.exists(): return None, tasks_with_overlap else: return None, tasks.filter(overlap=1)
[ "def", "_try_tasks_with_overlap", "(", "tasks", ")", ":", "tasks_with_overlap", "=", "tasks", ".", "filter", "(", "overlap__gt", "=", "1", ")", "if", "tasks_with_overlap", ".", "exists", "(", ")", ":", "return", "None", ",", "tasks_with_overlap", "else", ":", ...
Filter out tasks without overlap (doesn't return next task)
[ "Filter", "out", "tasks", "without", "overlap", "(", "doesn", "'", "t", "return", "next", "task", ")" ]
[ "\"\"\"Filter out tasks without overlap (doesn't return next task)\"\"\"" ]
[ { "param": "tasks", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "tasks", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71bfc3d4f122b11cfee2935e76b86c946bf25f49
dhruvhs/label-studio
label_studio/projects/functions/next_task.py
[ "Apache-2.0" ]
Python
_try_breadth_first
<not_specific>
def _try_breadth_first(tasks, user): """Try to find tasks with maximum amount of annotations, since we are trying to label tasks as fast as possible """ tasks = tasks.annotate(annotations_count=Count('annotations')) max_annotations_count = tasks.aggregate(Max('annotations_count'))['annotations_count__m...
Try to find tasks with maximum amount of annotations, since we are trying to label tasks as fast as possible
Try to find tasks with maximum amount of annotations, since we are trying to label tasks as fast as possible
[ "Try", "to", "find", "tasks", "with", "maximum", "amount", "of", "annotations", "since", "we", "are", "trying", "to", "label", "tasks", "as", "fast", "as", "possible" ]
def _try_breadth_first(tasks, user): tasks = tasks.annotate(annotations_count=Count('annotations')) max_annotations_count = tasks.aggregate(Max('annotations_count'))['annotations_count__max'] if max_annotations_count == 0: return not_solved_tasks_labeling_started = tasks.annotate( reach_...
[ "def", "_try_breadth_first", "(", "tasks", ",", "user", ")", ":", "tasks", "=", "tasks", ".", "annotate", "(", "annotations_count", "=", "Count", "(", "'annotations'", ")", ")", "max_annotations_count", "=", "tasks", ".", "aggregate", "(", "Max", "(", "'anno...
Try to find tasks with maximum amount of annotations, since we are trying to label tasks as fast as possible
[ "Try", "to", "find", "tasks", "with", "maximum", "amount", "of", "annotations", "since", "we", "are", "trying", "to", "label", "tasks", "as", "fast", "as", "possible" ]
[ "\"\"\"Try to find tasks with maximum amount of annotations, since we are trying to label tasks as fast as possible\n \"\"\"", "# there is no any labeled tasks found", "# find any task with maximal amount of created annotations", "# try to complete tasks that are already in progress" ]
[ { "param": "tasks", "type": null }, { "param": "user", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "tasks", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "user", "type": null, "docstring": null, "docstring_tokens": ...
7fd888908d29e10a36c8bf432d52dfdb05aa98be
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/renderer/rst/doxygen/compound.py
[ "Unlicense" ]
Python
create_doxygen_target
<not_specific>
def create_doxygen_target(self): """Can be overridden to create a target node which uses the doxygen refid information which can be used for creating links between internal doxygen elements. The default implementation should suffice most of the time. """ refid = "%s%s" % (self....
Can be overridden to create a target node which uses the doxygen refid information which can be used for creating links between internal doxygen elements. The default implementation should suffice most of the time.
Can be overridden to create a target node which uses the doxygen refid information which can be used for creating links between internal doxygen elements. The default implementation should suffice most of the time.
[ "Can", "be", "overridden", "to", "create", "a", "target", "node", "which", "uses", "the", "doxygen", "refid", "information", "which", "can", "be", "used", "for", "creating", "links", "between", "internal", "doxygen", "elements", ".", "The", "default", "impleme...
def create_doxygen_target(self): refid = "%s%s" % (self.project_info.name(), self.data_object.id) return self.target_handler.create_target(refid)
[ "def", "create_doxygen_target", "(", "self", ")", ":", "refid", "=", "\"%s%s\"", "%", "(", "self", ".", "project_info", ".", "name", "(", ")", ",", "self", ".", "data_object", ".", "id", ")", "return", "self", ".", "target_handler", ".", "create_target", ...
Can be overridden to create a target node which uses the doxygen refid information which can be used for creating links between internal doxygen elements.
[ "Can", "be", "overridden", "to", "create", "a", "target", "node", "which", "uses", "the", "doxygen", "refid", "information", "which", "can", "be", "used", "for", "creating", "links", "between", "internal", "doxygen", "elements", "." ]
[ "\"\"\"Can be overridden to create a target node which uses the doxygen refid information\n which can be used for creating links between internal doxygen elements.\n\n The default implementation should suffice most of the time.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7fd888908d29e10a36c8bf432d52dfdb05aa98be
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/renderer/rst/doxygen/compound.py
[ "Unlicense" ]
Python
build_signodes
<not_specific>
def build_signodes(self, targets): """Returns a list to account for when we need multiple signature nodes to account for multi-line declarations like templated declarations""" # Build title nodes signode = self.node_factory.desc_signature() signode.extend(targets) signod...
Returns a list to account for when we need multiple signature nodes to account for multi-line declarations like templated declarations
Returns a list to account for when we need multiple signature nodes to account for multi-line declarations like templated declarations
[ "Returns", "a", "list", "to", "account", "for", "when", "we", "need", "multiple", "signature", "nodes", "to", "account", "for", "multi", "-", "line", "declarations", "like", "templated", "declarations" ]
def build_signodes(self, targets): signode = self.node_factory.desc_signature() signode.extend(targets) signode.extend(self.title()) return [signode]
[ "def", "build_signodes", "(", "self", ",", "targets", ")", ":", "signode", "=", "self", ".", "node_factory", ".", "desc_signature", "(", ")", "signode", ".", "extend", "(", "targets", ")", "signode", ".", "extend", "(", "self", ".", "title", "(", ")", ...
Returns a list to account for when we need multiple signature nodes to account for multi-line declarations like templated declarations
[ "Returns", "a", "list", "to", "account", "for", "when", "we", "need", "multiple", "signature", "nodes", "to", "account", "for", "multi", "-", "line", "declarations", "like", "templated", "declarations" ]
[ "\"\"\"Returns a list to account for when we need multiple signature nodes to account for\n multi-line declarations like templated declarations\"\"\"", "# Build title nodes" ]
[ { "param": "self", "type": null }, { "param": "targets", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "targets", "type": null, "docstring": null, "docstring_tokens"...
7fd888908d29e10a36c8bf432d52dfdb05aa98be
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/renderer/rst/doxygen/compound.py
[ "Unlicense" ]
Python
render
<not_specific>
def render(self): """ Render all the children depth-first. """ nodelist = [] for item in self.data_object.listitem: context = self.context.create_child_context(item) renderer = self.renderer_factory.create_renderer(context) nodelist.extend(renderer.render()) ...
Render all the children depth-first.
Render all the children depth-first.
[ "Render", "all", "the", "children", "depth", "-", "first", "." ]
def render(self): nodelist = [] for item in self.data_object.listitem: context = self.context.create_child_context(item) renderer = self.renderer_factory.create_renderer(context) nodelist.extend(renderer.render()) return nodelist
[ "def", "render", "(", "self", ")", ":", "nodelist", "=", "[", "]", "for", "item", "in", "self", ".", "data_object", ".", "listitem", ":", "context", "=", "self", ".", "context", ".", "create_child_context", "(", "item", ")", "renderer", "=", "self", "....
Render all the children depth-first.
[ "Render", "all", "the", "children", "depth", "-", "first", "." ]
[ "\"\"\" Render all the children depth-first. \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7fd888908d29e10a36c8bf432d52dfdb05aa98be
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/renderer/rst/doxygen/compound.py
[ "Unlicense" ]
Python
render
<not_specific>
def render(self): """ Render all the children depth-first. Upon return expand the children node list into a docutils list-item. """ nodelist = [] for item in self.data_object.para: context = self.context.create_child_context(item) renderer = self.rende...
Render all the children depth-first. Upon return expand the children node list into a docutils list-item.
Render all the children depth-first. Upon return expand the children node list into a docutils list-item.
[ "Render", "all", "the", "children", "depth", "-", "first", ".", "Upon", "return", "expand", "the", "children", "node", "list", "into", "a", "docutils", "list", "-", "item", "." ]
def render(self): nodelist = [] for item in self.data_object.para: context = self.context.create_child_context(item) renderer = self.renderer_factory.create_renderer(context) nodelist.extend(renderer.render()) return [self.node_factory.list_item("", *nodelist)...
[ "def", "render", "(", "self", ")", ":", "nodelist", "=", "[", "]", "for", "item", "in", "self", ".", "data_object", ".", "para", ":", "context", "=", "self", ".", "context", ".", "create_child_context", "(", "item", ")", "renderer", "=", "self", ".", ...
Render all the children depth-first.
[ "Render", "all", "the", "children", "depth", "-", "first", "." ]
[ "\"\"\" Render all the children depth-first.\n Upon return expand the children node list into a docutils list-item.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f225e5926e4b4c28d2c6b1336e2f1d6289803bde
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/finder/doxygen/compound.py
[ "Unlicense" ]
Python
find
<not_specific>
def find(self, matcher_stack): """Search with MatcherStack functionality - deprecated in favour of the filter approach""" compound_finder = self.item_finder_factory.create_finder(self.data_object.compounddef) return compound_finder.find(matcher_stack)
Search with MatcherStack functionality - deprecated in favour of the filter approach
Search with MatcherStack functionality - deprecated in favour of the filter approach
[ "Search", "with", "MatcherStack", "functionality", "-", "deprecated", "in", "favour", "of", "the", "filter", "approach" ]
def find(self, matcher_stack): compound_finder = self.item_finder_factory.create_finder(self.data_object.compounddef) return compound_finder.find(matcher_stack)
[ "def", "find", "(", "self", ",", "matcher_stack", ")", ":", "compound_finder", "=", "self", ".", "item_finder_factory", ".", "create_finder", "(", "self", ".", "data_object", ".", "compounddef", ")", "return", "compound_finder", ".", "find", "(", "matcher_stack"...
Search with MatcherStack functionality - deprecated in favour of the filter approach
[ "Search", "with", "MatcherStack", "functionality", "-", "deprecated", "in", "favour", "of", "the", "filter", "approach" ]
[ "\"\"\"Search with MatcherStack functionality - deprecated in favour of the filter approach\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "matcher_stack", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "matcher_stack", "type": null, "docstring": null, "docstring_t...
f225e5926e4b4c28d2c6b1336e2f1d6289803bde
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/finder/doxygen/compound.py
[ "Unlicense" ]
Python
filter_
null
def filter_(self, ancestors, filter_, matches): """Find nodes which match the filter. Doesn't test this node, only its children""" node_stack = stack(self.data_object, ancestors) compound_finder = self.item_finder_factory.create_finder(self.data_object.compounddef) compound_finder.filt...
Find nodes which match the filter. Doesn't test this node, only its children
Find nodes which match the filter. Doesn't test this node, only its children
[ "Find", "nodes", "which", "match", "the", "filter", ".", "Doesn", "'", "t", "test", "this", "node", "only", "its", "children" ]
def filter_(self, ancestors, filter_, matches): node_stack = stack(self.data_object, ancestors) compound_finder = self.item_finder_factory.create_finder(self.data_object.compounddef) compound_finder.filter_(node_stack, filter_, matches)
[ "def", "filter_", "(", "self", ",", "ancestors", ",", "filter_", ",", "matches", ")", ":", "node_stack", "=", "stack", "(", "self", ".", "data_object", ",", "ancestors", ")", "compound_finder", "=", "self", ".", "item_finder_factory", ".", "create_finder", "...
Find nodes which match the filter.
[ "Find", "nodes", "which", "match", "the", "filter", "." ]
[ "\"\"\"Find nodes which match the filter. Doesn't test this node, only its children\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ancestors", "type": null }, { "param": "filter_", "type": null }, { "param": "matches", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ancestors", "type": null, "docstring": null, "docstring_token...
f225e5926e4b4c28d2c6b1336e2f1d6289803bde
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/finder/doxygen/compound.py
[ "Unlicense" ]
Python
find
<not_specific>
def find(self, matcher_stack): """Search with MatcherStack functionality - deprecated in favour of the filter approach""" results = [] for sectiondef in self.data_object.sectiondef: finder = self.item_finder_factory.create_finder(sectiondef) results.extend(finder.find(ma...
Search with MatcherStack functionality - deprecated in favour of the filter approach
Search with MatcherStack functionality - deprecated in favour of the filter approach
[ "Search", "with", "MatcherStack", "functionality", "-", "deprecated", "in", "favour", "of", "the", "filter", "approach" ]
def find(self, matcher_stack): results = [] for sectiondef in self.data_object.sectiondef: finder = self.item_finder_factory.create_finder(sectiondef) results.extend(finder.find(matcher_stack)) return results
[ "def", "find", "(", "self", ",", "matcher_stack", ")", ":", "results", "=", "[", "]", "for", "sectiondef", "in", "self", ".", "data_object", ".", "sectiondef", ":", "finder", "=", "self", ".", "item_finder_factory", ".", "create_finder", "(", "sectiondef", ...
Search with MatcherStack functionality - deprecated in favour of the filter approach
[ "Search", "with", "MatcherStack", "functionality", "-", "deprecated", "in", "favour", "of", "the", "filter", "approach" ]
[ "\"\"\"Search with MatcherStack functionality - deprecated in favour of the filter approach\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "matcher_stack", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "matcher_stack", "type": null, "docstring": null, "docstring_t...
f225e5926e4b4c28d2c6b1336e2f1d6289803bde
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/finder/doxygen/compound.py
[ "Unlicense" ]
Python
filter_
null
def filter_(self, ancestors, filter_, matches): """Finds nodes which match the filter and continues checks to children""" node_stack = stack(self.data_object, ancestors) if filter_.allow(node_stack): matches.append(self.data_object) for sectiondef in self.data_object.secti...
Finds nodes which match the filter and continues checks to children
Finds nodes which match the filter and continues checks to children
[ "Finds", "nodes", "which", "match", "the", "filter", "and", "continues", "checks", "to", "children" ]
def filter_(self, ancestors, filter_, matches): node_stack = stack(self.data_object, ancestors) if filter_.allow(node_stack): matches.append(self.data_object) for sectiondef in self.data_object.sectiondef: finder = self.item_finder_factory.create_finder(sectiondef) ...
[ "def", "filter_", "(", "self", ",", "ancestors", ",", "filter_", ",", "matches", ")", ":", "node_stack", "=", "stack", "(", "self", ".", "data_object", ",", "ancestors", ")", "if", "filter_", ".", "allow", "(", "node_stack", ")", ":", "matches", ".", "...
Finds nodes which match the filter and continues checks to children
[ "Finds", "nodes", "which", "match", "the", "filter", "and", "continues", "checks", "to", "children" ]
[ "\"\"\"Finds nodes which match the filter and continues checks to children\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ancestors", "type": null }, { "param": "filter_", "type": null }, { "param": "matches", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ancestors", "type": null, "docstring": null, "docstring_token...
f225e5926e4b4c28d2c6b1336e2f1d6289803bde
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/finder/doxygen/compound.py
[ "Unlicense" ]
Python
find
<not_specific>
def find(self, matcher_stack): """Search with MatcherStack functionality - deprecated in favour of the filter approach""" results = [] for memberdef in self.data_object.memberdef: finder = self.item_finder_factory.create_finder(memberdef) results.extend(finder.find(match...
Search with MatcherStack functionality - deprecated in favour of the filter approach
Search with MatcherStack functionality - deprecated in favour of the filter approach
[ "Search", "with", "MatcherStack", "functionality", "-", "deprecated", "in", "favour", "of", "the", "filter", "approach" ]
def find(self, matcher_stack): results = [] for memberdef in self.data_object.memberdef: finder = self.item_finder_factory.create_finder(memberdef) results.extend(finder.find(matcher_stack)) return results
[ "def", "find", "(", "self", ",", "matcher_stack", ")", ":", "results", "=", "[", "]", "for", "memberdef", "in", "self", ".", "data_object", ".", "memberdef", ":", "finder", "=", "self", ".", "item_finder_factory", ".", "create_finder", "(", "memberdef", ")...
Search with MatcherStack functionality - deprecated in favour of the filter approach
[ "Search", "with", "MatcherStack", "functionality", "-", "deprecated", "in", "favour", "of", "the", "filter", "approach" ]
[ "\"\"\"Search with MatcherStack functionality - deprecated in favour of the filter approach\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "matcher_stack", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "matcher_stack", "type": null, "docstring": null, "docstring_t...
f225e5926e4b4c28d2c6b1336e2f1d6289803bde
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/finder/doxygen/compound.py
[ "Unlicense" ]
Python
filter_
null
def filter_(self, ancestors, filter_, matches): """Find nodes which match the filter. Doesn't test this node, only its children""" node_stack = stack(self.data_object, ancestors) if filter_.allow(node_stack): matches.append(self.data_object) for memberdef in self.data_obje...
Find nodes which match the filter. Doesn't test this node, only its children
Find nodes which match the filter. Doesn't test this node, only its children
[ "Find", "nodes", "which", "match", "the", "filter", ".", "Doesn", "'", "t", "test", "this", "node", "only", "its", "children" ]
def filter_(self, ancestors, filter_, matches): node_stack = stack(self.data_object, ancestors) if filter_.allow(node_stack): matches.append(self.data_object) for memberdef in self.data_object.memberdef: finder = self.item_finder_factory.create_finder(memberdef) ...
[ "def", "filter_", "(", "self", ",", "ancestors", ",", "filter_", ",", "matches", ")", ":", "node_stack", "=", "stack", "(", "self", ".", "data_object", ",", "ancestors", ")", "if", "filter_", ".", "allow", "(", "node_stack", ")", ":", "matches", ".", "...
Find nodes which match the filter.
[ "Find", "nodes", "which", "match", "the", "filter", "." ]
[ "\"\"\"Find nodes which match the filter. Doesn't test this node, only its children\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ancestors", "type": null }, { "param": "filter_", "type": null }, { "param": "matches", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ancestors", "type": null, "docstring": null, "docstring_token...
f225e5926e4b4c28d2c6b1336e2f1d6289803bde
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/finder/doxygen/compound.py
[ "Unlicense" ]
Python
find
<not_specific>
def find(self, matcher_stack): """Search with MatcherStack functionality - deprecated in favour of the filter approach""" if matcher_stack.match("member", self.data_object): return [self.data_object] else: return []
Search with MatcherStack functionality - deprecated in favour of the filter approach
Search with MatcherStack functionality - deprecated in favour of the filter approach
[ "Search", "with", "MatcherStack", "functionality", "-", "deprecated", "in", "favour", "of", "the", "filter", "approach" ]
def find(self, matcher_stack): if matcher_stack.match("member", self.data_object): return [self.data_object] else: return []
[ "def", "find", "(", "self", ",", "matcher_stack", ")", ":", "if", "matcher_stack", ".", "match", "(", "\"member\"", ",", "self", ".", "data_object", ")", ":", "return", "[", "self", ".", "data_object", "]", "else", ":", "return", "[", "]" ]
Search with MatcherStack functionality - deprecated in favour of the filter approach
[ "Search", "with", "MatcherStack", "functionality", "-", "deprecated", "in", "favour", "of", "the", "filter", "approach" ]
[ "\"\"\"Search with MatcherStack functionality - deprecated in favour of the filter approach\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "matcher_stack", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "matcher_stack", "type": null, "docstring": null, "docstring_t...
cd1d63e12d5bb726e84af068ba9942c134b568dc
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/directive/file.py
[ "Unlicense" ]
Python
run
<not_specific>
def run(self): """Get the file from the argument and the project info from the factory.""" file_ = self.arguments[0] try: project_info = self.project_info_factory.create_project_info(self.options) except ProjectError as e: warning = create_warning(None, self.sta...
Get the file from the argument and the project info from the factory.
Get the file from the argument and the project info from the factory.
[ "Get", "the", "file", "from", "the", "argument", "and", "the", "project", "info", "from", "the", "factory", "." ]
def run(self): file_ = self.arguments[0] try: project_info = self.project_info_factory.create_project_info(self.options) except ProjectError as e: warning = create_warning(None, self.state, self.lineno) return warning.warn('doxygenfile: %s' % e) return...
[ "def", "run", "(", "self", ")", ":", "file_", "=", "self", ".", "arguments", "[", "0", "]", "try", ":", "project_info", "=", "self", ".", "project_info_factory", ".", "create_project_info", "(", "self", ".", "options", ")", "except", "ProjectError", "as", ...
Get the file from the argument and the project info from the factory.
[ "Get", "the", "file", "from", "the", "argument", "and", "the", "project", "info", "from", "the", "factory", "." ]
[ "\"\"\"Get the file from the argument and the project info from the factory.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd1d63e12d5bb726e84af068ba9942c134b568dc
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/directive/file.py
[ "Unlicense" ]
Python
run
<not_specific>
def run(self): """Get the file from the argument and extract the associated project info for the named project given that it is an auto-project. """ file_ = self.arguments[0] try: project_info = self.project_info_factory.retrieve_project_info_for_auto(self.options) ...
Get the file from the argument and extract the associated project info for the named project given that it is an auto-project.
Get the file from the argument and extract the associated project info for the named project given that it is an auto-project.
[ "Get", "the", "file", "from", "the", "argument", "and", "extract", "the", "associated", "project", "info", "for", "the", "named", "project", "given", "that", "it", "is", "an", "auto", "-", "project", "." ]
def run(self): file_ = self.arguments[0] try: project_info = self.project_info_factory.retrieve_project_info_for_auto(self.options) except ProjectError as e: warning = create_warning(None, self.state, self.lineno) return warning.warn('autodoxygenfile: %s' % e)...
[ "def", "run", "(", "self", ")", ":", "file_", "=", "self", ".", "arguments", "[", "0", "]", "try", ":", "project_info", "=", "self", ".", "project_info_factory", ".", "retrieve_project_info_for_auto", "(", "self", ".", "options", ")", "except", "ProjectError...
Get the file from the argument and extract the associated project info for the named project given that it is an auto-project.
[ "Get", "the", "file", "from", "the", "argument", "and", "extract", "the", "associated", "project", "info", "for", "the", "named", "project", "given", "that", "it", "is", "an", "auto", "-", "project", "." ]
[ "\"\"\"Get the file from the argument and extract the associated project info for the named\n project given that it is an auto-project.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4b0941aa80995715bffd3c2723aa6261559f9098
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/finder/core.py
[ "Unlicense" ]
Python
filter_
null
def filter_(self, filter_, matches): """Adds all nodes which match the filter into the matches list""" item_finder = self.item_finder_factory.create_finder(self._root) item_finder.filter_([FakeParentNode()], filter_, matches)
Adds all nodes which match the filter into the matches list
Adds all nodes which match the filter into the matches list
[ "Adds", "all", "nodes", "which", "match", "the", "filter", "into", "the", "matches", "list" ]
def filter_(self, filter_, matches): item_finder = self.item_finder_factory.create_finder(self._root) item_finder.filter_([FakeParentNode()], filter_, matches)
[ "def", "filter_", "(", "self", ",", "filter_", ",", "matches", ")", ":", "item_finder", "=", "self", ".", "item_finder_factory", ".", "create_finder", "(", "self", ".", "_root", ")", "item_finder", ".", "filter_", "(", "[", "FakeParentNode", "(", ")", "]",...
Adds all nodes which match the filter into the matches list
[ "Adds", "all", "nodes", "which", "match", "the", "filter", "into", "the", "matches", "list" ]
[ "\"\"\"Adds all nodes which match the filter into the matches list\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "filter_", "type": null }, { "param": "matches", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filter_", "type": null, "docstring": null, "docstring_tokens"...
5e2f10eeaa702e3a08cdd2cff8c965286e062e61
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/directives.py
[ "Unlicense" ]
Python
resolve_path
<not_specific>
def resolve_path(self, directory, filename): """Returns a full path to the filename in the given directory assuming that if the directory path is relative, then it is relative to the conf.py directory. """ # os.path.join does the appropriate handling if _project_path is an absolute path...
Returns a full path to the filename in the given directory assuming that if the directory path is relative, then it is relative to the conf.py directory.
Returns a full path to the filename in the given directory assuming that if the directory path is relative, then it is relative to the conf.py directory.
[ "Returns", "a", "full", "path", "to", "the", "filename", "in", "the", "given", "directory", "assuming", "that", "if", "the", "directory", "path", "is", "relative", "then", "it", "is", "relative", "to", "the", "conf", ".", "py", "directory", "." ]
def resolve_path(self, directory, filename): return self.join(self.config_directory, directory, filename)
[ "def", "resolve_path", "(", "self", ",", "directory", ",", "filename", ")", ":", "return", "self", ".", "join", "(", "self", ".", "config_directory", ",", "directory", ",", "filename", ")" ]
Returns a full path to the filename in the given directory assuming that if the directory path is relative, then it is relative to the conf.py directory.
[ "Returns", "a", "full", "path", "to", "the", "filename", "in", "the", "given", "directory", "assuming", "that", "if", "the", "directory", "path", "is", "relative", "then", "it", "is", "relative", "to", "the", "conf", ".", "py", "directory", "." ]
[ "\"\"\"Returns a full path to the filename in the given directory assuming that if the directory\n path is relative, then it is relative to the conf.py directory.\n \"\"\"", "# os.path.join does the appropriate handling if _project_path is an absolute path" ]
[ { "param": "self", "type": null }, { "param": "directory", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "directory", "type": null, "docstring": null, "docstring_token...
ca6e2ecf7186893ad0c62494c6d86e50a99efdb3
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/renderer/rst/doxygen/domain.py
[ "Unlicense" ]
Python
_create_target
<not_specific>
def _create_target(self, name, type_, id_): """Creates a target node and registers it with the appropriate domain object list in a style which matches Sphinx's behaviour for the domain directives like cpp:function""" # Check if we've already got this id in_cache, project = self....
Creates a target node and registers it with the appropriate domain object list in a style which matches Sphinx's behaviour for the domain directives like cpp:function
Creates a target node and registers it with the appropriate domain object list in a style which matches Sphinx's behaviour for the domain directives like cpp:function
[ "Creates", "a", "target", "node", "and", "registers", "it", "with", "the", "appropriate", "domain", "object", "list", "in", "a", "style", "which", "matches", "Sphinx", "'", "s", "behaviour", "for", "the", "domain", "directives", "like", "cpp", ":", "function...
def _create_target(self, name, type_, id_): in_cache, project = self.helper.check_cache(id_) if in_cache: print("Warning: Ignoring duplicate domain reference '%s'. " "First found in project '%s'" % (id_, project.reference())) return [] self.helper.cache(...
[ "def", "_create_target", "(", "self", ",", "name", ",", "type_", ",", "id_", ")", ":", "in_cache", ",", "project", "=", "self", ".", "helper", ".", "check_cache", "(", "id_", ")", "if", "in_cache", ":", "print", "(", "\"Warning: Ignoring duplicate domain ref...
Creates a target node and registers it with the appropriate domain object list in a style which matches Sphinx's behaviour for the domain directives like cpp:function
[ "Creates", "a", "target", "node", "and", "registers", "it", "with", "the", "appropriate", "domain", "object", "list", "in", "a", "style", "which", "matches", "Sphinx", "'", "s", "behaviour", "for", "the", "domain", "directives", "like", "cpp", ":", "function...
[ "\"\"\"Creates a target node and registers it with the appropriate domain\n object list in a style which matches Sphinx's behaviour for the domain\n directives like cpp:function\"\"\"", "# Check if we've already got this id", "# Create target node. This is required for LaTeX output as target nodes...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "type_", "type": null }, { "param": "id_", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
661c70ac6c1eb4ed58c016f8d38fc4b4f6451712
sfogerty/CLAMR
powerstats/docs/breathe-3.2.0/breathe/directive/base.py
[ "Unlicense" ]
Python
render
<not_specific>
def render(self, data_object, project_info, options, filter_, target_handler, mask_factory): "Standard render process used by subclasses" renderer_factory_creator = self.renderer_factory_creator_constructor.create_factory_creator( project_info, self.state.document, o...
Standard render process used by subclasses
Standard render process used by subclasses
[ "Standard", "render", "process", "used", "by", "subclasses" ]
def render(self, data_object, project_info, options, filter_, target_handler, mask_factory): renderer_factory_creator = self.renderer_factory_creator_constructor.create_factory_creator( project_info, self.state.document, options, target_handler ) ...
[ "def", "render", "(", "self", ",", "data_object", ",", "project_info", ",", "options", ",", "filter_", ",", "target_handler", ",", "mask_factory", ")", ":", "renderer_factory_creator", "=", "self", ".", "renderer_factory_creator_constructor", ".", "create_factory_crea...
Standard render process used by subclasses
[ "Standard", "render", "process", "used", "by", "subclasses" ]
[ "\"Standard render process used by subclasses\"" ]
[ { "param": "self", "type": null }, { "param": "data_object", "type": null }, { "param": "project_info", "type": null }, { "param": "options", "type": null }, { "param": "filter_", "type": null }, { "param": "target_handler", "type": null }, { ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_object", "type": null, "docstring": null, "docstring_tok...
431e16a3d8a91b5dd8cbab8df4debf8d27968329
Peiiii/vtgui
vtgui/utils.py
[ "MIT" ]
Python
_async_raise
null
def _async_raise(tid, exctype): '''Raises an exception in the threads with id tid''' if not inspect.isclass(exctype): raise TypeError("Only types can be raised (not instances)") res = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), ...
Raises an exception in the threads with id tid
Raises an exception in the threads with id tid
[ "Raises", "an", "exception", "in", "the", "threads", "with", "id", "tid" ]
def _async_raise(tid, exctype): if not inspect.isclass(exctype): raise TypeError("Only types can be raised (not instances)") res = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), ctypes.py_object(exctype)) print('res:',res) if r...
[ "def", "_async_raise", "(", "tid", ",", "exctype", ")", ":", "if", "not", "inspect", ".", "isclass", "(", "exctype", ")", ":", "raise", "TypeError", "(", "\"Only types can be raised (not instances)\"", ")", "res", "=", "ctypes", ".", "pythonapi", ".", "PyThrea...
Raises an exception in the threads with id tid
[ "Raises", "an", "exception", "in", "the", "threads", "with", "id", "tid" ]
[ "'''Raises an exception in the threads with id tid'''", "# \"if it returns a number greater than one, you're in trouble,", "# and you should call it again with exc=NULL to revert the effect\"" ]
[ { "param": "tid", "type": null }, { "param": "exctype", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "tid", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exctype", "type": null, "docstring": null, "docstring_tokens":...
b10a0076e0c72804efcb271a838b713f2af9fed1
openstack/charm-ceph-radosgw
hooks/hooks.py
[ "ECL-2.0", "Apache-2.0" ]
Python
install_packages
<not_specific>
def install_packages(): """Installs necessary packages for the ceph-radosgw service. Calling this method when the source config value has changed will cause an upgrade of ceph packages to be performed. :returns: whether packages were installed or not :rtype: boolean """ pkgs_installed = Fa...
Installs necessary packages for the ceph-radosgw service. Calling this method when the source config value has changed will cause an upgrade of ceph packages to be performed. :returns: whether packages were installed or not :rtype: boolean
Installs necessary packages for the ceph-radosgw service. Calling this method when the source config value has changed will cause an upgrade of ceph packages to be performed.
[ "Installs", "necessary", "packages", "for", "the", "ceph", "-", "radosgw", "service", ".", "Calling", "this", "method", "when", "the", "source", "config", "value", "has", "changed", "will", "cause", "an", "upgrade", "of", "ceph", "packages", "to", "be", "per...
def install_packages(): pkgs_installed = False c = config() if c.changed('source') or c.changed('key'): add_source(c.get('source'), c.get('key')) apt_update(fatal=True) pkgs = ( PACKAGES if upgrade_available() else filter_installed_packages(PACKAGES) ) if pkgs: ...
[ "def", "install_packages", "(", ")", ":", "pkgs_installed", "=", "False", "c", "=", "config", "(", ")", "if", "c", ".", "changed", "(", "'source'", ")", "or", "c", ".", "changed", "(", "'key'", ")", ":", "add_source", "(", "c", ".", "get", "(", "'s...
Installs necessary packages for the ceph-radosgw service.
[ "Installs", "necessary", "packages", "for", "the", "ceph", "-", "radosgw", "service", "." ]
[ "\"\"\"Installs necessary packages for the ceph-radosgw service.\n\n Calling this method when the source config value has changed\n will cause an upgrade of ceph packages to be performed.\n\n :returns: whether packages were installed or not\n :rtype: boolean\n \"\"\"", "# NOTE: just use full packag...
[]
{ "returns": [ { "docstring": "whether packages were installed or not", "docstring_tokens": [ "whether", "packages", "were", "installed", "or", "not" ], "type": "boolean" } ], "raises": [], "params": [], "outlier_params": [], "o...
b10a0076e0c72804efcb271a838b713f2af9fed1
openstack/charm-ceph-radosgw
hooks/hooks.py
[ "ECL-2.0", "Apache-2.0" ]
Python
update_nrpe_config
null
def update_nrpe_config(checks_to_remove=None): """ Update the checks for the nagios plugin. :param checks_to_remove: list of short names of nrpe checks to remove. For example, pass ['radosgw'] to remove the check for the default systemd radosgw service, to make way for per host serv...
Update the checks for the nagios plugin. :param checks_to_remove: list of short names of nrpe checks to remove. For example, pass ['radosgw'] to remove the check for the default systemd radosgw service, to make way for per host services. :type checks_to_remove: list
Update the checks for the nagios plugin.
[ "Update", "the", "checks", "for", "the", "nagios", "plugin", "." ]
def update_nrpe_config(checks_to_remove=None): apt_install('python-dbus') hostname = nrpe.get_nagios_hostname() current_unit = nrpe.get_nagios_unit_name() nrpe_setup = nrpe.NRPE(hostname=hostname) nrpe.copy_nrpe_checks() if checks_to_remove is not None: log("Removing the following nrpe c...
[ "def", "update_nrpe_config", "(", "checks_to_remove", "=", "None", ")", ":", "apt_install", "(", "'python-dbus'", ")", "hostname", "=", "nrpe", ".", "get_nagios_hostname", "(", ")", "current_unit", "=", "nrpe", ".", "get_nagios_unit_name", "(", ")", "nrpe_setup", ...
Update the checks for the nagios plugin.
[ "Update", "the", "checks", "for", "the", "nagios", "plugin", "." ]
[ "\"\"\"\n Update the checks for the nagios plugin.\n\n :param checks_to_remove: list of short names of nrpe checks to\n remove. For example, pass ['radosgw'] to remove the check for\n the default systemd radosgw service, to make way for per host\n services.\n :type checks_to_remove: li...
[ { "param": "checks_to_remove", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "checks_to_remove", "type": null, "docstring": "list of short names of nrpe checks to\nremove. For example, pass ['radosgw'] to remove the check for\nthe default systemd radosgw service, to make way for per host\nservices.", "d...
b10a0076e0c72804efcb271a838b713f2af9fed1
openstack/charm-ceph-radosgw
hooks/hooks.py
[ "ECL-2.0", "Apache-2.0" ]
Python
configure_https
null
def configure_https(): '''Enables SSL API Apache config if appropriate and kicks identity-service and image-service with any required updates ''' CONFIGS.write_all() if 'https' in CONFIGS.complete_contexts(): cmd = ['a2ensite', 'openstack_https_frontend'] subprocess.check_call(cm...
Enables SSL API Apache config if appropriate and kicks identity-service and image-service with any required updates
Enables SSL API Apache config if appropriate and kicks identity-service and image-service with any required updates
[ "Enables", "SSL", "API", "Apache", "config", "if", "appropriate", "and", "kicks", "identity", "-", "service", "and", "image", "-", "service", "with", "any", "required", "updates" ]
def configure_https(): CONFIGS.write_all() if 'https' in CONFIGS.complete_contexts(): cmd = ['a2ensite', 'openstack_https_frontend'] subprocess.check_call(cmd) else: cmd = ['a2dissite', 'openstack_https_frontend'] try: subprocess.check_call(cmd) except sub...
[ "def", "configure_https", "(", ")", ":", "CONFIGS", ".", "write_all", "(", ")", "if", "'https'", "in", "CONFIGS", ".", "complete_contexts", "(", ")", ":", "cmd", "=", "[", "'a2ensite'", ",", "'openstack_https_frontend'", "]", "subprocess", ".", "check_call", ...
Enables SSL API Apache config if appropriate and kicks identity-service and image-service with any required updates
[ "Enables", "SSL", "API", "Apache", "config", "if", "appropriate", "and", "kicks", "identity", "-", "service", "and", "image", "-", "service", "with", "any", "required", "updates" ]
[ "'''Enables SSL API Apache config if appropriate and kicks\n identity-service and image-service with any required\n updates\n '''", "# The site is not yet enabled or", "# https is not configured", "# TODO: improve this by checking if local CN certs are available", "# first then checking reload stat...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b10a0076e0c72804efcb271a838b713f2af9fed1
openstack/charm-ceph-radosgw
hooks/hooks.py
[ "ECL-2.0", "Apache-2.0" ]
Python
process_multisite_relations
null
def process_multisite_relations(): """Re-trigger any pending master/slave relations""" for r_id in relation_ids('master'): master_relation_joined(r_id) for r_id in relation_ids('slave'): for unit in related_units(r_id): slave_relation_changed(r_id, unit)
Re-trigger any pending master/slave relations
Re-trigger any pending master/slave relations
[ "Re", "-", "trigger", "any", "pending", "master", "/", "slave", "relations" ]
def process_multisite_relations(): for r_id in relation_ids('master'): master_relation_joined(r_id) for r_id in relation_ids('slave'): for unit in related_units(r_id): slave_relation_changed(r_id, unit)
[ "def", "process_multisite_relations", "(", ")", ":", "for", "r_id", "in", "relation_ids", "(", "'master'", ")", ":", "master_relation_joined", "(", "r_id", ")", "for", "r_id", "in", "relation_ids", "(", "'slave'", ")", ":", "for", "unit", "in", "related_units"...
Re-trigger any pending master/slave relations
[ "Re", "-", "trigger", "any", "pending", "master", "/", "slave", "relations" ]
[ "\"\"\"Re-trigger any pending master/slave relations\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
df2638a38055d5328e2634224644a673af4ced77
openstack/charm-ceph-radosgw
hooks/multisite.py
[ "ECL-2.0", "Apache-2.0" ]
Python
_key_name
<not_specific>
def _key_name(): """Determine the name of the cephx key for the local unit""" if utils.request_per_unit_key(): return 'rgw.{}'.format(socket.gethostname()) else: return 'radosgw.gateway'
Determine the name of the cephx key for the local unit
Determine the name of the cephx key for the local unit
[ "Determine", "the", "name", "of", "the", "cephx", "key", "for", "the", "local", "unit" ]
def _key_name(): if utils.request_per_unit_key(): return 'rgw.{}'.format(socket.gethostname()) else: return 'radosgw.gateway'
[ "def", "_key_name", "(", ")", ":", "if", "utils", ".", "request_per_unit_key", "(", ")", ":", "return", "'rgw.{}'", ".", "format", "(", "socket", ".", "gethostname", "(", ")", ")", "else", ":", "return", "'radosgw.gateway'" ]
Determine the name of the cephx key for the local unit
[ "Determine", "the", "name", "of", "the", "cephx", "key", "for", "the", "local", "unit" ]
[ "\"\"\"Determine the name of the cephx key for the local unit\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
df2638a38055d5328e2634224644a673af4ced77
openstack/charm-ceph-radosgw
hooks/multisite.py
[ "ECL-2.0", "Apache-2.0" ]
Python
_list
<not_specific>
def _list(key): """ Internal implementation for list_* functions :param key: string for required entity (zone, zonegroup, realm, user) :type key: str :return: List of specified entities found :rtype: list """ cmd = [ RGW_ADMIN, '--id={}'.format(_key_name()), key, 'list' ...
Internal implementation for list_* functions :param key: string for required entity (zone, zonegroup, realm, user) :type key: str :return: List of specified entities found :rtype: list
Internal implementation for list_* functions
[ "Internal", "implementation", "for", "list_", "*", "functions" ]
def _list(key): cmd = [ RGW_ADMIN, '--id={}'.format(_key_name()), key, 'list' ] try: result = json.loads(_check_output(cmd)) hookenv.log("Results: {}".format( result), level=hookenv.DEBUG) if isinstance(result, dict): return result[...
[ "def", "_list", "(", "key", ")", ":", "cmd", "=", "[", "RGW_ADMIN", ",", "'--id={}'", ".", "format", "(", "_key_name", "(", ")", ")", ",", "key", ",", "'list'", "]", "try", ":", "result", "=", "json", ".", "loads", "(", "_check_output", "(", "cmd",...
Internal implementation for list_* functions
[ "Internal", "implementation", "for", "list_", "*", "functions" ]
[ "\"\"\"\n Internal implementation for list_* functions\n\n :param key: string for required entity (zone, zonegroup, realm, user)\n :type key: str\n :return: List of specified entities found\n :rtype: list\n \"\"\"" ]
[ { "param": "key", "type": null } ]
{ "returns": [ { "docstring": "List of specified entities found", "docstring_tokens": [ "List", "of", "specified", "entities", "found" ], "type": "list" } ], "raises": [], "params": [ { "identifier": "key", "type": null, ...
df2638a38055d5328e2634224644a673af4ced77
openstack/charm-ceph-radosgw
hooks/multisite.py
[ "ECL-2.0", "Apache-2.0" ]
Python
create_system_user
null
def create_system_user(username): """ Create a RADOS Gateway system user :param username: username of user to create :type username: str :return: access key and secret :rtype: (str, str) """ create_user(username, system_user=True)
Create a RADOS Gateway system user :param username: username of user to create :type username: str :return: access key and secret :rtype: (str, str)
Create a RADOS Gateway system user
[ "Create", "a", "RADOS", "Gateway", "system", "user" ]
def create_system_user(username): create_user(username, system_user=True)
[ "def", "create_system_user", "(", "username", ")", ":", "create_user", "(", "username", ",", "system_user", "=", "True", ")" ]
Create a RADOS Gateway system user
[ "Create", "a", "RADOS", "Gateway", "system", "user" ]
[ "\"\"\"\n Create a RADOS Gateway system user\n\n :param username: username of user to create\n :type username: str\n :return: access key and secret\n :rtype: (str, str)\n \"\"\"" ]
[ { "param": "username", "type": null } ]
{ "returns": [ { "docstring": "access key and secret", "docstring_tokens": [ "access", "key", "and", "secret" ], "type": "(str, str)" } ], "raises": [], "params": [ { "identifier": "username", "type": null, "docstring": "usern...
38975a48de421ddf2db58263f8b86301def4be91
openstack/charm-ceph-radosgw
hooks/ceph_radosgw_context.py
[ "ECL-2.0", "Apache-2.0" ]
Python
ensure_host_resolvable_v6
<not_specific>
def ensure_host_resolvable_v6(hostname): """Ensure that we can resolve our hostname to an IPv6 address by adding it to /etc/hosts if it is not already resolvable. """ try: socket.getaddrinfo(hostname, None, socket.AF_INET6) except socket.gaierror: log("Host '%s' is not ipv6 resolvabl...
Ensure that we can resolve our hostname to an IPv6 address by adding it to /etc/hosts if it is not already resolvable.
Ensure that we can resolve our hostname to an IPv6 address by adding it to /etc/hosts if it is not already resolvable.
[ "Ensure", "that", "we", "can", "resolve", "our", "hostname", "to", "an", "IPv6", "address", "by", "adding", "it", "to", "/", "etc", "/", "hosts", "if", "it", "is", "not", "already", "resolvable", "." ]
def ensure_host_resolvable_v6(hostname): try: socket.getaddrinfo(hostname, None, socket.AF_INET6) except socket.gaierror: log("Host '%s' is not ipv6 resolvable - adding to /etc/hosts" % hostname, level=DEBUG) else: log("Host '%s' appears to be ipv6 resolvable" % (hostname...
[ "def", "ensure_host_resolvable_v6", "(", "hostname", ")", ":", "try", ":", "socket", ".", "getaddrinfo", "(", "hostname", ",", "None", ",", "socket", ".", "AF_INET6", ")", "except", "socket", ".", "gaierror", ":", "log", "(", "\"Host '%s' is not ipv6 resolvable ...
Ensure that we can resolve our hostname to an IPv6 address by adding it to /etc/hosts if it is not already resolvable.
[ "Ensure", "that", "we", "can", "resolve", "our", "hostname", "to", "an", "IPv6", "address", "by", "adding", "it", "to", "/", "etc", "/", "hosts", "if", "it", "is", "not", "already", "resolvable", "." ]
[ "\"\"\"Ensure that we can resolve our hostname to an IPv6 address by adding it\n to /etc/hosts if it is not already resolvable.\n \"\"\"", "# This must be the backend address used by haproxy" ]
[ { "param": "hostname", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hostname", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
38975a48de421ddf2db58263f8b86301def4be91
openstack/charm-ceph-radosgw
hooks/ceph_radosgw_context.py
[ "ECL-2.0", "Apache-2.0" ]
Python
resolve_http_frontend
<not_specific>
def resolve_http_frontend(): """Automatically determine the HTTP frontend configuration Determines the best HTTP frontend configuration based on the Ceph release in use and the architecture of the machine being used. :returns http frontend configuration to use. :rtype: str """ octopus_...
Automatically determine the HTTP frontend configuration Determines the best HTTP frontend configuration based on the Ceph release in use and the architecture of the machine being used. :returns http frontend configuration to use. :rtype: str
Automatically determine the HTTP frontend configuration Determines the best HTTP frontend configuration based on the Ceph release in use and the architecture of the machine being used. :returns http frontend configuration to use. :rtype: str
[ "Automatically", "determine", "the", "HTTP", "frontend", "configuration", "Determines", "the", "best", "HTTP", "frontend", "configuration", "based", "on", "the", "Ceph", "release", "in", "use", "and", "the", "architecture", "of", "the", "machine", "being", "used",...
def resolve_http_frontend(): octopus_or_later = cmp_pkgrevno('radosgw', '15.2.0') >= 0 pacific_or_later = cmp_pkgrevno('radosgw', '16.2.0') >= 0 if octopus_or_later: if not pacific_or_later and arch() in UNSUPPORTED_BEAST_ARCHS: return CIVETWEB_FRONTEND else: return B...
[ "def", "resolve_http_frontend", "(", ")", ":", "octopus_or_later", "=", "cmp_pkgrevno", "(", "'radosgw'", ",", "'15.2.0'", ")", ">=", "0", "pacific_or_later", "=", "cmp_pkgrevno", "(", "'radosgw'", ",", "'16.2.0'", ")", ">=", "0", "if", "octopus_or_later", ":", ...
Automatically determine the HTTP frontend configuration Determines the best HTTP frontend configuration based on the Ceph release in use and the architecture of the machine being used.
[ "Automatically", "determine", "the", "HTTP", "frontend", "configuration", "Determines", "the", "best", "HTTP", "frontend", "configuration", "based", "on", "the", "Ceph", "release", "in", "use", "and", "the", "architecture", "of", "the", "machine", "being", "used",...
[ "\"\"\"Automatically determine the HTTP frontend configuration\n\n Determines the best HTTP frontend configuration based\n on the Ceph release in use and the architecture of the\n machine being used.\n\n :returns http frontend configuration to use.\n :rtype: str\n \"\"\"", "# Pacific or later su...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
38975a48de421ddf2db58263f8b86301def4be91
openstack/charm-ceph-radosgw
hooks/ceph_radosgw_context.py
[ "ECL-2.0", "Apache-2.0" ]
Python
context_complete
<not_specific>
def context_complete(self, ctxt): """Overridden here to ensure the context is actually complete. We set `key` and `auth` to None here, by default, to ensure that the context will always evaluate to incomplete until the Ceph relation has actually sent these details; otherwise, th...
Overridden here to ensure the context is actually complete. We set `key` and `auth` to None here, by default, to ensure that the context will always evaluate to incomplete until the Ceph relation has actually sent these details; otherwise, there is a potential race condition between the...
Overridden here to ensure the context is actually complete. We set `key` and `auth` to None here, by default, to ensure that the context will always evaluate to incomplete until the Ceph relation has actually sent these details; otherwise, there is a potential race condition between the relation appearing and the first...
[ "Overridden", "here", "to", "ensure", "the", "context", "is", "actually", "complete", ".", "We", "set", "`", "key", "`", "and", "`", "auth", "`", "to", "None", "here", "by", "default", "to", "ensure", "that", "the", "context", "will", "always", "evaluate...
def context_complete(self, ctxt): if 'fsid' not in ctxt: return False return context.OSContextGenerator.context_complete(self, ctxt)
[ "def", "context_complete", "(", "self", ",", "ctxt", ")", ":", "if", "'fsid'", "not", "in", "ctxt", ":", "return", "False", "return", "context", ".", "OSContextGenerator", ".", "context_complete", "(", "self", ",", "ctxt", ")" ]
Overridden here to ensure the context is actually complete.
[ "Overridden", "here", "to", "ensure", "the", "context", "is", "actually", "complete", "." ]
[ "\"\"\"Overridden here to ensure the context is actually complete.\n\n We set `key` and `auth` to None here, by default, to ensure\n that the context will always evaluate to incomplete until the\n Ceph relation has actually sent these details; otherwise,\n there is a potential race condi...
[ { "param": "self", "type": null }, { "param": "ctxt", "type": null } ]
{ "returns": [ { "docstring": "True if the context is complete", "docstring_tokens": [ "True", "if", "the", "context", "is", "complete" ], "type": "bool" } ], "raises": [], "params": [ { "identifier": "self", "type":...
234fe526b26f5e62f360121178e8150aa68dd5a0
healthpraxone/local-data-api
local_data_api/resources/jdbc/__init__.py
[ "MIT" ]
Python
_fixed_to_datetime
Optional[str]
def _fixed_to_datetime(rs: Any, col: Any) -> Optional[str]: # pragma: no cover """ jaydebeapi has a bug that can't be parsed datetime correctly. This workaround will be removed when the PR is merged. https://github.com/baztian/jaydebeapi/pull/177 """ java_val = rs.getTimestamp(col) if not j...
jaydebeapi has a bug that can't be parsed datetime correctly. This workaround will be removed when the PR is merged. https://github.com/baztian/jaydebeapi/pull/177
jaydebeapi has a bug that can't be parsed datetime correctly. This workaround will be removed when the PR is merged.
[ "jaydebeapi", "has", "a", "bug", "that", "can", "'", "t", "be", "parsed", "datetime", "correctly", ".", "This", "workaround", "will", "be", "removed", "when", "the", "PR", "is", "merged", "." ]
def _fixed_to_datetime(rs: Any, col: Any) -> Optional[str]: java_val = rs.getTimestamp(col) if not java_val: return None import datetime d = datetime.datetime.strptime(str(java_val)[:19], "%Y-%m-%d %H:%M:%S") d = d.replace(microsecond=int(str(java_val.getNanos()).zfill(9)[:6])) return ...
[ "def", "_fixed_to_datetime", "(", "rs", ":", "Any", ",", "col", ":", "Any", ")", "->", "Optional", "[", "str", "]", ":", "java_val", "=", "rs", ".", "getTimestamp", "(", "col", ")", "if", "not", "java_val", ":", "return", "None", "import", "datetime", ...
jaydebeapi has a bug that can't be parsed datetime correctly.
[ "jaydebeapi", "has", "a", "bug", "that", "can", "'", "t", "be", "parsed", "datetime", "correctly", "." ]
[ "# pragma: no cover", "\"\"\"\n jaydebeapi has a bug that can't be parsed datetime correctly.\n This workaround will be removed when the PR is merged.\n https://github.com/baztian/jaydebeapi/pull/177\n \"\"\"" ]
[ { "param": "rs", "type": "Any" }, { "param": "col", "type": "Any" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rs", "type": "Any", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "col", "type": "Any", "docstring": null, "docstring_tokens": []...
24957e79447ab1a51616b9c148ae488950a976c0
Tribler/decentral-market
tsukiji/crypto.py
[ "MIT" ]
Python
create_key
<not_specific>
def create_key(): '''Generates and writes byte string with object of RSA key object.''' key = RSA.generate(2048) with open(KEYFILE_NAME, 'w') as f: f.write(key.exportKey('PEM')) return key
Generates and writes byte string with object of RSA key object.
Generates and writes byte string with object of RSA key object.
[ "Generates", "and", "writes", "byte", "string", "with", "object", "of", "RSA", "key", "object", "." ]
def create_key(): key = RSA.generate(2048) with open(KEYFILE_NAME, 'w') as f: f.write(key.exportKey('PEM')) return key
[ "def", "create_key", "(", ")", ":", "key", "=", "RSA", ".", "generate", "(", "2048", ")", "with", "open", "(", "KEYFILE_NAME", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "key", ".", "exportKey", "(", "'PEM'", ")", ")", "return", "ke...
Generates and writes byte string with object of RSA key object.
[ "Generates", "and", "writes", "byte", "string", "with", "object", "of", "RSA", "key", "object", "." ]
[ "'''Generates and writes byte string with object of RSA key object.'''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
24957e79447ab1a51616b9c148ae488950a976c0
Tribler/decentral-market
tsukiji/crypto.py
[ "MIT" ]
Python
retrieve_key
<not_specific>
def retrieve_key(): ''' Reads an exported key-bytestring from file. If the file does not exist, create one. Returns an RSA key object. ''' if not os.path.isfile(KEYFILE_NAME): return create_key() with open(KEYFILE_NAME, 'r') as f: key = RSA.importKey(f.read()) return...
Reads an exported key-bytestring from file. If the file does not exist, create one. Returns an RSA key object.
Reads an exported key-bytestring from file. If the file does not exist, create one. Returns an RSA key object.
[ "Reads", "an", "exported", "key", "-", "bytestring", "from", "file", ".", "If", "the", "file", "does", "not", "exist", "create", "one", ".", "Returns", "an", "RSA", "key", "object", "." ]
def retrieve_key(): if not os.path.isfile(KEYFILE_NAME): return create_key() with open(KEYFILE_NAME, 'r') as f: key = RSA.importKey(f.read()) return key
[ "def", "retrieve_key", "(", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "KEYFILE_NAME", ")", ":", "return", "create_key", "(", ")", "with", "open", "(", "KEYFILE_NAME", ",", "'r'", ")", "as", "f", ":", "key", "=", "RSA", ".", "imp...
Reads an exported key-bytestring from file.
[ "Reads", "an", "exported", "key", "-", "bytestring", "from", "file", "." ]
[ "'''\n Reads an exported key-bytestring from file.\n If the file does not exist, create one.\n Returns an RSA key object.\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
c0749af486f2eb87d26760b50575190a013d0d8d
Tribler/decentral-market
tsukiji/orderbook.py
[ "MIT" ]
Python
create_msg
<not_specific>
def create_msg(options=None): ''' Standard for message passing. All messages contain an id, a message-id and a timestamp. id: public key message-id: global incremented value timestamp: current time in iso format ''' if options is None: options = {} global message_id ...
Standard for message passing. All messages contain an id, a message-id and a timestamp. id: public key message-id: global incremented value timestamp: current time in iso format
Standard for message passing. All messages contain an id, a message-id and a timestamp. public key message-id: global incremented value timestamp: current time in iso format
[ "Standard", "for", "message", "passing", ".", "All", "messages", "contain", "an", "id", "a", "message", "-", "id", "and", "a", "timestamp", ".", "public", "key", "message", "-", "id", ":", "global", "incremented", "value", "timestamp", ":", "current", "tim...
def create_msg(options=None): if options is None: options = {} global message_id message = { "id": get_public_bytestring(), "message-id": message_id, "timestamp": datetime.datetime.now().isoformat(), } message.update(options) message_id = message_id + 1 return...
[ "def", "create_msg", "(", "options", "=", "None", ")", ":", "if", "options", "is", "None", ":", "options", "=", "{", "}", "global", "message_id", "message", "=", "{", "\"id\"", ":", "get_public_bytestring", "(", ")", ",", "\"message-id\"", ":", "message_id...
Standard for message passing.
[ "Standard", "for", "message", "passing", "." ]
[ "'''\n Standard for message passing.\n\n All messages contain an id, a message-id and a timestamp.\n\n id: public key\n message-id: global incremented value\n timestamp: current time in iso format\n '''" ]
[ { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "options", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c0749af486f2eb87d26760b50575190a013d0d8d
Tribler/decentral-market
tsukiji/orderbook.py
[ "MIT" ]
Python
trade_offer
<not_specific>
def trade_offer(their_offer, own_offer): '''Create a trade message replying to one of their offers.''' return create_trade( recipient=their_offer['id'], quantity=own_offer['quantity'], trade_id=their_offer['message-id'], )
Create a trade message replying to one of their offers.
Create a trade message replying to one of their offers.
[ "Create", "a", "trade", "message", "replying", "to", "one", "of", "their", "offers", "." ]
def trade_offer(their_offer, own_offer): return create_trade( recipient=their_offer['id'], quantity=own_offer['quantity'], trade_id=their_offer['message-id'], )
[ "def", "trade_offer", "(", "their_offer", ",", "own_offer", ")", ":", "return", "create_trade", "(", "recipient", "=", "their_offer", "[", "'id'", "]", ",", "quantity", "=", "own_offer", "[", "'quantity'", "]", ",", "trade_id", "=", "their_offer", "[", "'mes...
Create a trade message replying to one of their offers.
[ "Create", "a", "trade", "message", "replying", "to", "one", "of", "their", "offers", "." ]
[ "'''Create a trade message replying to one of their offers.'''" ]
[ { "param": "their_offer", "type": null }, { "param": "own_offer", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "their_offer", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "own_offer", "type": null, "docstring": null, "docstrin...
c0749af486f2eb87d26760b50575190a013d0d8d
Tribler/decentral-market
tsukiji/orderbook.py
[ "MIT" ]
Python
remove_offer
<not_specific>
def remove_offer(id, message_id): '''Remove an offer given an id and message-id. Returns the offer or None if no offer is found.''' offer = get_offer(id, message_id) if offer: offers.remove(offer) return offer
Remove an offer given an id and message-id. Returns the offer or None if no offer is found.
Remove an offer given an id and message-id. Returns the offer or None if no offer is found.
[ "Remove", "an", "offer", "given", "an", "id", "and", "message", "-", "id", ".", "Returns", "the", "offer", "or", "None", "if", "no", "offer", "is", "found", "." ]
def remove_offer(id, message_id): offer = get_offer(id, message_id) if offer: offers.remove(offer) return offer
[ "def", "remove_offer", "(", "id", ",", "message_id", ")", ":", "offer", "=", "get_offer", "(", "id", ",", "message_id", ")", "if", "offer", ":", "offers", ".", "remove", "(", "offer", ")", "return", "offer" ]
Remove an offer given an id and message-id.
[ "Remove", "an", "offer", "given", "an", "id", "and", "message", "-", "id", "." ]
[ "'''Remove an offer given an id and message-id. Returns the offer or None if no offer is found.'''" ]
[ { "param": "id", "type": null }, { "param": "message_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "message_id", "type": null, "docstring": null, "docstring_tokens...
c0749af486f2eb87d26760b50575190a013d0d8d
Tribler/decentral-market
tsukiji/orderbook.py
[ "MIT" ]
Python
clean_offers
<not_specific>
def clean_offers(f): '''Decorator that scans the list of offers and removes any offers whose timeout has passed.''' def func_wrapper(*args, **kwargs): for offer in offers: if offer['timeout'] < datetime.datetime.now(): offers.remove(offer) return f(*args, **kwargs) ...
Decorator that scans the list of offers and removes any offers whose timeout has passed.
Decorator that scans the list of offers and removes any offers whose timeout has passed.
[ "Decorator", "that", "scans", "the", "list", "of", "offers", "and", "removes", "any", "offers", "whose", "timeout", "has", "passed", "." ]
def clean_offers(f): def func_wrapper(*args, **kwargs): for offer in offers: if offer['timeout'] < datetime.datetime.now(): offers.remove(offer) return f(*args, **kwargs) return func_wrapper
[ "def", "clean_offers", "(", "f", ")", ":", "def", "func_wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "for", "offer", "in", "offers", ":", "if", "offer", "[", "'timeout'", "]", "<", "datetime", ".", "datetime", ".", "now", "(", ")", ":...
Decorator that scans the list of offers and removes any offers whose timeout has passed.
[ "Decorator", "that", "scans", "the", "list", "of", "offers", "and", "removes", "any", "offers", "whose", "timeout", "has", "passed", "." ]
[ "'''Decorator that scans the list of offers and removes any offers whose timeout has passed.'''" ]
[ { "param": "f", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
34b608e00563839b6800968e58a678d040095101
Tribler/decentral-market
tests/test_crypto.py
[ "MIT" ]
Python
silentremove
null
def silentremove(filename): '''Remove a file. If the file does not exist, stay silent.''' try: os.remove(filename) except OSError as e: if e.errno != errno.ENOENT: raise
Remove a file. If the file does not exist, stay silent.
Remove a file. If the file does not exist, stay silent.
[ "Remove", "a", "file", ".", "If", "the", "file", "does", "not", "exist", "stay", "silent", "." ]
def silentremove(filename): try: os.remove(filename) except OSError as e: if e.errno != errno.ENOENT: raise
[ "def", "silentremove", "(", "filename", ")", ":", "try", ":", "os", ".", "remove", "(", "filename", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "!=", "errno", ".", "ENOENT", ":", "raise" ]
Remove a file.
[ "Remove", "a", "file", "." ]
[ "'''Remove a file. If the file does not exist, stay silent.'''" ]
[ { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0115c3218de01535a5bd923d03cea6f0a9191690
cariad/dwalk
dwalk/cli.py
[ "MIT" ]
Python
invoke
int
def invoke(self) -> int: """ Invokes the apppriate task for the given command line arguments. Returns: int: Shell return code. """ basicConfig() if self.args.version: return self.print_version() if self.args.filenames: return...
Invokes the apppriate task for the given command line arguments. Returns: int: Shell return code.
Invokes the apppriate task for the given command line arguments.
[ "Invokes", "the", "apppriate", "task", "for", "the", "given", "command", "line", "arguments", "." ]
def invoke(self) -> int: basicConfig() if self.args.version: return self.print_version() if self.args.filenames: return self.execute() return self.print_help()
[ "def", "invoke", "(", "self", ")", "->", "int", ":", "basicConfig", "(", ")", "if", "self", ".", "args", ".", "version", ":", "return", "self", ".", "print_version", "(", ")", "if", "self", ".", "args", ".", "filenames", ":", "return", "self", ".", ...
Invokes the apppriate task for the given command line arguments.
[ "Invokes", "the", "apppriate", "task", "for", "the", "given", "command", "line", "arguments", "." ]
[ "\"\"\"\n Invokes the apppriate task for the given command line arguments.\n\n Returns:\n int: Shell return code.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Shell return code.", "docstring_tokens": [ "Shell", "return", "code", "." ], "type": "int" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring...
5193ff2c753b19b5bd4e36298731fd4f29a3354d
iago1460/photo-cataloguer
catalogue/model.py
[ "MIT" ]
Python
_chunk_reader
<not_specific>
def _chunk_reader(fobj, chunk_size=1024): """Generator that reads a file in chunks of bytes""" while True: chunk = fobj.read(chunk_size) if not chunk: return yield chunk
Generator that reads a file in chunks of bytes
Generator that reads a file in chunks of bytes
[ "Generator", "that", "reads", "a", "file", "in", "chunks", "of", "bytes" ]
def _chunk_reader(fobj, chunk_size=1024): while True: chunk = fobj.read(chunk_size) if not chunk: return yield chunk
[ "def", "_chunk_reader", "(", "fobj", ",", "chunk_size", "=", "1024", ")", ":", "while", "True", ":", "chunk", "=", "fobj", ".", "read", "(", "chunk_size", ")", "if", "not", "chunk", ":", "return", "yield", "chunk" ]
Generator that reads a file in chunks of bytes
[ "Generator", "that", "reads", "a", "file", "in", "chunks", "of", "bytes" ]
[ "\"\"\"Generator that reads a file in chunks of bytes\"\"\"" ]
[ { "param": "fobj", "type": null }, { "param": "chunk_size", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fobj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "chunk_size", "type": null, "docstring": null, "docstring_toke...
00b07b82b9a8a029c379a75661eb0684e5452aaa
snsokolov/contests
codeforces/579C_polyline.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = float(1) if self.a < self.b: return "-1" if self.a == self.b: return str("{0:.12f}".format(self.b)) r1 = (self.a + self.b) / (2 * int((self.a + self.b) / (2 * self.b))) ...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = float(1) if self.a < self.b: return "-1" if self.a == self.b: return str("{0:.12f}".format(self.b)) r1 = (self.a + self.b) / (2 * int((self.a + self.b) / (2 * self.b))) d = (2 * int((self.a - self.b) / (2 * self.b))) r...
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "float", "(", "1", ")", "if", "self", ".", "a", "<", "self", ".", "b", ":", "return", "\"-1\"", "if", "self", ".", "a", "==", "self", ".", "b", ":", "return", "str", "(", "\"{0:.12f}\"", ...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
288273df92030ef4261ce30bdfcc4f036afa757c
snsokolov/contests
codeforces/604D_modular.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = 0 bp = Binominals(mod=self.p) mm = 1 for m in range(1, self.p): mm = bp.mul(mm, self.k) if mm == 1: break bb = Binominals(mod=self.M) if self.k =...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = 0 bp = Binominals(mod=self.p) mm = 1 for m in range(1, self.p): mm = bp.mul(mm, self.k) if mm == 1: break bb = Binominals(mod=self.M) if self.k == 0: result = bb.pow(self.p, self.p-1) ...
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "0", "bp", "=", "Binominals", "(", "mod", "=", "self", ".", "p", ")", "mm", "=", "1", "for", "m", "in", "range", "(", "1", ",", "self", ".", "p", ")", ":", "mm", "=", "bp", ".", "mul...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d75aafbef55eb11e123cdf0aac84fe93a54acf9c
snsokolov/contests
codeforces/600A_nums.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = "" result += "-" if not self.al else ("\"" + ",".join(self.al) + "\"") result += "\n" result += "-" if not self.bl else ("\"" + ",".join(self.bl) + "\"") return result
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = "" result += "-" if not self.al else ("\"" + ",".join(self.al) + "\"") result += "\n" result += "-" if not self.bl else ("\"" + ",".join(self.bl) + "\"") return result
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "\"\"", "result", "+=", "\"-\"", "if", "not", "self", ".", "al", "else", "(", "\"\\\"\"", "+", "\",\"", ".", "join", "(", "self", ".", "al", ")", "+", "\"\\\"\"", ")", "result", "+=", "\"\\n...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
06679f319264c42b3a2ded4febc30707f7b96e50
snsokolov/contests
codeforces/672C_bottles.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ distt = [self.hyp(self.numa[i] - self.tx, self.numb[i] - self.ty) for i in range(self.n)] dista = [self.hyp(self.numa[i] - self.ax, self.numb[i] - self.ay) for i in range(self.n)] distb...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): distt = [self.hyp(self.numa[i] - self.tx, self.numb[i] - self.ty) for i in range(self.n)] dista = [self.hyp(self.numa[i] - self.ax, self.numb[i] - self.ay) for i in range(self.n)] distb = [self.hyp(self.numa[i] - self.bx, self.numb[i] - self...
[ "def", "calculate", "(", "self", ")", ":", "distt", "=", "[", "self", ".", "hyp", "(", "self", ".", "numa", "[", "i", "]", "-", "self", ".", "tx", ",", "self", ".", "numb", "[", "i", "]", "-", "self", ".", "ty", ")", "for", "i", "in", "rang...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9b30a5251cff1e33efb8734bb7272f4e9d2d65c2
snsokolov/contests
codeforces/600B_query.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = [] for n in self.numb: result.append(rbound(self.snuma, n)) return str(" ".join(map(str, result)))
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = [] for n in self.numb: result.append(rbound(self.snuma, n)) return str(" ".join(map(str, result)))
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "[", "]", "for", "n", "in", "self", ".", "numb", ":", "result", ".", "append", "(", "rbound", "(", "self", ".", "snuma", ",", "n", ")", ")", "return", "str", "(", "\" \"", ".", "join", "...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d5e42854da9077a6c8cb53c1beef5d7fc163e39b
snsokolov/contests
codeforces/577A_table.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = 0 for i in range(1, self.n+1): if self.m % i == 0 and self.m//i <= self.n: result += 1 return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = 0 for i in range(1, self.n+1): if self.m % i == 0 and self.m//i <= self.n: result += 1 return str(result)
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "0", "for", "i", "in", "range", "(", "1", ",", "self", ".", "n", "+", "1", ")", ":", "if", "self", ".", "m", "%", "i", "==", "0", "and", "self", ".", "m", "//", "i", "<=", "self", ...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f163cf7da7656c363946074a2f04dd9edafe2f2
snsokolov/contests
codeforces/609C_load.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = 0 for i in range(self.n): delta = self.snums[i] - self.targ[i] result += delta if delta > 0 else 0 return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = 0 for i in range(self.n): delta = self.snums[i] - self.targ[i] result += delta if delta > 0 else 0 return str(result)
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "0", "for", "i", "in", "range", "(", "self", ".", "n", ")", ":", "delta", "=", "self", ".", "snums", "[", "i", "]", "-", "self", ".", "targ", "[", "i", "]", "result", "+=", "delta", "i...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c8c01c240e39ac0ff50736fb6b07bcc2a0813c5f
snsokolov/contests
codeforces/558C_chem_2.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ valid = set() stp = [0] * self.MAX first = 1 for vol in self.list: new_valid = set() steps = 0 prev = 1 while vol > 0: if (first or vol in valid): ...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): valid = set() stp = [0] * self.MAX first = 1 for vol in self.list: new_valid = set() steps = 0 prev = 1 while vol > 0: if (first or vol in valid): if prev % 2 == 1: ...
[ "def", "calculate", "(", "self", ")", ":", "valid", "=", "set", "(", ")", "stp", "=", "[", "0", "]", "*", "self", ".", "MAX", "first", "=", "1", "for", "vol", "in", "self", ".", "list", ":", "new_valid", "=", "set", "(", ")", "steps", "=", "0...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c8c01c240e39ac0ff50736fb6b07bcc2a0813c5f
snsokolov/contests
codeforces/558C_chem_2.py
[ "Unlicense" ]
Python
uinput
<not_specific>
def uinput(): """ Unit-testable input function wrapper """ if it: return next(it) else: return sys.stdin.readline()
Unit-testable input function wrapper
Unit-testable input function wrapper
[ "Unit", "-", "testable", "input", "function", "wrapper" ]
def uinput(): if it: return next(it) else: return sys.stdin.readline()
[ "def", "uinput", "(", ")", ":", "if", "it", ":", "return", "next", "(", "it", ")", "else", ":", "return", "sys", ".", "stdin", ".", "readline", "(", ")" ]
Unit-testable input function wrapper
[ "Unit", "-", "testable", "input", "function", "wrapper" ]
[ "\"\"\" Unit-testable input function wrapper \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
157198f4c7bdda17fb095e6400ceacd9d2fbceab
snsokolov/contests
codeforces/667C_ling.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ chars = list(self.s) slen = len(chars) result = set([]) vis = set([]) q = deque([(0, "")]) while q: pos, prev = q.popleft() if pos in vis: continue ...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): chars = list(self.s) slen = len(chars) result = set([]) vis = set([]) q = deque([(0, "")]) while q: pos, prev = q.popleft() if pos in vis: continue pos2 = pos + 2 if slen - pos2 > 4: ...
[ "def", "calculate", "(", "self", ")", ":", "chars", "=", "list", "(", "self", ".", "s", ")", "slen", "=", "len", "(", "chars", ")", "result", "=", "set", "(", "[", "]", ")", "vis", "=", "set", "(", "[", "]", ")", "q", "=", "deque", "(", "["...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1af054819950e9adc8e3193bc08cfa6347eae58a
snsokolov/contests
codeforces/600D_circles.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = self.sa + self.sb return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = self.sa + self.sb return str(result)
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "self", ".", "sa", "+", "self", ".", "sb", "return", "str", "(", "result", ")" ]
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5bab4a09df891c2c025cea6d9d343e894f32aeb1
snsokolov/contests
codeforces/629B_relative.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = max(self.cr) return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = max(self.cr) return str(result)
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "max", "(", "self", ".", "cr", ")", "return", "str", "(", "result", ")" ]
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
41f8204735a3379e46daadfc057ce44e8fdf0bab
snsokolov/contests
codeforces/574B_musk.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = self.min_rank return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = self.min_rank return str(result)
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "self", ".", "min_rank", "return", "str", "(", "result", ")" ]
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2324a66152c1ecec5d15ab2a8370bb93e8c86a83
snsokolov/contests
codeforces/606B_robots.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ xy = self.x * self.y loc = (self.x0, self.y0) locs = set([loc]) result = [1] for (i, d) in enumerate(self.nums): nx, ny = loc if d == "U": nx = max(1, loc[0] - 1) ...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): xy = self.x * self.y loc = (self.x0, self.y0) locs = set([loc]) result = [1] for (i, d) in enumerate(self.nums): nx, ny = loc if d == "U": nx = max(1, loc[0] - 1) if d == "D": nx = min(self.x...
[ "def", "calculate", "(", "self", ")", ":", "xy", "=", "self", ".", "x", "*", "self", ".", "y", "loc", "=", "(", "self", ".", "x0", ",", "self", ".", "y0", ")", "locs", "=", "set", "(", "[", "loc", "]", ")", "result", "=", "[", "1", "]", "...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
72ba8587684f2ccd5c524507dce0aa7c2a74d423
snsokolov/contests
codeforces/664A_gcd.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = 1 if self.a != self.b else self.a return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = 1 if self.a != self.b else self.a return str(result)
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "1", "if", "self", ".", "a", "!=", "self", ".", "b", "else", "self", ".", "a", "return", "str", "(", "result", ")" ]
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
903a7f20790d74a48dfc8b8b6f2a4fb873a515ca
snsokolov/contests
codeforces/557A_diploma.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ self.set_range() result = self.range return str(" ".join([str(n) for n in result]))
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): self.set_range() result = self.range return str(" ".join([str(n) for n in result]))
[ "def", "calculate", "(", "self", ")", ":", "self", ".", "set_range", "(", ")", "result", "=", "self", ".", "range", "return", "str", "(", "\" \"", ".", "join", "(", "[", "str", "(", "n", ")", "for", "n", "in", "result", "]", ")", ")" ]
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
903a7f20790d74a48dfc8b8b6f2a4fb873a515ca
snsokolov/contests
codeforces/557A_diploma.py
[ "Unlicense" ]
Python
uinput
<not_specific>
def uinput(): """ Unit-testable input function wrapper """ if it: return next(it) else: return input()
Unit-testable input function wrapper
Unit-testable input function wrapper
[ "Unit", "-", "testable", "input", "function", "wrapper" ]
def uinput(): if it: return next(it) else: return input()
[ "def", "uinput", "(", ")", ":", "if", "it", ":", "return", "next", "(", "it", ")", "else", ":", "return", "input", "(", ")" ]
Unit-testable input function wrapper
[ "Unit", "-", "testable", "input", "function", "wrapper" ]
[ "\"\"\" Unit-testable input function wrapper \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7d181602f503d650bf96b9b1d71a5782150a9508
snsokolov/contests
codeforces/604A_forces.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = 0 for i in range(5): x = self.mx[i] m = self.numm[i] w = self.numw[i] result += max(0.3*x, (1 - m/250) * x - 50 * w) result += 100 * self.hs - 50 * self.hu ...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = 0 for i in range(5): x = self.mx[i] m = self.numm[i] w = self.numw[i] result += max(0.3*x, (1 - m/250) * x - 50 * w) result += 100 * self.hs - 50 * self.hu return str(int(result))
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "0", "for", "i", "in", "range", "(", "5", ")", ":", "x", "=", "self", ".", "mx", "[", "i", "]", "m", "=", "self", ".", "numm", "[", "i", "]", "w", "=", "self", ".", "numw", "[", "i...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d9fbf9c6e1be57a12456cb097eaa7ef2c8311217
snsokolov/contests
codeforces/574A_bear.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ lamak = self.nums[0] srt = sorted(self.nums[1:]) result = 0 while lamak <= srt[-1]: srt[-1] -= 1 lamak += 1 result += 1 srt = sorted(srt) return str(resu...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): lamak = self.nums[0] srt = sorted(self.nums[1:]) result = 0 while lamak <= srt[-1]: srt[-1] -= 1 lamak += 1 result += 1 srt = sorted(srt) return str(result)
[ "def", "calculate", "(", "self", ")", ":", "lamak", "=", "self", ".", "nums", "[", "0", "]", "srt", "=", "sorted", "(", "self", ".", "nums", "[", "1", ":", "]", ")", "result", "=", "0", "while", "lamak", "<=", "srt", "[", "-", "1", "]", ":", ...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7596c1496fc6562d7c60e70c170f41d2306ed6cd
snsokolov/contests
codeforces/672A_camp.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ line = "" for i in range(400): line += str(i) result = line[self.n] return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): line = "" for i in range(400): line += str(i) result = line[self.n] return str(result)
[ "def", "calculate", "(", "self", ")", ":", "line", "=", "\"\"", "for", "i", "in", "range", "(", "400", ")", ":", "line", "+=", "str", "(", "i", ")", "result", "=", "line", "[", "self", ".", "n", "]", "return", "str", "(", "result", ")" ]
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a2d1f1ece67bb98ecb8a5da0994ac3b140b7cbd6
snsokolov/contests
codeforces/596A_pool.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = 0 m = min(3, len(self.numa)) for i in range(m): for j in range(i+1, m): result += abs( (self.numa[i] - self.numa[j]) * (self.numb[i] - self.n...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = 0 m = min(3, len(self.numa)) for i in range(m): for j in range(i+1, m): result += abs( (self.numa[i] - self.numa[j]) * (self.numb[i] - self.numb[j])) if result == 0: result = -1 ...
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "0", "m", "=", "min", "(", "3", ",", "len", "(", "self", ".", "numa", ")", ")", "for", "i", "in", "range", "(", "m", ")", ":", "for", "j", "in", "range", "(", "i", "+", "1", ",", "...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
abefd6da7a1cffee528aa0a6423ddaeaf010ae82
snsokolov/contests
codeforces/664C_olymp.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ outs = map(str, map(self.translate, self.nums)) result = "\n".join(outs) return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): outs = map(str, map(self.translate, self.nums)) result = "\n".join(outs) return str(result)
[ "def", "calculate", "(", "self", ")", ":", "outs", "=", "map", "(", "str", ",", "map", "(", "self", ".", "translate", ",", "self", ".", "nums", ")", ")", "result", "=", "\"\\n\"", ".", "join", "(", "outs", ")", "return", "str", "(", "result", ")"...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
acd6aa2099b74a5ced946d195e03d855da0dace7
snsokolov/contests
codeforces/556C_matr.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ turns = self.turns() reduce = self.reduce() result = turns - reduce return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): turns = self.turns() reduce = self.reduce() result = turns - reduce return str(result)
[ "def", "calculate", "(", "self", ")", ":", "turns", "=", "self", ".", "turns", "(", ")", "reduce", "=", "self", ".", "reduce", "(", ")", "result", "=", "turns", "-", "reduce", "return", "str", "(", "result", ")" ]
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
688caec24eb689bd056541bcb84126a7462c2fe8
snsokolov/contests
codeforces/621A_shark.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ s = sum(self.nums) srt = sorted(self.nums) minodd = 0 for m in srt: if m % 2: minodd = m break result = s if not s % 2 else s - minodd return str(res...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): s = sum(self.nums) srt = sorted(self.nums) minodd = 0 for m in srt: if m % 2: minodd = m break result = s if not s % 2 else s - minodd return str(result)
[ "def", "calculate", "(", "self", ")", ":", "s", "=", "sum", "(", "self", ".", "nums", ")", "srt", "=", "sorted", "(", "self", ".", "nums", ")", "minodd", "=", "0", "for", "m", "in", "srt", ":", "if", "m", "%", "2", ":", "minodd", "=", "m", ...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
86e20f28d5b83ed525595460bd0df29541c5696b
snsokolov/contests
codeforces/664B_rebus.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ nums = [0] * len(self.signs) for i in range(len(self.signs)): nums[i] = 1 sum = self.summ(nums, self.signs) for i in range(len(self.signs)): if sum != self.n: if...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): nums = [0] * len(self.signs) for i in range(len(self.signs)): nums[i] = 1 sum = self.summ(nums, self.signs) for i in range(len(self.signs)): if sum != self.n: if self.signs[i] == "+" and sum < self.n: nums[i...
[ "def", "calculate", "(", "self", ")", ":", "nums", "=", "[", "0", "]", "*", "len", "(", "self", ".", "signs", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "signs", ")", ")", ":", "nums", "[", "i", "]", "=", "1", "sum", "=",...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e140f8f8348de021e01f434669e317203b6174bd
snsokolov/contests
codeforces/567A_mail.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = [] for i in range(self.imax): dmin = min( abs(self.nums[i] - self.nums[(i-1) % self.imax]), abs(self.nums[i] - self.nums[(i+1) % self.imax])) dmax = max( ...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = [] for i in range(self.imax): dmin = min( abs(self.nums[i] - self.nums[(i-1) % self.imax]), abs(self.nums[i] - self.nums[(i+1) % self.imax])) dmax = max( abs(self.nums[i] - self.nums[0]), ...
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "[", "]", "for", "i", "in", "range", "(", "self", ".", "imax", ")", ":", "dmin", "=", "min", "(", "abs", "(", "self", ".", "nums", "[", "i", "]", "-", "self", ".", "nums", "[", "(", ...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
76f4a82864f8100e2af312025e5176f9fe203375
snsokolov/contests
codeforces/558B_larray.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ values = sorted(self.freq.values()) result = [values[-1][2]+1, values[-1][3]+1] return str(" ".join(map(str, result)))
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): values = sorted(self.freq.values()) result = [values[-1][2]+1, values[-1][3]+1] return str(" ".join(map(str, result)))
[ "def", "calculate", "(", "self", ")", ":", "values", "=", "sorted", "(", "self", ".", "freq", ".", "values", "(", ")", ")", "result", "=", "[", "values", "[", "-", "1", "]", "[", "2", "]", "+", "1", ",", "values", "[", "-", "1", "]", "[", "...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6d0b60a99260e5c4f9ba759586152b1174c29f9a
snsokolov/contests
codeforces/600C_palindrom.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = [] mid = [] for c in sorted(self.pcnt): n = self.pcnt[c] if n > 0: for j in range(n // 2): result.append(c) if n % 2: ...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = [] mid = [] for c in sorted(self.pcnt): n = self.pcnt[c] if n > 0: for j in range(n // 2): result.append(c) if n % 2: mid.append(c) return "".join(result + mid + ...
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "[", "]", "mid", "=", "[", "]", "for", "c", "in", "sorted", "(", "self", ".", "pcnt", ")", ":", "n", "=", "self", ".", "pcnt", "[", "c", "]", "if", "n", ">", "0", ":", "for", "j", ...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2024079313069f1901fa0901e09fcb7358d7cdba
snsokolov/contests
codeforces/609B_gift.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = 0 for (i, n) in enumerate(self.nums): result += self.summ - self.genr[n-1] return str(result//2)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = 0 for (i, n) in enumerate(self.nums): result += self.summ - self.genr[n-1] return str(result//2)
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "0", "for", "(", "i", ",", "n", ")", "in", "enumerate", "(", "self", ".", "nums", ")", ":", "result", "+=", "self", ".", "summ", "-", "self", ".", "genr", "[", "n", "-", "1", "]", "ret...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e23048f093483a6bb5fef0d5f1893c5863c5c7e4
snsokolov/contests
codeforces/569B_inv.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = [] for i in range(self.imax): num = self.nums[i] if self.cnt[num] > 1 or num > self.imax: e = self.empty.popleft() self.cnt[num] -= 1 result.appen...
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = [] for i in range(self.imax): num = self.nums[i] if self.cnt[num] > 1 or num > self.imax: e = self.empty.popleft() self.cnt[num] -= 1 result.append(e) else: result.append(num...
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "[", "]", "for", "i", "in", "range", "(", "self", ".", "imax", ")", ":", "num", "=", "self", ".", "nums", "[", "i", "]", "if", "self", ".", "cnt", "[", "num", "]", ">", "1", "or", "n...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9fab15146561c1f53f635074e8de3725f1733c9d
snsokolov/contests
codeforces/554C_colored.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ result = self.f(len(self.list) - 1) % self.MOD return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): result = self.f(len(self.list) - 1) % self.MOD return str(result)
[ "def", "calculate", "(", "self", ")", ":", "result", "=", "self", ".", "f", "(", "len", "(", "self", ".", "list", ")", "-", "1", ")", "%", "self", ".", "MOD", "return", "str", "(", "result", ")" ]
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
37a2781e5f21b0e18a39d162531b730068b04be9
snsokolov/contests
codeforces/557C_table.py
[ "Unlicense" ]
Python
calculate
<not_specific>
def calculate(self): """ Main calcualtion function of the class """ iter = self.get_new_layer_info(self.legs, self.energy) for g in iter: pass result = self.ires_eng return str(result)
Main calcualtion function of the class
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
def calculate(self): iter = self.get_new_layer_info(self.legs, self.energy) for g in iter: pass result = self.ires_eng return str(result)
[ "def", "calculate", "(", "self", ")", ":", "iter", "=", "self", ".", "get_new_layer_info", "(", "self", ".", "legs", ",", "self", ".", "energy", ")", "for", "g", "in", "iter", ":", "pass", "result", "=", "self", ".", "ires_eng", "return", "str", "(",...
Main calcualtion function of the class
[ "Main", "calcualtion", "function", "of", "the", "class" ]
[ "\"\"\" Main calcualtion function of the class \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }