nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/concurrent/concurrent/futures/_base.py
python
Future.done
(self)
Return True of the future was cancelled or finished executing.
Return True of the future was cancelled or finished executing.
[ "Return", "True", "of", "the", "future", "was", "cancelled", "or", "finished", "executing", "." ]
def done(self): """Return True of the future was cancelled or finished executing.""" with self._condition: return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED]
[ "def", "done", "(", "self", ")", ":", "with", "self", ".", "_condition", ":", "return", "self", ".", "_state", "in", "[", "CANCELLED", ",", "CANCELLED_AND_NOTIFIED", ",", "FINISHED", "]" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/concurrent/concurrent/futures/_base.py#L349-L352
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/packages/source-python/__init__.py
python
setup_data_update
()
Setup data update.
Setup data update.
[ "Setup", "data", "update", "." ]
def setup_data_update(): """Setup data update.""" _sp_logger.log_debug('Setting up data update...') if LOG_FILE_OPERATIONS: builtins.open = old_open from core.settings import _core_settings if not _core_settings.auto_data_update: _sp_logger.log_debug('Automatic data updates are di...
[ "def", "setup_data_update", "(", ")", ":", "_sp_logger", ".", "log_debug", "(", "'Setting up data update...'", ")", "if", "LOG_FILE_OPERATIONS", ":", "builtins", ".", "open", "=", "old_open", "from", "core", ".", "settings", "import", "_core_settings", "if", "not"...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/source-python/__init__.py#L107-L137
travisgoodspeed/goodfet
1750cc1e8588af5470385e52fa098ca7364c2863
client/USBDevice.py
python
USBDevice.get_string_id
(self, s)
return i
[]
def get_string_id(self, s): try: i = self.strings.index(s) except ValueError: # string descriptors start at index 1 self.strings.append(s) i = len(self.strings) return i
[ "def", "get_string_id", "(", "self", ",", "s", ")", ":", "try", ":", "i", "=", "self", ".", "strings", ".", "index", "(", "s", ")", "except", "ValueError", ":", "# string descriptors start at index 1", "self", ".", "strings", ".", "append", "(", "s", ")"...
https://github.com/travisgoodspeed/goodfet/blob/1750cc1e8588af5470385e52fa098ca7364c2863/client/USBDevice.py#L55-L63
jiangxinyang227/bert-for-task
3e7aed9e3c757ebc22aabfd4f3fb7b4cd81b010a
bert_task/sentence_pair_task/data_helper.py
python
TrainData.gen_data
(self, file_path, is_training=True)
return inputs_ids, input_masks, segment_ids, labels_ids, label_to_index
生成数据 :param file_path: :param is_training :return:
生成数据 :param file_path: :param is_training :return:
[ "生成数据", ":", "param", "file_path", ":", ":", "param", "is_training", ":", "return", ":" ]
def gen_data(self, file_path, is_training=True): """ 生成数据 :param file_path: :param is_training :return: """ # 1,读取原始数据 text_as, text_bs, labels = self.read_data(file_path) print("read finished") if is_training: uni_label = lis...
[ "def", "gen_data", "(", "self", ",", "file_path", ",", "is_training", "=", "True", ")", ":", "# 1,读取原始数据", "text_as", ",", "text_bs", ",", "labels", "=", "self", ".", "read_data", "(", "file_path", ")", "print", "(", "\"read finished\"", ")", "if", "is_tra...
https://github.com/jiangxinyang227/bert-for-task/blob/3e7aed9e3c757ebc22aabfd4f3fb7b4cd81b010a/bert_task/sentence_pair_task/data_helper.py#L119-L159
jamiecaesar/securecrt-tools
f3cbb49223a485fc9af86e9799b5c940f19e8027
s_save_output.py
python
script_main
(session)
| SINGLE device script | Author: Jamie Caesar | Email: jcaesar@presidio.com This script will prompt the user for a command for a Cisco device and save the output into a file. The path where the file is saved is specified in settings.ini file. This script assumes that you are already connected to th...
| SINGLE device script | Author: Jamie Caesar | Email: jcaesar@presidio.com
[ "|", "SINGLE", "device", "script", "|", "Author", ":", "Jamie", "Caesar", "|", "Email", ":", "jcaesar@presidio", ".", "com" ]
def script_main(session): """ | SINGLE device script | Author: Jamie Caesar | Email: jcaesar@presidio.com This script will prompt the user for a command for a Cisco device and save the output into a file. The path where the file is saved is specified in settings.ini file. This script assume...
[ "def", "script_main", "(", "session", ")", ":", "# Get script object that owns this session, so we can check settings, get textfsm templates, etc", "script", "=", "session", ".", "script", "# Start session with device, i.e. modify term parameters for better interaction (assuming already conn...
https://github.com/jamiecaesar/securecrt-tools/blob/f3cbb49223a485fc9af86e9799b5c940f19e8027/s_save_output.py#L29-L63
textX/Arpeggio
9ec6c7ee402054616b2f81e76557d39d3d376fcd
examples/calc/calc.py
python
CalcVisitor.visit_term
(self, node, children)
return term
Divides or multiplies factors. Factor nodes will be already evaluated.
Divides or multiplies factors. Factor nodes will be already evaluated.
[ "Divides", "or", "multiplies", "factors", ".", "Factor", "nodes", "will", "be", "already", "evaluated", "." ]
def visit_term(self, node, children): """ Divides or multiplies factors. Factor nodes will be already evaluated. """ if self.debug: print("Term {}".format(children)) term = children[0] for i in range(2, len(children), 2): if children[i-1] =...
[ "def", "visit_term", "(", "self", ",", "node", ",", "children", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "\"Term {}\"", ".", "format", "(", "children", ")", ")", "term", "=", "children", "[", "0", "]", "for", "i", "in", "range", "("...
https://github.com/textX/Arpeggio/blob/9ec6c7ee402054616b2f81e76557d39d3d376fcd/examples/calc/calc.py#L52-L67
rlworkgroup/garage
b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507
src/garage/torch/policies/categorical_cnn_policy.py
python
CategoricalCNNPolicy.forward
(self, observations)
return dist, {}
Compute the action distributions from the observations. Args: observations (torch.Tensor): Observations to act on. Returns: torch.distributions.Distribution: Batch distribution of actions. dict[str, torch.Tensor]: Additional agent_info, as torch Tensors. ...
Compute the action distributions from the observations.
[ "Compute", "the", "action", "distributions", "from", "the", "observations", "." ]
def forward(self, observations): """Compute the action distributions from the observations. Args: observations (torch.Tensor): Observations to act on. Returns: torch.distributions.Distribution: Batch distribution of actions. dict[str, torch.Tensor]: Addition...
[ "def", "forward", "(", "self", ",", "observations", ")", ":", "# We're given flattened observations.", "observations", "=", "observations", ".", "reshape", "(", "-", "1", ",", "*", "self", ".", "_env_spec", ".", "observation_space", ".", "shape", ")", "cnn_outpu...
https://github.com/rlworkgroup/garage/blob/b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507/src/garage/torch/policies/categorical_cnn_policy.py#L122-L140
containernet/containernet
7b2ae38d691b2ed8da2b2700b85ed03562271d01
examples/miniedit.py
python
MiniEdit.createNodeBindings
( self )
return l
Create a set of bindings for nodes.
Create a set of bindings for nodes.
[ "Create", "a", "set", "of", "bindings", "for", "nodes", "." ]
def createNodeBindings( self ): "Create a set of bindings for nodes." bindings = { '<ButtonPress-1>': self.clickNode, '<B1-Motion>': self.dragNode, '<ButtonRelease-1>': self.releaseNode, '<Enter>': self.enterNode, '<Leave>': self.leaveNode ...
[ "def", "createNodeBindings", "(", "self", ")", ":", "bindings", "=", "{", "'<ButtonPress-1>'", ":", "self", ".", "clickNode", ",", "'<B1-Motion>'", ":", "self", ".", "dragNode", ",", "'<ButtonRelease-1>'", ":", "self", ".", "releaseNode", ",", "'<Enter>'", ":"...
https://github.com/containernet/containernet/blob/7b2ae38d691b2ed8da2b2700b85ed03562271d01/examples/miniedit.py#L2361-L2373
hvac/hvac
ec048ded30d21c13c21cfa950d148c8bfc1467b0
hvac/api/secrets_engines/pki.py
python
Pki.list_certificates
(self, mount_point=DEFAULT_MOUNT_POINT)
return self._adapter.list( url=api_path, )
List Certificates. The list of the current certificates by serial number only. Supported methods: LIST: /{mount_point}/certs. Produces: 200 application/json :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: ...
List Certificates.
[ "List", "Certificates", "." ]
def list_certificates(self, mount_point=DEFAULT_MOUNT_POINT): """List Certificates. The list of the current certificates by serial number only. Supported methods: LIST: /{mount_point}/certs. Produces: 200 application/json :param mount_point: The "path" the method/backend w...
[ "def", "list_certificates", "(", "self", ",", "mount_point", "=", "DEFAULT_MOUNT_POINT", ")", ":", "api_path", "=", "utils", ".", "format_url", "(", "\"/v1/{mount_point}/certs\"", ",", "mount_point", "=", "mount_point", ")", "return", "self", ".", "_adapter", ".",...
https://github.com/hvac/hvac/blob/ec048ded30d21c13c21cfa950d148c8bfc1467b0/hvac/api/secrets_engines/pki.py#L80-L96
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pywin/Lib/macurl2path.py
python
pathname2url
(pathname)
OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.
OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.
[ "OS", "-", "specific", "conversion", "from", "a", "file", "system", "path", "to", "a", "relative", "URL", "of", "the", "file", "scheme", ";", "not", "recommended", "for", "general", "use", "." ]
def pathname2url(pathname): """OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.""" if '/' in pathname: raise RuntimeError, "Cannot convert pathname containing slashes" components = pathname.split(':') # Remove empty first...
[ "def", "pathname2url", "(", "pathname", ")", ":", "if", "'/'", "in", "pathname", ":", "raise", "RuntimeError", ",", "\"Cannot convert pathname containing slashes\"", "components", "=", "pathname", ".", "split", "(", "':'", ")", "# Remove empty first and/or last componen...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/macurl2path.py#L52-L73
mrkipling/maraschino
c6be9286937783ae01df2d6d8cebfc8b2734a7d7
lib/werkzeug/wrappers.py
python
AcceptMixin.accept_mimetypes
(self)
return parse_accept_header(self.environ.get('HTTP_ACCEPT'), MIMEAccept)
List of mimetypes this client supports as :class:`~werkzeug.datastructures.MIMEAccept` object.
List of mimetypes this client supports as :class:`~werkzeug.datastructures.MIMEAccept` object.
[ "List", "of", "mimetypes", "this", "client", "supports", "as", ":", "class", ":", "~werkzeug", ".", "datastructures", ".", "MIMEAccept", "object", "." ]
def accept_mimetypes(self): """List of mimetypes this client supports as :class:`~werkzeug.datastructures.MIMEAccept` object. """ return parse_accept_header(self.environ.get('HTTP_ACCEPT'), MIMEAccept)
[ "def", "accept_mimetypes", "(", "self", ")", ":", "return", "parse_accept_header", "(", "self", ".", "environ", ".", "get", "(", "'HTTP_ACCEPT'", ")", ",", "MIMEAccept", ")" ]
https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/werkzeug/wrappers.py#L1095-L1099
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-47/fabmetheus_utilities/geometry/geometry_utilities/matrix.py
python
setElementNodeDictionaryMatrix
(elementNode, matrix4X4)
Set the element attribute dictionary or element matrix to the matrix.
Set the element attribute dictionary or element matrix to the matrix.
[ "Set", "the", "element", "attribute", "dictionary", "or", "element", "matrix", "to", "the", "matrix", "." ]
def setElementNodeDictionaryMatrix(elementNode, matrix4X4): 'Set the element attribute dictionary or element matrix to the matrix.' if elementNode.xmlObject == None: elementNode.attributes.update(matrix4X4.getAttributes('matrix.')) else: elementNode.xmlObject.matrix4X4 = matrix4X4
[ "def", "setElementNodeDictionaryMatrix", "(", "elementNode", ",", "matrix4X4", ")", ":", "if", "elementNode", ".", "xmlObject", "==", "None", ":", "elementNode", ".", "attributes", ".", "update", "(", "matrix4X4", ".", "getAttributes", "(", "'matrix.'", ")", ")"...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/geometry_utilities/matrix.py#L403-L408
fluentpython/notebooks
0f6e1e8d1686743dacd9281df7c5b5921812010a
18b-async-await/charfinder/charfinder.py
python
UnicodeNameIndex.get_descriptions
(self, chars)
[]
def get_descriptions(self, chars): for char in chars: yield self.describe(char)
[ "def", "get_descriptions", "(", "self", ",", "chars", ")", ":", "for", "char", "in", "chars", ":", "yield", "self", ".", "describe", "(", "char", ")" ]
https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/18b-async-await/charfinder/charfinder.py#L189-L191
GoogleCloudPlatform/compute-image-packages
cf4b33214f770da2299923a5fa73d3d95f66ec35
packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_config.py
python
InstanceConfig.WriteConfig
(self)
Write the config values to the instance defaults file.
Write the config values to the instance defaults file.
[ "Write", "the", "config", "values", "to", "the", "instance", "defaults", "file", "." ]
def WriteConfig(self): """Write the config values to the instance defaults file.""" super(InstanceConfig, self).WriteConfig(config_file=self.instance_config)
[ "def", "WriteConfig", "(", "self", ")", ":", "super", "(", "InstanceConfig", ",", "self", ")", ".", "WriteConfig", "(", "config_file", "=", "self", ".", "instance_config", ")" ]
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/cf4b33214f770da2299923a5fa73d3d95f66ec35/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_config.py#L159-L161
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/noarch/OpenSSL/crypto.py
python
Revoked.set_reason
(self, reason)
Set the reason of this revocation. If :py:data:`reason` is :py:const:`None`, delete the reason instead. :param reason: The reason string. :type reason: :py:class:`bytes` or :py:class:`NoneType` :return: :py:const:`None` .. seealso:: :py:meth:`all_reasons`, which ...
Set the reason of this revocation.
[ "Set", "the", "reason", "of", "this", "revocation", "." ]
def set_reason(self, reason): """ Set the reason of this revocation. If :py:data:`reason` is :py:const:`None`, delete the reason instead. :param reason: The reason string. :type reason: :py:class:`bytes` or :py:class:`NoneType` :return: :py:const:`None` .. see...
[ "def", "set_reason", "(", "self", ",", "reason", ")", ":", "if", "reason", "is", "None", ":", "self", ".", "_delete_reason", "(", ")", "elif", "not", "isinstance", "(", "reason", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"reason must be None or ...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/noarch/OpenSSL/crypto.py#L1793-L1834
enthought/traits
d22ce1f096e2a6f87c78d7f1bb5bf0abab1a18ff
traits/etsconfig/etsconfig.py
python
ETSConfig._initialize_toolkit
(self)
return toolkit
Initializes the toolkit.
Initializes the toolkit.
[ "Initializes", "the", "toolkit", "." ]
def _initialize_toolkit(self): """ Initializes the toolkit. """ if self._toolkit is not None: toolkit = self._toolkit else: toolkit = os.environ.get("ETS_TOOLKIT", "") return toolkit
[ "def", "_initialize_toolkit", "(", "self", ")", ":", "if", "self", ".", "_toolkit", "is", "not", "None", ":", "toolkit", "=", "self", ".", "_toolkit", "else", ":", "toolkit", "=", "os", ".", "environ", ".", "get", "(", "\"ETS_TOOLKIT\"", ",", "\"\"", "...
https://github.com/enthought/traits/blob/d22ce1f096e2a6f87c78d7f1bb5bf0abab1a18ff/traits/etsconfig/etsconfig.py#L440-L450
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/spread/pb.py
python
RemoteReference.jellyFor
(self, jellier)
If I am being sent back to where I came from, serialize as a local backreference.
If I am being sent back to where I came from, serialize as a local backreference.
[ "If", "I", "am", "being", "sent", "back", "to", "where", "I", "came", "from", "serialize", "as", "a", "local", "backreference", "." ]
def jellyFor(self, jellier): """If I am being sent back to where I came from, serialize as a local backreference. """ if jellier.invoker: assert self.broker == jellier.invoker, "Can't send references to brokers other than their own." return "local", self.luid else...
[ "def", "jellyFor", "(", "self", ",", "jellier", ")", ":", "if", "jellier", ".", "invoker", ":", "assert", "self", ".", "broker", "==", "jellier", ".", "invoker", ",", "\"Can't send references to brokers other than their own.\"", "return", "\"local\"", ",", "self",...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/spread/pb.py#L299-L306
javipalanca/spade
6a857c2ae0a86b3bdfd20ccfcd28a11e1c6db81e
spade/behaviour.py
python
CyclicBehaviour.exit_code
(self)
Returns the exit_code of the behaviour. It only works when the behaviour is done or killed, otherwise it raises an exception. Returns: object: the exit code of the behaviour Raises: BehaviourNotFinishedException: if the behaviour is not yet finished
Returns the exit_code of the behaviour. It only works when the behaviour is done or killed, otherwise it raises an exception.
[ "Returns", "the", "exit_code", "of", "the", "behaviour", ".", "It", "only", "works", "when", "the", "behaviour", "is", "done", "or", "killed", "otherwise", "it", "raises", "an", "exception", "." ]
def exit_code(self) -> Any: """ Returns the exit_code of the behaviour. It only works when the behaviour is done or killed, otherwise it raises an exception. Returns: object: the exit code of the behaviour Raises: BehaviourNotFinishedException: if ...
[ "def", "exit_code", "(", "self", ")", "->", "Any", ":", "if", "self", ".", "_done", "(", ")", "or", "self", ".", "is_killed", "(", ")", ":", "return", "self", ".", "_exit_code", "else", ":", "raise", "BehaviourNotFinishedException" ]
https://github.com/javipalanca/spade/blob/6a857c2ae0a86b3bdfd20ccfcd28a11e1c6db81e/spade/behaviour.py#L163-L179
jwasham/code-catalog-python
c8645a1058b970206e688bfcb1782c18c64bcc00
catalog/suggested/tree/expression_tree.py
python
ExpressionTree._evaluate_recur
(self, p)
Return the numeric result of subtree rooted at p.
Return the numeric result of subtree rooted at p.
[ "Return", "the", "numeric", "result", "of", "subtree", "rooted", "at", "p", "." ]
def _evaluate_recur(self, p): """Return the numeric result of subtree rooted at p.""" if self.is_leaf(p): return float(p.element()) # we assume element is numeric else: op = p.element() left_val = self._evaluate_recur(self.left(p)) right_val = sel...
[ "def", "_evaluate_recur", "(", "self", ",", "p", ")", ":", "if", "self", ".", "is_leaf", "(", "p", ")", ":", "return", "float", "(", "p", ".", "element", "(", ")", ")", "# we assume element is numeric", "else", ":", "op", "=", "p", ".", "element", "(...
https://github.com/jwasham/code-catalog-python/blob/c8645a1058b970206e688bfcb1782c18c64bcc00/catalog/suggested/tree/expression_tree.py#L47-L62
kbandla/ImmunityDebugger
2abc03fb15c8f3ed0914e1175c4d8933977c73e3
1.84/Libs/librecognition.py
python
FunctionRecognition._searchFunctionByHeuristic
(self, search, functionhash=None, firstcallhash=None, exact=None, heuristic = 90, module = None, firstbb = None)
return poss_return
Search memory to find a function that fullfit the options. @type search: STRING @param search: searchCommand string to make the first selection @type functionhash: STRING @param functionhash: the primary function hash (use makeFunctionHash to generate this value) ...
Search memory to find a function that fullfit the options. @type search: STRING @param search: searchCommand string to make the first selection @type functionhash: STRING @param functionhash: the primary function hash (use makeFunctionHash to generate this value)
[ "Search", "memory", "to", "find", "a", "function", "that", "fullfit", "the", "options", ".", "@type", "search", ":", "STRING", "@param", "search", ":", "searchCommand", "string", "to", "make", "the", "first", "selection", "@type", "functionhash", ":", "STRING"...
def _searchFunctionByHeuristic(self, search, functionhash=None, firstcallhash=None, exact=None, heuristic = 90, module = None, firstbb = None): """ Search memory to find a function that fullfit the options. @type search: STRING @param search: searchCommand string to make the fi...
[ "def", "_searchFunctionByHeuristic", "(", "self", ",", "search", ",", "functionhash", "=", "None", ",", "firstcallhash", "=", "None", ",", "exact", "=", "None", ",", "heuristic", "=", "90", ",", "module", "=", "None", ",", "firstbb", "=", "None", ")", ":...
https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.84/Libs/librecognition.py#L380-L480
trent-b/iterative-stratification
cf140d6bb56c761c73fd75c2230ddea68be08d9d
iterstrat/ml_stratifiers.py
python
MultilabelStratifiedShuffleSplit.split
(self, X, y, groups=None)
return super(MultilabelStratifiedShuffleSplit, self).split(X, y, groups)
Generate indices to split data into training and test set. Parameters ---------- X : array-like, shape (n_samples, n_features) Training data, where n_samples is the number of samples and n_features is the number of features. Note that providing ``y`` is suffic...
Generate indices to split data into training and test set. Parameters ---------- X : array-like, shape (n_samples, n_features) Training data, where n_samples is the number of samples and n_features is the number of features. Note that providing ``y`` is suffic...
[ "Generate", "indices", "to", "split", "data", "into", "training", "and", "test", "set", ".", "Parameters", "----------", "X", ":", "array", "-", "like", "shape", "(", "n_samples", "n_features", ")", "Training", "data", "where", "n_samples", "is", "the", "num...
def split(self, X, y, groups=None): """Generate indices to split data into training and test set. Parameters ---------- X : array-like, shape (n_samples, n_features) Training data, where n_samples is the number of samples and n_features is the number of features. ...
[ "def", "split", "(", "self", ",", "X", ",", "y", ",", "groups", "=", "None", ")", ":", "y", "=", "check_array", "(", "y", ",", "ensure_2d", "=", "False", ",", "dtype", "=", "None", ")", "return", "super", "(", "MultilabelStratifiedShuffleSplit", ",", ...
https://github.com/trent-b/iterative-stratification/blob/cf140d6bb56c761c73fd75c2230ddea68be08d9d/iterstrat/ml_stratifiers.py#L358-L386
napari/napari
dbf4158e801fa7a429de8ef1cdee73bf6d64c61e
napari/utils/colormaps/colormap_utils.py
python
ensure_colormap
(colormap: ValidColormapArg)
return AVAILABLE_COLORMAPS[name]
Accept any valid colormap argument, and return Colormap, or raise. Adds any new colormaps to AVAILABLE_COLORMAPS in the process, except for custom unnamed colormaps created from color values. Parameters ---------- colormap : ValidColormapArg See ValidColormapArg for supported input types. ...
Accept any valid colormap argument, and return Colormap, or raise.
[ "Accept", "any", "valid", "colormap", "argument", "and", "return", "Colormap", "or", "raise", "." ]
def ensure_colormap(colormap: ValidColormapArg) -> Colormap: """Accept any valid colormap argument, and return Colormap, or raise. Adds any new colormaps to AVAILABLE_COLORMAPS in the process, except for custom unnamed colormaps created from color values. Parameters ---------- colormap : Valid...
[ "def", "ensure_colormap", "(", "colormap", ":", "ValidColormapArg", ")", "->", "Colormap", ":", "with", "AVAILABLE_COLORMAPS_LOCK", ":", "if", "isinstance", "(", "colormap", ",", "str", ")", ":", "name", "=", "colormap", "if", "name", "not", "in", "AVAILABLE_C...
https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/utils/colormaps/colormap_utils.py#L492-L641
facebookresearch/hydra
9b2f4d54b328d1551aa70a241a1d638cbe046367
hydra/core/override_parser/overrides_visitor.py
python
HydraErrorListener.syntaxError
( self, recognizer: Any, offending_symbol: Any, line: Any, column: Any, msg: Any, e: Any, )
[]
def syntaxError( self, recognizer: Any, offending_symbol: Any, line: Any, column: Any, msg: Any, e: Any, ) -> None: if msg is not None: raise HydraException(msg) from e else: raise HydraException(str(e)) from e
[ "def", "syntaxError", "(", "self", ",", "recognizer", ":", "Any", ",", "offending_symbol", ":", "Any", ",", "line", ":", "Any", ",", "column", ":", "Any", ",", "msg", ":", "Any", ",", "e", ":", "Any", ",", ")", "->", "None", ":", "if", "msg", "is...
https://github.com/facebookresearch/hydra/blob/9b2f4d54b328d1551aa70a241a1d638cbe046367/hydra/core/override_parser/overrides_visitor.py#L362-L374
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/fsmt/modeling_fsmt.py
python
make_padding_mask
(input_ids, padding_idx=1)
return padding_mask
True for pad tokens
True for pad tokens
[ "True", "for", "pad", "tokens" ]
def make_padding_mask(input_ids, padding_idx=1): """True for pad tokens""" padding_mask = input_ids.eq(padding_idx) if not padding_mask.any(): padding_mask = None return padding_mask
[ "def", "make_padding_mask", "(", "input_ids", ",", "padding_idx", "=", "1", ")", ":", "padding_mask", "=", "input_ids", ".", "eq", "(", "padding_idx", ")", "if", "not", "padding_mask", ".", "any", "(", ")", ":", "padding_mask", "=", "None", "return", "padd...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/fsmt/modeling_fsmt.py#L379-L384
autotest/autotest
4614ae5f550cc888267b9a419e4b90deb54f8fae
utils/external_packages.py
python
ExternalPackage._build_and_install_current_dir_setupegg_py
(self, install_dir)
return self._install_from_egg(install_dir, egg_path)
For use as a _build_and_install_current_dir implementation.
For use as a _build_and_install_current_dir implementation.
[ "For", "use", "as", "a", "_build_and_install_current_dir", "implementation", "." ]
def _build_and_install_current_dir_setupegg_py(self, install_dir): """For use as a _build_and_install_current_dir implementation.""" egg_path = self._build_egg_using_setup_py(setup_py='setupegg.py') if not egg_path: return False return self._install_from_egg(install_dir, egg_...
[ "def", "_build_and_install_current_dir_setupegg_py", "(", "self", ",", "install_dir", ")", ":", "egg_path", "=", "self", ".", "_build_egg_using_setup_py", "(", "setup_py", "=", "'setupegg.py'", ")", "if", "not", "egg_path", ":", "return", "False", "return", "self", ...
https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/utils/external_packages.py#L184-L189
BrewPi/brewpi-script
85f693ab5e3395cd10cc2d991ebcddc933c7d5cd
brewpiVersion.py
python
AvrInfo.toString
(self)
[]
def toString(self): if self.version: return str(self.version) else: return "0.0.0"
[ "def", "toString", "(", "self", ")", ":", "if", "self", ".", "version", ":", "return", "str", "(", "self", ".", "version", ")", "else", ":", "return", "\"0.0.0\"" ]
https://github.com/BrewPi/brewpi-script/blob/85f693ab5e3395cd10cc2d991ebcddc933c7d5cd/brewpiVersion.py#L160-L164
ramonhagenaars/jsons
a5150cdd2704e83fe5f8798822a1c901b54dcb1c
jsons/deserializers/default_timedelta.py
python
default_timedelta_deserializer
(obj: float, cls: type = float, **kwargs)
return timedelta(seconds=obj)
Deserialize a float to a timedelta instance. :param obj: the float that is to be deserialized. :param cls: not used. :param kwargs: not used. :return: a ``datetime.timedelta`` instance.
Deserialize a float to a timedelta instance. :param obj: the float that is to be deserialized. :param cls: not used. :param kwargs: not used. :return: a ``datetime.timedelta`` instance.
[ "Deserialize", "a", "float", "to", "a", "timedelta", "instance", ".", ":", "param", "obj", ":", "the", "float", "that", "is", "to", "be", "deserialized", ".", ":", "param", "cls", ":", "not", "used", ".", ":", "param", "kwargs", ":", "not", "used", "...
def default_timedelta_deserializer(obj: float, cls: type = float, **kwargs) -> timedelta: """ Deserialize a float to a timedelta instance. :param obj: the float that is to be deserialized. :param cls: not used. :param kwargs: not ...
[ "def", "default_timedelta_deserializer", "(", "obj", ":", "float", ",", "cls", ":", "type", "=", "float", ",", "*", "*", "kwargs", ")", "->", "timedelta", ":", "return", "timedelta", "(", "seconds", "=", "obj", ")" ]
https://github.com/ramonhagenaars/jsons/blob/a5150cdd2704e83fe5f8798822a1c901b54dcb1c/jsons/deserializers/default_timedelta.py#L4-L14
brendano/tweetmotif
1b0b1e3a941745cd5a26eba01f554688b7c4b27e
everything_else/djfrontend/django-1.0.2/core/management/__init__.py
python
load_command_class
(app_name, name)
return getattr(__import__('%s.management.commands.%s' % (app_name, name), {}, {}, ['Command']), 'Command')()
Given a command name and an application name, returns the Command class instance. All errors raised by the import process (ImportError, AttributeError) are allowed to propagate.
Given a command name and an application name, returns the Command class instance. All errors raised by the import process (ImportError, AttributeError) are allowed to propagate.
[ "Given", "a", "command", "name", "and", "an", "application", "name", "returns", "the", "Command", "class", "instance", ".", "All", "errors", "raised", "by", "the", "import", "process", "(", "ImportError", "AttributeError", ")", "are", "allowed", "to", "propaga...
def load_command_class(app_name, name): """ Given a command name and an application name, returns the Command class instance. All errors raised by the import process (ImportError, AttributeError) are allowed to propagate. """ return getattr(__import__('%s.management.commands.%s' % (app_name, nam...
[ "def", "load_command_class", "(", "app_name", ",", "name", ")", ":", "return", "getattr", "(", "__import__", "(", "'%s.management.commands.%s'", "%", "(", "app_name", ",", "name", ")", ",", "{", "}", ",", "{", "}", ",", "[", "'Command'", "]", ")", ",", ...
https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/core/management/__init__.py#L60-L67
liuyubobobo/Play-with-Linear-Algebra
e86175adb908b03756618fbeeeadb448a3551321
07-Elemental-Matrices-and-The-Properties-of-Inversion/02-Implement-Inverse-of-Matrix/playLA/Matrix.py
python
Matrix.__mul__
(self, k)
return Matrix([[e * k for e in self.row_vector(i)] for i in range(self.row_num())])
返回矩阵的数量乘结果: self * k
返回矩阵的数量乘结果: self * k
[ "返回矩阵的数量乘结果", ":", "self", "*", "k" ]
def __mul__(self, k): """返回矩阵的数量乘结果: self * k""" return Matrix([[e * k for e in self.row_vector(i)] for i in range(self.row_num())])
[ "def", "__mul__", "(", "self", ",", "k", ")", ":", "return", "Matrix", "(", "[", "[", "e", "*", "k", "for", "e", "in", "self", ".", "row_vector", "(", "i", ")", "]", "for", "i", "in", "range", "(", "self", ".", "row_num", "(", ")", ")", "]", ...
https://github.com/liuyubobobo/Play-with-Linear-Algebra/blob/e86175adb908b03756618fbeeeadb448a3551321/07-Elemental-Matrices-and-The-Properties-of-Inversion/02-Implement-Inverse-of-Matrix/playLA/Matrix.py#L56-L59
facebookresearch/EmpatheticDialogues
9649114c71e1af32189a3973b3598dc311297560
retrieval_train.py
python
validate
( epoch, model, data_loader, max_exs=100000, is_test=False, nb_candidates=100, shuffled_str="shuffled", )
return 10
[]
def validate( epoch, model, data_loader, max_exs=100000, is_test=False, nb_candidates=100, shuffled_str="shuffled", ): model.eval() examples = 0 eval_start = time.time() sum_losses = 0 n_losses = 0 correct = 0 all_context = [] all_cands = [] n_skipped = 0 ...
[ "def", "validate", "(", "epoch", ",", "model", ",", "data_loader", ",", "max_exs", "=", "100000", ",", "is_test", "=", "False", ",", "nb_candidates", "=", "100", ",", "shuffled_str", "=", "\"shuffled\"", ",", ")", ":", "model", ".", "eval", "(", ")", "...
https://github.com/facebookresearch/EmpatheticDialogues/blob/9649114c71e1af32189a3973b3598dc311297560/retrieval_train.py#L88-L160
spectacles/CodeComplice
8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62
libs/SilverCity/HTMLGenerator.py
python
SimpleHTMLGenerator.__init__
(self, state_prefix)
[]
def __init__(self, state_prefix): self.css_classes = {} for constant in Utils.list_states(state_prefix): self.css_classes[getattr(ScintillaConstants, constant)] = \ generate_css_name(constant)
[ "def", "__init__", "(", "self", ",", "state_prefix", ")", ":", "self", ".", "css_classes", "=", "{", "}", "for", "constant", "in", "Utils", ".", "list_states", "(", "state_prefix", ")", ":", "self", ".", "css_classes", "[", "getattr", "(", "ScintillaConsta...
https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/SilverCity/HTMLGenerator.py#L60-L64
nadineproject/nadine
c41c8ef7ffe18f1853029c97eecc329039b4af6c
nadine/templatetags/list_tags.py
python
LoopCommaNode.render
(self, context)
[]
def render(self, context): try: last = self.for_last.resolve(context) if last: return '' first = self.for_first.resolve(context) if last and first: return '' return ', ' except template.VariableDoesNotExist: ...
[ "def", "render", "(", "self", ",", "context", ")", ":", "try", ":", "last", "=", "self", ".", "for_last", ".", "resolve", "(", "context", ")", "if", "last", ":", "return", "''", "first", "=", "self", ".", "for_first", ".", "resolve", "(", "context", ...
https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/nadine/templatetags/list_tags.py#L19-L30
tensorflow/tensor2tensor
2a33b152d7835af66a6d20afe7961751047e28dd
tensor2tensor/rl/envs/simulated_batch_env.py
python
SimulatedBatchEnv.observ
(self)
return self._observ.read_value()
Access the variable holding the current observation.
Access the variable holding the current observation.
[ "Access", "the", "variable", "holding", "the", "current", "observation", "." ]
def observ(self): """Access the variable holding the current observation.""" return self._observ.read_value()
[ "def", "observ", "(", "self", ")", ":", "return", "self", ".", "_observ", ".", "read_value", "(", ")" ]
https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/rl/envs/simulated_batch_env.py#L262-L264
datawire/forge
d501be4571dcef5691804c7db7008ee877933c8d
forge/match.py
python
match
(*pattern)
return decorator
[]
def match(*pattern): def decorator(function): namespace = inspect.currentframe().f_back.f_locals return _decorate(namespace, function, pattern) return decorator
[ "def", "match", "(", "*", "pattern", ")", ":", "def", "decorator", "(", "function", ")", ":", "namespace", "=", "inspect", ".", "currentframe", "(", ")", ".", "f_back", ".", "f_locals", "return", "_decorate", "(", "namespace", ",", "function", ",", "patt...
https://github.com/datawire/forge/blob/d501be4571dcef5691804c7db7008ee877933c8d/forge/match.py#L518-L522
timesler/facenet-pytorch
555aa4bec20ca3e7c2ead14e7e39d5bbce203e4b
models/utils/detect_face.py
python
batched_nms_numpy
(boxes, scores, idxs, threshold, method)
return torch.as_tensor(keep, dtype=torch.long, device=device)
[]
def batched_nms_numpy(boxes, scores, idxs, threshold, method): device = boxes.device if boxes.numel() == 0: return torch.empty((0,), dtype=torch.int64, device=device) # strategy: in order to perform NMS independently per class. # we add an offset to all the boxes. The offset is dependent # o...
[ "def", "batched_nms_numpy", "(", "boxes", ",", "scores", ",", "idxs", ",", "threshold", ",", "method", ")", ":", "device", "=", "boxes", ".", "device", "if", "boxes", ".", "numel", "(", ")", "==", "0", ":", "return", "torch", ".", "empty", "(", "(", ...
https://github.com/timesler/facenet-pytorch/blob/555aa4bec20ca3e7c2ead14e7e39d5bbce203e4b/models/utils/detect_face.py#L260-L274
xlwings/xlwings
44395c4d18b46f76249279b7d0965e640291499c
xlwings/main.py
python
Book.to_pdf
(self, path=None, include=None, exclude=None, layout=None, exclude_start_string='#', show=False)
Exports the whole Excel workbook or a subset of the sheets to a PDF file. If you want to print hidden sheets, you will need to list them explicitely under ``include``. Parameters ---------- path : str or path-like object, default None Path to the PDF file, defaults to the sa...
Exports the whole Excel workbook or a subset of the sheets to a PDF file. If you want to print hidden sheets, you will need to list them explicitely under ``include``.
[ "Exports", "the", "whole", "Excel", "workbook", "or", "a", "subset", "of", "the", "sheets", "to", "a", "PDF", "file", ".", "If", "you", "want", "to", "print", "hidden", "sheets", "you", "will", "need", "to", "list", "them", "explicitely", "under", "inclu...
def to_pdf(self, path=None, include=None, exclude=None, layout=None, exclude_start_string='#', show=False): """ Exports the whole Excel workbook or a subset of the sheets to a PDF file. If you want to print hidden sheets, you will need to list them explicitely under ``include``. Paramet...
[ "def", "to_pdf", "(", "self", ",", "path", "=", "None", ",", "include", "=", "None", ",", "exclude", "=", "None", ",", "layout", "=", "None", ",", "exclude_start_string", "=", "'#'", ",", "show", "=", "False", ")", ":", "report_path", "=", "utils", "...
https://github.com/xlwings/xlwings/blob/44395c4d18b46f76249279b7d0965e640291499c/xlwings/main.py#L946-L1046
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/hqadmin/views/users.py
python
SuperuserManagement.page_context
(self)
return { 'form': SuperuserManagementForm(*args), 'users': augmented_superusers(), }
[]
def page_context(self): # only staff can toggle is_staff can_toggle_is_staff = self.request.user.is_staff # render validation errors if rendered after POST args = [can_toggle_is_staff, self.request.POST] if self.request.POST else [can_toggle_is_staff] return { 'form':...
[ "def", "page_context", "(", "self", ")", ":", "# only staff can toggle is_staff", "can_toggle_is_staff", "=", "self", ".", "request", ".", "user", ".", "is_staff", "# render validation errors if rendered after POST", "args", "=", "[", "can_toggle_is_staff", ",", "self", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/hqadmin/views/users.py#L80-L88
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/suds/client.py
python
ServiceSelector.__getitem__
(self, name)
return self.__find(name)
Provides selection of the I{service} by name (string) or index (integer). In cases where only (1) service is defined or a I{default} has been specified, the request is forwarded to the L{PortSelector}. @param name: The name (or index) of a service. @type name: (int|str) ...
Provides selection of the I{service} by name (string) or index (integer). In cases where only (1) service is defined or a I{default} has been specified, the request is forwarded to the L{PortSelector}.
[ "Provides", "selection", "of", "the", "I", "{", "service", "}", "by", "name", "(", "string", ")", "or", "index", "(", "integer", ")", ".", "In", "cases", "where", "only", "(", "1", ")", "service", "is", "defined", "or", "a", "I", "{", "default", "}...
def __getitem__(self, name): """ Provides selection of the I{service} by name (string) or index (integer). In cases where only (1) service is defined or a I{default} has been specified, the request is forwarded to the L{PortSelector}. @param name: The name (or index) of...
[ "def", "__getitem__", "(", "self", ",", "name", ")", ":", "if", "len", "(", "self", ".", "__services", ")", "==", "1", ":", "port", "=", "self", ".", "__find", "(", "0", ")", "return", "port", "[", "name", "]", "default", "=", "self", ".", "__ds"...
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/suds/client.py#L301-L319
kbandla/ImmunityDebugger
2abc03fb15c8f3ed0914e1175c4d8933977c73e3
1.85/Libs/immlib.py
python
Debugger.makeFunctionHashHeuristic
(self, address, compressed = False, followCalls = True, data="")
return FunctionRecognition.makeFunctionHashHeuristic(address, compressed, followCalls)
@type address: DWORD @param address: address of the function to hash @type compressed: Boolean @param compressed: return a compressed base64 representation or the raw data @type followCalls: Boolean @param followCalls: follow the first call in a single ba...
@type address: DWORD @param address: address of the function to hash
[ "@type", "address", ":", "DWORD", "@param", "address", ":", "address", "of", "the", "function", "to", "hash" ]
def makeFunctionHashHeuristic(self, address, compressed = False, followCalls = True, data=""): """ @type address: DWORD @param address: address of the function to hash @type compressed: Boolean @param compressed: return a compressed base64 representation or the...
[ "def", "makeFunctionHashHeuristic", "(", "self", ",", "address", ",", "compressed", "=", "False", ",", "followCalls", "=", "True", ",", "data", "=", "\"\"", ")", ":", "recon", "=", "FunctionRecognition", "(", "self", ",", "data", ")", "return", "FunctionReco...
https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.85/Libs/immlib.py#L2983-L3007
DasIch/brownie
8e29a9ceb50622e50b7209690d31203ad42ca164
brownie/terminal/progress.py
python
ProgressBar.from_string
(cls, string, writer, maxsteps=None, widgets=None)
return cls(rv, writer, maxsteps=maxsteps)
Returns a :class:`ProgressBar` from a string. The string is used as a progressbar, ``$[a-zA-Z]+`` is substituted with a widget as defined by `widgets`. ``$`` can be escaped with another ``$`` e.g. ``$$foo`` will not be substituted. Initial values as required for the :class:`Hi...
Returns a :class:`ProgressBar` from a string.
[ "Returns", "a", ":", "class", ":", "ProgressBar", "from", "a", "string", "." ]
def from_string(cls, string, writer, maxsteps=None, widgets=None): """ Returns a :class:`ProgressBar` from a string. The string is used as a progressbar, ``$[a-zA-Z]+`` is substituted with a widget as defined by `widgets`. ``$`` can be escaped with another ``$`` e.g. ``$$foo`` ...
[ "def", "from_string", "(", "cls", ",", "string", ",", "writer", ",", "maxsteps", "=", "None", ",", "widgets", "=", "None", ")", ":", "default_widgets", "=", "{", "'text'", ":", "TextWidget", ",", "'hint'", ":", "HintWidget", ",", "'percentage'", ":", "Pe...
https://github.com/DasIch/brownie/blob/8e29a9ceb50622e50b7209690d31203ad42ca164/brownie/terminal/progress.py#L429-L489
aio-libs/aiokafka
ccbcc25e9cd7dd5a980c175197f5315e0953e87c
aiokafka/producer/producer.py
python
AIOKafkaProducer.send_batch
(self, batch, topic, *, partition)
return future
Submit a BatchBuilder for publication. Arguments: batch (BatchBuilder): batch object to be published. topic (str): topic where the batch will be published. partition (int): partition where this batch will be published. Returns: asyncio.Future: object tha...
Submit a BatchBuilder for publication.
[ "Submit", "a", "BatchBuilder", "for", "publication", "." ]
async def send_batch(self, batch, topic, *, partition): """Submit a BatchBuilder for publication. Arguments: batch (BatchBuilder): batch object to be published. topic (str): topic where the batch will be published. partition (int): partition where this batch will be ...
[ "async", "def", "send_batch", "(", "self", ",", "batch", ",", "topic", ",", "*", ",", "partition", ")", ":", "# first make sure the metadata for the topic is available", "await", "self", ".", "client", ".", "_wait_on_metadata", "(", "topic", ")", "# We only validate...
https://github.com/aio-libs/aiokafka/blob/ccbcc25e9cd7dd5a980c175197f5315e0953e87c/aiokafka/producer/producer.py#L491-L520
nortikin/sverchok
7b460f01317c15f2681bfa3e337c5e7346f3711b
nodes/generator/line_mk4.py
python
SvLineNodeMK4.update_sockets
(self, context)
need to do UX transformation before updating node
need to do UX transformation before updating node
[ "need", "to", "do", "UX", "transformation", "before", "updating", "node" ]
def update_sockets(self, context): """ need to do UX transformation before updating node""" def set_hide(sock, status): if sock.hide_safe != status: sock.hide_safe = status if self.direction in (DIRECTION.op, DIRECTION.od): set_hide(self.inputs['Origin'],...
[ "def", "update_sockets", "(", "self", ",", "context", ")", ":", "def", "set_hide", "(", "sock", ",", "status", ")", ":", "if", "sock", ".", "hide_safe", "!=", "status", ":", "sock", ".", "hide_safe", "=", "status", "if", "self", ".", "direction", "in",...
https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/nodes/generator/line_mk4.py#L217-L251
owid/covid-19-data
936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92
scripts/src/cowidev/vax/incremental/philippines.py
python
Philippines.read
(self)
return pd.Series(data=self._parse_data())
[]
def read(self) -> pd.Series: return pd.Series(data=self._parse_data())
[ "def", "read", "(", "self", ")", "->", "pd", ".", "Series", ":", "return", "pd", ".", "Series", "(", "data", "=", "self", ".", "_parse_data", "(", ")", ")" ]
https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/incremental/philippines.py#L18-L19
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/core/blockstorage_client_composite_operations.py
python
BlockstorageClientCompositeOperations.create_volume_and_wait_for_state
(self, create_volume_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={})
Calls :py:func:`~oci.core.BlockstorageClient.create_volume` and waits for the :py:class:`~oci.core.models.Volume` acted upon to enter the given state(s). :param oci.core.models.CreateVolumeDetails create_volume_details: (required) Request to create a new volume. :param list[str] wa...
Calls :py:func:`~oci.core.BlockstorageClient.create_volume` and waits for the :py:class:`~oci.core.models.Volume` acted upon to enter the given state(s).
[ "Calls", ":", "py", ":", "func", ":", "~oci", ".", "core", ".", "BlockstorageClient", ".", "create_volume", "and", "waits", "for", "the", ":", "py", ":", "class", ":", "~oci", ".", "core", ".", "models", ".", "Volume", "acted", "upon", "to", "enter", ...
def create_volume_and_wait_for_state(self, create_volume_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.core.BlockstorageClient.create_volume` and waits for the :py:class:`~oci.core.models.Volume` acted upon to enter the given state(s). :pa...
[ "def", "create_volume_and_wait_for_state", "(", "self", ",", "create_volume_details", ",", "wait_for_states", "=", "[", "]", ",", "operation_kwargs", "=", "{", "}", ",", "waiter_kwargs", "=", "{", "}", ")", ":", "operation_result", "=", "self", ".", "client", ...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/core/blockstorage_client_composite_operations.py#L305-L341
apachecn/AiLearning
228b62a905a2a9bf6066f65c16d53056b10ec610
src/py3.x/dl/rnn.py
python
RecurrentLayer.calc_gradient_t
(self, t)
计算每个时刻t权重的梯度
计算每个时刻t权重的梯度
[ "计算每个时刻t权重的梯度" ]
def calc_gradient_t(self, t): ''' 计算每个时刻t权重的梯度 ''' gradient = np.dot(self.delta_list[t], self.state_list[t - 1].T) self.gradient_list[t] = gradient
[ "def", "calc_gradient_t", "(", "self", ",", "t", ")", ":", "gradient", "=", "np", ".", "dot", "(", "self", ".", "delta_list", "[", "t", "]", ",", "self", ".", "state_list", "[", "t", "-", "1", "]", ".", "T", ")", "self", ".", "gradient_list", "["...
https://github.com/apachecn/AiLearning/blob/228b62a905a2a9bf6066f65c16d53056b10ec610/src/py3.x/dl/rnn.py#L84-L90
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_tokenizer.py
python
HTMLTokenizer.selfClosingStartTagState
(self)
return True
[]
def selfClosingStartTagState(self): data = self.stream.char() if data == ">": self.currentToken["selfClosing"] = True self.emitCurrentToken() elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data"...
[ "def", "selfClosingStartTagState", "(", "self", ")", ":", "data", "=", "self", ".", "stream", ".", "char", "(", ")", "if", "data", "==", "\">\"", ":", "self", ".", "currentToken", "[", "\"selfClosing\"", "]", "=", "True", "self", ".", "emitCurrentToken", ...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_tokenizer.py#L1076-L1092
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gui/plug/_windows.py
python
PluginStatus.__load
(self, obj, list_obj, id_col)
Callback function from the "Load" button
Callback function from the "Load" button
[ "Callback", "function", "from", "the", "Load", "button" ]
def __load(self, obj, list_obj, id_col): """ Callback function from the "Load" button """ selection = list_obj.get_selection() model, node = selection.get_selected() if not node: return idv = model.get_value(node, id_col) pdata = self.__preg.get_plugin...
[ "def", "__load", "(", "self", ",", "obj", ",", "list_obj", ",", "id_col", ")", ":", "selection", "=", "list_obj", ".", "get_selection", "(", ")", "model", ",", "node", "=", "selection", ".", "get_selected", "(", ")", "if", "not", "node", ":", "return",...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/plug/_windows.py#L649-L659
quodlibet/quodlibet
e3099c89f7aa6524380795d325cc14630031886c
quodlibet/qltk/window.py
python
Window.has_close_button
(self)
return True
Returns True in case we are sure that the window decorations include a close button.
Returns True in case we are sure that the window decorations include a close button.
[ "Returns", "True", "in", "case", "we", "are", "sure", "that", "the", "window", "decorations", "include", "a", "close", "button", "." ]
def has_close_button(self): """Returns True in case we are sure that the window decorations include a close button. """ if self.get_type_hint() == Gdk.WindowTypeHint.NORMAL: return True if os.name == "nt": return True if sys.platform == "darwin"...
[ "def", "has_close_button", "(", "self", ")", ":", "if", "self", ".", "get_type_hint", "(", ")", "==", "Gdk", ".", "WindowTypeHint", ".", "NORMAL", ":", "return", "True", "if", "os", ".", "name", "==", "\"nt\"", ":", "return", "True", "if", "sys", ".", ...
https://github.com/quodlibet/quodlibet/blob/e3099c89f7aa6524380795d325cc14630031886c/quodlibet/qltk/window.py#L195-L222
guildai/guildai
1665985a3d4d788efc1a3180ca51cc417f71ca78
guild/op_util.py
python
op_cmd_for_opdef
(opdef, extra_cmd_env=None)
return op_cmd, run_attrs
Returns tuple of op cmd for opdef and associated run attrs. Some operations require additional information from the opdef, which is returned as the second element of the two-tuple.
Returns tuple of op cmd for opdef and associated run attrs.
[ "Returns", "tuple", "of", "op", "cmd", "for", "opdef", "and", "associated", "run", "attrs", "." ]
def op_cmd_for_opdef(opdef, extra_cmd_env=None): """Returns tuple of op cmd for opdef and associated run attrs. Some operations require additional information from the opdef, which is returned as the second element of the two-tuple. """ cmd_args, run_attrs = _op_cmd_args_and_run_attrs(opdef) cm...
[ "def", "op_cmd_for_opdef", "(", "opdef", ",", "extra_cmd_env", "=", "None", ")", ":", "cmd_args", ",", "run_attrs", "=", "_op_cmd_args_and_run_attrs", "(", "opdef", ")", "cmd_env", "=", "_op_cmd_env", "(", "opdef", ",", "extra_cmd_env", "or", "{", "}", ")", ...
https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/op_util.py#L1043-L1054
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/tkinter/__init__.py
python
Variable.__del__
(self)
Unset the variable in Tcl.
Unset the variable in Tcl.
[ "Unset", "the", "variable", "in", "Tcl", "." ]
def __del__(self): """Unset the variable in Tcl.""" if self._tk is None: return if self._tk.getboolean(self._tk.call("info", "exists", self._name)): self._tk.globalunsetvar(self._name) if self._tclCommands is not None: for name in self._tclCommands: ...
[ "def", "__del__", "(", "self", ")", ":", "if", "self", ".", "_tk", "is", "None", ":", "return", "if", "self", ".", "_tk", ".", "getboolean", "(", "self", ".", "_tk", ".", "call", "(", "\"info\"", ",", "\"exists\"", ",", "self", ".", "_name", ")", ...
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/__init__.py#L244-L254
wistbean/fxxkpython
88e16d79d8dd37236ba6ecd0d0ff11d63143968c
vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/packaging/specifiers.py
python
BaseSpecifier.__hash__
(self)
Returns a hash value for this Specifier like object.
Returns a hash value for this Specifier like object.
[ "Returns", "a", "hash", "value", "for", "this", "Specifier", "like", "object", "." ]
def __hash__(self): """ Returns a hash value for this Specifier like object. """
[ "def", "__hash__", "(", "self", ")", ":" ]
https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/packaging/specifiers.py#L30-L33
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
txdav/caldav/datastore/scheduling/implicit.py
python
ImplicitScheduler.doImplicitAttendee
(self)
[]
def doImplicitAttendee(self): # Check SCHEDULE-AGENT doScheduling = self.checkOrganizerScheduleAgent() if self.action == "remove": if self.calendar.hasPropertyValueInAllComponents(Property("STATUS", "CANCELLED")): log.debug("Implicit - attendee '{attendee}' is remov...
[ "def", "doImplicitAttendee", "(", "self", ")", ":", "# Check SCHEDULE-AGENT", "doScheduling", "=", "self", ".", "checkOrganizerScheduleAgent", "(", ")", "if", "self", ".", "action", "==", "\"remove\"", ":", "if", "self", ".", "calendar", ".", "hasPropertyValueInAl...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/caldav/datastore/scheduling/implicit.py#L1414-L1564
snowflakedb/snowflake-connector-python
1659ec6b78930d1f947b4eff985c891af614d86c
src/snowflake/connector/auth_idtoken.py
python
AuthByIdToken.authenticate
(self, authenticator, service_name, account, user, password)
Nothing to do here.
Nothing to do here.
[ "Nothing", "to", "do", "here", "." ]
def authenticate(self, authenticator, service_name, account, user, password): """Nothing to do here.""" pass
[ "def", "authenticate", "(", "self", ",", "authenticator", ",", "service_name", ",", "account", ",", "user", ",", "password", ")", ":", "pass" ]
https://github.com/snowflakedb/snowflake-connector-python/blob/1659ec6b78930d1f947b4eff985c891af614d86c/src/snowflake/connector/auth_idtoken.py#L26-L28
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py
python
TollFreeInstance.address_requirements
(self)
return self._properties['address_requirements']
:returns: Whether the phone number requires an Address registered with Twilio. :rtype: TollFreeInstance.AddressRequirement
:returns: Whether the phone number requires an Address registered with Twilio. :rtype: TollFreeInstance.AddressRequirement
[ ":", "returns", ":", "Whether", "the", "phone", "number", "requires", "an", "Address", "registered", "with", "Twilio", ".", ":", "rtype", ":", "TollFreeInstance", ".", "AddressRequirement" ]
def address_requirements(self): """ :returns: Whether the phone number requires an Address registered with Twilio. :rtype: TollFreeInstance.AddressRequirement """ return self._properties['address_requirements']
[ "def", "address_requirements", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'address_requirements'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py#L364-L369
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/six.py
python
add_metaclass
(metaclass)
return wrapper
Class decorator for creating a class with a metaclass.
Class decorator for creating a class with a metaclass.
[ "Class", "decorator", "for", "creating", "a", "class", "with", "a", "metaclass", "." ]
def add_metaclass(metaclass): """Class decorator for creating a class with a metaclass.""" def wrapper(cls): orig_vars = cls.__dict__.copy() slots = orig_vars.get('__slots__') if slots is not None: if isinstance(slots, str): slots = [slots] for slo...
[ "def", "add_metaclass", "(", "metaclass", ")", ":", "def", "wrapper", "(", "cls", ")", ":", "orig_vars", "=", "cls", ".", "__dict__", ".", "copy", "(", ")", "slots", "=", "orig_vars", ".", "get", "(", "'__slots__'", ")", "if", "slots", "is", "not", "...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/six.py#L812-L825
geekan/scrapy-examples
edb1cb116bd6def65a6ef01f953b58eb43e54305
misc/spider.py
python
CommonSpider.extract_items
(self, sel, rules, item)
[]
def extract_items(self, sel, rules, item): for nk, nv in rules.items(): if nk in ('__use', '__list'): continue if nk not in item: item[nk] = [] if sel.css(nv): # item[nk] += [i.extract() for i in sel.css(nv)] # W...
[ "def", "extract_items", "(", "self", ",", "sel", ",", "rules", ",", "item", ")", ":", "for", "nk", ",", "nv", "in", "rules", ".", "items", "(", ")", ":", "if", "nk", "in", "(", "'__use'", ",", "'__list'", ")", ":", "continue", "if", "nk", "not", ...
https://github.com/geekan/scrapy-examples/blob/edb1cb116bd6def65a6ef01f953b58eb43e54305/misc/spider.py#L73-L84
google/mysql-tools
02d18542735a528c4a6cca951207393383266bb9
pylib/http_server.py
python
Request.get
(self, argument_name, default_value='')
return self._qs.get(argument_name, [default_value])[0]
Get one value of a query argument by name.
Get one value of a query argument by name.
[ "Get", "one", "value", "of", "a", "query", "argument", "by", "name", "." ]
def get(self, argument_name, default_value=''): """Get one value of a query argument by name.""" return self._qs.get(argument_name, [default_value])[0]
[ "def", "get", "(", "self", ",", "argument_name", ",", "default_value", "=", "''", ")", ":", "return", "self", ".", "_qs", ".", "get", "(", "argument_name", ",", "[", "default_value", "]", ")", "[", "0", "]" ]
https://github.com/google/mysql-tools/blob/02d18542735a528c4a6cca951207393383266bb9/pylib/http_server.py#L77-L79
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/sqli/plugins/dbms/mysql/takeover.py
python
Takeover.udfSetRemotePath
(self)
[]
def udfSetRemotePath(self): self.getVersionFromBanner() banVer = kb.bannerFp["dbmsVersion"] if banVer >= "5.0.67": if self.__plugindir is None: logger.info("retrieving MySQL plugin directory absolute path") self.__plugindir = unArrayizeValue(inject.g...
[ "def", "udfSetRemotePath", "(", "self", ")", ":", "self", ".", "getVersionFromBanner", "(", ")", "banVer", "=", "kb", ".", "bannerFp", "[", "\"dbmsVersion\"", "]", "if", "banVer", ">=", "\"5.0.67\"", ":", "if", "self", ".", "__plugindir", "is", "None", ":"...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/plugins/dbms/mysql/takeover.py#L35-L82
rytilahti/python-miio
b6e53dd16fac77915426e7592e2528b78ef65190
miio/integrations/vacuum/roidmi/roidmivacuum_miot.py
python
RoidmiConsumableStatus.main_brush_left
(self)
return timedelta(minutes=self.data["main_brush_left_minutes"])
How long until the main brush should be changed.
How long until the main brush should be changed.
[ "How", "long", "until", "the", "main", "brush", "should", "be", "changed", "." ]
def main_brush_left(self) -> timedelta: """How long until the main brush should be changed.""" return timedelta(minutes=self.data["main_brush_left_minutes"])
[ "def", "main_brush_left", "(", "self", ")", "->", "timedelta", ":", "return", "timedelta", "(", "minutes", "=", "self", ".", "data", "[", "\"main_brush_left_minutes\"", "]", ")" ]
https://github.com/rytilahti/python-miio/blob/b6e53dd16fac77915426e7592e2528b78ef65190/miio/integrations/vacuum/roidmi/roidmivacuum_miot.py#L506-L508
mlflow/mlflow
364aca7daf0fcee3ec407ae0b1b16d9cb3085081
mlflow/paddle/__init__.py
python
autolog
( log_every_n_epoch=1, log_models=True, disable=False, exclusive=False, silent=False, )
Enables (or disables) and configures autologging from PaddlePaddle to MLflow. Autologging is performed when the `fit` method of `paddle.Model`_ is called. .. _paddle.Model: https://www.paddlepaddle.org.cn/documentation/docs/en/api/paddle/Model_en.html :param log_every_n_epoch: If specified, logs ...
Enables (or disables) and configures autologging from PaddlePaddle to MLflow.
[ "Enables", "(", "or", "disables", ")", "and", "configures", "autologging", "from", "PaddlePaddle", "to", "MLflow", "." ]
def autolog( log_every_n_epoch=1, log_models=True, disable=False, exclusive=False, silent=False, ): # pylint: disable=unused-argument """ Enables (or disables) and configures autologging from PaddlePaddle to MLflow. Autologging is performed when the `fit` method of `paddle.Model`_ is c...
[ "def", "autolog", "(", "log_every_n_epoch", "=", "1", ",", "log_models", "=", "True", ",", "disable", "=", "False", ",", "exclusive", "=", "False", ",", "silent", "=", "False", ",", ")", ":", "# pylint: disable=unused-argument", "import", "paddle", "from", "...
https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/paddle/__init__.py#L462-L558
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/compat/dictconfig.py
python
BaseConfigurator.configure_custom
(self, config)
return result
Configure an object with a user-supplied factory.
Configure an object with a user-supplied factory.
[ "Configure", "an", "object", "with", "a", "user", "-", "supplied", "factory", "." ]
def configure_custom(self, config): """Configure an object with a user-supplied factory.""" c = config.pop('()') if not hasattr(c, '__call__') and hasattr(types, 'ClassType') and type(c) != types.ClassType: c = self.resolve(c) props = config.pop('.', None) # Check for...
[ "def", "configure_custom", "(", "self", ",", "config", ")", ":", "c", "=", "config", ".", "pop", "(", "'()'", ")", "if", "not", "hasattr", "(", "c", ",", "'__call__'", ")", "and", "hasattr", "(", "types", ",", "'ClassType'", ")", "and", "type", "(", ...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/compat/dictconfig.py#L256-L268
vojtamolda/autodrome
3e3aa1198ac96f3c7453f9797b776239801434ae
autodrome/simulator/simulator.py
python
Simulator.setup_steam
(cls, steam_file: Path)
Setup a special Steam file This little trick of creating 'steam_appid.txt' file with the Steam AppID prevents SteamAPI_RestartAppIfNecessary(...) API call that would start a new process by forking the Steam client application over which we would have no control. Details: https://partner...
Setup a special Steam file This little trick of creating 'steam_appid.txt' file with the Steam AppID prevents SteamAPI_RestartAppIfNecessary(...) API call that would start a new process by forking the Steam client application over which we would have no control.
[ "Setup", "a", "special", "Steam", "file", "This", "little", "trick", "of", "creating", "steam_appid", ".", "txt", "file", "with", "the", "Steam", "AppID", "prevents", "SteamAPI_RestartAppIfNecessary", "(", "...", ")", "API", "call", "that", "would", "start", "...
def setup_steam(cls, steam_file: Path) -> None: """ Setup a special Steam file This little trick of creating 'steam_appid.txt' file with the Steam AppID prevents SteamAPI_RestartAppIfNecessary(...) API call that would start a new process by forking the Steam client application over which...
[ "def", "setup_steam", "(", "cls", ",", "steam_file", ":", "Path", ")", "->", "None", ":", "print", "(", "f\"Setting up Steam ID in '{steam_file}'\"", ")", "steam_file", ".", "write_text", "(", "str", "(", "cls", ".", "SteamAppID", ")", ")" ]
https://github.com/vojtamolda/autodrome/blob/3e3aa1198ac96f3c7453f9797b776239801434ae/autodrome/simulator/simulator.py#L96-L104
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/multiprocessing/__init__.py
python
Manager
()
return m
Returns a manager associated with a running server process The managers methods such as `Lock()`, `Condition()` and `Queue()` can be used to create shared objects.
Returns a manager associated with a running server process The managers methods such as `Lock()`, `Condition()` and `Queue()` can be used to create shared objects.
[ "Returns", "a", "manager", "associated", "with", "a", "running", "server", "process", "The", "managers", "methods", "such", "as", "Lock", "()", "Condition", "()", "and", "Queue", "()", "can", "be", "used", "to", "create", "shared", "objects", "." ]
def Manager(): """ Returns a manager associated with a running server process The managers methods such as `Lock()`, `Condition()` and `Queue()` can be used to create shared objects. """ from multiprocessing.managers import SyncManager m = SyncManager() m.start() return m
[ "def", "Manager", "(", ")", ":", "from", "multiprocessing", ".", "managers", "import", "SyncManager", "m", "=", "SyncManager", "(", ")", "m", ".", "start", "(", ")", "return", "m" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/multiprocessing/__init__.py#L38-L48
Alex-Fabbri/Multi-News
f6476d1f114662eb93db32e9b704b7c4fe047217
code/Hi_MAP/onmt/inputters/inputter.py
python
_getstate
(self)
return dict(self.__dict__, stoi=dict(self.stoi))
[]
def _getstate(self): return dict(self.__dict__, stoi=dict(self.stoi))
[ "def", "_getstate", "(", "self", ")", ":", "return", "dict", "(", "self", ".", "__dict__", ",", "stoi", "=", "dict", "(", "self", ".", "stoi", ")", ")" ]
https://github.com/Alex-Fabbri/Multi-News/blob/f6476d1f114662eb93db32e9b704b7c4fe047217/code/Hi_MAP/onmt/inputters/inputter.py#L23-L24
ubuntu/ubuntu-make
939668aad1f4c38ffb74cce55b3678f6fded5c71
umake/decompressor.py
python
Decompressor._one_done
(self, future)
Callback that will be called once one decompress finishes. (will be wired on the constructor)
Callback that will be called once one decompress finishes.
[ "Callback", "that", "will", "be", "called", "once", "one", "decompress", "finishes", "." ]
def _one_done(self, future): """Callback that will be called once one decompress finishes. (will be wired on the constructor) """ result = self.DecompressResult(error=None) if future.exception(): logger.error("A decompression to {} failed: {}".format(future.tag_dest...
[ "def", "_one_done", "(", "self", ",", "future", ")", ":", "result", "=", "self", ".", "DecompressResult", "(", "error", "=", "None", ")", "if", "future", ".", "exception", "(", ")", ":", "logger", ".", "error", "(", "\"A decompression to {} failed: {}\"", ...
https://github.com/ubuntu/ubuntu-make/blob/939668aad1f4c38ffb74cce55b3678f6fded5c71/umake/decompressor.py#L140-L155
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3cfg.py
python
S3Config.get_project_activity_types
(self)
return self.project.get("activity_types", False)
Use Activity Types in Activities & Projects
Use Activity Types in Activities & Projects
[ "Use", "Activity", "Types", "in", "Activities", "&", "Projects" ]
def get_project_activity_types(self): """ Use Activity Types in Activities & Projects """ return self.project.get("activity_types", False)
[ "def", "get_project_activity_types", "(", "self", ")", ":", "return", "self", ".", "project", ".", "get", "(", "\"activity_types\"", ",", "False", ")" ]
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3cfg.py#L5875-L5879
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/Django-1.11.29/django/contrib/admin/checks.py
python
ModelAdminChecks._check_save_on_top
(self, obj)
Check save_on_top is a boolean.
Check save_on_top is a boolean.
[ "Check", "save_on_top", "is", "a", "boolean", "." ]
def _check_save_on_top(self, obj): """ Check save_on_top is a boolean. """ if not isinstance(obj.save_on_top, bool): return must_be('a boolean', option='save_on_top', obj=obj, id='admin.E102') else: return []
[ "def", "_check_save_on_top", "(", "self", ",", "obj", ")", ":", "if", "not", "isinstance", "(", "obj", ".", "save_on_top", ",", "bool", ")", ":", "return", "must_be", "(", "'a boolean'", ",", "option", "=", "'save_on_top'", ",", "obj", "=", "obj", ",", ...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/contrib/admin/checks.py#L544-L551
peterdsharpe/AeroSandbox
ded68b0465f2bfdcaf4bc90abd8c91be0addcaba
aerosandbox/visualization/carpet_plot_utils.py
python
time_limit
(seconds)
Allows you to run a block of code with a timeout. This way, you can sweep through points to make a carpet plot without getting stuck on a particular point that may not terminate in a reasonable amount of time. Only runs on Linux! Usage: Attempt to set x equal to the value of a complicated func...
Allows you to run a block of code with a timeout. This way, you can sweep through points to make a carpet plot without getting stuck on a particular point that may not terminate in a reasonable amount of time.
[ "Allows", "you", "to", "run", "a", "block", "of", "code", "with", "a", "timeout", ".", "This", "way", "you", "can", "sweep", "through", "points", "to", "make", "a", "carpet", "plot", "without", "getting", "stuck", "on", "a", "particular", "point", "that"...
def time_limit(seconds): """ Allows you to run a block of code with a timeout. This way, you can sweep through points to make a carpet plot without getting stuck on a particular point that may not terminate in a reasonable amount of time. Only runs on Linux! Usage: Attempt to set x equ...
[ "def", "time_limit", "(", "seconds", ")", ":", "def", "signal_handler", "(", "signum", ",", "frame", ")", ":", "raise", "TimeoutError", "(", ")", "try", ":", "signal", ".", "signal", "(", "signal", ".", "SIGALRM", ",", "signal_handler", ")", "except", "A...
https://github.com/peterdsharpe/AeroSandbox/blob/ded68b0465f2bfdcaf4bc90abd8c91be0addcaba/aerosandbox/visualization/carpet_plot_utils.py#L13-L46
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/pyqode/core/modes/matcher.py
python
SymbolMatcherMode._match_left
(self, symbol, current_block, i, cpt)
return False
[]
def _match_left(self, symbol, current_block, i, cpt): while current_block.isValid(): data = get_block_symbol_data(self.editor, current_block) parentheses = data[symbol] for j in range(i, len(parentheses)): info = parentheses[j] if info.characte...
[ "def", "_match_left", "(", "self", ",", "symbol", ",", "current_block", ",", "i", ",", "cpt", ")", ":", "while", "current_block", ".", "isValid", "(", ")", ":", "data", "=", "get_block_symbol_data", "(", "self", ".", "editor", ",", "current_block", ")", ...
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pyqode/core/modes/matcher.py#L187-L204
ANSSI-FR/polichombr
e2dc3874ae3d78c3b496e9656c9a6d1b88ae91e1
polichombr/controllers/user.py
python
UserController.set_name
(user, name)
return True
Set's the user's complete name.
Set's the user's complete name.
[ "Set", "s", "the", "user", "s", "complete", "name", "." ]
def set_name(user, name): """ Set's the user's complete name. """ user.completename = name db.session.commit() return True
[ "def", "set_name", "(", "user", ",", "name", ")", ":", "user", ".", "completename", "=", "name", "db", ".", "session", ".", "commit", "(", ")", "return", "True" ]
https://github.com/ANSSI-FR/polichombr/blob/e2dc3874ae3d78c3b496e9656c9a6d1b88ae91e1/polichombr/controllers/user.py#L128-L134
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v2alpha1_horizontal_pod_autoscaler_status.py
python
V2alpha1HorizontalPodAutoscalerStatus.last_scale_time
(self, last_scale_time)
Sets the last_scale_time of this V2alpha1HorizontalPodAutoscalerStatus. lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, used by the autoscaler to control how often the number of pods is changed. :param last_scale_time: The last_scale_time of this V2alpha1Horizontal...
Sets the last_scale_time of this V2alpha1HorizontalPodAutoscalerStatus. lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, used by the autoscaler to control how often the number of pods is changed.
[ "Sets", "the", "last_scale_time", "of", "this", "V2alpha1HorizontalPodAutoscalerStatus", ".", "lastScaleTime", "is", "the", "last", "time", "the", "HorizontalPodAutoscaler", "scaled", "the", "number", "of", "pods", "used", "by", "the", "autoscaler", "to", "control", ...
def last_scale_time(self, last_scale_time): """ Sets the last_scale_time of this V2alpha1HorizontalPodAutoscalerStatus. lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, used by the autoscaler to control how often the number of pods is changed. :param...
[ "def", "last_scale_time", "(", "self", ",", "last_scale_time", ")", ":", "self", ".", "_last_scale_time", "=", "last_scale_time" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v2alpha1_horizontal_pod_autoscaler_status.py#L170-L179
cherrypy/cherrypy
a7983fe61f7237f2354915437b04295694100372
cherrypy/_cpreqbody.py
python
unquote_plus
(bs)
return b''.join(atoms)
Bytes version of urllib.parse.unquote_plus.
Bytes version of urllib.parse.unquote_plus.
[ "Bytes", "version", "of", "urllib", ".", "parse", ".", "unquote_plus", "." ]
def unquote_plus(bs): """Bytes version of urllib.parse.unquote_plus.""" bs = bs.replace(b'+', b' ') atoms = bs.split(b'%') for i in range(1, len(atoms)): item = atoms[i] try: pct = int(item[:2], 16) atoms[i] = bytes([pct]) + item[2:] except ValueError: ...
[ "def", "unquote_plus", "(", "bs", ")", ":", "bs", "=", "bs", ".", "replace", "(", "b'+'", ",", "b' '", ")", "atoms", "=", "bs", ".", "split", "(", "b'%'", ")", "for", "i", "in", "range", "(", "1", ",", "len", "(", "atoms", ")", ")", ":", "ite...
https://github.com/cherrypy/cherrypy/blob/a7983fe61f7237f2354915437b04295694100372/cherrypy/_cpreqbody.py#L127-L138
naver/claf
6f45b1ecca0aa2b3bcf99e79c9cb2c915ba0bf3b
claf/model/semantic_parsing/mixin.py
python
WikiSQL.make_metrics
(self, predictions)
return metrics
aggregator, select_column, conditions accuracy
aggregator, select_column, conditions accuracy
[ "aggregator", "select_column", "conditions", "accuracy" ]
def make_metrics(self, predictions): """ aggregator, select_column, conditions accuracy """ agg_accuracy, sel_accuracy, conds_accuracy = 0, 0, 0 for index, pred in predictions.items(): target = self._dataset.get_ground_truth(index) # Aggregator, Select_Column, Conditio...
[ "def", "make_metrics", "(", "self", ",", "predictions", ")", ":", "agg_accuracy", ",", "sel_accuracy", ",", "conds_accuracy", "=", "0", ",", "0", ",", "0", "for", "index", ",", "pred", "in", "predictions", ".", "items", "(", ")", ":", "target", "=", "s...
https://github.com/naver/claf/blob/6f45b1ecca0aa2b3bcf99e79c9cb2c915ba0bf3b/claf/model/semantic_parsing/mixin.py#L22-L68
zestedesavoir/zds-site
2ba922223c859984a413cc6c108a8aa4023b113e
zds/utils/templatetags/date.py
python
format_date
(value, small=False)
return date_formatter(value, tooltip=False, small=small)
Format a date to an human readable string. If ``value`` is in future it is replaced by "In the future".
Format a date to an human readable string. If ``value`` is in future it is replaced by "In the future".
[ "Format", "a", "date", "to", "an", "human", "readable", "string", ".", "If", "value", "is", "in", "future", "it", "is", "replaced", "by", "In", "the", "future", "." ]
def format_date(value, small=False): """ Format a date to an human readable string. If ``value`` is in future it is replaced by "In the future". """ return date_formatter(value, tooltip=False, small=small)
[ "def", "format_date", "(", "value", ",", "small", "=", "False", ")", ":", "return", "date_formatter", "(", "value", ",", "tooltip", "=", "False", ",", "small", "=", "small", ")" ]
https://github.com/zestedesavoir/zds-site/blob/2ba922223c859984a413cc6c108a8aa4023b113e/zds/utils/templatetags/date.py#L54-L59
quentinhardy/odat
364b94cc662dcbb95a0b28880c6a71ddfc66dd6b
Output.py
python
Output.unknownNews
(self,m)
print unknow news
print unknow news
[ "print", "unknow", "news" ]
def unknownNews(self,m): ''' print unknow news ''' m = m.encode(encoding='UTF-8',errors='ignore') formatMesg = '[+] {0}'.format(m.decode()) if self.noColor == True or TERMCOLOR_AVAILABLE == False: print(formatMesg) else : print(colored(formatMesg, 'yellow',attrs=['bold']))
[ "def", "unknownNews", "(", "self", ",", "m", ")", ":", "m", "=", "m", ".", "encode", "(", "encoding", "=", "'UTF-8'", ",", "errors", "=", "'ignore'", ")", "formatMesg", "=", "'[+] {0}'", ".", "format", "(", "m", ".", "decode", "(", ")", ")", "if", ...
https://github.com/quentinhardy/odat/blob/364b94cc662dcbb95a0b28880c6a71ddfc66dd6b/Output.py#L81-L88
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/platforms/system11.py
python
System11OverlayPlatform.a_side_busy
(self)
return self.drivers_holding_a_side or self.a_side_done_time > self.machine.clock.get_time() or self.a_side_queue
Return if A side cannot be switches off right away.
Return if A side cannot be switches off right away.
[ "Return", "if", "A", "side", "cannot", "be", "switches", "off", "right", "away", "." ]
def a_side_busy(self): """Return if A side cannot be switches off right away.""" return self.drivers_holding_a_side or self.a_side_done_time > self.machine.clock.get_time() or self.a_side_queue
[ "def", "a_side_busy", "(", "self", ")", ":", "return", "self", ".", "drivers_holding_a_side", "or", "self", ".", "a_side_done_time", ">", "self", ".", "machine", ".", "clock", ".", "get_time", "(", ")", "or", "self", ".", "a_side_queue" ]
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/system11.py#L64-L66
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/requests/hooks.py
python
dispatch_hook
(key, hooks, hook_data, **kwargs)
return hook_data
Dispatches a hook dictionary on a given piece of data.
Dispatches a hook dictionary on a given piece of data.
[ "Dispatches", "a", "hook", "dictionary", "on", "a", "given", "piece", "of", "data", "." ]
def dispatch_hook(key, hooks, hook_data, **kwargs): """Dispatches a hook dictionary on a given piece of data.""" hooks = hooks or dict() if key in hooks: hooks = hooks.get(key) if hasattr(hooks, '__call__'): hooks = [hooks] for hook in hooks: _hook_data = ...
[ "def", "dispatch_hook", "(", "key", ",", "hooks", ",", "hook_data", ",", "*", "*", "kwargs", ")", ":", "hooks", "=", "hooks", "or", "dict", "(", ")", "if", "key", "in", "hooks", ":", "hooks", "=", "hooks", ".", "get", "(", "key", ")", "if", "hasa...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/requests/hooks.py#L29-L45
benknight/hue-alfred-workflow
4447ba61116caf4a448b50c4bfb866565d66d81e
logic/packages/requests/adapters.py
python
HTTPAdapter.build_response
(self, req, resp)
return response
Builds a :class:`Response <requests.Response>` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>` :param req: The :class:`PreparedRequest <PreparedRequest>` used ...
Builds a :class:`Response <requests.Response>` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
[ "Builds", "a", ":", "class", ":", "Response", "<requests", ".", "Response", ">", "object", "from", "a", "urllib3", "response", ".", "This", "should", "not", "be", "called", "from", "user", "code", "and", "is", "only", "exposed", "for", "use", "when", "su...
def build_response(self, req, resp): """Builds a :class:`Response <requests.Response>` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>` :param req: The ...
[ "def", "build_response", "(", "self", ",", "req", ",", "resp", ")", ":", "response", "=", "Response", "(", ")", "# Fallback to None if there's no status_code, for whatever reason.", "response", ".", "status_code", "=", "getattr", "(", "resp", ",", "'status'", ",", ...
https://github.com/benknight/hue-alfred-workflow/blob/4447ba61116caf4a448b50c4bfb866565d66d81e/logic/packages/requests/adapters.py#L139-L173
quantumlib/Cirq
89f88b01d69222d3f1ec14d649b7b3a85ed9211f
cirq-ionq/cirq_ionq/results.py
python
SimulatorResult.probabilities
(self, key: Optional[str] = None)
return result
Returns the probabilities of the measurement results. If a key parameter is supplied, these are the probabilities for the measurement results for the qubits measured by the measurement gate with that key. If no key is given, these are the measurement results from measuring all qubits in the ci...
Returns the probabilities of the measurement results.
[ "Returns", "the", "probabilities", "of", "the", "measurement", "results", "." ]
def probabilities(self, key: Optional[str] = None) -> Dict[int, float]: """Returns the probabilities of the measurement results. If a key parameter is supplied, these are the probabilities for the measurement results for the qubits measured by the measurement gate with that key. If no key is g...
[ "def", "probabilities", "(", "self", ",", "key", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Dict", "[", "int", ",", "float", "]", ":", "if", "key", "is", "None", ":", "return", "self", ".", "_probabilities", "if", "not", "key", "in"...
https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-ionq/cirq_ionq/results.py#L191-L227
inspurer/WorkAttendanceSystem
1221e2d67bdf5bb15fe99517cc3ded58ccb066df
V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/lockfile/__init__.py
python
locked
(path, timeout=None)
return decor
Decorator which enables locks for decorated function. Arguments: - path: path for lockfile. - timeout (optional): Timeout for acquiring lock. Usage: @locked('/var/run/myname', timeout=0) def myname(...): ...
Decorator which enables locks for decorated function.
[ "Decorator", "which", "enables", "locks", "for", "decorated", "function", "." ]
def locked(path, timeout=None): """Decorator which enables locks for decorated function. Arguments: - path: path for lockfile. - timeout (optional): Timeout for acquiring lock. Usage: @locked('/var/run/myname', timeout=0) def myname(...): ... """ def decor...
[ "def", "locked", "(", "path", ",", "timeout", "=", "None", ")", ":", "def", "decor", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lock", "=", "F...
https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/lockfile/__init__.py#L315-L337
tryton/trytond
9fc68232536d0707b73614eab978bd6f813e3677
trytond/ir/model.py
python
ModelButton.get_view_attributes
(cls, model, name)
return attributes
Return the view attributes of the named button of the model
Return the view attributes of the named button of the model
[ "Return", "the", "view", "attributes", "of", "the", "named", "button", "of", "the", "model" ]
def get_view_attributes(cls, model, name): "Return the view attributes of the named button of the model" key = (model, name, Transaction().language) attributes = cls._view_attributes_cache.get(key) if attributes is not None: return attributes buttons = cls.search([ ...
[ "def", "get_view_attributes", "(", "cls", ",", "model", ",", "name", ")", ":", "key", "=", "(", "model", ",", "name", ",", "Transaction", "(", ")", ".", "language", ")", "attributes", "=", "cls", ".", "_view_attributes_cache", ".", "get", "(", "key", "...
https://github.com/tryton/trytond/blob/9fc68232536d0707b73614eab978bd6f813e3677/trytond/ir/model.py#L981-L1001
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/protocols/htb.py
python
IBucketFilter.getBucketFor
(*somethings, **some_kw)
I'll give you a bucket for something. @returntype: L{Bucket}
I'll give you a bucket for something.
[ "I", "ll", "give", "you", "a", "bucket", "for", "something", "." ]
def getBucketFor(*somethings, **some_kw): """I'll give you a bucket for something. @returntype: L{Bucket} """
[ "def", "getBucketFor", "(", "*", "somethings", ",", "*", "*", "some_kw", ")", ":" ]
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/protocols/htb.py#L100-L104
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/idlelib/rpc.py
python
RPCServer.handle_error
(self, request, client_address)
Override TCPServer method Error message goes to __stderr__. No error message if exiting normally or socket raised EOF. Other exceptions not handled in server code will cause os._exit.
Override TCPServer method
[ "Override", "TCPServer", "method" ]
def handle_error(self, request, client_address): """Override TCPServer method Error message goes to __stderr__. No error message if exiting normally or socket raised EOF. Other exceptions not handled in server code will cause os._exit. """ try: raise ...
[ "def", "handle_error", "(", "self", ",", "request", ",", "client_address", ")", ":", "try", ":", "raise", "except", "SystemExit", ":", "raise", "except", ":", "erf", "=", "sys", ".", "__stderr__", "print", "(", "'\\n'", "+", "'-'", "*", "40", ",", "fil...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/idlelib/rpc.py#L94-L116
qibinlou/SinaWeibo-Emotion-Classification
f336fc104abd68b0ec4180fe2ed80fafe49cb790
nltk/corpus/reader/tagged.py
python
TaggedCorpusReader.tagged_paras
(self, fileids=None, simplify_tags=False)
return concat([TaggedCorpusView(fileid, enc, True, True, True, self._sep, self._word_tokenizer, self._sent_tokenizer, self._para_block_reader, ...
:return: the given file(s) as a list of paragraphs, each encoded as a list of sentences, which are in turn encoded as lists of ``(word,tag)`` tuples. :rtype: list(list(list(tuple(str,str))))
:return: the given file(s) as a list of paragraphs, each encoded as a list of sentences, which are in turn encoded as lists of ``(word,tag)`` tuples. :rtype: list(list(list(tuple(str,str))))
[ ":", "return", ":", "the", "given", "file", "(", "s", ")", "as", "a", "list", "of", "paragraphs", "each", "encoded", "as", "a", "list", "of", "sentences", "which", "are", "in", "turn", "encoded", "as", "lists", "of", "(", "word", "tag", ")", "tuples"...
def tagged_paras(self, fileids=None, simplify_tags=False): """ :return: the given file(s) as a list of paragraphs, each encoded as a list of sentences, which are in turn encoded as lists of ``(word,tag)`` tuples. :rtype: list(list(list(tuple(str,str)))) """ ...
[ "def", "tagged_paras", "(", "self", ",", "fileids", "=", "None", ",", "simplify_tags", "=", "False", ")", ":", "if", "simplify_tags", ":", "tag_mapping_function", "=", "self", ".", "_tag_mapping_function", "else", ":", "tag_mapping_function", "=", "None", "retur...
https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/nltk/corpus/reader/tagged.py#L152-L169
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/asymptotic/term_monoid.py
python
GenericTermMonoid.term_monoid
(self, type)
return TermMonoid(type, growth_group=self.growth_group, coefficient_ring=self.coefficient_ring)
r""" Return the term monoid of specified ``type``. INPUT: - ``type`` -- 'O' or 'exact', or an instance of an existing term monoid. See :class:`~sage.rings.asymptotic.term_monoid.TermMonoidFactory` for more details. OUTPUT: A term monoid object de...
r""" Return the term monoid of specified ``type``.
[ "r", "Return", "the", "term", "monoid", "of", "specified", "type", "." ]
def term_monoid(self, type): r""" Return the term monoid of specified ``type``. INPUT: - ``type`` -- 'O' or 'exact', or an instance of an existing term monoid. See :class:`~sage.rings.asymptotic.term_monoid.TermMonoidFactory` for more details. OUT...
[ "def", "term_monoid", "(", "self", ",", "type", ")", ":", "TermMonoid", "=", "self", ".", "term_monoid_factory", "return", "TermMonoid", "(", "type", ",", "growth_group", "=", "self", ".", "growth_group", ",", "coefficient_ring", "=", "self", ".", "coefficient...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/asymptotic/term_monoid.py#L1539-L1572
nipy/nipype
cd4c34d935a43812d1756482fdc4034844e485b8
nipype/pipeline/engine/workflows.py
python
Workflow._create_flat_graph
(self)
return workflowcopy._graph
Make a simple DAG where no node is a workflow.
Make a simple DAG where no node is a workflow.
[ "Make", "a", "simple", "DAG", "where", "no", "node", "is", "a", "workflow", "." ]
def _create_flat_graph(self): """Make a simple DAG where no node is a workflow.""" logger.debug("Creating flat graph for workflow: %s", self.name) workflowcopy = deepcopy(self) workflowcopy._generate_flatgraph() return workflowcopy._graph
[ "def", "_create_flat_graph", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Creating flat graph for workflow: %s\"", ",", "self", ".", "name", ")", "workflowcopy", "=", "deepcopy", "(", "self", ")", "workflowcopy", ".", "_generate_flatgraph", "(", ")", "...
https://github.com/nipy/nipype/blob/cd4c34d935a43812d1756482fdc4034844e485b8/nipype/pipeline/engine/workflows.py#L929-L934
gkhayes/mlrose
2a9d604ea464cccc48f30b8fe6b81fe5c4337c80
mlrose/opt_probs.py
python
ContinuousOpt.random_neighbor
(self)
return neighbor
Return random neighbor of current state vector. Returns ------- neighbor: array State vector of random neighbor.
Return random neighbor of current state vector.
[ "Return", "random", "neighbor", "of", "current", "state", "vector", "." ]
def random_neighbor(self): """Return random neighbor of current state vector. Returns ------- neighbor: array State vector of random neighbor. """ while True: neighbor = np.copy(self.state) i = np.random.randint(0, self.length) ...
[ "def", "random_neighbor", "(", "self", ")", ":", "while", "True", ":", "neighbor", "=", "np", ".", "copy", "(", "self", ".", "state", ")", "i", "=", "np", ".", "random", ".", "randint", "(", "0", ",", "self", ".", "length", ")", "neighbor", "[", ...
https://github.com/gkhayes/mlrose/blob/2a9d604ea464cccc48f30b8fe6b81fe5c4337c80/mlrose/opt_probs.py#L754-L777
stevearc/dql
9666cfba19773c20c7b4be29adc7d6179cf00d44
dql/throttle.py
python
TableLimits._compute_limit
(self, limit, throughput)
Compute a percentage limit or return a point limit
Compute a percentage limit or return a point limit
[ "Compute", "a", "percentage", "limit", "or", "return", "a", "point", "limit" ]
def _compute_limit(self, limit, throughput): """Compute a percentage limit or return a point limit""" if limit[-1] == "%": return throughput * float(limit[:-1]) / 100.0 else: return float(limit)
[ "def", "_compute_limit", "(", "self", ",", "limit", ",", "throughput", ")", ":", "if", "limit", "[", "-", "1", "]", "==", "\"%\"", ":", "return", "throughput", "*", "float", "(", "limit", "[", ":", "-", "1", "]", ")", "/", "100.0", "else", ":", "...
https://github.com/stevearc/dql/blob/9666cfba19773c20c7b4be29adc7d6179cf00d44/dql/throttle.py#L16-L21
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/command/easy_install.py
python
easy_install.write_script
(self, script_name, contents, mode="t", blockers=())
Write an executable file to the scripts directory
Write an executable file to the scripts directory
[ "Write", "an", "executable", "file", "to", "the", "scripts", "directory" ]
def write_script(self, script_name, contents, mode="t", blockers=()): """Write an executable file to the scripts directory""" self.delete_blockers( # clean up old .py/.pyw w/o a script [os.path.join(self.script_dir, x) for x in blockers] ) log.info("Installing %s script to %...
[ "def", "write_script", "(", "self", ",", "script_name", ",", "contents", ",", "mode", "=", "\"t\"", ",", "blockers", "=", "(", ")", ")", ":", "self", ".", "delete_blockers", "(", "# clean up old .py/.pyw w/o a script", "[", "os", ".", "path", ".", "join", ...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/command/easy_install.py#L825-L843
praekeltfoundation/vumi
b74b5dac95df778519f54c670a353e4bda496df9
vumi/transports/parlayx/xmlutil.py
python
ElementMaker.element
(self, tag, *children, **attrib)
return elem
Create an ElementTree element. :param tag: Tag name or `QualifiedName` instance. :param *children: Child content or elements. :param **attrib: Element XML attributes. :return: ElementTree element.
Create an ElementTree element.
[ "Create", "an", "ElementTree", "element", "." ]
def element(self, tag, *children, **attrib): """ Create an ElementTree element. :param tag: Tag name or `QualifiedName` instance. :param *children: Child content or elements. :param **attrib: Element XML attributes. :return: ElementTree element. """ if is...
[ "def", "element", "(", "self", ",", "tag", ",", "*", "children", ",", "*", "*", "attrib", ")", ":", "if", "isinstance", "(", "tag", ",", "etree", ".", "QName", ")", ":", "tag", "=", "tag", ".", "text", "elem", "=", "self", ".", "_makeelement", "(...
https://github.com/praekeltfoundation/vumi/blob/b74b5dac95df778519f54c670a353e4bda496df9/vumi/transports/parlayx/xmlutil.py#L271-L291
zentralopensource/zentral
c41f4f0824f0855fb8d382493cfea9d151cbc13c
zentral/contrib/osquery/compliance_checks.py
python
sync_query_compliance_check
(query, on)
return created, updated, deleted
Create update or delete the query compliance check
Create update or delete the query compliance check
[ "Create", "update", "or", "delete", "the", "query", "compliance", "check" ]
def sync_query_compliance_check(query, on): "Create update or delete the query compliance check" created = updated = deleted = False if on: if not isinstance(query.version, int): query.refresh_from_db() cc_defaults = { "model": OsqueryCheck.get_model(), "n...
[ "def", "sync_query_compliance_check", "(", "query", ",", "on", ")", ":", "created", "=", "updated", "=", "deleted", "=", "False", "if", "on", ":", "if", "not", "isinstance", "(", "query", ".", "version", ",", "int", ")", ":", "query", ".", "refresh_from_...
https://github.com/zentralopensource/zentral/blob/c41f4f0824f0855fb8d382493cfea9d151cbc13c/zentral/contrib/osquery/compliance_checks.py#L39-L65
facebookresearch/SpanBERT
0670d8b6a38f6714b85ea7a033f16bd8cc162676
pretraining/fairseq/trainer.py
python
Trainer.get_lr
(self)
return self.optimizer.get_lr()
Get the current learning rate.
Get the current learning rate.
[ "Get", "the", "current", "learning", "rate", "." ]
def get_lr(self): """Get the current learning rate.""" return self.optimizer.get_lr()
[ "def", "get_lr", "(", "self", ")", ":", "return", "self", ".", "optimizer", ".", "get_lr", "(", ")" ]
https://github.com/facebookresearch/SpanBERT/blob/0670d8b6a38f6714b85ea7a033f16bd8cc162676/pretraining/fairseq/trainer.py#L361-L363
tensorlayer/RLzoo
8dd3ff1003d1c7a446f45119bbd6b48c048990f4
rlzoo/common/distributions.py
python
DiagGaussian.sample
(self)
return self.mean, self.std * np.random.normal(0, 1, np.shape(self.mean))
Get actions in deterministic or stochastic manner
Get actions in deterministic or stochastic manner
[ "Get", "actions", "in", "deterministic", "or", "stochastic", "manner" ]
def sample(self): """ Get actions in deterministic or stochastic manner """ return self.mean, self.std * np.random.normal(0, 1, np.shape(self.mean))
[ "def", "sample", "(", "self", ")", ":", "return", "self", ".", "mean", ",", "self", ".", "std", "*", "np", ".", "random", ".", "normal", "(", "0", ",", "1", ",", "np", ".", "shape", "(", "self", ".", "mean", ")", ")" ]
https://github.com/tensorlayer/RLzoo/blob/8dd3ff1003d1c7a446f45119bbd6b48c048990f4/rlzoo/common/distributions.py#L159-L161
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
chainer_/chainercv2/models/densenet.py
python
densenet121
(**kwargs)
return get_densenet(blocks=121, model_name="densenet121", **kwargs)
DenseNet-121 model from 'Densely Connected Convolutional Networks,' https://arxiv.org/abs/1608.06993. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.chainer/models' Location for keeping the model paramete...
DenseNet-121 model from 'Densely Connected Convolutional Networks,' https://arxiv.org/abs/1608.06993.
[ "DenseNet", "-", "121", "model", "from", "Densely", "Connected", "Convolutional", "Networks", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1608", ".", "06993", "." ]
def densenet121(**kwargs): """ DenseNet-121 model from 'Densely Connected Convolutional Networks,' https://arxiv.org/abs/1608.06993. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.chainer/models' ...
[ "def", "densenet121", "(", "*", "*", "kwargs", ")", ":", "return", "get_densenet", "(", "blocks", "=", "121", ",", "model_name", "=", "\"densenet121\"", ",", "*", "*", "kwargs", ")" ]
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/chainer_/chainercv2/models/densenet.py#L234-L245
baidu-security/openrasp-iast
d4a5643420853a95614d371cf38d5c65ccf9cfd4
openrasp_iast/core/components/common.py
python
split_host
(host_port)
return host, port
将使用 "_" 连接为字符串的host、port还原 Parameters: host_port - str Returns: str, int
将使用 "_" 连接为字符串的host、port还原
[ "将使用", "_", "连接为字符串的host、port还原" ]
def split_host(host_port): """ 将使用 "_" 连接为字符串的host、port还原 Parameters: host_port - str Returns: str, int """ host_port_split = host_port.split("_") host = "_".join(host_port_split[:-1]) port = int(host_port_split[-1]) return host, port
[ "def", "split_host", "(", "host_port", ")", ":", "host_port_split", "=", "host_port", ".", "split", "(", "\"_\"", ")", "host", "=", "\"_\"", ".", "join", "(", "host_port_split", "[", ":", "-", "1", "]", ")", "port", "=", "int", "(", "host_port_split", ...
https://github.com/baidu-security/openrasp-iast/blob/d4a5643420853a95614d371cf38d5c65ccf9cfd4/openrasp_iast/core/components/common.py#L120-L133
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/idserver.py
python
get_ids_with_prefix
(portal_type, prefix)
return ids
Return a list of ids sharing the same portal type and prefix
Return a list of ids sharing the same portal type and prefix
[ "Return", "a", "list", "of", "ids", "sharing", "the", "same", "portal", "type", "and", "prefix" ]
def get_ids_with_prefix(portal_type, prefix): """Return a list of ids sharing the same portal type and prefix """ brains = search_by_prefix(portal_type, prefix) ids = map(api.get_id, brains) return ids
[ "def", "get_ids_with_prefix", "(", "portal_type", ",", "prefix", ")", ":", "brains", "=", "search_by_prefix", "(", "portal_type", ",", "prefix", ")", "ids", "=", "map", "(", "api", ".", "get_id", ",", "brains", ")", "return", "ids" ]
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/idserver.py#L236-L241
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbCaiNiaoKongZhiTa.cainiao_ecc_exceptions_delay_get
( self, mail_no )
return self._top_request( "cainiao.ecc.exceptions.delay.get", { "mail_no": mail_no } )
菜鸟控制塔包裹滞留异常信息获取 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=43853 :param mail_no: 运单号
菜鸟控制塔包裹滞留异常信息获取 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=43853
[ "菜鸟控制塔包裹滞留异常信息获取", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "43853" ]
def cainiao_ecc_exceptions_delay_get( self, mail_no ): """ 菜鸟控制塔包裹滞留异常信息获取 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=43853 :param mail_no: 运单号 """ return self._top_request( "cainiao.ecc.exceptions.delay.get", ...
[ "def", "cainiao_ecc_exceptions_delay_get", "(", "self", ",", "mail_no", ")", ":", "return", "self", ".", "_top_request", "(", "\"cainiao.ecc.exceptions.delay.get\"", ",", "{", "\"mail_no\"", ":", "mail_no", "}", ")" ]
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L110024-L110039
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/lib/xmodule/xmodule/lti_2_util.py
python
LTI20BlockMixin.clear_user_module_score
(self, user)
Clears the module user state, including grades and comments, and also scoring in db's courseware_studentmodule Arguments: user (django.contrib.auth.models.User): Actual user whose module state is to be cleared Returns: nothing
Clears the module user state, including grades and comments, and also scoring in db's courseware_studentmodule
[ "Clears", "the", "module", "user", "state", "including", "grades", "and", "comments", "and", "also", "scoring", "in", "db", "s", "courseware_studentmodule" ]
def clear_user_module_score(self, user): """ Clears the module user state, including grades and comments, and also scoring in db's courseware_studentmodule Arguments: user (django.contrib.auth.models.User): Actual user whose module state is to be cleared Returns: ...
[ "def", "clear_user_module_score", "(", "self", ",", "user", ")", ":", "self", ".", "set_user_module_score", "(", "user", ",", "None", ",", "None", ",", "score_deleted", "=", "True", ")" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/lti_2_util.py#L226-L236
deanishe/alfred-reddit
2f7545e682fc1579489947baa679e19b4eb1900e
src/workflow/util.py
python
set_config
(name, value, bundleid=None, exportable=False)
Set a workflow variable in ``info.plist``. .. versionadded:: 1.33 Args: name (str): Name of variable to set. value (str): Value to set variable to. bundleid (str, optional): Bundle ID of workflow variable belongs to. exportable (bool, optional): Whether variable should be marke...
Set a workflow variable in ``info.plist``.
[ "Set", "a", "workflow", "variable", "in", "info", ".", "plist", "." ]
def set_config(name, value, bundleid=None, exportable=False): """Set a workflow variable in ``info.plist``. .. versionadded:: 1.33 Args: name (str): Name of variable to set. value (str): Value to set variable to. bundleid (str, optional): Bundle ID of workflow variable belongs to. ...
[ "def", "set_config", "(", "name", ",", "value", ",", "bundleid", "=", "None", ",", "exportable", "=", "False", ")", ":", "if", "not", "bundleid", ":", "bundleid", "=", "os", ".", "getenv", "(", "'alfred_workflow_bundleid'", ")", "name", "=", "applescriptif...
https://github.com/deanishe/alfred-reddit/blob/2f7545e682fc1579489947baa679e19b4eb1900e/src/workflow/util.py#L244-L272
AstroPrint/AstroBox
e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75
src/astroprint/printer/s3g/__init__.py
python
PrinterS3g.doDisconnect
(self)
return True
[]
def doDisconnect(self): with self._state_condition: if self._printJob: self._printJob.cancel() self._printJob.join() self._printJob = None if self.isConnected(): self._comm.close() self._comm = None self._profile = None self._gcodeParser = None if self._botThread: self._botThread =...
[ "def", "doDisconnect", "(", "self", ")", ":", "with", "self", ".", "_state_condition", ":", "if", "self", ".", "_printJob", ":", "self", ".", "_printJob", ".", "cancel", "(", ")", "self", ".", "_printJob", ".", "join", "(", ")", "self", ".", "_printJob...
https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/astroprint/printer/s3g/__init__.py#L294-L313