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
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/requirementslib/models/setup_info.py
python
ast_parse_setup_py
(path: str, raising: bool = True)
return SetupReader.read_setup_py(Path(path), raising)
[]
def ast_parse_setup_py(path: str, raising: bool = True) -> "Dict[str, Any]": return SetupReader.read_setup_py(Path(path), raising)
[ "def", "ast_parse_setup_py", "(", "path", ":", "str", ",", "raising", ":", "bool", "=", "True", ")", "->", "\"Dict[str, Any]\"", ":", "return", "SetupReader", ".", "read_setup_py", "(", "Path", "(", "path", ")", ",", "raising", ")" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/requirementslib/models/setup_info.py#L879-L880
e2nIEE/pandapower
12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb
pandapower/create.py
python
create_sgen
(net, bus, p_mw, q_mvar=0, sn_mva=nan, name=None, index=None, scaling=1., type='wye', in_service=True, max_p_mw=nan, min_p_mw=nan, max_q_mvar=nan, min_q_mvar=nan, controllable=nan, k=nan, rx=nan, current_source=True)
return index
Adds one static generator in table net["sgen"]. Static generators are modelled as positive and constant PQ power. This element is used to model generators with a constant active and reactive power feed-in. If you want to model a voltage controlled generator, use the generator element instead. gen, sge...
Adds one static generator in table net["sgen"].
[ "Adds", "one", "static", "generator", "in", "table", "net", "[", "sgen", "]", "." ]
def create_sgen(net, bus, p_mw, q_mvar=0, sn_mva=nan, name=None, index=None, scaling=1., type='wye', in_service=True, max_p_mw=nan, min_p_mw=nan, max_q_mvar=nan, min_q_mvar=nan, controllable=nan, k=nan, rx=nan, current_source=True): """ Adds one static generator i...
[ "def", "create_sgen", "(", "net", ",", "bus", ",", "p_mw", ",", "q_mvar", "=", "0", ",", "sn_mva", "=", "nan", ",", "name", "=", "None", ",", "index", "=", "None", ",", "scaling", "=", "1.", ",", "type", "=", "'wye'", ",", "in_service", "=", "Tru...
https://github.com/e2nIEE/pandapower/blob/12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb/pandapower/create.py#L972-L1062
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-50/fabmetheus_utilities/euclidean.py
python
Endpoint.getClosestEndpoint
( self, endpoints )
return closestEndpoint
Get closest endpoint.
Get closest endpoint.
[ "Get", "closest", "endpoint", "." ]
def getClosestEndpoint( self, endpoints ): 'Get closest endpoint.' smallestDistance = 987654321987654321.0 closestEndpoint = None for endpoint in endpoints: distance = abs( self.point - endpoint.point ) if distance < smallestDistance: smallestDistance = distance closestEndpoint = endpoint return...
[ "def", "getClosestEndpoint", "(", "self", ",", "endpoints", ")", ":", "smallestDistance", "=", "987654321987654321.0", "closestEndpoint", "=", "None", "for", "endpoint", "in", "endpoints", ":", "distance", "=", "abs", "(", "self", ".", "point", "-", "endpoint", ...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/euclidean.py#L2088-L2097
neurolib-dev/neurolib
8d8ed2ceb422e9a1367193495a7e2df96cf4e4a3
neurolib/optimize/evolution/evolution.py
python
Evolution._outputToDf
(self, pop, df)
return df
Loads outputs dictionary from evolution from the .outputs attribute and writes data into a dataframe. :param pop: Population of which to get outputs from. :type pop: list :param df: Dataframe to which outputs are written :type df: pandas.core.frame.DataFrame :return: Dat...
Loads outputs dictionary from evolution from the .outputs attribute and writes data into a dataframe.
[ "Loads", "outputs", "dictionary", "from", "evolution", "from", "the", ".", "outputs", "attribute", "and", "writes", "data", "into", "a", "dataframe", "." ]
def _outputToDf(self, pop, df): """Loads outputs dictionary from evolution from the .outputs attribute and writes data into a dataframe. :param pop: Population of which to get outputs from. :type pop: list :param df: Dataframe to which outputs are written :type df: panda...
[ "def", "_outputToDf", "(", "self", ",", "pop", ",", "df", ")", ":", "# defines which variable types will be saved in the results dataframe", "SUPPORTED_TYPES", "=", "(", "float", ",", "int", ",", "np", ".", "ndarray", ",", "list", ")", "SCALAR_TYPES", "=", "(", ...
https://github.com/neurolib-dev/neurolib/blob/8d8ed2ceb422e9a1367193495a7e2df96cf4e4a3/neurolib/optimize/evolution/evolution.py#L779-L815
pulp/pulp
a0a28d804f997b6f81c391378aff2e4c90183df9
nodes/child/pulp_node/handlers/handler.py
python
RepositoryHandler.update
(self, conduit, units, options)
return handler_report
Update the specified content units. Each unit must be of type 'repository'. Updates only the repositories specified in the unit_key by repo_id. Report format: succeeded: <bool> details: { errors: [ { error_id: <str>, details: {} ...
Update the specified content units. Each unit must be of type 'repository'. Updates only the repositories specified in the unit_key by repo_id.
[ "Update", "the", "specified", "content", "units", ".", "Each", "unit", "must", "be", "of", "type", "repository", ".", "Updates", "only", "the", "repositories", "specified", "in", "the", "unit_key", "by", "repo_id", "." ]
def update(self, conduit, units, options): """ Update the specified content units. Each unit must be of type 'repository'. Updates only the repositories specified in the unit_key by repo_id. Report format: succeeded: <bool> details: { errors: [ ...
[ "def", "update", "(", "self", ",", "conduit", ",", "units", ",", "options", ")", ":", "warnings", ".", "warn", "(", "TASK_DEPRECATION_WARNING", ",", "NodeDeprecationWarning", ")", "summary_report", "=", "SummaryReport", "(", ")", "progress_report", "=", "Handler...
https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/nodes/child/pulp_node/handlers/handler.py#L107-L169
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_internal/commands/completion.py
python
CompletionCommand.run
(self, options, args)
Prints the completion code of the given shell
Prints the completion code of the given shell
[ "Prints", "the", "completion", "code", "of", "the", "given", "shell" ]
def run(self, options, args): """Prints the completion code of the given shell""" shells = COMPLETION_SCRIPTS.keys() shell_options = ['--' + shell for shell in sorted(shells)] if options.shell in shells: script = textwrap.dedent( COMPLETION_SCRIPTS.get(options...
[ "def", "run", "(", "self", ",", "options", ",", "args", ")", ":", "shells", "=", "COMPLETION_SCRIPTS", ".", "keys", "(", ")", "shell_options", "=", "[", "'--'", "+", "shell", "for", "shell", "in", "sorted", "(", "shells", ")", "]", "if", "options", "...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_internal/commands/completion.py#L80-L94
gaphor/gaphor
dfe8df33ef3b884afdadf7c91fc7740f8d3c2e88
gaphor/ui/elementeditor.py
python
EditorStack._get_adapters
(self, item)
return sorted(adaptermap.items())
Return an ordered list of (order, name, adapter).
Return an ordered list of (order, name, adapter).
[ "Return", "an", "ordered", "list", "of", "(", "order", "name", "adapter", ")", "." ]
def _get_adapters(self, item): """Return an ordered list of (order, name, adapter).""" adaptermap = {} if isinstance(item, Presentation) and item.subject: for adapter in PropertyPages(item.subject): adaptermap[(adapter.order, adapter.__class__.__name__)] = adapter ...
[ "def", "_get_adapters", "(", "self", ",", "item", ")", ":", "adaptermap", "=", "{", "}", "if", "isinstance", "(", "item", ",", "Presentation", ")", "and", "item", ".", "subject", ":", "for", "adapter", "in", "PropertyPages", "(", "item", ".", "subject", ...
https://github.com/gaphor/gaphor/blob/dfe8df33ef3b884afdadf7c91fc7740f8d3c2e88/gaphor/ui/elementeditor.py#L148-L157
mars-project/mars
6afd7ed86db77f29cc9470485698ef192ecc6d33
mars/tensor/reduction/nancumsum.py
python
nancumsum
(a, axis=None, dtype=None, out=None)
return op(a, out=out)
Return the cumulative sum of tensor elements over a given axis treating Not a Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are encountered and leading NaNs are replaced by zeros. Zeros are returned for slices that are all-NaN or empty. Parameters ---------- a : array_l...
Return the cumulative sum of tensor elements over a given axis treating Not a Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are encountered and leading NaNs are replaced by zeros.
[ "Return", "the", "cumulative", "sum", "of", "tensor", "elements", "over", "a", "given", "axis", "treating", "Not", "a", "Numbers", "(", "NaNs", ")", "as", "zero", ".", "The", "cumulative", "sum", "does", "not", "change", "when", "NaNs", "are", "encountered...
def nancumsum(a, axis=None, dtype=None, out=None): """ Return the cumulative sum of tensor elements over a given axis treating Not a Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are encountered and leading NaNs are replaced by zeros. Zeros are returned for slices that are a...
[ "def", "nancumsum", "(", "a", ",", "axis", "=", "None", ",", "dtype", "=", "None", ",", "out", "=", "None", ")", ":", "a", "=", "astensor", "(", "a", ")", "if", "dtype", "is", "None", ":", "dtype", "=", "np", ".", "nancumsum", "(", "np", ".", ...
https://github.com/mars-project/mars/blob/6afd7ed86db77f29cc9470485698ef192ecc6d33/mars/tensor/reduction/nancumsum.py#L37-L102
lightbulb-framework/lightbulb-framework
9e8d6f37f28c784963dba3d726a0c8022a605baf
libs/pkg_resources.py
python
_find_adapter
(registry, ob)
Return an adapter factory for `ob` from `registry`
Return an adapter factory for `ob` from `registry`
[ "Return", "an", "adapter", "factory", "for", "ob", "from", "registry" ]
def _find_adapter(registry, ob): """Return an adapter factory for `ob` from `registry`""" for t in _get_mro(getattr(ob, '__class__', type(ob))): if t in registry: return registry[t]
[ "def", "_find_adapter", "(", "registry", ",", "ob", ")", ":", "for", "t", "in", "_get_mro", "(", "getattr", "(", "ob", ",", "'__class__'", ",", "type", "(", "ob", ")", ")", ")", ":", "if", "t", "in", "registry", ":", "return", "registry", "[", "t",...
https://github.com/lightbulb-framework/lightbulb-framework/blob/9e8d6f37f28c784963dba3d726a0c8022a605baf/libs/pkg_resources.py#L2640-L2644
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/distutils/command/register.py
python
register.post_to_server
(self, data, auth=None)
return result
Post a query to the server, and return a string response.
Post a query to the server, and return a string response.
[ "Post", "a", "query", "to", "the", "server", "and", "return", "a", "string", "response", "." ]
def post_to_server(self, data, auth=None): ''' Post a query to the server, and return a string response. ''' if 'name' in data: self.announce('Registering %s to %s' % (data['name'], self.repository), ...
[ "def", "post_to_server", "(", "self", ",", "data", ",", "auth", "=", "None", ")", ":", "if", "'name'", "in", "data", ":", "self", ".", "announce", "(", "'Registering %s to %s'", "%", "(", "data", "[", "'name'", "]", ",", "self", ".", "repository", ")",...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/distutils/command/register.py#L249-L304
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/pickletools.py
python
read_stringnl
(f, decode=True, stripquotes=True)
return data
r""" >>> import StringIO >>> read_stringnl(StringIO.StringIO("'abcd'\nefg\n")) 'abcd' >>> read_stringnl(StringIO.StringIO("\n")) Traceback (most recent call last): ... ValueError: no string quotes around '' >>> read_stringnl(StringIO.StringIO("\n"), stripquotes=False) '' >>> r...
r""" >>> import StringIO >>> read_stringnl(StringIO.StringIO("'abcd'\nefg\n")) 'abcd'
[ "r", ">>>", "import", "StringIO", ">>>", "read_stringnl", "(", "StringIO", ".", "StringIO", "(", "abcd", "\\", "nefg", "\\", "n", "))", "abcd" ]
def read_stringnl(f, decode=True, stripquotes=True): r""" >>> import StringIO >>> read_stringnl(StringIO.StringIO("'abcd'\nefg\n")) 'abcd' >>> read_stringnl(StringIO.StringIO("\n")) Traceback (most recent call last): ... ValueError: no string quotes around '' >>> read_stringnl(Stri...
[ "def", "read_stringnl", "(", "f", ",", "decode", "=", "True", ",", "stripquotes", "=", "True", ")", ":", "data", "=", "f", ".", "readline", "(", ")", "if", "not", "data", ".", "endswith", "(", "'\\n'", ")", ":", "raise", "ValueError", "(", "\"no newl...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/pickletools.py#L262-L309
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/devops/devops_client.py
python
DevopsClient.get_deploy_artifact
(self, deploy_artifact_id, **kwargs)
Retrieves a deployment artifact by identifier. :param str deploy_artifact_id: (required) Unique artifact identifier. :param str opc_request_id: (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, provide the ...
Retrieves a deployment artifact by identifier.
[ "Retrieves", "a", "deployment", "artifact", "by", "identifier", "." ]
def get_deploy_artifact(self, deploy_artifact_id, **kwargs): """ Retrieves a deployment artifact by identifier. :param str deploy_artifact_id: (required) Unique artifact identifier. :param str opc_request_id: (optional) Unique Oracle-assigned identifier for the...
[ "def", "get_deploy_artifact", "(", "self", ",", "deploy_artifact_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/deployArtifacts/{deployArtifactId}\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", "\"retry_strat...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/devops/devops_client.py#L2860-L2939
mbusb/multibootusb
fa89b28f27891a9ce8d6e2a5737baa2e6ee83dfd
scripts/param_rewrite.py
python
op_replace_kv
(key, value, params)
return [key + (value(key, x[len(key):], params) if callable(value) else value) if x.startswith(key) else x for x in params]
Replace {value} of {key} if the key already exists in {params}. {value} may be a callable. In that case {value} will be called with key, definition to be replaced and {params}.
Replace {value} of {key} if the key already exists in {params}. {value} may be a callable. In that case {value} will be called with key, definition to be replaced and {params}.
[ "Replace", "{", "value", "}", "of", "{", "key", "}", "if", "the", "key", "already", "exists", "in", "{", "params", "}", ".", "{", "value", "}", "may", "be", "a", "callable", ".", "In", "that", "case", "{", "value", "}", "will", "be", "called", "w...
def op_replace_kv(key, value, params): ''' Replace {value} of {key} if the key already exists in {params}. {value} may be a callable. In that case {value} will be called with key, definition to be replaced and {params}. ''' assert key.endswith('=') return [key + (value(key, x[len(ke...
[ "def", "op_replace_kv", "(", "key", ",", "value", ",", "params", ")", ":", "assert", "key", ".", "endswith", "(", "'='", ")", "return", "[", "key", "+", "(", "value", "(", "key", ",", "x", "[", "len", "(", "key", ")", ":", "]", ",", "params", "...
https://github.com/mbusb/multibootusb/blob/fa89b28f27891a9ce8d6e2a5737baa2e6ee83dfd/scripts/param_rewrite.py#L42-L51
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/sql/compiler.py
python
IdentifierPreparer.format_table_seq
(self, table, use_schema=True)
Format table name and schema as a tuple.
Format table name and schema as a tuple.
[ "Format", "table", "name", "and", "schema", "as", "a", "tuple", "." ]
def format_table_seq(self, table, use_schema=True): """Format table name and schema as a tuple.""" # Dialects with more levels in their fully qualified references # ('database', 'owner', etc.) could override this and return # a longer sequence. if not self.omit_schema and use_s...
[ "def", "format_table_seq", "(", "self", ",", "table", ",", "use_schema", "=", "True", ")", ":", "# Dialects with more levels in their fully qualified references", "# ('database', 'owner', etc.) could override this and return", "# a longer sequence.", "if", "not", "self", ".", "...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/sql/compiler.py#L2970-L2982
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/core/expr.py
python
Expr.nseries
(self, x=None, x0=0, n=6, dir='+', logx=None)
Wrapper to _eval_nseries if assumptions allow, else to series. If x is given, x0 is 0, dir='+', and self has x, then _eval_nseries is called. This calculates "n" terms in the innermost expressions and then builds up the final series just by "cross-multiplying" everything out. T...
Wrapper to _eval_nseries if assumptions allow, else to series.
[ "Wrapper", "to", "_eval_nseries", "if", "assumptions", "allow", "else", "to", "series", "." ]
def nseries(self, x=None, x0=0, n=6, dir='+', logx=None): """ Wrapper to _eval_nseries if assumptions allow, else to series. If x is given, x0 is 0, dir='+', and self has x, then _eval_nseries is called. This calculates "n" terms in the innermost expressions and then builds up t...
[ "def", "nseries", "(", "self", ",", "x", "=", "None", ",", "x0", "=", "0", ",", "n", "=", "6", ",", "dir", "=", "'+'", ",", "logx", "=", "None", ")", ":", "if", "x", "and", "not", "x", "in", "self", ".", "free_symbols", ":", "return", "self",...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/core/expr.py#L3124-L3189
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/encodings/utf_32.py
python
IncrementalDecoder.getstate
(self)
return (state, addstate)
[]
def getstate(self): # additional state info from the base class must be None here, # as it isn't passed along to the caller state = codecs.BufferedIncrementalDecoder.getstate(self)[0] # additional state info we pass to the caller: # 0: stream is in natural order for this platform...
[ "def", "getstate", "(", "self", ")", ":", "# additional state info from the base class must be None here,", "# as it isn't passed along to the caller", "state", "=", "codecs", ".", "BufferedIncrementalDecoder", ".", "getstate", "(", "self", ")", "[", "0", "]", "# additional...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/encodings/utf_32.py#L70-L82
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
mesonbuild/mesonmain.py
python
CommandLineParser.add_runpython_arguments
(self, parser)
[]
def add_runpython_arguments(self, parser): parser.add_argument('-c', action='store_true', dest='eval_arg', default=False) parser.add_argument('script_file') parser.add_argument('script_args', nargs=argparse.REMAINDER)
[ "def", "add_runpython_arguments", "(", "self", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'-c'", ",", "action", "=", "'store_true'", ",", "dest", "=", "'eval_arg'", ",", "default", "=", "False", ")", "parser", ".", "add_argument", "(", "...
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/mesonmain.py#L94-L97
python-pillow/Pillow
fd2b07c454b20e1e9af0cea64923b21250f8f8d6
src/PIL/ImageChops.py
python
logical_or
(image1, image2)
return image1._new(image1.im.chop_or(image2.im))
Logical OR between two images. Both of the images must have mode "1". .. code-block:: python out = ((image1 or image2) % MAX) :rtype: :py:class:`~PIL.Image.Image`
Logical OR between two images.
[ "Logical", "OR", "between", "two", "images", "." ]
def logical_or(image1, image2): """Logical OR between two images. Both of the images must have mode "1". .. code-block:: python out = ((image1 or image2) % MAX) :rtype: :py:class:`~PIL.Image.Image` """ image1.load() image2.load() return image1._new(image1.im.chop_or(image2.i...
[ "def", "logical_or", "(", "image1", ",", "image2", ")", ":", "image1", ".", "load", "(", ")", "image2", ".", "load", "(", ")", "return", "image1", ".", "_new", "(", "image1", ".", "im", ".", "chop_or", "(", "image2", ".", "im", ")", ")" ]
https://github.com/python-pillow/Pillow/blob/fd2b07c454b20e1e9af0cea64923b21250f8f8d6/src/PIL/ImageChops.py#L260-L274
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/IPython/utils/py3compat.py
python
buffer_to_bytes
(buf)
return buf
Cast a buffer object to bytes
Cast a buffer object to bytes
[ "Cast", "a", "buffer", "object", "to", "bytes" ]
def buffer_to_bytes(buf): """Cast a buffer object to bytes""" if not isinstance(buf, bytes): buf = bytes(buf) return buf
[ "def", "buffer_to_bytes", "(", "buf", ")", ":", "if", "not", "isinstance", "(", "buf", ",", "bytes", ")", ":", "buf", "=", "bytes", "(", "buf", ")", "return", "buf" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/IPython/utils/py3compat.py#L38-L42
SickChill/SickChill
01020f3636d01535f60b83464d8127ea0efabfc7
sickchill/oldbeard/clients/generic.py
python
GenericClient._set_torrent_pause
(self, result)
return True
This should be overridden should return the True/False from the client when a torrent is set with pause params: :result: an instance of the searchResult class
This should be overridden should return the True/False from the client when a torrent is set with pause params: :result: an instance of the searchResult class
[ "This", "should", "be", "overridden", "should", "return", "the", "True", "/", "False", "from", "the", "client", "when", "a", "torrent", "is", "set", "with", "pause", "params", ":", ":", "result", ":", "an", "instance", "of", "the", "searchResult", "class" ...
def _set_torrent_pause(self, result): # pylint:disable=unused-argument, no-self-use """ This should be overridden should return the True/False from the client when a torrent is set with pause params: :result: an instance of the searchResult class """ return True
[ "def", "_set_torrent_pause", "(", "self", ",", "result", ")", ":", "# pylint:disable=unused-argument, no-self-use", "return", "True" ]
https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/oldbeard/clients/generic.py#L129-L135
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/docutils/parsers/rst/tableparser.py
python
GridTableParser.scan_down
(self, top, left, right)
return None
Look for the bottom-right corner of the cell, making note of all row boundaries.
Look for the bottom-right corner of the cell, making note of all row boundaries.
[ "Look", "for", "the", "bottom", "-", "right", "corner", "of", "the", "cell", "making", "note", "of", "all", "row", "boundaries", "." ]
def scan_down(self, top, left, right): """ Look for the bottom-right corner of the cell, making note of all row boundaries. """ rowseps = {} for i in range(top + 1, self.bottom + 1): if self.block[i][right] == '+': rowseps[i] = [right] ...
[ "def", "scan_down", "(", "self", ",", "top", ",", "left", ",", "right", ")", ":", "rowseps", "=", "{", "}", "for", "i", "in", "range", "(", "top", "+", "1", ",", "self", ".", "bottom", "+", "1", ")", ":", "if", "self", ".", "block", "[", "i",...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/docutils/parsers/rst/tableparser.py#L234-L250
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/encodings/quopri_codec.py
python
quopri_decode
(input, errors='strict')
return (g.getvalue(), len(input))
[]
def quopri_decode(input, errors='strict'): assert errors == 'strict' f = BytesIO(input) g = BytesIO() quopri.decode(f, g) return (g.getvalue(), len(input))
[ "def", "quopri_decode", "(", "input", ",", "errors", "=", "'strict'", ")", ":", "assert", "errors", "==", "'strict'", "f", "=", "BytesIO", "(", "input", ")", "g", "=", "BytesIO", "(", ")", "quopri", ".", "decode", "(", "f", ",", "g", ")", "return", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/encodings/quopri_codec.py#L18-L23
Thinklab-SJTU/ThinkMatch
9d33c1516a9a13e7d4a111133ec4e0e2af798d50
src/spectral_clustering.py
python
spectral_clustering
(sim_matrix: Tensor, cluster_num: int, init: Tensor=None, return_state: bool=False, normalized: bool=False)
r""" Perform spectral clustering based on given similarity matrix. This function firstly computes the leading eigenvectors of the given similarity matrix, and then utilizes the eigenvectors as features and performs k-means clustering based on these features. :param sim_matrix: :math:`(n\times n)` inpu...
r""" Perform spectral clustering based on given similarity matrix.
[ "r", "Perform", "spectral", "clustering", "based", "on", "given", "similarity", "matrix", "." ]
def spectral_clustering(sim_matrix: Tensor, cluster_num: int, init: Tensor=None, return_state: bool=False, normalized: bool=False): r""" Perform spectral clustering based on given similarity matrix. This function firstly computes the leading eigenvectors of the given similarity matr...
[ "def", "spectral_clustering", "(", "sim_matrix", ":", "Tensor", ",", "cluster_num", ":", "int", ",", "init", ":", "Tensor", "=", "None", ",", "return_state", ":", "bool", "=", "False", ",", "normalized", ":", "bool", "=", "False", ")", ":", "degree", "="...
https://github.com/Thinklab-SJTU/ThinkMatch/blob/9d33c1516a9a13e7d4a111133ec4e0e2af798d50/src/spectral_clustering.py#L201-L236
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/display_keyword_view_service/client.py
python
DisplayKeywordViewServiceClient.parse_common_folder_path
(path: str)
return m.groupdict() if m else {}
Parse a folder path into its component segments.
Parse a folder path into its component segments.
[ "Parse", "a", "folder", "path", "into", "its", "component", "segments", "." ]
def parse_common_folder_path(path: str) -> Dict[str, str]: """Parse a folder path into its component segments.""" m = re.match(r"^folders/(?P<folder>.+?)$", path) return m.groupdict() if m else {}
[ "def", "parse_common_folder_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^folders/(?P<folder>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdict", "(", ")", "if", "m"...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/display_keyword_view_service/client.py#L218-L221
Trusted-AI/adversarial-robustness-toolbox
9fabffdbb92947efa1ecc5d825d634d30dfbaf29
art/attacks/evasion/carlini.py
python
CarliniLInfMethod._generate_single
(self, x_batch, y_batch, clip_min, clip_max, const, tau)
return x_adv_batch
Generate a single adversarial example. :param x_batch: Current benign sample. :param y_batch: Current label. :param clip_min: Minimum clipping values. :param clip_max: Maximum clipping values. :param const: Current constant `c`. :param tau: Current limit `tau`.
Generate a single adversarial example.
[ "Generate", "a", "single", "adversarial", "example", "." ]
def _generate_single(self, x_batch, y_batch, clip_min, clip_max, const, tau): """ Generate a single adversarial example. :param x_batch: Current benign sample. :param y_batch: Current label. :param clip_min: Minimum clipping values. :param clip_max: Maximum clipping valu...
[ "def", "_generate_single", "(", "self", ",", "x_batch", ",", "y_batch", ",", "clip_min", ",", "clip_max", ",", "const", ",", "tau", ")", ":", "# The optimization is performed in tanh space to keep the adversarial images bounded from clip_min and clip_max.", "x_adv_batch_tanh", ...
https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/9fabffdbb92947efa1ecc5d825d634d30dfbaf29/art/attacks/evasion/carlini.py#L665-L728
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/lib2to3/refactor.py
python
RefactoringTool.write_file
(self, new_text, filename, old_text, encoding=None)
Writes a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set.
Writes a string to a file.
[ "Writes", "a", "string", "to", "a", "file", "." ]
def write_file(self, new_text, filename, old_text, encoding=None): """Writes a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. """ try: f = ...
[ "def", "write_file", "(", "self", ",", "new_text", ",", "filename", ",", "old_text", ",", "encoding", "=", "None", ")", ":", "try", ":", "f", "=", "_open_with_encoding", "(", "filename", ",", "\"w\"", ",", "encoding", "=", "encoding", ")", "except", "os"...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/lib2to3/refactor.py#L528-L547
pret/pokemon-reverse-engineering-tools
5e0715f2579adcfeb683448c9a7826cfd3afa57d
pokemontools/pic.py
python
Decompressor._fillram
(self, ram)
[]
def _fillram(self, ram): mode = ['rle', 'data'][self._readbit()] size = self.size * 4 while len(ram) < size: if mode == 'rle': self._read_rle_chunk(ram) mode = 'data' elif mode == 'data': self._read_data_chunk(ram, size) ...
[ "def", "_fillram", "(", "self", ",", "ram", ")", ":", "mode", "=", "[", "'rle'", ",", "'data'", "]", "[", "self", ".", "_readbit", "(", ")", "]", "size", "=", "self", ".", "size", "*", "4", "while", "len", "(", "ram", ")", "<", "size", ":", "...
https://github.com/pret/pokemon-reverse-engineering-tools/blob/5e0715f2579adcfeb683448c9a7826cfd3afa57d/pokemontools/pic.py#L96-L110
standardebooks/tools
f57af3c5938a9aeed9e97e82b2c130424f6033e5
se/vendor/kindleunpack/mobi_split.py
python
get_exth_params
(rec0)
return ebase,elen,enum
[]
def get_exth_params(rec0): ebase = mobi_header_base + getint(rec0,mobi_header_length) elen = getint(rec0,ebase+4) enum = getint(rec0,ebase+8) return ebase,elen,enum
[ "def", "get_exth_params", "(", "rec0", ")", ":", "ebase", "=", "mobi_header_base", "+", "getint", "(", "rec0", ",", "mobi_header_length", ")", "elen", "=", "getint", "(", "rec0", ",", "ebase", "+", "4", ")", "enum", "=", "getint", "(", "rec0", ",", "eb...
https://github.com/standardebooks/tools/blob/f57af3c5938a9aeed9e97e82b2c130424f6033e5/se/vendor/kindleunpack/mobi_split.py#L229-L233
davidbau/ganseeing
93cea2c8f391aef001ddf9dcb35c43990681a47c
seeing/train_onelayer_inv.py
python
set_requires_grad
(requires_grad, *models)
[]
def set_requires_grad(requires_grad, *models): for model in models: if model is not None: for param in model.parameters(): param.requires_grad = requires_grad
[ "def", "set_requires_grad", "(", "requires_grad", ",", "*", "models", ")", ":", "for", "model", "in", "models", ":", "if", "model", "is", "not", "None", ":", "for", "param", "in", "model", ".", "parameters", "(", ")", ":", "param", ".", "requires_grad", ...
https://github.com/davidbau/ganseeing/blob/93cea2c8f391aef001ddf9dcb35c43990681a47c/seeing/train_onelayer_inv.py#L234-L238
ilius/pyglossary
d599b3beda3ae17642af5debd83bb991148e6425
pyglossary/plugin_prop.py
python
PluginProp.getReadExtraOptions
(self)
return self.__class__.getExtraOptions(self.readerClass.open, self.name)
[]
def getReadExtraOptions(self): return self.__class__.getExtraOptions(self.readerClass.open, self.name)
[ "def", "getReadExtraOptions", "(", "self", ")", ":", "return", "self", ".", "__class__", ".", "getExtraOptions", "(", "self", ".", "readerClass", ".", "open", ",", "self", ".", "name", ")" ]
https://github.com/ilius/pyglossary/blob/d599b3beda3ae17642af5debd83bb991148e6425/pyglossary/plugin_prop.py#L242-L243
taowen/es-monitor
c4deceb4964857f495d13bfaf2d92f36734c9e1c
es_sql/sqlparse/__init__.py
python
parse
(sql, encoding=None)
return tuple(parsestream(sql, encoding))
Parse sql and return a list of statements. :param sql: A string containting one or more SQL statements. :param encoding: The encoding of the statement (optional). :returns: A tuple of :class:`~sqlparse.sql.Statement` instances.
Parse sql and return a list of statements.
[ "Parse", "sql", "and", "return", "a", "list", "of", "statements", "." ]
def parse(sql, encoding=None): """Parse sql and return a list of statements. :param sql: A string containting one or more SQL statements. :param encoding: The encoding of the statement (optional). :returns: A tuple of :class:`~sqlparse.sql.Statement` instances. """ return tuple(parsestream(sql,...
[ "def", "parse", "(", "sql", ",", "encoding", "=", "None", ")", ":", "return", "tuple", "(", "parsestream", "(", "sql", ",", "encoding", ")", ")" ]
https://github.com/taowen/es-monitor/blob/c4deceb4964857f495d13bfaf2d92f36734c9e1c/es_sql/sqlparse/__init__.py#L19-L26
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
vendor/mms-agent/getLogs.py
python
GetLogsThread._collectLogs
( self, logConn )
return root
Make the call to mongo host and pull the log data
Make the call to mongo host and pull the log data
[ "Make", "the", "call", "to", "mongo", "host", "and", "pull", "the", "log", "data" ]
def _collectLogs( self, logConn ): """ Make the call to mongo host and pull the log data """ root = { } logEntries = [] entries = logConn.admin.command( { 'getLog' : 'global' } ) if not entries or not entries.get('log'): self.lastLogEntries.clear() retu...
[ "def", "_collectLogs", "(", "self", ",", "logConn", ")", ":", "root", "=", "{", "}", "logEntries", "=", "[", "]", "entries", "=", "logConn", ".", "admin", ".", "command", "(", "{", "'getLog'", ":", "'global'", "}", ")", "if", "not", "entries", "or", ...
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/vendor/mms-agent/getLogs.py#L101-L129
STIXProject/python-stix
5ab382b1a3c19364fb8c3e5219addab9e3b64ee9
stix/incident/__init__.py
python
Incident.add_coordinator
(self, value)
Adds a :class:`.InformationSource` object to the :attr:`coordinators` collection.
Adds a :class:`.InformationSource` object to the :attr:`coordinators` collection.
[ "Adds", "a", ":", "class", ":", ".", "InformationSource", "object", "to", "the", ":", "attr", ":", "coordinators", "collection", "." ]
def add_coordinator(self, value): """Adds a :class:`.InformationSource` object to the :attr:`coordinators` collection. """ self.coordinators.append(value)
[ "def", "add_coordinator", "(", "self", ",", "value", ")", ":", "self", ".", "coordinators", ".", "append", "(", "value", ")" ]
https://github.com/STIXProject/python-stix/blob/5ab382b1a3c19364fb8c3e5219addab9e3b64ee9/stix/incident/__init__.py#L152-L157
CGCookie/retopoflow
3d8b3a47d1d661f99ab0aeb21d31370bf15de35e
addon_common/common/ui_properties.py
python
UI_Element_Properties.style_left
(self)
return self._computed_styles.get('left', 'auto')
[]
def style_left(self): if self._style_left is not None: return self._style_left return self._computed_styles.get('left', 'auto')
[ "def", "style_left", "(", "self", ")", ":", "if", "self", ".", "_style_left", "is", "not", "None", ":", "return", "self", ".", "_style_left", "return", "self", ".", "_computed_styles", ".", "get", "(", "'left'", ",", "'auto'", ")" ]
https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/addon_common/common/ui_properties.py#L605-L607
automl/ConfigSpace
4d69931de5540fc6be4230731ddebf6a25d2e1a8
ConfigSpace/read_and_write/json.py
python
_build_forbidden
(clause)
[]
def _build_forbidden(clause) -> Dict: if isinstance(clause, ForbiddenEqualsClause): return _build_forbidden_equals_clause(clause) elif isinstance(clause, ForbiddenInClause): return _build_forbidden_in_clause(clause) elif isinstance(clause, ForbiddenAndConjunction): return _build_forb...
[ "def", "_build_forbidden", "(", "clause", ")", "->", "Dict", ":", "if", "isinstance", "(", "clause", ",", "ForbiddenEqualsClause", ")", ":", "return", "_build_forbidden_equals_clause", "(", "clause", ")", "elif", "isinstance", "(", "clause", ",", "ForbiddenInClaus...
https://github.com/automl/ConfigSpace/blob/4d69931de5540fc6be4230731ddebf6a25d2e1a8/ConfigSpace/read_and_write/json.py#L229-L237
prakhar1989/Algorithms
82e64ce9d451b33c1bce64a63276d6341a1f13b0
union_find/unionfind.py
python
UnionFind.count_groups
(self)
return len(self.group)
returns a count of the number of groups/sets in the data structure
returns a count of the number of groups/sets in the data structure
[ "returns", "a", "count", "of", "the", "number", "of", "groups", "/", "sets", "in", "the", "data", "structure" ]
def count_groups(self): """ returns a count of the number of groups/sets in the data structure""" return len(self.group)
[ "def", "count_groups", "(", "self", ")", ":", "return", "len", "(", "self", ".", "group", ")" ]
https://github.com/prakhar1989/Algorithms/blob/82e64ce9d451b33c1bce64a63276d6341a1f13b0/union_find/unionfind.py#L59-L62
KiCad/kicad-library-utils
d55f6966e9d96d313b05368b6d418995d89a78a6
pcb/rules/F6_1.py
python
Rule.fix
(self)
Proceeds the fixing of the rule, if possible.
Proceeds the fixing of the rule, if possible.
[ "Proceeds", "the", "fixing", "of", "the", "rule", "if", "possible", "." ]
def fix(self): """ Proceeds the fixing of the rule, if possible. """ module = self.module if self.check(): self.info("Set 'surface mount' attribute") module.attribute = 'smd'
[ "def", "fix", "(", "self", ")", ":", "module", "=", "self", ".", "module", "if", "self", ".", "check", "(", ")", ":", "self", ".", "info", "(", "\"Set 'surface mount' attribute\"", ")", "module", ".", "attribute", "=", "'smd'" ]
https://github.com/KiCad/kicad-library-utils/blob/d55f6966e9d96d313b05368b6d418995d89a78a6/pcb/rules/F6_1.py#L45-L52
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/eis/v20200715/models.py
python
ListEisConnectorsResponse.__init__
(self)
r""" :param TotalCount: 连接器总数 :type TotalCount: int :param Connectors: 连接器列表 :type Connectors: list of EisConnectorSummary :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param TotalCount: 连接器总数 :type TotalCount: int :param Connectors: 连接器列表 :type Connectors: list of EisConnectorSummary :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "TotalCount", ":", "连接器总数", ":", "type", "TotalCount", ":", "int", ":", "param", "Connectors", ":", "连接器列表", ":", "type", "Connectors", ":", "list", "of", "EisConnectorSummary", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该...
def __init__(self): r""" :param TotalCount: 连接器总数 :type TotalCount: int :param Connectors: 连接器列表 :type Connectors: list of EisConnectorSummary :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.TotalCount = N...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "TotalCount", "=", "None", "self", ".", "Connectors", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/eis/v20200715/models.py#L411-L422
wummel/linkchecker
c2ce810c3fb00b895a841a7be6b2e78c64e7b042
third_party/miniboa-r42/handler_demo.py
python
my_on_connect
(client)
Example on_connect handler.
Example on_connect handler.
[ "Example", "on_connect", "handler", "." ]
def my_on_connect(client): """ Example on_connect handler. """ client.send('You connected from %s\n' % client.addrport()) if CLIENTS: client.send('Also connected are:\n') for neighbor in CLIENTS: client.send('%s\n' % neighbor.addrport()) else: client.send('Sad...
[ "def", "my_on_connect", "(", "client", ")", ":", "client", ".", "send", "(", "'You connected from %s\\n'", "%", "client", ".", "addrport", "(", ")", ")", "if", "CLIENTS", ":", "client", ".", "send", "(", "'Also connected are:\\n'", ")", "for", "neighbor", "i...
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/miniboa-r42/handler_demo.py#L25-L36
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractTransnovelationWordpressCom.py
python
extractTransnovelationWordpressCom
(item)
return False
Parser for 'transnovelation.wordpress.com'
Parser for 'transnovelation.wordpress.com'
[ "Parser", "for", "transnovelation", ".", "wordpress", ".", "com" ]
def extractTransnovelationWordpressCom(item): ''' Parser for 'transnovelation.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('Mr. Dior', 'Mr. Dior', ...
[ "def", "extractTransnovelationWordpressCom", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\""...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractTransnovelationWordpressCom.py#L1-L23
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/sklearn/cluster/spectral.py
python
spectral_clustering
(affinity, n_clusters=8, n_components=None, eigen_solver=None, random_state=None, n_init=10, eigen_tol=0.0, assign_labels='kmeans')
return labels
Apply clustering to a projection to the normalized laplacian. In practice Spectral Clustering is very useful when the structure of the individual clusters is highly non-convex or more generally when a measure of the center and spread of the cluster is not a suitable description of the complete cluster....
Apply clustering to a projection to the normalized laplacian.
[ "Apply", "clustering", "to", "a", "projection", "to", "the", "normalized", "laplacian", "." ]
def spectral_clustering(affinity, n_clusters=8, n_components=None, eigen_solver=None, random_state=None, n_init=10, eigen_tol=0.0, assign_labels='kmeans'): """Apply clustering to a projection to the normalized laplacian. In practice Spectral Clustering is very us...
[ "def", "spectral_clustering", "(", "affinity", ",", "n_clusters", "=", "8", ",", "n_components", "=", "None", ",", "eigen_solver", "=", "None", ",", "random_state", "=", "None", ",", "n_init", "=", "10", ",", "eigen_tol", "=", "0.0", ",", "assign_labels", ...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/sklearn/cluster/spectral.py#L159-L266
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
tools/sqlmap/lib/core/shell.py
python
CompleterNG.global_matches
(self, text)
return matches
Compute matches when text is a simple name. Return a list of all names currently defined in self.namespace that match.
Compute matches when text is a simple name. Return a list of all names currently defined in self.namespace that match.
[ "Compute", "matches", "when", "text", "is", "a", "simple", "name", ".", "Return", "a", "list", "of", "all", "names", "currently", "defined", "in", "self", ".", "namespace", "that", "match", "." ]
def global_matches(self, text): """ Compute matches when text is a simple name. Return a list of all names currently defined in self.namespace that match. """ matches = [] n = len(text) for ns in (self.namespace,): for word in ns: ...
[ "def", "global_matches", "(", "self", ",", "text", ")", ":", "matches", "=", "[", "]", "n", "=", "len", "(", "text", ")", "for", "ns", "in", "(", "self", ".", "namespace", ",", ")", ":", "for", "word", "in", "ns", ":", "if", "word", "[", ":", ...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/lib/core/shell.py#L33-L48
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/combinatorics/fp_groups.py
python
FpGroup.is_abelian
(self)
return self._perm_property("is_abelian")
Check if `self` is abelian.
Check if `self` is abelian.
[ "Check", "if", "self", "is", "abelian", "." ]
def is_abelian(self): ''' Check if `self` is abelian. ''' return self._perm_property("is_abelian")
[ "def", "is_abelian", "(", "self", ")", ":", "return", "self", ".", "_perm_property", "(", "\"is_abelian\"", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/combinatorics/fp_groups.py#L483-L488
salabim/salabim
e0de846b042daf2dc71aaf43d8adc6486b57f376
salabim_exp.py
python
test115
()
[]
def test115(): class X(sim.Component): def animation_objects(self): ao = sim.AnimateRectangle(spec=(-40, -10, 40, 10), fillcolor="red", text=lambda arg, t: f"{len(q)}.{arg.sequence_number()}", arg=self) return 90, 30, ao class Generator(sim.Component): def process(self):...
[ "def", "test115", "(", ")", ":", "class", "X", "(", "sim", ".", "Component", ")", ":", "def", "animation_objects", "(", "self", ")", ":", "ao", "=", "sim", ".", "AnimateRectangle", "(", "spec", "=", "(", "-", "40", ",", "-", "10", ",", "40", ",",...
https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim_exp.py#L894-L912
google-research/mixmatch
1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e
libml/layers.py
python
interleave_offsets
(batch, nu)
return offsets
[]
def interleave_offsets(batch, nu): groups = [batch // (nu + 1)] * (nu + 1) for x in range(batch - sum(groups)): groups[-x - 1] += 1 offsets = [0] for g in groups: offsets.append(offsets[-1] + g) assert offsets[-1] == batch return offsets
[ "def", "interleave_offsets", "(", "batch", ",", "nu", ")", ":", "groups", "=", "[", "batch", "//", "(", "nu", "+", "1", ")", "]", "*", "(", "nu", "+", "1", ")", "for", "x", "in", "range", "(", "batch", "-", "sum", "(", "groups", ")", ")", ":"...
https://github.com/google-research/mixmatch/blob/1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e/libml/layers.py#L89-L97
pytorch/captum
38b57082d22854013c0a0b80a51c0b85269afdaf
captum/attr/_utils/lrp_rules.py
python
PropagationRule.backward_hook_activation
(module, grad_input, grad_output)
return grad_output
Backward hook to propagate relevance over non-linear activations.
Backward hook to propagate relevance over non-linear activations.
[ "Backward", "hook", "to", "propagate", "relevance", "over", "non", "-", "linear", "activations", "." ]
def backward_hook_activation(module, grad_input, grad_output): """Backward hook to propagate relevance over non-linear activations.""" if ( isinstance(grad_input, tuple) and isinstance(grad_output, tuple) and len(grad_input) > len(grad_output) ): #...
[ "def", "backward_hook_activation", "(", "module", ",", "grad_input", ",", "grad_output", ")", ":", "if", "(", "isinstance", "(", "grad_input", ",", "tuple", ")", "and", "isinstance", "(", "grad_output", ",", "tuple", ")", "and", "len", "(", "grad_input", ")"...
https://github.com/pytorch/captum/blob/38b57082d22854013c0a0b80a51c0b85269afdaf/captum/attr/_utils/lrp_rules.py#L34-L46
polakowo/vectorbt
6638735c131655760474d72b9f045d1dbdbd8fe9
vectorbt/records/base.py
python
Records.records
(self)
return pd.DataFrame.from_records(self.values)
Records.
Records.
[ "Records", "." ]
def records(self) -> tp.Frame: """Records.""" return pd.DataFrame.from_records(self.values)
[ "def", "records", "(", "self", ")", "->", "tp", ".", "Frame", ":", "return", "pd", ".", "DataFrame", ".", "from_records", "(", "self", ".", "values", ")" ]
https://github.com/polakowo/vectorbt/blob/6638735c131655760474d72b9f045d1dbdbd8fe9/vectorbt/records/base.py#L588-L590
vertexproject/synapse
8173f43cb5fba5ca2648d12a659afb432139b0a7
synapse/lib/view.py
python
View.runPropSet
(self, node, prop, oldv, view=None)
Handle when a prop set trigger event fired
Handle when a prop set trigger event fired
[ "Handle", "when", "a", "prop", "set", "trigger", "event", "fired" ]
async def runPropSet(self, node, prop, oldv, view=None): ''' Handle when a prop set trigger event fired ''' if not node.snap.trigson: return if view is None: view = self.iden await self.triggers.runPropSet(node, prop, oldv, view=view)
[ "async", "def", "runPropSet", "(", "self", ",", "node", ",", "prop", ",", "oldv", ",", "view", "=", "None", ")", ":", "if", "not", "node", ".", "snap", ".", "trigson", ":", "return", "if", "view", "is", "None", ":", "view", "=", "self", ".", "ide...
https://github.com/vertexproject/synapse/blob/8173f43cb5fba5ca2648d12a659afb432139b0a7/synapse/lib/view.py#L775-L785
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/poudriere.py
python
parse_config
(config_file=None)
return "Could not find {} on file system".format(config_file)
Returns a dict of poudriere main configuration definitions CLI Example: .. code-block:: bash salt '*' poudriere.parse_config
Returns a dict of poudriere main configuration definitions
[ "Returns", "a", "dict", "of", "poudriere", "main", "configuration", "definitions" ]
def parse_config(config_file=None): """ Returns a dict of poudriere main configuration definitions CLI Example: .. code-block:: bash salt '*' poudriere.parse_config """ if config_file is None: config_file = _config_file() ret = {} if _check_config_exists(config_file): ...
[ "def", "parse_config", "(", "config_file", "=", "None", ")", ":", "if", "config_file", "is", "None", ":", "config_file", "=", "_config_file", "(", ")", "ret", "=", "{", "}", "if", "_check_config_exists", "(", "config_file", ")", ":", "with", "salt", ".", ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/poudriere.py#L107-L127
noamraph/dreampie
b09ee546ec099ee6549c649692ceb129e05fb229
dulwich/object_store.py
python
MemoryObjectStore.__delitem__
(self, name)
Delete an object from this store, for testing only.
Delete an object from this store, for testing only.
[ "Delete", "an", "object", "from", "this", "store", "for", "testing", "only", "." ]
def __delitem__(self, name): """Delete an object from this store, for testing only.""" del self._data[self._to_hexsha(name)]
[ "def", "__delitem__", "(", "self", ",", "name", ")", ":", "del", "self", ".", "_data", "[", "self", ".", "_to_hexsha", "(", "name", ")", "]" ]
https://github.com/noamraph/dreampie/blob/b09ee546ec099ee6549c649692ceb129e05fb229/dulwich/object_store.py#L658-L660
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/django-tastypie/tastypie/cache.py
python
SimpleCache.__init__
(self, cache_name='default', timeout=None, public=None, private=None, *args, **kwargs)
Optionally accepts a ``timeout`` in seconds for the resource's cache. Defaults to ``60`` seconds.
Optionally accepts a ``timeout`` in seconds for the resource's cache. Defaults to ``60`` seconds.
[ "Optionally", "accepts", "a", "timeout", "in", "seconds", "for", "the", "resource", "s", "cache", ".", "Defaults", "to", "60", "seconds", "." ]
def __init__(self, cache_name='default', timeout=None, public=None, private=None, *args, **kwargs): """ Optionally accepts a ``timeout`` in seconds for the resource's cache. Defaults to ``60`` seconds. """ super(SimpleCache, self).__init__(*args, **kwargs) ...
[ "def", "__init__", "(", "self", ",", "cache_name", "=", "'default'", ",", "timeout", "=", "None", ",", "public", "=", "None", ",", "private", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "SimpleCache", ",", "self", ...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/django-tastypie/tastypie/cache.py#L55-L65
ConsenSys/mythril
d00152f8e4d925c7749d63b533152a937e1dd516
mythril/laser/ethereum/state/global_state.py
python
GlobalState.accounts
(self)
return self.world_state._accounts
:return:
[]
def accounts(self) -> Dict: """ :return: """ return self.world_state._accounts
[ "def", "accounts", "(", "self", ")", "->", "Dict", ":", "return", "self", ".", "world_state", ".", "_accounts" ]
https://github.com/ConsenSys/mythril/blob/d00152f8e4d925c7749d63b533152a937e1dd516/mythril/laser/ethereum/state/global_state.py#L84-L89
mgear-dev/mgear
06ddc26c5adb5eab07ca470c7fafa77404c8a1de
scripts/mgear/maya/rigbits/weightNode_io.py
python
getPoseInfo
(node)
return tmp_dict
Get dict of the pose info from the provided weightDriver node Args: node (str): name of weightDriver Returns: dict: of poseInput:list of values, poseValue:values
Get dict of the pose info from the provided weightDriver node
[ "Get", "dict", "of", "the", "pose", "info", "from", "the", "provided", "weightDriver", "node" ]
def getPoseInfo(node): """Get dict of the pose info from the provided weightDriver node Args: node (str): name of weightDriver Returns: dict: of poseInput:list of values, poseValue:values """ lengthenCompoundAttrs(node) tmp_dict = {"poseInput": [], "poseValue": ...
[ "def", "getPoseInfo", "(", "node", ")", ":", "lengthenCompoundAttrs", "(", "node", ")", "tmp_dict", "=", "{", "\"poseInput\"", ":", "[", "]", ",", "\"poseValue\"", ":", "[", "]", "}", "numberOfPoses", "=", "pm", ".", "getAttr", "(", "\"{}.poses\"", ".", ...
https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/rigbits/weightNode_io.py#L268-L291
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/profiles/views.py
python
delete
(request, id, template_name="profiles/delete.html")
return render_to_resp(request=request, template_name=template_name, context={'user_this':user, 'profile': profile})
[]
def delete(request, id, template_name="profiles/delete.html"): user = get_object_or_404(User, pk=id) try: profile = Profile.objects.get(user=user) except: profile = None if not has_perm(request.user,'profiles.delete_profile',profile): raise Http403 if request.method == "POST": ...
[ "def", "delete", "(", "request", ",", "id", ",", "template_name", "=", "\"profiles/delete.html\"", ")", ":", "user", "=", "get_object_or_404", "(", "User", ",", "pk", "=", "id", ")", "try", ":", "profile", "=", "Profile", ".", "objects", ".", "get", "(",...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/profiles/views.py#L635-L672
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
source/addons/im_livechat/im_livechat.py
python
im_chat_session.users_infos
(self, cr, uid, ids, context=None)
add the anonymous user in the user of the session
add the anonymous user in the user of the session
[ "add", "the", "anonymous", "user", "in", "the", "user", "of", "the", "session" ]
def users_infos(self, cr, uid, ids, context=None): """ add the anonymous user in the user of the session """ for session in self.browse(cr, uid, ids, context=context): users_infos = super(im_chat_session, self).users_infos(cr, uid, ids, context=context) if session.anonymous_name:...
[ "def", "users_infos", "(", "self", ",", "cr", ",", "uid", ",", "ids", ",", "context", "=", "None", ")", ":", "for", "session", "in", "self", ".", "browse", "(", "cr", ",", "uid", ",", "ids", ",", "context", "=", "context", ")", ":", "users_infos", ...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/im_livechat/im_livechat.py#L207-L213
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.py
python
_detect_bom
(input)
return None, input
Return (bom_encoding, input), with any BOM removed from the input.
Return (bom_encoding, input), with any BOM removed from the input.
[ "Return", "(", "bom_encoding", "input", ")", "with", "any", "BOM", "removed", "from", "the", "input", "." ]
def _detect_bom(input): """Return (bom_encoding, input), with any BOM removed from the input.""" if input.startswith(b'\xFF\xFE'): return _UTF16LE, input[2:] if input.startswith(b'\xFE\xFF'): return _UTF16BE, input[2:] if input.startswith(b'\xEF\xBB\xBF'): return UTF8, input[3:] ...
[ "def", "_detect_bom", "(", "input", ")", ":", "if", "input", ".", "startswith", "(", "b'\\xFF\\xFE'", ")", ":", "return", "_UTF16LE", ",", "input", "[", "2", ":", "]", "if", "input", ".", "startswith", "(", "b'\\xFE\\xFF'", ")", ":", "return", "_UTF16BE"...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.py#L161-L169
NiaOrg/NiaPy
08f24ffc79fe324bc9c66ee7186ef98633026005
niapy/algorithms/basic/mke.py
python
MonkeyKingEvolutionV1.move_monkey_king_particle
(self, p, task)
r"""Move Monkey King Particles. Args: p (MkeSolution): Monkey King particle to apply this function on. task (Task): Optimization task.
r"""Move Monkey King Particles.
[ "r", "Move", "Monkey", "King", "Particles", "." ]
def move_monkey_king_particle(self, p, task): r"""Move Monkey King Particles. Args: p (MkeSolution): Monkey King particle to apply this function on. task (Task): Optimization task. """ p.monkey_king = False a = np.apply_along_axis(task.repair, 1, self.mo...
[ "def", "move_monkey_king_particle", "(", "self", ",", "p", ",", "task", ")", ":", "p", ".", "monkey_king", "=", "False", "a", "=", "np", ".", "apply_along_axis", "(", "task", ".", "repair", ",", "1", ",", "self", ".", "move_mk", "(", "p", ".", "x", ...
https://github.com/NiaOrg/NiaPy/blob/08f24ffc79fe324bc9c66ee7186ef98633026005/niapy/algorithms/basic/mke.py#L221-L233
scaelles/OSVOS-TensorFlow
6ef61d1f523296b95974a6dafac01e94bf2fde7d
osvos.py
python
class_balanced_cross_entropy_loss
(output, label)
return final_loss
Define the class balanced cross entropy loss to train the network Args: output: Output of the network label: Ground truth label Returns: Tensor that evaluates the loss
Define the class balanced cross entropy loss to train the network Args: output: Output of the network label: Ground truth label Returns: Tensor that evaluates the loss
[ "Define", "the", "class", "balanced", "cross", "entropy", "loss", "to", "train", "the", "network", "Args", ":", "output", ":", "Output", "of", "the", "network", "label", ":", "Ground", "truth", "label", "Returns", ":", "Tensor", "that", "evaluates", "the", ...
def class_balanced_cross_entropy_loss(output, label): """Define the class balanced cross entropy loss to train the network Args: output: Output of the network label: Ground truth label Returns: Tensor that evaluates the loss """ labels = tf.cast(tf.greater(label, 0.5), tf.float32) ...
[ "def", "class_balanced_cross_entropy_loss", "(", "output", ",", "label", ")", ":", "labels", "=", "tf", ".", "cast", "(", "tf", ".", "greater", "(", "label", ",", "0.5", ")", ",", "tf", ".", "float32", ")", "num_labels_pos", "=", "tf", ".", "reduce_sum",...
https://github.com/scaelles/OSVOS-TensorFlow/blob/6ef61d1f523296b95974a6dafac01e94bf2fde7d/osvos.py#L220-L244
openstack/designate
bff3d5f6e31fe595a77143ec4ac779c187bf72a8
designate/plugin.py
python
ExtensionPlugin.get_extensions
(cls, enabled_extensions=None)
return [e.plugin for e in mgr]
Load a series of extensions
Load a series of extensions
[ "Load", "a", "series", "of", "extensions" ]
def get_extensions(cls, enabled_extensions=None): """Load a series of extensions""" LOG.debug('Looking for extensions in %s' % cls.__plugin_ns__) def _check_func(ext): if enabled_extensions is None: # All extensions are enabled by default, if no specific list ...
[ "def", "get_extensions", "(", "cls", ",", "enabled_extensions", "=", "None", ")", ":", "LOG", ".", "debug", "(", "'Looking for extensions in %s'", "%", "cls", ".", "__plugin_ns__", ")", "def", "_check_func", "(", "ext", ")", ":", "if", "enabled_extensions", "i...
https://github.com/openstack/designate/blob/bff3d5f6e31fe595a77143ec4ac779c187bf72a8/designate/plugin.py#L83-L100
exaile/exaile
a7b58996c5c15b3aa7b9975ac13ee8f784ef4689
xlgui/panel/playlists.py
python
PlaylistsPanel._drag_data_received_uris
(self, tv, context, x, y, selection, info, etime)
Called by drag_data_received when the user drags URIs onto us
Called by drag_data_received when the user drags URIs onto us
[ "Called", "by", "drag_data_received", "when", "the", "user", "drags", "URIs", "onto", "us" ]
def _drag_data_received_uris(self, tv, context, x, y, selection, info, etime): """ Called by drag_data_received when the user drags URIs onto us """ locs = list(selection.get_uris()) drop_info = tv.get_dest_row_at_pos(x, y) if drop_info: path, position = drop_...
[ "def", "_drag_data_received_uris", "(", "self", ",", "tv", ",", "context", ",", "x", ",", "y", ",", "selection", ",", "info", ",", "etime", ")", ":", "locs", "=", "list", "(", "selection", ".", "get_uris", "(", ")", ")", "drop_info", "=", "tv", ".", ...
https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xlgui/panel/playlists.py#L637-L725
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/__init__.py
python
_try_enable_svml
()
return False
Tries to enable SVML if configuration permits use and the library is found.
Tries to enable SVML if configuration permits use and the library is found.
[ "Tries", "to", "enable", "SVML", "if", "configuration", "permits", "use", "and", "the", "library", "is", "found", "." ]
def _try_enable_svml(): """ Tries to enable SVML if configuration permits use and the library is found. """ if not config.DISABLE_INTEL_SVML: try: if sys.platform.startswith('linux'): llvmlite.binding.load_library_permanently("libsvml.so") elif sys.platfor...
[ "def", "_try_enable_svml", "(", ")", ":", "if", "not", "config", ".", "DISABLE_INTEL_SVML", ":", "try", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "'linux'", ")", ":", "llvmlite", ".", "binding", ".", "load_library_permanently", "(", "\"libsv...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/__init__.py#L150-L195
google-research/language
61fa7260ac7d690d11ef72ca863e45a37c0bdc80
language/labs/drkit/wikidata/preprocessing/distantly_supervise.py
python
SlingExtractor.get_canonical_property
(self, prop, tail)
return (prop_id, tail_id)
Returns true if the prop and tail are canonical WikiData properties.
Returns true if the prop and tail are canonical WikiData properties.
[ "Returns", "true", "if", "the", "prop", "and", "tail", "are", "canonical", "WikiData", "properties", "." ]
def get_canonical_property(self, prop, tail): """Returns true if the prop and tail are canonical WikiData properties.""" if not isinstance(prop, sling.Frame) or not isinstance(tail, sling.Frame): return None prop_id = self.get_frame_id(prop) tail_id = self.get_frame_id(tail) if prop_id is None...
[ "def", "get_canonical_property", "(", "self", ",", "prop", ",", "tail", ")", ":", "if", "not", "isinstance", "(", "prop", ",", "sling", ".", "Frame", ")", "or", "not", "isinstance", "(", "tail", ",", "sling", ".", "Frame", ")", ":", "return", "None", ...
https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/labs/drkit/wikidata/preprocessing/distantly_supervise.py#L151-L163
zzzeek/sqlalchemy
fc5c54fcd4d868c2a4c7ac19668d72f506fe821e
examples/performance/large_resultsets.py
python
test_core_fetchall
(n)
Load Core result rows using fetchall.
Load Core result rows using fetchall.
[ "Load", "Core", "result", "rows", "using", "fetchall", "." ]
def test_core_fetchall(n): """Load Core result rows using fetchall.""" with engine.connect() as conn: result = conn.execute(Customer.__table__.select().limit(n)).fetchall() for row in result: row["id"], row["name"], row["description"]
[ "def", "test_core_fetchall", "(", "n", ")", ":", "with", "engine", ".", "connect", "(", ")", "as", "conn", ":", "result", "=", "conn", ".", "execute", "(", "Customer", ".", "__table__", ".", "select", "(", ")", ".", "limit", "(", "n", ")", ")", "."...
https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/examples/performance/large_resultsets.py#L105-L111
wikimedia/pywikibot
81a01ffaec7271bf5b4b170f85a80388420a4e78
pywikibot/tools/__init__.py
python
EmptyDefault.__getitem__
(self, key)
Raise always a :py:obj:`CombinedError`.
Raise always a :py:obj:`CombinedError`.
[ "Raise", "always", "a", ":", "py", ":", "obj", ":", "CombinedError", "." ]
def __getitem__(self, key): """Raise always a :py:obj:`CombinedError`.""" raise CombinedError(key)
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "raise", "CombinedError", "(", "key", ")" ]
https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/tools/__init__.py#L1038-L1040
google/trax
d6cae2067dedd0490b78d831033607357e975015
trax/layers/research/efficient_attention.py
python
PureLSHSelfAttention._incremental_forward_unbatched
(self, qk, v, mask=None, *, q_start, q_len, state, rng, update_state)
return out, (buckets, buckets_idx, hash_rng)
[]
def _incremental_forward_unbatched(self, qk, v, mask=None, *, q_start, q_len, state, rng, update_state): x = (qk, v) length = x[0].shape[0] assert update_state, ( 'This setting not supported (e.g. no backprop for fast inferenc...
[ "def", "_incremental_forward_unbatched", "(", "self", ",", "qk", ",", "v", ",", "mask", "=", "None", ",", "*", ",", "q_start", ",", "q_len", ",", "state", ",", "rng", ",", "update_state", ")", ":", "x", "=", "(", "qk", ",", "v", ")", "length", "=",...
https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/layers/research/efficient_attention.py#L2824-L2934
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/plugins/trezor/clientbase.py
python
TrezorClientBase.get_passphrase
(self, available_on_device)
return passphrase
[]
def get_passphrase(self, available_on_device): if self.creating_wallet: msg = _("Enter a passphrase to generate this wallet. Each time " "you use this wallet your {} will prompt you for the " "passphrase. If you forget the passphrase you cannot " ...
[ "def", "get_passphrase", "(", "self", ",", "available_on_device", ")", ":", "if", "self", ".", "creating_wallet", ":", "msg", "=", "_", "(", "\"Enter a passphrase to generate this wallet. Each time \"", "\"you use this wallet your {} will prompt you for the \"", "\"passphrase....
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/plugins/trezor/clientbase.py#L293-L313
microsoft/MASS
a72a74e5cab150f75cd4e241afa4681bfb92b721
MASS-unsupNMT/src/fp16.py
python
BN_convert_float
(module)
return module
Designed to work with network_to_half. BatchNorm layers need parameters in single precision. Find all layers and convert them back to float. This can't be done with built in .apply as that function will apply fn to all modules, parameters, and buffers. Thus we wouldn't be able to guard the float con...
Designed to work with network_to_half. BatchNorm layers need parameters in single precision. Find all layers and convert them back to float. This can't be done with built in .apply as that function will apply fn to all modules, parameters, and buffers. Thus we wouldn't be able to guard the float con...
[ "Designed", "to", "work", "with", "network_to_half", ".", "BatchNorm", "layers", "need", "parameters", "in", "single", "precision", ".", "Find", "all", "layers", "and", "convert", "them", "back", "to", "float", ".", "This", "can", "t", "be", "done", "with", ...
def BN_convert_float(module): ''' Designed to work with network_to_half. BatchNorm layers need parameters in single precision. Find all layers and convert them back to float. This can't be done with built in .apply as that function will apply fn to all modules, parameters, and buffers. Thus we w...
[ "def", "BN_convert_float", "(", "module", ")", ":", "if", "isinstance", "(", "module", ",", "torch", ".", "nn", ".", "modules", ".", "batchnorm", ".", "_BatchNorm", ")", ":", "module", ".", "float", "(", ")", "for", "child", "in", "module", ".", "child...
https://github.com/microsoft/MASS/blob/a72a74e5cab150f75cd4e241afa4681bfb92b721/MASS-unsupNMT/src/fp16.py#L16-L29
ohmyadd/wetland
76d296ec66dc438606e2455a848619d446f4a4b7
paramiko/channel.py
python
ChannelFile.__repr__
(self)
return '<paramiko.ChannelFile from ' + repr(self.channel) + '>'
Returns a string representation of this object, for debugging.
Returns a string representation of this object, for debugging.
[ "Returns", "a", "string", "representation", "of", "this", "object", "for", "debugging", "." ]
def __repr__(self): """ Returns a string representation of this object, for debugging. """ return '<paramiko.ChannelFile from ' + repr(self.channel) + '>'
[ "def", "__repr__", "(", "self", ")", ":", "return", "'<paramiko.ChannelFile from '", "+", "repr", "(", "self", ".", "channel", ")", "+", "'>'" ]
https://github.com/ohmyadd/wetland/blob/76d296ec66dc438606e2455a848619d446f4a4b7/paramiko/channel.py#L1323-L1327
biopython/biopython
2dd97e71762af7b046d7f7f8a4f1e38db6b06c86
Bio/GenBank/Record.py
python
Record._contig_line
(self)
return output
Output for CONTIG location information from RefSeq (PRIVATE).
Output for CONTIG location information from RefSeq (PRIVATE).
[ "Output", "for", "CONTIG", "location", "information", "from", "RefSeq", "(", "PRIVATE", ")", "." ]
def _contig_line(self): """Output for CONTIG location information from RefSeq (PRIVATE).""" output = "" if self.contig: output += Record.BASE_FORMAT % "CONTIG" output += _wrapped_genbank( self.contig, Record.GB_BASE_INDENT, split_char="," ) ...
[ "def", "_contig_line", "(", "self", ")", ":", "output", "=", "\"\"", "if", "self", ".", "contig", ":", "output", "+=", "Record", ".", "BASE_FORMAT", "%", "\"CONTIG\"", "output", "+=", "_wrapped_genbank", "(", "self", ".", "contig", ",", "Record", ".", "G...
https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/GenBank/Record.py#L487-L495
pysathq/pysat
07bf3a5a4428d40eca804e7ebdf4f496aadf4213
examples/lbx.py
python
LBX.compute
(self, enable=[])
return self.solution
Compute and return one solution. This method checks whether the hard part of the formula is satisfiable, i.e. an MCS can be extracted. If the formula is satisfiable, the model computed by the SAT call is used as an *over-approximation* of the MCS in the method :func:`_com...
Compute and return one solution. This method checks whether the hard part of the formula is satisfiable, i.e. an MCS can be extracted. If the formula is satisfiable, the model computed by the SAT call is used as an *over-approximation* of the MCS in the method :func:`_com...
[ "Compute", "and", "return", "one", "solution", ".", "This", "method", "checks", "whether", "the", "hard", "part", "of", "the", "formula", "is", "satisfiable", "i", ".", "e", ".", "an", "MCS", "can", "be", "extracted", ".", "If", "the", "formula", "is", ...
def compute(self, enable=[]): """ Compute and return one solution. This method checks whether the hard part of the formula is satisfiable, i.e. an MCS can be extracted. If the formula is satisfiable, the model computed by the SAT call is used as an *over-approxima...
[ "def", "compute", "(", "self", ",", "enable", "=", "[", "]", ")", ":", "self", ".", "setd", "=", "[", "]", "self", ".", "satc", "=", "[", "False", "for", "cl", "in", "self", ".", "soft", "]", "# satisfied clauses", "self", ".", "solution", "=", "...
https://github.com/pysathq/pysat/blob/07bf3a5a4428d40eca804e7ebdf4f496aadf4213/examples/lbx.py#L249-L287
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/http/request.py
python
split_domain_port
(host)
return domain, port
Return a (domain, port) tuple from a given host. Returned domain is lower-cased. If the host is invalid, the domain will be empty.
Return a (domain, port) tuple from a given host.
[ "Return", "a", "(", "domain", "port", ")", "tuple", "from", "a", "given", "host", "." ]
def split_domain_port(host): """ Return a (domain, port) tuple from a given host. Returned domain is lower-cased. If the host is invalid, the domain will be empty. """ host = host.lower() if not host_validation_re.match(host): return '', '' if host[-1] == ']': # It's a...
[ "def", "split_domain_port", "(", "host", ")", ":", "host", "=", "host", ".", "lower", "(", ")", "if", "not", "host_validation_re", ".", "match", "(", "host", ")", ":", "return", "''", ",", "''", "if", "host", "[", "-", "1", "]", "==", "']'", ":", ...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/http/request.py#L541-L560
SlavikMIPT/tgcloud
15a44135e9d5510a80065573390e965198016eef
dedupfs/fuse.py
python
Fuse.__init__
(self, *args, **kw)
Not much happens here apart from initializing the `parser` attribute. Arguments are forwarded to the constructor of the parser class almost unchanged. The parser class is `FuseOptParse` unless you specify one using the ``parser_class`` keyword. (See `FuseOptParse` documentation for ...
Not much happens here apart from initializing the `parser` attribute. Arguments are forwarded to the constructor of the parser class almost unchanged.
[ "Not", "much", "happens", "here", "apart", "from", "initializing", "the", "parser", "attribute", ".", "Arguments", "are", "forwarded", "to", "the", "constructor", "of", "the", "parser", "class", "almost", "unchanged", "." ]
def __init__(self, *args, **kw): """ Not much happens here apart from initializing the `parser` attribute. Arguments are forwarded to the constructor of the parser class almost unchanged. The parser class is `FuseOptParse` unless you specify one using the ``parser_class`...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "not", "fuse_python_api", ":", "raise", "RuntimeError", ",", "__name__", "+", "\"\"\".fuse_python_api not defined.\n\n! Please define \"\"\"", "+", "__name__", "+", "\"\"\".fuse...
https://github.com/SlavikMIPT/tgcloud/blob/15a44135e9d5510a80065573390e965198016eef/dedupfs/fuse.py#L645-L707
rossant/ipymd
d87c9ebc59d67fe78b0139ee00e0e5307682e303
ipymd/lib/opendocument.py
python
ODFDocument.linebreak
(self)
Add a line break within a paragraph.
Add a line break within a paragraph.
[ "Add", "a", "line", "break", "within", "a", "paragraph", "." ]
def linebreak(self): """Add a line break within a paragraph.""" container = self._containers[-1] container.addElement(LineBreak())
[ "def", "linebreak", "(", "self", ")", ":", "container", "=", "self", ".", "_containers", "[", "-", "1", "]", "container", ".", "addElement", "(", "LineBreak", "(", ")", ")" ]
https://github.com/rossant/ipymd/blob/d87c9ebc59d67fe78b0139ee00e0e5307682e303/ipymd/lib/opendocument.py#L639-L642
vsitzmann/siren
4df34baee3f0f9c8f351630992c1fe1f69114b5f
meta_modules.py
python
HyperNetwork.__init__
(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module)
Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidden_features: Number of hidden units in hypernetwork hypo_module: MetaModule. The module whose parameters are predicted.
[]
def __init__(self, hyper_in_features, hyper_hidden_layers, hyper_hidden_features, hypo_module): ''' Args: hyper_in_features: In features of hypernetwork hyper_hidden_layers: Number of hidden layers in hypernetwork hyper_hidden_features: Number of hidden units in hype...
[ "def", "__init__", "(", "self", ",", "hyper_in_features", ",", "hyper_hidden_layers", ",", "hyper_hidden_features", ",", "hypo_module", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "hypo_parameters", "=", "hypo_module", ".", "meta_named_parameters", "("...
https://github.com/vsitzmann/siren/blob/4df34baee3f0f9c8f351630992c1fe1f69114b5f/meta_modules.py#L11-L39
poppy-project/pypot
c5d384fe23eef9f6ec98467f6f76626cdf20afb9
pypot/utils/stoppablethread.py
python
StoppableThread.start
(self)
Start the run method as a new thread. It will first stop the thread if it is already running.
Start the run method as a new thread.
[ "Start", "the", "run", "method", "as", "a", "new", "thread", "." ]
def start(self): """ Start the run method as a new thread. It will first stop the thread if it is already running. """ if self.running: self.stop() self._thread = threading.Thread(target=self._wrapped_target) self._thread.daemon = True self._thread....
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "running", ":", "self", ".", "stop", "(", ")", "self", ".", "_thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_wrapped_target", ")", "self", ".", "_thread", ".", ...
https://github.com/poppy-project/pypot/blob/c5d384fe23eef9f6ec98467f6f76626cdf20afb9/pypot/utils/stoppablethread.py#L33-L44
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.py
python
change_credentials
()
Updates the credentials for a Managed Account, optionally applying the change to the Managed System. demisto parameter: (int) account_id ID of the account for which to set the credentials. demisto parameter: (string) password The new password to set. If not given, generates a new, random passw...
Updates the credentials for a Managed Account, optionally applying the change to the Managed System.
[ "Updates", "the", "credentials", "for", "a", "Managed", "Account", "optionally", "applying", "the", "change", "to", "the", "Managed", "System", "." ]
def change_credentials(): """ Updates the credentials for a Managed Account, optionally applying the change to the Managed System. demisto parameter: (int) account_id ID of the account for which to set the credentials. demisto parameter: (string) password The new password to set. If no...
[ "def", "change_credentials", "(", ")", ":", "account_id", "=", "demisto", ".", "args", "(", ")", ".", "get", "(", "'account_id'", ")", "password", "=", "demisto", ".", "args", "(", ")", ".", "get", "(", "'password'", ")", "public_key", "=", "demisto", ...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.py#L328-L377
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_priority_class_list.py
python
V1PriorityClassList.__ne__
(self, other)
return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
Returns true if both objects are not equal
[ "Returns", "true", "if", "both", "objects", "are", "not", "equal" ]
def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, V1PriorityClassList): return True return self.to_dict() != other.to_dict()
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V1PriorityClassList", ")", ":", "return", "True", "return", "self", ".", "to_dict", "(", ")", "!=", "other", ".", "to_dict", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_priority_class_list.py#L200-L205
scanny/python-pptx
71d1ca0b2b3b9178d64cdab565e8503a25a54e0b
pptx/shapes/shapetree.py
python
_LayoutShapeFactory
(shape_elm, parent)
return BaseShapeFactory(shape_elm, parent)
Return an instance of the appropriate shape proxy class for *shape_elm* on a slide layout.
Return an instance of the appropriate shape proxy class for *shape_elm* on a slide layout.
[ "Return", "an", "instance", "of", "the", "appropriate", "shape", "proxy", "class", "for", "*", "shape_elm", "*", "on", "a", "slide", "layout", "." ]
def _LayoutShapeFactory(shape_elm, parent): """ Return an instance of the appropriate shape proxy class for *shape_elm* on a slide layout. """ tag_name = shape_elm.tag if tag_name == qn("p:sp") and shape_elm.has_ph_elm: return LayoutPlaceholder(shape_elm, parent) return BaseShapeFact...
[ "def", "_LayoutShapeFactory", "(", "shape_elm", ",", "parent", ")", ":", "tag_name", "=", "shape_elm", ".", "tag", "if", "tag_name", "==", "qn", "(", "\"p:sp\"", ")", "and", "shape_elm", ".", "has_ph_elm", ":", "return", "LayoutPlaceholder", "(", "shape_elm", ...
https://github.com/scanny/python-pptx/blob/71d1ca0b2b3b9178d64cdab565e8503a25a54e0b/pptx/shapes/shapetree.py#L806-L814
zvtvz/zvt
054bf8a3e7a049df7087c324fa87e8effbaf5bdc
src/zvt/recorders/eastmoney/common.py
python
EastmoneyTimestampsDataRecorder.init_timestamps
(self, entity)
return []
[]
def init_timestamps(self, entity): param = {"color": "w", "fc": get_fc(entity)} timestamp_json_list = call_eastmoney_api( url=self.timestamps_fetching_url, path_fields=self.timestamp_list_path_fields, param=param ) if self.timestamp_path_fields and timestamp_json_list: ...
[ "def", "init_timestamps", "(", "self", ",", "entity", ")", ":", "param", "=", "{", "\"color\"", ":", "\"w\"", ",", "\"fc\"", ":", "get_fc", "(", "entity", ")", "}", "timestamp_json_list", "=", "call_eastmoney_api", "(", "url", "=", "self", ".", "timestamps...
https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/src/zvt/recorders/eastmoney/common.py#L150-L160
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/root_system/fusion_ring.py
python
FusionRing.virasoro_central_charge
(self)
return self._conj * self._k * dim_g / (self._k + self._h_check)
r""" Return the Virasoro central charge of the WZW conformal field theory associated with the Fusion Ring. If `\mathfrak{g}` is the corresponding semisimple Lie algebra, this is .. MATH:: \frac{k\dim\mathfrak{g}}{k+h^\vee}, where `k` is the level and `h^\v...
r""" Return the Virasoro central charge of the WZW conformal field theory associated with the Fusion Ring.
[ "r", "Return", "the", "Virasoro", "central", "charge", "of", "the", "WZW", "conformal", "field", "theory", "associated", "with", "the", "Fusion", "Ring", "." ]
def virasoro_central_charge(self): r""" Return the Virasoro central charge of the WZW conformal field theory associated with the Fusion Ring. If `\mathfrak{g}` is the corresponding semisimple Lie algebra, this is .. MATH:: \frac{k\dim\mathfrak{g}}{k+h^\vee}...
[ "def", "virasoro_central_charge", "(", "self", ")", ":", "dim_g", "=", "len", "(", "self", ".", "space", "(", ")", ".", "roots", "(", ")", ")", "+", "self", ".", "cartan_type", "(", ")", ".", "rank", "(", ")", "return", "self", ".", "_conj", "*", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/root_system/fusion_ring.py#L544-L583
xiepaup/dbatools
8549f2571aaee6a39f5c6f32179ac9c5d301a9aa
mysqlTools/mysql_utilities/mysql/utilities/common/table.py
python
Table.check_indexes
(self, show_drops=False)
Check for duplicate or redundant indexes and display all matches show_drops[in] (optional) If True the DROP statements are printed Note: You must call get_indexes() prior to calling this method. If get_indexes() is not called, no duplicates will be found.
Check for duplicate or redundant indexes and display all matches
[ "Check", "for", "duplicate", "or", "redundant", "indexes", "and", "display", "all", "matches" ]
def check_indexes(self, show_drops=False): """Check for duplicate or redundant indexes and display all matches show_drops[in] (optional) If True the DROP statements are printed Note: You must call get_indexes() prior to calling this method. If get_indexes() is not called, no duplic...
[ "def", "check_indexes", "(", "self", ",", "show_drops", "=", "False", ")", ":", "dupes", "=", "[", "]", "res", "=", "self", ".", "__check_index_list", "(", "self", ".", "btree_indexes", ")", "# if there are duplicates, add them to the dupes list", "if", "res", "...
https://github.com/xiepaup/dbatools/blob/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/utilities/common/table.py#L991-L1037
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/oauth/__init__.py
python
Request.to_postdata
(self)
return urllib.urlencode(d, True).replace('+', '%20')
Serialize as post data for a POST request.
Serialize as post data for a POST request.
[ "Serialize", "as", "post", "data", "for", "a", "POST", "request", "." ]
def to_postdata(self): """Serialize as post data for a POST request.""" d = {} for k, v in self.iteritems(): d[k.encode('utf-8')] = to_utf8_optional_iterator(v) # tell urlencode to deal with sequence values and map them correctly # to resulting querystring. for examp...
[ "def", "to_postdata", "(", "self", ")", ":", "d", "=", "{", "}", "for", "k", ",", "v", "in", "self", ".", "iteritems", "(", ")", ":", "d", "[", "k", ".", "encode", "(", "'utf-8'", ")", "]", "=", "to_utf8_optional_iterator", "(", "v", ")", "# tell...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/oauth/__init__.py#L402-L411
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/distlib/resources.py
python
ZipResourceFinder.__init__
(self, module)
[]
def __init__(self, module): super(ZipResourceFinder, self).__init__(module) archive = self.loader.archive self.prefix_len = 1 + len(archive) # PyPy doesn't have a _files attr on zipimporter, and you can't set one if hasattr(self.loader, '_files'): self._files = self.l...
[ "def", "__init__", "(", "self", ",", "module", ")", ":", "super", "(", "ZipResourceFinder", ",", "self", ")", ".", "__init__", "(", "module", ")", "archive", "=", "self", ".", "loader", ".", "archive", "self", ".", "prefix_len", "=", "1", "+", "len", ...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/distlib/resources.py#L213-L222
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/smtplib.py
python
quotedata
(data)
return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data))
Quote data for email. Double leading '.', and change Unix newline '\\n', or Mac '\\r' into Internet CRLF end-of-line.
Quote data for email.
[ "Quote", "data", "for", "email", "." ]
def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\\n', or Mac '\\r' into Internet CRLF end-of-line. """ return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data))
[ "def", "quotedata", "(", "data", ")", ":", "return", "re", ".", "sub", "(", "r'(?m)^\\.'", ",", "'..'", ",", "re", ".", "sub", "(", "r'(?:\\r\\n|\\n|\\r(?!\\n))'", ",", "CRLF", ",", "data", ")", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/smtplib.py#L152-L159
thatbrguy/Pedestrian-Detection
b11c7d6bed0ff320811726fe1c429be26a87da9e
slim/nets/resnet_v1.py
python
resnet_v1
(inputs, blocks, num_classes=None, is_training=True, global_pool=True, output_stride=None, include_root_block=True, spatial_squeeze=True, reuse=None, scope=None)
Generator for v1 ResNet models. This function generates a family of ResNet v1 models. See the resnet_v1_*() methods for specific model instantiations, obtained by selecting different block instantiations that produce ResNets of various depths. Training for image classification on Imagenet is usually done with...
Generator for v1 ResNet models.
[ "Generator", "for", "v1", "ResNet", "models", "." ]
def resnet_v1(inputs, blocks, num_classes=None, is_training=True, global_pool=True, output_stride=None, include_root_block=True, spatial_squeeze=True, reuse=None, scope=None): """Generator for...
[ "def", "resnet_v1", "(", "inputs", ",", "blocks", ",", "num_classes", "=", "None", ",", "is_training", "=", "True", ",", "global_pool", "=", "True", ",", "output_stride", "=", "None", ",", "include_root_block", "=", "True", ",", "spatial_squeeze", "=", "True...
https://github.com/thatbrguy/Pedestrian-Detection/blob/b11c7d6bed0ff320811726fe1c429be26a87da9e/slim/nets/resnet_v1.py#L132-L233
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/plugins/console/widgets/shell.py
python
PythonShellWidget._key_pagedown
(self)
Action for PageDown key
Action for PageDown key
[ "Action", "for", "PageDown", "key" ]
def _key_pagedown(self): """Action for PageDown key""" pass
[ "def", "_key_pagedown", "(", "self", ")", ":", "pass" ]
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/console/widgets/shell.py#L805-L807
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
lib-python/2.7/plat-mac/EasyDialogs.py
python
AskPassword
(prompt, default='', id=264, ok=None, cancel=None)
Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only. Return the contents of the text entry field when the user clicks the OK button or presses Return. Return None when the user clicks the Cancel button. If omitted, DEFAULT is empty. Th...
Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only.
[ "Display", "a", "PROMPT", "string", "and", "a", "text", "entry", "field", "with", "a", "DEFAULT", "string", ".", "The", "string", "is", "displayed", "as", "bullets", "only", "." ]
def AskPassword(prompt, default='', id=264, ok=None, cancel=None): """Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only. Return the contents of the text entry field when the user clicks the OK button or presses Return. Return None when th...
[ "def", "AskPassword", "(", "prompt", ",", "default", "=", "''", ",", "id", "=", "264", ",", "ok", "=", "None", ",", "cancel", "=", "None", ")", ":", "_initialize", "(", ")", "_interact", "(", ")", "d", "=", "GetNewDialog", "(", "id", ",", "-", "1...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/plat-mac/EasyDialogs.py#L139-L181
kmike/pymorphy2
92d546f042ff14601376d3646242908d5ab786c1
pymorphy2/tagset.py
python
CyrillicOpencorporaTag._init_grammemes
(cls, dict_grammemes)
Initialize various class attributes with grammeme information obtained from XML dictionary.
Initialize various class attributes with grammeme information obtained from XML dictionary.
[ "Initialize", "various", "class", "attributes", "with", "grammeme", "information", "obtained", "from", "XML", "dictionary", "." ]
def _init_grammemes(cls, dict_grammemes): """ Initialize various class attributes with grammeme information obtained from XML dictionary. """ cls._init_alias_map(dict_grammemes) super(CyrillicOpencorporaTag, cls)._init_grammemes(dict_grammemes) GRAMMEME_INDICES =...
[ "def", "_init_grammemes", "(", "cls", ",", "dict_grammemes", ")", ":", "cls", ".", "_init_alias_map", "(", "dict_grammemes", ")", "super", "(", "CyrillicOpencorporaTag", ",", "cls", ")", ".", "_init_grammemes", "(", "dict_grammemes", ")", "GRAMMEME_INDICES", "=", ...
https://github.com/kmike/pymorphy2/blob/92d546f042ff14601376d3646242908d5ab786c1/pymorphy2/tagset.py#L550-L572
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/idlelib/ParenMatch.py
python
ParenMatch.activate_restore
(self)
[]
def activate_restore(self): if not self.is_restore_active: for seq in self.RESTORE_SEQUENCES: self.text.event_add(self.RESTORE_VIRTUAL_EVENT_NAME, seq) self.is_restore_active = True
[ "def", "activate_restore", "(", "self", ")", ":", "if", "not", "self", ".", "is_restore_active", ":", "for", "seq", "in", "self", ".", "RESTORE_SEQUENCES", ":", "self", ".", "text", ".", "event_add", "(", "self", ".", "RESTORE_VIRTUAL_EVENT_NAME", ",", "seq"...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/idlelib/ParenMatch.py#L71-L75
Teradata/stacki
a8085dce179dbe903f65f136f4b63bcc076cc057
common/src/stack/switch/pylib/switch/x1052.py
python
SwitchDellX1052.download
(self)
Download the running-config from the switch to the server. If downloading the config fails, a SwitchException is raised.
Download the running-config from the switch to the server.
[ "Download", "the", "running", "-", "config", "from", "the", "switch", "to", "the", "server", "." ]
def download(self): """Download the running-config from the switch to the server. If downloading the config fails, a SwitchException is raised. """ # # tftp requires the destination file to already exist and to be writable by all # filename = Path(self.tftpdir).resolve(strict = True) / self.current_confi...
[ "def", "download", "(", "self", ")", ":", "#", "# tftp requires the destination file to already exist and to be writable by all", "#", "filename", "=", "Path", "(", "self", ".", "tftpdir", ")", ".", "resolve", "(", "strict", "=", "True", ")", "/", "self", ".", "...
https://github.com/Teradata/stacki/blob/a8085dce179dbe903f65f136f4b63bcc076cc057/common/src/stack/switch/pylib/switch/x1052.py#L184-L202
stellargraph/stellargraph
3c2c8c18ab4c5c16660f350d8e23d7dc39e738de
stellargraph/layer/graphsage.py
python
AttentionalAggregator.calculate_group_sizes
(self, input_shape)
Calculates the output size for each input group. The results are stored in two variables: * self.included_weight_groups: if the corresponding entry is True then the input group is valid and should be used. * self.weight_sizes: the size of the output from this group. ...
Calculates the output size for each input group.
[ "Calculates", "the", "output", "size", "for", "each", "input", "group", "." ]
def calculate_group_sizes(self, input_shape): """ Calculates the output size for each input group. The results are stored in two variables: * self.included_weight_groups: if the corresponding entry is True then the input group is valid and should be used. *...
[ "def", "calculate_group_sizes", "(", "self", ",", "input_shape", ")", ":", "# If the neighbours are zero-dimensional for any of the shapes", "# in the input, do not use the input group in the model.", "# XXX Ignore batch size, since dim != 0 results in None!!", "self", ".", "included_weigh...
https://github.com/stellargraph/stellargraph/blob/3c2c8c18ab4c5c16660f350d8e23d7dc39e738de/stellargraph/layer/graphsage.py#L605-L649
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py
python
inject_into_urllib3
()
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.
[ "Monkey", "-", "patch", "urllib3", "with", "PyOpenSSL", "-", "backed", "SSL", "-", "support", "." ]
def inject_into_urllib3(): 'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.' connection.ssl_wrap_socket = ssl_wrap_socket util.HAS_SNI = HAS_SNI
[ "def", "inject_into_urllib3", "(", ")", ":", "connection", ".", "ssl_wrap_socket", "=", "ssl_wrap_socket", "util", ".", "HAS_SNI", "=", "HAS_SNI" ]
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py#L93-L97
flow-project/flow
a511c41c48e6b928bb2060de8ad1ef3c3e3d9554
flow/core/rewards.py
python
miles_per_gallon
(env, veh_ids=None, gain=.001)
return mpg * gain
Calculate mpg of either a particular vehicle or the total average of all the vehicles. Assumes vehicle is an average sized vehicle. The power calculated here is the lower bound of the actual power consumed by a vehicle. Parameters ---------- env : flow.envs.Env the environment variable...
Calculate mpg of either a particular vehicle or the total average of all the vehicles.
[ "Calculate", "mpg", "of", "either", "a", "particular", "vehicle", "or", "the", "total", "average", "of", "all", "the", "vehicles", "." ]
def miles_per_gallon(env, veh_ids=None, gain=.001): """Calculate mpg of either a particular vehicle or the total average of all the vehicles. Assumes vehicle is an average sized vehicle. The power calculated here is the lower bound of the actual power consumed by a vehicle. Parameters --------...
[ "def", "miles_per_gallon", "(", "env", ",", "veh_ids", "=", "None", ",", "gain", "=", ".001", ")", ":", "mpg", "=", "0", "counter", "=", "0", "if", "veh_ids", "is", "None", ":", "veh_ids", "=", "env", ".", "k", ".", "vehicle", ".", "get_ids", "(", ...
https://github.com/flow-project/flow/blob/a511c41c48e6b928bb2060de8ad1ef3c3e3d9554/flow/core/rewards.py#L402-L438
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/lnaddr.py
python
tagged_bytes
(char, l)
return tagged(char, bitstring.BitArray(l))
[]
def tagged_bytes(char, l): return tagged(char, bitstring.BitArray(l))
[ "def", "tagged_bytes", "(", "char", ",", "l", ")", ":", "return", "tagged", "(", "char", ",", "bitstring", ".", "BitArray", "(", "l", ")", ")" ]
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/lnaddr.py#L141-L142
OpenRCE/sulley
bff0dd1864d055eb4bfa8aacbbb6ecf215e4db4b
sulley/blocks.py
python
request.pop
(self)
The last open block was closed, so pop it off of the block stack.
The last open block was closed, so pop it off of the block stack.
[ "The", "last", "open", "block", "was", "closed", "so", "pop", "it", "off", "of", "the", "block", "stack", "." ]
def pop (self): ''' The last open block was closed, so pop it off of the block stack. ''' if not self.block_stack: raise sex.SullyRuntimeError("BLOCK STACK OUT OF SYNC") self.block_stack.pop()
[ "def", "pop", "(", "self", ")", ":", "if", "not", "self", ".", "block_stack", ":", "raise", "sex", ".", "SullyRuntimeError", "(", "\"BLOCK STACK OUT OF SYNC\"", ")", "self", ".", "block_stack", ".", "pop", "(", ")" ]
https://github.com/OpenRCE/sulley/blob/bff0dd1864d055eb4bfa8aacbbb6ecf215e4db4b/sulley/blocks.py#L71-L79
PowerScript/KatanaFramework
0f6ad90a88de865d58ec26941cb4460501e75496
lib/dnslib/build/lib.linux-i686-2.7/dnslib/dns.py
python
DNSRecord.__init__
(self,header=None,questions=None, rr=None,q=None,a=None,auth=None,ar=None)
Create new DNSRecord
Create new DNSRecord
[ "Create", "new", "DNSRecord" ]
def __init__(self,header=None,questions=None, rr=None,q=None,a=None,auth=None,ar=None): """ Create new DNSRecord """ self.header = header or DNSHeader() self.questions = questions or [] self.rr = rr or [] self.auth = auth or [] se...
[ "def", "__init__", "(", "self", ",", "header", "=", "None", ",", "questions", "=", "None", ",", "rr", "=", "None", ",", "q", "=", "None", ",", "a", "=", "None", ",", "auth", "=", "None", ",", "ar", "=", "None", ")", ":", "self", ".", "header", ...
https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/dnslib/build/lib.linux-i686-2.7/dnslib/dns.py#L141-L156
jazzband/django-model-utils
208e226c729267d424f595f9575248957fc1c28b
model_utils/tracker.py
python
FieldInstanceTracker.set_saved_fields
(self, fields=None)
[]
def set_saved_fields(self, fields=None): if not self.instance.pk: self.saved_data = {} elif fields is None: self.saved_data = self.current() else: self.saved_data.update(**self.current(fields=fields)) # preventing mutable fields side effects f...
[ "def", "set_saved_fields", "(", "self", ",", "fields", "=", "None", ")", ":", "if", "not", "self", ".", "instance", ".", "pk", ":", "self", ".", "saved_data", "=", "{", "}", "elif", "fields", "is", "None", ":", "self", ".", "saved_data", "=", "self",...
https://github.com/jazzband/django-model-utils/blob/208e226c729267d424f595f9575248957fc1c28b/model_utils/tracker.py#L210-L220
odlgroup/odl
0b088df8dc4621c68b9414c3deff9127f4c4f11d
odl/space/pspace.py
python
ProductSpaceElement.asarray
(self, out=None)
Extract the data of this vector as a numpy array. Only available if `is_power_space` is True. The ordering is such that it commutes with indexing:: self[ind].asarray() == self.asarray()[ind] Parameters ---------- out : `numpy.ndarray`, optional Array i...
Extract the data of this vector as a numpy array.
[ "Extract", "the", "data", "of", "this", "vector", "as", "a", "numpy", "array", "." ]
def asarray(self, out=None): """Extract the data of this vector as a numpy array. Only available if `is_power_space` is True. The ordering is such that it commutes with indexing:: self[ind].asarray() == self.asarray()[ind] Parameters ---------- out : `nump...
[ "def", "asarray", "(", "self", ",", "out", "=", "None", ")", ":", "if", "not", "self", ".", "space", ".", "is_power_space", ":", "raise", "ValueError", "(", "'cannot use `asarray` if `space.is_power_space` '", "'is `False`'", ")", "else", ":", "if", "out", "is...
https://github.com/odlgroup/odl/blob/0b088df8dc4621c68b9414c3deff9127f4c4f11d/odl/space/pspace.py#L1003-L1042
DataBiosphere/toil
2e148eee2114ece8dcc3ec8a83f36333266ece0d
src/toil/leader.py
python
Leader._startServiceJobs
(self)
Start any service jobs available from the service manager
Start any service jobs available from the service manager
[ "Start", "any", "service", "jobs", "available", "from", "the", "service", "manager" ]
def _startServiceJobs(self): """Start any service jobs available from the service manager""" self.issueQueingServiceJobs() while True: service_id = self.serviceManager.get_startable_service(0) # Stop trying to get jobs when function returns None if service_id ...
[ "def", "_startServiceJobs", "(", "self", ")", ":", "self", ".", "issueQueingServiceJobs", "(", ")", "while", "True", ":", "service_id", "=", "self", ".", "serviceManager", ".", "get_startable_service", "(", "0", ")", "# Stop trying to get jobs when function returns No...
https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/src/toil/leader.py#L609-L619
p/redis-dump-load
d5affcb9c140e55da738de4f18b360282fb0f9e0
redisdl.py
python
HashReader.send_command
(p, key)
[]
def send_command(p, key): p.hgetall(key)
[ "def", "send_command", "(", "p", ",", "key", ")", ":", "p", ".", "hgetall", "(", "key", ")" ]
https://github.com/p/redis-dump-load/blob/d5affcb9c140e55da738de4f18b360282fb0f9e0/redisdl.py#L239-L240