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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | example/ctp/option/ApiStruct.py | python | ExchangeExecOrderActionError.__init__ | (self, ExchangeID='', ExecOrderSysID='', TraderID='', InstallID=0, ExecOrderLocalID='', ActionLocalID='', ErrorID=0, ErrorMsg='', BrokerID='') | [] | def __init__(self, ExchangeID='', ExecOrderSysID='', TraderID='', InstallID=0, ExecOrderLocalID='', ActionLocalID='', ErrorID=0, ErrorMsg='', BrokerID=''):
self.ExchangeID = '' #交易所代码, char[9]
self.ExecOrderSysID = '' #执行宣告编号, char[21]
self.TraderID = '' #交易所交易员代码, char[21]
self.InstallI... | [
"def",
"__init__",
"(",
"self",
",",
"ExchangeID",
"=",
"''",
",",
"ExecOrderSysID",
"=",
"''",
",",
"TraderID",
"=",
"''",
",",
"InstallID",
"=",
"0",
",",
"ExecOrderLocalID",
"=",
"''",
",",
"ActionLocalID",
"=",
"''",
",",
"ErrorID",
"=",
"0",
",",
... | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/option/ApiStruct.py#L4056-L4065 | ||||
MVIG-SJTU/pointSIFT | 0c13a5e1fcd8b97ac2f3db5c60a2805d2262d2da | tf_utils/tf_util.py | python | _variable_with_weight_decay | (name, shape, stddev, wd, use_xavier=True) | return var | Helper to create an initialized Variable with weight decay.
Note that the Variable is initialized with a truncated normal distribution.
A weight decay is added only if one is specified.
Args:
name: name of the variable
shape: list of ints
stddev: standard deviation of a truncated Gaussian
wd: ad... | Helper to create an initialized Variable with weight decay. | [
"Helper",
"to",
"create",
"an",
"initialized",
"Variable",
"with",
"weight",
"decay",
"."
] | def _variable_with_weight_decay(name, shape, stddev, wd, use_xavier=True):
"""Helper to create an initialized Variable with weight decay.
Note that the Variable is initialized with a truncated normal distribution.
A weight decay is added only if one is specified.
Args:
name: name of the variable
shape... | [
"def",
"_variable_with_weight_decay",
"(",
"name",
",",
"shape",
",",
"stddev",
",",
"wd",
",",
"use_xavier",
"=",
"True",
")",
":",
"if",
"use_xavier",
":",
"initializer",
"=",
"tf",
".",
"contrib",
".",
"layers",
".",
"xavier_initializer",
"(",
")",
"els... | https://github.com/MVIG-SJTU/pointSIFT/blob/0c13a5e1fcd8b97ac2f3db5c60a2805d2262d2da/tf_utils/tf_util.py#L24-L49 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/commtrack/sms.py | python | process_transactions | (E, transactions) | return process_balances(E, balances), process_transfers(E, transfers) | [] | def process_transactions(E, transactions):
balances = []
transfers = []
for tx in transactions:
if tx.action in (
const.StockActions.STOCKONHAND,
const.StockActions.STOCKOUT,
):
balances.append(tx)
else:
transfers.append(tx)
retur... | [
"def",
"process_transactions",
"(",
"E",
",",
"transactions",
")",
":",
"balances",
"=",
"[",
"]",
"transfers",
"=",
"[",
"]",
"for",
"tx",
"in",
"transactions",
":",
"if",
"tx",
".",
"action",
"in",
"(",
"const",
".",
"StockActions",
".",
"STOCKONHAND",... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/commtrack/sms.py#L232-L245 | |||
hasegaw/IkaLog | bd476da541fcc296f792d4db76a6b9174c4777ad | ikalog/inputs/opencv_videocapture.py | python | CVCapture._select_device_by_name_func | (self, source) | [] | def _select_device_by_name_func(self, source):
IkaUtils.dprint('%s: Select device by name "%s"' % (self, source))
try:
index = self.enumerate_sources().index(source)
except ValueError:
IkaUtils.dprint('%s: Input "%s" not found' % (self, source))
return False
... | [
"def",
"_select_device_by_name_func",
"(",
"self",
",",
"source",
")",
":",
"IkaUtils",
".",
"dprint",
"(",
"'%s: Select device by name \"%s\"'",
"%",
"(",
"self",
",",
"source",
")",
")",
"try",
":",
"index",
"=",
"self",
".",
"enumerate_sources",
"(",
")",
... | https://github.com/hasegaw/IkaLog/blob/bd476da541fcc296f792d4db76a6b9174c4777ad/ikalog/inputs/opencv_videocapture.py#L88-L98 | ||||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/pip/pip/_internal/commands/cache.py | python | CacheCommand.format_for_abspath | (self, files) | [] | def format_for_abspath(self, files):
# type: (List[str]) -> None
if not files:
return
results = []
for filename in files:
results.append(filename)
logger.info('\n'.join(sorted(results))) | [
"def",
"format_for_abspath",
"(",
"self",
",",
"files",
")",
":",
"# type: (List[str]) -> None",
"if",
"not",
"files",
":",
"return",
"results",
"=",
"[",
"]",
"for",
"filename",
"in",
"files",
":",
"results",
".",
"append",
"(",
"filename",
")",
"logger",
... | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_internal/commands/cache.py#L163-L172 | ||||
hauntsaninja/pyp | eb78ee7d0ff17d37eca87efd52197a24e5e3304f | pyp.py | python | NameFinder.visit_FunctionDef | (self, node: ast.FunctionDef) | [] | def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
self.flexible_visit(node.decorator_list)
self.visit_function_helper(node, node.name) | [
"def",
"visit_FunctionDef",
"(",
"self",
",",
"node",
":",
"ast",
".",
"FunctionDef",
")",
"->",
"None",
":",
"self",
".",
"flexible_visit",
"(",
"node",
".",
"decorator_list",
")",
"self",
".",
"visit_function_helper",
"(",
"node",
",",
"node",
".",
"name... | https://github.com/hauntsaninja/pyp/blob/eb78ee7d0ff17d37eca87efd52197a24e5e3304f/pyp.py#L152-L154 | ||||
sidewalklabs/s2sphere | d1d067e8c06e5fbaf0cc0158bade947b4a03a438 | s2sphere/sphere.py | python | Cell.exact_area | (self) | return area(v0, v1, v2) + area(v0, v2, v3) | cell area in steradians accurate to 6 digits but slow to compute
Return the area of this cell as accurately as possible. This method is
more expensive but it is accurate to 6 digits of precision even for
leaf cells (whose area is approximately 1e-18). | cell area in steradians accurate to 6 digits but slow to compute | [
"cell",
"area",
"in",
"steradians",
"accurate",
"to",
"6",
"digits",
"but",
"slow",
"to",
"compute"
] | def exact_area(self):
"""cell area in steradians accurate to 6 digits but slow to compute
Return the area of this cell as accurately as possible. This method is
more expensive but it is accurate to 6 digits of precision even for
leaf cells (whose area is approximately 1e-18).
"... | [
"def",
"exact_area",
"(",
"self",
")",
":",
"v0",
"=",
"self",
".",
"get_vertex",
"(",
"0",
")",
"v1",
"=",
"self",
".",
"get_vertex",
"(",
"1",
")",
"v2",
"=",
"self",
".",
"get_vertex",
"(",
"2",
")",
"v3",
"=",
"self",
".",
"get_vertex",
"(",
... | https://github.com/sidewalklabs/s2sphere/blob/d1d067e8c06e5fbaf0cc0158bade947b4a03a438/s2sphere/sphere.py#L2432-L2443 | |
mahmoud/boltons | 270e974975984f662f998c8f6eb0ebebd964de82 | boltons/dictutils.py | python | ManyToMany.__eq__ | (self, other) | return type(self) == type(other) and self.data == other.data | [] | def __eq__(self, other):
return type(self) == type(other) and self.data == other.data | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"type",
"(",
"self",
")",
"==",
"type",
"(",
"other",
")",
"and",
"self",
".",
"data",
"==",
"other",
".",
"data"
] | https://github.com/mahmoud/boltons/blob/270e974975984f662f998c8f6eb0ebebd964de82/boltons/dictutils.py#L1012-L1013 | |||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | api_client/python/grr_api_client/utils.py | python | UrnStringToHuntId | (urn: str) | return components[-1] | Converts given URN string to a flow id string. | Converts given URN string to a flow id string. | [
"Converts",
"given",
"URN",
"string",
"to",
"a",
"flow",
"id",
"string",
"."
] | def UrnStringToHuntId(urn: str) -> str:
"""Converts given URN string to a flow id string."""
if urn.startswith(AFF4_PREFIX):
urn = urn[len(AFF4_PREFIX):]
components = urn.split("/")
if len(components) != 2 or components[0] != "hunts":
raise ValueError("Invalid hunt URN: %s" % urn)
return components[... | [
"def",
"UrnStringToHuntId",
"(",
"urn",
":",
"str",
")",
"->",
"str",
":",
"if",
"urn",
".",
"startswith",
"(",
"AFF4_PREFIX",
")",
":",
"urn",
"=",
"urn",
"[",
"len",
"(",
"AFF4_PREFIX",
")",
":",
"]",
"components",
"=",
"urn",
".",
"split",
"(",
... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/api_client/python/grr_api_client/utils.py#L153-L162 | |
EmilyAlsentzer/clinicalBERT | a9d91698929b7189311bba364ccdd0360e847276 | downstream_tasks/run_ner.py | python | DataProcessor.get_dev_examples | (self, data_dir) | Gets a collection of `InputExample`s for the dev set. | Gets a collection of `InputExample`s for the dev set. | [
"Gets",
"a",
"collection",
"of",
"InputExample",
"s",
"for",
"the",
"dev",
"set",
"."
] | def get_dev_examples(self, data_dir):
"""Gets a collection of `InputExample`s for the dev set."""
raise NotImplementedError() | [
"def",
"get_dev_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/EmilyAlsentzer/clinicalBERT/blob/a9d91698929b7189311bba364ccdd0360e847276/downstream_tasks/run_ner.py#L164-L166 | ||
Esri/ArcREST | ab240fde2b0200f61d4a5f6df033516e53f2f416 | src/arcrest/webmap/symbols.py | python | PictureFillSymbol.asDictionary | (self) | return template | returns the object as a dictionary | returns the object as a dictionary | [
"returns",
"the",
"object",
"as",
"a",
"dictionary"
] | def asDictionary(self):
""" returns the object as a dictionary """
template = {
"type" : "esriPMS",
"url" : self._url,
"imageData" : self._imageDate,
"contentType" : self._contentType,
"width" : self._width,
"height" : self._height,... | [
"def",
"asDictionary",
"(",
"self",
")",
":",
"template",
"=",
"{",
"\"type\"",
":",
"\"esriPMS\"",
",",
"\"url\"",
":",
"self",
".",
"_url",
",",
"\"imageData\"",
":",
"self",
".",
"_imageDate",
",",
"\"contentType\"",
":",
"self",
".",
"_contentType",
",... | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/symbols.py#L540-L556 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/ecovacs/vacuum.py | python | EcovacsVacuum.__init__ | (self, device) | Initialize the Ecovacs Vacuum. | Initialize the Ecovacs Vacuum. | [
"Initialize",
"the",
"Ecovacs",
"Vacuum",
"."
] | def __init__(self, device):
"""Initialize the Ecovacs Vacuum."""
self.device = device
self.device.connect_and_wait_until_ready()
if self.device.vacuum.get("nick") is not None:
self._name = str(self.device.vacuum["nick"])
else:
# In case there is no nicknam... | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"self",
".",
"device",
"=",
"device",
"self",
".",
"device",
".",
"connect_and_wait_until_ready",
"(",
")",
"if",
"self",
".",
"device",
".",
"vacuum",
".",
"get",
"(",
"\"nick\"",
")",
"is",
"no... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/ecovacs/vacuum.py#L64-L76 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/shutil.py | python | move | (src, dst, copy_function=copy2) | return real_dst | Recursively move a file or directory to another location. This is
similar to the Unix "mv" command. Return the file or directory's
destination.
If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The destination path must not already
exist.
... | Recursively move a file or directory to another location. This is
similar to the Unix "mv" command. Return the file or directory's
destination. | [
"Recursively",
"move",
"a",
"file",
"or",
"directory",
"to",
"another",
"location",
".",
"This",
"is",
"similar",
"to",
"the",
"Unix",
"mv",
"command",
".",
"Return",
"the",
"file",
"or",
"directory",
"s",
"destination",
"."
] | def move(src, dst, copy_function=copy2):
"""Recursively move a file or directory to another location. This is
similar to the Unix "mv" command. Return the file or directory's
destination.
If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The de... | [
"def",
"move",
"(",
"src",
",",
"dst",
",",
"copy_function",
"=",
"copy2",
")",
":",
"real_dst",
"=",
"dst",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"if",
"_samefile",
"(",
"src",
",",
"dst",
")",
":",
"# We might be on a case in... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/shutil.py#L500-L554 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/plexapi/media.py | python | BaseImage._loadData | (self, data) | [] | def _loadData(self, data):
self._data = data
self.key = data.attrib.get('key')
self.provider = data.attrib.get('provider')
self.ratingKey = data.attrib.get('ratingKey')
self.selected = utils.cast(bool, data.attrib.get('selected'))
self.thumb = data.attrib.get('thumb') | [
"def",
"_loadData",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_data",
"=",
"data",
"self",
".",
"key",
"=",
"data",
".",
"attrib",
".",
"get",
"(",
"'key'",
")",
"self",
".",
"provider",
"=",
"data",
".",
"attrib",
".",
"get",
"(",
"'prov... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/plexapi/media.py#L932-L938 | ||||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1beta1_event.py | python | V1beta1Event.kind | (self) | return self._kind | Gets the kind of this V1beta1Event. # noqa: E501
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/a... | Gets the kind of this V1beta1Event. # noqa: E501 | [
"Gets",
"the",
"kind",
"of",
"this",
"V1beta1Event",
".",
"#",
"noqa",
":",
"E501"
] | def kind(self):
"""Gets the kind of this V1beta1Event. # noqa: E501
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributo... | [
"def",
"kind",
"(",
"self",
")",
":",
"return",
"self",
".",
"_kind"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1beta1_event.py#L296-L304 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/string.py | python | find | (s, *args) | return s.find(*args) | find(s, sub [,start [,end]]) -> in
Return the lowest index in s where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure. | find(s, sub [,start [,end]]) -> in | [
"find",
"(",
"s",
"sub",
"[",
"start",
"[",
"end",
"]]",
")",
"-",
">",
"in"
] | def find(s, *args):
"""find(s, sub [,start [,end]]) -> in
Return the lowest index in s where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
"""
return s.find(*args) | [
"def",
"find",
"(",
"s",
",",
"*",
"args",
")",
":",
"return",
"s",
".",
"find",
"(",
"*",
"args",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/string.py#L353-L363 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/states/zabbix_host.py | python | present | (host, groups, interfaces, **kwargs) | return ret | Ensures that the host exists, eventually creates new host.
NOTE: please use argument visible_name instead of name to not mess with name from salt sls. This function accepts
all standard host properties: keyword argument names differ depending on your zabbix version, see:
https://www.zabbix.com/documentation... | Ensures that the host exists, eventually creates new host.
NOTE: please use argument visible_name instead of name to not mess with name from salt sls. This function accepts
all standard host properties: keyword argument names differ depending on your zabbix version, see:
https://www.zabbix.com/documentation... | [
"Ensures",
"that",
"the",
"host",
"exists",
"eventually",
"creates",
"new",
"host",
".",
"NOTE",
":",
"please",
"use",
"argument",
"visible_name",
"instead",
"of",
"name",
"to",
"not",
"mess",
"with",
"name",
"from",
"salt",
"sls",
".",
"This",
"function",
... | def present(host, groups, interfaces, **kwargs):
"""
Ensures that the host exists, eventually creates new host.
NOTE: please use argument visible_name instead of name to not mess with name from salt sls. This function accepts
all standard host properties: keyword argument names differ depending on your ... | [
"def",
"present",
"(",
"host",
",",
"groups",
",",
"interfaces",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_args",
"=",
"{",
"}",
"if",
"\"_connection_user\"",
"in",
"kwargs",
":",
"connection_args",
"[",
"\"_connection_user\"",
"]",
"=",
"kwargs",
".",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/states/zabbix_host.py#L25-L536 | |
MDudek-ICS/TRISIS-TRITON-HATMAN | 15a00af7fd1040f0430729d024427601f84886a1 | decompiled_code/library/logging/__init__.py | python | Logger.log | (self, level, msg, *args, **kwargs) | Log 'msg % args' with the integer severity 'level'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1) | Log 'msg % args' with the integer severity 'level'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1) | [
"Log",
"msg",
"%",
"args",
"with",
"the",
"integer",
"severity",
"level",
".",
"To",
"pass",
"exception",
"information",
"use",
"the",
"keyword",
"argument",
"exc_info",
"with",
"a",
"true",
"value",
"e",
".",
"g",
".",
"logger",
".",
"log",
"(",
"level"... | def log(self, level, msg, *args, **kwargs):
"""
Log 'msg % args' with the integer severity 'level'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
... | [
"def",
"log",
"(",
"self",
",",
"level",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"level",
",",
"int",
")",
":",
"if",
"raiseExceptions",
":",
"raise",
"TypeError",
"(",
"'level must be an integer... | https://github.com/MDudek-ICS/TRISIS-TRITON-HATMAN/blob/15a00af7fd1040f0430729d024427601f84886a1/decompiled_code/library/logging/__init__.py#L1107-L1122 | ||
tpircher/pycrc | 240d4509e8592c7ee60aaed8a068351cf71c25fc | pycrc/expr.py | python | Add.simplify | (self) | return Add(lhs, rhs) | Return a simplified version of this sub-expression. | Return a simplified version of this sub-expression. | [
"Return",
"a",
"simplified",
"version",
"of",
"this",
"sub",
"-",
"expression",
"."
] | def simplify(self):
"""
Return a simplified version of this sub-expression.
"""
lhs = self.lhs.simplify()
rhs = self.rhs.simplify()
if lhs.is_int() and rhs.is_int():
return Terminal(lhs.val + rhs.val)
if lhs.is_int(0):
return rhs
if... | [
"def",
"simplify",
"(",
"self",
")",
":",
"lhs",
"=",
"self",
".",
"lhs",
".",
"simplify",
"(",
")",
"rhs",
"=",
"self",
".",
"rhs",
".",
"simplify",
"(",
")",
"if",
"lhs",
".",
"is_int",
"(",
")",
"and",
"rhs",
".",
"is_int",
"(",
")",
":",
... | https://github.com/tpircher/pycrc/blob/240d4509e8592c7ee60aaed8a068351cf71c25fc/pycrc/expr.py#L156-L168 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_router.py | python | Yedit.separator | (self) | return self._separator | getter method for separator | getter method for separator | [
"getter",
"method",
"for",
"separator"
] | def separator(self):
''' getter method for separator '''
return self._separator | [
"def",
"separator",
"(",
"self",
")",
":",
"return",
"self",
".",
"_separator"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_router.py#L306-L308 | |
determined-ai/determined | f637264493acc14f12e66550cb51c520b5d27f6c | examples/tutorials/fashion_mnist_tf_keras/data.py | python | load_validation_data | () | return x_test, y_test | Loads the Fashion-MNIST dataset.
Returns:
Tuple of Numpy arrays: `(x_test, y_test)`.
License:
The copyright for Fashion-MNIST is held by Zalando SE.
Fashion-MNIST is licensed under the [MIT license](
https://github.com/zalandoresearch/fashion-mnist/blob/master/LICENSE). | Loads the Fashion-MNIST dataset. | [
"Loads",
"the",
"Fashion",
"-",
"MNIST",
"dataset",
"."
] | def load_validation_data():
"""Loads the Fashion-MNIST dataset.
Returns:
Tuple of Numpy arrays: `(x_test, y_test)`.
License:
The copyright for Fashion-MNIST is held by Zalando SE.
Fashion-MNIST is licensed under the [MIT license](
https://github.com/zalandoresearch/fashion-... | [
"def",
"load_validation_data",
"(",
")",
":",
"download_directory",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"base",
"=",
"\"https://storage.googleapis.com/tensorflow/tf-keras-datasets/\"",
"files",
"=",
"[",
"\"t10k-labels-idx1-ubyte.gz\"",
",",
"\"t10k-images-idx3-ubyte.g... | https://github.com/determined-ai/determined/blob/f637264493acc14f12e66550cb51c520b5d27f6c/examples/tutorials/fashion_mnist_tf_keras/data.py#L50-L79 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/pickletools.py | python | read_decimalnl_short | (f) | r"""
>>> import StringIO
>>> read_decimalnl_short(StringIO.StringIO("1234\n56"))
1234
>>> read_decimalnl_short(StringIO.StringIO("1234L\n56"))
Traceback (most recent call last):
...
ValueError: trailing 'L' not allowed in '1234L' | r"""
>>> import StringIO
>>> read_decimalnl_short(StringIO.StringIO("1234\n56"))
1234 | [
"r",
">>>",
"import",
"StringIO",
">>>",
"read_decimalnl_short",
"(",
"StringIO",
".",
"StringIO",
"(",
"1234",
"\\",
"n56",
"))",
"1234"
] | def read_decimalnl_short(f):
r"""
>>> import StringIO
>>> read_decimalnl_short(StringIO.StringIO("1234\n56"))
1234
>>> read_decimalnl_short(StringIO.StringIO("1234L\n56"))
Traceback (most recent call last):
...
ValueError: trailing 'L' not allowed in '1234L'
"""
s = read_string... | [
"def",
"read_decimalnl_short",
"(",
"f",
")",
":",
"s",
"=",
"read_stringnl",
"(",
"f",
",",
"decode",
"=",
"False",
",",
"stripquotes",
"=",
"False",
")",
"if",
"s",
".",
"endswith",
"(",
"\"L\"",
")",
":",
"raise",
"ValueError",
"(",
"\"trailing 'L' no... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/pickletools.py#L486-L513 | ||
sawcordwell/pymdptoolbox | 7c96789cc80e280437005c12065cf70266c11636 | src/examples/tictactoe.py | python | getTransitionProbabilities | (state, action) | return(s1, p, 0) | Parameters
----------
state : tuple
The state
action : int
The action
Returns
-------
s1, p, r : tuple of two lists and an int
s1 are the next states, p are the probabilities, and r is the reward | Parameters
----------
state : tuple
The state
action : int
The action
Returns
-------
s1, p, r : tuple of two lists and an int
s1 are the next states, p are the probabilities, and r is the reward | [
"Parameters",
"----------",
"state",
":",
"tuple",
"The",
"state",
"action",
":",
"int",
"The",
"action",
"Returns",
"-------",
"s1",
"p",
"r",
":",
"tuple",
"of",
"two",
"lists",
"and",
"an",
"int",
"s1",
"are",
"the",
"next",
"states",
"p",
"are",
"t... | def getTransitionProbabilities(state, action):
"""
Parameters
----------
state : tuple
The state
action : int
The action
Returns
-------
s1, p, r : tuple of two lists and an int
s1 are the next states, p are the probabilities, and r is the reward
"""... | [
"def",
"getTransitionProbabilities",
"(",
"state",
",",
"action",
")",
":",
"#assert isValid(state)",
"assert",
"0",
"<=",
"action",
"<",
"ACTIONS",
"if",
"not",
"isLegal",
"(",
"state",
",",
"action",
")",
":",
"# If the action is illegal, then transition back to the... | https://github.com/sawcordwell/pymdptoolbox/blob/7c96789cc80e280437005c12065cf70266c11636/src/examples/tictactoe.py#L72-L126 | |
nsacyber/WALKOFF | 52d3311abe99d64cd2a902eb998c5e398efe0e07 | common/walkoff_client/walkoff_client/models/trigger.py | python | Trigger.label | (self, label) | Sets the label of this Trigger.
The user defined name of the trigger # noqa: E501
:param label: The label of this Trigger. # noqa: E501
:type: str | Sets the label of this Trigger. | [
"Sets",
"the",
"label",
"of",
"this",
"Trigger",
"."
] | def label(self, label):
"""Sets the label of this Trigger.
The user defined name of the trigger # noqa: E501
:param label: The label of this Trigger. # noqa: E501
:type: str
"""
if label is None:
raise ValueError("Invalid value for `label`, must not be `No... | [
"def",
"label",
"(",
"self",
",",
"label",
")",
":",
"if",
"label",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `label`, must not be `None`\"",
")",
"# noqa: E501",
"self",
".",
"_label",
"=",
"label"
] | https://github.com/nsacyber/WALKOFF/blob/52d3311abe99d64cd2a902eb998c5e398efe0e07/common/walkoff_client/walkoff_client/models/trigger.py#L249-L260 | ||
withdk/badusb2-mitm-poc | db2bfdb1dc9ad371aa665b292183c45577adfbaa | GoodFET.py | python | GoodFET.setBaud | (self,baud) | return | Change the baud rate. TODO fix this. | Change the baud rate. TODO fix this. | [
"Change",
"the",
"baud",
"rate",
".",
"TODO",
"fix",
"this",
"."
] | def setBaud(self,baud):
"""Change the baud rate. TODO fix this."""
rates=self.baudrates;
self.data=[baud];
print "Changing FET baud."
self.serialport.write(chr(0x00));
self.serialport.write(chr(0x80));
self.serialport.write(chr(1));
self.serialport.write(... | [
"def",
"setBaud",
"(",
"self",
",",
"baud",
")",
":",
"rates",
"=",
"self",
".",
"baudrates",
"self",
".",
"data",
"=",
"[",
"baud",
"]",
"print",
"\"Changing FET baud.\"",
"self",
".",
"serialport",
".",
"write",
"(",
"chr",
"(",
"0x00",
")",
")",
"... | https://github.com/withdk/badusb2-mitm-poc/blob/db2bfdb1dc9ad371aa665b292183c45577adfbaa/GoodFET.py#L644-L661 | |
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/parsers/csgo.py | python | CsgoParser.getClient | (self, cid) | return None | Return an already connected client by searching the clients cid index.
May return None | Return an already connected client by searching the clients cid index.
May return None | [
"Return",
"an",
"already",
"connected",
"client",
"by",
"searching",
"the",
"clients",
"cid",
"index",
".",
"May",
"return",
"None"
] | def getClient(self, cid):
"""
Return an already connected client by searching the clients cid index.
May return None
"""
client = self.clients.getByCID(cid)
if client:
return client
return None | [
"def",
"getClient",
"(",
"self",
",",
"cid",
")",
":",
"client",
"=",
"self",
".",
"clients",
".",
"getByCID",
"(",
"cid",
")",
"if",
"client",
":",
"return",
"client",
"return",
"None"
] | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/parsers/csgo.py#L795-L803 | |
Yonsm/.homeassistant | 4d9a0070d0fcd8a5ded46e7884da9a4494bbbf26 | extras/homeassistant/loader.py | python | Integration.disabled | (self) | return self.manifest.get("disabled") | Return reason integration is disabled. | Return reason integration is disabled. | [
"Return",
"reason",
"integration",
"is",
"disabled",
"."
] | def disabled(self) -> str | None:
"""Return reason integration is disabled."""
return self.manifest.get("disabled") | [
"def",
"disabled",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"self",
".",
"manifest",
".",
"get",
"(",
"\"disabled\"",
")"
] | https://github.com/Yonsm/.homeassistant/blob/4d9a0070d0fcd8a5ded46e7884da9a4494bbbf26/extras/homeassistant/loader.py#L357-L359 | |
BerkeleyAutomation/dex-net | cccf93319095374b0eefc24b8b6cd40bc23966d2 | src/dexnet/learning/models.py | python | Model.snapshot | (self) | Returns a concise description of the current model for debugging and logging purposes | Returns a concise description of the current model for debugging and logging purposes | [
"Returns",
"a",
"concise",
"description",
"of",
"the",
"current",
"model",
"for",
"debugging",
"and",
"logging",
"purposes"
] | def snapshot(self):
"""
Returns a concise description of the current model for debugging and logging purposes
"""
pass | [
"def",
"snapshot",
"(",
"self",
")",
":",
"pass"
] | https://github.com/BerkeleyAutomation/dex-net/blob/cccf93319095374b0eefc24b8b6cd40bc23966d2/src/dexnet/learning/models.py#L60-L64 | ||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/storage/memory_mixins/regioned_memory/region_data.py | python | RegionMap.relativize | (self, absolute_address, target_region_id=None) | return descriptor.region_id, absolute_address - base_address, descriptor.related_function_address | Convert an absolute address to the memory offset in a memory region.
Note that if an address belongs to heap region is passed in to a stack region map, it will be converted to an
offset included in the closest stack frame, and vice versa for passing a stack address to a heap region.
Therefore y... | Convert an absolute address to the memory offset in a memory region. | [
"Convert",
"an",
"absolute",
"address",
"to",
"the",
"memory",
"offset",
"in",
"a",
"memory",
"region",
"."
] | def relativize(self, absolute_address, target_region_id=None):
"""
Convert an absolute address to the memory offset in a memory region.
Note that if an address belongs to heap region is passed in to a stack region map, it will be converted to an
offset included in the closest stack fram... | [
"def",
"relativize",
"(",
"self",
",",
"absolute_address",
",",
"target_region_id",
"=",
"None",
")",
":",
"if",
"target_region_id",
"is",
"None",
":",
"if",
"self",
".",
"is_stack",
":",
"# Get the base address of the stack frame it belongs to",
"base_address",
"=",
... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/storage/memory_mixins/regioned_memory/region_data.py#L202-L242 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/conch/ssh/transport.py | python | SSHClientTransport._continueKEXDH_REPLY | (self, ignored, pubKey, f, signature) | The host key has been verified, so we generate the keys.
@param pubKey: the public key blob for the server's public key.
@type pubKey: C{str}
@param f: the server's Diffie-Hellman public key.
@type f: C{long}
@param signature: the server's signature, verifying that it has the
... | The host key has been verified, so we generate the keys. | [
"The",
"host",
"key",
"has",
"been",
"verified",
"so",
"we",
"generate",
"the",
"keys",
"."
] | def _continueKEXDH_REPLY(self, ignored, pubKey, f, signature):
"""
The host key has been verified, so we generate the keys.
@param pubKey: the public key blob for the server's public key.
@type pubKey: C{str}
@param f: the server's Diffie-Hellman public key.
@type f: C{l... | [
"def",
"_continueKEXDH_REPLY",
"(",
"self",
",",
"ignored",
",",
"pubKey",
",",
"f",
",",
"signature",
")",
":",
"serverKey",
"=",
"keys",
".",
"Key",
".",
"fromString",
"(",
"pubKey",
")",
"sharedSecret",
"=",
"_MPpow",
"(",
"f",
",",
"self",
".",
"x"... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/conch/ssh/transport.py#L999-L1027 | ||
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/eos_alpha_functions.py | python | Harmens_Knapp_alpha_pure | (T, Tc, c1, c2) | return (c1*(-sqrt(T/Tc) + 1) - c2*(1 - Tc/T) + 1)**2 | [] | def Harmens_Knapp_alpha_pure(T, Tc, c1, c2):
return (c1*(-sqrt(T/Tc) + 1) - c2*(1 - Tc/T) + 1)**2 | [
"def",
"Harmens_Knapp_alpha_pure",
"(",
"T",
",",
"Tc",
",",
"c1",
",",
"c2",
")",
":",
"return",
"(",
"c1",
"*",
"(",
"-",
"sqrt",
"(",
"T",
"/",
"Tc",
")",
"+",
"1",
")",
"-",
"c2",
"*",
"(",
"1",
"-",
"Tc",
"/",
"T",
")",
"+",
"1",
")"... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/eos_alpha_functions.py#L1273-L1274 | |||
google/fplutil | ac0118ad7fedf054c2645efdb13f52788c183d12 | bin/android_ndk_perf.py | python | run_perf_visualizer | (browser, perf_args, adb_device, output_filename,
frames, verbose) | Generate the visualized html.
Args:
browser: The browser to use for display, if this is an empty string
no browser is open.
perf_args: PerfArgs instance which contains arguments used to run the
visualizer.
adb_device: Device used to determine which perf binary should be used.
output_filen... | Generate the visualized html. | [
"Generate",
"the",
"visualized",
"html",
"."
] | def run_perf_visualizer(browser, perf_args, adb_device, output_filename,
frames, verbose):
"""Generate the visualized html.
Args:
browser: The browser to use for display, if this is an empty string
no browser is open.
perf_args: PerfArgs instance which contains arguments used ... | [
"def",
"run_perf_visualizer",
"(",
"browser",
",",
"perf_args",
",",
"adb_device",
",",
"output_filename",
",",
"frames",
",",
"verbose",
")",
":",
"perf_host",
"=",
"find_host_binary",
"(",
"PERFHOST_BINARY",
",",
"adb_device",
")",
"perf_to_tracing",
"=",
"find_... | https://github.com/google/fplutil/blob/ac0118ad7fedf054c2645efdb13f52788c183d12/bin/android_ndk_perf.py#L2176-L2239 | ||
gavinlyonsrepo/RpiMotorLib | fd166f1c6501d9c8ee18f57fa81329445ce244c8 | RpiMotorLib/rpi_dc_lib.py | python | TB6612FNGDc.cleanup | (self, clean_up=False) | cleanup all GPIO connections used in event of error by lib user | cleanup all GPIO connections used in event of error by lib user | [
"cleanup",
"all",
"GPIO",
"connections",
"used",
"in",
"event",
"of",
"error",
"by",
"lib",
"user"
] | def cleanup(self, clean_up=False):
""" cleanup all GPIO connections used in event of error by lib user"""
if self.verbose:
print("rpi_dc_lib.py : Cleaning up : {}".format(self.name))
GPIO.output(self.pin_one, False)
GPIO.output(self.pin_two, False)
self.my_pwm.ChangeD... | [
"def",
"cleanup",
"(",
"self",
",",
"clean_up",
"=",
"False",
")",
":",
"if",
"self",
".",
"verbose",
":",
"print",
"(",
"\"rpi_dc_lib.py : Cleaning up : {}\"",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"GPIO",
".",
"output",
"(",
"self",
".",
... | https://github.com/gavinlyonsrepo/RpiMotorLib/blob/fd166f1c6501d9c8ee18f57fa81329445ce244c8/RpiMotorLib/rpi_dc_lib.py#L327-L335 | ||
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/IPy/IPy.py | python | IP.v46map | (self) | Returns the IPv6 mapped address of an IPv4 address, or the corresponding
IPv4 address if the IPv6 address is in the appropriate range.
Raises a ValueError if the IPv6 address is not translatable. See RFC 4291.
>>> IP('192.168.1.1').v46map()
IP('::ffff:192.168.1.1')
>>> IP('::fff... | Returns the IPv6 mapped address of an IPv4 address, or the corresponding
IPv4 address if the IPv6 address is in the appropriate range.
Raises a ValueError if the IPv6 address is not translatable. See RFC 4291. | [
"Returns",
"the",
"IPv6",
"mapped",
"address",
"of",
"an",
"IPv4",
"address",
"or",
"the",
"corresponding",
"IPv4",
"address",
"if",
"the",
"IPv6",
"address",
"is",
"in",
"the",
"appropriate",
"range",
".",
"Raises",
"a",
"ValueError",
"if",
"the",
"IPv6",
... | def v46map(self):
"""
Returns the IPv6 mapped address of an IPv4 address, or the corresponding
IPv4 address if the IPv6 address is in the appropriate range.
Raises a ValueError if the IPv6 address is not translatable. See RFC 4291.
>>> IP('192.168.1.1').v46map()
IP('::ff... | [
"def",
"v46map",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ipversion",
"==",
"4",
":",
"return",
"IP",
"(",
"str",
"(",
"IPV6_MAP_MASK",
"+",
"self",
".",
"ip",
")",
"+",
"\"/%s\"",
"%",
"(",
"self",
".",
"_prefixlen",
"+",
"96",
")",
")",
"els... | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/IPy/IPy.py#L999-L1018 | ||
joelgrus/data-science-from-scratch | d5d0f117f41b3ccab3b07f1ee1fa21cfcf69afa1 | first-edition/code-python3/introduction.py | python | predict_paid_or_unpaid | (years_experience) | [] | def predict_paid_or_unpaid(years_experience):
if years_experience < 3.0: return "paid"
elif years_experience < 8.5: return "unpaid"
else: return "paid" | [
"def",
"predict_paid_or_unpaid",
"(",
"years_experience",
")",
":",
"if",
"years_experience",
"<",
"3.0",
":",
"return",
"\"paid\"",
"elif",
"years_experience",
"<",
"8.5",
":",
"return",
"\"unpaid\"",
"else",
":",
"return",
"\"paid\""
] | https://github.com/joelgrus/data-science-from-scratch/blob/d5d0f117f41b3ccab3b07f1ee1fa21cfcf69afa1/first-edition/code-python3/introduction.py#L179-L182 | ||||
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/pydoc.py | python | HTMLDoc.modulelink | (self, object) | return '<a href="%s.html">%s</a>' % (object.__name__, object.__name__) | Make a link for a module. | Make a link for a module. | [
"Make",
"a",
"link",
"for",
"a",
"module",
"."
] | def modulelink(self, object):
"""Make a link for a module."""
return '<a href="%s.html">%s</a>' % (object.__name__, object.__name__) | [
"def",
"modulelink",
"(",
"self",
",",
"object",
")",
":",
"return",
"'<a href=\"%s.html\">%s</a>'",
"%",
"(",
"object",
".",
"__name__",
",",
"object",
".",
"__name__",
")"
] | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/pydoc.py#L565-L567 | |
volatilityfoundation/volatility | a438e768194a9e05eb4d9ee9338b881c0fa25937 | volatility/renderers/dot.py | python | DotRenderer.render | (self, outfd, grid) | Renders the TreeGrid in data out to the output file from the config options | Renders the TreeGrid in data out to the output file from the config options | [
"Renders",
"the",
"TreeGrid",
"in",
"data",
"out",
"to",
"the",
"output",
"file",
"from",
"the",
"config",
"options"
] | def render(self, outfd, grid):
"""Renders the TreeGrid in data out to the output file from the config options"""
self._columns = grid.columns
self._text_cell_renderers = self._text_cell_renderers_func(self._columns)
if grid.max_depth() <= 1:
debug.warning("Dot output will be... | [
"def",
"render",
"(",
"self",
",",
"outfd",
",",
"grid",
")",
":",
"self",
".",
"_columns",
"=",
"grid",
".",
"columns",
"self",
".",
"_text_cell_renderers",
"=",
"self",
".",
"_text_cell_renderers_func",
"(",
"self",
".",
"_columns",
")",
"if",
"grid",
... | https://github.com/volatilityfoundation/volatility/blob/a438e768194a9e05eb4d9ee9338b881c0fa25937/volatility/renderers/dot.py#L28-L37 | ||
djblets/djblets | 0496e1ec49e43d43d776768c9fc5b6f8af56ec2c | djblets/conditions/values.py | python | ConditionValueIntegerField.__init__ | (self, **field_kwargs) | Initialize the value field.
Args:
**field_kwargs (dict):
Keyword arguments to pass to the
:py:class:`~django.forms.fields.IntegerField` constructor. | Initialize the value field. | [
"Initialize",
"the",
"value",
"field",
"."
] | def __init__(self, **field_kwargs):
"""Initialize the value field.
Args:
**field_kwargs (dict):
Keyword arguments to pass to the
:py:class:`~django.forms.fields.IntegerField` constructor.
"""
super(ConditionValueIntegerField, self).__init__(
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"field_kwargs",
")",
":",
"super",
"(",
"ConditionValueIntegerField",
",",
"self",
")",
".",
"__init__",
"(",
"field",
"=",
"forms",
".",
"IntegerField",
"(",
"*",
"*",
"field_kwargs",
")",
")"
] | https://github.com/djblets/djblets/blob/0496e1ec49e43d43d776768c9fc5b6f8af56ec2c/djblets/conditions/values.py#L403-L412 | ||
OpenEndedGroup/Field | 4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c | Contents/lib/python/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/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/distutils/command/install_egg_info.py#L63-L70 | |
dephell/dephell | de96f01fcfd8dd620b049369a8ec30dde566c5de | install.py | python | Context.install_dephell | (self) | [] | def install_dephell(self):
if self.args.branch:
name = 'git+https://github.com/{slug}.git@{branch}#egg=dephell[full]'
name = name.format(
slug=self.args.slug,
branch=self.args.version or self.args.branch,
)
elif self.args.version:
... | [
"def",
"install_dephell",
"(",
"self",
")",
":",
"if",
"self",
".",
"args",
".",
"branch",
":",
"name",
"=",
"'git+https://github.com/{slug}.git@{branch}#egg=dephell[full]'",
"name",
"=",
"name",
".",
"format",
"(",
"slug",
"=",
"self",
".",
"args",
".",
"slug... | https://github.com/dephell/dephell/blob/de96f01fcfd8dd620b049369a8ec30dde566c5de/install.py#L169-L182 | ||||
librosa/librosa | 76029d35ce4c76a7475f07aab67fe2df3f73c25c | librosa/core/pitch.py | python | _parabolic_interpolation | (y_frames) | return parabolic_shifts | Piecewise parabolic interpolation for yin and pyin.
Parameters
----------
y_frames : np.ndarray [shape=(frame_length, n_frames)]
framed audio time series.
Returns
-------
parabolic_shifts : np.ndarray [shape=(frame_length, n_frames)]
position of the parabola optima | Piecewise parabolic interpolation for yin and pyin. | [
"Piecewise",
"parabolic",
"interpolation",
"for",
"yin",
"and",
"pyin",
"."
] | def _parabolic_interpolation(y_frames):
"""Piecewise parabolic interpolation for yin and pyin.
Parameters
----------
y_frames : np.ndarray [shape=(frame_length, n_frames)]
framed audio time series.
Returns
-------
parabolic_shifts : np.ndarray [shape=(frame_length, n_frames)]
... | [
"def",
"_parabolic_interpolation",
"(",
"y_frames",
")",
":",
"parabolic_shifts",
"=",
"np",
".",
"zeros_like",
"(",
"y_frames",
")",
"parabola_a",
"=",
"(",
"y_frames",
"[",
"...",
",",
":",
"-",
"2",
",",
":",
"]",
"+",
"y_frames",
"[",
"...",
",",
"... | https://github.com/librosa/librosa/blob/76029d35ce4c76a7475f07aab67fe2df3f73c25c/librosa/core/pitch.py#L431-L454 | |
mediacloud/backend | d36b489e4fbe6e44950916a04d9543a1d6cd5df0 | apps/topics-mine/src/python/topics_mine/posts/twitter/helpers.py | python | add_tweets_to_meta_tweets | (meta_tweets: list) | Given a set of meta_tweets, fetch data from twitter about each tweet and attach it under the tweet field.
Arguments:
meta_tweets - list of dicts, each of which must have a 'tweet_id'
Return:
None | Given a set of meta_tweets, fetch data from twitter about each tweet and attach it under the tweet field. | [
"Given",
"a",
"set",
"of",
"meta_tweets",
"fetch",
"data",
"from",
"twitter",
"about",
"each",
"tweet",
"and",
"attach",
"it",
"under",
"the",
"tweet",
"field",
"."
] | def add_tweets_to_meta_tweets(meta_tweets: list) -> None:
"""
Given a set of meta_tweets, fetch data from twitter about each tweet and attach it under the tweet field.
Arguments:
meta_tweets - list of dicts, each of which must have a 'tweet_id'
Return:
None
"""
log.info("fetching tweet... | [
"def",
"add_tweets_to_meta_tweets",
"(",
"meta_tweets",
":",
"list",
")",
"->",
"None",
":",
"log",
".",
"info",
"(",
"\"fetching tweets for \"",
"+",
"str",
"(",
"len",
"(",
"meta_tweets",
")",
")",
"+",
"\" tweets\"",
")",
"for",
"i",
"in",
"range",
"(",... | https://github.com/mediacloud/backend/blob/d36b489e4fbe6e44950916a04d9543a1d6cd5df0/apps/topics-mine/src/python/topics_mine/posts/twitter/helpers.py#L14-L45 | ||
django-nonrel/django-nonrel | 4fbfe7344481a5eab8698f79207f09124310131b | django/db/models/fields/__init__.py | python | Field.get_db_prep_value | (self, value, connection, prepared=False) | return value | Returns field's value prepared for interacting with the database
backend.
Used by the default implementations of ``get_db_prep_save``and
`get_db_prep_lookup``` | Returns field's value prepared for interacting with the database
backend. | [
"Returns",
"field",
"s",
"value",
"prepared",
"for",
"interacting",
"with",
"the",
"database",
"backend",
"."
] | def get_db_prep_value(self, value, connection, prepared=False):
"""Returns field's value prepared for interacting with the database
backend.
Used by the default implementations of ``get_db_prep_save``and
`get_db_prep_lookup```
"""
if not prepared:
value = sel... | [
"def",
"get_db_prep_value",
"(",
"self",
",",
"value",
",",
"connection",
",",
"prepared",
"=",
"False",
")",
":",
"if",
"not",
"prepared",
":",
"value",
"=",
"self",
".",
"get_prep_value",
"(",
"value",
")",
"return",
"value"
] | https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/db/models/fields/__init__.py#L263-L272 | |
GitGuardian/ggshield | 94a1fa0f6402cd1df2dd3dbc5b932862e85f99e5 | ggshield/output/output_handler.py | python | OutputHandler._get_exit_code | (scan: ScanCollection) | return 0 | [] | def _get_exit_code(scan: ScanCollection) -> int:
if scan.results:
return 1
if scan.scans and any(x.results for x in scan.scans):
return 1
return 0 | [
"def",
"_get_exit_code",
"(",
"scan",
":",
"ScanCollection",
")",
"->",
"int",
":",
"if",
"scan",
".",
"results",
":",
"return",
"1",
"if",
"scan",
".",
"scans",
"and",
"any",
"(",
"x",
".",
"results",
"for",
"x",
"in",
"scan",
".",
"scans",
")",
"... | https://github.com/GitGuardian/ggshield/blob/94a1fa0f6402cd1df2dd3dbc5b932862e85f99e5/ggshield/output/output_handler.py#L51-L56 | |||
noplay/python-mysql-replication | d9a2ba26d3da680aa402d114777fcb8469c3b1b5 | pymysqlreplication/event.py | python | GtidEvent.gtid | (self) | return gtid | GTID = source_id:transaction_id
Eg: 3E11FA47-71CA-11E1-9E33-C80AA9429562:23
See: http://dev.mysql.com/doc/refman/5.6/en/replication-gtids-concepts.html | GTID = source_id:transaction_id
Eg: 3E11FA47-71CA-11E1-9E33-C80AA9429562:23
See: http://dev.mysql.com/doc/refman/5.6/en/replication-gtids-concepts.html | [
"GTID",
"=",
"source_id",
":",
"transaction_id",
"Eg",
":",
"3E11FA47",
"-",
"71CA",
"-",
"11E1",
"-",
"9E33",
"-",
"C80AA9429562",
":",
"23",
"See",
":",
"http",
":",
"//",
"dev",
".",
"mysql",
".",
"com",
"/",
"doc",
"/",
"refman",
"/",
"5",
".",... | def gtid(self):
"""GTID = source_id:transaction_id
Eg: 3E11FA47-71CA-11E1-9E33-C80AA9429562:23
See: http://dev.mysql.com/doc/refman/5.6/en/replication-gtids-concepts.html"""
nibbles = binascii.hexlify(self.sid).decode('ascii')
gtid = '%s-%s-%s-%s-%s:%d' % (
nibbles[:8... | [
"def",
"gtid",
"(",
"self",
")",
":",
"nibbles",
"=",
"binascii",
".",
"hexlify",
"(",
"self",
".",
"sid",
")",
".",
"decode",
"(",
"'ascii'",
")",
"gtid",
"=",
"'%s-%s-%s-%s-%s:%d'",
"%",
"(",
"nibbles",
"[",
":",
"8",
"]",
",",
"nibbles",
"[",
"8... | https://github.com/noplay/python-mysql-replication/blob/d9a2ba26d3da680aa402d114777fcb8469c3b1b5/pymysqlreplication/event.py#L62-L70 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/es/v20180416/es_client.py | python | EsClient.DescribeInstances | (self, request) | 查询用户该地域下符合条件的所有实例
:param request: Request instance for DescribeInstances.
:type request: :class:`tencentcloud.es.v20180416.models.DescribeInstancesRequest`
:rtype: :class:`tencentcloud.es.v20180416.models.DescribeInstancesResponse` | 查询用户该地域下符合条件的所有实例 | [
"查询用户该地域下符合条件的所有实例"
] | def DescribeInstances(self, request):
"""查询用户该地域下符合条件的所有实例
:param request: Request instance for DescribeInstances.
:type request: :class:`tencentcloud.es.v20180416.models.DescribeInstancesRequest`
:rtype: :class:`tencentcloud.es.v20180416.models.DescribeInstancesResponse`
"""
... | [
"def",
"DescribeInstances",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"DescribeInstances\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loads... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/es/v20180416/es_client.py#L141-L166 | ||
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/collections/__init__.py | python | ChainMap.copy | (self) | return self.__class__(self.maps[0].copy(), *self.maps[1:]) | New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:] | New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:] | [
"New",
"ChainMap",
"or",
"subclass",
"with",
"a",
"new",
"copy",
"of",
"maps",
"[",
"0",
"]",
"and",
"refs",
"to",
"maps",
"[",
"1",
":",
"]"
] | def copy(self):
'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]'
return self.__class__(self.maps[0].copy(), *self.maps[1:]) | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"maps",
"[",
"0",
"]",
".",
"copy",
"(",
")",
",",
"*",
"self",
".",
"maps",
"[",
"1",
":",
"]",
")"
] | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/collections/__init__.py#L908-L910 | |
qutip/qutip | 52d01da181a21b810c3407812c670f35fdc647e8 | qutip/qip/device/processor.py | python | Processor.add_pulse | (self, pulse) | Add a new pulse to the device.
Parameters
----------
pulse: :class:`.Pulse`
`Pulse` object to be added. | Add a new pulse to the device. | [
"Add",
"a",
"new",
"pulse",
"to",
"the",
"device",
"."
] | def add_pulse(self, pulse):
"""
Add a new pulse to the device.
Parameters
----------
pulse: :class:`.Pulse`
`Pulse` object to be added.
"""
if isinstance(pulse, Pulse):
if pulse.spline_kind is None:
pulse.spline_kind = self... | [
"def",
"add_pulse",
"(",
"self",
",",
"pulse",
")",
":",
"if",
"isinstance",
"(",
"pulse",
",",
"Pulse",
")",
":",
"if",
"pulse",
".",
"spline_kind",
"is",
"None",
":",
"pulse",
".",
"spline_kind",
"=",
"self",
".",
"spline_kind",
"self",
".",
"pulses"... | https://github.com/qutip/qutip/blob/52d01da181a21b810c3407812c670f35fdc647e8/qutip/qip/device/processor.py#L350-L364 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/ssl/v20191205/models.py | python | SubmitCertificateInformationRequest.__init__ | (self) | r"""
:param CertificateId: 证书 ID。
:type CertificateId: str
:param CsrType: CSR 生成方式:online = 在线生成, parse = 手动上传。
:type CsrType: str
:param CsrContent: 上传的 CSR 内容。
:type CsrContent: str
:param CertificateDomain: 绑定证书的域名。
:type CertificateDomain: str
... | r"""
:param CertificateId: 证书 ID。
:type CertificateId: str
:param CsrType: CSR 生成方式:online = 在线生成, parse = 手动上传。
:type CsrType: str
:param CsrContent: 上传的 CSR 内容。
:type CsrContent: str
:param CertificateDomain: 绑定证书的域名。
:type CertificateDomain: str
... | [
"r",
":",
"param",
"CertificateId",
":",
"证书",
"ID。",
":",
"type",
"CertificateId",
":",
"str",
":",
"param",
"CsrType",
":",
"CSR",
"生成方式:online",
"=",
"在线生成",
"parse",
"=",
"手动上传。",
":",
"type",
"CsrType",
":",
"str",
":",
"param",
"CsrContent",
":",
... | def __init__(self):
r"""
:param CertificateId: 证书 ID。
:type CertificateId: str
:param CsrType: CSR 生成方式:online = 在线生成, parse = 手动上传。
:type CsrType: str
:param CsrContent: 上传的 CSR 内容。
:type CsrContent: str
:param CertificateDomain: 绑定证书的域名。
:type Ce... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"CertificateId",
"=",
"None",
"self",
".",
"CsrType",
"=",
"None",
"self",
".",
"CsrContent",
"=",
"None",
"self",
".",
"CertificateDomain",
"=",
"None",
"self",
".",
"DomainList",
"=",
"None",
"self... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ssl/v20191205/models.py#L2258-L2338 | ||
galaxyproject/galaxy | 4c03520f05062e0f4a1b3655dc0b7452fda69943 | lib/galaxy/datatypes/data.py | python | Newick.sniff | (self, filename) | return False | Returning false as the newick format is too general and cannot be sniffed. | Returning false as the newick format is too general and cannot be sniffed. | [
"Returning",
"false",
"as",
"the",
"newick",
"format",
"is",
"too",
"general",
"and",
"cannot",
"be",
"sniffed",
"."
] | def sniff(self, filename):
""" Returning false as the newick format is too general and cannot be sniffed."""
return False | [
"def",
"sniff",
"(",
"self",
",",
"filename",
")",
":",
"return",
"False"
] | https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/datatypes/data.py#L1046-L1048 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/fritz/device_tracker.py | python | FritzBoxTracker.icon | (self) | return "mdi:lan-disconnect" | Return device icon. | Return device icon. | [
"Return",
"device",
"icon",
"."
] | def icon(self) -> str:
"""Return device icon."""
if self.is_connected:
return "mdi:lan-connect"
return "mdi:lan-disconnect" | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"is_connected",
":",
"return",
"\"mdi:lan-connect\"",
"return",
"\"mdi:lan-disconnect\""
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/fritz/device_tracker.py#L96-L100 | |
pyjs/pyjs | 6c4a3d3a67300cd5df7f95a67ca9dcdc06950523 | pyjswaddons/SWFUpload.py | python | Settings.getFileSizeLimit | (self) | return self.file_size_limit | @return: the file size limit | [] | def getFileSizeLimit(self):
"""
@return: the file size limit
"""
return self.file_size_limit | [
"def",
"getFileSizeLimit",
"(",
"self",
")",
":",
"return",
"self",
".",
"file_size_limit"
] | https://github.com/pyjs/pyjs/blob/6c4a3d3a67300cd5df7f95a67ca9dcdc06950523/pyjswaddons/SWFUpload.py#L816-L820 | ||
idapython/src | 839d93ac969bc1a152982464907445bc0d18a1f8 | tools/inspect.py | python | findsource | (object) | Return the entire source file and starting line number for an object.
The argument may be a module, class, method, function, traceback, frame,
or code object. The source code is returned as a list of all the lines
in the file and the line number indexes a line in that list. An OSError
is raised if th... | Return the entire source file and starting line number for an object. | [
"Return",
"the",
"entire",
"source",
"file",
"and",
"starting",
"line",
"number",
"for",
"an",
"object",
"."
] | def findsource(object):
"""Return the entire source file and starting line number for an object.
The argument may be a module, class, method, function, traceback, frame,
or code object. The source code is returned as a list of all the lines
in the file and the line number indexes a line in that list. ... | [
"def",
"findsource",
"(",
"object",
")",
":",
"file",
"=",
"getsourcefile",
"(",
"object",
")",
"if",
"file",
":",
"# Invalidate cache if needed.",
"linecache",
".",
"checkcache",
"(",
"file",
")",
"else",
":",
"file",
"=",
"getfile",
"(",
"object",
")",
"... | https://github.com/idapython/src/blob/839d93ac969bc1a152982464907445bc0d18a1f8/tools/inspect.py#L736-L807 | ||
inducer/loopy | 55143b21711a534c07bbb14aaa63ff3879a93433 | loopy/__init__.py | python | make_einsum | (spec, arg_names, **knl_creation_kwargs) | return make_kernel("{[%s]: %s}" % (",".join(all_indices), constraints),
[Assignment(lhs, rhs)],
**knl_creation_kwargs) | r"""Returns a :class:`LoopKernel` for evaluating array-based
operations using Einstein summation convention.
:param spec: a string denoting the subscripts for
summation as a comma-separated list of subscript labels.
This follows the usual :func:`numpy.einsum` convention.
Note that the e... | r"""Returns a :class:`LoopKernel` for evaluating array-based
operations using Einstein summation convention. | [
"r",
"Returns",
"a",
":",
"class",
":",
"LoopKernel",
"for",
"evaluating",
"array",
"-",
"based",
"operations",
"using",
"Einstein",
"summation",
"convention",
"."
] | def make_einsum(spec, arg_names, **knl_creation_kwargs):
r"""Returns a :class:`LoopKernel` for evaluating array-based
operations using Einstein summation convention.
:param spec: a string denoting the subscripts for
summation as a comma-separated list of subscript labels.
This follows the u... | [
"def",
"make_einsum",
"(",
"spec",
",",
"arg_names",
",",
"*",
"*",
"knl_creation_kwargs",
")",
":",
"arg_spec",
",",
"out_spec",
"=",
"spec",
".",
"split",
"(",
"\"->\"",
")",
"arg_specs",
"=",
"arg_spec",
".",
"split",
"(",
"\",\"",
")",
"if",
"len",
... | https://github.com/inducer/loopy/blob/55143b21711a534c07bbb14aaa63ff3879a93433/loopy/__init__.py#L499-L564 | |
w3h/isf | 6faf0a3df185465ec17369c90ccc16e2a03a1870 | lib/thirdparty/scapy/packet.py | python | Packet.show | (self, indent=3, lvl="", label_lvl="") | Prints a hierarchical view of the packet. "indent" gives the size of indentation for each layer. | Prints a hierarchical view of the packet. "indent" gives the size of indentation for each layer. | [
"Prints",
"a",
"hierarchical",
"view",
"of",
"the",
"packet",
".",
"indent",
"gives",
"the",
"size",
"of",
"indentation",
"for",
"each",
"layer",
"."
] | def show(self, indent=3, lvl="", label_lvl=""):
"""Prints a hierarchical view of the packet. "indent" gives the size of indentation for each layer."""
ct = conf.color_theme
print "%s%s %s %s" % (label_lvl,
ct.punct("###["),
ct.layer_nam... | [
"def",
"show",
"(",
"self",
",",
"indent",
"=",
"3",
",",
"lvl",
"=",
"\"\"",
",",
"label_lvl",
"=",
"\"\"",
")",
":",
"ct",
"=",
"conf",
".",
"color_theme",
"print",
"\"%s%s %s %s\"",
"%",
"(",
"label_lvl",
",",
"ct",
".",
"punct",
"(",
"\"###[\"",
... | https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/scapy/packet.py#L836-L869 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkinter.py | python | Misc.pack_slaves | (self) | return map(self._nametowidget,
self.tk.splitlist(
self.tk.call('pack', 'slaves', self._w))) | Return a list of all slaves of this widget
in its packing order. | Return a list of all slaves of this widget
in its packing order. | [
"Return",
"a",
"list",
"of",
"all",
"slaves",
"of",
"this",
"widget",
"in",
"its",
"packing",
"order",
"."
] | def pack_slaves(self):
"""Return a list of all slaves of this widget
in its packing order."""
return map(self._nametowidget,
self.tk.splitlist(
self.tk.call('pack', 'slaves', self._w))) | [
"def",
"pack_slaves",
"(",
"self",
")",
":",
"return",
"map",
"(",
"self",
".",
"_nametowidget",
",",
"self",
".",
"tk",
".",
"splitlist",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'pack'",
",",
"'slaves'",
",",
"self",
".",
"_w",
")",
")",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkinter.py#L1354-L1359 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py | python | list_ipp_command | (client: MsClient, args: dict) | Listing all Internet Presence Provider
Args:
client:
args (dict): usually demisto.args() | Listing all Internet Presence Provider | [
"Listing",
"all",
"Internet",
"Presence",
"Provider"
] | def list_ipp_command(client: MsClient, args: dict):
"""Listing all Internet Presence Provider
Args:
client:
args (dict): usually demisto.args()
"""
management_group = args.get("management_group")
policies = client.list_ipp(management_group).get("value")
outputs = list()
if p... | [
"def",
"list_ipp_command",
"(",
"client",
":",
"MsClient",
",",
"args",
":",
"dict",
")",
":",
"management_group",
"=",
"args",
".",
"get",
"(",
"\"management_group\"",
")",
"policies",
"=",
"client",
".",
"list_ipp",
"(",
"management_group",
")",
".",
"get"... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/AzureSecurityCenter/Integrations/AzureSecurityCenter_v2/AzureSecurityCenter_v2.py#L816-L874 | ||
cclib/cclib | 81cd4a81cc4a3bbed7016b3e417ca9bff8ad3a92 | cclib/io/wfxwriter.py | python | WFXWriter.generate_repr | (self) | return '\n'.join(wfx_lines) | Generate the wfx representation of the logfile data. | Generate the wfx representation of the logfile data. | [
"Generate",
"the",
"wfx",
"representation",
"of",
"the",
"logfile",
"data",
"."
] | def generate_repr(self):
"""Generate the wfx representation of the logfile data."""
# sections:(Function returning data for section,
# Section heading,
# Required)
sections = [
(self._title, "Title", True),
(self._keywords, "Keywords"... | [
"def",
"generate_repr",
"(",
"self",
")",
":",
"# sections:(Function returning data for section,",
"# Section heading,",
"# Required)",
"sections",
"=",
"[",
"(",
"self",
".",
"_title",
",",
"\"Title\"",
",",
"True",
")",
",",
"(",
"self",
".",
"... | https://github.com/cclib/cclib/blob/81cd4a81cc4a3bbed7016b3e417ca9bff8ad3a92/cclib/io/wfxwriter.py#L460-L515 | |
conan-io/conan | 28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8 | conans/model/graph_lock.py | python | GraphLock.initial_counter | (self) | return max(int(x) for x in self._nodes.keys()) | When a new, relaxed graph is being created based on this lockfile, it can add new
nodes. The IDs of those nodes need a base ID, to not collide with the existing ones
:return: the maximum ID of this lockfile, as integer | When a new, relaxed graph is being created based on this lockfile, it can add new
nodes. The IDs of those nodes need a base ID, to not collide with the existing ones | [
"When",
"a",
"new",
"relaxed",
"graph",
"is",
"being",
"created",
"based",
"on",
"this",
"lockfile",
"it",
"can",
"add",
"new",
"nodes",
".",
"The",
"IDs",
"of",
"those",
"nodes",
"need",
"a",
"base",
"ID",
"to",
"not",
"collide",
"with",
"the",
"exist... | def initial_counter(self):
""" When a new, relaxed graph is being created based on this lockfile, it can add new
nodes. The IDs of those nodes need a base ID, to not collide with the existing ones
:return: the maximum ID of this lockfile, as integer
"""
# IDs are string, we need... | [
"def",
"initial_counter",
"(",
"self",
")",
":",
"# IDs are string, we need to compute the maximum integer",
"return",
"max",
"(",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"_nodes",
".",
"keys",
"(",
")",
")"
] | https://github.com/conan-io/conan/blob/28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8/conans/model/graph_lock.py#L432-L439 | |
beeware/colosseum | cbf974be54fd7f6fddbe7285704cfaf7a866c5c5 | src/colosseum/units.py | python | ViewportUnit.__init__ | (self, suffix, scale, val=None) | [] | def __init__(self, suffix, scale, val=None):
super().__init__(suffix, val)
self.scale = scale | [
"def",
"__init__",
"(",
"self",
",",
"suffix",
",",
"scale",
",",
"val",
"=",
"None",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"suffix",
",",
"val",
")",
"self",
".",
"scale",
"=",
"scale"
] | https://github.com/beeware/colosseum/blob/cbf974be54fd7f6fddbe7285704cfaf7a866c5c5/src/colosseum/units.py#L116-L118 | ||||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/preface.py | python | PrefaceSkein.addShutdownToOutput | (self) | Add shutdown gcode to the output. | Add shutdown gcode to the output. | [
"Add",
"shutdown",
"gcode",
"to",
"the",
"output",
"."
] | def addShutdownToOutput(self):
"Add shutdown gcode to the output."
self.distanceFeedRate.addLine('(</crafting>)') # GCode formatted comment
if self.repository.turnExtruderOffAtShutDown.value:
self.distanceFeedRate.addLine('M103') | [
"def",
"addShutdownToOutput",
"(",
"self",
")",
":",
"self",
".",
"distanceFeedRate",
".",
"addLine",
"(",
"'(</crafting>)'",
")",
"# GCode formatted comment",
"if",
"self",
".",
"repository",
".",
"turnExtruderOffAtShutDown",
".",
"value",
":",
"self",
".",
"dist... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/preface.py#L187-L191 | ||
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/share/driver.py | python | ShareDriver.get_backend_info | (self, context) | Get driver and array configuration parameters.
Driver can use this method to get the special configuration info and
return for assessment.
:returns: A dictionary containing driver-specific info.
Example::
{
'version': '2.23'
... | Get driver and array configuration parameters. | [
"Get",
"driver",
"and",
"array",
"configuration",
"parameters",
"."
] | def get_backend_info(self, context):
"""Get driver and array configuration parameters.
Driver can use this method to get the special configuration info and
return for assessment.
:returns: A dictionary containing driver-specific info.
Example::
{
... | [
"def",
"get_backend_info",
"(",
"self",
",",
"context",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/driver.py#L2782-L2800 | ||
aptonic/dropzone4-actions | 936ab89868ba8c79094a3577c2055fe376bfc488 | Qiniu.dzbundle/requests/sessions.py | python | Session.get | (self, url, **kwargs) | return self.request('GET', url, **kwargs) | Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. | Sends a GET request. Returns :class:`Response` object. | [
"Sends",
"a",
"GET",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def get(self, url, **kwargs):
"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
"""
kwargs.setdefault('allow_redirects', True)
return self.request(... | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"self",
".",
"request",
"(",
"'GET'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aptonic/dropzone4-actions/blob/936ab89868ba8c79094a3577c2055fe376bfc488/Qiniu.dzbundle/requests/sessions.py#L469-L477 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/posixpath.py | python | sameopenfile | (fp1, fp2) | return samestat(s1, s2) | Test whether two open file objects reference the same file | Test whether two open file objects reference the same file | [
"Test",
"whether",
"two",
"open",
"file",
"objects",
"reference",
"the",
"same",
"file"
] | def sameopenfile(fp1, fp2):
"""Test whether two open file objects reference the same file"""
s1 = os.fstat(fp1)
s2 = os.fstat(fp2)
return samestat(s1, s2) | [
"def",
"sameopenfile",
"(",
"fp1",
",",
"fp2",
")",
":",
"s1",
"=",
"os",
".",
"fstat",
"(",
"fp1",
")",
"s2",
"=",
"os",
".",
"fstat",
"(",
"fp2",
")",
"return",
"samestat",
"(",
"s1",
",",
"s2",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/posixpath.py#L163-L167 | |
PaddlePaddle/Parakeet | 8705a2a8405e3c63f2174d69880d2b5525a6c9fd | parakeet/modules/audio.py | python | dequantize | (quantized, n_bands, dtype=None) | return value | Linearlly dequantize an integer Tensor into a float Tensor in the range
[-1, 1).
Parameters
-----------
quantized : Tensor [dtype: int]
The quantized value in the range [0, n_bands).
n_bands : int
Number of bands. The input integer Tensor's value is in the range
[0,... | Linearlly dequantize an integer Tensor into a float Tensor in the range
[-1, 1). | [
"Linearlly",
"dequantize",
"an",
"integer",
"Tensor",
"into",
"a",
"float",
"Tensor",
"in",
"the",
"range",
"[",
"-",
"1",
"1",
")",
"."
] | def dequantize(quantized, n_bands, dtype=None):
"""Linearlly dequantize an integer Tensor into a float Tensor in the range
[-1, 1).
Parameters
-----------
quantized : Tensor [dtype: int]
The quantized value in the range [0, n_bands).
n_bands : int
Number of bands. The i... | [
"def",
"dequantize",
"(",
"quantized",
",",
"n_bands",
",",
"dtype",
"=",
"None",
")",
":",
"dtype",
"=",
"dtype",
"or",
"paddle",
".",
"get_default_dtype",
"(",
")",
"value",
"=",
"(",
"paddle",
".",
"cast",
"(",
"quantized",
",",
"dtype",
")",
"+",
... | https://github.com/PaddlePaddle/Parakeet/blob/8705a2a8405e3c63f2174d69880d2b5525a6c9fd/parakeet/modules/audio.py#L47-L71 | |
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/clients.py | python | Client.makeIpAlias | (self, ip) | Create a new ip alias for this client.
:param ip: The ip string | Create a new ip alias for this client.
:param ip: The ip string | [
"Create",
"a",
"new",
"ip",
"alias",
"for",
"this",
"client",
".",
":",
"param",
"ip",
":",
"The",
"ip",
"string"
] | def makeIpAlias(self, ip):
"""
Create a new ip alias for this client.
:param ip: The ip string
"""
if not self.id or not ip:
return
try:
alias = self.console.storage.getClientIpAddress(IpAlias(clientId=self.id, ip=ip))
except KeyError:
... | [
"def",
"makeIpAlias",
"(",
"self",
",",
"ip",
")",
":",
"if",
"not",
"self",
".",
"id",
"or",
"not",
"ip",
":",
"return",
"try",
":",
"alias",
"=",
"self",
".",
"console",
".",
"storage",
".",
"getClientIpAddress",
"(",
"IpAlias",
"(",
"clientId",
"=... | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/clients.py#L829-L851 | ||
Floobits/floobits-emacs | 93b3317fb6c842efe165e54c8a32bf51d436837d | floo/emui.py | python | Emui.user_select | (self, context, prompt, choices_big, choices_small, cb) | @returns (choice, index) | [] | def user_select(self, context, prompt, choices_big, choices_small, cb):
"""@returns (choice, index)"""
choices = [["%d. %s" % (i + 1, v), i] for i, v in enumerate(choices_big)]
event = {
'choices': choices,
'initial': '',
'prompt': prompt + "\n\n%s\n\nPlease s... | [
"def",
"user_select",
"(",
"self",
",",
"context",
",",
"prompt",
",",
"choices_big",
",",
"choices_small",
",",
"cb",
")",
":",
"choices",
"=",
"[",
"[",
"\"%d. %s\"",
"%",
"(",
"i",
"+",
"1",
",",
"v",
")",
",",
"i",
"]",
"for",
"i",
",",
"v",
... | https://github.com/Floobits/floobits-emacs/blob/93b3317fb6c842efe165e54c8a32bf51d436837d/floo/emui.py#L36-L52 | |||
tensorflow/mesh | 57ed4018e6a173952501b074daabad32b6449f3d | mesh_tensorflow/transformer/transformer.py | python | Context.nonpadding | (self) | Tensor with zeros in padding positions and ones elsewhere. | Tensor with zeros in padding positions and ones elsewhere. | [
"Tensor",
"with",
"zeros",
"in",
"padding",
"positions",
"and",
"ones",
"elsewhere",
"."
] | def nonpadding(self):
"""Tensor with zeros in padding positions and ones elsewhere."""
if self.sequence_id is None:
return None
if self.sequence_id == 1:
return 1
else:
return mtf.cast(
mtf.not_equal(self.sequence_id, 0), self.activation_dtype) | [
"def",
"nonpadding",
"(",
"self",
")",
":",
"if",
"self",
".",
"sequence_id",
"is",
"None",
":",
"return",
"None",
"if",
"self",
".",
"sequence_id",
"==",
"1",
":",
"return",
"1",
"else",
":",
"return",
"mtf",
".",
"cast",
"(",
"mtf",
".",
"not_equal... | https://github.com/tensorflow/mesh/blob/57ed4018e6a173952501b074daabad32b6449f3d/mesh_tensorflow/transformer/transformer.py#L297-L305 | ||
maurosoria/dirsearch | b83e68c8fdf360ab06be670d7b92b263262ee5b1 | thirdparty/pyparsing/actions.py | python | removeQuotes | (s, l, t) | return t[0][1:-1] | Helper parse action for removing quotation marks from parsed
quoted strings.
Example::
# by default, quotation marks are included in parsed results
quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]
# use removeQuotes to st... | Helper parse action for removing quotation marks from parsed
quoted strings. | [
"Helper",
"parse",
"action",
"for",
"removing",
"quotation",
"marks",
"from",
"parsed",
"quoted",
"strings",
"."
] | def removeQuotes(s, l, t):
"""Helper parse action for removing quotation marks from parsed
quoted strings.
Example::
# by default, quotation marks are included in parsed results
quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]... | [
"def",
"removeQuotes",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"return",
"t",
"[",
"0",
"]",
"[",
"1",
":",
"-",
"1",
"]"
] | https://github.com/maurosoria/dirsearch/blob/b83e68c8fdf360ab06be670d7b92b263262ee5b1/thirdparty/pyparsing/actions.py#L58-L71 | |
unknown-horizons/unknown-horizons | 7397fb333006d26c3d9fe796c7bd9cb8c3b43a49 | horizons/gui/mousetools/cursortool.py | python | CursorTool._round_map_coords | (self, map_x, map_y) | return Point(roundhalfplus(map_x), roundhalfplus(map_y)) | Returns the coordinates of an event at the map.
Why roundhalfplus?
a b a-b round(a)-round(b) roundplus(a)-roundplus(b)
1.50 0.50 1.00 1.00 1.0
0.50 -0.49 0.99 1.00 1.0
-0.49 -1.49 1.00 1.00 1.0
E... | Returns the coordinates of an event at the map. | [
"Returns",
"the",
"coordinates",
"of",
"an",
"event",
"at",
"the",
"map",
"."
] | def _round_map_coords(self, map_x, map_y):
"""Returns the coordinates of an event at the map.
Why roundhalfplus?
a b a-b round(a)-round(b) roundplus(a)-roundplus(b)
1.50 0.50 1.00 1.00 1.0
0.50 -0.49 0.99 1.00 1.0
-0.4... | [
"def",
"_round_map_coords",
"(",
"self",
",",
"map_x",
",",
"map_y",
")",
":",
"return",
"Point",
"(",
"roundhalfplus",
"(",
"map_x",
")",
",",
"roundhalfplus",
"(",
"map_y",
")",
")"
] | https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/gui/mousetools/cursortool.py#L89-L105 | |
eBay/accelerator | 218d9a5e4451ac72b9e65df6c5b32e37d25136c8 | accelerator/build.py | python | Urd.build_chained | (self, method, options={}, datasets={}, jobs={}, name=None, caption=None, why_build=False, force_build=False, workdir=None, **kw) | return self.build(method, options, datasets, jobs, name, caption, why_build, force_build, workdir, **kw) | [] | def build_chained(self, method, options={}, datasets={}, jobs={}, name=None, caption=None, why_build=False, force_build=False, workdir=None, **kw):
assert 'previous' not in set(datasets) | set(jobs) | set(kw), "Don't specify previous to build_chained"
assert name, "build_chained must have 'name'"
assert self._lat... | [
"def",
"build_chained",
"(",
"self",
",",
"method",
",",
"options",
"=",
"{",
"}",
",",
"datasets",
"=",
"{",
"}",
",",
"jobs",
"=",
"{",
"}",
",",
"name",
"=",
"None",
",",
"caption",
"=",
"None",
",",
"why_build",
"=",
"False",
",",
"force_build"... | https://github.com/eBay/accelerator/blob/218d9a5e4451ac72b9e65df6c5b32e37d25136c8/accelerator/build.py#L571-L577 | |||
awslabs/aws-ec2rescue-linux | 8ecf40e7ea0d2563dac057235803fca2221029d2 | lib/requests/packages/urllib3/contrib/_securetransport/low_level.py | python | _cf_string_to_unicode | (value) | return string | Creates a Unicode string from a CFString object. Used entirely for error
reporting.
Yes, it annoys me quite a lot that this function is this complex. | Creates a Unicode string from a CFString object. Used entirely for error
reporting. | [
"Creates",
"a",
"Unicode",
"string",
"from",
"a",
"CFString",
"object",
".",
"Used",
"entirely",
"for",
"error",
"reporting",
"."
] | def _cf_string_to_unicode(value):
"""
Creates a Unicode string from a CFString object. Used entirely for error
reporting.
Yes, it annoys me quite a lot that this function is this complex.
"""
value_as_void_p = ctypes.cast(value, ctypes.POINTER(ctypes.c_void_p))
string = CoreFoundation.CFSt... | [
"def",
"_cf_string_to_unicode",
"(",
"value",
")",
":",
"value_as_void_p",
"=",
"ctypes",
".",
"cast",
"(",
"value",
",",
"ctypes",
".",
"POINTER",
"(",
"ctypes",
".",
"c_void_p",
")",
")",
"string",
"=",
"CoreFoundation",
".",
"CFStringGetCStringPtr",
"(",
... | https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/lib/requests/packages/urllib3/contrib/_securetransport/low_level.py#L59-L85 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/mailbox.py | python | MH.__init__ | (self, path, factory=None, create=True) | Initialize an MH instance. | Initialize an MH instance. | [
"Initialize",
"an",
"MH",
"instance",
"."
] | def __init__(self, path, factory=None, create=True):
"""Initialize an MH instance."""
Mailbox.__init__(self, path, factory, create)
if not os.path.exists(self._path):
if create:
os.mkdir(self._path, 0o700)
os.close(os.open(os.path.join(self._path, '.mh... | [
"def",
"__init__",
"(",
"self",
",",
"path",
",",
"factory",
"=",
"None",
",",
"create",
"=",
"True",
")",
":",
"Mailbox",
".",
"__init__",
"(",
"self",
",",
"path",
",",
"factory",
",",
"create",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",... | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/mailbox.py#L933-L943 | ||
serge-sans-paille/pythran | f9f73aa5a965adc4ebcb91a439784dbe9ef911fa | pythran/transformations/remove_comprehension.py | python | RemoveComprehension.nest_reducer | (x, g) | return ast.For(g.target, g.iter, [wrap_in_ifs(x, g.ifs)], [], None) | Create a ast.For node from a comprehension and another node.
g is an ast.comprehension.
x is the code that have to be executed.
Examples
--------
>> [i for i in range(2)]
Becomes
>> for i in range(2):
>> ... x code with if clauses ...
It is... | Create a ast.For node from a comprehension and another node. | [
"Create",
"a",
"ast",
".",
"For",
"node",
"from",
"a",
"comprehension",
"and",
"another",
"node",
"."
] | def nest_reducer(x, g):
"""
Create a ast.For node from a comprehension and another node.
g is an ast.comprehension.
x is the code that have to be executed.
Examples
--------
>> [i for i in range(2)]
Becomes
>> for i in range(2):
>> .... | [
"def",
"nest_reducer",
"(",
"x",
",",
"g",
")",
":",
"def",
"wrap_in_ifs",
"(",
"node",
",",
"ifs",
")",
":",
"\"\"\"\n Wrap comprehension content in all possibles if clauses.\n\n Examples\n --------\n >> [i for i in range(2) if i < 3 if 0 ... | https://github.com/serge-sans-paille/pythran/blob/f9f73aa5a965adc4ebcb91a439784dbe9ef911fa/pythran/transformations/remove_comprehension.py#L35-L73 | |
grnet/synnefo | d06ec8c7871092131cdaabf6b03ed0b504c93e43 | astakosclient/astakosclient/__init__.py | python | AstakosClient.reject_commission | (self, serial) | Reject a commission (see commission_action) | Reject a commission (see commission_action) | [
"Reject",
"a",
"commission",
"(",
"see",
"commission_action",
")"
] | def reject_commission(self, serial):
"""Reject a commission (see commission_action)"""
self.commission_action(serial, "reject") | [
"def",
"reject_commission",
"(",
"self",
",",
"serial",
")",
":",
"self",
".",
"commission_action",
"(",
"serial",
",",
"\"reject\"",
")"
] | https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/astakosclient/astakosclient/__init__.py#L824-L826 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.py | python | copyfile | (src, dst) | Copy data from src to dst | Copy data from src to dst | [
"Copy",
"data",
"from",
"src",
"to",
"dst"
] | def copyfile(src, dst):
"""Copy data from src to dst"""
if _samefile(src, dst):
raise Error("`%s` and `%s` are the same file" % (src, dst))
for fn in [src, dst]:
try:
st = os.stat(fn)
except OSError:
# File most likely does not exist
pass
... | [
"def",
"copyfile",
"(",
"src",
",",
"dst",
")",
":",
"if",
"_samefile",
"(",
"src",
",",
"dst",
")",
":",
"raise",
"Error",
"(",
"\"`%s` and `%s` are the same file\"",
"%",
"(",
"src",
",",
"dst",
")",
")",
"for",
"fn",
"in",
"[",
"src",
",",
"dst",
... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.py#L87-L105 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/distutils/file_util.py | python | write_file | (filename, contents) | Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it. | Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it. | [
"Create",
"a",
"file",
"with",
"the",
"specified",
"name",
"and",
"write",
"contents",
"(",
"a",
"sequence",
"of",
"strings",
"without",
"line",
"terminators",
")",
"to",
"it",
"."
] | def write_file (filename, contents):
"""Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it.
"""
f = open(filename, "w")
try:
for line in contents:
f.write(line + "\n")
finally:
f.close() | [
"def",
"write_file",
"(",
"filename",
",",
"contents",
")",
":",
"f",
"=",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"try",
":",
"for",
"line",
"in",
"contents",
":",
"f",
".",
"write",
"(",
"line",
"+",
"\"\\n\"",
")",
"finally",
":",
"f",
".",
... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/distutils/file_util.py#L229-L238 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Tools/gdb/libpython.py | python | move_in_stack | (move_up) | Move up or down the stack (for the py-up/py-down command) | Move up or down the stack (for the py-up/py-down command) | [
"Move",
"up",
"or",
"down",
"the",
"stack",
"(",
"for",
"the",
"py",
"-",
"up",
"/",
"py",
"-",
"down",
"command",
")"
] | def move_in_stack(move_up):
'''Move up or down the stack (for the py-up/py-down command)'''
frame = Frame.get_selected_python_frame()
while frame:
if move_up:
iter_frame = frame.older()
else:
iter_frame = frame.newer()
if not iter_frame:
break
... | [
"def",
"move_in_stack",
"(",
"move_up",
")",
":",
"frame",
"=",
"Frame",
".",
"get_selected_python_frame",
"(",
")",
"while",
"frame",
":",
"if",
"move_up",
":",
"iter_frame",
"=",
"frame",
".",
"older",
"(",
")",
"else",
":",
"iter_frame",
"=",
"frame",
... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Tools/gdb/libpython.py#L1314-L1337 | ||
Kyubyong/tacotron_asr | fdc0d9a3ff56405e90e2cb6ff8d540e735b01b7d | data_load.py | python | get_spectrogram_and_text | (_inputs) | return spectrogram, text | From `_inputs`, which has been fetched from slice queues,
makes text, spectrogram, and magnitude,
then enqueue them again. | From `_inputs`, which has been fetched from slice queues,
makes text, spectrogram, and magnitude,
then enqueue them again. | [
"From",
"_inputs",
"which",
"has",
"been",
"fetched",
"from",
"slice",
"queues",
"makes",
"text",
"spectrogram",
"and",
"magnitude",
"then",
"enqueue",
"them",
"again",
"."
] | def get_spectrogram_and_text(_inputs):
'''From `_inputs`, which has been fetched from slice queues,
makes text, spectrogram, and magnitude,
then enqueue them again.
'''
sound_fpath, text = _inputs
spectrogram = get_spectrogram(sound_fpath)
spectrogram = reduce_frames(spectrogram, hp.r... | [
"def",
"get_spectrogram_and_text",
"(",
"_inputs",
")",
":",
"sound_fpath",
",",
"text",
"=",
"_inputs",
"spectrogram",
"=",
"get_spectrogram",
"(",
"sound_fpath",
")",
"spectrogram",
"=",
"reduce_frames",
"(",
"spectrogram",
",",
"hp",
".",
"r",
")",
"text",
... | https://github.com/Kyubyong/tacotron_asr/blob/fdc0d9a3ff56405e90e2cb6ff8d540e735b01b7d/data_load.py#L121-L131 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scatter3d/line/_colorbar.py | python | ColorBar.ticklabeloverflow | (self) | return self["ticklabeloverflow"] | Determines how we handle tick labels that would overflow either
the graph div or the domain of the axis. The default value for
inside tick labels is *hide past domain*. In other cases the
default is *hide past div*.
The 'ticklabeloverflow' property is an enumeration that may be spec... | Determines how we handle tick labels that would overflow either
the graph div or the domain of the axis. The default value for
inside tick labels is *hide past domain*. In other cases the
default is *hide past div*.
The 'ticklabeloverflow' property is an enumeration that may be spec... | [
"Determines",
"how",
"we",
"handle",
"tick",
"labels",
"that",
"would",
"overflow",
"either",
"the",
"graph",
"div",
"or",
"the",
"domain",
"of",
"the",
"axis",
".",
"The",
"default",
"value",
"for",
"inside",
"tick",
"labels",
"is",
"*",
"hide",
"past",
... | def ticklabeloverflow(self):
"""
Determines how we handle tick labels that would overflow either
the graph div or the domain of the axis. The default value for
inside tick labels is *hide past domain*. In other cases the
default is *hide past div*.
The 'ticklabelover... | [
"def",
"ticklabeloverflow",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticklabeloverflow\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatter3d/line/_colorbar.py#L879-L894 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py | python | WorkerChannelPage.get_instance | (self, payload) | return WorkerChannelInstance(
self._version,
payload,
workspace_sid=self._solution['workspace_sid'],
worker_sid=self._solution['worker_sid'],
) | Build an instance of WorkerChannelInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance
:rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance | Build an instance of WorkerChannelInstance | [
"Build",
"an",
"instance",
"of",
"WorkerChannelInstance"
] | def get_instance(self, payload):
"""
Build an instance of WorkerChannelInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance
:rtype: twilio.rest.taskrouter.v1.workspace.worker.worker... | [
"def",
"get_instance",
"(",
"self",
",",
"payload",
")",
":",
"return",
"WorkerChannelInstance",
"(",
"self",
".",
"_version",
",",
"payload",
",",
"workspace_sid",
"=",
"self",
".",
"_solution",
"[",
"'workspace_sid'",
"]",
",",
"worker_sid",
"=",
"self",
"... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py#L174-L188 | |
vvk-ehk/evalimine | e2f486deb136e0a514e43a2a85774a344fff1998 | ivote-server/evui/uiutil.py | python | _del_char | (prefix, inp) | return True | Kursor kas samm vasakule või rida ülespoole ja lõppu.
Tagastab:
False - midagi ei juhtunud
True - kustutati symbol | Kursor kas samm vasakule või rida ülespoole ja lõppu.
Tagastab:
False - midagi ei juhtunud
True - kustutati symbol | [
"Kursor",
"kas",
"samm",
"vasakule",
"või",
"rida",
"ülespoole",
"ja",
"lõppu",
".",
"Tagastab",
":",
"False",
"-",
"midagi",
"ei",
"juhtunud",
"True",
"-",
"kustutati",
"symbol"
] | def _del_char(prefix, inp):
"""
Kursor kas samm vasakule või rida ülespoole ja lõppu.
Tagastab:
False - midagi ei juhtunud
True - kustutati symbol
"""
_, _w = _term_size()
# et saaks õige kuvatava tähtede arvu
prefix_len = len(unicode(prefix, "utf8"))
if (prefix_len + len... | [
"def",
"_del_char",
"(",
"prefix",
",",
"inp",
")",
":",
"_",
",",
"_w",
"=",
"_term_size",
"(",
")",
"# et saaks õige kuvatava tähtede arvu",
"prefix_len",
"=",
"len",
"(",
"unicode",
"(",
"prefix",
",",
"\"utf8\"",
")",
")",
"if",
"(",
"prefix_len",
"+",... | https://github.com/vvk-ehk/evalimine/blob/e2f486deb136e0a514e43a2a85774a344fff1998/ivote-server/evui/uiutil.py#L360-L400 | |
ev3dev/ev3dev-lang-python | f84152ca9b952a7a47a3f477542f878f3b69b824 | ev3dev2/sensor/__init__.py | python | Sensor.bin_data_format | (self) | return value | Returns the format of the values in ``bin_data`` for the current mode.
Possible values are:
- ``u8``: Unsigned 8-bit integer (byte)
- ``s8``: Signed 8-bit integer (sbyte)
- ``u16``: Unsigned 16-bit integer (ushort)
- ``s16``: Signed 16-bit integer (short)
- ``s16_be``: S... | Returns the format of the values in ``bin_data`` for the current mode.
Possible values are: | [
"Returns",
"the",
"format",
"of",
"the",
"values",
"in",
"bin_data",
"for",
"the",
"current",
"mode",
".",
"Possible",
"values",
"are",
":"
] | def bin_data_format(self):
"""
Returns the format of the values in ``bin_data`` for the current mode.
Possible values are:
- ``u8``: Unsigned 8-bit integer (byte)
- ``s8``: Signed 8-bit integer (sbyte)
- ``u16``: Unsigned 16-bit integer (ushort)
- ``s16``: Signed... | [
"def",
"bin_data_format",
"(",
"self",
")",
":",
"self",
".",
"_bin_data_format",
",",
"value",
"=",
"self",
".",
"get_attr_string",
"(",
"self",
".",
"_bin_data_format",
",",
"'bin_data_format'",
")",
"return",
"value"
] | https://github.com/ev3dev/ev3dev-lang-python/blob/f84152ca9b952a7a47a3f477542f878f3b69b824/ev3dev2/sensor/__init__.py#L207-L221 | |
SebKuzminsky/pycam | 55e3129f518e470040e79bb00515b4bfcf36c172 | pycam/Plugins/ParallelProcessing.py | python | ParallelProcessing.generate_random_server_password | (self, widget=None) | [] | def generate_random_server_password(self, widget=None):
all_characters = string.letters + string.digits
random_pw = "".join([random.choice(all_characters) for i in range(12)])
self.auth_key_obj.set_text(random_pw) | [
"def",
"generate_random_server_password",
"(",
"self",
",",
"widget",
"=",
"None",
")",
":",
"all_characters",
"=",
"string",
".",
"letters",
"+",
"string",
".",
"digits",
"random_pw",
"=",
"\"\"",
".",
"join",
"(",
"[",
"random",
".",
"choice",
"(",
"all_... | https://github.com/SebKuzminsky/pycam/blob/55e3129f518e470040e79bb00515b4bfcf36c172/pycam/Plugins/ParallelProcessing.py#L159-L162 | ||||
IntelPython/sdc | 1ebf55c00ef38dfbd401a70b3945e352a5a38b87 | sdc/set_ext.py | python | lower_dict_in | (context, builder, sig, args) | return builder.call(fn, args) | [] | def lower_dict_in(context, builder, sig, args):
fnty = lir.FunctionType(lir.IntType(1), [lir.IntType(8).as_pointer(),
lir.IntType(8).as_pointer()])
fn = cgutils.get_or_insert_function(builder.module, fnty, name="set_in_string")
return builder.call(fn, args) | [
"def",
"lower_dict_in",
"(",
"context",
",",
"builder",
",",
"sig",
",",
"args",
")",
":",
"fnty",
"=",
"lir",
".",
"FunctionType",
"(",
"lir",
".",
"IntType",
"(",
"1",
")",
",",
"[",
"lir",
".",
"IntType",
"(",
"8",
")",
".",
"as_pointer",
"(",
... | https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/set_ext.py#L186-L190 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/gpm/v20200820/models.py | python | CreateRuleRequest.__init__ | (self) | r"""
:param RuleName: 规则名称,[a-zA-Z0-9-\.]* 长度128
:type RuleName: str
:param RuleScript: 规则脚本,长度65535
:type RuleScript: str
:param RuleDesc: 规则描述,最长1024
:type RuleDesc: str
:param Tags: 标签,key-value结构的数组,最多关联50组标签
:type Tags: list of StringKV | r"""
:param RuleName: 规则名称,[a-zA-Z0-9-\.]* 长度128
:type RuleName: str
:param RuleScript: 规则脚本,长度65535
:type RuleScript: str
:param RuleDesc: 规则描述,最长1024
:type RuleDesc: str
:param Tags: 标签,key-value结构的数组,最多关联50组标签
:type Tags: list of StringKV | [
"r",
":",
"param",
"RuleName",
":",
"规则名称,",
"[",
"a",
"-",
"zA",
"-",
"Z0",
"-",
"9",
"-",
"\\",
".",
"]",
"*",
"长度128",
":",
"type",
"RuleName",
":",
"str",
":",
"param",
"RuleScript",
":",
"规则脚本,长度65535",
":",
"type",
"RuleScript",
":",
"str",
... | def __init__(self):
r"""
:param RuleName: 规则名称,[a-zA-Z0-9-\.]* 长度128
:type RuleName: str
:param RuleScript: 规则脚本,长度65535
:type RuleScript: str
:param RuleDesc: 规则描述,最长1024
:type RuleDesc: str
:param Tags: 标签,key-value结构的数组,最多关联50组标签
:type Tags: lis... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"RuleName",
"=",
"None",
"self",
".",
"RuleScript",
"=",
"None",
"self",
".",
"RuleDesc",
"=",
"None",
"self",
".",
"Tags",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/gpm/v20200820/models.py#L208-L222 | ||
ahmetozlu/tensorflow_object_counting_api | 630a1471a1aa19e582d09898f569c5eea031a21d | smurf_counter_training/legacy/evaluator.py | python | evaluate | (create_input_dict_fn, create_model_fn, eval_config, categories,
checkpoint_dir, eval_dir, graph_hook_fn=None, evaluator_list=None) | return metrics | Evaluation function for detection models.
Args:
create_input_dict_fn: a function to create a tensor input dictionary.
create_model_fn: a function that creates a DetectionModel.
eval_config: a eval_pb2.EvalConfig protobuf.
categories: a list of category dictionaries. Each dict in the list should
... | Evaluation function for detection models. | [
"Evaluation",
"function",
"for",
"detection",
"models",
"."
] | def evaluate(create_input_dict_fn, create_model_fn, eval_config, categories,
checkpoint_dir, eval_dir, graph_hook_fn=None, evaluator_list=None):
"""Evaluation function for detection models.
Args:
create_input_dict_fn: a function to create a tensor input dictionary.
create_model_fn: a function ... | [
"def",
"evaluate",
"(",
"create_input_dict_fn",
",",
"create_model_fn",
",",
"eval_config",
",",
"categories",
",",
"checkpoint_dir",
",",
"eval_dir",
",",
"graph_hook_fn",
"=",
"None",
",",
"evaluator_list",
"=",
"None",
")",
":",
"model",
"=",
"create_model_fn",... | https://github.com/ahmetozlu/tensorflow_object_counting_api/blob/630a1471a1aa19e582d09898f569c5eea031a21d/smurf_counter_training/legacy/evaluator.py#L173-L298 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/sklearn/ensemble/weight_boosting.py | python | AdaBoostClassifier.staged_decision_function | (self, X) | Compute decision function of ``X`` for each boosting iteration.
This method allows monitoring (i.e. determine error on testing set)
after each boosting iteration.
Parameters
----------
X : {array-like, sparse matrix} of shape = [n_samples, n_features]
The training i... | Compute decision function of ``X`` for each boosting iteration. | [
"Compute",
"decision",
"function",
"of",
"X",
"for",
"each",
"boosting",
"iteration",
"."
] | def staged_decision_function(self, X):
"""Compute decision function of ``X`` for each boosting iteration.
This method allows monitoring (i.e. determine error on testing set)
after each boosting iteration.
Parameters
----------
X : {array-like, sparse matrix} of shape = ... | [
"def",
"staged_decision_function",
"(",
"self",
",",
"X",
")",
":",
"check_is_fitted",
"(",
"self",
",",
"\"n_classes_\"",
")",
"X",
"=",
"self",
".",
"_validate_X_predict",
"(",
"X",
")",
"n_classes",
"=",
"self",
".",
"n_classes_",
"classes",
"=",
"self",
... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/sklearn/ensemble/weight_boosting.py#L680-L731 | ||
OpenCobolIDE/OpenCobolIDE | c78d0d335378e5fe0a5e74f53c19b68b55e85388 | open_cobol_ide/extlibs/future/backports/datetime.py | python | tzinfo.__reduce__ | (self) | [] | def __reduce__(self):
getinitargs = getattr(self, "__getinitargs__", None)
if getinitargs:
args = getinitargs()
else:
args = ()
getstate = getattr(self, "__getstate__", None)
if getstate:
state = getstate()
else:
state = get... | [
"def",
"__reduce__",
"(",
"self",
")",
":",
"getinitargs",
"=",
"getattr",
"(",
"self",
",",
"\"__getinitargs__\"",
",",
"None",
")",
"if",
"getinitargs",
":",
"args",
"=",
"getinitargs",
"(",
")",
"else",
":",
"args",
"=",
"(",
")",
"getstate",
"=",
"... | https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/future/backports/datetime.py#L970-L984 | ||||
tensorflow/privacy | 867f3d4c5566b21433a6a1bed998094d1479b4d5 | tensorflow_privacy/privacy/analysis/gdp_accountant.py | python | compute_eps_uniform | (epoch, noise_multi, n, batch_size, delta) | return eps_from_mu(
compute_mu_uniform(epoch, noise_multi, n, batch_size), delta) | Compute epsilon given delta from inverse dual of uniform subsampling. | Compute epsilon given delta from inverse dual of uniform subsampling. | [
"Compute",
"epsilon",
"given",
"delta",
"from",
"inverse",
"dual",
"of",
"uniform",
"subsampling",
"."
] | def compute_eps_uniform(epoch, noise_multi, n, batch_size, delta):
"""Compute epsilon given delta from inverse dual of uniform subsampling."""
return eps_from_mu(
compute_mu_uniform(epoch, noise_multi, n, batch_size), delta) | [
"def",
"compute_eps_uniform",
"(",
"epoch",
",",
"noise_multi",
",",
"n",
",",
"batch_size",
",",
"delta",
")",
":",
"return",
"eps_from_mu",
"(",
"compute_mu_uniform",
"(",
"epoch",
",",
"noise_multi",
",",
"n",
",",
"batch_size",
")",
",",
"delta",
")"
] | https://github.com/tensorflow/privacy/blob/867f3d4c5566b21433a6a1bed998094d1479b4d5/tensorflow_privacy/privacy/analysis/gdp_accountant.py#L60-L64 | |
giantbranch/python-hacker-code | addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d | 我手敲的代码(中文注释)/chapter11/volatility/conf.py | python | ConfObject.add_file | (self, filename, _type = 'init') | Adds a new file to parse | Adds a new file to parse | [
"Adds",
"a",
"new",
"file",
"to",
"parse"
] | def add_file(self, filename, _type = 'init'):
""" Adds a new file to parse """
self._filenames.append(filename)
self.cnf_opts.clear()
for f in self._filenames:
try:
conf_parser = ConfigParser.ConfigParser()
conf_parser.read(f)
... | [
"def",
"add_file",
"(",
"self",
",",
"filename",
",",
"_type",
"=",
"'init'",
")",
":",
"self",
".",
"_filenames",
".",
"append",
"(",
"filename",
")",
"self",
".",
"cnf_opts",
".",
"clear",
"(",
")",
"for",
"f",
"in",
"self",
".",
"_filenames",
":",... | https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/volatility/conf.py#L172-L200 | ||
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/model/DNN/sklearn/line_sklearn.py | python | main | () | [] | def main():
train() | [
"def",
"main",
"(",
")",
":",
"train",
"(",
")"
] | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/model/DNN/sklearn/line_sklearn.py#L92-L93 | ||||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py | python | Distribution.activate | (self, path=None, replace=False) | Ensure distribution is importable on `path` (default=sys.path) | Ensure distribution is importable on `path` (default=sys.path) | [
"Ensure",
"distribution",
"is",
"importable",
"on",
"path",
"(",
"default",
"=",
"sys",
".",
"path",
")"
] | def activate(self, path=None, replace=False):
"""Ensure distribution is importable on `path` (default=sys.path)"""
if path is None:
path = sys.path
self.insert_on(path, replace=replace)
if path is sys.path:
fixup_namespace_packages(self.location)
for p... | [
"def",
"activate",
"(",
"self",
",",
"path",
"=",
"None",
",",
"replace",
"=",
"False",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"sys",
".",
"path",
"self",
".",
"insert_on",
"(",
"path",
",",
"replace",
"=",
"replace",
")",
"if",
... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L2569-L2578 | ||
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/gitcfg.py | python | GitConfig.terminal | (self) | return term | [] | def terminal(self):
term = self.get('cola.terminal', default=None)
if not term:
# find a suitable default terminal
term = 'xterm -e' # for mac osx
if utils.is_win32():
# Try to find Git's sh.exe directory in
# one of the typical locati... | [
"def",
"terminal",
"(",
"self",
")",
":",
"term",
"=",
"self",
".",
"get",
"(",
"'cola.terminal'",
",",
"default",
"=",
"None",
")",
"if",
"not",
"term",
":",
"# find a suitable default terminal",
"term",
"=",
"'xterm -e'",
"# for mac osx",
"if",
"utils",
".... | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/gitcfg.py#L456-L482 | |||
nasa-jpl/osr-rover-code | cbc4d45269a4250451f477c2d820d781c2d8f1e6 | ROS/osr/src/roboclaw_wrapper.py | python | RoboclawWrapper.read_errors | (self) | return err | Checks error status of each motor controller, returns 0 if no errors reported | Checks error status of each motor controller, returns 0 if no errors reported | [
"Checks",
"error",
"status",
"of",
"each",
"motor",
"controller",
"returns",
"0",
"if",
"no",
"errors",
"reported"
] | def read_errors(self):
"""Checks error status of each motor controller, returns 0 if no errors reported"""
err = [0] * 5
for i in range(len(self.address)):
err[i] = self.rc.ReadError(self.address[i])[1]
if err[i] != 0:
rospy.logerr("Motor controller '{}' r... | [
"def",
"read_errors",
"(",
"self",
")",
":",
"err",
"=",
"[",
"0",
"]",
"*",
"5",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"address",
")",
")",
":",
"err",
"[",
"i",
"]",
"=",
"self",
".",
"rc",
".",
"ReadError",
"(",
"self",
... | https://github.com/nasa-jpl/osr-rover-code/blob/cbc4d45269a4250451f477c2d820d781c2d8f1e6/ROS/osr/src/roboclaw_wrapper.py#L450-L458 | |
ospalh/anki-addons | 4ece13423bd541e29d9b40ebe26ca0999a6962b1 | batteries/decimal.py | python | Decimal._ln_exp_bound | (self) | return e + len(str(10**-e - c)) - 1 | Compute a lower bound for the adjusted exponent of self.ln().
In other words, compute r such that self.ln() >= 10**r. Assumes
that self is finite and positive and that self != 1. | Compute a lower bound for the adjusted exponent of self.ln().
In other words, compute r such that self.ln() >= 10**r. Assumes
that self is finite and positive and that self != 1. | [
"Compute",
"a",
"lower",
"bound",
"for",
"the",
"adjusted",
"exponent",
"of",
"self",
".",
"ln",
"()",
".",
"In",
"other",
"words",
"compute",
"r",
"such",
"that",
"self",
".",
"ln",
"()",
">",
"=",
"10",
"**",
"r",
".",
"Assumes",
"that",
"self",
... | def _ln_exp_bound(self):
"""Compute a lower bound for the adjusted exponent of self.ln().
In other words, compute r such that self.ln() >= 10**r. Assumes
that self is finite and positive and that self != 1.
"""
# for 0.1 <= x <= 10 we use the inequalities 1-1/x <= ln(x) <= x-1
... | [
"def",
"_ln_exp_bound",
"(",
"self",
")",
":",
"# for 0.1 <= x <= 10 we use the inequalities 1-1/x <= ln(x) <= x-1",
"adj",
"=",
"self",
".",
"_exp",
"+",
"len",
"(",
"self",
".",
"_int",
")",
"-",
"1",
"if",
"adj",
">=",
"1",
":",
"# argument >= 10; we use 23/10 ... | https://github.com/ospalh/anki-addons/blob/4ece13423bd541e29d9b40ebe26ca0999a6962b1/batteries/decimal.py#L3057-L3079 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/setuptools/msvc.py | python | RegistryInfo.lookup | (self, key, name) | Look for values in registry in Microsoft software registry.
Parameters
----------
key: str
Registry key path where look.
name: str
Value name to find.
Return
------
str: value | Look for values in registry in Microsoft software registry. | [
"Look",
"for",
"values",
"in",
"registry",
"in",
"Microsoft",
"software",
"registry",
"."
] | def lookup(self, key, name):
"""
Look for values in registry in Microsoft software registry.
Parameters
----------
key: str
Registry key path where look.
name: str
Value name to find.
Return
------
str: value
"""
... | [
"def",
"lookup",
"(",
"self",
",",
"key",
",",
"name",
")",
":",
"KEY_READ",
"=",
"winreg",
".",
"KEY_READ",
"openkey",
"=",
"winreg",
".",
"OpenKey",
"ms",
"=",
"self",
".",
"microsoft",
"for",
"hkey",
"in",
"self",
".",
"HKEYS",
":",
"try",
":",
... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/setuptools/msvc.py#L429-L461 | ||
googlecolab/colabtools | b7b3566363e2f0bad9ad256ae317314ba5bd42f8 | google/colab/html/_html.py | python | _call_js_function | (js_function, *args) | return output.eval_js("""
(function() {{
const msg = JSON.parse(window["{name}"]);
delete window["{name}"];
return ({js_function})(...msg);
}})();
""".format(name=name, js_function=js_function)) | Evaluates a javascript string with arguments and returns its value. | Evaluates a javascript string with arguments and returns its value. | [
"Evaluates",
"a",
"javascript",
"string",
"with",
"arguments",
"and",
"returns",
"its",
"value",
"."
] | def _call_js_function(js_function, *args):
"""Evaluates a javascript string with arguments and returns its value."""
serialized = json.dumps(args)
if len(serialized) < _MSG_CHUNK_SIZE:
return output.eval_js('({})(...{})'.format(js_function, serialized))
name = str(uuid.uuid4())
for i in range(0, len(seri... | [
"def",
"_call_js_function",
"(",
"js_function",
",",
"*",
"args",
")",
":",
"serialized",
"=",
"json",
".",
"dumps",
"(",
"args",
")",
"if",
"len",
"(",
"serialized",
")",
"<",
"_MSG_CHUNK_SIZE",
":",
"return",
"output",
".",
"eval_js",
"(",
"'({})(...{})'... | https://github.com/googlecolab/colabtools/blob/b7b3566363e2f0bad9ad256ae317314ba5bd42f8/google/colab/html/_html.py#L69-L89 | |
legendmohe/LEHome | a959a2fe64a23c58de7c0ff3254eae8c27732320 | vendor/baidu_push/Channel.py | python | Channel.queryDeviceType | (self, channelId, optional = None) | 根据channelId查询设备类型
参数:
ChannelId:用户Channel的ID号
optional:可选参数
返回值:
成功:python字典; 失败:False | 根据channelId查询设备类型
参数:
ChannelId:用户Channel的ID号
optional:可选参数
返回值:
成功:python字典; 失败:False | [
"根据channelId查询设备类型",
"参数:",
"ChannelId",
":",
"用户Channel的ID号",
"optional",
":",
"可选参数",
"返回值:",
"成功:python字典;",
"失败:False"
] | def queryDeviceType(self, channelId, optional = None):
"""
根据channelId查询设备类型
参数:
ChannelId:用户Channel的ID号
optional:可选参数
返回值:
成功:python字典; 失败:False
"""
try:
tmpArgs = [channelId, optional]
arrArgs = self._mergeArgs([Channel.CHANNEL_ID], tmpArgs)
arrArgs[Channel.METHOD] = 'query_device_type';... | [
"def",
"queryDeviceType",
"(",
"self",
",",
"channelId",
",",
"optional",
"=",
"None",
")",
":",
"try",
":",
"tmpArgs",
"=",
"[",
"channelId",
",",
"optional",
"]",
"arrArgs",
"=",
"self",
".",
"_mergeArgs",
"(",
"[",
"Channel",
".",
"CHANNEL_ID",
"]",
... | https://github.com/legendmohe/LEHome/blob/a959a2fe64a23c58de7c0ff3254eae8c27732320/vendor/baidu_push/Channel.py#L401-L417 | ||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/visualize/utils/heatmap.py | python | HeatmapGridWidget.colorMap | (self) | return self.__colormap | [] | def colorMap(self) -> ColorMap:
return self.__colormap | [
"def",
"colorMap",
"(",
"self",
")",
"->",
"ColorMap",
":",
"return",
"self",
".",
"__colormap"
] | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/utils/heatmap.py#L917-L918 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.