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
matplotlib/matplotlib
8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322
lib/matplotlib/backends/backend_template.py
python
draw_if_interactive
()
For image backends - is not required. For GUI backends - this should be overridden if drawing should be done in interactive python mode.
For image backends - is not required. For GUI backends - this should be overridden if drawing should be done in interactive python mode.
[ "For", "image", "backends", "-", "is", "not", "required", ".", "For", "GUI", "backends", "-", "this", "should", "be", "overridden", "if", "drawing", "should", "be", "done", "in", "interactive", "python", "mode", "." ]
def draw_if_interactive(): """ For image backends - is not required. For GUI backends - this should be overridden if drawing should be done in interactive python mode. """
[ "def", "draw_if_interactive", "(", ")", ":" ]
https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/backends/backend_template.py#L139-L144
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/topology/simplicial_set.py
python
SimplicialSet_arbitrary._latex_
(self)
return str(self)
r""" LaTeX representation. If ``latex_name`` is set when the simplicial set is defined, or if :meth:`rename_latex` is used to set the LaTeX name, use that. Otherwise, use its string representation. EXAMPLES:: sage: from sage.topology.simplicial_set import AbstractS...
r""" LaTeX representation.
[ "r", "LaTeX", "representation", "." ]
def _latex_(self): r""" LaTeX representation. If ``latex_name`` is set when the simplicial set is defined, or if :meth:`rename_latex` is used to set the LaTeX name, use that. Otherwise, use its string representation. EXAMPLES:: sage: from sage.topology.simp...
[ "def", "_latex_", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_latex_name'", ")", "and", "self", ".", "_latex_name", "is", "not", "None", ":", "return", "self", ".", "_latex_name", "return", "str", "(", "self", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/topology/simplicial_set.py#L3053-L3080
facebookresearch/ParlAI
e4d59c30eef44f1f67105961b82a83fd28d7d78b
projects/anti_scaling/distillation.py
python
AbstractDistillTransformerAgentMixin._get_prediction_loss
(self, fwd_pass: ForwardPassOutputs)
return pred_loss
Calculate and return the KL loss on the teacher's prediction layer. Also record prediction-loss metrics.
Calculate and return the KL loss on the teacher's prediction layer.
[ "Calculate", "and", "return", "the", "KL", "loss", "on", "the", "teacher", "s", "prediction", "layer", "." ]
def _get_prediction_loss(self, fwd_pass: ForwardPassOutputs) -> torch.Tensor: """ Calculate and return the KL loss on the teacher's prediction layer. Also record prediction-loss metrics. """ assert isinstance(self, TorchGeneratorAgent) # Code relies on methods pr...
[ "def", "_get_prediction_loss", "(", "self", ",", "fwd_pass", ":", "ForwardPassOutputs", ")", "->", "torch", ".", "Tensor", ":", "assert", "isinstance", "(", "self", ",", "TorchGeneratorAgent", ")", "# Code relies on methods", "pred_loss", "=", "F", ".", "kl_div", ...
https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/projects/anti_scaling/distillation.py#L723-L747
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/requests/utils.py
python
urldefragauth
(url)
return urlunparse((scheme, netloc, path, params, query, ''))
Given a url remove the fragment and the authentication part. :rtype: str
Given a url remove the fragment and the authentication part.
[ "Given", "a", "url", "remove", "the", "fragment", "and", "the", "authentication", "part", "." ]
def urldefragauth(url): """ Given a url remove the fragment and the authentication part. :rtype: str """ scheme, netloc, path, params, query, fragment = urlparse(url) # see func:`prepend_scheme_if_needed` if not netloc: netloc, path = path, netloc netloc = netloc.rsplit('@', 1...
[ "def", "urldefragauth", "(", "url", ")", ":", "scheme", ",", "netloc", ",", "path", ",", "params", ",", "query", ",", "fragment", "=", "urlparse", "(", "url", ")", "# see func:`prepend_scheme_if_needed`", "if", "not", "netloc", ":", "netloc", ",", "path", ...
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/requests/utils.py#L959-L973
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/visualize/ownomogram.py
python
OWNomogram._adjust_scale
(attributes, points, max_width, diff, attr_inds, log_reg_cont_data_extremes, cls_index)
return scale
[]
def _adjust_scale(attributes, points, max_width, diff, attr_inds, log_reg_cont_data_extremes, cls_index): if not diff: return max_width def offset(name, point): text_ = QGraphicsTextItem(name).boundingRect() return scale * point + text_.width() ...
[ "def", "_adjust_scale", "(", "attributes", ",", "points", ",", "max_width", ",", "diff", ",", "attr_inds", ",", "log_reg_cont_data_extremes", ",", "cls_index", ")", ":", "if", "not", "diff", ":", "return", "max_width", "def", "offset", "(", "name", ",", "poi...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/ownomogram.py#L1018-L1043
PyHDI/veriloggen
2382d200deabf59cfcfd741f5eba371010aaf2bb
veriloggen/verilog/from_verilog.py
python
VerilogReadVisitor.visit_IdentifierScope
(self, node)
return args
[]
def visit_IdentifierScope(self, node): args = [self.visit(label) for label in node.labellist] return args
[ "def", "visit_IdentifierScope", "(", "self", ",", "node", ")", ":", "args", "=", "[", "self", ".", "visit", "(", "label", ")", "for", "label", "in", "node", ".", "labellist", "]", "return", "args" ]
https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/verilog/from_verilog.py#L919-L921
miguelgrinberg/Flask-SocketIO
28e7dd115991f964fc2193ac654fc05bc3a67c7a
src/flask_socketio/namespace.py
python
Namespace.send
(self, data, room=None, include_self=True, namespace=None, callback=None)
return self.socketio.send(data, room=room, include_self=include_self, namespace=namespace or self.namespace, callback=callback)
Send a message to one or more connected clients.
Send a message to one or more connected clients.
[ "Send", "a", "message", "to", "one", "or", "more", "connected", "clients", "." ]
def send(self, data, room=None, include_self=True, namespace=None, callback=None): """Send a message to one or more connected clients.""" return self.socketio.send(data, room=room, include_self=include_self, namespace=namespace or self.namespace, ...
[ "def", "send", "(", "self", ",", "data", ",", "room", "=", "None", ",", "include_self", "=", "True", ",", "namespace", "=", "None", ",", "callback", "=", "None", ")", ":", "return", "self", ".", "socketio", ".", "send", "(", "data", ",", "room", "=...
https://github.com/miguelgrinberg/Flask-SocketIO/blob/28e7dd115991f964fc2193ac654fc05bc3a67c7a/src/flask_socketio/namespace.py#L36-L41
lad1337/XDM
0c1b7009fe00f06f102a6f67c793478f515e7efe
site-packages/logilab/astng/scoped_nodes.py
python
Class.block_range
(self, lineno)
return self.fromlineno, self.tolineno
return block line numbers. start from the "class" position whatever the given lineno
return block line numbers.
[ "return", "block", "line", "numbers", "." ]
def block_range(self, lineno): """return block line numbers. start from the "class" position whatever the given lineno """ return self.fromlineno, self.tolineno
[ "def", "block_range", "(", "self", ",", "lineno", ")", ":", "return", "self", ".", "fromlineno", ",", "self", ".", "tolineno" ]
https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/logilab/astng/scoped_nodes.py#L734-L739
1040003585/WebScrapingWithPython
a770fa5b03894076c8c9539b1ffff34424ffc016
portia_examle/lib/python2.7/site-packages/pkg_resources/__init__.py
python
get_default_cache
()
return ( os.environ.get('PYTHON_EGG_CACHE') or appdirs.user_cache_dir(appname='Python-Eggs') )
Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs".
Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs".
[ "Return", "the", "PYTHON_EGG_CACHE", "environment", "variable", "or", "a", "platform", "-", "relevant", "user", "cache", "dir", "for", "an", "app", "named", "Python", "-", "Eggs", "." ]
def get_default_cache(): """ Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs". """ return ( os.environ.get('PYTHON_EGG_CACHE') or appdirs.user_cache_dir(appname='Python-Eggs') )
[ "def", "get_default_cache", "(", ")", ":", "return", "(", "os", ".", "environ", ".", "get", "(", "'PYTHON_EGG_CACHE'", ")", "or", "appdirs", ".", "user_cache_dir", "(", "appname", "=", "'Python-Eggs'", ")", ")" ]
https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pkg_resources/__init__.py#L1360-L1369
anki/vector-python-sdk
d61fdb07c6278deba750f987b20441fff2df865f
anki_vector/objects.py
python
LightCube.last_moved_time
(self)
return self._last_moved_time
The time the object was last moved in SDK time. .. testcode:: import time import anki_vector with anki_vector.Robot() as robot: print("disconnecting from any connected cube...") robot.world.disconnect_cube() time.sleep(2) ...
The time the object was last moved in SDK time.
[ "The", "time", "the", "object", "was", "last", "moved", "in", "SDK", "time", "." ]
def last_moved_time(self) -> float: """The time the object was last moved in SDK time. .. testcode:: import time import anki_vector with anki_vector.Robot() as robot: print("disconnecting from any connected cube...") robot.world.disc...
[ "def", "last_moved_time", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_last_moved_time" ]
https://github.com/anki/vector-python-sdk/blob/d61fdb07c6278deba750f987b20441fff2df865f/anki_vector/objects.py#L650-L674
inasafe/inasafe
355eb2ce63f516b9c26af0c86a24f99e53f63f87
safe/gui/tools/wizard/wizard_step.py
python
WizardStep.help
(self)
return message
Return full help message for the step wizard. :returns: A message object contains help text. :rtype: m.Message
Return full help message for the step wizard.
[ "Return", "full", "help", "message", "for", "the", "step", "wizard", "." ]
def help(self): """Return full help message for the step wizard. :returns: A message object contains help text. :rtype: m.Message """ message = m.Message() message.add(m.Brand()) message.add(self.help_heading()) message.add(self.help_content()) re...
[ "def", "help", "(", "self", ")", ":", "message", "=", "m", ".", "Message", "(", ")", "message", ".", "add", "(", "m", ".", "Brand", "(", ")", ")", "message", ".", "add", "(", "self", ".", "help_heading", "(", ")", ")", "message", ".", "add", "(...
https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/gui/tools/wizard/wizard_step.py#L108-L118
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/arraylike.py
python
_is_aligned
(frame, other)
Helper to check if a DataFrame is aligned with another DataFrame or Series.
Helper to check if a DataFrame is aligned with another DataFrame or Series.
[ "Helper", "to", "check", "if", "a", "DataFrame", "is", "aligned", "with", "another", "DataFrame", "or", "Series", "." ]
def _is_aligned(frame, other): """ Helper to check if a DataFrame is aligned with another DataFrame or Series. """ from pandas import DataFrame if isinstance(other, DataFrame): return frame._indexed_same(other) else: # Series -> match index return frame.columns.equals(ot...
[ "def", "_is_aligned", "(", "frame", ",", "other", ")", ":", "from", "pandas", "import", "DataFrame", "if", "isinstance", "(", "other", ",", "DataFrame", ")", ":", "return", "frame", ".", "_indexed_same", "(", "other", ")", "else", ":", "# Series -> match ind...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/arraylike.py#L167-L177
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_parcats.py
python
Parcats.meta
(self)
return self["meta"]
Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the tr...
Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the tr...
[ "Assigns", "extra", "meta", "information", "associated", "with", "this", "trace", "that", "can", "be", "used", "in", "various", "text", "attributes", ".", "Attributes", "such", "as", "trace", "name", "graph", "axis", "and", "colorbar", "title", ".", "text", ...
def meta(self): """ Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text ...
[ "def", "meta", "(", "self", ")", ":", "return", "self", "[", "\"meta\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_parcats.py#L586-L605
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py-rest/gluon/contrib/fpdf/fpdf.py
python
FPDF.set_right_margin
(self, margin)
Set right margin
Set right margin
[ "Set", "right", "margin" ]
def set_right_margin(self, margin): "Set right margin" self.r_margin=margin
[ "def", "set_right_margin", "(", "self", ",", "margin", ")", ":", "self", ".", "r_margin", "=", "margin" ]
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py-rest/gluon/contrib/fpdf/fpdf.py#L173-L175
cyverse/atmosphere
4a3e522f1f7b58abd9fa944c10b7455dc5cddac1
service/networking.py
python
_get_random_uid
(userid)
return int(random.uniform(1, MAX_SUBNET))
Given a string (Username) return a value < MAX_SUBNET
Given a string (Username) return a value < MAX_SUBNET
[ "Given", "a", "string", "(", "Username", ")", "return", "a", "value", "<", "MAX_SUBNET" ]
def _get_random_uid(userid): """ Given a string (Username) return a value < MAX_SUBNET """ MAX_SUBNET = 4064 return int(random.uniform(1, MAX_SUBNET))
[ "def", "_get_random_uid", "(", "userid", ")", ":", "MAX_SUBNET", "=", "4064", "return", "int", "(", "random", ".", "uniform", "(", "1", ",", "MAX_SUBNET", ")", ")" ]
https://github.com/cyverse/atmosphere/blob/4a3e522f1f7b58abd9fa944c10b7455dc5cddac1/service/networking.py#L34-L39
Komodo/KomodoEdit
61edab75dce2bdb03943b387b0608ea36f548e8e
contrib/paramiko/paramiko/file.py
python
BufferedFile.seekable
(self)
return False
Check if the file supports random access. :returns: `True` if the file supports random access. If `False`, `seek` will raise an exception.
Check if the file supports random access.
[ "Check", "if", "the", "file", "supports", "random", "access", "." ]
def seekable(self): """ Check if the file supports random access. :returns: `True` if the file supports random access. If `False`, `seek` will raise an exception. """ return False
[ "def", "seekable", "(", "self", ")", ":", "return", "False" ]
https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/contrib/paramiko/paramiko/file.py#L142-L150
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/words/word_options.py
python
WordOptions
(**kwargs)
Sets the global options for elements of the word class. The defaults are for words to be displayed in list notation. INPUT: - ``display`` - 'string' (default), or 'list', words are displayed in string or list notation. - ``truncate`` - boolean (default: True), whether to truncate the string ...
Sets the global options for elements of the word class. The defaults are for words to be displayed in list notation.
[ "Sets", "the", "global", "options", "for", "elements", "of", "the", "word", "class", ".", "The", "defaults", "are", "for", "words", "to", "be", "displayed", "in", "list", "notation", "." ]
def WordOptions(**kwargs): """ Sets the global options for elements of the word class. The defaults are for words to be displayed in list notation. INPUT: - ``display`` - 'string' (default), or 'list', words are displayed in string or list notation. - ``truncate`` - boolean (default: ...
[ "def", "WordOptions", "(", "*", "*", "kwargs", ")", ":", "global", "word_options", "if", "kwargs", "==", "{", "}", ":", "return", "copy", ".", "copy", "(", "word_options", ")", "if", "'display'", "in", "kwargs", ":", "if", "kwargs", "[", "'display'", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/words/word_options.py#L26-L99
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/artifacts/artifacts_client.py
python
ArtifactsClient.list_container_image_signatures
(self, compartment_id, **kwargs)
List container image signatures in an image. :param str compartment_id: (required) The `OCID`__ of the compartment. __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm :param bool compartment_id_in_subtree: (optional) When set to true, the hi...
List container image signatures in an image.
[ "List", "container", "image", "signatures", "in", "an", "image", "." ]
def list_container_image_signatures(self, compartment_id, **kwargs): """ List container image signatures in an image. :param str compartment_id: (required) The `OCID`__ of the compartment. __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm ...
[ "def", "list_container_image_signatures", "(", "self", ",", "compartment_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/container/imageSignatures\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", "\"retry_strate...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/artifacts/artifacts_client.py#L1708-L1909
thatbrguy/Pedestrian-Detection
b11c7d6bed0ff320811726fe1c429be26a87da9e
object_detection/core/minibatch_sampler.py
python
MinibatchSampler.subsample
(self, indicator, batch_size, **params)
Returns subsample of entries in indicator. Args: indicator: boolean tensor of shape [N] whose True entries can be sampled. batch_size: desired batch size. **params: additional keyword arguments for specific implementations of the MinibatchSampler. Returns: sample_indicator: b...
Returns subsample of entries in indicator.
[ "Returns", "subsample", "of", "entries", "in", "indicator", "." ]
def subsample(self, indicator, batch_size, **params): """Returns subsample of entries in indicator. Args: indicator: boolean tensor of shape [N] whose True entries can be sampled. batch_size: desired batch size. **params: additional keyword arguments for specific implementations of ...
[ "def", "subsample", "(", "self", ",", "indicator", ",", "batch_size", ",", "*", "*", "params", ")", ":", "pass" ]
https://github.com/thatbrguy/Pedestrian-Detection/blob/b11c7d6bed0ff320811726fe1c429be26a87da9e/object_detection/core/minibatch_sampler.py#L48-L61
openid/python-openid
afa6adacbe1a41d8f614c8bce2264dfbe9e76489
openid/yadis/xri.py
python
iriToURI
(iri)
Transform an IRI to a URI by escaping unicode. According to RFC 3987, section 3.1, "Mapping of IRIs to URIs" @type iri: six.text_type, six.binary_type deprecated. @rtype: six.text_type
Transform an IRI to a URI by escaping unicode.
[ "Transform", "an", "IRI", "to", "a", "URI", "by", "escaping", "unicode", "." ]
def iriToURI(iri): """Transform an IRI to a URI by escaping unicode. According to RFC 3987, section 3.1, "Mapping of IRIs to URIs" @type iri: six.text_type, six.binary_type deprecated. @rtype: six.text_type """ iri = string_to_text(iri, "Binary input for iriToURI is deprecated. Use text input ...
[ "def", "iriToURI", "(", "iri", ")", ":", "iri", "=", "string_to_text", "(", "iri", ",", "\"Binary input for iriToURI is deprecated. Use text input instead.\"", ")", "# This is hackish. `quote` requires `str` in both py27 and py3+.", "if", "isinstance", "(", "iri", ",", "str",...
https://github.com/openid/python-openid/blob/afa6adacbe1a41d8f614c8bce2264dfbe9e76489/openid/yadis/xri.py#L62-L79
deepmind/pysc2
05b28ef0d85aa5eef811bc49ff4c0cbe496c0adb
pysc2/lib/actions.py
python
cmd_minimap
(action, action_space, ability_id, queued, minimap)
Do a command that needs a point on the minimap.
Do a command that needs a point on the minimap.
[ "Do", "a", "command", "that", "needs", "a", "point", "on", "the", "minimap", "." ]
def cmd_minimap(action, action_space, ability_id, queued, minimap): """Do a command that needs a point on the minimap.""" action_cmd = spatial(action, action_space).unit_command action_cmd.ability_id = ability_id action_cmd.queue_command = queued minimap.assign_to(action_cmd.target_minimap_coord)
[ "def", "cmd_minimap", "(", "action", ",", "action_space", ",", "ability_id", ",", "queued", ",", "minimap", ")", ":", "action_cmd", "=", "spatial", "(", "action", ",", "action_space", ")", ".", "unit_command", "action_cmd", ".", "ability_id", "=", "ability_id"...
https://github.com/deepmind/pysc2/blob/05b28ef0d85aa5eef811bc49ff4c0cbe496c0adb/pysc2/lib/actions.py#L141-L146
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/lib2to3/pytree.py
python
BasePattern.match
(self, node, results=None)
return True
Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns.
Does this pattern exactly match a node?
[ "Does", "this", "pattern", "exactly", "match", "a", "node?" ]
def match(self, node, results=None): """ Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard...
[ "def", "match", "(", "self", ",", "node", ",", "results", "=", "None", ")", ":", "if", "self", ".", "type", "is", "not", "None", "and", "node", ".", "type", "!=", "self", ".", "type", ":", "return", "False", "if", "self", ".", "content", "is", "n...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/lib2to3/pytree.py#L454-L477
leancloud/satori
701caccbd4fe45765001ca60435c0cb499477c03
satori-rules/plugin/libs/pymongo/topology.py
python
Topology._apply_selector
(self, selector, address)
[]
def _apply_selector(self, selector, address): if self._description.topology_type == TOPOLOGY_TYPE.Single: # Ignore the selector. return self._description.known_servers elif address: sd = self._description.server_descriptions().get(address) return [sd] if s...
[ "def", "_apply_selector", "(", "self", ",", "selector", ",", "address", ")", ":", "if", "self", ".", "_description", ".", "topology_type", "==", "TOPOLOGY_TYPE", ".", "Single", ":", "# Ignore the selector.", "return", "self", ".", "_description", ".", "known_ser...
https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/pymongo/topology.py#L312-L325
wuzheng-sjtu/FastFPN
a60a618665b11481e95bd184073a2ac09febc9d4
libs/boxes/anchor.py
python
_ratio_enum
(anchor, ratios)
return anchors
Enumerate a set of anchors for each aspect ratio wrt an anchor.
Enumerate a set of anchors for each aspect ratio wrt an anchor.
[ "Enumerate", "a", "set", "of", "anchors", "for", "each", "aspect", "ratio", "wrt", "an", "anchor", "." ]
def _ratio_enum(anchor, ratios): """ Enumerate a set of anchors for each aspect ratio wrt an anchor. """ w, h, x_ctr, y_ctr = _whctrs(anchor) size = w * h size_ratios = size / ratios ws = np.round(np.sqrt(size_ratios)) hs = np.round(ws * ratios) anchors = _mkanchors(ws, hs, x_ctr, y_ctr) return a...
[ "def", "_ratio_enum", "(", "anchor", ",", "ratios", ")", ":", "w", ",", "h", ",", "x_ctr", ",", "y_ctr", "=", "_whctrs", "(", "anchor", ")", "size", "=", "w", "*", "h", "size_ratios", "=", "size", "/", "ratios", "ws", "=", "np", ".", "round", "("...
https://github.com/wuzheng-sjtu/FastFPN/blob/a60a618665b11481e95bd184073a2ac09febc9d4/libs/boxes/anchor.py#L68-L79
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/urllib/parse.py
python
_coerce_args
(*args)
return _decode_args(args) + (_encode_result,)
[]
def _coerce_args(*args): # Invokes decode if necessary to create str args # and returns the coerced inputs along with # an appropriate result coercion function # - noop for str inputs # - encoding function otherwise str_input = isinstance(args[0], str) for arg in args[1:]: # We s...
[ "def", "_coerce_args", "(", "*", "args", ")", ":", "# Invokes decode if necessary to create str args", "# and returns the coerced inputs along with", "# an appropriate result coercion function", "# - noop for str inputs", "# - encoding function otherwise", "str_input", "=", "isinstan...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/urllib/parse.py#L98-L112
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/calendar.py
python
leapdays
(y1, y2)
return (y2//4 - y1//4) - (y2//100 - y1//100) + (y2//400 - y1//400)
Return number of leap years in range [y1, y2). Assume y1 <= y2.
Return number of leap years in range [y1, y2). Assume y1 <= y2.
[ "Return", "number", "of", "leap", "years", "in", "range", "[", "y1", "y2", ")", ".", "Assume", "y1", "<", "=", "y2", "." ]
def leapdays(y1, y2): """Return number of leap years in range [y1, y2). Assume y1 <= y2.""" y1 -= 1 y2 -= 1 return (y2//4 - y1//4) - (y2//100 - y1//100) + (y2//400 - y1//400)
[ "def", "leapdays", "(", "y1", ",", "y2", ")", ":", "y1", "-=", "1", "y2", "-=", "1", "return", "(", "y2", "//", "4", "-", "y1", "//", "4", ")", "-", "(", "y2", "//", "100", "-", "y1", "//", "100", ")", "+", "(", "y2", "//", "400", "-", ...
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/calendar.py#L102-L107
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/iecp/v20210914/iecp_client.py
python
IecpClient.CreateEdgeNode
(self, request)
创建边缘节点 :param request: Request instance for CreateEdgeNode. :type request: :class:`tencentcloud.iecp.v20210914.models.CreateEdgeNodeRequest` :rtype: :class:`tencentcloud.iecp.v20210914.models.CreateEdgeNodeResponse`
创建边缘节点
[ "创建边缘节点" ]
def CreateEdgeNode(self, request): """创建边缘节点 :param request: Request instance for CreateEdgeNode. :type request: :class:`tencentcloud.iecp.v20210914.models.CreateEdgeNodeRequest` :rtype: :class:`tencentcloud.iecp.v20210914.models.CreateEdgeNodeResponse` """ try: ...
[ "def", "CreateEdgeNode", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"CreateEdgeNode\"", ",", "params", ")", "response", "=", "json", ".", "loads", "...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iecp/v20210914/iecp_client.py#L113-L138
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/amd64/psutil/_pssunos.py
python
Process.cpu_times
(self)
return _common.pcputimes(user, system)
[]
def cpu_times(self): user, system = cext.proc_cpu_times(self.pid) return _common.pcputimes(user, system)
[ "def", "cpu_times", "(", "self", ")", ":", "user", ",", "system", "=", "cext", ".", "proc_cpu_times", "(", "self", ".", "pid", ")", "return", "_common", ".", "pcputimes", "(", "user", ",", "system", ")" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/amd64/psutil/_pssunos.py#L353-L355
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tsf/v20180326/models.py
python
DeletePathRewritesResponse.__init__
(self)
r""" :param Result: true/false :type Result: bool :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param Result: true/false :type Result: bool :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "Result", ":", "true", "/", "false", ":", "type", "Result", ":", "bool", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): r""" :param Result: true/false :type Result: bool :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.Result = None self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Result", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tsf/v20180326/models.py#L4471-L4479
perone/Pyevolve
589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0
pyevolve/Network.py
python
UDPThreadBroadcastClient.close
(self)
Close the internal socket
Close the internal socket
[ "Close", "the", "internal", "socket" ]
def close(self): """ Close the internal socket """ self.sock.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "sock", ".", "close", "(", ")" ]
https://github.com/perone/Pyevolve/blob/589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0/pyevolve/Network.py#L90-L92
uclnlp/jack
9e5ffbd4fb2b0bd6b816fe6e14b9045ac776bb8e
jack/readers/extractive_qa/shared.py
python
_np_softmax
(x)
return e_x / e_x.sum(axis=0)
Compute softmax values for each sets of scores in x.
Compute softmax values for each sets of scores in x.
[ "Compute", "softmax", "values", "for", "each", "sets", "of", "scores", "in", "x", "." ]
def _np_softmax(x): """Compute softmax values for each sets of scores in x.""" e_x = np.exp(x - np.max(x)) return e_x / e_x.sum(axis=0)
[ "def", "_np_softmax", "(", "x", ")", ":", "e_x", "=", "np", ".", "exp", "(", "x", "-", "np", ".", "max", "(", "x", ")", ")", "return", "e_x", "/", "e_x", ".", "sum", "(", "axis", "=", "0", ")" ]
https://github.com/uclnlp/jack/blob/9e5ffbd4fb2b0bd6b816fe6e14b9045ac776bb8e/jack/readers/extractive_qa/shared.py#L263-L266
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/multiprocessing/util.py
python
log_to_stderr
(level=None)
return _logger
Turn on logging and add a handler which prints to stderr
Turn on logging and add a handler which prints to stderr
[ "Turn", "on", "logging", "and", "add", "a", "handler", "which", "prints", "to", "stderr" ]
def log_to_stderr(level=None): ''' Turn on logging and add a handler which prints to stderr ''' global _log_to_stderr import logging logger = get_logger() formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT) handler = logging.StreamHandler() handler.setFormatter(formatter) logg...
[ "def", "log_to_stderr", "(", "level", "=", "None", ")", ":", "global", "_log_to_stderr", "import", "logging", "logger", "=", "get_logger", "(", ")", "formatter", "=", "logging", ".", "Formatter", "(", "DEFAULT_LOGGING_FORMAT", ")", "handler", "=", "logging", "...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/multiprocessing/util.py#L113-L129
frenetic-lang/pyretic
30462692f3e9675158862755955b44f3a37ea21c
pyretic/vendor/ryu/ryu/contrib/ncclient/operations/edit.py
python
DeleteConfig.request
(self, target)
return self._request(node)
Delete a configuration datastore. *target* specifies the name or URL of configuration datastore to delete :seealso: :ref:`srctarget_params`
Delete a configuration datastore.
[ "Delete", "a", "configuration", "datastore", "." ]
def request(self, target): """Delete a configuration datastore. *target* specifies the name or URL of configuration datastore to delete :seealso: :ref:`srctarget_params`""" node = new_ele("delete-config") node.append(util.datastore_or_url("target", target, self._assert)) ...
[ "def", "request", "(", "self", ",", "target", ")", ":", "node", "=", "new_ele", "(", "\"delete-config\"", ")", "node", ".", "append", "(", "util", ".", "datastore_or_url", "(", "\"target\"", ",", "target", ",", "self", ".", "_assert", ")", ")", "return",...
https://github.com/frenetic-lang/pyretic/blob/30462692f3e9675158862755955b44f3a37ea21c/pyretic/vendor/ryu/ryu/contrib/ncclient/operations/edit.py#L64-L72
hfaran/Tornado-JSON
fcc551e4b78cac9245e36376329d84afda296284
tornado_json/routes.py
python
get_module_routes
(module_name, custom_routes=None, exclusions=None, arg_pattern=r'(?P<{}>[a-zA-Z0-9_\-]+)')
return routes
r"""Create and return routes for module_name Routes are (url, RequestHandler) tuples :returns: list of routes for ``module_name`` with respect to ``exclusions`` and ``custom_routes``. Returned routes are with URLs formatted such that they are forward-slash-separated by module/class level ...
r"""Create and return routes for module_name
[ "r", "Create", "and", "return", "routes", "for", "module_name" ]
def get_module_routes(module_name, custom_routes=None, exclusions=None, arg_pattern=r'(?P<{}>[a-zA-Z0-9_\-]+)'): r"""Create and return routes for module_name Routes are (url, RequestHandler) tuples :returns: list of routes for ``module_name`` with respect to ``exclusions`` an...
[ "def", "get_module_routes", "(", "module_name", ",", "custom_routes", "=", "None", ",", "exclusions", "=", "None", ",", "arg_pattern", "=", "r'(?P<{}>[a-zA-Z0-9_\\-]+)'", ")", ":", "def", "has_method", "(", "module", ",", "cls_name", ",", "method_name", ")", ":"...
https://github.com/hfaran/Tornado-JSON/blob/fcc551e4b78cac9245e36376329d84afda296284/tornado_json/routes.py#L43-L199
ycszen/TorchSeg
62eeb159aee77972048d9d7688a28249d3c56735
model/bisenet/cityscapes.bisenet.X39/network.py
python
BiSeNet.forward
(self, data, label=None)
return F.log_softmax(self.heads[-1](pred_out[-1]), dim=1)
[]
def forward(self, data, label=None): spatial_out = self.spatial_path(data) context_blocks = self.context_path(data) context_blocks.reverse() global_context = self.global_context(context_blocks[0]) global_context = F.interpolate(global_context, ...
[ "def", "forward", "(", "self", ",", "data", ",", "label", "=", "None", ")", ":", "spatial_out", "=", "self", ".", "spatial_path", "(", "data", ")", "context_blocks", "=", "self", ".", "context_path", "(", "data", ")", "context_blocks", ".", "reverse", "(...
https://github.com/ycszen/TorchSeg/blob/62eeb159aee77972048d9d7688a28249d3c56735/model/bisenet/cityscapes.bisenet.X39/network.py#L73-L109
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/faster rcnn/CharlesShang-TFFRCNN-master/experiments/profiling/gprof2dot.py
python
UndefinedEvent.__init__
(self, event)
[]
def __init__(self, event): Exception.__init__(self) self.event = event
[ "def", "__init__", "(", "self", ",", "event", ")", ":", "Exception", ".", "__init__", "(", "self", ")", "self", ".", "event", "=", "event" ]
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/faster rcnn/CharlesShang-TFFRCNN-master/experiments/profiling/gprof2dot.py#L102-L104
codelucas/newspaper
f622011177f6c2e95e48d6076561e21c016f08c3
newspaper/extractors.py
python
ContentExtractor.get_canonical_link
(self, article_url, doc)
return meta_url
Return the article's canonical URL Gets the first available value of: 1. The rel=canonical tag 2. The og:url tag
Return the article's canonical URL
[ "Return", "the", "article", "s", "canonical", "URL" ]
def get_canonical_link(self, article_url, doc): """ Return the article's canonical URL Gets the first available value of: 1. The rel=canonical tag 2. The og:url tag """ links = self.parser.getElementsByTag(doc, tag='link', attr='rel', ...
[ "def", "get_canonical_link", "(", "self", ",", "article_url", ",", "doc", ")", ":", "links", "=", "self", ".", "parser", ".", "getElementsByTag", "(", "doc", ",", "tag", "=", "'link'", ",", "attr", "=", "'rel'", ",", "value", "=", "'canonical'", ")", "...
https://github.com/codelucas/newspaper/blob/f622011177f6c2e95e48d6076561e21c016f08c3/newspaper/extractors.py#L531-L567
enthought/traitsui
b7c38c7a47bf6ae7971f9ddab70c8a358647dd25
traitsui/qt4/list_editor.py
python
SimpleEditor.update_editor
(self)
Updates the editor when the object trait changes externally to the editor.
Updates the editor when the object trait changes externally to the editor.
[ "Updates", "the", "editor", "when", "the", "object", "trait", "changes", "externally", "to", "the", "editor", "." ]
def update_editor(self): """Updates the editor when the object trait changes externally to the editor. """ self.mapper = QtCore.QSignalMapper(self.control) # Disconnect the editor from any control about to be destroyed: self._dispose_items() list_pane = self._lis...
[ "def", "update_editor", "(", "self", ")", ":", "self", ".", "mapper", "=", "QtCore", ".", "QSignalMapper", "(", "self", ".", "control", ")", "# Disconnect the editor from any control about to be destroyed:", "self", ".", "_dispose_items", "(", ")", "list_pane", "=",...
https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/qt4/list_editor.py#L170-L235
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_openshift_3.2/library/oc_image.py
python
Yedit.yaml_dict
(self)
return self.__yaml_dict
getter method for yaml_dict
getter method for yaml_dict
[ "getter", "method", "for", "yaml_dict" ]
def yaml_dict(self): ''' getter method for yaml_dict ''' return self.__yaml_dict
[ "def", "yaml_dict", "(", "self", ")", ":", "return", "self", ".", "__yaml_dict" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oc_image.py#L516-L518
amygdala/code-snippets
9fa00e5a4ec4ae3eb5a2fa212d1ecefb4009eba7
cloud_run/twilio_vision/src/whats_that.py
python
construct_message
(labels, face_annotations, logos)
return resp
Build up the response from the labels found
Build up the response from the labels found
[ "Build", "up", "the", "response", "from", "the", "labels", "found" ]
def construct_message(labels, face_annotations, logos): """Build up the response from the labels found""" # We'll use this to construct our response response_text = PRETEXT label_desc = "" pos_labels = ['very likely', 'likely', 'possibly'] # Go through labels and turn them into text of the res...
[ "def", "construct_message", "(", "labels", ",", "face_annotations", ",", "logos", ")", ":", "# We'll use this to construct our response", "response_text", "=", "PRETEXT", "label_desc", "=", "\"\"", "pos_labels", "=", "[", "'very likely'", ",", "'likely'", ",", "'possi...
https://github.com/amygdala/code-snippets/blob/9fa00e5a4ec4ae3eb5a2fa212d1ecefb4009eba7/cloud_run/twilio_vision/src/whats_that.py#L84-L127
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/reformer/convert_reformer_trax_checkpoint_to_pytorch.py
python
set_param
(torch_layer, weight, bias=None)
[]
def set_param(torch_layer, weight, bias=None): # set parameter of one layer assert torch_layer.weight.shape == weight.shape, f"{torch_layer} layer.weight does not match" torch_layer.weight = nn.Parameter(weight) if bias is not None: assert torch_layer.bias.shape == bias.shape, f"{torch_layer} la...
[ "def", "set_param", "(", "torch_layer", ",", "weight", ",", "bias", "=", "None", ")", ":", "# set parameter of one layer", "assert", "torch_layer", ".", "weight", ".", "shape", "==", "weight", ".", "shape", ",", "f\"{torch_layer} layer.weight does not match\"", "tor...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/reformer/convert_reformer_trax_checkpoint_to_pytorch.py#L32-L38
fsspec/filesystem_spec
76da18cf5a9697f480e5a0f6d1013d71676af131
fsspec/spec.py
python
AbstractBufferedFile._fetch_range
(self, start, end)
Get the specified set of bytes from remote
Get the specified set of bytes from remote
[ "Get", "the", "specified", "set", "of", "bytes", "from", "remote" ]
def _fetch_range(self, start, end): """Get the specified set of bytes from remote""" raise NotImplementedError
[ "def", "_fetch_range", "(", "self", ",", "start", ",", "end", ")", ":", "raise", "NotImplementedError" ]
https://github.com/fsspec/filesystem_spec/blob/76da18cf5a9697f480e5a0f6d1013d71676af131/fsspec/spec.py#L1520-L1522
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
rpython/rlib/rbigint.py
python
_muladd1
(a, n, extra=0)
return z
UNSAFE Multiply by a single digit and add a single digit, ignoring the sign.
UNSAFE Multiply by a single digit and add a single digit, ignoring the sign.
[ "UNSAFE", "Multiply", "by", "a", "single", "digit", "and", "add", "a", "single", "digit", "ignoring", "the", "sign", "." ]
def _muladd1(a, n, extra=0): """UNSAFE Multiply by a single digit and add a single digit, ignoring the sign. """ size_a = a.numdigits() z = rbigint([NULLDIGIT] * (size_a+1), 1) assert extra & MASK == extra carry = _widen_digit(extra) i = 0 while i < size_a: carry += a.widedigit(...
[ "def", "_muladd1", "(", "a", ",", "n", ",", "extra", "=", "0", ")", ":", "size_a", "=", "a", ".", "numdigits", "(", ")", "z", "=", "rbigint", "(", "[", "NULLDIGIT", "]", "*", "(", "size_a", "+", "1", ")", ",", "1", ")", "assert", "extra", "&"...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/rpython/rlib/rbigint.py#L1929-L1945
blackye/lalascan
e35726e6648525eb47493e39ee63a2a906dbb4b2
thirdparty_libs/requests/packages/urllib3/response.py
python
HTTPResponse.get_redirect_location
(self)
return False
Should we redirect and where to? :returns: Truthy redirect location string if we got a redirect status code and valid location. ``None`` if redirect status and no location. ``False`` if not a redirect status code.
Should we redirect and where to?
[ "Should", "we", "redirect", "and", "where", "to?" ]
def get_redirect_location(self): """ Should we redirect and where to? :returns: Truthy redirect location string if we got a redirect status code and valid location. ``None`` if redirect status and no location. ``False`` if not a redirect status code. """ ...
[ "def", "get_redirect_location", "(", "self", ")", ":", "if", "self", ".", "status", "in", "[", "301", ",", "302", ",", "303", ",", "307", "]", ":", "return", "self", ".", "headers", ".", "get", "(", "'location'", ")", "return", "False" ]
https://github.com/blackye/lalascan/blob/e35726e6648525eb47493e39ee63a2a906dbb4b2/thirdparty_libs/requests/packages/urllib3/response.py#L102-L113
Lausannen/NAS-FCOS
d586b28c0fae72a9f30119797732e614a2517de5
maskrcnn_benchmark/modeling/roi_heads/box_head/inference.py
python
PostProcessor.filter_results
(self, boxlist, num_classes)
return result
Returns bounding-box detection results by thresholding on scores and applying non-maximum suppression (NMS).
Returns bounding-box detection results by thresholding on scores and applying non-maximum suppression (NMS).
[ "Returns", "bounding", "-", "box", "detection", "results", "by", "thresholding", "on", "scores", "and", "applying", "non", "-", "maximum", "suppression", "(", "NMS", ")", "." ]
def filter_results(self, boxlist, num_classes): """Returns bounding-box detection results by thresholding on scores and applying non-maximum suppression (NMS). """ # unwrap the boxlist to avoid additional overhead. # if we had multi-class NMS, we could perform this directly on th...
[ "def", "filter_results", "(", "self", ",", "boxlist", ",", "num_classes", ")", ":", "# unwrap the boxlist to avoid additional overhead.", "# if we had multi-class NMS, we could perform this directly on the boxlist", "boxes", "=", "boxlist", ".", "bbox", ".", "reshape", "(", "...
https://github.com/Lausannen/NAS-FCOS/blob/d586b28c0fae72a9f30119797732e614a2517de5/maskrcnn_benchmark/modeling/roi_heads/box_head/inference.py#L95-L136
netzob/netzob
49ee3e5e7d6dce67496afd5a75827a78be0c9f70
netzob/src/netzob/Common/CommandLine.py
python
CommandLine.isInteractiveConsoleRequested
(self)
return self.providedOptions.interactive
Compute and returns if the user has requested the initiation of an interactive session
Compute and returns if the user has requested the initiation of an interactive session
[ "Compute", "and", "returns", "if", "the", "user", "has", "requested", "the", "initiation", "of", "an", "interactive", "session" ]
def isInteractiveConsoleRequested(self): """Compute and returns if the user has requested the initiation of an interactive session""" if self.parser is None: self.parse() if self.providedOptions is None: return False return self.providedOptions.interactive
[ "def", "isInteractiveConsoleRequested", "(", "self", ")", ":", "if", "self", ".", "parser", "is", "None", ":", "self", ".", "parse", "(", ")", "if", "self", ".", "providedOptions", "is", "None", ":", "return", "False", "return", "self", ".", "providedOptio...
https://github.com/netzob/netzob/blob/49ee3e5e7d6dce67496afd5a75827a78be0c9f70/netzob/src/netzob/Common/CommandLine.py#L71-L77
HKUST-KnowComp/MnemonicReader
76aeb1d9021eaecb8d6d26caa00464ebeca8e87e
script/train.py
python
set_defaults
(args)
return args
Make sure the commandline arguments are initialized properly.
Make sure the commandline arguments are initialized properly.
[ "Make", "sure", "the", "commandline", "arguments", "are", "initialized", "properly", "." ]
def set_defaults(args): """Make sure the commandline arguments are initialized properly.""" # Check critical files exist args.dev_json = os.path.join(args.data_dir, args.dev_json) if not os.path.isfile(args.dev_json): raise IOError('No such file: %s' % args.dev_json) args.train_file = os.pat...
[ "def", "set_defaults", "(", "args", ")", ":", "# Check critical files exist", "args", ".", "dev_json", "=", "os", ".", "path", ".", "join", "(", "args", ".", "data_dir", ",", "args", ".", "dev_json", ")", "if", "not", "os", ".", "path", ".", "isfile", ...
https://github.com/HKUST-KnowComp/MnemonicReader/blob/76aeb1d9021eaecb8d6d26caa00464ebeca8e87e/script/train.py#L125-L186
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
example/ctp/futures/__init__.py
python
TraderApi.ReqFromBankToFutureByFuture
(self, pReqTransfer, nRequestID)
return 0
期货发起银行资金转期货请求
期货发起银行资金转期货请求
[ "期货发起银行资金转期货请求" ]
def ReqFromBankToFutureByFuture(self, pReqTransfer, nRequestID): """期货发起银行资金转期货请求""" return 0
[ "def", "ReqFromBankToFutureByFuture", "(", "self", ",", "pReqTransfer", ",", "nRequestID", ")", ":", "return", "0" ]
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/futures/__init__.py#L485-L487
polychromatic/polychromatic
106bc3fdfda650a732341bf45e0d20fd281cc521
pylib/controller/shared.py
python
_translate_widget
(appdata, widget)
Translates the strings of a widget loaded using uic.loadUi()
Translates the strings of a widget loaded using uic.loadUi()
[ "Translates", "the", "strings", "of", "a", "widget", "loaded", "using", "uic", ".", "loadUi", "()" ]
def _translate_widget(appdata, widget): """ Translates the strings of a widget loaded using uic.loadUi() """ _ = appdata._ def _translate(set_function, string): if string: set_function(_(string)) if type(widget) == QWidget: return if type(widget) in [QMenu, QGr...
[ "def", "_translate_widget", "(", "appdata", ",", "widget", ")", ":", "_", "=", "appdata", ".", "_", "def", "_translate", "(", "set_function", ",", "string", ")", ":", "if", "string", ":", "set_function", "(", "_", "(", "string", ")", ")", "if", "type",...
https://github.com/polychromatic/polychromatic/blob/106bc3fdfda650a732341bf45e0d20fd281cc521/pylib/controller/shared.py#L153-L209
mcfletch/pyopengl
02d11dad9ff18e50db10e975c4756e17bf198464
OpenGL/GLES2/ARM/shader_framebuffer_fetch_depth_stencil.py
python
glInitShaderFramebufferFetchDepthStencilARM
()
return extensions.hasGLExtension( _EXTENSION_NAME )
Return boolean indicating whether this extension is available
Return boolean indicating whether this extension is available
[ "Return", "boolean", "indicating", "whether", "this", "extension", "is", "available" ]
def glInitShaderFramebufferFetchDepthStencilARM(): '''Return boolean indicating whether this extension is available''' from OpenGL import extensions return extensions.hasGLExtension( _EXTENSION_NAME )
[ "def", "glInitShaderFramebufferFetchDepthStencilARM", "(", ")", ":", "from", "OpenGL", "import", "extensions", "return", "extensions", ".", "hasGLExtension", "(", "_EXTENSION_NAME", ")" ]
https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GLES2/ARM/shader_framebuffer_fetch_depth_stencil.py#L32-L35
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/dns/rdtypes/ANY/SOA.py
python
SOA.from_text
(cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None)
return cls(rdclass, rdtype, mname, rname, serial, refresh, retry, expire, minimum)
[]
def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None): mname = tok.get_name(origin, relativize, relativize_to) rname = tok.get_name(origin, relativize, relativize_to) serial = tok.get_uint32() refresh = tok.get_ttl() retry = ...
[ "def", "from_text", "(", "cls", ",", "rdclass", ",", "rdtype", ",", "tok", ",", "origin", "=", "None", ",", "relativize", "=", "True", ",", "relativize_to", "=", "None", ")", ":", "mname", "=", "tok", ".", "get_name", "(", "origin", ",", "relativize", ...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dns/rdtypes/ANY/SOA.py#L53-L64
puremourning/vimspector
bc57b1dd14214cf3e3a476ef75e9dcb56cf0c76d
python3/vimspector/settings.py
python
Dict
( option )
return _UpdateDict( DICT_TYPE( DEFAULTS.get( option, {} ) ), vim.vars.get( f'vimspector_{ option }', DICT_TYPE() ) )
[]
def Dict( option ): return _UpdateDict( DICT_TYPE( DEFAULTS.get( option, {} ) ), vim.vars.get( f'vimspector_{ option }', DICT_TYPE() ) )
[ "def", "Dict", "(", "option", ")", ":", "return", "_UpdateDict", "(", "DICT_TYPE", "(", "DEFAULTS", ".", "get", "(", "option", ",", "{", "}", ")", ")", ",", "vim", ".", "vars", ".", "get", "(", "f'vimspector_{ option }'", ",", "DICT_TYPE", "(", ")", ...
https://github.com/puremourning/vimspector/blob/bc57b1dd14214cf3e3a476ef75e9dcb56cf0c76d/python3/vimspector/settings.py#L103-L105
redis/redis-py
0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7
redis/commands/bf/commands.py
python
CMSCommands.info
(self, key)
return self.execute_command(CMS_INFO, key)
Return width, depth and total count of the sketch. For more information see `CMS.INFO <https://oss.redis.com/redisbloom/master/CountMinSketch_Commands/#cmsinfo>`_.
Return width, depth and total count of the sketch. For more information see `CMS.INFO <https://oss.redis.com/redisbloom/master/CountMinSketch_Commands/#cmsinfo>`_.
[ "Return", "width", "depth", "and", "total", "count", "of", "the", "sketch", ".", "For", "more", "information", "see", "CMS", ".", "INFO", "<https", ":", "//", "oss", ".", "redis", ".", "com", "/", "redisbloom", "/", "master", "/", "CountMinSketch_Commands"...
def info(self, key): """ Return width, depth and total count of the sketch. For more information see `CMS.INFO <https://oss.redis.com/redisbloom/master/CountMinSketch_Commands/#cmsinfo>`_. """ # noqa return self.execute_command(CMS_INFO, key)
[ "def", "info", "(", "self", ",", "key", ")", ":", "# noqa", "return", "self", ".", "execute_command", "(", "CMS_INFO", ",", "key", ")" ]
https://github.com/redis/redis-py/blob/0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7/redis/commands/bf/commands.py#L493-L498
pycom/pycom-libraries
75d0e67cb421e0576a3a9677bb0d9d81f27ebdb7
pymesh/pymesh_frozen/main_BR.py
python
new_br_message_cb
(rcv_ip, rcv_port, rcv_data, dest_ip, dest_port)
return
callback triggered when a new packet arrived for the current Border Router, having destination an IP which is external from Mesh
callback triggered when a new packet arrived for the current Border Router, having destination an IP which is external from Mesh
[ "callback", "triggered", "when", "a", "new", "packet", "arrived", "for", "the", "current", "Border", "Router", "having", "destination", "an", "IP", "which", "is", "external", "from", "Mesh" ]
def new_br_message_cb(rcv_ip, rcv_port, rcv_data, dest_ip, dest_port): ''' callback triggered when a new packet arrived for the current Border Router, having destination an IP which is external from Mesh ''' print('Incoming %d bytes from %s (port %d), to external IPv6 %s (port %d)' % (len(rcv_da...
[ "def", "new_br_message_cb", "(", "rcv_ip", ",", "rcv_port", ",", "rcv_data", ",", "dest_ip", ",", "dest_port", ")", ":", "print", "(", "'Incoming %d bytes from %s (port %d), to external IPv6 %s (port %d)'", "%", "(", "len", "(", "rcv_data", ")", ",", "rcv_ip", ",", ...
https://github.com/pycom/pycom-libraries/blob/75d0e67cb421e0576a3a9677bb0d9d81f27ebdb7/pymesh/pymesh_frozen/main_BR.py#L42-L67
nosmokingbandit/Watcher3
0217e75158b563bdefc8e01c3be7620008cf3977
lib/sqlalchemy/sql/schema.py
python
Table._sorted_constraints
(self)
return sorted(self.constraints, key=lambda c: c._creation_order)
Return the set of constraints as a list, sorted by creation order.
Return the set of constraints as a list, sorted by creation order.
[ "Return", "the", "set", "of", "constraints", "as", "a", "list", "sorted", "by", "creation", "order", "." ]
def _sorted_constraints(self): """Return the set of constraints as a list, sorted by creation order. """ return sorted(self.constraints, key=lambda c: c._creation_order)
[ "def", "_sorted_constraints", "(", "self", ")", ":", "return", "sorted", "(", "self", ".", "constraints", ",", "key", "=", "lambda", "c", ":", "c", ".", "_creation_order", ")" ]
https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/sqlalchemy/sql/schema.py#L535-L540
bingykang/Fewshot_Detection
ddfd3fdc8bc5a9a2ca956cad6a5ed07a4660bdb6
dynamic_conv.py
python
_ConvNd.__init__
(self, in_channels, out_channels, kernel_size, stride, padding, dilation, transposed, output_padding, groups, bias)
if transposed: self.weight = Parameter(torch.Tensor( in_channels, out_channels // groups, *kernel_size)) else: self.weight = Parameter(torch.Tensor( out_channels, in_channels // groups, *kernel_size))
if transposed: self.weight = Parameter(torch.Tensor( in_channels, out_channels // groups, *kernel_size)) else: self.weight = Parameter(torch.Tensor( out_channels, in_channels // groups, *kernel_size))
[ "if", "transposed", ":", "self", ".", "weight", "=", "Parameter", "(", "torch", ".", "Tensor", "(", "in_channels", "out_channels", "//", "groups", "*", "kernel_size", "))", "else", ":", "self", ".", "weight", "=", "Parameter", "(", "torch", ".", "Tensor", ...
def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, transposed, output_padding, groups, bias): super(_ConvNd, self).__init__() if in_channels % groups != 0: raise ValueError('in_channels must be divisible by groups') if out_channels ...
[ "def", "__init__", "(", "self", ",", "in_channels", ",", "out_channels", ",", "kernel_size", ",", "stride", ",", "padding", ",", "dilation", ",", "transposed", ",", "output_padding", ",", "groups", ",", "bias", ")", ":", "super", "(", "_ConvNd", ",", "self...
https://github.com/bingykang/Fewshot_Detection/blob/ddfd3fdc8bc5a9a2ca956cad6a5ed07a4660bdb6/dynamic_conv.py#L15-L49
Jack-Cherish/Deep-Learning
5fd254b61ad45367fbae28c49976e82b14ff7110
Tutorial/lesson-3/fc.py
python
Normalizer.denorm
(self, vec)
return reduce(lambda x, y: x + y, binary)
[]
def denorm(self, vec): binary = list(map(lambda i: 1 if i > 0.5 else 0, vec[:, 0])) for i in range(len(self.mask)): binary[i] = binary[i] * self.mask[i] return reduce(lambda x, y: x + y, binary)
[ "def", "denorm", "(", "self", ",", "vec", ")", ":", "binary", "=", "list", "(", "map", "(", "lambda", "i", ":", "1", "if", "i", ">", "0.5", "else", "0", ",", "vec", "[", ":", ",", "0", "]", ")", ")", "for", "i", "in", "range", "(", "len", ...
https://github.com/Jack-Cherish/Deep-Learning/blob/5fd254b61ad45367fbae28c49976e82b14ff7110/Tutorial/lesson-3/fc.py#L165-L169
AstroPrint/AstroBox
e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75
src/ext/makerbot_driver/s3g.py
python
s3g.toggle_ABP
(self, tool_index, state)
This sets the on/off state of the ABP's conveyor belt @param boolean : Turns on or off the ABP's conveyor belt
This sets the on/off state of the ABP's conveyor belt
[ "This", "sets", "the", "on", "/", "off", "state", "of", "the", "ABP", "s", "conveyor", "belt" ]
def toggle_ABP(self, tool_index, state): """ This sets the on/off state of the ABP's conveyor belt @param boolean : Turns on or off the ABP's conveyor belt """ enable = 0 if state: enable = 1 payload = struct.pack( '<B', enable ...
[ "def", "toggle_ABP", "(", "self", ",", "tool_index", ",", "state", ")", ":", "enable", "=", "0", "if", "state", ":", "enable", "=", "1", "payload", "=", "struct", ".", "pack", "(", "'<B'", ",", "enable", ")", "self", ".", "tool_action_command", "(", ...
https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/ext/makerbot_driver/s3g.py#L1416-L1428
borgbase/vorta
23c47673c009bdef8baebb0b9cdf5e78c07fe373
package/fix_app_qt_folder_names_for_codesign.py
python
find_problematic_folders
(folder: Path)
Recursively yields problematic folders (containing a dot in their name).
Recursively yields problematic folders (containing a dot in their name).
[ "Recursively", "yields", "problematic", "folders", "(", "containing", "a", "dot", "in", "their", "name", ")", "." ]
def find_problematic_folders(folder: Path) -> Generator[Path, None, None]: """Recursively yields problematic folders (containing a dot in their name).""" for path in folder.iterdir(): if not path.is_dir() or path.is_symlink(): # Skip simlinks as they are allowed (even with a dot) ...
[ "def", "find_problematic_folders", "(", "folder", ":", "Path", ")", "->", "Generator", "[", "Path", ",", "None", ",", "None", "]", ":", "for", "path", "in", "folder", ".", "iterdir", "(", ")", ":", "if", "not", "path", ".", "is_dir", "(", ")", "or", ...
https://github.com/borgbase/vorta/blob/23c47673c009bdef8baebb0b9cdf5e78c07fe373/package/fix_app_qt_folder_names_for_codesign.py#L73-L82
zatosource/zato
2a9d273f06f9d776fbfeb53e73855af6e40fa208
code/zato-server/src/zato/server/base/parallel/__init__.py
python
ParallelServer.cleanup_wsx
(self, needs_pid=False)
Delete persistent information about WSX clients currently registered with the server.
Delete persistent information about WSX clients currently registered with the server.
[ "Delete", "persistent", "information", "about", "WSX", "clients", "currently", "registered", "with", "the", "server", "." ]
def cleanup_wsx(self, needs_pid=False): """ Delete persistent information about WSX clients currently registered with the server. """ wsx_service = 'zato.channel.web-socket.client.delete-by-server' if self.service_store.is_deployed(wsx_service): self.invoke(wsx_service, {'ne...
[ "def", "cleanup_wsx", "(", "self", ",", "needs_pid", "=", "False", ")", ":", "wsx_service", "=", "'zato.channel.web-socket.client.delete-by-server'", "if", "self", ".", "service_store", ".", "is_deployed", "(", "wsx_service", ")", ":", "self", ".", "invoke", "(", ...
https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/zato-server/src/zato/server/base/parallel/__init__.py#L1207-L1213
danthelion/doc2audiobook
700714b793dd511ff189e1778300b019f3188961
doc2audiobook.py
python
process_input_files
(input_path: Path, output_directory_path: Path, client: texttospeech.TextToSpeechClient, voice: texttospeech.types.VoiceSelectionParams, audio_config: texttospeech.types.AudioConfig )
Process every file inside `input_directory_path` and save results in `output_directory_path`. :param input_path: Full path to the input directory or a singular file (inside the mapped input directory). :param output_directory_path: Full path to the output directory. :param client: TextToSpeechClient instan...
Process every file inside `input_directory_path` and save results in `output_directory_path`.
[ "Process", "every", "file", "inside", "input_directory_path", "and", "save", "results", "in", "output_directory_path", "." ]
def process_input_files(input_path: Path, output_directory_path: Path, client: texttospeech.TextToSpeechClient, voice: texttospeech.types.VoiceSelectionParams, audio_config: texttospeech.types.AudioConfig ...
[ "def", "process_input_files", "(", "input_path", ":", "Path", ",", "output_directory_path", ":", "Path", ",", "client", ":", "texttospeech", ".", "TextToSpeechClient", ",", "voice", ":", "texttospeech", ".", "types", ".", "VoiceSelectionParams", ",", "audio_config",...
https://github.com/danthelion/doc2audiobook/blob/700714b793dd511ff189e1778300b019f3188961/doc2audiobook.py#L27-L55
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/aifc.py
python
_write_long
(f, x)
[]
def _write_long(f, x): f.write(struct.pack('>l', x))
[ "def", "_write_long", "(", "f", ",", "x", ")", ":", "f", ".", "write", "(", "struct", ".", "pack", "(", "'>l'", ",", "x", ")", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/aifc.py#L207-L208
autonomio/talos
b4c823ccae9db2d4815cf468c22362af2b9e0c21
talos/commands/evaluate.py
python
Evaluate.evaluate
(self, x, y, task, metric, model_id=None, folds=5, shuffle=True, asc=False, print_out=False)
return out
Evaluate a model based on f1_score (all except regression) or mae (for regression). Supports 'binary', 'multi_class', 'multi_label', and 'regression' evaluation. x : array The input data for making predictions y : array The ground truth for x model_id : i...
Evaluate a model based on f1_score (all except regression) or mae (for regression). Supports 'binary', 'multi_class', 'multi_label', and 'regression' evaluation.
[ "Evaluate", "a", "model", "based", "on", "f1_score", "(", "all", "except", "regression", ")", "or", "mae", "(", "for", "regression", ")", ".", "Supports", "binary", "multi_class", "multi_label", "and", "regression", "evaluation", "." ]
def evaluate(self, x, y, task, metric, model_id=None, folds=5, shuffle=True, asc=False, print_out=False): '''Evaluate a model based on f1_score (all except re...
[ "def", "evaluate", "(", "self", ",", "x", ",", "y", ",", "task", ",", "metric", ",", "model_id", "=", "None", ",", "folds", "=", "5", ",", "shuffle", "=", "True", ",", "asc", "=", "False", ",", "print_out", "=", "False", ")", ":", "import", "nump...
https://github.com/autonomio/talos/blob/b4c823ccae9db2d4815cf468c22362af2b9e0c21/talos/commands/evaluate.py#L14-L97
etetoolkit/ete
2b207357dc2a40ccad7bfd8f54964472c72e4726
ete3/phylomedb/phylomeDB.py
python
PhylomeDBConnector.get_seed_ids
(self, phylome_id, filter_isoforms=True)
return seedids
[]
def get_seed_ids(self, phylome_id, filter_isoforms=True): # WORKS VERY SLOW !! cmd = 'SELECT seed_proteome FROM %s WHERE phylome_id="%s";' % (self._phylomes_table, phylome_id) if self._SQL.execute(cmd): seed_proteome = self._SQL.fetchone()[0] seedids = self.get_seqids_in_...
[ "def", "get_seed_ids", "(", "self", ",", "phylome_id", ",", "filter_isoforms", "=", "True", ")", ":", "# WORKS VERY SLOW !!", "cmd", "=", "'SELECT seed_proteome FROM %s WHERE phylome_id=\"%s\";'", "%", "(", "self", ".", "_phylomes_table", ",", "phylome_id", ")", "if",...
https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/phylomedb/phylomeDB.py#L442-L450
cmbruns/pyopenvr
ac4847a8a05cda0d4bcf7c4f243008b2a191c7a5
src/openvr/__init__.py
python
IVRApplications.getApplicationPropertyBool
(self, appKey: str, property_)
return result
Returns a bool value for an application property. Returns false in all error cases.
Returns a bool value for an application property. Returns false in all error cases.
[ "Returns", "a", "bool", "value", "for", "an", "application", "property", ".", "Returns", "false", "in", "all", "error", "cases", "." ]
def getApplicationPropertyBool(self, appKey: str, property_): """Returns a bool value for an application property. Returns false in all error cases.""" fn = self.function_table.getApplicationPropertyBool if appKey is not None: appKey = bytes(appKey, encoding='utf-8') error = ...
[ "def", "getApplicationPropertyBool", "(", "self", ",", "appKey", ":", "str", ",", "property_", ")", ":", "fn", "=", "self", ".", "function_table", ".", "getApplicationPropertyBool", "if", "appKey", "is", "not", "None", ":", "appKey", "=", "bytes", "(", "appK...
https://github.com/cmbruns/pyopenvr/blob/ac4847a8a05cda0d4bcf7c4f243008b2a191c7a5/src/openvr/__init__.py#L3612-L3620
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/v6_0/work_item_tracking_process/work_item_tracking_process_client.py
python
WorkItemTrackingProcessClient.create_state_definition
(self, state_model, process_id, wit_ref_name)
return self._deserialize('WorkItemStateResultModel', response)
CreateStateDefinition. [Preview API] Creates a state definition in the work item type of the process. :param :class:`<WorkItemStateInputModel> <azure.devops.v6_0.work_item_tracking_process.models.WorkItemStateInputModel>` state_model: :param str process_id: The ID of the process :param s...
CreateStateDefinition. [Preview API] Creates a state definition in the work item type of the process. :param :class:`<WorkItemStateInputModel> <azure.devops.v6_0.work_item_tracking_process.models.WorkItemStateInputModel>` state_model: :param str process_id: The ID of the process :param s...
[ "CreateStateDefinition", ".", "[", "Preview", "API", "]", "Creates", "a", "state", "definition", "in", "the", "work", "item", "type", "of", "the", "process", ".", ":", "param", ":", "class", ":", "<WorkItemStateInputModel", ">", "<azure", ".", "devops", ".",...
def create_state_definition(self, state_model, process_id, wit_ref_name): """CreateStateDefinition. [Preview API] Creates a state definition in the work item type of the process. :param :class:`<WorkItemStateInputModel> <azure.devops.v6_0.work_item_tracking_process.models.WorkItemStateInputModel...
[ "def", "create_state_definition", "(", "self", ",", "state_model", ",", "process_id", ",", "wit_ref_name", ")", ":", "route_values", "=", "{", "}", "if", "process_id", "is", "not", "None", ":", "route_values", "[", "'processId'", "]", "=", "self", ".", "_ser...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v6_0/work_item_tracking_process/work_item_tracking_process_client.py#L824-L843
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_adm_router.py
python
Service.add_cluster_ip
(self, sip)
add cluster ip
add cluster ip
[ "add", "cluster", "ip" ]
def add_cluster_ip(self, sip): '''add cluster ip''' self.put(Service.cluster_ip, sip)
[ "def", "add_cluster_ip", "(", "self", ",", "sip", ")", ":", "self", ".", "put", "(", "Service", ".", "cluster_ip", ",", "sip", ")" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_adm_router.py#L1735-L1737
tensorflow/tensorboard
61d11d99ef034c30ba20b6a7840c8eededb9031c
tensorboard/plugin_util.py
python
markdowns_to_safe_html
(markdown_strings, combine)
return warning + sanitized_combined
Convert multiple Markdown documents to one safe HTML document. One could also achieve this by calling `markdown_to_safe_html` multiple times and combining the results. Compared to that approach, this function may be faster, because HTML sanitization (which can be expensive) is performed only once rathe...
Convert multiple Markdown documents to one safe HTML document.
[ "Convert", "multiple", "Markdown", "documents", "to", "one", "safe", "HTML", "document", "." ]
def markdowns_to_safe_html(markdown_strings, combine): """Convert multiple Markdown documents to one safe HTML document. One could also achieve this by calling `markdown_to_safe_html` multiple times and combining the results. Compared to that approach, this function may be faster, because HTML sanitiza...
[ "def", "markdowns_to_safe_html", "(", "markdown_strings", ",", "combine", ")", ":", "unsafe_htmls", "=", "[", "]", "total_null_bytes", "=", "0", "for", "source", "in", "markdown_strings", ":", "# Convert to utf-8 whenever we have a binary input.", "if", "isinstance", "(...
https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/plugin_util.py#L122-L169
rcorcs/NatI
fdf014f4292afdc95250add7b6658468043228e1
en/parser/nltk_lite/draw/__init__.py
python
CanvasWidget.__press_cb
(self, event)
Handle a button-press event: - record the button press event in C{self.__press} - register a button-release callback. - if this CanvasWidget or any of its ancestors are draggable, then register the appropriate motion callback.
Handle a button-press event: - record the button press event in C{self.__press} - register a button-release callback. - if this CanvasWidget or any of its ancestors are draggable, then register the appropriate motion callback.
[ "Handle", "a", "button", "-", "press", "event", ":", "-", "record", "the", "button", "press", "event", "in", "C", "{", "self", ".", "__press", "}", "-", "register", "a", "button", "-", "release", "callback", ".", "-", "if", "this", "CanvasWidget", "or"...
def __press_cb(self, event): """ Handle a button-press event: - record the button press event in C{self.__press} - register a button-release callback. - if this CanvasWidget or any of its ancestors are draggable, then register the appropriate motion callback. ...
[ "def", "__press_cb", "(", "self", ",", "event", ")", ":", "# If we're already waiting for a button release, then ignore", "# this new button press.", "if", "(", "self", ".", "__canvas", ".", "bind", "(", "'<ButtonRelease-1>'", ")", "or", "self", ".", "__canvas", ".", ...
https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/parser/nltk_lite/draw/__init__.py#L524-L557
d6t/d6tpipe
4ec6c755504f5fe6d5b71e8621375315ce41ad6f
d6tpipe/luigi/ftp.py
python
AtomicFtpFile.__init__
(self, fs, path)
Initializes an AtomicFtpfile instance. :param fs: :param path: :type path: str
Initializes an AtomicFtpfile instance. :param fs: :param path: :type path: str
[ "Initializes", "an", "AtomicFtpfile", "instance", ".", ":", "param", "fs", ":", ":", "param", "path", ":", ":", "type", "path", ":", "str" ]
def __init__(self, fs, path): """ Initializes an AtomicFtpfile instance. :param fs: :param path: :type path: str """ self._fs = fs super(AtomicFtpFile, self).__init__(path)
[ "def", "__init__", "(", "self", ",", "fs", ",", "path", ")", ":", "self", ".", "_fs", "=", "fs", "super", "(", "AtomicFtpFile", ",", "self", ")", ".", "__init__", "(", "path", ")" ]
https://github.com/d6t/d6tpipe/blob/4ec6c755504f5fe6d5b71e8621375315ce41ad6f/d6tpipe/luigi/ftp.py#L409-L417
thingsboard/thingsboard-gateway
1d1b1fc2450852dbd56ff137c6bfd49143dc758d
thingsboard_gateway/tb_utility/tb_gateway_remote_configurator.py
python
RemoteConfigurator.process_configuration
(self, configuration)
[]
def process_configuration(self, configuration): try: if not self.in_process: self.in_process = True # while not self.__gateway._published_events.empty(): # LOG.debug("Waiting for end of the data processing...") # sleep(1) ...
[ "def", "process_configuration", "(", "self", ",", "configuration", ")", ":", "try", ":", "if", "not", "self", ".", "in_process", ":", "self", ".", "in_process", "=", "True", "# while not self.__gateway._published_events.empty():", "# LOG.debug(\"Waiting for end of the...
https://github.com/thingsboard/thingsboard-gateway/blob/1d1b1fc2450852dbd56ff137c6bfd49143dc758d/thingsboard_gateway/tb_utility/tb_gateway_remote_configurator.py#L52-L80
DinoTools/python-overpy
5343e743e87c117531f1e321a424911ff4cee8cf
overpy/__init__.py
python
Result.__init__
( self, elements: Optional[List[Union["Area", "Node", "Relation", "Way"]]] = None, api: Optional[Overpass] = None)
:param elements: List of elements to initialize the result with :param api: The API object to load additional resources and elements
[]
def __init__( self, elements: Optional[List[Union["Area", "Node", "Relation", "Way"]]] = None, api: Optional[Overpass] = None): """ :param elements: List of elements to initialize the result with :param api: The API object to load additional resources and ele...
[ "def", "__init__", "(", "self", ",", "elements", ":", "Optional", "[", "List", "[", "Union", "[", "\"Area\"", ",", "\"Node\"", ",", "\"Relation\"", ",", "\"Way\"", "]", "]", "]", "=", "None", ",", "api", ":", "Optional", "[", "Overpass", "]", "=", "N...
https://github.com/DinoTools/python-overpy/blob/5343e743e87c117531f1e321a424911ff4cee8cf/overpy/__init__.py#L242-L271
wusaifei/garbage_classify
107b0c02499828e72978b6fe0aa704ecb9457d30
tta_wrapper/functional.py
python
Multiply.forward
(self, image, param)
return image * param
[]
def forward(self, image, param): return image * param
[ "def", "forward", "(", "self", ",", "image", ",", "param", ")", ":", "return", "image", "*", "param" ]
https://github.com/wusaifei/garbage_classify/blob/107b0c02499828e72978b6fe0aa704ecb9457d30/tta_wrapper/functional.py#L121-L122
deepmind/pysc2
05b28ef0d85aa5eef811bc49ff4c0cbe496c0adb
pysc2/lib/remote_controller.py
python
RemoteController.game_info
(self)
return self._client.send(game_info=sc_pb.RequestGameInfo())
Get the basic information about the game.
Get the basic information about the game.
[ "Get", "the", "basic", "information", "about", "the", "game", "." ]
def game_info(self): """Get the basic information about the game.""" return self._client.send(game_info=sc_pb.RequestGameInfo())
[ "def", "game_info", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "send", "(", "game_info", "=", "sc_pb", ".", "RequestGameInfo", "(", ")", ")" ]
https://github.com/deepmind/pysc2/blob/05b28ef0d85aa5eef811bc49ff4c0cbe496c0adb/pysc2/lib/remote_controller.py#L227-L229
SurrealAI/surreal
ae9e5f43bdd7d1bc6d39d0a4783b96b2c117fade
surreal/main/rollout.py
python
restore_model
(folder, filename)
return data['model']
Loads model from an experiment folder.
Loads model from an experiment folder.
[ "Loads", "model", "from", "an", "experiment", "folder", "." ]
def restore_model(folder, filename): """ Loads model from an experiment folder. """ path_to_ckpt = path.join(folder, "checkpoint", filename) with open(path_to_ckpt, 'rb') as fp: data = pickle.load(fp) return data['model']
[ "def", "restore_model", "(", "folder", ",", "filename", ")", ":", "path_to_ckpt", "=", "path", ".", "join", "(", "folder", ",", "\"checkpoint\"", ",", "filename", ")", "with", "open", "(", "path_to_ckpt", ",", "'rb'", ")", "as", "fp", ":", "data", "=", ...
https://github.com/SurrealAI/surreal/blob/ae9e5f43bdd7d1bc6d39d0a4783b96b2c117fade/surreal/main/rollout.py#L15-L22
THUDM/cogdl
881746a69b74d3667e2ce59bcbcf6a5835d52751
cogdl/layers/reversible_layer.py
python
AdditiveCoupling.__init__
(self, fm, gm=None, split_dim=-1)
This computes the output :math:`y` on forward given input :math:`x` and arbitrary modules :math:`Fm` and :math:`Gm` according to: :math:`(x1, x2) = x` :math:`y1 = x1 + Fm(x2)` :math:`y2 = x2 + Gm(y1)` :math:`y = (y1, y2)` Parameters ---------- Fm : :obj:`torch...
This computes the output :math:`y` on forward given input :math:`x` and arbitrary modules :math:`Fm` and :math:`Gm` according to: :math:`(x1, x2) = x` :math:`y1 = x1 + Fm(x2)` :math:`y2 = x2 + Gm(y1)` :math:`y = (y1, y2)` Parameters ---------- Fm : :obj:`torch...
[ "This", "computes", "the", "output", ":", "math", ":", "y", "on", "forward", "given", "input", ":", "math", ":", "x", "and", "arbitrary", "modules", ":", "math", ":", "Fm", "and", ":", "math", ":", "Gm", "according", "to", ":", ":", "math", ":", "(...
def __init__(self, fm, gm=None, split_dim=-1): """ This computes the output :math:`y` on forward given input :math:`x` and arbitrary modules :math:`Fm` and :math:`Gm` according to: :math:`(x1, x2) = x` :math:`y1 = x1 + Fm(x2)` :math:`y2 = x2 + Gm(y1)` :math:`y = (y1, y2)`...
[ "def", "__init__", "(", "self", ",", "fm", ",", "gm", "=", "None", ",", "split_dim", "=", "-", "1", ")", ":", "super", "(", "AdditiveCoupling", ",", "self", ")", ".", "__init__", "(", ")", "# mirror the passed module, without parameter sharing...", "if", "fm...
https://github.com/THUDM/cogdl/blob/881746a69b74d3667e2ce59bcbcf6a5835d52751/cogdl/layers/reversible_layer.py#L389-L416
PrefectHQ/prefect
67bdc94e2211726d99561f6f52614bec8970e981
src/prefect/serialization/environment.py
python
CustomEnvironmentSchema.create_object
(self, data: dict, **kwargs: Any)
return Environment(labels=data.get("labels"), metadata=data.get("metadata"))
Because we cannot deserialize a custom class, we return an empty Base Environment with the appropriate labels.
Because we cannot deserialize a custom class, we return an empty Base Environment with the appropriate labels.
[ "Because", "we", "cannot", "deserialize", "a", "custom", "class", "we", "return", "an", "empty", "Base", "Environment", "with", "the", "appropriate", "labels", "." ]
def create_object(self, data: dict, **kwargs: Any) -> Environment: """ Because we cannot deserialize a custom class, we return an empty Base Environment with the appropriate labels. """ return Environment(labels=data.get("labels"), metadata=data.get("metadata"))
[ "def", "create_object", "(", "self", ",", "data", ":", "dict", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Environment", ":", "return", "Environment", "(", "labels", "=", "data", ".", "get", "(", "\"labels\"", ")", ",", "metadata", "=", "data", ...
https://github.com/PrefectHQ/prefect/blob/67bdc94e2211726d99561f6f52614bec8970e981/src/prefect/serialization/environment.py#L78-L83
captainhammy/Houdini-Toolbox
a4e61c3c0296b3a3a153a8dd42297c316be1b0f3
python/houdini_toolbox/sohohooks/aovs/manager.py
python
AOVManager._merge_readers
(self, readers: List[AOVFile])
Merge the data of multiple AOVFile objects. :param readers: A list of file readers. :return:
Merge the data of multiple AOVFile objects.
[ "Merge", "the", "data", "of", "multiple", "AOVFile", "objects", "." ]
def _merge_readers(self, readers: List[AOVFile]): """Merge the data of multiple AOVFile objects. :param readers: A list of file readers. :return: """ # We need to handle AOVs first since AOVs in other files may overwrite # AOVs in group definition files. for rea...
[ "def", "_merge_readers", "(", "self", ",", "readers", ":", "List", "[", "AOVFile", "]", ")", ":", "# We need to handle AOVs first since AOVs in other files may overwrite", "# AOVs in group definition files.", "for", "reader", "in", "readers", ":", "self", ".", "_init_read...
https://github.com/captainhammy/Houdini-Toolbox/blob/a4e61c3c0296b3a3a153a8dd42297c316be1b0f3/python/houdini_toolbox/sohohooks/aovs/manager.py#L152-L166
rdevooght/sequence-based-recommendations
0dfefeda9d7d5395b9b9bd2a4aa6a4fabfe3ca96
helpers/evaluation.py
python
DistributionCharacteristics.plot_frequency_distribution
(self)
Plot the number of items versus the frequency
Plot the number of items versus the frequency
[ "Plot", "the", "number", "of", "items", "versus", "the", "frequency" ]
def plot_frequency_distribution(self): '''Plot the number of items versus the frequency ''' frequencies = self.movies.values() freq_distribution = collections.Counter(frequencies)
[ "def", "plot_frequency_distribution", "(", "self", ")", ":", "frequencies", "=", "self", ".", "movies", ".", "values", "(", ")", "freq_distribution", "=", "collections", ".", "Counter", "(", "frequencies", ")" ]
https://github.com/rdevooght/sequence-based-recommendations/blob/0dfefeda9d7d5395b9b9bd2a4aa6a4fabfe3ca96/helpers/evaluation.py#L225-L229
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/requests/packages/chardet/__init__.py
python
detect
(aBuf)
return u.result
[]
def detect(aBuf): if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or (version_info >= (3, 0) and not isinstance(aBuf, bytes))): raise ValueError('Expected a bytes object, not a unicode object') from . import universaldetector u = universaldetector.UniversalDetector() u.res...
[ "def", "detect", "(", "aBuf", ")", ":", "if", "(", "(", "version_info", "<", "(", "3", ",", "0", ")", "and", "isinstance", "(", "aBuf", ",", "unicode", ")", ")", "or", "(", "version_info", ">=", "(", "3", ",", "0", ")", "and", "not", "isinstance"...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/requests/packages/chardet/__init__.py#L22-L32
unsky/RetinaNet
d74e54ddad6e2f0d376c2ee9ad2e88507d78ad44
lib/dataset/pycocotools/coco.py
python
COCO.decodeMask
(R)
return M.reshape((R['size']), order='F')
Decode binary mask M encoded via run-length encoding. :param R (object RLE) : run-length encoding of binary mask :return: M (bool 2D array) : decoded binary mask
Decode binary mask M encoded via run-length encoding. :param R (object RLE) : run-length encoding of binary mask :return: M (bool 2D array) : decoded binary mask
[ "Decode", "binary", "mask", "M", "encoded", "via", "run", "-", "length", "encoding", ".", ":", "param", "R", "(", "object", "RLE", ")", ":", "run", "-", "length", "encoding", "of", "binary", "mask", ":", "return", ":", "M", "(", "bool", "2D", "array"...
def decodeMask(R): """ Decode binary mask M encoded via run-length encoding. :param R (object RLE) : run-length encoding of binary mask :return: M (bool 2D array) : decoded binary mask """ N = len(R['counts']) M = np.zeros( (R['size'][0]*R['size'][1], )) ...
[ "def", "decodeMask", "(", "R", ")", ":", "N", "=", "len", "(", "R", "[", "'counts'", "]", ")", "M", "=", "np", ".", "zeros", "(", "(", "R", "[", "'size'", "]", "[", "0", "]", "*", "R", "[", "'size'", "]", "[", "1", "]", ",", ")", ")", "...
https://github.com/unsky/RetinaNet/blob/d74e54ddad6e2f0d376c2ee9ad2e88507d78ad44/lib/dataset/pycocotools/coco.py#L355-L371
harvard-lil/capstone
f15c98fce0b50b74616c40f862146d858b54be5d
capstone/capapi/serializers.py
python
NoLoginCaseDocumentSerializer.to_representation
(self, instance, check_permissions=False)
return super().to_representation(instance, check_permissions=check_permissions)
Tell get_casebody not to check for case download permissions.
Tell get_casebody not to check for case download permissions.
[ "Tell", "get_casebody", "not", "to", "check", "for", "case", "download", "permissions", "." ]
def to_representation(self, instance, check_permissions=False): """ Tell get_casebody not to check for case download permissions. """ return super().to_representation(instance, check_permissions=check_permissions)
[ "def", "to_representation", "(", "self", ",", "instance", ",", "check_permissions", "=", "False", ")", ":", "return", "super", "(", ")", ".", "to_representation", "(", "instance", ",", "check_permissions", "=", "check_permissions", ")" ]
https://github.com/harvard-lil/capstone/blob/f15c98fce0b50b74616c40f862146d858b54be5d/capstone/capapi/serializers.py#L457-L459
markj3d/Red9_StudioPack
1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919
core/Red9_AnimationUtils.py
python
AnimationUI.__uiCall
(self, func, *args)
MAIN ANIMATION UI CALL Why not just call the procs directly? well this also manages the collection /pushing of the filterSettings data for all procs
MAIN ANIMATION UI CALL Why not just call the procs directly? well this also manages the collection /pushing of the filterSettings data for all procs
[ "MAIN", "ANIMATION", "UI", "CALL", "Why", "not", "just", "call", "the", "procs", "directly?", "well", "this", "also", "manages", "the", "collection", "/", "pushing", "of", "the", "filterSettings", "data", "for", "all", "procs" ]
def __uiCall(self, func, *args): ''' MAIN ANIMATION UI CALL Why not just call the procs directly? well this also manages the collection /pushing of the filterSettings data for all procs ''' # issue : up to v2011 Maya puts each action into the UndoQueue separately ...
[ "def", "__uiCall", "(", "self", ",", "func", ",", "*", "args", ")", ":", "# issue : up to v2011 Maya puts each action into the UndoQueue separately", "# when called by lambda or partial - Fix is to open an UndoChunk to catch", "# everything in one block", "objs", "=", "cmds", ".", ...
https://github.com/markj3d/Red9_StudioPack/blob/1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919/core/Red9_AnimationUtils.py#L3184-L3265
raiden-network/raiden
76c68b426a6f81f173b9a2c09bd88a610502c38b
raiden/transfer/mediated_transfer/mediation_fee.py
python
_cap_fees
( x_list: List[Fraction], y_list: List[Fraction] )
return x_list, y_list
Insert extra points for intersections with x-axis, see `test_fee_capping`
Insert extra points for intersections with x-axis, see `test_fee_capping`
[ "Insert", "extra", "points", "for", "intersections", "with", "x", "-", "axis", "see", "test_fee_capping" ]
def _cap_fees( x_list: List[Fraction], y_list: List[Fraction] ) -> Tuple[List[Fraction], List[Fraction]]: """Insert extra points for intersections with x-axis, see `test_fee_capping`""" x_list = copy(x_list) y_list = copy(y_list) for i in range(len(x_list) - 1): y1, y2 = y_list[i : i + 2] ...
[ "def", "_cap_fees", "(", "x_list", ":", "List", "[", "Fraction", "]", ",", "y_list", ":", "List", "[", "Fraction", "]", ")", "->", "Tuple", "[", "List", "[", "Fraction", "]", ",", "List", "[", "Fraction", "]", "]", ":", "x_list", "=", "copy", "(", ...
https://github.com/raiden-network/raiden/blob/76c68b426a6f81f173b9a2c09bd88a610502c38b/raiden/transfer/mediated_transfer/mediation_fee.py#L89-L107
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/unsupervised/owtsne.py
python
OWtSNE._get_projection_data
(self)
return data
[]
def _get_projection_data(self): if self.data is None: return None data = self.data.transform( Domain( self.data.domain.attributes, self.data.domain.class_vars, self.data.domain.metas + self._get_projection_variables() )...
[ "def", "_get_projection_data", "(", "self", ")", ":", "if", "self", ".", "data", "is", "None", ":", "return", "None", "data", "=", "self", ".", "data", ".", "transform", "(", "Domain", "(", "self", ".", "data", ".", "domain", ".", "attributes", ",", ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/unsupervised/owtsne.py#L587-L606
ztosec/hunter
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
SqlmapCelery/sqlmap/lib/core/agent.py
python
Agent.hexConvertField
(self, field)
return hexField
Returns hex converted field string
Returns hex converted field string
[ "Returns", "hex", "converted", "field", "string" ]
def hexConvertField(self, field): """ Returns hex converted field string """ rootQuery = queries[Backend.getIdentifiedDbms()] hexField = field if 'hex' in rootQuery: hexField = rootQuery.hex.query % field else: warnMsg = "switch '--hex' i...
[ "def", "hexConvertField", "(", "self", ",", "field", ")", ":", "rootQuery", "=", "queries", "[", "Backend", ".", "getIdentifiedDbms", "(", ")", "]", "hexField", "=", "field", "if", "'hex'", "in", "rootQuery", ":", "hexField", "=", "rootQuery", ".", "hex", ...
https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/SqlmapCelery/sqlmap/lib/core/agent.py#L359-L373
aparo/django-elasticsearch
8fd25bd86b58cfc0d6490cfac08e4846ab4ddf97
django_elasticsearch/serializer.py
python
Encoder.encode_django
(self, model)
return {'_app':model._meta.app_label, '_model':model._meta.module_name, 'pk':model.pk, '_type':"django"}
Encode ricorsive embedded models and django models
Encode ricorsive embedded models and django models
[ "Encode", "ricorsive", "embedded", "models", "and", "django", "models" ]
def encode_django(self, model): """ Encode ricorsive embedded models and django models """ from django_elasticsearch.fields import EmbeddedModel if isinstance(model, EmbeddedModel): if model.pk is None: model.pk = str(uuid.uuid4()) res = {'...
[ "def", "encode_django", "(", "self", ",", "model", ")", ":", "from", "django_elasticsearch", ".", "fields", "import", "EmbeddedModel", "if", "isinstance", "(", "model", ",", "EmbeddedModel", ")", ":", "if", "model", ".", "pk", "is", "None", ":", "model", "...
https://github.com/aparo/django-elasticsearch/blob/8fd25bd86b58cfc0d6490cfac08e4846ab4ddf97/django_elasticsearch/serializer.py#L62-L89
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
DemoPrograms/Demo_Uno_Card_Game.py
python
Card.getColorCode
(self)
return self.colorCode
Returns card's color code.
Returns card's color code.
[ "Returns", "card", "s", "color", "code", "." ]
def getColorCode(self): '''Returns card's color code.''' return self.colorCode
[ "def", "getColorCode", "(", "self", ")", ":", "return", "self", ".", "colorCode" ]
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_Uno_Card_Game.py#L614-L616
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/html5lib/treebuilders/base.py
python
Node.insertBefore
(self, node, refNode)
Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node
Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node
[ "Insert", "node", "as", "a", "child", "of", "the", "current", "node", "before", "refNode", "in", "the", "list", "of", "child", "nodes", ".", "Raises", "ValueError", "if", "refNode", "is", "not", "a", "child", "of", "the", "current", "node" ]
def insertBefore(self, node, refNode): """Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node""" raise NotImplementedError
[ "def", "insertBefore", "(", "self", ",", "node", ",", "refNode", ")", ":", "raise", "NotImplementedError" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L65-L69
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/mimetypes.py
python
MimeTypes.guess_all_extensions
(self, type, strict=True)
return extensions
Guess the extensions for a file based on its MIME type. Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapped to the MIME t...
Guess the extensions for a file based on its MIME type.
[ "Guess", "the", "extensions", "for", "a", "file", "based", "on", "its", "MIME", "type", "." ]
def guess_all_extensions(self, type, strict=True): """Guess the extensions for a file based on its MIME type. Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been associated with any par...
[ "def", "guess_all_extensions", "(", "self", ",", "type", ",", "strict", "=", "True", ")", ":", "type", "=", "type", ".", "lower", "(", ")", "extensions", "=", "list", "(", "self", ".", "types_map_inv", "[", "True", "]", ".", "get", "(", "type", ",", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/mimetypes.py#L166-L183
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/utils/samplepartition.py
python
compare_containers
(a, b)
return cmp( a.getCapacity() and a_magnitude or mg(0, 'ml'), b.getCapacity() and b_magnitude or mg(0, 'ml') )
[]
def compare_containers(a, b): a_capacity = a.getCapacity().lower().split(" ", 1) b_capacity = b.getCapacity().lower().split(" ", 1) a_magnitude = mg(float(a_capacity[0]), a_capacity[1]) b_magnitude = mg(float(b_capacity[0]), b_capacity[1]) return cmp( a.getCapacity() and a_magnitude or mg(0,...
[ "def", "compare_containers", "(", "a", ",", "b", ")", ":", "a_capacity", "=", "a", ".", "getCapacity", "(", ")", ".", "lower", "(", ")", ".", "split", "(", "\" \"", ",", "1", ")", "b_capacity", "=", "b", ".", "getCapacity", "(", ")", ".", "lower", ...
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/utils/samplepartition.py#L15-L23
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/api/admissionregistration_v1_api.py
python
AdmissionregistrationV1Api.delete_collection_mutating_webhook_configuration_with_http_info
(self, **kwargs)
return self.api_client.call_api( '/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, re...
delete_collection_mutating_webhook_configuration # noqa: E501 delete collection of MutatingWebhookConfiguration # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_mut...
delete_collection_mutating_webhook_configuration # noqa: E501
[ "delete_collection_mutating_webhook_configuration", "#", "noqa", ":", "E501" ]
def delete_collection_mutating_webhook_configuration_with_http_info(self, **kwargs): # noqa: E501 """delete_collection_mutating_webhook_configuration # noqa: E501 delete collection of MutatingWebhookConfiguration # noqa: E501 This method makes a synchronous HTTP request by default. To make a...
[ "def", "delete_collection_mutating_webhook_configuration_with_http_info", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "local_var_params", "=", "locals", "(", ")", "all_params", "=", "[", "'pretty'", ",", "'_continue'", ",", "'dry_run'", ",", "'fi...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/admissionregistration_v1_api.py#L334-L465
dsiroky/snakemq
2d53a25c7ef613bc7cc1e4e8e39ab4fc5990a1a5
snakemq/packeter.py
python
Packeter.__init__
(self, link)
:param link: :class:`~snakemq.link.Link`
:param link: :class:`~snakemq.link.Link`
[ ":", "param", "link", ":", ":", "class", ":", "~snakemq", ".", "link", ".", "Link" ]
def __init__(self, link): """ :param link: :class:`~snakemq.link.Link` """ self.link = link self.log = logging.getLogger("snakemq.packeter") #{ callbacks self.on_connect = Callback() #: ``func(conn_id)`` self.on_disconnect = Callback() #: ``func(conn_id...
[ "def", "__init__", "(", "self", ",", "link", ")", ":", "self", ".", "link", "=", "link", "self", ".", "log", "=", "logging", ".", "getLogger", "(", "\"snakemq.packeter\"", ")", "#{ callbacks", "self", ".", "on_connect", "=", "Callback", "(", ")", "#: ``f...
https://github.com/dsiroky/snakemq/blob/2d53a25c7ef613bc7cc1e4e8e39ab4fc5990a1a5/snakemq/packeter.py#L91-L113
prompt-toolkit/pyvim
210816b4b1d2dc00606ec924dda29e49ac4cd87c
pyvim/window_arrangement.py
python
TabPage._walk_through_windows
(self)
return walk(self.root)
Yields (Split, Window) tuples.
Yields (Split, Window) tuples.
[ "Yields", "(", "Split", "Window", ")", "tuples", "." ]
def _walk_through_windows(self): """ Yields (Split, Window) tuples. """ def walk(split): for c in split: if isinstance(c, (HSplit, VSplit)): for i in walk(c): yield i elif isinstance(c, Window): ...
[ "def", "_walk_through_windows", "(", "self", ")", ":", "def", "walk", "(", "split", ")", ":", "for", "c", "in", "split", ":", "if", "isinstance", "(", "c", ",", "(", "HSplit", ",", "VSplit", ")", ")", ":", "for", "i", "in", "walk", "(", "c", ")",...
https://github.com/prompt-toolkit/pyvim/blob/210816b4b1d2dc00606ec924dda29e49ac4cd87c/pyvim/window_arrangement.py#L68-L80
jakevdp/sklearn_scipy2013
b841c5fee50c20670882ff83cfa24347d13bf0db
ipynbhelper.py
python
run_notebook
(nb)
[]
def run_notebook(nb): km = KernelManager() km.start_kernel(stderr=open(os.devnull, 'w')) if hasattr(km, 'client'): kc = km.client() kc.start_channels() iopub = kc.iopub_channel else: # IPython 0.13 compat kc = km kc.start_channels() iopub = kc.sub_...
[ "def", "run_notebook", "(", "nb", ")", ":", "km", "=", "KernelManager", "(", ")", "km", ".", "start_kernel", "(", "stderr", "=", "open", "(", "os", ".", "devnull", ",", "'w'", ")", ")", "if", "hasattr", "(", "km", ",", "'client'", ")", ":", "kc", ...
https://github.com/jakevdp/sklearn_scipy2013/blob/b841c5fee50c20670882ff83cfa24347d13bf0db/ipynbhelper.py#L87-L126
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/sklearn/covariance/graph_lasso_.py
python
alpha_max
(emp_cov)
return np.max(np.abs(A))
Find the maximum alpha for which there are some non-zeros off-diagonal. Parameters ---------- emp_cov : 2D array, (n_features, n_features) The sample covariance matrix Notes ----- This results from the bound for the all the Lasso that are solved in GraphLasso: each time, the row o...
Find the maximum alpha for which there are some non-zeros off-diagonal.
[ "Find", "the", "maximum", "alpha", "for", "which", "there", "are", "some", "non", "-", "zeros", "off", "-", "diagonal", "." ]
def alpha_max(emp_cov): """Find the maximum alpha for which there are some non-zeros off-diagonal. Parameters ---------- emp_cov : 2D array, (n_features, n_features) The sample covariance matrix Notes ----- This results from the bound for the all the Lasso that are solved in G...
[ "def", "alpha_max", "(", "emp_cov", ")", ":", "A", "=", "np", ".", "copy", "(", "emp_cov", ")", "A", ".", "flat", "[", ":", ":", "A", ".", "shape", "[", "0", "]", "+", "1", "]", "=", "0", "return", "np", ".", "max", "(", "np", ".", "abs", ...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/sklearn/covariance/graph_lasso_.py#L58-L76
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/code.py
python
InteractiveConsole.__init__
(self, locals=None, filename="<console>")
Constructor. The optional locals argument will be passed to the InteractiveInterpreter base class. The optional filename argument should specify the (file)name of the input stream; it will show up in tracebacks.
Constructor.
[ "Constructor", "." ]
def __init__(self, locals=None, filename="<console>"): """Constructor. The optional locals argument will be passed to the InteractiveInterpreter base class. The optional filename argument should specify the (file)name of the input stream; it will show up in tracebacks. ...
[ "def", "__init__", "(", "self", ",", "locals", "=", "None", ",", "filename", "=", "\"<console>\"", ")", ":", "InteractiveInterpreter", ".", "__init__", "(", "self", ",", "locals", ")", "self", ".", "filename", "=", "filename", "self", ".", "resetbuffer", "...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/code.py#L182-L194
python-discord/bot
26c5587ac13e5414361bb6e7ada42983b81014d2
bot/rules/links.py
python
apply
( last_message: Message, recent_messages: List[Message], config: Dict[str, int] )
return None
Detects total links exceeding the limit sent by a single user.
Detects total links exceeding the limit sent by a single user.
[ "Detects", "total", "links", "exceeding", "the", "limit", "sent", "by", "a", "single", "user", "." ]
async def apply( last_message: Message, recent_messages: List[Message], config: Dict[str, int] ) -> Optional[Tuple[str, Iterable[Member], Iterable[Message]]]: """Detects total links exceeding the limit sent by a single user.""" relevant_messages = tuple( msg for msg in recent_messages ...
[ "async", "def", "apply", "(", "last_message", ":", "Message", ",", "recent_messages", ":", "List", "[", "Message", "]", ",", "config", ":", "Dict", "[", "str", ",", "int", "]", ")", "->", "Optional", "[", "Tuple", "[", "str", ",", "Iterable", "[", "M...
https://github.com/python-discord/bot/blob/26c5587ac13e5414361bb6e7ada42983b81014d2/bot/rules/links.py#L9-L36
googledatalab/pydatalab
1c86e26a0d24e3bc8097895ddeab4d0607be4c40
google/datalab/contrib/pipeline/_pipeline.py
python
PipelineGenerator._get_default_args
(schedule_config, emails)
return """ default_args = {{{0}}} """.format(default_arg_literals)
[]
def _get_default_args(schedule_config, emails): start_datetime_obj = schedule_config.get('start', datetime.datetime.now()) end_datetime_obj = schedule_config.get('end') start_date_str = PipelineGenerator._get_datetime_expr_str(start_datetime_obj) end_date_str = PipelineGenerator._get_datetime_expr_str(e...
[ "def", "_get_default_args", "(", "schedule_config", ",", "emails", ")", ":", "start_datetime_obj", "=", "schedule_config", ".", "get", "(", "'start'", ",", "datetime", ".", "datetime", ".", "now", "(", ")", ")", "end_datetime_obj", "=", "schedule_config", ".", ...
https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/google/datalab/contrib/pipeline/_pipeline.py#L71-L101
openembedded/bitbake
98407efc8c670abd71d3fa88ec3776ee9b5c38f3
lib/bb/event.py
python
MultipleProviders.isRuntime
(self)
return self._is_runtime
Is this a runtime issue?
Is this a runtime issue?
[ "Is", "this", "a", "runtime", "issue?" ]
def isRuntime(self): """ Is this a runtime issue? """ return self._is_runtime
[ "def", "isRuntime", "(", "self", ")", ":", "return", "self", ".", "_is_runtime" ]
https://github.com/openembedded/bitbake/blob/98407efc8c670abd71d3fa88ec3776ee9b5c38f3/lib/bb/event.py#L562-L566