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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pybrain/pybrain | dcdf32ba1805490cefbc0bdeb227260d304fdb42 | pybrain/rl/learners/valuebased/interface.py | python | ActionValueNetwork._forwardImplementation | (self, inbuf, outbuf) | takes the state vector and return the discrete action with
the maximum value over all actions for this state. | takes the state vector and return the discrete action with
the maximum value over all actions for this state. | [
"takes",
"the",
"state",
"vector",
"and",
"return",
"the",
"discrete",
"action",
"with",
"the",
"maximum",
"value",
"over",
"all",
"actions",
"for",
"this",
"state",
"."
] | def _forwardImplementation(self, inbuf, outbuf):
""" takes the state vector and return the discrete action with
the maximum value over all actions for this state.
"""
outbuf[0] = self.getMaxAction(asarray(inbuf)) | [
"def",
"_forwardImplementation",
"(",
"self",
",",
"inbuf",
",",
"outbuf",
")",
":",
"outbuf",
"[",
"0",
"]",
"=",
"self",
".",
"getMaxAction",
"(",
"asarray",
"(",
"inbuf",
")",
")"
] | https://github.com/pybrain/pybrain/blob/dcdf32ba1805490cefbc0bdeb227260d304fdb42/pybrain/rl/learners/valuebased/interface.py#L78-L82 | ||
akaraspt/deepsleepnet | d4906b4875547a45175eaba8bdde280b7b1496f1 | tensorlayer/prepro.py | python | threading_data | (data=None, fn=None, **kwargs) | return np.asarray(results) | Return a batch of result by given data.
Usually be used for data augmentation.
Parameters
-----------
data : numpy array or zip of numpy array, see Examples below.
fn : the function for data processing.
more args : the args for fn, see Examples below.
Examples
--------
- Single arr... | Return a batch of result by given data.
Usually be used for data augmentation. | [
"Return",
"a",
"batch",
"of",
"result",
"by",
"given",
"data",
".",
"Usually",
"be",
"used",
"for",
"data",
"augmentation",
"."
] | def threading_data(data=None, fn=None, **kwargs):
"""Return a batch of result by given data.
Usually be used for data augmentation.
Parameters
-----------
data : numpy array or zip of numpy array, see Examples below.
fn : the function for data processing.
more args : the args for fn, see Ex... | [
"def",
"threading_data",
"(",
"data",
"=",
"None",
",",
"fn",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"## plot function info",
"# for name, value in kwargs.items():",
"# print('{0} = {1}'.format(name, value))",
"# exit()",
"# define function for threading",
"def... | https://github.com/akaraspt/deepsleepnet/blob/d4906b4875547a45175eaba8bdde280b7b1496f1/tensorlayer/prepro.py#L37-L105 | |
vyos/vyos-1x | 6e8a8934a7d4e1b21d7c828e372303683b499b56 | python/vyos/configverify.py | python | verify_interface_exists | (ifname) | Common helper function used by interface implementations to perform
recurring validation if an interface actually exists. | Common helper function used by interface implementations to perform
recurring validation if an interface actually exists. | [
"Common",
"helper",
"function",
"used",
"by",
"interface",
"implementations",
"to",
"perform",
"recurring",
"validation",
"if",
"an",
"interface",
"actually",
"exists",
"."
] | def verify_interface_exists(ifname):
"""
Common helper function used by interface implementations to perform
recurring validation if an interface actually exists.
"""
import os
if not os.path.exists(f'/sys/class/net/{ifname}'):
raise ConfigError(f'Interface "{ifname}" does not exist!') | [
"def",
"verify_interface_exists",
"(",
"ifname",
")",
":",
"import",
"os",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"f'/sys/class/net/{ifname}'",
")",
":",
"raise",
"ConfigError",
"(",
"f'Interface \"{ifname}\" does not exist!'",
")"
] | https://github.com/vyos/vyos-1x/blob/6e8a8934a7d4e1b21d7c828e372303683b499b56/python/vyos/configverify.py#L231-L238 | ||
dciabrin/ngdevkit | 6d50d4f29c7f8f0ccca05d2bfe53ba2036d32ccf | tools/tiletool.py | python | converter.validate_extract | (self) | Common input checks for extract command | Common input checks for extract command | [
"Common",
"input",
"checks",
"for",
"extract",
"command"
] | def validate_extract(self):
"""Common input checks for extract command"""
if self.args.output:
if len(self.args.output) != 1:
sys.exit("error: expected one image file, given: %s" %
" ".join(self.args.output))
self.out = self.args.output[0]... | [
"def",
"validate_extract",
"(",
"self",
")",
":",
"if",
"self",
".",
"args",
".",
"output",
":",
"if",
"len",
"(",
"self",
".",
"args",
".",
"output",
")",
"!=",
"1",
":",
"sys",
".",
"exit",
"(",
"\"error: expected one image file, given: %s\"",
"%",
"\"... | https://github.com/dciabrin/ngdevkit/blob/6d50d4f29c7f8f0ccca05d2bfe53ba2036d32ccf/tools/tiletool.py#L69-L81 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/pymongo/master_slave_connection.py | python | MasterSlaveConnection.database_names | (self) | return self.__master.database_names() | Get a list of all database names. | Get a list of all database names. | [
"Get",
"a",
"list",
"of",
"all",
"database",
"names",
"."
] | def database_names(self):
"""Get a list of all database names.
"""
return self.__master.database_names() | [
"def",
"database_names",
"(",
"self",
")",
":",
"return",
"self",
".",
"__master",
".",
"database_names",
"(",
")"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/pymongo/master_slave_connection.py#L278-L281 | |
Qirky/Troop | 529c5eb14e456f683e6d23fd4adcddc8446aa115 | src/interface/textbox.py | python | ThreadSafeText.get_redo_operation | (self) | return self.redo_stack.pop() | Gets the last operation from the undo stack | Gets the last operation from the undo stack | [
"Gets",
"the",
"last",
"operation",
"from",
"the",
"undo",
"stack"
] | def get_redo_operation(self):
""" Gets the last operation from the undo stack """
return self.redo_stack.pop() | [
"def",
"get_redo_operation",
"(",
"self",
")",
":",
"return",
"self",
".",
"redo_stack",
".",
"pop",
"(",
")"
] | https://github.com/Qirky/Troop/blob/529c5eb14e456f683e6d23fd4adcddc8446aa115/src/interface/textbox.py#L253-L255 | |
rll/rllab | ba78e4c16dc492982e648f117875b22af3965579 | rllab/misc/tabulate.py | python | _pipe_line_with_colons | (colwidths, colaligns) | return "|" + "|".join(segments) + "|" | Return a horizontal line with optional colons to indicate column's
alignment (as in `pipe` output format). | Return a horizontal line with optional colons to indicate column's
alignment (as in `pipe` output format). | [
"Return",
"a",
"horizontal",
"line",
"with",
"optional",
"colons",
"to",
"indicate",
"column",
"s",
"alignment",
"(",
"as",
"in",
"pipe",
"output",
"format",
")",
"."
] | def _pipe_line_with_colons(colwidths, colaligns):
"""Return a horizontal line with optional colons to indicate column's
alignment (as in `pipe` output format)."""
segments = [_pipe_segment_with_colons(a, w) for a, w in zip(colaligns, colwidths)]
return "|" + "|".join(segments) + "|" | [
"def",
"_pipe_line_with_colons",
"(",
"colwidths",
",",
"colaligns",
")",
":",
"segments",
"=",
"[",
"_pipe_segment_with_colons",
"(",
"a",
",",
"w",
")",
"for",
"a",
",",
"w",
"in",
"zip",
"(",
"colaligns",
",",
"colwidths",
")",
"]",
"return",
"\"|\"",
... | https://github.com/rll/rllab/blob/ba78e4c16dc492982e648f117875b22af3965579/rllab/misc/tabulate.py#L92-L96 | |
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | archive/fabfile.py | python | setup_pgbouncer | () | [] | def setup_pgbouncer():
sudo('apt-get remove -y pgbouncer')
sudo('apt-get install -y libevent-dev pkg-config libc-ares2 libc-ares-dev')
PGBOUNCER_VERSION = '1.15.0'
with cd(env.VENDOR_PATH), settings(warn_only=True):
run('wget https://pgbouncer.github.io/downloads/files/%s/pgbouncer-%s.tar.gz' % ... | [
"def",
"setup_pgbouncer",
"(",
")",
":",
"sudo",
"(",
"'apt-get remove -y pgbouncer'",
")",
"sudo",
"(",
"'apt-get install -y libevent-dev pkg-config libc-ares2 libc-ares-dev'",
")",
"PGBOUNCER_VERSION",
"=",
"'1.15.0'",
"with",
"cd",
"(",
"env",
".",
"VENDOR_PATH",
")",
... | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/archive/fabfile.py#L584-L597 | ||||
spulec/moto | a688c0032596a7dfef122b69a08f2bec3be2e481 | moto/applicationautoscaling/responses.py | python | ApplicationAutoScalingResponse.deregister_scalable_target | (self) | return json.dumps({}) | Deregisters a scalable target. | Deregisters a scalable target. | [
"Deregisters",
"a",
"scalable",
"target",
"."
] | def deregister_scalable_target(self):
"""Deregisters a scalable target."""
self._validate_params()
self.applicationautoscaling_backend.deregister_scalable_target(
self._get_param("ServiceNamespace"),
self._get_param("ResourceId"),
self._get_param("ScalableDime... | [
"def",
"deregister_scalable_target",
"(",
"self",
")",
":",
"self",
".",
"_validate_params",
"(",
")",
"self",
".",
"applicationautoscaling_backend",
".",
"deregister_scalable_target",
"(",
"self",
".",
"_get_param",
"(",
"\"ServiceNamespace\"",
")",
",",
"self",
".... | https://github.com/spulec/moto/blob/a688c0032596a7dfef122b69a08f2bec3be2e481/moto/applicationautoscaling/responses.py#L48-L56 | |
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/tools/adaptive_thread_pool.py | python | ThreadGate.StartWork | (self) | Starts a critical section in which the number of workers is limited.
Starts a critical section which allows self.__enabled_count
simultaneously operating threads. The critical section is ended by
calling self.FinishWork(). | Starts a critical section in which the number of workers is limited. | [
"Starts",
"a",
"critical",
"section",
"in",
"which",
"the",
"number",
"of",
"workers",
"is",
"limited",
"."
] | def StartWork(self):
"""Starts a critical section in which the number of workers is limited.
Starts a critical section which allows self.__enabled_count
simultaneously operating threads. The critical section is ended by
calling self.FinishWork().
"""
self.__thread_semaphore.acquire()
if s... | [
"def",
"StartWork",
"(",
"self",
")",
":",
"self",
".",
"__thread_semaphore",
".",
"acquire",
"(",
")",
"if",
"self",
".",
"__backoff_time",
">",
"0.0",
":",
"if",
"not",
"threading",
".",
"currentThread",
"(",
")",
".",
"exit_flag",
":",
"logger",
".",
... | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/tools/adaptive_thread_pool.py#L411-L426 | ||
tooxie/shiva-server | 4d169aae8d4cb01133f62701b14610695e48c297 | shiva/http.py | python | Resource.__new__ | (cls, *args, **kwargs) | return super(Resource, cls).__new__(cls, *args, **kwargs) | [] | def __new__(cls, *args, **kwargs):
cls.method_decorators.append(allow_method)
if app.config.get('CORS_ENABLED') is True:
# Applies to all inherited resources
cls.method_decorators.append(allow_origins)
return super(Resource, cls).__new__(cls, *args, **kwargs) | [
"def",
"__new__",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"cls",
".",
"method_decorators",
".",
"append",
"(",
"allow_method",
")",
"if",
"app",
".",
"config",
".",
"get",
"(",
"'CORS_ENABLED'",
")",
"is",
"True",
":",
"# App... | https://github.com/tooxie/shiva-server/blob/4d169aae8d4cb01133f62701b14610695e48c297/shiva/http.py#L45-L52 | |||
openstack/neutron | fb229fb527ac8b95526412f7762d90826ac41428 | neutron/services/logapi/agent/log_extension.py | python | LoggingDriver.start_logging | (self, context, **kwargs) | Enable logging
:param context: rpc context
:param kwargs: log_resources data or port_id | Enable logging | [
"Enable",
"logging"
] | def start_logging(self, context, **kwargs):
"""Enable logging
:param context: rpc context
:param kwargs: log_resources data or port_id
""" | [
"def",
"start_logging",
"(",
"self",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":"
] | https://github.com/openstack/neutron/blob/fb229fb527ac8b95526412f7762d90826ac41428/neutron/services/logapi/agent/log_extension.py#L48-L53 | ||
rossant/smopy | 1fb75e0b74e0582116b7869c92caa0319de7a555 | smopy.py | python | fetch_tile | (x, y, z, tileserver) | return img | Fetch tile (x, y) at zoom level z from OpenStreetMap's servers.
Return a PIL image. | Fetch tile (x, y) at zoom level z from OpenStreetMap's servers. | [
"Fetch",
"tile",
"(",
"x",
"y",
")",
"at",
"zoom",
"level",
"z",
"from",
"OpenStreetMap",
"s",
"servers",
"."
] | def fetch_tile(x, y, z, tileserver):
"""Fetch tile (x, y) at zoom level z from OpenStreetMap's servers.
Return a PIL image.
"""
url = get_url(x, y, z, tileserver)
req = Request(url, data=None, headers={'User-Agent': 'smopy'})
png = BytesIO(urlopen(req).read())
img = Image.open(png)
im... | [
"def",
"fetch_tile",
"(",
"x",
",",
"y",
",",
"z",
",",
"tileserver",
")",
":",
"url",
"=",
"get_url",
"(",
"x",
",",
"y",
",",
"z",
",",
"tileserver",
")",
"req",
"=",
"Request",
"(",
"url",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"{",
... | https://github.com/rossant/smopy/blob/1fb75e0b74e0582116b7869c92caa0319de7a555/smopy.py#L35-L47 | |
O365/python-o365 | 7f77005c3cee8177d0141e79b8eda8a7b60c5124 | O365/account.py | python | Account.address_book | (self, *, resource=None, address_book='personal') | Get an instance to the specified address book for the
specified account resource
:param str resource: Custom resource to be used in this address book
(Defaults to parent main_resource)
:param str address_book: Choose from 'Personal' or 'Directory'
:return: a representation of t... | Get an instance to the specified address book for the
specified account resource | [
"Get",
"an",
"instance",
"to",
"the",
"specified",
"address",
"book",
"for",
"the",
"specified",
"account",
"resource"
] | def address_book(self, *, resource=None, address_book='personal'):
""" Get an instance to the specified address book for the
specified account resource
:param str resource: Custom resource to be used in this address book
(Defaults to parent main_resource)
:param str address_boo... | [
"def",
"address_book",
"(",
"self",
",",
"*",
",",
"resource",
"=",
"None",
",",
"address_book",
"=",
"'personal'",
")",
":",
"if",
"address_book",
".",
"lower",
"(",
")",
"==",
"'personal'",
":",
"from",
".",
"address_book",
"import",
"AddressBook",
"retu... | https://github.com/O365/python-o365/blob/7f77005c3cee8177d0141e79b8eda8a7b60c5124/O365/account.py#L153-L177 | ||
biolab/orange2 | db40a9449cb45b507d63dcd5739b223f9cffb8e6 | Orange/OrangeWidgets/OWConcurrent.py | python | FutureWatcher._stateChanged | (self, future, state) | The `future` state has changed (called by :class:`Future`). | The `future` state has changed (called by :class:`Future`). | [
"The",
"future",
"state",
"has",
"changed",
"(",
"called",
"by",
":",
"class",
":",
"Future",
")",
"."
] | def _stateChanged(self, future, state):
"""
The `future` state has changed (called by :class:`Future`).
"""
ev = StateChangedEvent(state)
if self.thread() is QThread.currentThread():
QCoreApplication.sendEvent(self, ev)
else:
QCoreApplication.post... | [
"def",
"_stateChanged",
"(",
"self",
",",
"future",
",",
"state",
")",
":",
"ev",
"=",
"StateChangedEvent",
"(",
"state",
")",
"if",
"self",
".",
"thread",
"(",
")",
"is",
"QThread",
".",
"currentThread",
"(",
")",
":",
"QCoreApplication",
".",
"sendEven... | https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/Orange/OrangeWidgets/OWConcurrent.py#L611-L620 | ||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/geometry/plane.py | python | Plane.projection_line | (self, line) | Project the given line onto the plane through the normal plane
containing the line.
Parameters
==========
LinearEntity or LinearEntity3D
Returns
=======
Point3D, Line3D, Ray3D or Segment3D
Notes
=====
For the interaction between 2D an... | Project the given line onto the plane through the normal plane
containing the line. | [
"Project",
"the",
"given",
"line",
"onto",
"the",
"plane",
"through",
"the",
"normal",
"plane",
"containing",
"the",
"line",
"."
] | def projection_line(self, line):
"""Project the given line onto the plane through the normal plane
containing the line.
Parameters
==========
LinearEntity or LinearEntity3D
Returns
=======
Point3D, Line3D, Ray3D or Segment3D
Notes
====... | [
"def",
"projection_line",
"(",
"self",
",",
"line",
")",
":",
"if",
"not",
"isinstance",
"(",
"line",
",",
"(",
"LinearEntity",
",",
"LinearEntity3D",
")",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Enter a linear entity only'",
")",
"a",
",",
"b",
"="... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/geometry/plane.py#L703-L752 | ||
openid/python-openid | afa6adacbe1a41d8f614c8bce2264dfbe9e76489 | openid/yadis/discover.py | python | DiscoveryResult.isXRDS | (self) | return (self.usedYadisLocation() or self.content_type == YADIS_CONTENT_TYPE) | Is the response text supposed to be an XRDS document? | Is the response text supposed to be an XRDS document? | [
"Is",
"the",
"response",
"text",
"supposed",
"to",
"be",
"an",
"XRDS",
"document?"
] | def isXRDS(self):
"""Is the response text supposed to be an XRDS document?"""
return (self.usedYadisLocation() or self.content_type == YADIS_CONTENT_TYPE) | [
"def",
"isXRDS",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"usedYadisLocation",
"(",
")",
"or",
"self",
".",
"content_type",
"==",
"YADIS_CONTENT_TYPE",
")"
] | https://github.com/openid/python-openid/blob/afa6adacbe1a41d8f614c8bce2264dfbe9e76489/openid/yadis/discover.py#L53-L55 | |
lebedov/scikit-cuda | 5d3c74f926fe7ce67ecfc85e9623aab7bc0b344f | skcuda/linalg.py | python | dot_diag | (d_gpu, a_gpu, trans='N', overwrite=False, handle=None) | return r_gpu | Dot product of diagonal and non-diagonal arrays.
Computes the matrix product of a diagonal array represented as a
vector and a non-diagonal array.
Parameters
----------
d_gpu : pycuda.gpuarray.GPUArray
Array of length `N` corresponding to the diagonal of the
multiplier.
a_gpu :... | Dot product of diagonal and non-diagonal arrays. | [
"Dot",
"product",
"of",
"diagonal",
"and",
"non",
"-",
"diagonal",
"arrays",
"."
] | def dot_diag(d_gpu, a_gpu, trans='N', overwrite=False, handle=None):
"""
Dot product of diagonal and non-diagonal arrays.
Computes the matrix product of a diagonal array represented as a
vector and a non-diagonal array.
Parameters
----------
d_gpu : pycuda.gpuarray.GPUArray
Array o... | [
"def",
"dot_diag",
"(",
"d_gpu",
",",
"a_gpu",
",",
"trans",
"=",
"'N'",
",",
"overwrite",
"=",
"False",
",",
"handle",
"=",
"None",
")",
":",
"if",
"handle",
"is",
"None",
":",
"handle",
"=",
"misc",
".",
"_global_cublas_handle",
"if",
"not",
"(",
"... | https://github.com/lebedov/scikit-cuda/blob/5d3c74f926fe7ce67ecfc85e9623aab7bc0b344f/skcuda/linalg.py#L1160-L1253 | |
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/plistlib.py | python | readPlist | (pathOrFile) | return rootObject | Read a .plist file. 'pathOrFile' may either be a file name or a
(readable) file object. Return the unpacked root object (which
usually is a dictionary). | Read a .plist file. 'pathOrFile' may either be a file name or a
(readable) file object. Return the unpacked root object (which
usually is a dictionary). | [
"Read",
"a",
".",
"plist",
"file",
".",
"pathOrFile",
"may",
"either",
"be",
"a",
"file",
"name",
"or",
"a",
"(",
"readable",
")",
"file",
"object",
".",
"Return",
"the",
"unpacked",
"root",
"object",
"(",
"which",
"usually",
"is",
"a",
"dictionary",
"... | def readPlist(pathOrFile):
"""Read a .plist file. 'pathOrFile' may either be a file name or a
(readable) file object. Return the unpacked root object (which
usually is a dictionary).
"""
didOpen = 0
if isinstance(pathOrFile, (str, unicode)):
pathOrFile = open(pathOrFile)
didOpen ... | [
"def",
"readPlist",
"(",
"pathOrFile",
")",
":",
"didOpen",
"=",
"0",
"if",
"isinstance",
"(",
"pathOrFile",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"pathOrFile",
"=",
"open",
"(",
"pathOrFile",
")",
"didOpen",
"=",
"1",
"p",
"=",
"PlistParser"... | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/plistlib.py#L67-L80 | |
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/smtlib/printers.py | python | SmtDagPrinter.walk_bool_constant | (self, formula, **kwargs) | [] | def walk_bool_constant(self, formula, **kwargs):
if formula.constant_value():
return "true"
else:
return "false" | [
"def",
"walk_bool_constant",
"(",
"self",
",",
"formula",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"formula",
".",
"constant_value",
"(",
")",
":",
"return",
"\"true\"",
"else",
":",
"return",
"\"false\""
] | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/smtlib/printers.py#L478-L482 | ||||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/models/promp/promp.py | python | ProMP.output_dims | (self) | return 2 * self.D | Return the output dimension of the model | Return the output dimension of the model | [
"Return",
"the",
"output",
"dimension",
"of",
"the",
"model"
] | def output_dims(self):
"""Return the output dimension of the model"""
return 2 * self.D | [
"def",
"output_dims",
"(",
"self",
")",
":",
"return",
"2",
"*",
"self",
".",
"D"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/models/promp/promp.py#L286-L288 | |
lukalabs/cakechat | 844507281b30d81b3fe3674895fe27826dba8438 | cakechat/dialog_model/model.py | python | CakeChatModel.get_thought_vectors | (self, context_tokens_ids) | return self._models['context_encoder'].predict(context_tokens_ids) | :param context_tokens_ids, shape == (batch_size, context_size, seq_len), int32
:return: context_encoding, shape == (batch_size, hidden_layer_dim), float32 | :param context_tokens_ids, shape == (batch_size, context_size, seq_len), int32
:return: context_encoding, shape == (batch_size, hidden_layer_dim), float32 | [
":",
"param",
"context_tokens_ids",
"shape",
"==",
"(",
"batch_size",
"context_size",
"seq_len",
")",
"int32",
":",
"return",
":",
"context_encoding",
"shape",
"==",
"(",
"batch_size",
"hidden_layer_dim",
")",
"float32"
] | def get_thought_vectors(self, context_tokens_ids):
"""
:param context_tokens_ids, shape == (batch_size, context_size, seq_len), int32
:return: context_encoding, shape == (batch_size, hidden_layer_dim), float32
"""
return self._models['context_encoder'].predict(context_tokens_... | [
"def",
"get_thought_vectors",
"(",
"self",
",",
"context_tokens_ids",
")",
":",
"return",
"self",
".",
"_models",
"[",
"'context_encoder'",
"]",
".",
"predict",
"(",
"context_tokens_ids",
")"
] | https://github.com/lukalabs/cakechat/blob/844507281b30d81b3fe3674895fe27826dba8438/cakechat/dialog_model/model.py#L524-L529 | |
dipy/dipy | be956a529465b28085f8fc435a756947ddee1c89 | dipy/reconst/qtdmri.py | python | angular_basis_opt | (l, m, q, theta, phi) | return const | Angular basis independent of spatial scaling factor us. Though it
includes q, it is independent of the data and can be precomputed. | Angular basis independent of spatial scaling factor us. Though it
includes q, it is independent of the data and can be precomputed. | [
"Angular",
"basis",
"independent",
"of",
"spatial",
"scaling",
"factor",
"us",
".",
"Though",
"it",
"includes",
"q",
"it",
"is",
"independent",
"of",
"the",
"data",
"and",
"can",
"be",
"precomputed",
"."
] | def angular_basis_opt(l, m, q, theta, phi):
""" Angular basis independent of spatial scaling factor us. Though it
includes q, it is independent of the data and can be precomputed.
"""
const = (
(-1) ** (l / 2) * np.sqrt(4.0 * np.pi) *
(2 * np.pi ** 2 * q ** 2) ** (l / 2) *
real_s... | [
"def",
"angular_basis_opt",
"(",
"l",
",",
"m",
",",
"q",
",",
"theta",
",",
"phi",
")",
":",
"const",
"=",
"(",
"(",
"-",
"1",
")",
"**",
"(",
"l",
"/",
"2",
")",
"*",
"np",
".",
"sqrt",
"(",
"4.0",
"*",
"np",
".",
"pi",
")",
"*",
"(",
... | https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/reconst/qtdmri.py#L1423-L1432 | |
KhronosGroup/NNEF-Tools | c913758ca687dab8cb7b49e8f1556819a2d0ca25 | nnef_tools/conversion/nnef_to_tf.py | python | Converter.__init__ | (self, data_format='NXC', io_transpose=False, custom_transforms=None, custom_functions=None,
mirror_unsupported=False) | [] | def __init__(self, data_format='NXC', io_transpose=False, custom_transforms=None, custom_functions=None,
mirror_unsupported=False):
_Converter.__init__(self, transforms=self.merge_transforms(_Transforms, custom_transforms),
functions=custom_functions, mirror_unsuppor... | [
"def",
"__init__",
"(",
"self",
",",
"data_format",
"=",
"'NXC'",
",",
"io_transpose",
"=",
"False",
",",
"custom_transforms",
"=",
"None",
",",
"custom_functions",
"=",
"None",
",",
"mirror_unsupported",
"=",
"False",
")",
":",
"_Converter",
".",
"__init__",
... | https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/conversion/nnef_to_tf.py#L36-L41 | ||||
JusticeRage/FFM | 2afb61a37322fa216bd45400ec59479cfa2ea3d7 | model/driver/input.py | python | DefaultInputDriver.delete_word | (self) | Handles the ^W character.
:return: | Handles the ^W character.
:return: | [
"Handles",
"the",
"^W",
"character",
".",
":",
"return",
":"
] | def delete_word(self):
"""
Handles the ^W character.
:return:
"""
if self.cursor_position == len(self.input_buffer):
return
while self.cursor_position - 1 < len(self.input_buffer) and self.input_buffer[-self.cursor_position - 1] == " ":
self.backsp... | [
"def",
"delete_word",
"(",
"self",
")",
":",
"if",
"self",
".",
"cursor_position",
"==",
"len",
"(",
"self",
".",
"input_buffer",
")",
":",
"return",
"while",
"self",
".",
"cursor_position",
"-",
"1",
"<",
"len",
"(",
"self",
".",
"input_buffer",
")",
... | https://github.com/JusticeRage/FFM/blob/2afb61a37322fa216bd45400ec59479cfa2ea3d7/model/driver/input.py#L195-L215 | ||
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/sparse/linalg/_expm_multiply.py | python | _expm_multiply_simple_core | (A, B, t, mu, m_star, s, tol=None, balance=False) | return F | A helper function. | A helper function. | [
"A",
"helper",
"function",
"."
] | def _expm_multiply_simple_core(A, B, t, mu, m_star, s, tol=None, balance=False):
"""
A helper function.
"""
if balance:
raise NotImplementedError
if tol is None:
u_d = 2 ** -53
tol = u_d
F = B
eta = np.exp(t*mu / float(s))
for i in range(s):
c1 = _exact_in... | [
"def",
"_expm_multiply_simple_core",
"(",
"A",
",",
"B",
",",
"t",
",",
"mu",
",",
"m_star",
",",
"s",
",",
"tol",
"=",
"None",
",",
"balance",
"=",
"False",
")",
":",
"if",
"balance",
":",
"raise",
"NotImplementedError",
"if",
"tol",
"is",
"None",
"... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/sparse/linalg/_expm_multiply.py#L197-L220 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/six.py | python | MovedModule.__init__ | (self, name, old, new=None) | [] | def __init__(self, name, old, new=None):
super(MovedModule, self).__init__(name)
if PY3:
if new is None:
new = name
self.mod = new
else:
self.mod = old | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"old",
",",
"new",
"=",
"None",
")",
":",
"super",
"(",
"MovedModule",
",",
"self",
")",
".",
"__init__",
"(",
"name",
")",
"if",
"PY3",
":",
"if",
"new",
"is",
"None",
":",
"new",
"=",
"name",
... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/six.py#L105-L112 | ||||
deepmind/dm_control | 806a10e896e7c887635328bfa8352604ad0fedae | dm_control/locomotion/tasks/go_to_target.py | python | GoToTarget.initialize_episode | (self, physics, random_state) | [] | def initialize_episode(self, physics, random_state):
self._walker.reinitialize_pose(physics, random_state)
if self._walker_spawn_rotation:
rotation = variation.evaluate(
self._walker_spawn_rotation, random_state=random_state)
quat = [np.cos(rotation / 2), 0, 0, np.sin(rotation / 2)]
el... | [
"def",
"initialize_episode",
"(",
"self",
",",
"physics",
",",
"random_state",
")",
":",
"self",
".",
"_walker",
".",
"reinitialize_pose",
"(",
"physics",
",",
"random_state",
")",
"if",
"self",
".",
"_walker_spawn_rotation",
":",
"rotation",
"=",
"variation",
... | https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/locomotion/tasks/go_to_target.py#L139-L164 | ||||
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/matplotlib/backends/backend_wx.py | python | _FigureCanvasWxBase._set_capture | (self, capture=True) | Control wx mouse capture. | Control wx mouse capture. | [
"Control",
"wx",
"mouse",
"capture",
"."
] | def _set_capture(self, capture=True):
"""Control wx mouse capture."""
if self.HasCapture():
self.ReleaseMouse()
if capture:
self.CaptureMouse() | [
"def",
"_set_capture",
"(",
"self",
",",
"capture",
"=",
"True",
")",
":",
"if",
"self",
".",
"HasCapture",
"(",
")",
":",
"self",
".",
"ReleaseMouse",
"(",
")",
"if",
"capture",
":",
"self",
".",
"CaptureMouse",
"(",
")"
] | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/backends/backend_wx.py#L756-L761 | ||
ucbdrive/few-shot-object-detection | 148a039af7abce9eff59d5cdece296ad1d2b8aa0 | fsdet/evaluation/coco_evaluation.py | python | _evaluate_predictions_on_coco | (
coco_gt, coco_results, iou_type, catIds=None
) | return coco_eval | Evaluate the coco results using COCOEval API. | Evaluate the coco results using COCOEval API. | [
"Evaluate",
"the",
"coco",
"results",
"using",
"COCOEval",
"API",
"."
] | def _evaluate_predictions_on_coco(
coco_gt, coco_results, iou_type, catIds=None
):
"""
Evaluate the coco results using COCOEval API.
"""
assert len(coco_results) > 0
coco_dt = coco_gt.loadRes(coco_results)
coco_eval = COCOeval(coco_gt, coco_dt, iou_type)
if catIds is not None:
c... | [
"def",
"_evaluate_predictions_on_coco",
"(",
"coco_gt",
",",
"coco_results",
",",
"iou_type",
",",
"catIds",
"=",
"None",
")",
":",
"assert",
"len",
"(",
"coco_results",
")",
">",
"0",
"coco_dt",
"=",
"coco_gt",
".",
"loadRes",
"(",
"coco_results",
")",
"coc... | https://github.com/ucbdrive/few-shot-object-detection/blob/148a039af7abce9eff59d5cdece296ad1d2b8aa0/fsdet/evaluation/coco_evaluation.py#L338-L354 | |
crossbario/crossbar | ed350b7ba1c8421f3640b9c2e94a21ed4cfdff64 | crossbar/master/node/user.py | python | UserManager.modify_user | (self, user_id, user_delta, details=None) | Modify an existing user.
:procedure: ``crossbarfabriccenter.user.modify_user``
:event: ``crossbarfabriccenter.user.on_user_modified``
:error: ``crossbar.error.no_such_object``
:param user_id: The user object to modify.
:type user_id: str
:param user_delta: The modifica... | Modify an existing user. | [
"Modify",
"an",
"existing",
"user",
"."
] | async def modify_user(self, user_id, user_delta, details=None):
"""
Modify an existing user.
:procedure: ``crossbarfabriccenter.user.modify_user``
:event: ``crossbarfabriccenter.user.on_user_modified``
:error: ``crossbar.error.no_such_object``
:param user_id: The user o... | [
"async",
"def",
"modify_user",
"(",
"self",
",",
"user_id",
",",
"user_delta",
",",
"details",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/crossbario/crossbar/blob/ed350b7ba1c8421f3640b9c2e94a21ed4cfdff64/crossbar/master/node/user.py#L277-L298 | ||
GNOME/gnome-music | b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e | gnomemusic/utils.py | python | seconds_to_string | (duration) | return '{:d}∶{:02d}'.format(minutes, seconds) | Convert a time in seconds to a mm:ss string
:param int duration: Time in seconds
:return: Time in mm:ss format
:rtype: str | Convert a time in seconds to a mm:ss string | [
"Convert",
"a",
"time",
"in",
"seconds",
"to",
"a",
"mm",
":",
"ss",
"string"
] | def seconds_to_string(duration):
"""Convert a time in seconds to a mm:ss string
:param int duration: Time in seconds
:return: Time in mm:ss format
:rtype: str
"""
seconds = duration
minutes = seconds // 60
seconds %= 60
return '{:d}∶{:02d}'.format(minutes, seconds) | [
"def",
"seconds_to_string",
"(",
"duration",
")",
":",
"seconds",
"=",
"duration",
"minutes",
"=",
"seconds",
"//",
"60",
"seconds",
"%=",
"60",
"return",
"'{:d}∶{:02d}'.f",
"o",
"rmat(m",
"i",
"nutes, ",
"s",
"conds)",
""
] | https://github.com/GNOME/gnome-music/blob/b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e/gnomemusic/utils.py#L152-L163 | |
eyounx/ZOOpt | 49c750daf842639ee6407848a867091689571810 | zoopt/algos/opt_algorithms/racos/racos_common.py | python | RacosCommon.extend | (seta, setb) | return result | Concatenate two list. | Concatenate two list. | [
"Concatenate",
"two",
"list",
"."
] | def extend(seta, setb):
"""
Concatenate two list.
"""
result = copy.deepcopy(seta)
for x in setb:
result.append(copy.deepcopy(x))
return result | [
"def",
"extend",
"(",
"seta",
",",
"setb",
")",
":",
"result",
"=",
"copy",
".",
"deepcopy",
"(",
"seta",
")",
"for",
"x",
"in",
"setb",
":",
"result",
".",
"append",
"(",
"copy",
".",
"deepcopy",
"(",
"x",
")",
")",
"return",
"result"
] | https://github.com/eyounx/ZOOpt/blob/49c750daf842639ee6407848a867091689571810/zoopt/algos/opt_algorithms/racos/racos_common.py#L251-L258 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/metagoofil/hachoir_parser/archive/zip.py | python | ZipFile.createContentSize | (self) | return None | [] | def createContentSize(self):
start = 0
end = MAX_FILESIZE * 8
end = self.stream.searchBytes("PK\5\6", start, end)
if end is not None:
return end + 22*8
return None | [
"def",
"createContentSize",
"(",
"self",
")",
":",
"start",
"=",
"0",
"end",
"=",
"MAX_FILESIZE",
"*",
"8",
"end",
"=",
"self",
".",
"stream",
".",
"searchBytes",
"(",
"\"PK\\5\\6\"",
",",
"start",
",",
"end",
")",
"if",
"end",
"is",
"not",
"None",
"... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_parser/archive/zip.py#L420-L426 | |||
City-Bureau/city-scrapers | b295d0aa612e3979a9fccab7c5f55ecea9ed074c | city_scrapers/spiders/cook_zoning.py | python | CookZoningSpider._parse_links | (self, item) | return links | Parse or generate links. | Parse or generate links. | [
"Parse",
"or",
"generate",
"links",
"."
] | def _parse_links(self, item):
"""Parse or generate links."""
links = []
for link in item.css("a"):
links.append({"title": "Agenda", "href": link.attrib["href"]})
return links | [
"def",
"_parse_links",
"(",
"self",
",",
"item",
")",
":",
"links",
"=",
"[",
"]",
"for",
"link",
"in",
"item",
".",
"css",
"(",
"\"a\"",
")",
":",
"links",
".",
"append",
"(",
"{",
"\"title\"",
":",
"\"Agenda\"",
",",
"\"href\"",
":",
"link",
".",... | https://github.com/City-Bureau/city-scrapers/blob/b295d0aa612e3979a9fccab7c5f55ecea9ed074c/city_scrapers/spiders/cook_zoning.py#L64-L69 | |
freedombox/FreedomBox | 335a7f92cc08f27981f838a7cddfc67740598e54 | plinth/modules/email_server/views.py | python | AliasView.__init__ | (self, *args, **kwargs) | Initialize the view. | Initialize the view. | [
"Initialize",
"the",
"view",
"."
] | def __init__(self, *args, **kwargs):
"""Initialize the view."""
super().__init__(*args, **kwargs)
self.posted_form = None | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"posted_form",
"=",
"None"
] | https://github.com/freedombox/FreedomBox/blob/335a7f92cc08f27981f838a7cddfc67740598e54/plinth/modules/email_server/views.py#L141-L144 | ||
chaoss/grimoirelab-perceval | ba19bfd5e40bffdd422ca8e68526326b47f97491 | perceval/backends/core/rocketchat.py | python | RocketChat.metadata_id | (item) | return item["_id"] | Extracts the identifier from a Rocket.Chat item. | Extracts the identifier from a Rocket.Chat item. | [
"Extracts",
"the",
"identifier",
"from",
"a",
"Rocket",
".",
"Chat",
"item",
"."
] | def metadata_id(item):
"""Extracts the identifier from a Rocket.Chat item."""
return item["_id"] | [
"def",
"metadata_id",
"(",
"item",
")",
":",
"return",
"item",
"[",
"\"_id\"",
"]"
] | https://github.com/chaoss/grimoirelab-perceval/blob/ba19bfd5e40bffdd422ca8e68526326b47f97491/perceval/backends/core/rocketchat.py#L193-L196 | |
GNOME/pygobject | 6115565b13f13407021b9f0b4d92c8c890eb19d8 | setup.py | python | get_version_requirement | (pkg_config_name) | return versions[pkg_config_name] | Given a pkg-config module name gets the minimum version required | Given a pkg-config module name gets the minimum version required | [
"Given",
"a",
"pkg",
"-",
"config",
"module",
"name",
"gets",
"the",
"minimum",
"version",
"required"
] | def get_version_requirement(pkg_config_name):
"""Given a pkg-config module name gets the minimum version required"""
versions = {
"gobject-introspection-1.0": GI_VERSION_REQUIRED,
"glib-2.0": GLIB_VERSION_REQUIRED,
"gio-2.0": GLIB_VERSION_REQUIRED,
"py3cairo": PYCAIRO_VERSION_RE... | [
"def",
"get_version_requirement",
"(",
"pkg_config_name",
")",
":",
"versions",
"=",
"{",
"\"gobject-introspection-1.0\"",
":",
"GI_VERSION_REQUIRED",
",",
"\"glib-2.0\"",
":",
"GLIB_VERSION_REQUIRED",
",",
"\"gio-2.0\"",
":",
"GLIB_VERSION_REQUIRED",
",",
"\"py3cairo\"",
... | https://github.com/GNOME/pygobject/blob/6115565b13f13407021b9f0b4d92c8c890eb19d8/setup.py#L62-L75 | |
infodox/exploits | 69e957865f362bc7c51e7a386361fb4d2751120c | phpchart_pwn.py | python | main | () | [] | def main():
haxurl = "http://" + target + path + "wizard/index.php?type=';INSERTCODE;//"
payload = genpayload(host, port)
pwn = haxurl.replace("INSERTCODE", payload)
print "[+] Preparing for hax"
print "[!] Please run nc -lvp %s on your listener" %(port)
raw_input("Press Enter to Fire...") # deb... | [
"def",
"main",
"(",
")",
":",
"haxurl",
"=",
"\"http://\"",
"+",
"target",
"+",
"path",
"+",
"\"wizard/index.php?type=';INSERTCODE;//\"",
"payload",
"=",
"genpayload",
"(",
"host",
",",
"port",
")",
"pwn",
"=",
"haxurl",
".",
"replace",
"(",
"\"INSERTCODE\"",
... | https://github.com/infodox/exploits/blob/69e957865f362bc7c51e7a386361fb4d2751120c/phpchart_pwn.py#L26-L36 | ||||
it-projects-llc/odoo-saas-tools | 8e9ad4d06853b668a42a3e8177c8246fd946f0e9 | oauth_provider/controllers/main.py | python | OAuth2._extract_params | (self, request, post_dict) | return uri, http_method, body, headers | Extract parameters from the Django request object. Such parameters will then be passed to
OAuthLib to build its own Request object | Extract parameters from the Django request object. Such parameters will then be passed to
OAuthLib to build its own Request object | [
"Extract",
"parameters",
"from",
"the",
"Django",
"request",
"object",
".",
"Such",
"parameters",
"will",
"then",
"be",
"passed",
"to",
"OAuthLib",
"to",
"build",
"its",
"own",
"Request",
"object"
] | def _extract_params(self, request, post_dict):
"""
Extract parameters from the Django request object. Such parameters will then be passed to
OAuthLib to build its own Request object
"""
uri = self._get_escaped_full_path(request)
http_method = request.httprequest.method
... | [
"def",
"_extract_params",
"(",
"self",
",",
"request",
",",
"post_dict",
")",
":",
"uri",
"=",
"self",
".",
"_get_escaped_full_path",
"(",
"request",
")",
"http_method",
"=",
"request",
".",
"httprequest",
".",
"method",
"headers",
"=",
"dict",
"(",
"list",
... | https://github.com/it-projects-llc/odoo-saas-tools/blob/8e9ad4d06853b668a42a3e8177c8246fd946f0e9/oauth_provider/controllers/main.py#L40-L56 | |
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/whoosh/matching/mcore.py | python | Matcher.reset | (self) | Returns to the start of the posting list.
Note that reset() may not do what you expect after you call
:meth:`Matcher.replace()`, since this can mean calling reset() not on
the original matcher, but on an optimized replacement. | Returns to the start of the posting list. | [
"Returns",
"to",
"the",
"start",
"of",
"the",
"posting",
"list",
"."
] | def reset(self):
"""Returns to the start of the posting list.
Note that reset() may not do what you expect after you call
:meth:`Matcher.replace()`, since this can mean calling reset() not on
the original matcher, but on an optimized replacement.
"""
raise NotImplemente... | [
"def",
"reset",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/whoosh/matching/mcore.py#L89-L97 | ||
googleapis/python-dialogflow | e48ea001b7c8a4a5c1fe4b162bad49ea397458e9 | google/cloud/dialogflow_v2/services/entity_types/pagers.py | python | ListEntityTypesAsyncPager.__repr__ | (self) | return "{0}<{1!r}>".format(self.__class__.__name__, self._response) | [] | def __repr__(self) -> str:
return "{0}<{1!r}>".format(self.__class__.__name__, self._response) | [
"def",
"__repr__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"{0}<{1!r}>\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"_response",
")"
] | https://github.com/googleapis/python-dialogflow/blob/e48ea001b7c8a4a5c1fe4b162bad49ea397458e9/google/cloud/dialogflow_v2/services/entity_types/pagers.py#L154-L155 | |||
dedupeio/dedupe | 5ad932c3416478d973a207cd52e2a1da4f287f2b | dedupe/blocking.py | python | Fingerprinter.unindex | (self, docs: Docs, field: str) | Remove docs from indices used by fingerprinters
Args:
docs: an iterator of values from your data to remove. While
not required, it is recommended that docs be a unique
set of of those values. Indexing can be an expensive
operation.
f... | Remove docs from indices used by fingerprinters | [
"Remove",
"docs",
"from",
"indices",
"used",
"by",
"fingerprinters"
] | def unindex(self, docs: Docs, field: str) -> None:
'''Remove docs from indices used by fingerprinters
Args:
docs: an iterator of values from your data to remove. While
not required, it is recommended that docs be a unique
set of of those values. Indexing ... | [
"def",
"unindex",
"(",
"self",
",",
"docs",
":",
"Docs",
",",
"field",
":",
"str",
")",
"->",
"None",
":",
"indices",
"=",
"extractIndices",
"(",
"self",
".",
"index_fields",
"[",
"field",
"]",
")",
"for",
"doc",
"in",
"docs",
":",
"if",
"doc",
":"... | https://github.com/dedupeio/dedupe/blob/5ad932c3416478d973a207cd52e2a1da4f287f2b/dedupe/blocking.py#L151-L180 | ||
charliememory/Disentangled-Person-Image-Generation | e4703860bb1b351050ce50f339985ff0811f1d64 | tflib/ops/linear.py | python | Linear | (
name,
input_dim,
output_dim,
inputs,
biases=True,
initialization=None,
weightnorm=None,
gain=1.
) | initialization: None, `lecun`, 'glorot', `he`, 'glorot_he', `orthogonal`, `("uniform", range)` | initialization: None, `lecun`, 'glorot', `he`, 'glorot_he', `orthogonal`, `("uniform", range)` | [
"initialization",
":",
"None",
"lecun",
"glorot",
"he",
"glorot_he",
"orthogonal",
"(",
"uniform",
"range",
")"
] | def Linear(
name,
input_dim,
output_dim,
inputs,
biases=True,
initialization=None,
weightnorm=None,
gain=1.
):
"""
initialization: None, `lecun`, 'glorot', `he`, 'glorot_he', `orthogonal`, `("uniform", range)`
"""
with tf.name_sc... | [
"def",
"Linear",
"(",
"name",
",",
"input_dim",
",",
"output_dim",
",",
"inputs",
",",
"biases",
"=",
"True",
",",
"initialization",
"=",
"None",
",",
"weightnorm",
"=",
"None",
",",
"gain",
"=",
"1.",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
... | https://github.com/charliememory/Disentangled-Person-Image-Generation/blob/e4703860bb1b351050ce50f339985ff0811f1d64/tflib/ops/linear.py#L24-L148 | ||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/data/parsers/doc/wsdl.py | python | WSDLParser.get_methods | (self) | return res | @wsdlDocument: The XML document
:return: The methods defined in the WSDL | [] | def get_methods(self):
"""
@wsdlDocument: The XML document
:return: The methods defined in the WSDL
"""
res = []
for methodName in self._proxy.methods.keys():
remoteMethodObject = remoteMethod()
remoteMethodObject.set_methodName(str(methodName))
... | [
"def",
"get_methods",
"(",
"self",
")",
":",
"res",
"=",
"[",
"]",
"for",
"methodName",
"in",
"self",
".",
"_proxy",
".",
"methods",
".",
"keys",
"(",
")",
":",
"remoteMethodObject",
"=",
"remoteMethod",
"(",
")",
"remoteMethodObject",
".",
"set_methodName... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/data/parsers/doc/wsdl.py#L108-L123 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/finite_rings/finite_field_ntl_gf2e.py | python | FiniteField_ntl_gf2e.order | (self) | return self._cache.order() | Return the cardinality of this field.
EXAMPLES::
sage: k.<a> = GF(2^64)
sage: k.order()
18446744073709551616 | Return the cardinality of this field. | [
"Return",
"the",
"cardinality",
"of",
"this",
"field",
"."
] | def order(self):
"""
Return the cardinality of this field.
EXAMPLES::
sage: k.<a> = GF(2^64)
sage: k.order()
18446744073709551616
"""
return self._cache.order() | [
"def",
"order",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cache",
".",
"order",
"(",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py#L159-L169 | |
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | plugin.video.megogo.net/resources/lib/megogo2xbmc.py | python | getInfo | (video) | return export | [] | def getInfo(video):
mysetInfo={}
try: poster=video['poster']
except: poster=None
try: desc=video['description'].replace('<p>','').replace('\r\n\r\n','\r\n')
except: desc=None
try: rating=video['rating_kinopoisk']
except: rating=None
try: year=video['year']
except: year=None
... | [
"def",
"getInfo",
"(",
"video",
")",
":",
"mysetInfo",
"=",
"{",
"}",
"try",
":",
"poster",
"=",
"video",
"[",
"'poster'",
"]",
"except",
":",
"poster",
"=",
"None",
"try",
":",
"desc",
"=",
"video",
"[",
"'description'",
"]",
".",
"replace",
"(",
... | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.megogo.net/resources/lib/megogo2xbmc.py#L663-L702 | |||
tipam/pi3d | 1f1c822dc3ac58344ad2d5468978d62e51710df4 | pi3d/shape/Building.py | python | Building.east_wall | (self, x, y, z, width=10, length=10, height=10, details=None, name="wall", mergeshape=None) | Creates a cell consisting of optional north, south, east and west walls and an optional ceiling.
The north and south walls are parallel with the x axis, with north being more positive. The east and
west walls are parallel with the z axis, with east being more positive.
The cell is centred at (x,y,z). The ce... | Creates a cell consisting of optional north, south, east and west walls and an optional ceiling.
The north and south walls are parallel with the x axis, with north being more positive. The east and
west walls are parallel with the z axis, with east being more positive.
The cell is centred at (x,y,z). The ce... | [
"Creates",
"a",
"cell",
"consisting",
"of",
"optional",
"north",
"south",
"east",
"and",
"west",
"walls",
"and",
"an",
"optional",
"ceiling",
".",
"The",
"north",
"and",
"south",
"walls",
"are",
"parallel",
"with",
"the",
"x",
"axis",
"with",
"north",
"bei... | def east_wall(self, x, y, z, width=10, length=10, height=10, details=None, name="wall", mergeshape=None):
"""
Creates a cell consisting of optional north, south, east and west walls and an optional ceiling.
The north and south walls are parallel with the x axis, with north being more positive. The east and
... | [
"def",
"east_wall",
"(",
"self",
",",
"x",
",",
"y",
",",
"z",
",",
"width",
"=",
"10",
",",
"length",
"=",
"10",
",",
"height",
"=",
"10",
",",
"details",
"=",
"None",
",",
"name",
"=",
"\"wall\"",
",",
"mergeshape",
"=",
"None",
")",
":",
"gl... | https://github.com/tipam/pi3d/blob/1f1c822dc3ac58344ad2d5468978d62e51710df4/pi3d/shape/Building.py#L691-L714 | ||
bitcoin-core/HWI | 6871946c2176f2f9777b6ac8f0614d96d99bfa0e | hwilib/key.py | python | H_ | (x: int) | return x | HARDENED_FLAG | Shortcut function that "hardens" a number in a BIP44 path. | Shortcut function that "hardens" a number in a BIP44 path. | [
"Shortcut",
"function",
"that",
"hardens",
"a",
"number",
"in",
"a",
"BIP44",
"path",
"."
] | def H_(x: int) -> int:
"""
Shortcut function that "hardens" a number in a BIP44 path.
"""
return x | HARDENED_FLAG | [
"def",
"H_",
"(",
"x",
":",
"int",
")",
"->",
"int",
":",
"return",
"x",
"|",
"HARDENED_FLAG"
] | https://github.com/bitcoin-core/HWI/blob/6871946c2176f2f9777b6ac8f0614d96d99bfa0e/hwilib/key.py#L43-L47 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/forms/formsets.py | python | BaseFormSet.has_changed | (self) | return any(form.has_changed() for form in self) | Returns true if data in any form differs from initial. | Returns true if data in any form differs from initial. | [
"Returns",
"true",
"if",
"data",
"in",
"any",
"form",
"differs",
"from",
"initial",
"."
] | def has_changed(self):
"""
Returns true if data in any form differs from initial.
"""
return any(form.has_changed() for form in self) | [
"def",
"has_changed",
"(",
"self",
")",
":",
"return",
"any",
"(",
"form",
".",
"has_changed",
"(",
")",
"for",
"form",
"in",
"self",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/forms/formsets.py#L306-L310 | |
pypr/pysph | 9cb9a859934939307c65a25cbf73e4ecc83fea4a | pysph/tools/particle_packing.py | python | calculate_normal_2d_surface | (boundary, shift, isclosed=True) | return xn, yn, x, y, area | Calculate normals from the set of points arranged in a sequence
Parameters
----------
boundary: 2 dimensional numpy array of x and y coordinates
shift: the signed shift value
isclosed: True if the boundary is closed curve
Returns
-------
xn: x coordinate of normal
yn: y coordinat... | Calculate normals from the set of points arranged in a sequence | [
"Calculate",
"normals",
"from",
"the",
"set",
"of",
"points",
"arranged",
"in",
"a",
"sequence"
] | def calculate_normal_2d_surface(boundary, shift, isclosed=True):
"""Calculate normals from the set of points arranged in a sequence
Parameters
----------
boundary: 2 dimensional numpy array of x and y coordinates
shift: the signed shift value
isclosed: True if the boundary is closed curve
... | [
"def",
"calculate_normal_2d_surface",
"(",
"boundary",
",",
"shift",
",",
"isclosed",
"=",
"True",
")",
":",
"import",
"numpy",
"as",
"np",
"xb",
"=",
"boundary",
"[",
"0",
"]",
"yb",
"=",
"boundary",
"[",
"1",
"]",
"xn",
"=",
"np",
".",
"zeros",
"("... | https://github.com/pypr/pysph/blob/9cb9a859934939307c65a25cbf73e4ecc83fea4a/pysph/tools/particle_packing.py#L46-L118 | |
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/pickletools.py | python | read_long1 | (f) | return decode_long(data) | r"""
>>> import StringIO
>>> read_long1(StringIO.StringIO("\x00"))
0L
>>> read_long1(StringIO.StringIO("\x02\xff\x00"))
255L
>>> read_long1(StringIO.StringIO("\x02\xff\x7f"))
32767L
>>> read_long1(StringIO.StringIO("\x02\x00\xff"))
-256L
>>> read_long1(StringIO.StringIO("\x02\x00... | r"""
>>> import StringIO
>>> read_long1(StringIO.StringIO("\x00"))
0L
>>> read_long1(StringIO.StringIO("\x02\xff\x00"))
255L
>>> read_long1(StringIO.StringIO("\x02\xff\x7f"))
32767L
>>> read_long1(StringIO.StringIO("\x02\x00\xff"))
-256L
>>> read_long1(StringIO.StringIO("\x02\x00... | [
"r",
">>>",
"import",
"StringIO",
">>>",
"read_long1",
"(",
"StringIO",
".",
"StringIO",
"(",
"\\",
"x00",
"))",
"0L",
">>>",
"read_long1",
"(",
"StringIO",
".",
"StringIO",
"(",
"\\",
"x02",
"\\",
"xff",
"\\",
"x00",
"))",
"255L",
">>>",
"read_long1",
... | def read_long1(f):
r"""
>>> import StringIO
>>> read_long1(StringIO.StringIO("\x00"))
0L
>>> read_long1(StringIO.StringIO("\x02\xff\x00"))
255L
>>> read_long1(StringIO.StringIO("\x02\xff\x7f"))
32767L
>>> read_long1(StringIO.StringIO("\x02\x00\xff"))
-256L
>>> read_long1(Stri... | [
"def",
"read_long1",
"(",
"f",
")",
":",
"n",
"=",
"read_uint1",
"(",
"f",
")",
"data",
"=",
"f",
".",
"read",
"(",
"n",
")",
"if",
"len",
"(",
"data",
")",
"!=",
"n",
":",
"raise",
"ValueError",
"(",
"\"not enough data in stream to read long1\"",
")",... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/pickletools.py#L622-L641 | |
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/platforms/opp/opp.py | python | OppHardwarePlatform.read_matrix_inp_resp_initial | (self, chain_serial, msg) | Read initial matrix switch states.
Args:
----
chain_serial: Serial of the chain which received the message.
msg: Message to parse. | Read initial matrix switch states. | [
"Read",
"initial",
"matrix",
"switch",
"states",
"."
] | def read_matrix_inp_resp_initial(self, chain_serial, msg):
"""Read initial matrix switch states.
Args:
----
chain_serial: Serial of the chain which received the message.
msg: Message to parse.
"""
# Verify the CRC8 is correct
if len(msg) < 11:
... | [
"def",
"read_matrix_inp_resp_initial",
"(",
"self",
",",
"chain_serial",
",",
"msg",
")",
":",
"# Verify the CRC8 is correct",
"if",
"len",
"(",
"msg",
")",
"<",
"11",
":",
"raise",
"AssertionError",
"(",
"\"Received too short initial input response: \"",
"+",
"\"\"",... | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/opp/opp.py#L688-L709 | ||
sethmlarson/virtualbox-python | 984a6e2cb0e8996f4df40f4444c1528849f1c70d | virtualbox/library.py | python | IInternalMachineControl.clipboard_area_get_ref_count | (self, id_p) | return refcount | Returns the current reference count of a clipboard area.
in id_p of type int
Clipboard area to return reference count for.
out refcount of type int
Returns the current reference count. | Returns the current reference count of a clipboard area. | [
"Returns",
"the",
"current",
"reference",
"count",
"of",
"a",
"clipboard",
"area",
"."
] | def clipboard_area_get_ref_count(self, id_p):
"""Returns the current reference count of a clipboard area.
in id_p of type int
Clipboard area to return reference count for.
out refcount of type int
Returns the current reference count.
"""
if not isinstan... | [
"def",
"clipboard_area_get_ref_count",
"(",
"self",
",",
"id_p",
")",
":",
"if",
"not",
"isinstance",
"(",
"id_p",
",",
"baseinteger",
")",
":",
"raise",
"TypeError",
"(",
"\"id_p can only be an instance of type baseinteger\"",
")",
"refcount",
"=",
"self",
".",
"... | https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L12989-L13002 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/FeedUnit42v2/Integrations/FeedUnit42v2/FeedUnit42v2.py | python | get_ioc_type | (indicator, id_to_object) | return ioc_type | Get IOC type by extracting it from the pattern field.
Args:
indicator: the indicator to get information on.
id_to_object: a dict in the form of - id: stix_object.
Returns:
str. the IOC type. | Get IOC type by extracting it from the pattern field. | [
"Get",
"IOC",
"type",
"by",
"extracting",
"it",
"from",
"the",
"pattern",
"field",
"."
] | def get_ioc_type(indicator, id_to_object):
"""
Get IOC type by extracting it from the pattern field.
Args:
indicator: the indicator to get information on.
id_to_object: a dict in the form of - id: stix_object.
Returns:
str. the IOC type.
"""
ioc_type = ''
indicator_... | [
"def",
"get_ioc_type",
"(",
"indicator",
",",
"id_to_object",
")",
":",
"ioc_type",
"=",
"''",
"indicator_obj",
"=",
"id_to_object",
".",
"get",
"(",
"indicator",
",",
"{",
"}",
")",
"pattern",
"=",
"indicator_obj",
".",
"get",
"(",
"'pattern'",
",",
"''",... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/FeedUnit42v2/Integrations/FeedUnit42v2/FeedUnit42v2.py#L471-L489 | |
coala/coala | 37af7fd5de3ed148b8096cfc80e4717fb840bf2c | coalib/bears/Bear.py | python | Bear.__json__ | (cls) | return _dict | Override JSON export of ``Bear`` object. | Override JSON export of ``Bear`` object. | [
"Override",
"JSON",
"export",
"of",
"Bear",
"object",
"."
] | def __json__(cls):
"""
Override JSON export of ``Bear`` object.
"""
# json cannot serialize properties, so drop them
_dict = {key: value for key, value in get_public_members(cls).items()
if not isinstance(value, property)}
metadata = cls.get_metadata()
... | [
"def",
"__json__",
"(",
"cls",
")",
":",
"# json cannot serialize properties, so drop them",
"_dict",
"=",
"{",
"key",
":",
"value",
"for",
"key",
",",
"value",
"in",
"get_public_members",
"(",
"cls",
")",
".",
"items",
"(",
")",
"if",
"not",
"isinstance",
"... | https://github.com/coala/coala/blob/37af7fd5de3ed148b8096cfc80e4717fb840bf2c/coalib/bears/Bear.py#L503-L521 | |
rackerlabs/scantron | 175f93c501780f09befb7127028a141b1e5a1b3f | scantron_api_client/scantron_api_client.py | python | ScantronClient.update_scan_command | (self, scan_command_id, payload) | return self.scantron_api_query(f"/api/scan_commands/{scan_command_id}", method="PATCH", payload=payload) | Update scan command for specific scan command ID. | Update scan command for specific scan command ID. | [
"Update",
"scan",
"command",
"for",
"specific",
"scan",
"command",
"ID",
"."
] | def update_scan_command(self, scan_command_id, payload):
"""Update scan command for specific scan command ID."""
return self.scantron_api_query(f"/api/scan_commands/{scan_command_id}", method="PATCH", payload=payload) | [
"def",
"update_scan_command",
"(",
"self",
",",
"scan_command_id",
",",
"payload",
")",
":",
"return",
"self",
".",
"scantron_api_query",
"(",
"f\"/api/scan_commands/{scan_command_id}\"",
",",
"method",
"=",
"\"PATCH\"",
",",
"payload",
"=",
"payload",
")"
] | https://github.com/rackerlabs/scantron/blob/175f93c501780f09befb7127028a141b1e5a1b3f/scantron_api_client/scantron_api_client.py#L484-L486 | |
ofnote/tsalib | e6c2ab5d1f8453866eb201264652c89d2a570f1e | tsalib/utils.py | python | select | (x, dv_dict, squeeze=False) | return y | Index using dimension shorthands
x: (t, 'bcd') -- tensor, shape tuple (can be indexed in numpy notation : x[:,0,:])
dv_dict: {'b': 0, 'c': 5}
squeeze: [True, False] or a tsn list ('b,c') of dims to be squeezed | Index using dimension shorthands
x: (t, 'bcd') -- tensor, shape tuple (can be indexed in numpy notation : x[:,0,:])
dv_dict: {'b': 0, 'c': 5}
squeeze: [True, False] or a tsn list ('b,c') of dims to be squeezed | [
"Index",
"using",
"dimension",
"shorthands",
"x",
":",
"(",
"t",
"bcd",
")",
"--",
"tensor",
"shape",
"tuple",
"(",
"can",
"be",
"indexed",
"in",
"numpy",
"notation",
":",
"x",
"[",
":",
"0",
":",
"]",
")",
"dv_dict",
":",
"{",
"b",
":",
"0",
"c"... | def select(x, dv_dict, squeeze=False):
'''
Index using dimension shorthands
x: (t, 'bcd') -- tensor, shape tuple (can be indexed in numpy notation : x[:,0,:])
dv_dict: {'b': 0, 'c': 5}
squeeze: [True, False] or a tsn list ('b,c') of dims to be squeezed
'''
assert not squeeze, 'not impl... | [
"def",
"select",
"(",
"x",
",",
"dv_dict",
",",
"squeeze",
"=",
"False",
")",
":",
"assert",
"not",
"squeeze",
",",
"'not implemented'",
"assert",
"isinstance",
"(",
"tuple",
")",
",",
"'The first argument should be a tuple of (vector, shape)'",
"xv",
",",
"xs",
... | https://github.com/ofnote/tsalib/blob/e6c2ab5d1f8453866eb201264652c89d2a570f1e/tsalib/utils.py#L45-L68 | |
awslabs/aws-data-wrangler | 548f5197bacd91bd50ebc66a0173eff9c56f69b1 | awswrangler/quicksight/_get_list.py | python | list_dashboards | (
account_id: Optional[str] = None, boto3_session: Optional[boto3.Session] = None
) | return _list(
func_name="list_dashboards",
attr_name="DashboardSummaryList",
account_id=account_id,
boto3_session=boto3_session,
) | List dashboards in an AWS account.
Parameters
----------
account_id : str, optional
If None, the account ID will be inferred from your boto3 session.
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
Retur... | List dashboards in an AWS account. | [
"List",
"dashboards",
"in",
"an",
"AWS",
"account",
"."
] | def list_dashboards(
account_id: Optional[str] = None, boto3_session: Optional[boto3.Session] = None
) -> List[Dict[str, Any]]:
"""List dashboards in an AWS account.
Parameters
----------
account_id : str, optional
If None, the account ID will be inferred from your boto3 session.
boto3_... | [
"def",
"list_dashboards",
"(",
"account_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"boto3_session",
":",
"Optional",
"[",
"boto3",
".",
"Session",
"]",
"=",
"None",
")",
"->",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
... | https://github.com/awslabs/aws-data-wrangler/blob/548f5197bacd91bd50ebc66a0173eff9c56f69b1/awswrangler/quicksight/_get_list.py#L39-L66 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/venv/lib/python3.7/site-packages/setuptools/command/bdist_egg.py | python | bdist_egg.get_ext_outputs | (self) | return all_outputs, ext_outputs | Get a list of relative paths to C extensions in the output distro | Get a list of relative paths to C extensions in the output distro | [
"Get",
"a",
"list",
"of",
"relative",
"paths",
"to",
"C",
"extensions",
"in",
"the",
"output",
"distro"
] | def get_ext_outputs(self):
"""Get a list of relative paths to C extensions in the output distro"""
all_outputs = []
ext_outputs = []
paths = {self.bdist_dir: ''}
for base, dirs, files in sorted_walk(self.bdist_dir):
for filename in files:
if os.path.... | [
"def",
"get_ext_outputs",
"(",
"self",
")",
":",
"all_outputs",
"=",
"[",
"]",
"ext_outputs",
"=",
"[",
"]",
"paths",
"=",
"{",
"self",
".",
"bdist_dir",
":",
"''",
"}",
"for",
"base",
",",
"dirs",
",",
"files",
"in",
"sorted_walk",
"(",
"self",
".",... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/setuptools/command/bdist_egg.py#L326-L352 | |
sartography/SpiffWorkflow | 764be6c276a278d372b96de470e39b29248a86d4 | SpiffWorkflow/bpmn/parser/BpmnParser.py | python | BpmnParser.add_bpmn_files_by_glob | (self, g) | Add all filenames matching the provided pattern (e.g. *.bpmn) to the
parser's set. | Add all filenames matching the provided pattern (e.g. *.bpmn) to the
parser's set. | [
"Add",
"all",
"filenames",
"matching",
"the",
"provided",
"pattern",
"(",
"e",
".",
"g",
".",
"*",
".",
"bpmn",
")",
"to",
"the",
"parser",
"s",
"set",
"."
] | def add_bpmn_files_by_glob(self, g):
"""
Add all filenames matching the provided pattern (e.g. *.bpmn) to the
parser's set.
"""
self.add_bpmn_files(glob.glob(g)) | [
"def",
"add_bpmn_files_by_glob",
"(",
"self",
",",
"g",
")",
":",
"self",
".",
"add_bpmn_files",
"(",
"glob",
".",
"glob",
"(",
"g",
")",
")"
] | https://github.com/sartography/SpiffWorkflow/blob/764be6c276a278d372b96de470e39b29248a86d4/SpiffWorkflow/bpmn/parser/BpmnParser.py#L122-L127 | ||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventType.is_member_remove_external_id | (self) | return self._tag == 'member_remove_external_id' | Check if the union tag is ``member_remove_external_id``.
:rtype: bool | Check if the union tag is ``member_remove_external_id``. | [
"Check",
"if",
"the",
"union",
"tag",
"is",
"member_remove_external_id",
"."
] | def is_member_remove_external_id(self):
"""
Check if the union tag is ``member_remove_external_id``.
:rtype: bool
"""
return self._tag == 'member_remove_external_id' | [
"def",
"is_member_remove_external_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
"==",
"'member_remove_external_id'"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L29553-L29559 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_internal/utils/misc.py | python | _redact_netloc | (netloc) | return (redact_netloc(netloc),) | [] | def _redact_netloc(netloc):
# type: (str) -> Tuple[str,]
return (redact_netloc(netloc),) | [
"def",
"_redact_netloc",
"(",
"netloc",
")",
":",
"# type: (str) -> Tuple[str,]",
"return",
"(",
"redact_netloc",
"(",
"netloc",
")",
",",
")"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_internal/utils/misc.py#L675-L677 | |||
bitcoin-core/HWI | 6871946c2176f2f9777b6ac8f0614d96d99bfa0e | hwilib/devices/trezorlib/debuglink.py | python | TrezorClientDebugLink.mnemonic_callback | (self, _) | [] | def mnemonic_callback(self, _) -> str:
word, pos = self.debug.read_recovery_word()
if word:
return word
if pos:
return self.mnemonic[pos - 1]
raise RuntimeError("Unexpected call") | [
"def",
"mnemonic_callback",
"(",
"self",
",",
"_",
")",
"->",
"str",
":",
"word",
",",
"pos",
"=",
"self",
".",
"debug",
".",
"read_recovery_word",
"(",
")",
"if",
"word",
":",
"return",
"word",
"if",
"pos",
":",
"return",
"self",
".",
"mnemonic",
"[... | https://github.com/bitcoin-core/HWI/blob/6871946c2176f2f9777b6ac8f0614d96d99bfa0e/hwilib/devices/trezorlib/debuglink.py#L659-L666 | ||||
mlflow/mlflow | 364aca7daf0fcee3ec407ae0b1b16d9cb3085081 | mlflow/tracking/client.py | python | MlflowClient.list_experiments | (
self,
view_type: int = ViewType.ACTIVE_ONLY,
max_results: Optional[int] = None,
page_token: Optional[str] = None,
) | return self._tracking_client.list_experiments(
view_type=view_type, max_results=max_results, page_token=page_token
) | :param view_type: Qualify requested type of experiments.
:param max_results: If passed, specifies the maximum number of experiments desired. If not
passed, all experiments will be returned for the File and SQL backends.
For the REST backend, the server wil... | :param view_type: Qualify requested type of experiments.
:param max_results: If passed, specifies the maximum number of experiments desired. If not
passed, all experiments will be returned for the File and SQL backends.
For the REST backend, the server wil... | [
":",
"param",
"view_type",
":",
"Qualify",
"requested",
"type",
"of",
"experiments",
".",
":",
"param",
"max_results",
":",
"If",
"passed",
"specifies",
"the",
"maximum",
"number",
"of",
"experiments",
"desired",
".",
"If",
"not",
"passed",
"all",
"experiments... | def list_experiments(
self,
view_type: int = ViewType.ACTIVE_ONLY,
max_results: Optional[int] = None,
page_token: Optional[str] = None,
) -> PagedList[Experiment]:
"""
:param view_type: Qualify requested type of experiments.
:param max_results: If passed, spec... | [
"def",
"list_experiments",
"(",
"self",
",",
"view_type",
":",
"int",
"=",
"ViewType",
".",
"ACTIVE_ONLY",
",",
"max_results",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"page_token",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
"-... | https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/tracking/client.py#L338-L397 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/difflib.py | python | HtmlDiff._format_line | (self,side,flag,linenum,text) | return '<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>' \
% (id,linenum,text) | Returns HTML markup of "from" / "to" text lines
side -- 0 or 1 indicating "from" or "to" text
flag -- indicates if difference on line
linenum -- line number (used for line number column)
text -- line text to be marked up | Returns HTML markup of "from" / "to" text lines | [
"Returns",
"HTML",
"markup",
"of",
"from",
"/",
"to",
"text",
"lines"
] | def _format_line(self,side,flag,linenum,text):
"""Returns HTML markup of "from" / "to" text lines
side -- 0 or 1 indicating "from" or "to" text
flag -- indicates if difference on line
linenum -- line number (used for line number column)
text -- line text to be marked up
... | [
"def",
"_format_line",
"(",
"self",
",",
"side",
",",
"flag",
",",
"linenum",
",",
"text",
")",
":",
"try",
":",
"linenum",
"=",
"'%d'",
"%",
"linenum",
"id",
"=",
"' id=\"%s%s\"'",
"%",
"(",
"self",
".",
"_prefix",
"[",
"side",
"]",
",",
"linenum",
... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/difflib.py#L1889-L1910 | |
SALib/SALib | b6b6b5cab3388f3b80590c98d66aca7dc784d894 | src/SALib/analyze/pawn.py | python | cli_parse | (parser) | return parser | [] | def cli_parse(parser):
parser.add_argument('-X', '--model-input-file',
type=str, required=True, help='Model input file')
parser.add_argument('-S', '--slices',
type=int, required=False, help='Number of slices to take')
return parser | [
"def",
"cli_parse",
"(",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'-X'",
",",
"'--model-input-file'",
",",
"type",
"=",
"str",
",",
"required",
"=",
"True",
",",
"help",
"=",
"'Model input file'",
")",
"parser",
".",
"add_argument",
"(",
"'... | https://github.com/SALib/SALib/blob/b6b6b5cab3388f3b80590c98d66aca7dc784d894/src/SALib/analyze/pawn.py#L136-L142 | |||
exodrifter/unity-python | bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d | Lib/codecs.py | python | IncrementalEncoder.encode | (self, input, final=False) | Encodes input and returns the resulting object. | Encodes input and returns the resulting object. | [
"Encodes",
"input",
"and",
"returns",
"the",
"resulting",
"object",
"."
] | def encode(self, input, final=False):
"""
Encodes input and returns the resulting object.
"""
raise NotImplementedError | [
"def",
"encode",
"(",
"self",
",",
"input",
",",
"final",
"=",
"False",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/codecs.py#L191-L195 | ||
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/api/yaml_object.py | python | _ObjectMapper.set_value | (self, value) | Set value of instance to map to.
Args:
value: Instance that this mapper maps to. | Set value of instance to map to. | [
"Set",
"value",
"of",
"instance",
"to",
"map",
"to",
"."
] | def set_value(self, value):
"""Set value of instance to map to.
Args:
value: Instance that this mapper maps to.
"""
self.value = value | [
"def",
"set_value",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"value",
"=",
"value"
] | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/api/yaml_object.py#L57-L63 | ||
theQRL/QRL | e751c790c1d8e01b51b26735009a2607ac548773 | src/qrl/_version.py | python | plus_or_dot | (pieces) | return "+" | Return a + if we don't already have one, else return a . | Return a + if we don't already have one, else return a . | [
"Return",
"a",
"+",
"if",
"we",
"don",
"t",
"already",
"have",
"one",
"else",
"return",
"a",
"."
] | def plus_or_dot(pieces):
"""Return a + if we don't already have one, else return a ."""
if "+" in pieces.get("closest-tag", ""):
return "."
return "+" | [
"def",
"plus_or_dot",
"(",
"pieces",
")",
":",
"if",
"\"+\"",
"in",
"pieces",
".",
"get",
"(",
"\"closest-tag\"",
",",
"\"\"",
")",
":",
"return",
"\".\"",
"return",
"\"+\""
] | https://github.com/theQRL/QRL/blob/e751c790c1d8e01b51b26735009a2607ac548773/src/qrl/_version.py#L308-L312 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/distutils/command/install_egg_info.py | python | safe_version | (version) | return re.sub('[^A-Za-z0-9.]+', '-', version) | Convert an arbitrary string to a standard version string
Spaces become dots, and all other non-alphanumeric characters become
dashes, with runs of multiple dashes condensed to a single dash. | Convert an arbitrary string to a standard version string | [
"Convert",
"an",
"arbitrary",
"string",
"to",
"a",
"standard",
"version",
"string"
] | def safe_version(version):
"""Convert an arbitrary string to a standard version string
Spaces become dots, and all other non-alphanumeric characters become
dashes, with runs of multiple dashes condensed to a single dash.
"""
version = version.replace(' ','.')
return re.sub('[^A-Za-z0-9.]+', '-'... | [
"def",
"safe_version",
"(",
"version",
")",
":",
"version",
"=",
"version",
".",
"replace",
"(",
"' '",
",",
"'.'",
")",
"return",
"re",
".",
"sub",
"(",
"'[^A-Za-z0-9.]+'",
",",
"'-'",
",",
"version",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/distutils/command/install_egg_info.py#L63-L70 | |
fossasia/susi_linux | 395ea4dbbd2c26cbed8e369b1d8f2af6a3db31a0 | susi_linux/hardware_components/led.py | python | LED_COLOR.clear_strip | (self) | Turns off the strip and shows the result right away. | Turns off the strip and shows the result right away. | [
"Turns",
"off",
"the",
"strip",
"and",
"shows",
"the",
"result",
"right",
"away",
"."
] | def clear_strip(self):
if (not self.seeed_attached):
return
""" Turns off the strip and shows the result right away."""
for led in range(self.num_led):
self.set_pixel(led, 0, 0, 0)
self.show() | [
"def",
"clear_strip",
"(",
"self",
")",
":",
"if",
"(",
"not",
"self",
".",
"seeed_attached",
")",
":",
"return",
"for",
"led",
"in",
"range",
"(",
"self",
".",
"num_led",
")",
":",
"self",
".",
"set_pixel",
"(",
"led",
",",
"0",
",",
"0",
",",
"... | https://github.com/fossasia/susi_linux/blob/395ea4dbbd2c26cbed8e369b1d8f2af6a3db31a0/susi_linux/hardware_components/led.py#L62-L69 | ||
google-research/seed_rl | 66e8890261f09d0355e8bf5f1c5e41968ca9f02b | agents/policy_gradient/eval_utils.py | python | Evaluator.add | (self, data) | Adds data (which should have self.info_specs signature) to the queue. | Adds data (which should have self.info_specs signature) to the queue. | [
"Adds",
"data",
"(",
"which",
"should",
"have",
"self",
".",
"info_specs",
"signature",
")",
"to",
"the",
"queue",
"."
] | def add(self, data):
"""Adds data (which should have self.info_specs signature) to the queue."""
self.episode_info_queue.enqueue(EpisodeInfo(*data)) | [
"def",
"add",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"episode_info_queue",
".",
"enqueue",
"(",
"EpisodeInfo",
"(",
"*",
"data",
")",
")"
] | https://github.com/google-research/seed_rl/blob/66e8890261f09d0355e8bf5f1c5e41968ca9f02b/agents/policy_gradient/eval_utils.py#L48-L50 | ||
ctxis/CAPE | dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82 | modules/processing/parsers/mwcp/utils/construct/helpers.py | python | Delimited._find_delimiter | (self, stream, delimiter) | Finds given delimiter in stream.
:returns: Stream offset for delimiter.
:raises ConstructError: If delimiter isn't found. | Finds given delimiter in stream. | [
"Finds",
"given",
"delimiter",
"in",
"stream",
"."
] | def _find_delimiter(self, stream, delimiter):
"""
Finds given delimiter in stream.
:returns: Stream offset for delimiter.
:raises ConstructError: If delimiter isn't found.
"""
fallback = stream.tell()
try:
for byte in iter(lambda: stream.read(1), ''):... | [
"def",
"_find_delimiter",
"(",
"self",
",",
"stream",
",",
"delimiter",
")",
":",
"fallback",
"=",
"stream",
".",
"tell",
"(",
")",
"try",
":",
"for",
"byte",
"in",
"iter",
"(",
"lambda",
":",
"stream",
".",
"read",
"(",
"1",
")",
",",
"''",
")",
... | https://github.com/ctxis/CAPE/blob/dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82/modules/processing/parsers/mwcp/utils/construct/helpers.py#L903-L921 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/transmission/__init__.py | python | TransmissionData.check_removed_torrent | (self) | Get removed torrent functionality. | Get removed torrent functionality. | [
"Get",
"removed",
"torrent",
"functionality",
"."
] | def check_removed_torrent(self):
"""Get removed torrent functionality."""
current_torrent_names = {torrent.name for torrent in self._torrents}
for torrent in self._all_torrents:
if torrent.name not in current_torrent_names:
self.hass.bus.fire(
EVE... | [
"def",
"check_removed_torrent",
"(",
"self",
")",
":",
"current_torrent_names",
"=",
"{",
"torrent",
".",
"name",
"for",
"torrent",
"in",
"self",
".",
"_torrents",
"}",
"for",
"torrent",
"in",
"self",
".",
"_all_torrents",
":",
"if",
"torrent",
".",
"name",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/transmission/__init__.py#L433-L443 | ||
intel/CeTune | fdc523971dc6d52cbbefb24ff9504fdc934b31ca | analyzer/analyzer_remote.py | python | Analyzer.process_iostat_data | (self, node, path) | return result | [] | def process_iostat_data(self, node, path):
result = {}
try:
output_list = []
dict_diskformat = {}
if node in self.cluster["osds"]:
output_list = self.common.parse_disk_format( self.cluster['diskformat'] )
for i in range(len(output_list)... | [
"def",
"process_iostat_data",
"(",
"self",
",",
"node",
",",
"path",
")",
":",
"result",
"=",
"{",
"}",
"try",
":",
"output_list",
"=",
"[",
"]",
"dict_diskformat",
"=",
"{",
"}",
"if",
"node",
"in",
"self",
".",
"cluster",
"[",
"\"osds\"",
"]",
":",... | https://github.com/intel/CeTune/blob/fdc523971dc6d52cbbefb24ff9504fdc934b31ca/analyzer/analyzer_remote.py#L619-L664 | |||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/returners/sentry_return.py | python | returner | (ret) | Log outcome to sentry. The returner tries to identify errors and report
them as such. All other messages will be reported at info level.
Failed states will be appended as separate list for convenience. | Log outcome to sentry. The returner tries to identify errors and report
them as such. All other messages will be reported at info level.
Failed states will be appended as separate list for convenience. | [
"Log",
"outcome",
"to",
"sentry",
".",
"The",
"returner",
"tries",
"to",
"identify",
"errors",
"and",
"report",
"them",
"as",
"such",
".",
"All",
"other",
"messages",
"will",
"be",
"reported",
"at",
"info",
"level",
".",
"Failed",
"states",
"will",
"be",
... | def returner(ret):
"""
Log outcome to sentry. The returner tries to identify errors and report
them as such. All other messages will be reported at info level.
Failed states will be appended as separate list for convenience.
"""
try:
_connect_sentry(_get_message(ret), ret)
except Ex... | [
"def",
"returner",
"(",
"ret",
")",
":",
"try",
":",
"_connect_sentry",
"(",
"_get_message",
"(",
"ret",
")",
",",
"ret",
")",
"except",
"Exception",
"as",
"err",
":",
"# pylint: disable=broad-except",
"log",
".",
"error",
"(",
"\"Can't run connect_sentry: %s\""... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/returners/sentry_return.py#L71-L81 | ||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/urllib/__init__.py | python | toBytes | (url) | return url | toBytes(u"URL") --> 'URL'. | toBytes(u"URL") --> 'URL'. | [
"toBytes",
"(",
"u",
"URL",
")",
"--",
">",
"URL",
"."
] | def toBytes(url):
"""toBytes(u"URL") --> 'URL'."""
# Most URL schemes require ASCII. If that changes, the conversion
# can be relaxed
if _is_unicode(url):
try:
url = url.encode("ASCII")
except UnicodeError:
raise UnicodeError("URL " + repr(url) +
... | [
"def",
"toBytes",
"(",
"url",
")",
":",
"# Most URL schemes require ASCII. If that changes, the conversion",
"# can be relaxed",
"if",
"_is_unicode",
"(",
"url",
")",
":",
"try",
":",
"url",
"=",
"url",
".",
"encode",
"(",
"\"ASCII\"",
")",
"except",
"UnicodeError",... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/urllib/__init__.py#L1065-L1075 | |
IOActive/XDiFF | 552d3394e119ca4ced8115f9fd2d7e26760e40b1 | classes/db.py | python | Db.analyze_killed_differences | (self) | return results | Find which testcases were required to be killed AND were also not killed (loop vs no loop for others) | Find which testcases were required to be killed AND were also not killed (loop vs no loop for others) | [
"Find",
"which",
"testcases",
"were",
"required",
"to",
"be",
"killed",
"AND",
"were",
"also",
"not",
"killed",
"(",
"loop",
"vs",
"no",
"loop",
"for",
"others",
")"
] | def analyze_killed_differences(self):
"""Find which testcases were required to be killed AND were also not killed (loop vs no loop for others)"""
results = []
try:
self.db_cursor.execute("SELECT substr(t.testcase, 1, " + str(self.settings['testcase_limit']) + "), s.name, s.type, s.os, c.name, r.stdout, r.stder... | [
"def",
"analyze_killed_differences",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"try",
":",
"self",
".",
"db_cursor",
".",
"execute",
"(",
"\"SELECT substr(t.testcase, 1, \"",
"+",
"str",
"(",
"self",
".",
"settings",
"[",
"'testcase_limit'",
"]",
")",
... | https://github.com/IOActive/XDiFF/blob/552d3394e119ca4ced8115f9fd2d7e26760e40b1/classes/db.py#L227-L235 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/template/defaulttags.py | python | ifchanged | (parser, token) | return IfChangedNode(nodelist_true, nodelist_false, *values) | Checks if a value has changed from the last iteration of a loop.
The ``{% ifchanged %}`` block tag is used within a loop. It has two
possible uses.
1. Checks its own rendered contents against its previous state and only
displays the content if it has changed. For example, this displays a
lis... | Checks if a value has changed from the last iteration of a loop. | [
"Checks",
"if",
"a",
"value",
"has",
"changed",
"from",
"the",
"last",
"iteration",
"of",
"a",
"loop",
"."
] | def ifchanged(parser, token):
"""
Checks if a value has changed from the last iteration of a loop.
The ``{% ifchanged %}`` block tag is used within a loop. It has two
possible uses.
1. Checks its own rendered contents against its previous state and only
displays the content if it has change... | [
"def",
"ifchanged",
"(",
"parser",
",",
"token",
")",
":",
"bits",
"=",
"token",
".",
"contents",
".",
"split",
"(",
")",
"nodelist_true",
"=",
"parser",
".",
"parse",
"(",
"(",
"'else'",
",",
"'endifchanged'",
")",
")",
"token",
"=",
"parser",
".",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/template/defaulttags.py#L923-L961 | |
operatorequals/covertutils | 2d1eae695f8a4ace12331ce3dc31125eb3d308df | covertutils/bridges/simplebridge.py | python | SimpleBridge.__init__ | ( self, lhandler, rhandler ) | [] | def __init__( self, lhandler, rhandler ) :
if not( isinstance(lhandler, BufferingHandler) and isinstance(rhandler, BufferingHandler) ) :
raise TypeError( "Argument is not of type 'BufferingHandler'" )
self.lcondition = lhandler.getCondition()
self.rcondition = rhandler.getCondition()
self.l2r_thread = Thr... | [
"def",
"__init__",
"(",
"self",
",",
"lhandler",
",",
"rhandler",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"lhandler",
",",
"BufferingHandler",
")",
"and",
"isinstance",
"(",
"rhandler",
",",
"BufferingHandler",
")",
")",
":",
"raise",
"TypeError",
"... | https://github.com/operatorequals/covertutils/blob/2d1eae695f8a4ace12331ce3dc31125eb3d308df/covertutils/bridges/simplebridge.py#L12-L27 | ||||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbTianMaoFuWuShangPin.tmall_servicecenter_tasks_search | (
self,
start,
end
) | return self._top_request(
"tmall.servicecenter.tasks.search",
{
"start": start,
"end": end
},
result_processor=lambda x: x["service_task_packet"]
) | 查询任务类工单信息
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=11122
:param start: 开始时间: 开始时间和结束时间不能超过15分钟
:param end: 结束时间: 开始时间和结束时间不能超过15分钟 | 查询任务类工单信息
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=11122 | [
"查询任务类工单信息",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"11122"
] | def tmall_servicecenter_tasks_search(
self,
start,
end
):
"""
查询任务类工单信息
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=11122
:param start: 开始时间: 开始时间和结束时间不能超过15分钟
:param end: 结束时间: 开始时间和结束时间不能超过15分钟
"""
return self... | [
"def",
"tmall_servicecenter_tasks_search",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"tmall.servicecenter.tasks.search\"",
",",
"{",
"\"start\"",
":",
"start",
",",
"\"end\"",
":",
"end",
"}",
",",
"result_pro... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L31413-L31432 | |
euphrat1ca/fuzzdb-collect | f32552a4d5d84350552c68801aed281ca1f48e66 | ScriptShare/0my/zhao-master/bin/make.py | python | Node.__init__ | (self, yaml, node_id, type) | [] | def __init__(self, yaml, node_id, type) :
self.id = node_id
self.type = type
self.name = yaml[u'name']
if u'other_names' in yaml : # person
self.other_names = yaml[u'other_names']
if u'sex' in yaml : # person
self.sex = yaml[u'sex']
if u'full_nam... | [
"def",
"__init__",
"(",
"self",
",",
"yaml",
",",
"node_id",
",",
"type",
")",
":",
"self",
".",
"id",
"=",
"node_id",
"self",
".",
"type",
"=",
"type",
"self",
".",
"name",
"=",
"yaml",
"[",
"u'name'",
"]",
"if",
"u'other_names'",
"in",
"yaml",
":... | https://github.com/euphrat1ca/fuzzdb-collect/blob/f32552a4d5d84350552c68801aed281ca1f48e66/ScriptShare/0my/zhao-master/bin/make.py#L44-L57 | ||||
biolab/orange2 | db40a9449cb45b507d63dcd5739b223f9cffb8e6 | Orange/OrangeCanvas/application/canvasmain.py | python | CanvasMainWindow.rename_widget | (self) | Rename the current focused widget. | Rename the current focused widget. | [
"Rename",
"the",
"current",
"focused",
"widget",
"."
] | def rename_widget(self):
"""Rename the current focused widget.
"""
doc = self.current_document()
nodes = doc.selectedNodes()
if len(nodes) == 1:
doc.editNodeTitle(nodes[0]) | [
"def",
"rename_widget",
"(",
"self",
")",
":",
"doc",
"=",
"self",
".",
"current_document",
"(",
")",
"nodes",
"=",
"doc",
".",
"selectedNodes",
"(",
")",
"if",
"len",
"(",
"nodes",
")",
"==",
"1",
":",
"doc",
".",
"editNodeTitle",
"(",
"nodes",
"[",... | https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/Orange/OrangeCanvas/application/canvasmain.py#L1525-L1531 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/words/protocols/irc.py | python | IRCClient.irc_RPL_WELCOME | (self, prefix, params) | Called when we have received the welcome from the server. | Called when we have received the welcome from the server. | [
"Called",
"when",
"we",
"have",
"received",
"the",
"welcome",
"from",
"the",
"server",
"."
] | def irc_RPL_WELCOME(self, prefix, params):
"""
Called when we have received the welcome from the server.
"""
self._registered = True
self.nickname = self._attemptedNick
self.signedOn() | [
"def",
"irc_RPL_WELCOME",
"(",
"self",
",",
"prefix",
",",
"params",
")",
":",
"self",
".",
"_registered",
"=",
"True",
"self",
".",
"nickname",
"=",
"self",
".",
"_attemptedNick",
"self",
".",
"signedOn",
"(",
")"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/words/protocols/irc.py#L1718-L1724 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/lib-tk/Tix.py | python | tixCommand.tix_cget | (self, option) | return self.tk.call('tix', 'cget', option) | Returns the current value of the configuration
option given by option. Option may be any of the
options described in the CONFIGURATION OPTIONS section. | Returns the current value of the configuration
option given by option. Option may be any of the
options described in the CONFIGURATION OPTIONS section. | [
"Returns",
"the",
"current",
"value",
"of",
"the",
"configuration",
"option",
"given",
"by",
"option",
".",
"Option",
"may",
"be",
"any",
"of",
"the",
"options",
"described",
"in",
"the",
"CONFIGURATION",
"OPTIONS",
"section",
"."
] | def tix_cget(self, option):
"""Returns the current value of the configuration
option given by option. Option may be any of the
options described in the CONFIGURATION OPTIONS section.
"""
return self.tk.call('tix', 'cget', option) | [
"def",
"tix_cget",
"(",
"self",
",",
"option",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'tix'",
",",
"'cget'",
",",
"option",
")"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/lib-tk/Tix.py#L98-L103 | |
Xyntax/DirBrute | 84a54013f57a4588add9c2032c7c6c0902e6f504 | libs/requests/packages/urllib3/util/retry.py | python | Retry.increment | (self, method=None, url=None, response=None, error=None, _pool=None, _stacktrace=None) | return new_retry | Return a new Retry object with incremented retry counters.
:param response: A response object, or None, if the server did not
return a response.
:type response: :class:`~urllib3.response.HTTPResponse`
:param Exception error: An error encountered during the request, or
No... | Return a new Retry object with incremented retry counters. | [
"Return",
"a",
"new",
"Retry",
"object",
"with",
"incremented",
"retry",
"counters",
"."
] | def increment(self, method=None, url=None, response=None, error=None, _pool=None, _stacktrace=None):
""" Return a new Retry object with incremented retry counters.
:param response: A response object, or None, if the server did not
return a response.
:type response: :class:`~urllib3.... | [
"def",
"increment",
"(",
"self",
",",
"method",
"=",
"None",
",",
"url",
"=",
"None",
",",
"response",
"=",
"None",
",",
"error",
"=",
"None",
",",
"_pool",
"=",
"None",
",",
"_stacktrace",
"=",
"None",
")",
":",
"if",
"self",
".",
"total",
"is",
... | https://github.com/Xyntax/DirBrute/blob/84a54013f57a4588add9c2032c7c6c0902e6f504/libs/requests/packages/urllib3/util/retry.py#L209-L275 | |
madduck/reclass | 9c3478498a5dfa3d1e5cf7aa3b602ca3b53ee15b | reclass/datatypes/parameters.py | python | Parameters.__init__ | (self, mapping=None, delimiter=None) | [] | def __init__(self, mapping=None, delimiter=None):
if delimiter is None:
delimiter = Parameters.DEFAULT_PATH_DELIMITER
self._delimiter = delimiter
self._base = {}
self._occurrences = {}
if mapping is not None:
# we initialise by merging, otherwise the list ... | [
"def",
"__init__",
"(",
"self",
",",
"mapping",
"=",
"None",
",",
"delimiter",
"=",
"None",
")",
":",
"if",
"delimiter",
"is",
"None",
":",
"delimiter",
"=",
"Parameters",
".",
"DEFAULT_PATH_DELIMITER",
"self",
".",
"_delimiter",
"=",
"delimiter",
"self",
... | https://github.com/madduck/reclass/blob/9c3478498a5dfa3d1e5cf7aa3b602ca3b53ee15b/reclass/datatypes/parameters.py#L42-L51 | ||||
flask-admin/flask-admin | 7cff9c742d44d42a8d3495c73a6d71381c796396 | flask_admin/contrib/sqla/view.py | python | ModelView.get_query | (self) | return self.session.query(self.model) | Return a query for the model type.
This method can be used to set a "persistent filter" on an index_view.
Example::
class MyView(ModelView):
def get_query(self):
return super(MyView, self).get_query().filter(User.username == current_... | Return a query for the model type. | [
"Return",
"a",
"query",
"for",
"the",
"model",
"type",
"."
] | def get_query(self):
"""
Return a query for the model type.
This method can be used to set a "persistent filter" on an index_view.
Example::
class MyView(ModelView):
def get_query(self):
return super(MyView, self)... | [
"def",
"get_query",
"(",
"self",
")",
":",
"return",
"self",
".",
"session",
".",
"query",
"(",
"self",
".",
"model",
")"
] | https://github.com/flask-admin/flask-admin/blob/7cff9c742d44d42a8d3495c73a6d71381c796396/flask_admin/contrib/sqla/view.py#L853-L869 | |
Thriftpy/thriftpy2 | 8755065bdd3a51b55cbab488fe628027f2c060db | thriftpy2/parser/__init__.py | python | load | (path, module_name=None, include_dirs=None, include_dir=None, encoding='utf-8') | return thrift | Load thrift file as a module.
The module loaded and objects inside may only be pickled if module_name
was provided.
Note: `include_dir` will be depreacated in the future, use `include_dirs`
instead. If `include_dir` was provided (not None), it will be appended to
`include_dirs`. | Load thrift file as a module. | [
"Load",
"thrift",
"file",
"as",
"a",
"module",
"."
] | def load(path, module_name=None, include_dirs=None, include_dir=None, encoding='utf-8'):
"""Load thrift file as a module.
The module loaded and objects inside may only be pickled if module_name
was provided.
Note: `include_dir` will be depreacated in the future, use `include_dirs`
instead. If `inc... | [
"def",
"load",
"(",
"path",
",",
"module_name",
"=",
"None",
",",
"include_dirs",
"=",
"None",
",",
"include_dir",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"real_module",
"=",
"bool",
"(",
"module_name",
")",
"thrift",
"=",
"parse",
"(",
... | https://github.com/Thriftpy/thriftpy2/blob/8755065bdd3a51b55cbab488fe628027f2c060db/thriftpy2/parser/__init__.py#L21-L38 | |
bcbio/bcbio-nextgen | c80f9b6b1be3267d1f981b7035e3b72441d258f2 | bcbio/structural/delly.py | python | _run_delly | (bam_files, chrom, ref_file, work_dir, items) | return [_bgzip_and_clean(out_file, items)] | Run delly, calling structural variations for the specified type. | Run delly, calling structural variations for the specified type. | [
"Run",
"delly",
"calling",
"structural",
"variations",
"for",
"the",
"specified",
"type",
"."
] | def _run_delly(bam_files, chrom, ref_file, work_dir, items):
"""Run delly, calling structural variations for the specified type.
"""
batch = sshared.get_cur_batch(items)
ext = "-%s-svs" % batch if batch else "-svs"
out_file = os.path.join(work_dir, "%s%s-%s.bcf"
% (os.pat... | [
"def",
"_run_delly",
"(",
"bam_files",
",",
"chrom",
",",
"ref_file",
",",
"work_dir",
",",
"items",
")",
":",
"batch",
"=",
"sshared",
".",
"get_cur_batch",
"(",
"items",
")",
"ext",
"=",
"\"-%s-svs\"",
"%",
"batch",
"if",
"batch",
"else",
"\"-svs\"",
"... | https://github.com/bcbio/bcbio-nextgen/blob/c80f9b6b1be3267d1f981b7035e3b72441d258f2/bcbio/structural/delly.py#L43-L69 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/ast.py | python | NodeVisitor.generic_visit | (self, node) | Called if no explicit visitor function exists for a node. | Called if no explicit visitor function exists for a node. | [
"Called",
"if",
"no",
"explicit",
"visitor",
"function",
"exists",
"for",
"a",
"node",
"."
] | def generic_visit(self, node):
"""Called if no explicit visitor function exists for a node."""
for field, value in iter_fields(node):
if isinstance(value, list):
for item in value:
if isinstance(item, AST):
self.visit(item)
... | [
"def",
"generic_visit",
"(",
"self",
",",
"node",
")",
":",
"for",
"field",
",",
"value",
"in",
"iter_fields",
"(",
"node",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"for",
"item",
"in",
"value",
":",
"if",
"isinstance",
"(",... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/ast.py#L243-L251 | ||
pytroll/satpy | 09e51f932048f98cce7919a4ff8bd2ec01e1ae98 | satpy/multiscene.py | python | MultiScene.all_same_area | (self) | return self._all_same_area(self.loaded_dataset_ids) | Determine if all contained Scenes have the same 'area'. | Determine if all contained Scenes have the same 'area'. | [
"Determine",
"if",
"all",
"contained",
"Scenes",
"have",
"the",
"same",
"area",
"."
] | def all_same_area(self):
"""Determine if all contained Scenes have the same 'area'."""
return self._all_same_area(self.loaded_dataset_ids) | [
"def",
"all_same_area",
"(",
"self",
")",
":",
"return",
"self",
".",
"_all_same_area",
"(",
"self",
".",
"loaded_dataset_ids",
")"
] | https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/multiscene.py#L260-L262 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/mailbox.py | python | Maildir.get_file | (self, key) | return _ProxyFile(f) | Return a file-like representation or raise a KeyError. | Return a file-like representation or raise a KeyError. | [
"Return",
"a",
"file",
"-",
"like",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | def get_file(self, key):
"""Return a file-like representation or raise a KeyError."""
f = open(os.path.join(self._path, self._lookup(key)), 'rb')
return _ProxyFile(f) | [
"def",
"get_file",
"(",
"self",
",",
"key",
")",
":",
"f",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"self",
".",
"_lookup",
"(",
"key",
")",
")",
",",
"'rb'",
")",
"return",
"_ProxyFile",
"(",
"f",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/mailbox.py#L376-L379 | |
tensorflow/data-validation | 6c68c219c5d78d3736fd011d8a7c53fbcb94379c | tensorflow_data_validation/statistics/generators/basic_stats_generator.py | python | _make_bytes_stats_proto | (bytes_stats: _PartialBytesStats,
total_num_values: int
) | return result | Convert the partial bytes statistics into BytesStatistics proto. | Convert the partial bytes statistics into BytesStatistics proto. | [
"Convert",
"the",
"partial",
"bytes",
"statistics",
"into",
"BytesStatistics",
"proto",
"."
] | def _make_bytes_stats_proto(bytes_stats: _PartialBytesStats,
total_num_values: int
) -> statistics_pb2.BytesStatistics:
"""Convert the partial bytes statistics into BytesStatistics proto."""
result = statistics_pb2.BytesStatistics()
if total_num_values > 0:
... | [
"def",
"_make_bytes_stats_proto",
"(",
"bytes_stats",
":",
"_PartialBytesStats",
",",
"total_num_values",
":",
"int",
")",
"->",
"statistics_pb2",
".",
"BytesStatistics",
":",
"result",
"=",
"statistics_pb2",
".",
"BytesStatistics",
"(",
")",
"if",
"total_num_values",... | https://github.com/tensorflow/data-validation/blob/6c68c219c5d78d3736fd011d8a7c53fbcb94379c/tensorflow_data_validation/statistics/generators/basic_stats_generator.py#L708-L718 | |
termius/termius-cli | 2664d0c70d3d682ad931b885b4965447b156c280 | termius/core/commands/base.py | python | AbstractCommand.get_parser | (self, prog_name) | return self.extend_parser(parser) | Create command line argument parser. | Create command line argument parser. | [
"Create",
"command",
"line",
"argument",
"parser",
"."
] | def get_parser(self, prog_name):
"""Create command line argument parser."""
parser = super(AbstractCommand, self).get_parser(prog_name)
parser.add_argument(
'--log-file', help='record output to FILE'
)
return self.extend_parser(parser) | [
"def",
"get_parser",
"(",
"self",
",",
"prog_name",
")",
":",
"parser",
"=",
"super",
"(",
"AbstractCommand",
",",
"self",
")",
".",
"get_parser",
"(",
"prog_name",
")",
"parser",
".",
"add_argument",
"(",
"'--log-file'",
",",
"help",
"=",
"'record output to... | https://github.com/termius/termius-cli/blob/2664d0c70d3d682ad931b885b4965447b156c280/termius/core/commands/base.py#L40-L46 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/gui/api_plugins/osquery.py | python | _ParseToCsvBytes | (
osquery_results: Iterator[rdf_osquery.OsqueryResult],) | Parses osquery results into chunks of bytes. | Parses osquery results into chunks of bytes. | [
"Parses",
"osquery",
"results",
"into",
"chunks",
"of",
"bytes",
"."
] | def _ParseToCsvBytes(
osquery_results: Iterator[rdf_osquery.OsqueryResult],) -> Iterator[bytes]:
"""Parses osquery results into chunks of bytes."""
added_columns = False
for result in osquery_results:
if not added_columns:
added_columns = True
columns = result.GetTableColumns()
yield _L... | [
"def",
"_ParseToCsvBytes",
"(",
"osquery_results",
":",
"Iterator",
"[",
"rdf_osquery",
".",
"OsqueryResult",
"]",
",",
")",
"->",
"Iterator",
"[",
"bytes",
"]",
":",
"added_columns",
"=",
"False",
"for",
"result",
"in",
"osquery_results",
":",
"if",
"not",
... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_plugins/osquery.py#L97-L108 | ||
markj3d/Red9_StudioPack | 1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919 | core/Red9_Audio.py | python | AudioNode.bwav_sync_to_dynamic | (self, tc_node, bounds=[]) | like the baw_sync_to_timecode func this will sync this audio bwav node to a given timecode
but the difference here is that that timecode is extracted dynamically from a given node,
stamped with the Red9 timecode attrs. This also supports multiple timecode takes within the
same node | like the baw_sync_to_timecode func this will sync this audio bwav node to a given timecode
but the difference here is that that timecode is extracted dynamically from a given node,
stamped with the Red9 timecode attrs. This also supports multiple timecode takes within the
same node | [
"like",
"the",
"baw_sync_to_timecode",
"func",
"this",
"will",
"sync",
"this",
"audio",
"bwav",
"node",
"to",
"a",
"given",
"timecode",
"but",
"the",
"difference",
"here",
"is",
"that",
"that",
"timecode",
"is",
"extracted",
"dynamically",
"from",
"a",
"given"... | def bwav_sync_to_dynamic(self, tc_node, bounds=[]):
'''
like the baw_sync_to_timecode func this will sync this audio bwav node to a given timecode
but the difference here is that that timecode is extracted dynamically from a given node,
stamped with the Red9 timecode attrs. This also sup... | [
"def",
"bwav_sync_to_dynamic",
"(",
"self",
",",
"tc_node",
",",
"bounds",
"=",
"[",
"]",
")",
":",
"if",
"self",
".",
"isLoaded",
"and",
"self",
".",
"pro_bwav",
"and",
"self",
".",
"pro_bwav",
".",
"isBwav",
"(",
")",
":",
"_timecode",
"=",
"self",
... | https://github.com/markj3d/Red9_StudioPack/blob/1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919/core/Red9_Audio.py#L860-L877 | ||
lad1337/XDM | 0c1b7009fe00f06f102a6f67c793478f515e7efe | site-packages/pylint/reporters/__init__.py | python | BaseReporter.set_output | (self, output=None) | set output stream | set output stream | [
"set",
"output",
"stream"
] | def set_output(self, output=None):
"""set output stream"""
self.out = output or sys.stdout
# py3k streams handle their encoding :
if sys.version_info >= (3, 0):
self.encode = lambda x: x
return
def encode(string):
if not isinstance(string, uni... | [
"def",
"set_output",
"(",
"self",
",",
"output",
"=",
"None",
")",
":",
"self",
".",
"out",
"=",
"output",
"or",
"sys",
".",
"stdout",
"# py3k streams handle their encoding :",
"if",
"sys",
".",
"version_info",
">=",
"(",
"3",
",",
"0",
")",
":",
"self",... | https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/pylint/reporters/__init__.py#L71-L89 | ||
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/api/datastore_types.py | python | Key.ToTagUri | (self) | return u'tag:%s.%s,%s:%s[%s]' % (
saxutils.escape(EncodeAppIdNamespace(self.app(), self.namespace())),
os.environ['AUTH_DOMAIN'],
datetime.date.today().isoformat(),
saxutils.escape(self.kind()),
saxutils.escape(str(self))) | Returns a tag: URI for this entity for use in XML output.
Foreign keys for entities may be represented in XML output as tag URIs.
RFC 4151 describes the tag URI scheme. From http://taguri.org/:
The tag algorithm lets people mint - create - identifiers that no one
else using the same algorithm coul... | Returns a tag: URI for this entity for use in XML output. | [
"Returns",
"a",
"tag",
":",
"URI",
"for",
"this",
"entity",
"for",
"use",
"in",
"XML",
"output",
"."
] | def ToTagUri(self):
"""Returns a tag: URI for this entity for use in XML output.
Foreign keys for entities may be represented in XML output as tag URIs.
RFC 4151 describes the tag URI scheme. From http://taguri.org/:
The tag algorithm lets people mint - create - identifiers that no one
else us... | [
"def",
"ToTagUri",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"has_id_or_name",
"(",
")",
":",
"raise",
"datastore_errors",
".",
"BadKeyError",
"(",
"'ToTagUri() called for an entity with an incomplete key.'",
")",
"return",
"u'tag:%s.%s,%s:%s[%s]'",
"%",
"(",
... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/api/datastore_types.py#L602-L633 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.