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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/nova/nova/utils.py | python | is_valid_ipv4 | (address) | Verify that address represents a valid IPv4 address. | Verify that address represents a valid IPv4 address. | [
"Verify",
"that",
"address",
"represents",
"a",
"valid",
"IPv4",
"address",
"."
] | def is_valid_ipv4(address):
"""Verify that address represents a valid IPv4 address."""
try:
return netaddr.valid_ipv4(address)
except Exception:
return False | [
"def",
"is_valid_ipv4",
"(",
"address",
")",
":",
"try",
":",
"return",
"netaddr",
".",
"valid_ipv4",
"(",
"address",
")",
"except",
"Exception",
":",
"return",
"False"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/utils.py#L887-L892 | ||
ucsb-seclab/karonte | 427ac313e596f723e40768b95d13bd7a9fc92fd8 | tool/taint_analysis/coretaint.py | python | CoreTaint.do_recursive_untaint | (self, dst, path) | return self._do_recursive_untaint_core(dst, path) | Perform the untaint operation (see do_recursive_untaint_core)
:param dst: variable to untaint
:param path: angr path
:return: | Perform the untaint operation (see do_recursive_untaint_core) | [
"Perform",
"the",
"untaint",
"operation",
"(",
"see",
"do_recursive_untaint_core",
")"
] | def do_recursive_untaint(self, dst, path):
"""
Perform the untaint operation (see do_recursive_untaint_core)
:param dst: variable to untaint
:param path: angr path
:return:
"""
return self._do_recursive_untaint_core(dst, path) | [
"def",
"do_recursive_untaint",
"(",
"self",
",",
"dst",
",",
"path",
")",
":",
"return",
"self",
".",
"_do_recursive_untaint_core",
"(",
"dst",
",",
"path",
")"
] | https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/tool/taint_analysis/coretaint.py#L587-L596 | |
PaddlePaddle/PaddleSlim | f895aebe441b2bef79ecc434626d3cac4b3cbd09 | paddleslim/nas/early_stop/median_stop/median_stop.py | python | MedianStop._convert_running2completed | (self, exp_name, status) | Convert experiment record from running to complete.
Args:
exp_name<str>: the name of experiment.
status<str>: the status of this experiment. | Convert experiment record from running to complete. | [
"Convert",
"experiment",
"record",
"from",
"running",
"to",
"complete",
"."
] | def _convert_running2completed(self, exp_name, status):
"""
Convert experiment record from running to complete.
Args:
exp_name<str>: the name of experiment.
status<str>: the status of this experiment.
"""
_logger.debug('the status of this experiment is {}'.... | [
"def",
"_convert_running2completed",
"(",
"self",
",",
"exp_name",
",",
"status",
")",
":",
"_logger",
".",
"debug",
"(",
"'the status of this experiment is {}'",
".",
"format",
"(",
"status",
")",
")",
"completed_avg_history",
"=",
"dict",
"(",
")",
"if",
"exp_... | https://github.com/PaddlePaddle/PaddleSlim/blob/f895aebe441b2bef79ecc434626d3cac4b3cbd09/paddleslim/nas/early_stop/median_stop/median_stop.py#L79-L108 | ||
PaddlePaddle/PaddleSpeech | 26524031d242876b7fdb71582b0b3a7ea45c7d9d | utils/utility.py | python | download | (url, md5sum, target_dir) | return filepath | Download file from url to target_dir, and check md5sum. | Download file from url to target_dir, and check md5sum. | [
"Download",
"file",
"from",
"url",
"to",
"target_dir",
"and",
"check",
"md5sum",
"."
] | def download(url, md5sum, target_dir):
"""Download file from url to target_dir, and check md5sum."""
if not os.path.exists(target_dir):
os.makedirs(target_dir)
filepath = os.path.join(target_dir, url.split("/")[-1])
if not (os.path.exists(filepath) and md5file(filepath) == md5sum):
print... | [
"def",
"download",
"(",
"url",
",",
"md5sum",
",",
"target_dir",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"target_dir",
")",
":",
"os",
".",
"makedirs",
"(",
"target_dir",
")",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
"... | https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/utils/utility.py#L136-L149 | |
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/modules/storage/partitioning/custom/custom_module.py | python | CustomPartitioningModule.for_publication | (self) | return CustomPartitioningInterface(self) | Return a DBus representation. | Return a DBus representation. | [
"Return",
"a",
"DBus",
"representation",
"."
] | def for_publication(self):
"""Return a DBus representation."""
return CustomPartitioningInterface(self) | [
"def",
"for_publication",
"(",
"self",
")",
":",
"return",
"CustomPartitioningInterface",
"(",
"self",
")"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/storage/partitioning/custom/custom_module.py#L56-L58 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/models.py | python | Response.content | (self) | return self._content | Content of the response, in bytes. | Content of the response, in bytes. | [
"Content",
"of",
"the",
"response",
"in",
"bytes",
"."
] | def content(self):
"""Content of the response, in bytes."""
if self._content is False:
# Read the contents.
if self._content_consumed:
raise RuntimeError(
'The content for this response was already consumed')
if self.status_code =... | [
"def",
"content",
"(",
"self",
")",
":",
"if",
"self",
".",
"_content",
"is",
"False",
":",
"# Read the contents.",
"if",
"self",
".",
"_content_consumed",
":",
"raise",
"RuntimeError",
"(",
"'The content for this response was already consumed'",
")",
"if",
"self",
... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/models.py#L816-L833 | |
OpenAgricultureFoundation/openag-device-software | a51d2de399c0a6781ae51d0dcfaae1583d75f346 | device/controllers/modules/pid/pid.py | python | PID.setKi | (self, integral_gain: float) | Determines how aggressively the PID reacts to the current error
with setting Integral Gain | Determines how aggressively the PID reacts to the current error
with setting Integral Gain | [
"Determines",
"how",
"aggressively",
"the",
"PID",
"reacts",
"to",
"the",
"current",
"error",
"with",
"setting",
"Integral",
"Gain"
] | def setKi(self, integral_gain: float) -> None:
"""Determines how aggressively the PID reacts to the current error
with setting Integral Gain"""
self.Ki = integral_gain | [
"def",
"setKi",
"(",
"self",
",",
"integral_gain",
":",
"float",
")",
"->",
"None",
":",
"self",
".",
"Ki",
"=",
"integral_gain"
] | https://github.com/OpenAgricultureFoundation/openag-device-software/blob/a51d2de399c0a6781ae51d0dcfaae1583d75f346/device/controllers/modules/pid/pid.py#L106-L109 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/configparser.py | python | RawConfigParser.defaults | (self) | return self._defaults | [] | def defaults(self):
return self._defaults | [
"def",
"defaults",
"(",
"self",
")",
":",
"return",
"self",
".",
"_defaults"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/configparser.py#L633-L634 | |||
amonapp/amon | 61ae3575ad98ec4854ea87c213aa8dfbb29a0199 | amon/templatetags/math.py | python | substract | (element, second_element) | return result | [] | def substract(element, second_element):
result = float(element)-float(second_element)
return result | [
"def",
"substract",
"(",
"element",
",",
"second_element",
")",
":",
"result",
"=",
"float",
"(",
"element",
")",
"-",
"float",
"(",
"second_element",
")",
"return",
"result"
] | https://github.com/amonapp/amon/blob/61ae3575ad98ec4854ea87c213aa8dfbb29a0199/amon/templatetags/math.py#L12-L14 | |||
gaojiuli/gain | 2c8160c92943837613a773f681fb190a8c434bb2 | gain/result/file_result.py | python | FileResult.save_to_file | (self, results) | save results to file Asynchronous
:param results: str
:return: None | save results to file Asynchronous
:param results: str
:return: None | [
"save",
"results",
"to",
"file",
"Asynchronous",
":",
"param",
"results",
":",
"str",
":",
"return",
":",
"None"
] | async def save_to_file(self, results):
"""
save results to file Asynchronous
:param results: str
:return: None
"""
async with aiofiles.open(self.path, 'a+') as f:
await f.write(results) | [
"async",
"def",
"save_to_file",
"(",
"self",
",",
"results",
")",
":",
"async",
"with",
"aiofiles",
".",
"open",
"(",
"self",
".",
"path",
",",
"'a+'",
")",
"as",
"f",
":",
"await",
"f",
".",
"write",
"(",
"results",
")"
] | https://github.com/gaojiuli/gain/blob/2c8160c92943837613a773f681fb190a8c434bb2/gain/result/file_result.py#L32-L39 | ||
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/django/contrib/gis/geos/io.py | python | WKTReader.read | (self, wkt) | return GEOSGeometry(super(WKTReader, self).read(wkt)) | Returns a GEOSGeometry for the given WKT string. | Returns a GEOSGeometry for the given WKT string. | [
"Returns",
"a",
"GEOSGeometry",
"for",
"the",
"given",
"WKT",
"string",
"."
] | def read(self, wkt):
"Returns a GEOSGeometry for the given WKT string."
return GEOSGeometry(super(WKTReader, self).read(wkt)) | [
"def",
"read",
"(",
"self",
",",
"wkt",
")",
":",
"return",
"GEOSGeometry",
"(",
"super",
"(",
"WKTReader",
",",
"self",
")",
".",
"read",
"(",
"wkt",
")",
")"
] | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/contrib/gis/geos/io.py#L16-L18 | |
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v5_1/build/build_client.py | python | BuildClient.restore_webhooks | (self, trigger_types, project, provider_name, service_endpoint_id=None, repository=None) | RestoreWebhooks.
[Preview API] Recreates the webhooks for the specified triggers in the given source code repository.
:param [DefinitionTriggerType] trigger_types: The types of triggers to restore webhooks for.
:param str project: Project ID or project name
:param str provider_name: The ... | RestoreWebhooks.
[Preview API] Recreates the webhooks for the specified triggers in the given source code repository.
:param [DefinitionTriggerType] trigger_types: The types of triggers to restore webhooks for.
:param str project: Project ID or project name
:param str provider_name: The ... | [
"RestoreWebhooks",
".",
"[",
"Preview",
"API",
"]",
"Recreates",
"the",
"webhooks",
"for",
"the",
"specified",
"triggers",
"in",
"the",
"given",
"source",
"code",
"repository",
".",
":",
"param",
"[",
"DefinitionTriggerType",
"]",
"trigger_types",
":",
"The",
... | def restore_webhooks(self, trigger_types, project, provider_name, service_endpoint_id=None, repository=None):
"""RestoreWebhooks.
[Preview API] Recreates the webhooks for the specified triggers in the given source code repository.
:param [DefinitionTriggerType] trigger_types: The types of trigge... | [
"def",
"restore_webhooks",
"(",
"self",
",",
"trigger_types",
",",
"project",
",",
"provider_name",
",",
"service_endpoint_id",
"=",
"None",
",",
"repository",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/build/build_client.py#L1863-L1888 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/ocr/v20181119/models.py | python | EstateCertOCRResponse.__init__ | (self) | r"""
:param Obligee: 权利人
:type Obligee: str
:param Ownership: 共有情况
:type Ownership: str
:param Location: 坐落
:type Location: str
:param Unit: 不动产单元号
:type Unit: str
:param Type: 权利类型
:type Type: str
:param Property: 权利性质
:typ... | r"""
:param Obligee: 权利人
:type Obligee: str
:param Ownership: 共有情况
:type Ownership: str
:param Location: 坐落
:type Location: str
:param Unit: 不动产单元号
:type Unit: str
:param Type: 权利类型
:type Type: str
:param Property: 权利性质
:typ... | [
"r",
":",
"param",
"Obligee",
":",
"权利人",
":",
"type",
"Obligee",
":",
"str",
":",
"param",
"Ownership",
":",
"共有情况",
":",
"type",
"Ownership",
":",
"str",
":",
"param",
"Location",
":",
"坐落",
":",
"type",
"Location",
":",
"str",
":",
"param",
"Unit"... | def __init__(self):
r"""
:param Obligee: 权利人
:type Obligee: str
:param Ownership: 共有情况
:type Ownership: str
:param Location: 坐落
:type Location: str
:param Unit: 不动产单元号
:type Unit: str
:param Type: 权利类型
:type Type: str
:param... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Obligee",
"=",
"None",
"self",
".",
"Ownership",
"=",
"None",
"self",
".",
"Location",
"=",
"None",
"self",
".",
"Unit",
"=",
"None",
"self",
".",
"Type",
"=",
"None",
"self",
".",
"Property",
... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ocr/v20181119/models.py#L1691-L1732 | ||
fooying/3102 | 0faee38c30b2e24154f41e68457cfd8f7a61c040 | thirdparty/attrdict/__init__.py | python | AttrDict.__delitem__ | (self, key) | del adict[key]
Delete a key-value pair in the instance. | del adict[key] | [
"del",
"adict",
"[",
"key",
"]"
] | def __delitem__(self, key):
"""
del adict[key]
Delete a key-value pair in the instance.
"""
self._delete(key) | [
"def",
"__delitem__",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"_delete",
"(",
"key",
")"
] | https://github.com/fooying/3102/blob/0faee38c30b2e24154f41e68457cfd8f7a61c040/thirdparty/attrdict/__init__.py#L183-L189 | ||
riptideio/pymodbus | c5772b35ae3f29d1947f3ab453d8d00df846459f | pymodbus/transaction.py | python | ModbusTransactionManager.getNextTID | (self) | return self.tid | Retrieve the next unique transaction identifier
This handles incrementing the identifier after
retrieval
:returns: The next unique transaction identifier | Retrieve the next unique transaction identifier | [
"Retrieve",
"the",
"next",
"unique",
"transaction",
"identifier"
] | def getNextTID(self):
""" Retrieve the next unique transaction identifier
This handles incrementing the identifier after
retrieval
:returns: The next unique transaction identifier
"""
self.tid = (self.tid + 1) & 0xffff
return self.tid | [
"def",
"getNextTID",
"(",
"self",
")",
":",
"self",
".",
"tid",
"=",
"(",
"self",
".",
"tid",
"+",
"1",
")",
"&",
"0xffff",
"return",
"self",
".",
"tid"
] | https://github.com/riptideio/pymodbus/blob/c5772b35ae3f29d1947f3ab453d8d00df846459f/pymodbus/transaction.py#L407-L416 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/tkinter/__init__.py | python | Misc.winfo_rooty | (self) | return self.tk.getint(
self.tk.call('winfo', 'rooty', self._w)) | Return y coordinate of upper left corner of this widget on the
root window. | Return y coordinate of upper left corner of this widget on the
root window. | [
"Return",
"y",
"coordinate",
"of",
"upper",
"left",
"corner",
"of",
"this",
"widget",
"on",
"the",
"root",
"window",
"."
] | def winfo_rooty(self):
"""Return y coordinate of upper left corner of this widget on the
root window."""
return self.tk.getint(
self.tk.call('winfo', 'rooty', self._w)) | [
"def",
"winfo_rooty",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'rooty'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/__init__.py#L906-L910 | |
CMA-ES/pycma | f6eed1ef7e747cec1ab2e5c835d6f2fd1ebc097f | cma/transformations.py | python | BoxConstraintsLinQuadTransformation.is_loosely_feasible_i | (self, x, i) | return lb - 2 * al - (ub - lb) / 2.0 <= x <= ub + 2 * au + (ub - lb) / 2.0 | never used | never used | [
"never",
"used"
] | def is_loosely_feasible_i(self, x, i):
"""never used"""
lb = self._lb[self._index(i)]
ub = self._ub[self._index(i)]
al = self._al[self._index(i)]
au = self._au[self._index(i)]
return lb - 2 * al - (ub - lb) / 2.0 <= x <= ub + 2 * au + (ub - lb) / 2.0 | [
"def",
"is_loosely_feasible_i",
"(",
"self",
",",
"x",
",",
"i",
")",
":",
"lb",
"=",
"self",
".",
"_lb",
"[",
"self",
".",
"_index",
"(",
"i",
")",
"]",
"ub",
"=",
"self",
".",
"_ub",
"[",
"self",
".",
"_index",
"(",
"i",
")",
"]",
"al",
"="... | https://github.com/CMA-ES/pycma/blob/f6eed1ef7e747cec1ab2e5c835d6f2fd1ebc097f/cma/transformations.py#L360-L366 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.viewkeys | (self) | return KeysView(self) | od.viewkeys() -> a set-like object providing a view on od's keys | od.viewkeys() -> a set-like object providing a view on od's keys | [
"od",
".",
"viewkeys",
"()",
"-",
">",
"a",
"set",
"-",
"like",
"object",
"providing",
"a",
"view",
"on",
"od",
"s",
"keys"
] | def viewkeys(self):
"od.viewkeys() -> a set-like object providing a view on od's keys"
return KeysView(self) | [
"def",
"viewkeys",
"(",
"self",
")",
":",
"return",
"KeysView",
"(",
"self",
")"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py#L249-L251 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/all/pupwinutils/processes.py | python | is_process_64_from_handle | (hProcess) | return not iswow64.value | Take a process handle. return True if process is 64 bits, and False otherwise. | Take a process handle. return True if process is 64 bits, and False otherwise. | [
"Take",
"a",
"process",
"handle",
".",
"return",
"True",
"if",
"process",
"is",
"64",
"bits",
"and",
"False",
"otherwise",
"."
] | def is_process_64_from_handle(hProcess):
""" Take a process handle. return True if process is 64 bits, and False otherwise. """
iswow64 = c_bool(False)
if not hasattr(windll.kernel32,'IsWow64Process'):
return False
windll.kernel32.IsWow64Process(hProcess, byref(iswow64))
return not iswow64.value | [
"def",
"is_process_64_from_handle",
"(",
"hProcess",
")",
":",
"iswow64",
"=",
"c_bool",
"(",
"False",
")",
"if",
"not",
"hasattr",
"(",
"windll",
".",
"kernel32",
",",
"'IsWow64Process'",
")",
":",
"return",
"False",
"windll",
".",
"kernel32",
".",
"IsWow64... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/all/pupwinutils/processes.py#L35-L41 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/lib-tk/Tkinter.py | python | Canvas.select_clear | (self) | Clear the selection if it is in this widget. | Clear the selection if it is in this widget. | [
"Clear",
"the",
"selection",
"if",
"it",
"is",
"in",
"this",
"widget",
"."
] | def select_clear(self):
"""Clear the selection if it is in this widget."""
self.tk.call(self._w, 'select', 'clear') | [
"def",
"select_clear",
"(",
"self",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'select'",
",",
"'clear'",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/Tkinter.py#L2449-L2451 | ||
Garvit244/Leetcode | a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29 | 1-100q/45.py | python | Solution.jump | (self, nums) | return steps if maxReach == len(nums) - 1 else 0 | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def jump(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
steps, lastRearch, maxReach = 0, 0 ,0
for index in range(len(nums)):
if index > lastRearch:
lastRearch = maxReach
steps += 1
maxReach = max(maxReach, index + nums[index]... | [
"def",
"jump",
"(",
"self",
",",
"nums",
")",
":",
"steps",
",",
"lastRearch",
",",
"maxReach",
"=",
"0",
",",
"0",
",",
"0",
"for",
"index",
"in",
"range",
"(",
"len",
"(",
"nums",
")",
")",
":",
"if",
"index",
">",
"lastRearch",
":",
"lastRearc... | https://github.com/Garvit244/Leetcode/blob/a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29/1-100q/45.py#L18-L31 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.__rxor__ | (self, other ) | return other ^ self | Implementation of ^ operator when left operand is not a C{L{ParserElement}} | Implementation of ^ operator when left operand is not a C{L{ParserElement}} | [
"Implementation",
"of",
"^",
"operator",
"when",
"left",
"operand",
"is",
"not",
"a",
"C",
"{",
"L",
"{",
"ParserElement",
"}}"
] | def __rxor__(self, other ):
"""
Implementation of ^ operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn(... | [
"def",
"__rxor__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/pyparsing.py#L1943-L1953 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/future/backports/email/_header_value_parser.py | python | WhiteSpaceTerminal.value | (self) | return ' ' | [] | def value(self):
return ' ' | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"' '"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/future/backports/email/_header_value_parser.py#L1277-L1278 | |||
iniqua/plecost | ef0d89bfdf1ef870bd11b1d8bdf93a8ce9ec6ca0 | plecost_lib/libs/wordlist.py | python | get_wordlist | (wordlist_name) | Get and iterator of specified word list.
:param wordlist_name: Word list name
:type wordlist_name: basestring
:return: iterator with each line of file.
:rtype: str | Get and iterator of specified word list. | [
"Get",
"and",
"iterator",
"of",
"specified",
"word",
"list",
"."
] | def get_wordlist(wordlist_name):
"""
Get and iterator of specified word list.
:param wordlist_name: Word list name
:type wordlist_name: basestring
:return: iterator with each line of file.
:rtype: str
"""
if not isinstance(wordlist_name, str):
raise TypeError("Expected basestri... | [
"def",
"get_wordlist",
"(",
"wordlist_name",
")",
":",
"if",
"not",
"isinstance",
"(",
"wordlist_name",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"Expected basestring, got '%s' instead\"",
"%",
"type",
"(",
"wordlist_name",
")",
")",
"word_list_name",
"="... | https://github.com/iniqua/plecost/blob/ef0d89bfdf1ef870bd11b1d8bdf93a8ce9ec6ca0/plecost_lib/libs/wordlist.py#L68-L88 | ||
dipy/dipy | be956a529465b28085f8fc435a756947ddee1c89 | dipy/reconst/qtdmri.py | python | QtdmriFit.norm_of_laplacian_signal | (self) | return norm_laplacian | Calculates the norm of the laplacian of the fitted signal [1]_.
This information could be useful to assess if the extrapolation of the
fitted signal contains spurious oscillations. A high laplacian norm may
indicate that these are present, and any q-space indices that
use integrals of th... | Calculates the norm of the laplacian of the fitted signal [1]_.
This information could be useful to assess if the extrapolation of the
fitted signal contains spurious oscillations. A high laplacian norm may
indicate that these are present, and any q-space indices that
use integrals of th... | [
"Calculates",
"the",
"norm",
"of",
"the",
"laplacian",
"of",
"the",
"fitted",
"signal",
"[",
"1",
"]",
"_",
".",
"This",
"information",
"could",
"be",
"useful",
"to",
"assess",
"if",
"the",
"extrapolation",
"of",
"the",
"fitted",
"signal",
"contains",
"spu... | def norm_of_laplacian_signal(self):
""" Calculates the norm of the laplacian of the fitted signal [1]_.
This information could be useful to assess if the extrapolation of the
fitted signal contains spurious oscillations. A high laplacian norm may
indicate that these are present, and any ... | [
"def",
"norm_of_laplacian_signal",
"(",
"self",
")",
":",
"if",
"self",
".",
"model",
".",
"cartesian",
":",
"lap_matrix",
"=",
"qtdmri_laplacian_reg_matrix",
"(",
"self",
".",
"model",
".",
"ind_mat",
",",
"self",
".",
"us",
",",
"self",
".",
"ut",
",",
... | https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/reconst/qtdmri.py#L1010-L1048 | |
tern-tools/tern | 723f43dcaae2f2f0a08a63e5e8de3938031a386e | tern/load/docker_api.py | python | build_and_dump | (dockerfile) | return image_metadata | Given a path to the dockerfile, use the Docker API to build the
container image and extract the image into a working directory. Return
true if this succeeded and false if it didn't | Given a path to the dockerfile, use the Docker API to build the
container image and extract the image into a working directory. Return
true if this succeeded and false if it didn't | [
"Given",
"a",
"path",
"to",
"the",
"dockerfile",
"use",
"the",
"Docker",
"API",
"to",
"build",
"the",
"container",
"image",
"and",
"extract",
"the",
"image",
"into",
"a",
"working",
"directory",
".",
"Return",
"true",
"if",
"this",
"succeeded",
"and",
"fal... | def build_and_dump(dockerfile):
"""Given a path to the dockerfile, use the Docker API to build the
container image and extract the image into a working directory. Return
true if this succeeded and false if it didn't"""
image_metadata = None
# open up a client first
# if this fails we cannot proc... | [
"def",
"build_and_dump",
"(",
"dockerfile",
")",
":",
"image_metadata",
"=",
"None",
"# open up a client first",
"# if this fails we cannot proceed further so we will exit",
"client",
"=",
"check_docker_setup",
"(",
")",
"image",
"=",
"build_image",
"(",
"dockerfile",
",",
... | https://github.com/tern-tools/tern/blob/723f43dcaae2f2f0a08a63e5e8de3938031a386e/tern/load/docker_api.py#L128-L146 | |
BMW-InnovationLab/BMW-TensorFlow-Training-GUI | 4f10d1f00f9ac312ca833e5b28fd0f8952cfee17 | training_api/research/object_detection/predictors/heads/mask_head.py | python | MaskRCNNMaskHead._get_mask_predictor_conv_depth | (self,
num_feature_channels,
num_classes,
class_weight=3.0,
feature_weight=2.0) | return int(math.pow(2.0, num_conv_channels_log)) | Computes the depth of the mask predictor convolutions.
Computes the depth of the mask predictor convolutions given feature channels
and number of classes by performing a weighted average of the two in
log space to compute the number of convolution channels. The weights that
are used for computing the w... | Computes the depth of the mask predictor convolutions. | [
"Computes",
"the",
"depth",
"of",
"the",
"mask",
"predictor",
"convolutions",
"."
] | def _get_mask_predictor_conv_depth(self,
num_feature_channels,
num_classes,
class_weight=3.0,
feature_weight=2.0):
"""Computes the depth of the mask predictor convoluti... | [
"def",
"_get_mask_predictor_conv_depth",
"(",
"self",
",",
"num_feature_channels",
",",
"num_classes",
",",
"class_weight",
"=",
"3.0",
",",
"feature_weight",
"=",
"2.0",
")",
":",
"num_feature_channels_log",
"=",
"math",
".",
"log",
"(",
"float",
"(",
"num_featur... | https://github.com/BMW-InnovationLab/BMW-TensorFlow-Training-GUI/blob/4f10d1f00f9ac312ca833e5b28fd0f8952cfee17/training_api/research/object_detection/predictors/heads/mask_head.py#L80-L112 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/x509.py | python | create_certificate | (path=None, text=False, overwrite=True, ca_server=None, **kwargs) | Create an X509 certificate.
path:
Path to write the certificate to.
text:
If ``True``, return the PEM text without writing to a file.
Default ``False``.
overwrite:
If ``True`` (default), create_certificate will overwrite the entire PEM
file. Set False to preserve e... | Create an X509 certificate. | [
"Create",
"an",
"X509",
"certificate",
"."
] | def create_certificate(path=None, text=False, overwrite=True, ca_server=None, **kwargs):
"""
Create an X509 certificate.
path:
Path to write the certificate to.
text:
If ``True``, return the PEM text without writing to a file.
Default ``False``.
overwrite:
If ``Tru... | [
"def",
"create_certificate",
"(",
"path",
"=",
"None",
",",
"text",
"=",
"False",
",",
"overwrite",
"=",
"True",
",",
"ca_server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"not",
"path",
"and",
"not",
"text",
"and",
"(",
"\"testrun\... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/x509.py#L1135-L1688 | ||
isce-framework/isce2 | 0e5114a8bede3caf1d533d98e44dfe4b983e3f48 | components/isceobj/TopsProc/runPrepESD.py | python | runPrepESD | (self) | Create additional layers for performing ESD. | Create additional layers for performing ESD. | [
"Create",
"additional",
"layers",
"for",
"performing",
"ESD",
"."
] | def runPrepESD(self):
'''
Create additional layers for performing ESD.
'''
if not self.doESD:
return
swathList = self._insar.getValidSwathList(self.swaths)
for swath in swathList:
if self._insar.numberOfCommonBursts[swath-1] < 2:
print('Skipping prepesd for swath... | [
"def",
"runPrepESD",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"doESD",
":",
"return",
"swathList",
"=",
"self",
".",
"_insar",
".",
"getValidSwathList",
"(",
"self",
".",
"swaths",
")",
"for",
"swath",
"in",
"swathList",
":",
"if",
"self",
".",... | https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/isceobj/TopsProc/runPrepESD.py#L209-L326 | ||
dropbox/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | changes/queue/task.py | python | TrackedTask._update | (self, kwargs) | return bool(count) | Update's the state of this Task.
>>> task._update(status=Status.finished)
Returns:
bool: Whether anything was updated. | Update's the state of this Task. | [
"Update",
"s",
"the",
"state",
"of",
"this",
"Task",
"."
] | def _update(self, kwargs):
"""
Update's the state of this Task.
>>> task._update(status=Status.finished)
Returns:
bool: Whether anything was updated.
"""
assert self.task_id
count = Task.query.filter(
Task.task_name == self.task_name,
... | [
"def",
"_update",
"(",
"self",
",",
"kwargs",
")",
":",
"assert",
"self",
".",
"task_id",
"count",
"=",
"Task",
".",
"query",
".",
"filter",
"(",
"Task",
".",
"task_name",
"==",
"self",
".",
"task_name",
",",
"Task",
".",
"task_id",
"==",
"self",
"."... | https://github.com/dropbox/changes/blob/37e23c3141b75e4785cf398d015e3dbca41bdd56/changes/queue/task.py#L167-L183 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/venv/lib/python3.6/site-packages/pygame/examples/arraydemo.py | python | surfdemo_show | (array_img, name) | displays a surface, waits for user to continue | displays a surface, waits for user to continue | [
"displays",
"a",
"surface",
"waits",
"for",
"user",
"to",
"continue"
] | def surfdemo_show(array_img, name):
"displays a surface, waits for user to continue"
screen = pygame.display.set_mode(array_img.shape[:2], 0, 32)
surfarray.blit_array(screen, array_img)
pygame.display.flip()
pygame.display.set_caption(name)
while 1:
e = pygame.event.wait()
if e.t... | [
"def",
"surfdemo_show",
"(",
"array_img",
",",
"name",
")",
":",
"screen",
"=",
"pygame",
".",
"display",
".",
"set_mode",
"(",
"array_img",
".",
"shape",
"[",
":",
"2",
"]",
",",
"0",
",",
"32",
")",
"surfarray",
".",
"blit_array",
"(",
"screen",
",... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pygame/examples/arraydemo.py#L11-L33 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/dbm/dumb.py | python | _Database._setval | (self, pos, val) | return (pos, len(val)) | [] | def _setval(self, pos, val):
with _io.open(self._datfile, 'rb+') as f:
f.seek(pos)
f.write(val)
return (pos, len(val)) | [
"def",
"_setval",
"(",
"self",
",",
"pos",
",",
"val",
")",
":",
"with",
"_io",
".",
"open",
"(",
"self",
".",
"_datfile",
",",
"'rb+'",
")",
"as",
"f",
":",
"f",
".",
"seek",
"(",
"pos",
")",
"f",
".",
"write",
"(",
"val",
")",
"return",
"("... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/dbm/dumb.py#L171-L175 | |||
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/core/configuration/anaconda.py | python | AnacondaConfiguration.set_from_opts | (self, opts) | Set the configuration from the Anaconda cmdline options.
This code is too related to the Anaconda cmdline options, so it shouldn't
be part of this class. We should find a better, more universal, way to change
the Anaconda configuration.
FIXME: This is a temporary solution.
:pa... | Set the configuration from the Anaconda cmdline options. | [
"Set",
"the",
"configuration",
"from",
"the",
"Anaconda",
"cmdline",
"options",
"."
] | def set_from_opts(self, opts):
"""Set the configuration from the Anaconda cmdline options.
This code is too related to the Anaconda cmdline options, so it shouldn't
be part of this class. We should find a better, more universal, way to change
the Anaconda configuration.
FIXME: ... | [
"def",
"set_from_opts",
"(",
"self",
",",
"opts",
")",
":",
"if",
"opts",
".",
"debug",
":",
"self",
".",
"anaconda",
".",
"_set_option",
"(",
"\"debug\"",
",",
"True",
")",
"# Set \"nosave flags\".",
"if",
"\"can_copy_input_kickstart\"",
"in",
"opts",
":",
... | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/core/configuration/anaconda.py#L342-L406 | ||
shapely/shapely | 9258e6dd4dcca61699d69c2a5853a486b132ed86 | shapely/geometry/base.py | python | BaseGeometry.minimum_clearance | (self) | return float(shapely.minimum_clearance(self)) | Unitless distance by which a node could be moved to produce an invalid geometry (float) | Unitless distance by which a node could be moved to produce an invalid geometry (float) | [
"Unitless",
"distance",
"by",
"which",
"a",
"node",
"could",
"be",
"moved",
"to",
"produce",
"an",
"invalid",
"geometry",
"(",
"float",
")"
] | def minimum_clearance(self):
"""Unitless distance by which a node could be moved to produce an invalid geometry (float)"""
return float(shapely.minimum_clearance(self)) | [
"def",
"minimum_clearance",
"(",
"self",
")",
":",
"return",
"float",
"(",
"shapely",
".",
"minimum_clearance",
"(",
"self",
")",
")"
] | https://github.com/shapely/shapely/blob/9258e6dd4dcca61699d69c2a5853a486b132ed86/shapely/geometry/base.py#L250-L252 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventDetails.get_sharing_change_link_enforce_password_policy_details | (self) | return self._value | Only call this if :meth:`is_sharing_change_link_enforce_password_policy_details` is true.
:rtype: SharingChangeLinkEnforcePasswordPolicyDetails | Only call this if :meth:`is_sharing_change_link_enforce_password_policy_details` is true. | [
"Only",
"call",
"this",
"if",
":",
"meth",
":",
"is_sharing_change_link_enforce_password_policy_details",
"is",
"true",
"."
] | def get_sharing_change_link_enforce_password_policy_details(self):
"""
Only call this if :meth:`is_sharing_change_link_enforce_password_policy_details` is true.
:rtype: SharingChangeLinkEnforcePasswordPolicyDetails
"""
if not self.is_sharing_change_link_enforce_password_policy_d... | [
"def",
"get_sharing_change_link_enforce_password_policy_details",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_sharing_change_link_enforce_password_policy_details",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"\"tag 'sharing_change_link_enforce_password_policy_details' n... | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L21299-L21307 | |
ni/nidaqmx-python | 62fc6b48cbbb330fe1bcc9aedadc86610a1269b6 | nidaqmx/_task_modules/channels/ci_channel.py | python | CIChannel.ci_velocity_a_input_dig_fltr_enable | (self) | [] | def ci_velocity_a_input_dig_fltr_enable(self):
cfunc = (lib_importer.windll.
DAQmxResetCIVelocityEncoderAInputDigFltrEnable)
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
... | [
"def",
"ci_velocity_a_input_dig_fltr_enable",
"(",
"self",
")",
":",
"cfunc",
"=",
"(",
"lib_importer",
".",
"windll",
".",
"DAQmxResetCIVelocityEncoderAInputDigFltrEnable",
")",
"if",
"cfunc",
".",
"argtypes",
"is",
"None",
":",
"with",
"cfunc",
".",
"arglock",
"... | https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/channels/ci_channel.py#L10849-L10860 | ||||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_adm_router.py | python | RoleBindingConfig.create_dict | (self) | create a default rolebinding as a dict | create a default rolebinding as a dict | [
"create",
"a",
"default",
"rolebinding",
"as",
"a",
"dict"
] | def create_dict(self):
''' create a default rolebinding as a dict '''
self.data['apiVersion'] = 'v1'
self.data['kind'] = 'RoleBinding'
self.data['groupNames'] = self.group_names
self.data['metadata']['name'] = self.name
self.data['metadata']['namespace'] = self.namespace
... | [
"def",
"create_dict",
"(",
"self",
")",
":",
"self",
".",
"data",
"[",
"'apiVersion'",
"]",
"=",
"'v1'",
"self",
".",
"data",
"[",
"'kind'",
"]",
"=",
"'RoleBinding'",
"self",
".",
"data",
"[",
"'groupNames'",
"]",
"=",
"self",
".",
"group_names",
"sel... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_adm_router.py#L2412-L2422 | ||
eleurent/highway-env | 9d63973da854584fe51b00ccee7b24b1bf031418 | highway_env/envs/common/abstract.py | python | AbstractEnv._reset | (self) | Reset the scene: roads and vehicles.
This method must be overloaded by the environments. | Reset the scene: roads and vehicles. | [
"Reset",
"the",
"scene",
":",
"roads",
"and",
"vehicles",
"."
] | def _reset(self) -> None:
"""
Reset the scene: roads and vehicles.
This method must be overloaded by the environments.
"""
raise NotImplementedError() | [
"def",
"_reset",
"(",
"self",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/eleurent/highway-env/blob/9d63973da854584fe51b00ccee7b24b1bf031418/highway_env/envs/common/abstract.py#L193-L199 | ||
spl0k/supysonic | 62bad3b9878a1d22cf040f25dab0fa28a252ba38 | supysonic/daemon/client.py | python | AddWatchedFolderCommand.apply | (self, connection, daemon) | [] | def apply(self, connection, daemon):
if daemon.watcher is not None:
daemon.watcher.add_folder(self._folder) | [
"def",
"apply",
"(",
"self",
",",
"connection",
",",
"daemon",
")",
":",
"if",
"daemon",
".",
"watcher",
"is",
"not",
"None",
":",
"daemon",
".",
"watcher",
".",
"add_folder",
"(",
"self",
".",
"_folder",
")"
] | https://github.com/spl0k/supysonic/blob/62bad3b9878a1d22cf040f25dab0fa28a252ba38/supysonic/daemon/client.py#L28-L30 | ||||
nschloe/quadpy | c4c076d8ddfa968486a2443a95e2fb3780dcde0f | src/quadpy/c3/_classical.py | python | face_midpoint | () | return C3Scheme("Face-Midpoint", d, 3) | [] | def face_midpoint():
d = {"symm_r00": [[frac(1, 6)], [1]]}
return C3Scheme("Face-Midpoint", d, 3) | [
"def",
"face_midpoint",
"(",
")",
":",
"d",
"=",
"{",
"\"symm_r00\"",
":",
"[",
"[",
"frac",
"(",
"1",
",",
"6",
")",
"]",
",",
"[",
"1",
"]",
"]",
"}",
"return",
"C3Scheme",
"(",
"\"Face-Midpoint\"",
",",
"d",
",",
"3",
")"
] | https://github.com/nschloe/quadpy/blob/c4c076d8ddfa968486a2443a95e2fb3780dcde0f/src/quadpy/c3/_classical.py#L16-L18 | |||
mehulj94/BrainDamage | 49a29c2606d5f7c0d9705ae5f4201a6bb25cfe73 | Echoes/ftpnavigator.py | python | FtpNavigator.read_file | (self, filepath) | return pwdFound | [] | def read_file(self, filepath):
f = open(filepath, 'r')
pwdFound = []
for ff in f.readlines():
values = {}
info = ff.split(';')
for i in info:
i = i.split('=')
if i[0] == 'Name':
values['Name'] = i[1]
... | [
"def",
"read_file",
"(",
"self",
",",
"filepath",
")",
":",
"f",
"=",
"open",
"(",
"filepath",
",",
"'r'",
")",
"pwdFound",
"=",
"[",
"]",
"for",
"ff",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"values",
"=",
"{",
"}",
"info",
"=",
"ff",
".",... | https://github.com/mehulj94/BrainDamage/blob/49a29c2606d5f7c0d9705ae5f4201a6bb25cfe73/Echoes/ftpnavigator.py#L15-L41 | |||
betamaxpy/betamax | f06fe32d657a8c78b6e5a00048dff7fa50ad9be6 | src/betamax/matchers/base.py | python | BaseMatcher.match | (self, request, recorded_request) | A method that must be implemented by the user.
:param PreparedRequest request: A requests PreparedRequest object
:param dict recorded_request: A dictionary containing the serialized
request in the cassette
:returns bool: True if they match else False | A method that must be implemented by the user. | [
"A",
"method",
"that",
"must",
"be",
"implemented",
"by",
"the",
"user",
"."
] | def match(self, request, recorded_request):
"""A method that must be implemented by the user.
:param PreparedRequest request: A requests PreparedRequest object
:param dict recorded_request: A dictionary containing the serialized
request in the cassette
:returns bool: True if... | [
"def",
"match",
"(",
"self",
",",
"request",
",",
"recorded_request",
")",
":",
"raise",
"NotImplementedError",
"(",
"'The match method must be implemented on'",
"' %s'",
"%",
"self",
".",
"__class__",
".",
"__name__",
")"
] | https://github.com/betamaxpy/betamax/blob/f06fe32d657a8c78b6e5a00048dff7fa50ad9be6/src/betamax/matchers/base.py#L53-L62 | ||
careermonk/data-structures-and-algorithmic-thinking-with-python | 3c07d9dcec4fd06d0958a96fecd5e228f0378112 | src/chapter06trees/FindMaxInBSTRecursive.py | python | BSTNode.rotateLeft | (self) | Q P
/ \ / \
C P ==> Q B
/ \ / \
A B C A | Q P
/ \ / \
C P ==> Q B
/ \ / \
A B C A | [
"Q",
"P",
"/",
"\\",
"/",
"\\",
"C",
"P",
"==",
">",
"Q",
"B",
"/",
"\\",
"/",
"\\",
"A",
"B",
"C",
"A"
] | def rotateLeft(self):
'''
Q P
/ \ / \
C P ==> Q B
/ \ / \
A B C A
'''
# If you do not understand at first, note that instead of
# moving Q to C's position, I move P instead. So... | [
"def",
"rotateLeft",
"(",
"self",
")",
":",
"# If you do not understand at first, note that instead of",
"# moving Q to C's position, I move P instead. So think on",
"# terms of \"P will be future Q\"",
"Q",
",",
"P",
"=",
"self",
",",
"self",
".",
"right",
"if",
"not",
"P",
... | https://github.com/careermonk/data-structures-and-algorithmic-thinking-with-python/blob/3c07d9dcec4fd06d0958a96fecd5e228f0378112/src/chapter06trees/FindMaxInBSTRecursive.py#L167-L190 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/openshift_facts/library/openshift_facts.py | python | delete_empty_keys | (keylist) | Delete dictionary elements from keylist where "value" is empty.
Args:
keylist(list): A list of builddefault configuration envs.
Returns:
none
Example:
keylist = [{'name': 'HTTP_PROXY', 'value': 'http://file.rdu.redhat.com:3128'},
{'name': 'HT... | Delete dictionary elements from keylist where "value" is empty. | [
"Delete",
"dictionary",
"elements",
"from",
"keylist",
"where",
"value",
"is",
"empty",
"."
] | def delete_empty_keys(keylist):
""" Delete dictionary elements from keylist where "value" is empty.
Args:
keylist(list): A list of builddefault configuration envs.
Returns:
none
Example:
keylist = [{'name': 'HTTP_PROXY', 'value': 'http://file.rdu.redhat.com:3... | [
"def",
"delete_empty_keys",
"(",
"keylist",
")",
":",
"count",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"keylist",
")",
")",
":",
"if",
"len",
"(",
"keylist",
"[",
"i",
"-",
"count",
"]",
"[",
"'value'",
"]",
")",
"==",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/openshift_facts/library/openshift_facts.py#L1201-L1224 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/fields.py | python | ReverseField.subfields | (self) | [] | def subfields(self):
yield "", self.subfield
yield self.name_prefix, self | [
"def",
"subfields",
"(",
"self",
")",
":",
"yield",
"\"\"",
",",
"self",
".",
"subfield",
"yield",
"self",
".",
"name_prefix",
",",
"self"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/fields.py#L1282-L1284 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scattergeo/selected/_textfont.py | python | Textfont.color | (self) | return self["color"] | Sets the text font color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)... | Sets the text font color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)... | [
"Sets",
"the",
"text",
"font",
"color",
"of",
"selected",
"points",
".",
"The",
"color",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0000",
")",
"-",
"An",
"rgb... | def color(self):
"""
Sets the text font color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hs... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scattergeo/selected/_textfont.py#L16-L66 | |
IndicoDataSolutions/finetune | 83ba222eed331df64b2fa7157bb64f0a2eef4a2c | finetune/optimizers/recompute_grads.py | python | underlying_variable_ref | (t) | Find the underlying variable ref.
Traverses through Identity, ReadVariableOp, and Enter ops.
Stops when op type has Variable or VarHandle in name.
Args:
t: a Tensor
Returns:
a Tensor that is a variable ref, or None on error. | Find the underlying variable ref.
Traverses through Identity, ReadVariableOp, and Enter ops.
Stops when op type has Variable or VarHandle in name.
Args:
t: a Tensor
Returns:
a Tensor that is a variable ref, or None on error. | [
"Find",
"the",
"underlying",
"variable",
"ref",
".",
"Traverses",
"through",
"Identity",
"ReadVariableOp",
"and",
"Enter",
"ops",
".",
"Stops",
"when",
"op",
"type",
"has",
"Variable",
"or",
"VarHandle",
"in",
"name",
".",
"Args",
":",
"t",
":",
"a",
"Tens... | def underlying_variable_ref(t):
"""Find the underlying variable ref.
Traverses through Identity, ReadVariableOp, and Enter ops.
Stops when op type has Variable or VarHandle in name.
Args:
t: a Tensor
Returns:
a Tensor that is a variable ref, or None on error.
"""
while t.op.type ... | [
"def",
"underlying_variable_ref",
"(",
"t",
")",
":",
"while",
"t",
".",
"op",
".",
"type",
"in",
"[",
"\"Identity\"",
",",
"\"ReadVariableOp\"",
",",
"\"Enter\"",
"]",
":",
"t",
"=",
"t",
".",
"op",
".",
"inputs",
"[",
"0",
"]",
"op_type",
"=",
"t",... | https://github.com/IndicoDataSolutions/finetune/blob/83ba222eed331df64b2fa7157bb64f0a2eef4a2c/finetune/optimizers/recompute_grads.py#L138-L154 | ||
microsoft/debugpy | be8dd607f6837244e0b565345e497aff7a0c08bf | src/debugpy/_vendored/pydevd/third_party/pep8/autopep8.py | python | FixPEP8.fix_long_line_logically | (self, result, logical) | Try to make lines fit within --max-line-length characters. | Try to make lines fit within --max-line-length characters. | [
"Try",
"to",
"make",
"lines",
"fit",
"within",
"--",
"max",
"-",
"line",
"-",
"length",
"characters",
"."
] | def fix_long_line_logically(self, result, logical):
"""Try to make lines fit within --max-line-length characters."""
if (
not logical or
len(logical[2]) == 1 or
self.source[result['line'] - 1].lstrip().startswith('#')
):
return self.fix_long_line_p... | [
"def",
"fix_long_line_logically",
"(",
"self",
",",
"result",
",",
"logical",
")",
":",
"if",
"(",
"not",
"logical",
"or",
"len",
"(",
"logical",
"[",
"2",
"]",
")",
"==",
"1",
"or",
"self",
".",
"source",
"[",
"result",
"[",
"'line'",
"]",
"-",
"1... | https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/_vendored/pydevd/third_party/pep8/autopep8.py#L817-L850 | ||
aws/aws-xray-sdk-python | 71436ad7f275c603298da68bee072af7c214cfc3 | aws_xray_sdk/core/models/dummy_entities.py | python | DummySubsegment.add_exception | (self, exception, stack, remote=False) | No-op | No-op | [
"No",
"-",
"op"
] | def add_exception(self, exception, stack, remote=False):
"""
No-op
"""
pass | [
"def",
"add_exception",
"(",
"self",
",",
"exception",
",",
"stack",
",",
"remote",
"=",
"False",
")",
":",
"pass"
] | https://github.com/aws/aws-xray-sdk-python/blob/71436ad7f275c603298da68bee072af7c214cfc3/aws_xray_sdk/core/models/dummy_entities.py#L134-L138 | ||
ronf/asyncssh | ee1714c598d8c2ea6f5484e465443f38b68714aa | asyncssh/sftp.py | python | SFTPServerHandler._process_rename | (self, packet: SSHPacket) | Process an incoming SFTP rename request | Process an incoming SFTP rename request | [
"Process",
"an",
"incoming",
"SFTP",
"rename",
"request"
] | async def _process_rename(self, packet: SSHPacket) -> None:
"""Process an incoming SFTP rename request"""
oldpath = packet.get_string()
newpath = packet.get_string()
if self._version >= 5:
flags = packet.get_uint32()
flag_text = ', flags=0x%08x' % flags
... | [
"async",
"def",
"_process_rename",
"(",
"self",
",",
"packet",
":",
"SSHPacket",
")",
"->",
"None",
":",
"oldpath",
"=",
"packet",
".",
"get_string",
"(",
")",
"newpath",
"=",
"packet",
".",
"get_string",
"(",
")",
"if",
"self",
".",
"_version",
">=",
... | https://github.com/ronf/asyncssh/blob/ee1714c598d8c2ea6f5484e465443f38b68714aa/asyncssh/sftp.py#L5887-L5913 | ||
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/bs4/element.py | python | NavigableString.__getattr__ | (self, attr) | text.string gives you text. This is for backwards
compatibility for Navigable*String, but for CData* it lets you
get the string without the CData wrapper. | text.string gives you text. This is for backwards
compatibility for Navigable*String, but for CData* it lets you
get the string without the CData wrapper. | [
"text",
".",
"string",
"gives",
"you",
"text",
".",
"This",
"is",
"for",
"backwards",
"compatibility",
"for",
"Navigable",
"*",
"String",
"but",
"for",
"CData",
"*",
"it",
"lets",
"you",
"get",
"the",
"string",
"without",
"the",
"CData",
"wrapper",
"."
] | def __getattr__(self, attr):
"""text.string gives you text. This is for backwards
compatibility for Navigable*String, but for CData* it lets you
get the string without the CData wrapper."""
if attr == 'string':
return self
else:
raise AttributeError(
... | [
"def",
"__getattr__",
"(",
"self",
",",
"attr",
")",
":",
"if",
"attr",
"==",
"'string'",
":",
"return",
"self",
"else",
":",
"raise",
"AttributeError",
"(",
"\"'%s' object has no attribute '%s'\"",
"%",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"... | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/bs4/element.py#L914-L923 | ||
jacoxu/encoder_decoder | 6829c3bc42105aedfd1b8a81c81be19df4326c0a | keras/old_models.py | python | Sequential.save_weights | (self, filepath, overwrite=False) | Dump all layer weights to a HDF5 file. | Dump all layer weights to a HDF5 file. | [
"Dump",
"all",
"layer",
"weights",
"to",
"a",
"HDF5",
"file",
"."
] | def save_weights(self, filepath, overwrite=False):
'''Dump all layer weights to a HDF5 file.
'''
import h5py
import os.path
# if file exists and should not be overwritten
if not overwrite and os.path.isfile(filepath):
import sys
get_input = input
... | [
"def",
"save_weights",
"(",
"self",
",",
"filepath",
",",
"overwrite",
"=",
"False",
")",
":",
"import",
"h5py",
"import",
"os",
".",
"path",
"# if file exists and should not be overwritten",
"if",
"not",
"overwrite",
"and",
"os",
".",
"path",
".",
"isfile",
"... | https://github.com/jacoxu/encoder_decoder/blob/6829c3bc42105aedfd1b8a81c81be19df4326c0a/keras/old_models.py#L865-L896 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/tencentcloud/vpc/v20170312/vpc_client.py | python | VpcClient.ModifySubnetAttribute | (self, request) | 本接口(ModifySubnetAttribute)用于修改子网属性。
:param request: 调用ModifySubnetAttribute所需参数的结构体。
:type request: :class:`tencentcloud.vpc.v20170312.models.ModifySubnetAttributeRequest`
:rtype: :class:`tencentcloud.vpc.v20170312.models.ModifySubnetAttributeResponse` | 本接口(ModifySubnetAttribute)用于修改子网属性。 | [
"本接口(ModifySubnetAttribute)用于修改子网属性。"
] | def ModifySubnetAttribute(self, request):
"""本接口(ModifySubnetAttribute)用于修改子网属性。
:param request: 调用ModifySubnetAttribute所需参数的结构体。
:type request: :class:`tencentcloud.vpc.v20170312.models.ModifySubnetAttributeRequest`
:rtype: :class:`tencentcloud.vpc.v20170312.models.ModifySubnetAttribut... | [
"def",
"ModifySubnetAttribute",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"ModifySubnetAttribute\"",
",",
"params",
")",
"response",
"=",
"json",
".",
... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tencentcloud/vpc/v20170312/vpc_client.py#L2146-L2171 | ||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/returns/estimators.py | python | AdvantageEstimator.__init__ | (self, storage, value, q_value, gamma=1., standardize=False) | Initialize the Advantage estimator.
Args:
storage (RolloutStorage): rollout storage
value (Value): value function approximator.
q_value (QValue, Estimator): Q-value function approximator, or estimator.
gamma (float): discount factor
standardize (bool)... | Initialize the Advantage estimator. | [
"Initialize",
"the",
"Advantage",
"estimator",
"."
] | def __init__(self, storage, value, q_value, gamma=1., standardize=False):
"""
Initialize the Advantage estimator.
Args:
storage (RolloutStorage): rollout storage
value (Value): value function approximator.
q_value (QValue, Estimator): Q-value function approxi... | [
"def",
"__init__",
"(",
"self",
",",
"storage",
",",
"value",
",",
"q_value",
",",
"gamma",
"=",
"1.",
",",
"standardize",
"=",
"False",
")",
":",
"super",
"(",
"AdvantageEstimator",
",",
"self",
")",
".",
"__init__",
"(",
"storage",
"=",
"storage",
",... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/returns/estimators.py#L440-L466 | ||
skelsec/pypykatz | dd129ff36e00593d1340776b517f7e749ad8d314 | pypykatz/crypto/des.py | python | triple_des.decrypt | (self, data, pad=None, padmode=None) | return self._unpadData(data, pad, padmode) | decrypt(data, [pad], [padmode]) -> bytes
data : bytes to be encrypted
pad : Optional argument for decryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be decrypted
with the already specified key. In PAD_NORMAL... | decrypt(data, [pad], [padmode]) -> bytes | [
"decrypt",
"(",
"data",
"[",
"pad",
"]",
"[",
"padmode",
"]",
")",
"-",
">",
"bytes"
] | def decrypt(self, data, pad=None, padmode=None):
"""decrypt(data, [pad], [padmode]) -> bytes
data : bytes to be encrypted
pad : Optional argument for decryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be dec... | [
"def",
"decrypt",
"(",
"self",
",",
"data",
",",
"pad",
"=",
"None",
",",
"padmode",
"=",
"None",
")",
":",
"ENCRYPT",
"=",
"des",
".",
"ENCRYPT",
"DECRYPT",
"=",
"des",
".",
"DECRYPT",
"data",
"=",
"self",
".",
"_guardAgainstUnicode",
"(",
"data",
"... | https://github.com/skelsec/pypykatz/blob/dd129ff36e00593d1340776b517f7e749ad8d314/pypykatz/crypto/des.py#L814-L859 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/sqlalchemy/sql/operators.py | python | ColumnOperators.__le__ | (self, other) | return self.operate(le, other) | Implement the ``<=`` operator.
In a column context, produces the clause ``a <= b``. | Implement the ``<=`` operator. | [
"Implement",
"the",
"<",
"=",
"operator",
"."
] | def __le__(self, other):
"""Implement the ``<=`` operator.
In a column context, produces the clause ``a <= b``.
"""
return self.operate(le, other) | [
"def",
"__le__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"operate",
"(",
"le",
",",
"other",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sqlalchemy/sql/operators.py#L284-L290 | |
MenglinLu/Chinese-clinical-NER | 9614593ee2e1ba38d0985c44e957d316e178b93c | bert_sklearn_bioes/bert_sklearn/finetune.py | python | eval_model | (model, dataloader, config, desc="Validation") | return res | Evaluate model on validation data.
Parameters
----------
model : BertPlusMLP
Bert model plus mlp head
dataloader : Dataloader
validation dataloader
device : torch.device
device to run validation on
model_type : string
'text_classifier' | 'text_regressor' | 'toke... | Evaluate model on validation data. | [
"Evaluate",
"model",
"on",
"validation",
"data",
"."
] | def eval_model(model, dataloader, config, desc="Validation"):
"""
Evaluate model on validation data.
Parameters
----------
model : BertPlusMLP
Bert model plus mlp head
dataloader : Dataloader
validation dataloader
device : torch.device
device to run validation on
... | [
"def",
"eval_model",
"(",
"model",
",",
"dataloader",
",",
"config",
",",
"desc",
"=",
"\"Validation\"",
")",
":",
"device",
"=",
"config",
".",
"device",
"model_type",
"=",
"config",
".",
"model_type",
"ignore_label",
"=",
"config",
".",
"ignore_label_id",
... | https://github.com/MenglinLu/Chinese-clinical-NER/blob/9614593ee2e1ba38d0985c44e957d316e178b93c/bert_sklearn_bioes/bert_sklearn/finetune.py#L147-L234 | |
facebookresearch/pytext | 1a4e184b233856fcfb9997d74f167cbf5bbbfb8d | pytext/data/data_handler.py | python | DataHandler.preprocess_row | (self, row_data: Dict[str, Any]) | return row_data | preprocess steps for a single input row, sub class should override it | preprocess steps for a single input row, sub class should override it | [
"preprocess",
"steps",
"for",
"a",
"single",
"input",
"row",
"sub",
"class",
"should",
"override",
"it"
] | def preprocess_row(self, row_data: Dict[str, Any]) -> Dict[str, Any]:
"""
preprocess steps for a single input row, sub class should override it
"""
return row_data | [
"def",
"preprocess_row",
"(",
"self",
",",
"row_data",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"row_data"
] | https://github.com/facebookresearch/pytext/blob/1a4e184b233856fcfb9997d74f167cbf5bbbfb8d/pytext/data/data_handler.py#L385-L389 | |
commonsense/conceptnet | 57e783facbff63a1ef5c581fe2e4a899f97a0ad1 | conceptnet/concepttools/concepttools.py | python | ConceptTools.project_spatial | (self,textnode_list) | return self.spreading_activation(textnode_list,linktype_weights=linktype_weights_dict) | -inputs a list of concepts
-computes the spatial projection, which consists of
relevant locations, relevant objects in the same scene.
-returns a rank-ordered list of concepts and their scores
e.g.: (('concept1',score1), ('concept2,score2), ...) | -inputs a list of concepts
-computes the spatial projection, which consists of
relevant locations, relevant objects in the same scene.
-returns a rank-ordered list of concepts and their scores
e.g.: (('concept1',score1), ('concept2,score2), ...) | [
"-",
"inputs",
"a",
"list",
"of",
"concepts",
"-",
"computes",
"the",
"spatial",
"projection",
"which",
"consists",
"of",
"relevant",
"locations",
"relevant",
"objects",
"in",
"the",
"same",
"scene",
".",
"-",
"returns",
"a",
"rank",
"-",
"ordered",
"list",
... | def project_spatial(self,textnode_list):
"""
-inputs a list of concepts
-computes the spatial projection, which consists of
relevant locations, relevant objects in the same scene.
-returns a rank-ordered list of concepts and their scores
e.g.: (('concept1',score1), ('con... | [
"def",
"project_spatial",
"(",
"self",
",",
"textnode_list",
")",
":",
"linktype_weights_dict",
"=",
"(",
"{",
"'AtLocation'",
":",
"1.0",
",",
"'ConceptuallyRelatedTo'",
":",
"0.5",
"}",
",",
"{",
"}",
")",
"return",
"self",
".",
"spreading_activation",
"(",
... | https://github.com/commonsense/conceptnet/blob/57e783facbff63a1ef5c581fe2e4a899f97a0ad1/conceptnet/concepttools/concepttools.py#L393-L408 | |
suavecode/SUAVE | 4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5 | trunk/SUAVE/Core/Data.py | python | Data.append | (self,value,key=None) | Adds new values to the classes. Can also change an already appended key
Assumptions:
N/A
Source:
N/A
Inputs:
value
key
Outputs:
N/A
Properties Used:
N/A | Adds new values to the classes. Can also change an already appended key
Assumptions:
N/A
Source:
N/A
Inputs:
value
key
Outputs:
N/A
Properties Used:
N/A | [
"Adds",
"new",
"values",
"to",
"the",
"classes",
".",
"Can",
"also",
"change",
"an",
"already",
"appended",
"key",
"Assumptions",
":",
"N",
"/",
"A",
"Source",
":",
"N",
"/",
"A",
"Inputs",
":",
"value",
"key",
"Outputs",
":",
"N",
"/",
"A",
"Propert... | def append(self,value,key=None):
""" Adds new values to the classes. Can also change an already appended key
Assumptions:
N/A
Source:
N/A
Inputs:
value
key
Outputs:
N/A
... | [
"def",
"append",
"(",
"self",
",",
"value",
",",
"key",
"=",
"None",
")",
":",
"if",
"key",
"is",
"None",
":",
"key",
"=",
"value",
".",
"tag",
"key",
"=",
"key",
".",
"translate",
"(",
"t_table",
")",
"if",
"key",
"in",
"self",
":",
"raise",
"... | https://github.com/suavecode/SUAVE/blob/4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5/trunk/SUAVE/Core/Data.py#L514-L536 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/kombu-4.3.0/kombu/log.py | python | get_loglevel | (level) | return level | Get loglevel by name. | Get loglevel by name. | [
"Get",
"loglevel",
"by",
"name",
"."
] | def get_loglevel(level):
"""Get loglevel by name."""
if isinstance(level, string_t):
return LOG_LEVELS[level]
return level | [
"def",
"get_loglevel",
"(",
"level",
")",
":",
"if",
"isinstance",
"(",
"level",
",",
"string_t",
")",
":",
"return",
"LOG_LEVELS",
"[",
"level",
"]",
"return",
"level"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/kombu-4.3.0/kombu/log.py#L37-L41 | |
rackerlabs/mimic | efd34108b6aa3eb7ecd26e22f1aa155c14a7885e | mimic/model/rackspace_images.py | python | RackspaceOnMetalCentOSImage.metadata_json | (self) | return {
"flavor_classes": "onmetal",
"image_type": "base",
"os_type": "linux",
"org.openstack__1__os_distro": "org.centos",
"vm_mode": "metal",
"auto_disk_config": "disabled"
} | Create a JSON-serializable data structure describing
``metadata`` for an image. | Create a JSON-serializable data structure describing
``metadata`` for an image. | [
"Create",
"a",
"JSON",
"-",
"serializable",
"data",
"structure",
"describing",
"metadata",
"for",
"an",
"image",
"."
] | def metadata_json(self):
"""
Create a JSON-serializable data structure describing
``metadata`` for an image.
"""
return {
"flavor_classes": "onmetal",
"image_type": "base",
"os_type": "linux",
"org.openstack__1__os_distro": "org.cen... | [
"def",
"metadata_json",
"(",
"self",
")",
":",
"return",
"{",
"\"flavor_classes\"",
":",
"\"onmetal\"",
",",
"\"image_type\"",
":",
"\"base\"",
",",
"\"os_type\"",
":",
"\"linux\"",
",",
"\"org.openstack__1__os_distro\"",
":",
"\"org.centos\"",
",",
"\"vm_mode\"",
"... | https://github.com/rackerlabs/mimic/blob/efd34108b6aa3eb7ecd26e22f1aa155c14a7885e/mimic/model/rackspace_images.py#L874-L886 | |
openstack/cinder | 23494a6d6c51451688191e1847a458f1d3cdcaa5 | cinder/volume/drivers/nimble.py | python | NimbleBaseVolumeDriver.delete_group | (self, context, group, volumes) | return model_updates, volume_model_updates | Deletes a group. | Deletes a group. | [
"Deletes",
"a",
"group",
"."
] | def delete_group(self, context, group, volumes):
"""Deletes a group."""
if not volume_utils.is_group_a_cg_snapshot_type(group):
raise NotImplementedError()
LOG.info("Delete Consistency Group %s.", group.id)
model_updates = {"status": fields.GroupStatus.DELETED}
error_... | [
"def",
"delete_group",
"(",
"self",
",",
"context",
",",
"group",
",",
"volumes",
")",
":",
"if",
"not",
"volume_utils",
".",
"is_group_a_cg_snapshot_type",
"(",
"group",
")",
":",
"raise",
"NotImplementedError",
"(",
")",
"LOG",
".",
"info",
"(",
"\"Delete ... | https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/volume/drivers/nimble.py#L811-L838 | |
glouppe/info8006-introduction-to-ai | 8360cc9a8c418559e402be1454ec885b6c1062d7 | projects/project1/pacman_module/graphicsDisplay.py | python | PacmanGraphics.updateDistributions | (self, distributions) | Draws an agent's belief distributions | Draws an agent's belief distributions | [
"Draws",
"an",
"agent",
"s",
"belief",
"distributions"
] | def updateDistributions(self, distributions):
"Draws an agent's belief distributions"
# copy all distributions so we don't change their state
distributions = [np.copy(x) for x in distributions]
if self.distributionImages is None:
self.drawDistributions(self.previousState)
... | [
"def",
"updateDistributions",
"(",
"self",
",",
"distributions",
")",
":",
"# copy all distributions so we don't change their state",
"distributions",
"=",
"[",
"np",
".",
"copy",
"(",
"x",
")",
"for",
"x",
"in",
"distributions",
"]",
"if",
"self",
".",
"distribut... | https://github.com/glouppe/info8006-introduction-to-ai/blob/8360cc9a8c418559e402be1454ec885b6c1062d7/projects/project1/pacman_module/graphicsDisplay.py#L839-L861 | ||
dask/dask | c2b962fec1ba45440fe928869dc64cfe9cc36506 | dask/array/reductions.py | python | make_arg_reduction | (func, argfunc, is_nan_func=False) | return derived_from(np)(wrapped) | Create an argreduction callable
Parameters
----------
func : callable
The reduction (e.g. ``min``)
argfunc : callable
The argreduction (e.g. ``argmin``) | Create an argreduction callable | [
"Create",
"an",
"argreduction",
"callable"
] | def make_arg_reduction(func, argfunc, is_nan_func=False):
"""Create an argreduction callable
Parameters
----------
func : callable
The reduction (e.g. ``min``)
argfunc : callable
The argreduction (e.g. ``argmin``)
"""
chunk = partial(arg_chunk, func, argfunc)
combine = p... | [
"def",
"make_arg_reduction",
"(",
"func",
",",
"argfunc",
",",
"is_nan_func",
"=",
"False",
")",
":",
"chunk",
"=",
"partial",
"(",
"arg_chunk",
",",
"func",
",",
"argfunc",
")",
"combine",
"=",
"partial",
"(",
"arg_combine",
",",
"func",
",",
"argfunc",
... | https://github.com/dask/dask/blob/c2b962fec1ba45440fe928869dc64cfe9cc36506/dask/array/reductions.py#L1115-L1139 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/_collections_abc.py | python | MutableSet.discard | (self, value) | Remove an element. Do not raise an exception if absent. | Remove an element. Do not raise an exception if absent. | [
"Remove",
"an",
"element",
".",
"Do",
"not",
"raise",
"an",
"exception",
"if",
"absent",
"."
] | def discard(self, value):
"""Remove an element. Do not raise an exception if absent."""
raise NotImplementedError | [
"def",
"discard",
"(",
"self",
",",
"value",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/_collections_abc.py#L511-L513 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/colorama/ansi.py | python | AnsiCursor.UP | (self, n=1) | return CSI + str(n) + 'A' | [] | def UP(self, n=1):
return CSI + str(n) + 'A' | [
"def",
"UP",
"(",
"self",
",",
"n",
"=",
"1",
")",
":",
"return",
"CSI",
"+",
"str",
"(",
"n",
")",
"+",
"'A'"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/colorama/ansi.py#L37-L38 | |||
kupferlauncher/kupfer | 1c1e9bcbce05a82f503f68f8b3955c20b02639b3 | waflib/Build.py | python | BuildContext.add_post_fun | (self, meth) | Binds a callback method to execute immediately after the build is successful::
def call_ldconfig(bld):
bld.exec_command('/sbin/ldconfig')
def build(bld):
if bld.cmd == 'install':
bld.add_pre_fun(call_ldconfig) | Binds a callback method to execute immediately after the build is successful:: | [
"Binds",
"a",
"callback",
"method",
"to",
"execute",
"immediately",
"after",
"the",
"build",
"is",
"successful",
"::"
] | def add_post_fun(self, meth):
"""
Binds a callback method to execute immediately after the build is successful::
def call_ldconfig(bld):
bld.exec_command('/sbin/ldconfig')
def build(bld):
if bld.cmd == 'install':
bld.add_pre_fun(call_ldconfig)
"""
try:
self.post_funs.append(meth)
excep... | [
"def",
"add_post_fun",
"(",
"self",
",",
"meth",
")",
":",
"try",
":",
"self",
".",
"post_funs",
".",
"append",
"(",
"meth",
")",
"except",
"AttributeError",
":",
"self",
".",
"post_funs",
"=",
"[",
"meth",
"]"
] | https://github.com/kupferlauncher/kupfer/blob/1c1e9bcbce05a82f503f68f8b3955c20b02639b3/waflib/Build.py#L564-L578 | ||
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/sqlalchemy/sql/operators.py | python | ColumnOperators.__lt__ | (self, other) | return self.operate(lt, other) | Implement the ``<`` operator.
In a column context, produces the clause ``a < b``. | Implement the ``<`` operator. | [
"Implement",
"the",
"<",
"operator",
"."
] | def __lt__(self, other):
"""Implement the ``<`` operator.
In a column context, produces the clause ``a < b``.
"""
return self.operate(lt, other) | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"operate",
"(",
"lt",
",",
"other",
")"
] | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/sql/operators.py#L279-L285 | |
qxf2/qxf2-page-object-model | 8b2978e5bd2a5413d581f9e29a2098e5f5e742fd | utils/email_util.py | python | Email_Util.login | (self,username,password) | return result_flag | Login to the email | Login to the email | [
"Login",
"to",
"the",
"email"
] | def login(self,username,password):
"Login to the email"
result_flag = False
try:
self.mail.login(username,password)
except Exception as e:
print('\nException in Email_Util.login')
print('PYTHON SAYS:')
print(e)
print('\n')
... | [
"def",
"login",
"(",
"self",
",",
"username",
",",
"password",
")",
":",
"result_flag",
"=",
"False",
"try",
":",
"self",
".",
"mail",
".",
"login",
"(",
"username",
",",
"password",
")",
"except",
"Exception",
"as",
"e",
":",
"print",
"(",
"'\\nExcept... | https://github.com/qxf2/qxf2-page-object-model/blob/8b2978e5bd2a5413d581f9e29a2098e5f5e742fd/utils/email_util.py#L30-L43 | |
saic-vul/image_harmonization | 7f71cc131cd81f7a9dc7116c52428d4d75046085 | iharm/model/modeling/conv_autoencoder.py | python | DeconvDecoder.__init__ | (self, depth, encoder_blocks_channels, norm_layer, attend_from=-1, image_fusion=False) | [] | def __init__(self, depth, encoder_blocks_channels, norm_layer, attend_from=-1, image_fusion=False):
super(DeconvDecoder, self).__init__()
self.image_fusion = image_fusion
self.deconv_blocks = nn.ModuleList()
in_channels = encoder_blocks_channels.pop()
out_channels = in_channels
... | [
"def",
"__init__",
"(",
"self",
",",
"depth",
",",
"encoder_blocks_channels",
",",
"norm_layer",
",",
"attend_from",
"=",
"-",
"1",
",",
"image_fusion",
"=",
"False",
")",
":",
"super",
"(",
"DeconvDecoder",
",",
"self",
")",
".",
"__init__",
"(",
")",
"... | https://github.com/saic-vul/image_harmonization/blob/7f71cc131cd81f7a9dc7116c52428d4d75046085/iharm/model/modeling/conv_autoencoder.py#L68-L87 | ||||
sergioburdisso/pyss3 | 70c37853f3f56a60c3df9b94b678ca3f0db843de | pyss3/server.py | python | get_http_body | (http_request) | return http_request.split("\r\n\r\n")[1] | Given a HTTP request, return the body. | Given a HTTP request, return the body. | [
"Given",
"a",
"HTTP",
"request",
"return",
"the",
"body",
"."
] | def get_http_body(http_request):
"""Given a HTTP request, return the body."""
return http_request.split("\r\n\r\n")[1] | [
"def",
"get_http_body",
"(",
"http_request",
")",
":",
"return",
"http_request",
".",
"split",
"(",
"\"\\r\\n\\r\\n\"",
")",
"[",
"1",
"]"
] | https://github.com/sergioburdisso/pyss3/blob/70c37853f3f56a60c3df9b94b678ca3f0db843de/pyss3/server.py#L132-L134 | |
aiff22/PyNET-PyTorch | b05d817408cf729582b52a3fee214775ccab800c | msssim.py | python | SSIM.forward | (self, img1, img2) | return ssim(img1, img2, window=window, window_size=self.window_size, size_average=self.size_average) | [] | def forward(self, img1, img2):
(_, channel, _, _) = img1.size()
if channel == self.channel and self.window.dtype == img1.dtype:
window = self.window
else:
window = create_window(self.window_size, channel).to(img1.device).type(img1.dtype)
self.window = window
... | [
"def",
"forward",
"(",
"self",
",",
"img1",
",",
"img2",
")",
":",
"(",
"_",
",",
"channel",
",",
"_",
",",
"_",
")",
"=",
"img1",
".",
"size",
"(",
")",
"if",
"channel",
"==",
"self",
".",
"channel",
"and",
"self",
".",
"window",
".",
"dtype",... | https://github.com/aiff22/PyNET-PyTorch/blob/b05d817408cf729582b52a3fee214775ccab800c/msssim.py#L112-L122 | |||
Tencent/bk-bcs-saas | 2b437bf2f5fd5ce2078f7787c3a12df609f7679d | bcs-app/backend/container_service/observability/log_stream/views.py | python | LogStreamHandler.receive | (self, text_data) | 获取消息, 目前只有推送, 只打印日志 | 获取消息, 目前只有推送, 只打印日志 | [
"获取消息",
"目前只有推送",
"只打印日志"
] | async def receive(self, text_data):
"""获取消息, 目前只有推送, 只打印日志"""
logger.info("receive message: %s", text_data) | [
"async",
"def",
"receive",
"(",
"self",
",",
"text_data",
")",
":",
"logger",
".",
"info",
"(",
"\"receive message: %s\"",
",",
"text_data",
")"
] | https://github.com/Tencent/bk-bcs-saas/blob/2b437bf2f5fd5ce2078f7787c3a12df609f7679d/bcs-app/backend/container_service/observability/log_stream/views.py#L126-L128 | ||
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/urllib3/response.py | python | HTTPResponse.stream | (self, amt=2**16, decode_content=None) | A generator wrapper for the read() method. A call will block until
``amt`` bytes have been read from the connection or until the
connection is closed.
:param amt:
How much of the content to read. The generator will return up to
much data per iteration, but may return les... | A generator wrapper for the read() method. A call will block until
``amt`` bytes have been read from the connection or until the
connection is closed. | [
"A",
"generator",
"wrapper",
"for",
"the",
"read",
"()",
"method",
".",
"A",
"call",
"will",
"block",
"until",
"amt",
"bytes",
"have",
"been",
"read",
"from",
"the",
"connection",
"or",
"until",
"the",
"connection",
"is",
"closed",
"."
] | def stream(self, amt=2**16, decode_content=None):
"""
A generator wrapper for the read() method. A call will block until
``amt`` bytes have been read from the connection or until the
connection is closed.
:param amt:
How much of the content to read. The generator wil... | [
"def",
"stream",
"(",
"self",
",",
"amt",
"=",
"2",
"**",
"16",
",",
"decode_content",
"=",
"None",
")",
":",
"if",
"self",
".",
"chunked",
"and",
"self",
".",
"supports_chunked_reads",
"(",
")",
":",
"for",
"line",
"in",
"self",
".",
"read_chunked",
... | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/urllib3/response.py#L475-L499 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/ogl/basic.py | python | Shape.SetFormatMode | (self, mode, regionId = 0) | Set the format mode of the region.
:param `mode`: can be a bit list of the following
============================== ==============================
Format mode Description
============================== ==============================
`FORMAT_NONE` ... | Set the format mode of the region. | [
"Set",
"the",
"format",
"mode",
"of",
"the",
"region",
"."
] | def SetFormatMode(self, mode, regionId = 0):
"""
Set the format mode of the region.
:param `mode`: can be a bit list of the following
============================== ==============================
Format mode Description
============================== ... | [
"def",
"SetFormatMode",
"(",
"self",
",",
"mode",
",",
"regionId",
"=",
"0",
")",
":",
"if",
"regionId",
"<",
"len",
"(",
"self",
".",
"_regions",
")",
":",
"self",
".",
"_regions",
"[",
"regionId",
"]",
".",
"SetFormatMode",
"(",
"mode",
")"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/ogl/basic.py#L810-L828 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/sessions.py | python | FilesystemSessionStore.delete | (self, session) | [] | def delete(self, session):
fn = self.get_session_filename(session.sid)
try:
os.unlink(fn)
except OSError:
pass | [
"def",
"delete",
"(",
"self",
",",
"session",
")",
":",
"fn",
"=",
"self",
".",
"get_session_filename",
"(",
"session",
".",
"sid",
")",
"try",
":",
"os",
".",
"unlink",
"(",
"fn",
")",
"except",
"OSError",
":",
"pass"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/sessions.py#L256-L261 | ||||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/imghdr.py | python | test_xbm | (h, f) | X bitmap (X10 or X11) | X bitmap (X10 or X11) | [
"X",
"bitmap",
"(",
"X10",
"or",
"X11",
")"
] | def test_xbm(h, f):
"""X bitmap (X10 or X11)"""
s = '#define '
if h[:len(s)] == s:
return 'xbm' | [
"def",
"test_xbm",
"(",
"h",
",",
"f",
")",
":",
"s",
"=",
"'#define '",
"if",
"h",
"[",
":",
"len",
"(",
"s",
")",
"]",
"==",
"s",
":",
"return",
"'xbm'"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/imghdr.py#L107-L111 | ||
mininet/mininet | 8a50d3867c49781c60b6171acc6e4b46954b4281 | examples/miniedit.py | python | MiniEdit.newTopology | ( self ) | New command. | New command. | [
"New",
"command",
"."
] | def newTopology( self ):
"New command."
for widget in tuple( self.widgetToItem ):
self.deleteItem( self.widgetToItem[ widget ] )
self.hostCount = 0
self.switchCount = 0
self.controllerCount = 0
self.links = {}
self.hostOpts = {}
self.switchOpts... | [
"def",
"newTopology",
"(",
"self",
")",
":",
"for",
"widget",
"in",
"tuple",
"(",
"self",
".",
"widgetToItem",
")",
":",
"self",
".",
"deleteItem",
"(",
"self",
".",
"widgetToItem",
"[",
"widget",
"]",
")",
"self",
".",
"hostCount",
"=",
"0",
"self",
... | https://github.com/mininet/mininet/blob/8a50d3867c49781c60b6171acc6e4b46954b4281/examples/miniedit.py#L1608-L1619 | ||
awslabs/deeplearning-benchmark | 3e9a906422b402869537f91056ae771b66487a8e | tensorflow/inception/inception/slim/scopes.py | python | _get_arg_stack | () | [] | def _get_arg_stack():
stack = ops.get_collection(_ARGSTACK_KEY)
if stack:
return stack[0]
else:
stack = [{}]
ops.add_to_collection(_ARGSTACK_KEY, stack)
return stack | [
"def",
"_get_arg_stack",
"(",
")",
":",
"stack",
"=",
"ops",
".",
"get_collection",
"(",
"_ARGSTACK_KEY",
")",
"if",
"stack",
":",
"return",
"stack",
"[",
"0",
"]",
"else",
":",
"stack",
"=",
"[",
"{",
"}",
"]",
"ops",
".",
"add_to_collection",
"(",
... | https://github.com/awslabs/deeplearning-benchmark/blob/3e9a906422b402869537f91056ae771b66487a8e/tensorflow/inception/inception/slim/scopes.py#L63-L70 | ||||
c3nav/c3nav | 0f4e699e3733459b1c70935a4c813959cffd86bd | src/c3nav/editor/wrappers.py | python | BaseWrapper._wrap_manager | (self, manager) | return ManagerWrapper(self._changeset, manager) | Wrap a manager with same changeset as this wrapper.
Detects RelatedManager or ManyRelatedmanager instances and chooses the Wrapper accordingly. | Wrap a manager with same changeset as this wrapper.
Detects RelatedManager or ManyRelatedmanager instances and chooses the Wrapper accordingly. | [
"Wrap",
"a",
"manager",
"with",
"same",
"changeset",
"as",
"this",
"wrapper",
".",
"Detects",
"RelatedManager",
"or",
"ManyRelatedmanager",
"instances",
"and",
"chooses",
"the",
"Wrapper",
"accordingly",
"."
] | def _wrap_manager(self, manager):
"""
Wrap a manager with same changeset as this wrapper.
Detects RelatedManager or ManyRelatedmanager instances and chooses the Wrapper accordingly.
"""
assert isinstance(manager, Manager)
if hasattr(manager, 'through'):
return... | [
"def",
"_wrap_manager",
"(",
"self",
",",
"manager",
")",
":",
"assert",
"isinstance",
"(",
"manager",
",",
"Manager",
")",
"if",
"hasattr",
"(",
"manager",
",",
"'through'",
")",
":",
"return",
"ManyRelatedManagerWrapper",
"(",
"self",
".",
"_changeset",
",... | https://github.com/c3nav/c3nav/blob/0f4e699e3733459b1c70935a4c813959cffd86bd/src/c3nav/editor/wrappers.py#L56-L66 | |
kengz/SLM-Lab | 667ba73349ad00c6f4b3e428dcd10eebbdab4c70 | slm_lab/env/vec_env.py | python | DummyVecEnv.__init__ | (self, env_fns) | @param env_fns iterable of functions that build environments | [] | def __init__(self, env_fns):
'''
@param env_fns iterable of functions that build environments
'''
self.envs = [fn() for fn in env_fns]
env = self.envs[0]
VecEnv.__init__(self, len(env_fns), env.observation_space, env.action_space)
obs_space = env.observation_space... | [
"def",
"__init__",
"(",
"self",
",",
"env_fns",
")",
":",
"self",
".",
"envs",
"=",
"[",
"fn",
"(",
")",
"for",
"fn",
"in",
"env_fns",
"]",
"env",
"=",
"self",
".",
"envs",
"[",
"0",
"]",
"VecEnv",
".",
"__init__",
"(",
"self",
",",
"len",
"(",... | https://github.com/kengz/SLM-Lab/blob/667ba73349ad00c6f4b3e428dcd10eebbdab4c70/slm_lab/env/vec_env.py#L272-L287 | |||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/venv/__init__.py | python | EnvBuilder.setup_python | (self, context) | Set up a Python executable in the environment.
:param context: The information for the environment creation request
being processed. | Set up a Python executable in the environment. | [
"Set",
"up",
"a",
"Python",
"executable",
"in",
"the",
"environment",
"."
] | def setup_python(self, context):
"""
Set up a Python executable in the environment.
:param context: The information for the environment creation request
being processed.
"""
binpath = context.bin_path
path = context.env_exe
copier = self.s... | [
"def",
"setup_python",
"(",
"self",
",",
"context",
")",
":",
"binpath",
"=",
"context",
".",
"bin_path",
"path",
"=",
"context",
".",
"env_exe",
"copier",
"=",
"self",
".",
"symlink_or_copy",
"dirname",
"=",
"context",
".",
"python_dir",
"if",
"os",
".",
... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/venv/__init__.py#L269-L328 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/tensor/modules/free_module_automorphism.py | python | FreeModuleAutomorphism._del_derived | (self) | r"""
Delete the derived quantities.
EXAMPLES::
sage: M = FiniteRankFreeModule(QQ, 3, name='M')
sage: e = M.basis('e')
sage: a = M.automorphism(name='a')
sage: a[e,:] = [[1,0,-1], [0,3,0], [0,0,2]]
sage: b = a.inverse()
sage: a._in... | r"""
Delete the derived quantities. | [
"r",
"Delete",
"the",
"derived",
"quantities",
"."
] | def _del_derived(self):
r"""
Delete the derived quantities.
EXAMPLES::
sage: M = FiniteRankFreeModule(QQ, 3, name='M')
sage: e = M.basis('e')
sage: a = M.automorphism(name='a')
sage: a[e,:] = [[1,0,-1], [0,3,0], [0,0,2]]
sage: b = a.i... | [
"def",
"_del_derived",
"(",
"self",
")",
":",
"# First delete the derived quantities pertaining to FreeModuleTensor:",
"FreeModuleTensor",
".",
"_del_derived",
"(",
"self",
")",
"# Then reset the inverse automorphism to None:",
"if",
"self",
".",
"_inverse",
"is",
"not",
"Non... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/tensor/modules/free_module_automorphism.py#L347-L372 | ||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/microapp.py | python | MicroApp.update | (self, agent_id, app_icon=None, app_name=None, app_desc=None,
homepage_url=None, pc_homepage_url=None, omp_link=None) | return self._post(
'/microapp/update',
{
"agentId": agent_id,
"appIcon": app_icon,
"appName": app_name,
"appDesc": app_desc,
"homepageUrl": homepage_url,
"pcHomepageUrl": pc_homepage_url,
... | 更新微应用
:param agent_id: 微应用实例化id
:param app_icon: 微应用的图标。需要调用上传接口将图标上传到钉钉服务器后获取到的mediaId
:param app_name: 微应用的名称。长度限制为1~10个字符
:param app_desc: 微应用的描述。长度限制为1~20个字符
:param homepage_url: 微应用的移动端主页,必须以http开头或https开头
:param pc_homepage_url: 微应用的PC端主页,必须以http开头或https开头,如果不为空则必须... | 更新微应用 | [
"更新微应用"
] | def update(self, agent_id, app_icon=None, app_name=None, app_desc=None,
homepage_url=None, pc_homepage_url=None, omp_link=None):
"""
更新微应用
:param agent_id: 微应用实例化id
:param app_icon: 微应用的图标。需要调用上传接口将图标上传到钉钉服务器后获取到的mediaId
:param app_name: 微应用的名称。长度限制为1~10个字符
... | [
"def",
"update",
"(",
"self",
",",
"agent_id",
",",
"app_icon",
"=",
"None",
",",
"app_name",
"=",
"None",
",",
"app_desc",
"=",
"None",
",",
"homepage_url",
"=",
"None",
",",
"pc_homepage_url",
"=",
"None",
",",
"omp_link",
"=",
"None",
")",
":",
"ret... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/microapp.py#L34-L60 | |
geopython/pywps | 7f228ff17594912664073a629b2c2ed9d4f5f615 | pywps/app/Service.py | python | Service.create_complex_inputs | (self, source, inputs) | return outinputs | Create new ComplexInput as clone of original ComplexInput
because of inputs can be more than one, take it just as Prototype.
:param source: The process's input definition.
:param inputs: The request input data.
:return collections.deque: | Create new ComplexInput as clone of original ComplexInput
because of inputs can be more than one, take it just as Prototype. | [
"Create",
"new",
"ComplexInput",
"as",
"clone",
"of",
"original",
"ComplexInput",
"because",
"of",
"inputs",
"can",
"be",
"more",
"than",
"one",
"take",
"it",
"just",
"as",
"Prototype",
"."
] | def create_complex_inputs(self, source, inputs):
"""Create new ComplexInput as clone of original ComplexInput
because of inputs can be more than one, take it just as Prototype.
:param source: The process's input definition.
:param inputs: The request input data.
:return collecti... | [
"def",
"create_complex_inputs",
"(",
"self",
",",
"source",
",",
"inputs",
")",
":",
"outinputs",
"=",
"deque",
"(",
"maxlen",
"=",
"source",
".",
"max_occurs",
")",
"for",
"inpt",
"in",
"inputs",
":",
"data_input",
"=",
"source",
".",
"clone",
"(",
")",... | https://github.com/geopython/pywps/blob/7f228ff17594912664073a629b2c2ed9d4f5f615/pywps/app/Service.py#L148-L185 | |
topydo/topydo | 57d7577c987515d4b49d5500f666da29080ca3c2 | topydo/lib/TodoBase.py | python | TodoBase.source | (self) | return self.text(True) | Returns the source text of the todo. This is the raw text with all
the tags included. | Returns the source text of the todo. This is the raw text with all
the tags included. | [
"Returns",
"the",
"source",
"text",
"of",
"the",
"todo",
".",
"This",
"is",
"the",
"raw",
"text",
"with",
"all",
"the",
"tags",
"included",
"."
] | def source(self):
"""
Returns the source text of the todo. This is the raw text with all
the tags included.
"""
return self.text(True) | [
"def",
"source",
"(",
"self",
")",
":",
"return",
"self",
".",
"text",
"(",
"True",
")"
] | https://github.com/topydo/topydo/blob/57d7577c987515d4b49d5500f666da29080ca3c2/topydo/lib/TodoBase.py#L170-L175 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | couch/datadog_checks/couch/config_models/defaults.py | python | instance_auth_token | (field, value) | return get_default_field_value(field, value) | [] | def instance_auth_token(field, value):
return get_default_field_value(field, value) | [
"def",
"instance_auth_token",
"(",
"field",
",",
"value",
")",
":",
"return",
"get_default_field_value",
"(",
"field",
",",
"value",
")"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/couch/datadog_checks/couch/config_models/defaults.py#L33-L34 | |||
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | tabular/src/autogluon/tabular/models/rf/rf_model.py | python | RFModel._fit | (self,
X,
y,
num_cpus=-1,
time_limit=None,
sample_weight=None,
**kwargs) | [] | def _fit(self,
X,
y,
num_cpus=-1,
time_limit=None,
sample_weight=None,
**kwargs):
time_start = time.time()
model_cls = self._get_model_type()
max_memory_usage_ratio = self.params_aux['max_memory_usage_ratio']
... | [
"def",
"_fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"num_cpus",
"=",
"-",
"1",
",",
"time_limit",
"=",
"None",
",",
"sample_weight",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"time_start",
"=",
"time",
".",
"time",
"(",
")",
"model_cls",
"... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/tabular/src/autogluon/tabular/models/rf/rf_model.py#L121-L207 | ||||
petercorke/robotics-toolbox-python | 51aa8bbb3663a7c815f9880d538d61e7c85bc470 | roboticstoolbox/tools/urdf/urdf.py | python | URDFType._parse_simple_attribs | (cls, node) | return kwargs | Parse all attributes in the _ATTRIBS array for this class.
Parameters
----------
node : :class:`lxml.etree.Element`
The node to parse attributes for.
Returns
-------
kwargs : dict
Map from attribute name to value. If the attribute is not
... | Parse all attributes in the _ATTRIBS array for this class.
Parameters
----------
node : :class:`lxml.etree.Element`
The node to parse attributes for.
Returns
-------
kwargs : dict
Map from attribute name to value. If the attribute is not
... | [
"Parse",
"all",
"attributes",
"in",
"the",
"_ATTRIBS",
"array",
"for",
"this",
"class",
".",
"Parameters",
"----------",
"node",
":",
":",
"class",
":",
"lxml",
".",
"etree",
".",
"Element",
"The",
"node",
"to",
"parse",
"attributes",
"for",
".",
"Returns"... | def _parse_simple_attribs(cls, node):
"""Parse all attributes in the _ATTRIBS array for this class.
Parameters
----------
node : :class:`lxml.etree.Element`
The node to parse attributes for.
Returns
-------
kwargs : dict
Map from attribute ... | [
"def",
"_parse_simple_attribs",
"(",
"cls",
",",
"node",
")",
":",
"kwargs",
"=",
"{",
"}",
"for",
"a",
"in",
"cls",
".",
"_ATTRIBS",
":",
"t",
",",
"r",
"=",
"cls",
".",
"_ATTRIBS",
"[",
"a",
"]",
"# t = type, r = required (bool)",
"if",
"r",
":",
"... | https://github.com/petercorke/robotics-toolbox-python/blob/51aa8bbb3663a7c815f9880d538d61e7c85bc470/roboticstoolbox/tools/urdf/urdf.py#L69-L98 | |
spotify/luigi | c3b66f4a5fa7eaa52f9a72eb6704b1049035c789 | luigi/task.py | python | Task.process_resources | (self) | return self.resources | Override in "template" tasks which provide common resource functionality
but allow subclasses to specify additional resources while preserving
the name for consistent end-user experience. | Override in "template" tasks which provide common resource functionality
but allow subclasses to specify additional resources while preserving
the name for consistent end-user experience. | [
"Override",
"in",
"template",
"tasks",
"which",
"provide",
"common",
"resource",
"functionality",
"but",
"allow",
"subclasses",
"to",
"specify",
"additional",
"resources",
"while",
"preserving",
"the",
"name",
"for",
"consistent",
"end",
"-",
"user",
"experience",
... | def process_resources(self):
"""
Override in "template" tasks which provide common resource functionality
but allow subclasses to specify additional resources while preserving
the name for consistent end-user experience.
"""
return self.resources | [
"def",
"process_resources",
"(",
"self",
")",
":",
"return",
"self",
".",
"resources"
] | https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/task.py#L631-L637 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/lib-tk/ttk.py | python | Treeview.detach | (self, *items) | Unlinks all of the specified items from the tree.
The items and all of their descendants are still present, and may
be reinserted at another point in the tree, but will not be
displayed. The root item may not be detached. | Unlinks all of the specified items from the tree. | [
"Unlinks",
"all",
"of",
"the",
"specified",
"items",
"from",
"the",
"tree",
"."
] | def detach(self, *items):
"""Unlinks all of the specified items from the tree.
The items and all of their descendants are still present, and may
be reinserted at another point in the tree, but will not be
displayed. The root item may not be detached."""
self.tk.call(self._w, "de... | [
"def",
"detach",
"(",
"self",
",",
"*",
"items",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"detach\"",
",",
"items",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/lib-tk/ttk.py#L1246-L1252 | ||
ArangoDB-Community/python-arango | 77cbc6813b75daa1a6e232e2327259e56b0228ca | arango/formatter.py | python | format_replication_applier_config | (body: Json) | return verify_format(body, result) | Format replication applier configuration data.
:param body: Input body.
:type body: dict
:return: Formatted body.
:rtype: dict | Format replication applier configuration data. | [
"Format",
"replication",
"applier",
"configuration",
"data",
"."
] | def format_replication_applier_config(body: Json) -> Json:
"""Format replication applier configuration data.
:param body: Input body.
:type body: dict
:return: Formatted body.
:rtype: dict
"""
result: Json = {}
if "endpoint" in body:
result["endpoint"] = body["endpoint"]
if ... | [
"def",
"format_replication_applier_config",
"(",
"body",
":",
"Json",
")",
"->",
"Json",
":",
"result",
":",
"Json",
"=",
"{",
"}",
"if",
"\"endpoint\"",
"in",
"body",
":",
"result",
"[",
"\"endpoint\"",
"]",
"=",
"body",
"[",
"\"endpoint\"",
"]",
"if",
... | https://github.com/ArangoDB-Community/python-arango/blob/77cbc6813b75daa1a6e232e2327259e56b0228ca/arango/formatter.py#L405-L469 | |
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/api/views/share_groups.py | python | ShareGroupViewBuilder.summary | (self, request, share_group) | return {
'share_group': {
'id': share_group.get('id'),
'name': share_group.get('name'),
'links': self._get_links(request, share_group['id'])
}
} | Generic, non-detailed view of a share group. | Generic, non-detailed view of a share group. | [
"Generic",
"non",
"-",
"detailed",
"view",
"of",
"a",
"share",
"group",
"."
] | def summary(self, request, share_group):
"""Generic, non-detailed view of a share group."""
return {
'share_group': {
'id': share_group.get('id'),
'name': share_group.get('name'),
'links': self._get_links(request, share_group['id'])
... | [
"def",
"summary",
"(",
"self",
",",
"request",
",",
"share_group",
")",
":",
"return",
"{",
"'share_group'",
":",
"{",
"'id'",
":",
"share_group",
".",
"get",
"(",
"'id'",
")",
",",
"'name'",
":",
"share_group",
".",
"get",
"(",
"'name'",
")",
",",
"... | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/api/views/share_groups.py#L35-L43 | |
9miao/G-Firefly | 8fbeeb3ef9782600560be48228c91cfb8f5ff87d | gfirefly/gfirefly/utils/services.py | python | CommandService.unMapTarget | (self, target) | Remove a target from the service. | Remove a target from the service. | [
"Remove",
"a",
"target",
"from",
"the",
"service",
"."
] | def unMapTarget(self, target):
"""Remove a target from the service.
"""
key = int((target.__name__).split('_')[-1])
if key in self._targets:
del self._targets[key] | [
"def",
"unMapTarget",
"(",
"self",
",",
"target",
")",
":",
"key",
"=",
"int",
"(",
"(",
"target",
".",
"__name__",
")",
".",
"split",
"(",
"'_'",
")",
"[",
"-",
"1",
"]",
")",
"if",
"key",
"in",
"self",
".",
"_targets",
":",
"del",
"self",
"."... | https://github.com/9miao/G-Firefly/blob/8fbeeb3ef9782600560be48228c91cfb8f5ff87d/gfirefly/gfirefly/utils/services.py#L85-L90 | ||
xMistt/fortnitepy-bot | 407a4fa9cf37e61533054389dea355335bcdb2a7 | partybot/party.py | python | PartyCommands.bp | (self, ctx: fortnitepy.ext.commands.Context, tier: int) | [] | async def bp(self, ctx: fortnitepy.ext.commands.Context, tier: int) -> None:
await self.bot.party.me.set_battlepass_info(
has_purchased=True,
level=tier,
)
await ctx.send(f'Set battle pass tier to {tier}.') | [
"async",
"def",
"bp",
"(",
"self",
",",
"ctx",
":",
"fortnitepy",
".",
"ext",
".",
"commands",
".",
"Context",
",",
"tier",
":",
"int",
")",
"->",
"None",
":",
"await",
"self",
".",
"bot",
".",
"party",
".",
"me",
".",
"set_battlepass_info",
"(",
"... | https://github.com/xMistt/fortnitepy-bot/blob/407a4fa9cf37e61533054389dea355335bcdb2a7/partybot/party.py#L114-L120 | ||||
accel-brain/accel-brain-code | 86f489dc9be001a3bae6d053f48d6b57c0bedb95 | Accel-Brain-Base/accelbrainbase/observabledata/_mxnet/transformermodel/transformer_encoder.py | python | TransformerEncoder.hybrid_forward | (self, F, x, m=None) | return self.forward_propagation(F, x, m) | Hybrid forward with Gluon API.
Args:
F: `mxnet.ndarray` or `mxnet.symbol`.
x: `mxnet.ndarray` of observed data points.
m: `mxnet.ndarray` of self-attention masks.
Returns:
`mxnet.ndarray` or `mxnet.symbol` of inferenced feature poi... | Hybrid forward with Gluon API. | [
"Hybrid",
"forward",
"with",
"Gluon",
"API",
"."
] | def hybrid_forward(self, F, x, m=None):
'''
Hybrid forward with Gluon API.
Args:
F: `mxnet.ndarray` or `mxnet.symbol`.
x: `mxnet.ndarray` of observed data points.
m: `mxnet.ndarray` of self-attention masks.
Returns:
... | [
"def",
"hybrid_forward",
"(",
"self",
",",
"F",
",",
"x",
",",
"m",
"=",
"None",
")",
":",
"# rank-3",
"return",
"self",
".",
"forward_propagation",
"(",
"F",
",",
"x",
",",
"m",
")"
] | https://github.com/accel-brain/accel-brain-code/blob/86f489dc9be001a3bae6d053f48d6b57c0bedb95/Accel-Brain-Base/accelbrainbase/observabledata/_mxnet/transformermodel/transformer_encoder.py#L290-L303 | |
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/words/xish/domish.py | python | Element.__str__ | (self) | return "" | Retrieve the first CData (content) node | Retrieve the first CData (content) node | [
"Retrieve",
"the",
"first",
"CData",
"(",
"content",
")",
"node"
] | def __str__(self):
""" Retrieve the first CData (content) node
"""
for n in self.children:
if isinstance(n, types.StringTypes): return n
return "" | [
"def",
"__str__",
"(",
"self",
")",
":",
"for",
"n",
"in",
"self",
".",
"children",
":",
"if",
"isinstance",
"(",
"n",
",",
"types",
".",
"StringTypes",
")",
":",
"return",
"n",
"return",
"\"\""
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/words/xish/domish.py#L434-L439 | |
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/nltk/draw/util.py | python | CanvasWidget.hidden | (self) | return self.__hidden | :return: True if this canvas widget is hidden.
:rtype: bool | :return: True if this canvas widget is hidden.
:rtype: bool | [
":",
"return",
":",
"True",
"if",
"this",
"canvas",
"widget",
"is",
"hidden",
".",
":",
"rtype",
":",
"bool"
] | def hidden(self):
"""
:return: True if this canvas widget is hidden.
:rtype: bool
"""
return self.__hidden | [
"def",
"hidden",
"(",
"self",
")",
":",
"return",
"self",
".",
"__hidden"
] | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/draw/util.py#L480-L485 | |
Cisco-Talos/BASS | 6dd8b7aa4b13ddcd48f0c8fbd64ac43955157420 | funcdb/server.py | python | _function_count_transitions | (func) | return sum(1 for bb in func.basic_blocks for _ in bb.successors) | Count the number of transitions between basic blocks in a function | Count the number of transitions between basic blocks in a function | [
"Count",
"the",
"number",
"of",
"transitions",
"between",
"basic",
"blocks",
"in",
"a",
"function"
] | def _function_count_transitions(func):
"""Count the number of transitions between basic blocks in a function"""
return sum(1 for bb in func.basic_blocks for _ in bb.successors) | [
"def",
"_function_count_transitions",
"(",
"func",
")",
":",
"return",
"sum",
"(",
"1",
"for",
"bb",
"in",
"func",
".",
"basic_blocks",
"for",
"_",
"in",
"bb",
".",
"successors",
")"
] | https://github.com/Cisco-Talos/BASS/blob/6dd8b7aa4b13ddcd48f0c8fbd64ac43955157420/funcdb/server.py#L97-L99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.