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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/plugins/pluginmanager/__init__.py | python | PluginmanagerPlugin.onStartup | (self) | Initialize plugin settings. | Initialize plugin settings. | [
"Initialize",
"plugin",
"settings",
"."
] | def onStartup(self):
"""
Initialize plugin settings.
"""
self._adminPlugin = self.console.getPlugin('admin')
# register our commands
if 'commands' in self.config.sections():
for cmd in self.config.options('commands'):
level = self.config.get('... | [
"def",
"onStartup",
"(",
"self",
")",
":",
"self",
".",
"_adminPlugin",
"=",
"self",
".",
"console",
".",
"getPlugin",
"(",
"'admin'",
")",
"# register our commands",
"if",
"'commands'",
"in",
"self",
".",
"config",
".",
"sections",
"(",
")",
":",
"for",
... | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/plugins/pluginmanager/__init__.py#L59-L79 | ||
aws/aws-parallelcluster | f1fe5679a01c524e7ea904c329bd6d17318c6cd9 | cli/src/pcluster/aws/s3_resource.py | python | S3Resource.delete_object_versions | (self, bucket_name, prefix=None) | Delete object versions by filter. | Delete object versions by filter. | [
"Delete",
"object",
"versions",
"by",
"filter",
"."
] | def delete_object_versions(self, bucket_name, prefix=None):
"""Delete object versions by filter."""
self.get_bucket(bucket_name).object_versions.filter(Prefix=prefix).delete() | [
"def",
"delete_object_versions",
"(",
"self",
",",
"bucket_name",
",",
"prefix",
"=",
"None",
")",
":",
"self",
".",
"get_bucket",
"(",
"bucket_name",
")",
".",
"object_versions",
".",
"filter",
"(",
"Prefix",
"=",
"prefix",
")",
".",
"delete",
"(",
")"
] | https://github.com/aws/aws-parallelcluster/blob/f1fe5679a01c524e7ea904c329bd6d17318c6cd9/cli/src/pcluster/aws/s3_resource.py#L50-L52 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v2alpha1_cron_job_list.py | python | V2alpha1CronJobList.metadata | (self) | return self._metadata | Gets the metadata of this V2alpha1CronJobList.
Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
:return: The metadata of this V2alpha1CronJobList.
:rtype: V1ListMeta | Gets the metadata of this V2alpha1CronJobList.
Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata | [
"Gets",
"the",
"metadata",
"of",
"this",
"V2alpha1CronJobList",
".",
"Standard",
"list",
"metadata",
".",
"More",
"info",
":",
"https",
":",
"//",
"git",
".",
"k8s",
".",
"io",
"/",
"community",
"/",
"contributors",
"/",
"devel",
"/",
"api",
"-",
"conven... | def metadata(self):
"""
Gets the metadata of this V2alpha1CronJobList.
Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
:return: The metadata of this V2alpha1CronJobList.
:rtype: V1ListMeta
"""
return ... | [
"def",
"metadata",
"(",
"self",
")",
":",
"return",
"self",
".",
"_metadata"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v2alpha1_cron_job_list.py#L124-L132 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/ecm/v20190719/models.py | python | DescribeDisksRequest.__init__ | (self) | r"""
:param Filters: 过滤条件。参数不支持同时指定`DiskIds`和`Filters`。<br><li>disk-usage - Array of String - 是否必填:否 -(过滤条件)按云盘类型过滤。 (SYSTEM_DISK:表示系统盘 | DATA_DISK:表示数据盘)<br><li>disk-charge-type - Array of String - 是否必填:否 -(过滤条件)按照云硬盘计费模式过滤。 (PREPAID:表示预付费,即包年包月 | POSTPAID_BY_HOUR:表示后付费,即按量计费。)<br><li>portable - Array of Strin... | r"""
:param Filters: 过滤条件。参数不支持同时指定`DiskIds`和`Filters`。<br><li>disk-usage - Array of String - 是否必填:否 -(过滤条件)按云盘类型过滤。 (SYSTEM_DISK:表示系统盘 | DATA_DISK:表示数据盘)<br><li>disk-charge-type - Array of String - 是否必填:否 -(过滤条件)按照云硬盘计费模式过滤。 (PREPAID:表示预付费,即包年包月 | POSTPAID_BY_HOUR:表示后付费,即按量计费。)<br><li>portable - Array of Strin... | [
"r",
":",
"param",
"Filters",
":",
"过滤条件。参数不支持同时指定",
"DiskIds",
"和",
"Filters",
"。<br",
">",
"<li",
">",
"disk",
"-",
"usage",
"-",
"Array",
"of",
"String",
"-",
"是否必填:否",
"-",
"(过滤条件)按云盘类型过滤。",
"(",
"SYSTEM_DISK:表示系统盘",
"|",
"DATA_DISK:表示数据盘",
")",
"<br",
... | def __init__(self):
r"""
:param Filters: 过滤条件。参数不支持同时指定`DiskIds`和`Filters`。<br><li>disk-usage - Array of String - 是否必填:否 -(过滤条件)按云盘类型过滤。 (SYSTEM_DISK:表示系统盘 | DATA_DISK:表示数据盘)<br><li>disk-charge-type - Array of String - 是否必填:否 -(过滤条件)按照云硬盘计费模式过滤。 (PREPAID:表示预付费,即包年包月 | POSTPAID_BY_HOUR:表示后付费,即按量计费。)<br><... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Filters",
"=",
"None",
"self",
".",
"Limit",
"=",
"None",
"self",
".",
"OrderField",
"=",
"None",
"self",
".",
"Offset",
"=",
"None",
"self",
".",
"ReturnBindAutoSnapshotPolicy",
"=",
"None",
"self"... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ecm/v20190719/models.py#L3028-L3051 | ||
cms-dev/cms | 0401c5336b34b1731736045da4877fef11889274 | cms/grading/Sandbox.py | python | wait_without_std | (procs) | return [process.wait() for process in procs] | Wait for the conclusion of the processes in the list, avoiding
starving for input and output.
procs (list): a list of processes as returned by Popen.
return (list): a list of return codes. | Wait for the conclusion of the processes in the list, avoiding
starving for input and output. | [
"Wait",
"for",
"the",
"conclusion",
"of",
"the",
"processes",
"in",
"the",
"list",
"avoiding",
"starving",
"for",
"input",
"and",
"output",
"."
] | def wait_without_std(procs):
"""Wait for the conclusion of the processes in the list, avoiding
starving for input and output.
procs (list): a list of processes as returned by Popen.
return (list): a list of return codes.
"""
def get_to_consume():
"""Amongst stdout and stderr of list o... | [
"def",
"wait_without_std",
"(",
"procs",
")",
":",
"def",
"get_to_consume",
"(",
")",
":",
"\"\"\"Amongst stdout and stderr of list of processes, find the\n ones that are alive and not closed (i.e., that may still want\n to write to).\n\n return (list): a list of open stre... | https://github.com/cms-dev/cms/blob/0401c5336b34b1731736045da4877fef11889274/cms/grading/Sandbox.py#L63-L106 | |
moinwiki/moin | 568f223231aadecbd3b21a701ec02271f8d8021d | src/moin/scripts/migration/moin19/_utils19.py | python | quoteWikinameFS | (wikiname, charset=CHARSET19) | return ''.join(quoted) | Return file system representation of a Unicode WikiName.
Warning: will raise UnicodeError if wikiname can not be encoded using
charset. The default value 'utf-8' can encode any character.
:param wikiname: wiki name [unicode]
:param charset: charset to encode string (before quoting)
:rtype: string
... | Return file system representation of a Unicode WikiName. | [
"Return",
"file",
"system",
"representation",
"of",
"a",
"Unicode",
"WikiName",
"."
] | def quoteWikinameFS(wikiname, charset=CHARSET19):
"""
Return file system representation of a Unicode WikiName.
Warning: will raise UnicodeError if wikiname can not be encoded using
charset. The default value 'utf-8' can encode any character.
:param wikiname: wiki name [unicode]
:param charset:... | [
"def",
"quoteWikinameFS",
"(",
"wikiname",
",",
"charset",
"=",
"CHARSET19",
")",
":",
"filename",
"=",
"wikiname",
".",
"encode",
"(",
"charset",
")",
"quoted",
"=",
"[",
"]",
"location",
"=",
"0",
"for",
"needle",
"in",
"UNSAFE",
".",
"finditer",
"(",
... | https://github.com/moinwiki/moin/blob/568f223231aadecbd3b21a701ec02271f8d8021d/src/moin/scripts/migration/moin19/_utils19.py#L82-L110 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/setuptools/_vendor/packaging/markers.py | python | _eval_op | (lhs, op, rhs) | return oper(lhs, rhs) | [] | def _eval_op(lhs, op, rhs):
try:
spec = Specifier("".join([op.serialize(), rhs]))
except InvalidSpecifier:
pass
else:
return spec.contains(lhs)
oper = _operators.get(op.serialize())
if oper is None:
raise UndefinedComparison(
"Undefined {0!r} on {1!r} and... | [
"def",
"_eval_op",
"(",
"lhs",
",",
"op",
",",
"rhs",
")",
":",
"try",
":",
"spec",
"=",
"Specifier",
"(",
"\"\"",
".",
"join",
"(",
"[",
"op",
".",
"serialize",
"(",
")",
",",
"rhs",
"]",
")",
")",
"except",
"InvalidSpecifier",
":",
"pass",
"els... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/setuptools/_vendor/packaging/markers.py#L183-L197 | |||
umautobots/vod-converter | 29e16918145ebd97e1692ae8e7ef3dc4da242a88 | vod_converter/converter.py | python | Ingestor.ingest | (self, path) | Read in data from the filesytem.
:param path: '/path/to/data/'
:return: an array of dicts conforming to `IMAGE_DETECTION_SCHEMA` | Read in data from the filesytem.
:param path: '/path/to/data/'
:return: an array of dicts conforming to `IMAGE_DETECTION_SCHEMA` | [
"Read",
"in",
"data",
"from",
"the",
"filesytem",
".",
":",
"param",
"path",
":",
"/",
"path",
"/",
"to",
"/",
"data",
"/",
":",
"return",
":",
"an",
"array",
"of",
"dicts",
"conforming",
"to",
"IMAGE_DETECTION_SCHEMA"
] | def ingest(self, path):
"""
Read in data from the filesytem.
:param path: '/path/to/data/'
:return: an array of dicts conforming to `IMAGE_DETECTION_SCHEMA`
"""
pass | [
"def",
"ingest",
"(",
"self",
",",
"path",
")",
":",
"pass"
] | https://github.com/umautobots/vod-converter/blob/29e16918145ebd97e1692ae8e7ef3dc4da242a88/vod_converter/converter.py#L81-L87 | ||
imagr/imagr | e54bcf3f0f951babcd2fa153de2dd8556aa3506d | Imagr/gmacpyutil/systemconfig.py | python | GetDot1xInterfaces | () | return interfaces | Retrieves attributes of all dot1x compatible interfaces.
Returns:
Array of dict or empty array | Retrieves attributes of all dot1x compatible interfaces. | [
"Retrieves",
"attributes",
"of",
"all",
"dot1x",
"compatible",
"interfaces",
"."
] | def GetDot1xInterfaces():
"""Retrieves attributes of all dot1x compatible interfaces.
Returns:
Array of dict or empty array
"""
interfaces = []
for interface in GetNetworkInterfaces():
if interface['type'] == 'IEEE80211' or interface['type'] == 'Ethernet':
if (interface['builtin'] and
... | [
"def",
"GetDot1xInterfaces",
"(",
")",
":",
"interfaces",
"=",
"[",
"]",
"for",
"interface",
"in",
"GetNetworkInterfaces",
"(",
")",
":",
"if",
"interface",
"[",
"'type'",
"]",
"==",
"'IEEE80211'",
"or",
"interface",
"[",
"'type'",
"]",
"==",
"'Ethernet'",
... | https://github.com/imagr/imagr/blob/e54bcf3f0f951babcd2fa153de2dd8556aa3506d/Imagr/gmacpyutil/systemconfig.py#L381-L393 | |
cocagne/paxos | cf3b5a2bf6ece39d2432b7ebfe1efb2e232bc2df | paxos/practical.py | python | Messenger.send_prepare_nack | (self, to_uid, proposal_id, promised_id) | Sends a Prepare Nack message for the proposal to the specified node | Sends a Prepare Nack message for the proposal to the specified node | [
"Sends",
"a",
"Prepare",
"Nack",
"message",
"for",
"the",
"proposal",
"to",
"the",
"specified",
"node"
] | def send_prepare_nack(self, to_uid, proposal_id, promised_id):
'''
Sends a Prepare Nack message for the proposal to the specified node
''' | [
"def",
"send_prepare_nack",
"(",
"self",
",",
"to_uid",
",",
"proposal_id",
",",
"promised_id",
")",
":"
] | https://github.com/cocagne/paxos/blob/cf3b5a2bf6ece39d2432b7ebfe1efb2e232bc2df/paxos/practical.py#L12-L15 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/redis/client.py | python | PubSub.unsubscribe | (self, *args) | return self.execute_command('UNSUBSCRIBE', *args) | Unsubscribe from the supplied channels. If empty, unsubscribe from
all channels | Unsubscribe from the supplied channels. If empty, unsubscribe from
all channels | [
"Unsubscribe",
"from",
"the",
"supplied",
"channels",
".",
"If",
"empty",
"unsubscribe",
"from",
"all",
"channels"
] | def unsubscribe(self, *args):
"""
Unsubscribe from the supplied channels. If empty, unsubscribe from
all channels
"""
if args:
args = list_or_args(args[0], args[1:])
return self.execute_command('UNSUBSCRIBE', *args) | [
"def",
"unsubscribe",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"args",
":",
"args",
"=",
"list_or_args",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
":",
"]",
")",
"return",
"self",
".",
"execute_command",
"(",
"'UNSUBSCRIBE'",
",",
"*... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/redis/client.py#L2489-L2496 | |
OpenMDAO/OpenMDAO-Framework | f2e37b7de3edeaaeb2d251b375917adec059db9b | openmdao.main/src/openmdao/main/plugin.py | python | _load_templates | () | return templates, class_templates, test_template | Reads templates from files in the plugin_templates directory.
conf.py:
This is the template for the file that Sphinx uses to configure itself.
It's intended to match the conf.py for the OpenMDAO docs, so if those
change, this may need to be updated.
index.rst
Template for the top level... | Reads templates from files in the plugin_templates directory. | [
"Reads",
"templates",
"from",
"files",
"in",
"the",
"plugin_templates",
"directory",
"."
] | def _load_templates():
''' Reads templates from files in the plugin_templates directory.
conf.py:
This is the template for the file that Sphinx uses to configure itself.
It's intended to match the conf.py for the OpenMDAO docs, so if those
change, this may need to be updated.
index.rst
... | [
"def",
"_load_templates",
"(",
")",
":",
"# There are a number of string templates that are used to produce various",
"# files within the plugin distribution. These templates are stored in the",
"# templates dict, with the key being the name of the file that the",
"# template corresponds to.",
"te... | https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.main/src/openmdao/main/plugin.py#L41-L123 | |
hubblestack/hubble | 763142474edcecdec5fd25591dc29c3536e8f969 | hubblestack/modules/conf_publisher.py | python | _filter_config | (opts_to_log, remove_dots=True) | return filtered_conf | Filters out keys containing certain patterns to avoid sensitive information being sent to splunk | Filters out keys containing certain patterns to avoid sensitive information being sent to splunk | [
"Filters",
"out",
"keys",
"containing",
"certain",
"patterns",
"to",
"avoid",
"sensitive",
"information",
"being",
"sent",
"to",
"splunk"
] | def _filter_config(opts_to_log, remove_dots=True):
"""
Filters out keys containing certain patterns to avoid sensitive information being sent to splunk
"""
patterns_to_filter = ["password", "token", "passphrase", "privkey", "keyid", "s3.key"]
filtered_conf = _remove_sensitive_info(opts_to_log, patte... | [
"def",
"_filter_config",
"(",
"opts_to_log",
",",
"remove_dots",
"=",
"True",
")",
":",
"patterns_to_filter",
"=",
"[",
"\"password\"",
",",
"\"token\"",
",",
"\"passphrase\"",
",",
"\"privkey\"",
",",
"\"keyid\"",
",",
"\"s3.key\"",
"]",
"filtered_conf",
"=",
"... | https://github.com/hubblestack/hubble/blob/763142474edcecdec5fd25591dc29c3536e8f969/hubblestack/modules/conf_publisher.py#L65-L75 | |
openstack/openstack-ansible | 954567346e24c46a07d1f6d018ffb9e80ea7960d | osa_toolkit/manage.py | python | print_containers_per_group | (inventory) | return table | Return a table of groups and the containers in each group.
Keyword arguments:
inventory -- inventory dictionary | Return a table of groups and the containers in each group. | [
"Return",
"a",
"table",
"of",
"groups",
"and",
"the",
"containers",
"in",
"each",
"group",
"."
] | def print_containers_per_group(inventory):
"""Return a table of groups and the containers in each group.
Keyword arguments:
inventory -- inventory dictionary
"""
required_list = [
'groups',
'container_name'
]
table = prettytable.PrettyTable(required_list)
for group_name... | [
"def",
"print_containers_per_group",
"(",
"inventory",
")",
":",
"required_list",
"=",
"[",
"'groups'",
",",
"'container_name'",
"]",
"table",
"=",
"prettytable",
".",
"PrettyTable",
"(",
"required_list",
")",
"for",
"group_name",
"in",
"inventory",
".",
"keys",
... | https://github.com/openstack/openstack-ansible/blob/954567346e24c46a07d1f6d018ffb9e80ea7960d/osa_toolkit/manage.py#L189-L220 | |
coderSkyChen/Action_Recognition_Zoo | 92ec5ec3efeee852aec5c057798298cd3a8e58ae | model_zoo/models/slim/nets/resnet_v1.py | python | resnet_v1_152 | (inputs,
num_classes=None,
is_training=True,
global_pool=True,
output_stride=None,
reuse=None,
scope='resnet_v1_152') | return resnet_v1(inputs, blocks, num_classes, is_training,
global_pool=global_pool, output_stride=output_stride,
include_root_block=True, reuse=reuse, scope=scope) | ResNet-152 model of [1]. See resnet_v1() for arg and return description. | ResNet-152 model of [1]. See resnet_v1() for arg and return description. | [
"ResNet",
"-",
"152",
"model",
"of",
"[",
"1",
"]",
".",
"See",
"resnet_v1",
"()",
"for",
"arg",
"and",
"return",
"description",
"."
] | def resnet_v1_152(inputs,
num_classes=None,
is_training=True,
global_pool=True,
output_stride=None,
reuse=None,
scope='resnet_v1_152'):
"""ResNet-152 model of [1]. See resnet_v1() for arg and return description... | [
"def",
"resnet_v1_152",
"(",
"inputs",
",",
"num_classes",
"=",
"None",
",",
"is_training",
"=",
"True",
",",
"global_pool",
"=",
"True",
",",
"output_stride",
"=",
"None",
",",
"reuse",
"=",
"None",
",",
"scope",
"=",
"'resnet_v1_152'",
")",
":",
"blocks"... | https://github.com/coderSkyChen/Action_Recognition_Zoo/blob/92ec5ec3efeee852aec5c057798298cd3a8e58ae/model_zoo/models/slim/nets/resnet_v1.py#L254-L273 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/api/core_v1_api.py | python | CoreV1Api.replace_namespace_status | (self, name, body, **kwargs) | return self.replace_namespace_status_with_http_info(name, body, **kwargs) | replace_namespace_status # noqa: E501
replace status of the specified Namespace # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.replace_namespace_status(name, body, async_req=True)
... | replace_namespace_status # noqa: E501 | [
"replace_namespace_status",
"#",
"noqa",
":",
"E501"
] | def replace_namespace_status(self, name, body, **kwargs): # noqa: E501
"""replace_namespace_status # noqa: E501
replace status of the specified Namespace # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=... | [
"def",
"replace_namespace_status",
"(",
"self",
",",
"name",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"replace_namespace_status_with_http_info",
"(",
"name",... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/api/core_v1_api.py#L25643-L25670 | |
bachya/smart-home | 536b989e0d7057c7a8a65b2ac9bbffd4b826cce7 | hass/settings/custom_components/hacs/tasks/base.py | python | HacsTask.slug | (self) | return self.__class__.__module__.rsplit(".", maxsplit=1)[-1] | Return the check slug. | Return the check slug. | [
"Return",
"the",
"check",
"slug",
"."
] | def slug(self) -> str:
"""Return the check slug."""
return self.__class__.__module__.rsplit(".", maxsplit=1)[-1] | [
"def",
"slug",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"__class__",
".",
"__module__",
".",
"rsplit",
"(",
"\".\"",
",",
"maxsplit",
"=",
"1",
")",
"[",
"-",
"1",
"]"
] | https://github.com/bachya/smart-home/blob/536b989e0d7057c7a8a65b2ac9bbffd4b826cce7/hass/settings/custom_components/hacs/tasks/base.py#L29-L31 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/numbers.py | python | Integral.__rlshift__ | (self, other) | other << self | other << self | [
"other",
"<<",
"self"
] | def __rlshift__(self, other):
"""other << self"""
raise NotImplementedError | [
"def",
"__rlshift__",
"(",
"self",
",",
"other",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/numbers.py#L330-L332 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/object_detection/utils/json_utils.py | python | Dumps | (obj, float_digits=-1, **params) | return json_str | Wrapper of json.dumps that allows specifying the float precision used.
Args:
obj: The object to dump.
float_digits: The number of digits of precision when writing floats out.
**params: Additional parameters to pass to json.dumps.
Returns:
output: JSON string representation of obj. | Wrapper of json.dumps that allows specifying the float precision used. | [
"Wrapper",
"of",
"json",
".",
"dumps",
"that",
"allows",
"specifying",
"the",
"float",
"precision",
"used",
"."
] | def Dumps(obj, float_digits=-1, **params):
"""Wrapper of json.dumps that allows specifying the float precision used.
Args:
obj: The object to dump.
float_digits: The number of digits of precision when writing floats out.
**params: Additional parameters to pass to json.dumps.
Returns:
output: JSO... | [
"def",
"Dumps",
"(",
"obj",
",",
"float_digits",
"=",
"-",
"1",
",",
"*",
"*",
"params",
")",
":",
"json_str",
"=",
"json",
".",
"dumps",
"(",
"obj",
",",
"*",
"*",
"params",
")",
"if",
"float_digits",
">",
"-",
"1",
":",
"json_str",
"=",
"Format... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/object_detection/utils/json_utils.py#L45-L59 | |
taigaio/taiga-ncurses | 65312098f2d167762e0dbd1c16019754ab64d068 | taiga_ncurses/api/client.py | python | TaigaClient.get_issue | (self, id, params={}) | return self._get(url, params) | [] | def get_issue(self, id, params={}):
url = urljoin(self._host, self.URLS.get("issue").format(id))
return self._get(url, params) | [
"def",
"get_issue",
"(",
"self",
",",
"id",
",",
"params",
"=",
"{",
"}",
")",
":",
"url",
"=",
"urljoin",
"(",
"self",
".",
"_host",
",",
"self",
".",
"URLS",
".",
"get",
"(",
"\"issue\"",
")",
".",
"format",
"(",
"id",
")",
")",
"return",
"se... | https://github.com/taigaio/taiga-ncurses/blob/65312098f2d167762e0dbd1c16019754ab64d068/taiga_ncurses/api/client.py#L297-L299 | |||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/util.py | python | JsonRPCClient.request | (self, endpoint, *args) | [] | async def request(self, endpoint, *args):
self._id += 1
data = ('{"jsonrpc": "2.0", "id":"%d", "method": "%s", "params": %s }'
% (self._id, endpoint, json.dumps(args)))
async with self.session.post(self.url, data=data) as resp:
if resp.status == 200:
r... | [
"async",
"def",
"request",
"(",
"self",
",",
"endpoint",
",",
"*",
"args",
")",
":",
"self",
".",
"_id",
"+=",
"1",
"data",
"=",
"(",
"'{\"jsonrpc\": \"2.0\", \"id\":\"%d\", \"method\": \"%s\", \"params\": %s }'",
"%",
"(",
"self",
".",
"_id",
",",
"endpoint",
... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/util.py#L1598-L1613 | ||||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/messaging/scheduling/views.py | python | BroadcastListView._format_time | (self, time) | return user_time.ui_string(SERVER_DATETIME_FORMAT) | [] | def _format_time(self, time):
if not time:
return ''
user_time = ServerTime(time).user_time(self.project_timezone)
return user_time.ui_string(SERVER_DATETIME_FORMAT) | [
"def",
"_format_time",
"(",
"self",
",",
"time",
")",
":",
"if",
"not",
"time",
":",
"return",
"''",
"user_time",
"=",
"ServerTime",
"(",
"time",
")",
".",
"user_time",
"(",
"self",
".",
"project_timezone",
")",
"return",
"user_time",
".",
"ui_string",
"... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/messaging/scheduling/views.py#L302-L307 | |||
garethdmm/gryphon | 73e19fa2d0b64c3fc7dac9e0036fc92e25e5b694 | gryphon/execution/live_runner.py | python | get_strategy_class_from_module | (module) | Get the strategy class from a module according to a simple ruleset.
This ruleset is: return the first class defined in the module that is a subclass of
the Strategy base class, and which case-insensitive matches the module name
(filename) when any underscores are removed from the module name. This allows u... | Get the strategy class from a module according to a simple ruleset. | [
"Get",
"the",
"strategy",
"class",
"from",
"a",
"module",
"according",
"to",
"a",
"simple",
"ruleset",
"."
] | def get_strategy_class_from_module(module):
"""
Get the strategy class from a module according to a simple ruleset.
This ruleset is: return the first class defined in the module that is a subclass of
the Strategy base class, and which case-insensitive matches the module name
(filename) when any und... | [
"def",
"get_strategy_class_from_module",
"(",
"module",
")",
":",
"expected_strat_name",
"=",
"module",
".",
"__name__",
".",
"replace",
"(",
"'_'",
",",
"''",
")",
"if",
"'.'",
"in",
"expected_strat_name",
":",
"# Probably a module path.",
"expected_strat_name",
"=... | https://github.com/garethdmm/gryphon/blob/73e19fa2d0b64c3fc7dac9e0036fc92e25e5b694/gryphon/execution/live_runner.py#L102-L129 | ||
OpenMDAO/OpenMDAO | f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd | openmdao/solvers/solver.py | python | SolverInfo.append_subsolver | (self) | Add a new level for any sub-solver for your solver. | Add a new level for any sub-solver for your solver. | [
"Add",
"a",
"new",
"level",
"for",
"any",
"sub",
"-",
"solver",
"for",
"your",
"solver",
"."
] | def append_subsolver(self):
"""
Add a new level for any sub-solver for your solver.
"""
new_str = '| '
self.prefix += new_str
self.stack.append(new_str) | [
"def",
"append_subsolver",
"(",
"self",
")",
":",
"new_str",
"=",
"'| '",
"self",
".",
"prefix",
"+=",
"new_str",
"self",
".",
"stack",
".",
"append",
"(",
"new_str",
")"
] | https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/solvers/solver.py#L66-L72 | ||
PaddlePaddle/PaddleHub | 107ee7e1a49d15e9c94da3956475d88a53fc165f | modules/text/language_model/slda_novel/sampler.py | python | MHSampler.__construct_alias_table | (self) | Construct alias table for all words. | Construct alias table for all words. | [
"Construct",
"alias",
"table",
"for",
"all",
"words",
"."
] | def __construct_alias_table(self):
"""Construct alias table for all words.
"""
logger.info("Construct alias table for alias sampling method.")
vocab_size = self.__model.vocab_size()
self.__topic_indexes = [[] for _ in range(vocab_size)]
self.__alias_tables = [VoseAlias() ... | [
"def",
"__construct_alias_table",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Construct alias table for alias sampling method.\"",
")",
"vocab_size",
"=",
"self",
".",
"__model",
".",
"vocab_size",
"(",
")",
"self",
".",
"__topic_indexes",
"=",
"[",
"[",... | https://github.com/PaddlePaddle/PaddleHub/blob/107ee7e1a49d15e9c94da3956475d88a53fc165f/modules/text/language_model/slda_novel/sampler.py#L34-L64 | ||
inducer/pycuda | 9f3b898ec0846e2a4dff5077d4403ea03b1fccf9 | pycuda/gpuarray.py | python | if_positive | (criterion, then_, else_, out=None, stream=None) | return out | [] | def if_positive(criterion, then_, else_, out=None, stream=None):
if not (criterion.shape == then_.shape == else_.shape):
raise ValueError("shapes do not match")
if not (then_.dtype == else_.dtype):
raise ValueError("dtypes do not match")
func = elementwise.get_if_positive_kernel(criterion.... | [
"def",
"if_positive",
"(",
"criterion",
",",
"then_",
",",
"else_",
",",
"out",
"=",
"None",
",",
"stream",
"=",
"None",
")",
":",
"if",
"not",
"(",
"criterion",
".",
"shape",
"==",
"then_",
".",
"shape",
"==",
"else_",
".",
"shape",
")",
":",
"rai... | https://github.com/inducer/pycuda/blob/9f3b898ec0846e2a4dff5077d4403ea03b1fccf9/pycuda/gpuarray.py#L1890-L1913 | |||
abhinavsingh/proxy.py | c6fceb639a5925994f04b15b333413693eb434eb | proxy/core/base/tcp_server.py | python | BaseTcpServerHandler._optionally_wrap_socket | (
self, conn: socket.socket,
) | return conn | Attempts to wrap accepted client connection using provided certificates.
Shutdown and closes client connection upon error. | Attempts to wrap accepted client connection using provided certificates. | [
"Attempts",
"to",
"wrap",
"accepted",
"client",
"connection",
"using",
"provided",
"certificates",
"."
] | def _optionally_wrap_socket(
self, conn: socket.socket,
) -> Union[ssl.SSLSocket, socket.socket]:
"""Attempts to wrap accepted client connection using provided certificates.
Shutdown and closes client connection upon error.
"""
if self._encryption_enabled():
... | [
"def",
"_optionally_wrap_socket",
"(",
"self",
",",
"conn",
":",
"socket",
".",
"socket",
",",
")",
"->",
"Union",
"[",
"ssl",
".",
"SSLSocket",
",",
"socket",
".",
"socket",
"]",
":",
"if",
"self",
".",
"_encryption_enabled",
"(",
")",
":",
"assert",
... | https://github.com/abhinavsingh/proxy.py/blob/c6fceb639a5925994f04b15b333413693eb434eb/proxy/core/base/tcp_server.py#L210-L222 | |
shmilylty/OneForAll | 48591142a641e80f8a64ab215d11d06b696702d7 | common/utils.py | python | gen_random_ip | () | Generate random decimal IP string | Generate random decimal IP string | [
"Generate",
"random",
"decimal",
"IP",
"string"
] | def gen_random_ip():
"""
Generate random decimal IP string
"""
while True:
ip = IPv4Address(random.randint(0, 2 ** 32 - 1))
if ip.is_global:
return ip.exploded | [
"def",
"gen_random_ip",
"(",
")",
":",
"while",
"True",
":",
"ip",
"=",
"IPv4Address",
"(",
"random",
".",
"randint",
"(",
"0",
",",
"2",
"**",
"32",
"-",
"1",
")",
")",
"if",
"ip",
".",
"is_global",
":",
"return",
"ip",
".",
"exploded"
] | https://github.com/shmilylty/OneForAll/blob/48591142a641e80f8a64ab215d11d06b696702d7/common/utils.py#L43-L50 | ||
sixty-north/cosmic-ray | cf7fb7c3cc564db1e8d53b8e8848c9f46e61a879 | src/cosmic_ray/cli.py | python | baseline | (config_file, session_file) | Runs a baseline execution that executes the test suite over unmutated code.
If ``--session-file`` is provided, the session used for baselining is stored in that file. Otherwise,
the session is stored in a temporary file which is deleted after the baselining.
Exits with 0 if the job has exited normally, ot... | Runs a baseline execution that executes the test suite over unmutated code. | [
"Runs",
"a",
"baseline",
"execution",
"that",
"executes",
"the",
"test",
"suite",
"over",
"unmutated",
"code",
"."
] | def baseline(config_file, session_file):
"""Runs a baseline execution that executes the test suite over unmutated code.
If ``--session-file`` is provided, the session used for baselining is stored in that file. Otherwise,
the session is stored in a temporary file which is deleted after the baselining.
... | [
"def",
"baseline",
"(",
"config_file",
",",
"session_file",
")",
":",
"cfg",
"=",
"load_config",
"(",
"config_file",
")",
"@",
"contextmanager",
"def",
"path_or_temp",
"(",
"path",
")",
":",
"if",
"path",
"is",
"None",
":",
"with",
"tempfile",
".",
"Tempor... | https://github.com/sixty-north/cosmic-ray/blob/cf7fb7c3cc564db1e8d53b8e8848c9f46e61a879/src/cosmic_ray/cli.py#L127-L167 | ||
latchset/jwcrypto | 48f6234713bc0da46a947c543c02a86adda080aa | jwcrypto/jwk.py | python | JWK.export_public | (self, as_dict=False) | return json_encode(pub) | Exports the public key in the standard JSON format.
It fails if one is not available like when this function
is called on a symmetric key.
:param as_dict(bool): If set to True export as python dict not JSON | Exports the public key in the standard JSON format.
It fails if one is not available like when this function
is called on a symmetric key. | [
"Exports",
"the",
"public",
"key",
"in",
"the",
"standard",
"JSON",
"format",
".",
"It",
"fails",
"if",
"one",
"is",
"not",
"available",
"like",
"when",
"this",
"function",
"is",
"called",
"on",
"a",
"symmetric",
"key",
"."
] | def export_public(self, as_dict=False):
"""Exports the public key in the standard JSON format.
It fails if one is not available like when this function
is called on a symmetric key.
:param as_dict(bool): If set to True export as python dict not JSON
"""
pub = self._publi... | [
"def",
"export_public",
"(",
"self",
",",
"as_dict",
"=",
"False",
")",
":",
"pub",
"=",
"self",
".",
"_public_params",
"(",
")",
"if",
"as_dict",
"is",
"True",
":",
"return",
"pub",
"return",
"json_encode",
"(",
"pub",
")"
] | https://github.com/latchset/jwcrypto/blob/48f6234713bc0da46a947c543c02a86adda080aa/jwcrypto/jwk.py#L629-L639 | |
WenmuZhou/PytorchOCR | 0b2b3a67814ae40b20f3814d6793f5d75d644e38 | tools/det_train.py | python | get_fine_tune_params | (net, finetune_stage) | return to_return_parameters | 获取需要优化的参数
Args:
net:
Returns: 需要优化的参数 | 获取需要优化的参数
Args:
net:
Returns: 需要优化的参数 | [
"获取需要优化的参数",
"Args",
":",
"net",
":",
"Returns",
":",
"需要优化的参数"
] | def get_fine_tune_params(net, finetune_stage):
"""
获取需要优化的参数
Args:
net:
Returns: 需要优化的参数
"""
to_return_parameters = []
for stage in finetune_stage:
attr = getattr(net.module, stage, None)
for element in attr.parameters():
to_return_parameters.append(elemen... | [
"def",
"get_fine_tune_params",
"(",
"net",
",",
"finetune_stage",
")",
":",
"to_return_parameters",
"=",
"[",
"]",
"for",
"stage",
"in",
"finetune_stage",
":",
"attr",
"=",
"getattr",
"(",
"net",
".",
"module",
",",
"stage",
",",
"None",
")",
"for",
"eleme... | https://github.com/WenmuZhou/PytorchOCR/blob/0b2b3a67814ae40b20f3814d6793f5d75d644e38/tools/det_train.py#L112-L124 | |
florath/rmtoo | 6ffe08703451358dca24b232ee4380b1da23bcad | rmtoo/lib/vcs/Git.py | python | Git.__get_blob | (self, commit, base_dir, sub_path) | return self.__get_blob_direct(ltree, sub_path_split[-1]) | Returns the blob from the give base directory and path.
If the file (blob) is not available, a None is returned.
If the directory is not available / accessable an exception
is thrown. | Returns the blob from the give base directory and path.
If the file (blob) is not available, a None is returned.
If the directory is not available / accessable an exception
is thrown. | [
"Returns",
"the",
"blob",
"from",
"the",
"give",
"base",
"directory",
"and",
"path",
".",
"If",
"the",
"file",
"(",
"blob",
")",
"is",
"not",
"available",
"a",
"None",
"is",
"returned",
".",
"If",
"the",
"directory",
"is",
"not",
"available",
"/",
"acc... | def __get_blob(self, commit, base_dir, sub_path):
'''Returns the blob from the give base directory and path.
If the file (blob) is not available, a None is returned.
If the directory is not available / accessable an exception
is thrown.'''
assert sub_path
full_pa... | [
"def",
"__get_blob",
"(",
"self",
",",
"commit",
",",
"base_dir",
",",
"sub_path",
")",
":",
"assert",
"sub_path",
"full_path",
"=",
"base_dir",
".",
"split",
"(",
"\"/\"",
")",
"sub_path_split",
"=",
"sub_path",
".",
"split",
"(",
"\"/\"",
")",
"if",
"l... | https://github.com/florath/rmtoo/blob/6ffe08703451358dca24b232ee4380b1da23bcad/rmtoo/lib/vcs/Git.py#L228-L239 | |
qfpl/hpython | 4c608ebbcfaee56ad386666d27e67cd4c77b0b4f | benchmarks/pypy.py | python | Decimal._round_half_down | (self, prec) | Round 5 down | Round 5 down | [
"Round",
"5",
"down"
] | def _round_half_down(self, prec):
"""Round 5 down"""
if _exact_half(self._int, prec):
return -1
else:
return self._round_half_up(prec) | [
"def",
"_round_half_down",
"(",
"self",
",",
"prec",
")",
":",
"if",
"_exact_half",
"(",
"self",
".",
"_int",
",",
"prec",
")",
":",
"return",
"-",
"1",
"else",
":",
"return",
"self",
".",
"_round_half_up",
"(",
"prec",
")"
] | https://github.com/qfpl/hpython/blob/4c608ebbcfaee56ad386666d27e67cd4c77b0b4f/benchmarks/pypy.py#L1770-L1775 | ||
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/experiment/routines/_base.py | python | Routine.writeMainCode | (self, buff) | This defines the code for the frames of a single routine | This defines the code for the frames of a single routine | [
"This",
"defines",
"the",
"code",
"for",
"the",
"frames",
"of",
"a",
"single",
"routine"
] | def writeMainCode(self, buff):
"""This defines the code for the frames of a single routine
"""
# create the frame loop for this routine
code = ('\n# ------Prepare to start Routine "%s"-------\n')
buff.writeIndentedLines(code % (self.name))
code = 'continueRoutine = True\n... | [
"def",
"writeMainCode",
"(",
"self",
",",
"buff",
")",
":",
"# create the frame loop for this routine",
"code",
"=",
"(",
"'\\n# ------Prepare to start Routine \"%s\"-------\\n'",
")",
"buff",
".",
"writeIndentedLines",
"(",
"code",
"%",
"(",
"self",
".",
"name",
")",... | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/experiment/routines/_base.py#L340-L448 | ||
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/collections.py | python | OrderedDict.__ne__ | (self, other) | return not self == other | od.__ne__(y) <==> od!=y | od.__ne__(y) <==> od!=y | [
"od",
".",
"__ne__",
"(",
"y",
")",
"<",
"==",
">",
"od!",
"=",
"y"
] | def __ne__(self, other):
'od.__ne__(y) <==> od!=y'
return not self == other | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"self",
"==",
"other"
] | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/collections.py#L228-L230 | |
NiaOrg/NiaPy | 08f24ffc79fe324bc9c66ee7186ef98633026005 | niapy/problems/zakharov.py | python | Zakharov.__init__ | (self, dimension=4, lower=-5.0, upper=10.0, *args, **kwargs) | r"""Initialize Zakharov problem..
Args:
dimension (Optional[int]): Dimension of the problem.
lower (Optional[Union[float, Iterable[float]]]): Lower bounds of the problem.
upper (Optional[Union[float, Iterable[float]]]): Upper bounds of the problem.
See Also:
... | r"""Initialize Zakharov problem.. | [
"r",
"Initialize",
"Zakharov",
"problem",
".."
] | def __init__(self, dimension=4, lower=-5.0, upper=10.0, *args, **kwargs):
r"""Initialize Zakharov problem..
Args:
dimension (Optional[int]): Dimension of the problem.
lower (Optional[Union[float, Iterable[float]]]): Lower bounds of the problem.
upper (Optional[Union[... | [
"def",
"__init__",
"(",
"self",
",",
"dimension",
"=",
"4",
",",
"lower",
"=",
"-",
"5.0",
",",
"upper",
"=",
"10.0",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"dimension",
",",
"lower",
",",
... | https://github.com/NiaOrg/NiaPy/blob/08f24ffc79fe324bc9c66ee7186ef98633026005/niapy/problems/zakharov.py#L46-L58 | ||
KoalixSwitzerland/koalixcrm | 87d125379845d6ab990c19500d63cbed4051040a | koalixcrm/crm/product/currency.py | python | Currency.get_rounding | (self) | Returns either the stored rounding value for a currency or a default rounding value of 0.05
Args: no arguments
Returns: Decimal value
Raises: should not return exceptions | Returns either the stored rounding value for a currency or a default rounding value of 0.05 | [
"Returns",
"either",
"the",
"stored",
"rounding",
"value",
"for",
"a",
"currency",
"or",
"a",
"default",
"rounding",
"value",
"of",
"0",
".",
"05"
] | def get_rounding(self):
"""Returns either the stored rounding value for a currency or a default rounding value of 0.05
Args: no arguments
Returns: Decimal value
Raises: should not return exceptions"""
if self.rounding is None:
return Decimal('0.05')
else:
... | [
"def",
"get_rounding",
"(",
"self",
")",
":",
"if",
"self",
".",
"rounding",
"is",
"None",
":",
"return",
"Decimal",
"(",
"'0.05'",
")",
"else",
":",
"return",
"self",
".",
"rounding"
] | https://github.com/KoalixSwitzerland/koalixcrm/blob/87d125379845d6ab990c19500d63cbed4051040a/koalixcrm/crm/product/currency.py#L20-L31 | ||
yidao620c/core-algorithm | 73f249e00d0e57eb2cea5a4c527ad7ae89ae7c08 | algorithms/ch02sort/m03_merge_sort.py | python | MergeSort.merge_ordered_seq | (self, left, middle, right) | seq: 待排序序列
left <= middle <= right
子数组seq[left..middle]和seq[middle+1..right]都是排好序的
该排序的时间复杂度为O(n) | seq: 待排序序列
left <= middle <= right
子数组seq[left..middle]和seq[middle+1..right]都是排好序的
该排序的时间复杂度为O(n) | [
"seq",
":",
"待排序序列",
"left",
"<",
"=",
"middle",
"<",
"=",
"right",
"子数组seq",
"[",
"left",
"..",
"middle",
"]",
"和seq",
"[",
"middle",
"+",
"1",
"..",
"right",
"]",
"都是排好序的",
"该排序的时间复杂度为O",
"(",
"n",
")"
] | def merge_ordered_seq(self, left, middle, right):
"""
seq: 待排序序列
left <= middle <= right
子数组seq[left..middle]和seq[middle+1..right]都是排好序的
该排序的时间复杂度为O(n)
"""
temp_seq = []
i = left
j = middle + 1
while i <= middle and j <= right:
... | [
"def",
"merge_ordered_seq",
"(",
"self",
",",
"left",
",",
"middle",
",",
"right",
")",
":",
"temp_seq",
"=",
"[",
"]",
"i",
"=",
"left",
"j",
"=",
"middle",
"+",
"1",
"while",
"i",
"<=",
"middle",
"and",
"j",
"<=",
"right",
":",
"if",
"self",
".... | https://github.com/yidao620c/core-algorithm/blob/73f249e00d0e57eb2cea5a4c527ad7ae89ae7c08/algorithms/ch02sort/m03_merge_sort.py#L31-L52 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/sdb/vault.py | python | get | (key, profile=None) | Get a value from the vault service | Get a value from the vault service | [
"Get",
"a",
"value",
"from",
"the",
"vault",
"service"
] | def get(key, profile=None):
"""
Get a value from the vault service
"""
if "?" in key:
path, key = key.split("?")
else:
path, key = key.rsplit("/", 1)
version2 = __utils__["vault.is_v2"](path)
if version2["v2"]:
path = version2["data"]
try:
url = "v1/{}".... | [
"def",
"get",
"(",
"key",
",",
"profile",
"=",
"None",
")",
":",
"if",
"\"?\"",
"in",
"key",
":",
"path",
",",
"key",
"=",
"key",
".",
"split",
"(",
"\"?\"",
")",
"else",
":",
"path",
",",
"key",
"=",
"key",
".",
"rsplit",
"(",
"\"/\"",
",",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/sdb/vault.py#L79-L110 | ||
interpretml/interpret-community | 84d86b7514fd9812f1497329bf1c4c9fc864370e | python/interpret_community/common/explanation_utils.py | python | _sparse_order_imp | (local_importance_values, values_type=_RANKING, features=None, top_k=None) | Compute the ranking for sparse feature importance values.
:param local_importance_values: The local importance values to compute the ranking for.
:type local_importance_values: scipy.sparse.csr_matrix or list[scipy.sparse.csr_matrix]
:param values_type: The type of values, can be 'ranking', which returns t... | Compute the ranking for sparse feature importance values. | [
"Compute",
"the",
"ranking",
"for",
"sparse",
"feature",
"importance",
"values",
"."
] | def _sparse_order_imp(local_importance_values, values_type=_RANKING, features=None, top_k=None):
"""Compute the ranking for sparse feature importance values.
:param local_importance_values: The local importance values to compute the ranking for.
:type local_importance_values: scipy.sparse.csr_matrix or lis... | [
"def",
"_sparse_order_imp",
"(",
"local_importance_values",
",",
"values_type",
"=",
"_RANKING",
",",
"features",
"=",
"None",
",",
"top_k",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"local_importance_values",
",",
"list",
")",
":",
"per_class_sparse_ranking... | https://github.com/interpretml/interpret-community/blob/84d86b7514fd9812f1497329bf1c4c9fc864370e/python/interpret_community/common/explanation_utils.py#L452-L480 | ||
PaddlePaddle/PaddleHub | 107ee7e1a49d15e9c94da3956475d88a53fc165f | modules/image/semantic_segmentation/deeplabv3p_xception65_humanseg/processor.py | python | postprocess | (data_out, org_im, org_im_shape, org_im_path, output_dir, visualization, thresh=120) | return result | Postprocess output of network. one image at a time.
Args:
data_out (numpy.ndarray): output of network.
org_im (numpy.ndarray): original image.
org_im_shape (list): shape pf original image.
org_im_path (list): path of riginal image.
output_dir (str): output directory to store... | Postprocess output of network. one image at a time. | [
"Postprocess",
"output",
"of",
"network",
".",
"one",
"image",
"at",
"a",
"time",
"."
] | def postprocess(data_out, org_im, org_im_shape, org_im_path, output_dir, visualization, thresh=120):
"""
Postprocess output of network. one image at a time.
Args:
data_out (numpy.ndarray): output of network.
org_im (numpy.ndarray): original image.
org_im_shape (list): shape pf origi... | [
"def",
"postprocess",
"(",
"data_out",
",",
"org_im",
",",
"org_im_shape",
",",
"org_im_path",
",",
"output_dir",
",",
"visualization",
",",
"thresh",
"=",
"120",
")",
":",
"result",
"=",
"dict",
"(",
")",
"for",
"logit",
"in",
"data_out",
":",
"logit",
... | https://github.com/PaddlePaddle/PaddleHub/blob/107ee7e1a49d15e9c94da3956475d88a53fc165f/modules/image/semantic_segmentation/deeplabv3p_xception65_humanseg/processor.py#L29-L62 | |
facebook/FAI-PEP | 632918e8b4025044b67eb24aff57027e84836995 | benchmarking/run_remote.py | python | RunRemote._downloadRepoFile | (self, location, tgt_dir, commit_hash) | return tgt_file | location: //repo/fbsource/fbcode/aibench/...../a.py | location: //repo/fbsource/fbcode/aibench/...../a.py | [
"location",
":",
"//",
"repo",
"/",
"fbsource",
"/",
"fbcode",
"/",
"aibench",
"/",
".....",
"/",
"a",
".",
"py"
] | def _downloadRepoFile(self, location, tgt_dir, commit_hash):
"""
location: //repo/fbsource/fbcode/aibench/...../a.py
"""
raw_scm_query = pkg_resources.resource_string(
"aibench", "benchmarking/bin/scm_query.par"
)
query_exe = os.path.join(tgt_dir, "scm_query.p... | [
"def",
"_downloadRepoFile",
"(",
"self",
",",
"location",
",",
"tgt_dir",
",",
"commit_hash",
")",
":",
"raw_scm_query",
"=",
"pkg_resources",
".",
"resource_string",
"(",
"\"aibench\"",
",",
"\"benchmarking/bin/scm_query.par\"",
")",
"query_exe",
"=",
"os",
".",
... | https://github.com/facebook/FAI-PEP/blob/632918e8b4025044b67eb24aff57027e84836995/benchmarking/run_remote.py#L571-L599 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/dateutil/relativedelta.py | python | relativedelta.__add__ | (self, other) | return ret | [] | def __add__(self, other):
if isinstance(other, relativedelta):
return self.__class__(years=other.years + self.years,
months=other.months + self.months,
days=other.days + self.days,
hours=other.hours + ... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"relativedelta",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"years",
"=",
"other",
".",
"years",
"+",
"self",
".",
"years",
",",
"months",
"=",
"oth... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dateutil/relativedelta.py#L317-L402 | |||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/reportlab/pdfbase/cidfonts.py | python | CIDTypeFace.__init__ | (self, name) | Initialised from one of the canned dictionaries in allowedEncodings
Or rather, it will be shortly... | Initialised from one of the canned dictionaries in allowedEncodings | [
"Initialised",
"from",
"one",
"of",
"the",
"canned",
"dictionaries",
"in",
"allowedEncodings"
] | def __init__(self, name):
"""Initialised from one of the canned dictionaries in allowedEncodings
Or rather, it will be shortly..."""
pdfmetrics.TypeFace.__init__(self, name)
self._extractDictInfo(name) | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"pdfmetrics",
".",
"TypeFace",
".",
"__init__",
"(",
"self",
",",
"name",
")",
"self",
".",
"_extractDictInfo",
"(",
"name",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/reportlab/pdfbase/cidfonts.py#L232-L237 | ||
bhoov/exbert | d27b6236aa51b185f7d3fed904f25cabe3baeb1a | server/transformers/examples/summarization/bertabs/utils_summarization.py | python | encode_for_summarization | (story_lines, summary_lines, tokenizer) | return story_token_ids, summary_token_ids | Encode the story and summary lines, and join them
as specified in [1] by using `[SEP] [CLS]` tokens to separate
sentences. | Encode the story and summary lines, and join them
as specified in [1] by using `[SEP] [CLS]` tokens to separate
sentences. | [
"Encode",
"the",
"story",
"and",
"summary",
"lines",
"and",
"join",
"them",
"as",
"specified",
"in",
"[",
"1",
"]",
"by",
"using",
"[",
"SEP",
"]",
"[",
"CLS",
"]",
"tokens",
"to",
"separate",
"sentences",
"."
] | def encode_for_summarization(story_lines, summary_lines, tokenizer):
""" Encode the story and summary lines, and join them
as specified in [1] by using `[SEP] [CLS]` tokens to separate
sentences.
"""
story_lines_token_ids = [tokenizer.encode(line) for line in story_lines]
story_token_ids = [toke... | [
"def",
"encode_for_summarization",
"(",
"story_lines",
",",
"summary_lines",
",",
"tokenizer",
")",
":",
"story_lines_token_ids",
"=",
"[",
"tokenizer",
".",
"encode",
"(",
"line",
")",
"for",
"line",
"in",
"story_lines",
"]",
"story_token_ids",
"=",
"[",
"token... | https://github.com/bhoov/exbert/blob/d27b6236aa51b185f7d3fed904f25cabe3baeb1a/server/transformers/examples/summarization/bertabs/utils_summarization.py#L130-L140 | |
ghostop14/sparrow-wifi | 4b8289773ea4304872062f65a6ffc9352612b08e | wirelessengine.py | python | WirelessEngine.parseIWoutput | (iwOutput) | return retVal | [] | def parseIWoutput(iwOutput):
# Define search regexes once:
p_bss = re.compile('^BSS (.*?)\(')
p_ssid = re.compile('^.+?SSID: +(.*)')
p_ess = re.compile('^ capability:.*(ESS)')
p_ess_privacy = re.compile('^ capability:.*(ESS Privacy)')
p_ibss = re.compile('^ capab... | [
"def",
"parseIWoutput",
"(",
"iwOutput",
")",
":",
"# Define search regexes once:",
"p_bss",
"=",
"re",
".",
"compile",
"(",
"'^BSS (.*?)\\('",
")",
"p_ssid",
"=",
"re",
".",
"compile",
"(",
"'^.+?SSID: +(.*)'",
")",
"p_ess",
"=",
"re",
".",
"compile",
"(",
... | https://github.com/ghostop14/sparrow-wifi/blob/4b8289773ea4304872062f65a6ffc9352612b08e/wirelessengine.py#L667-L855 | |||
mozilla/pontoon | d26999eea57902a30b5c15e9b77277fe7e76a60f | pontoon/base/templatetags/helpers.py | python | provider_login_url | (request, provider_id=settings.AUTHENTICATION_METHOD, **query) | return provider.get_login_url(request, **query) | This function adapts the django-allauth templatetags that don't support jinja2.
@TODO: land support for the jinja2 tags in the django-allauth. | This function adapts the django-allauth templatetags that don't support jinja2. | [
"This",
"function",
"adapts",
"the",
"django",
"-",
"allauth",
"templatetags",
"that",
"don",
"t",
"support",
"jinja2",
"."
] | def provider_login_url(request, provider_id=settings.AUTHENTICATION_METHOD, **query):
"""
This function adapts the django-allauth templatetags that don't support jinja2.
@TODO: land support for the jinja2 tags in the django-allauth.
"""
provider = providers.registry.by_id(provider_id)
auth_para... | [
"def",
"provider_login_url",
"(",
"request",
",",
"provider_id",
"=",
"settings",
".",
"AUTHENTICATION_METHOD",
",",
"*",
"*",
"query",
")",
":",
"provider",
"=",
"providers",
".",
"registry",
".",
"by_id",
"(",
"provider_id",
")",
"auth_params",
"=",
"query",... | https://github.com/mozilla/pontoon/blob/d26999eea57902a30b5c15e9b77277fe7e76a60f/pontoon/base/templatetags/helpers.py#L181-L203 | |
flow-project/flow | a511c41c48e6b928bb2060de8ad1ef3c3e3d9554 | flow/networks/highway.py | python | HighwayNetwork.specify_routes | (self, net_params) | return rts | See parent class. | See parent class. | [
"See",
"parent",
"class",
"."
] | def specify_routes(self, net_params):
"""See parent class."""
num_edges = net_params.additional_params.get("num_edges", 1)
rts = {}
for i in range(num_edges):
rts["highway_{}".format(i)] = ["highway_{}".format(j) for
j in range(i, nu... | [
"def",
"specify_routes",
"(",
"self",
",",
"net_params",
")",
":",
"num_edges",
"=",
"net_params",
".",
"additional_params",
".",
"get",
"(",
"\"num_edges\"",
",",
"1",
")",
"rts",
"=",
"{",
"}",
"for",
"i",
"in",
"range",
"(",
"num_edges",
")",
":",
"... | https://github.com/flow-project/flow/blob/a511c41c48e6b928bb2060de8ad1ef3c3e3d9554/flow/networks/highway.py#L153-L163 | |
google/coursebuilder-core | 08f809db3226d9269e30d5edd0edd33bd22041f4 | coursebuilder/common/safe_dom.py | python | ScriptElement.add_text | (self, text) | Add the script body. | Add the script body. | [
"Add",
"the",
"script",
"body",
"."
] | def add_text(self, text):
"""Add the script body."""
class Script(Text):
def __init__(self, script):
# Pylint is just plain wrong about warning here; suppressing.
# pylint: disable=bad-super-call
super(Script, self).__init__(None)
... | [
"def",
"add_text",
"(",
"self",
",",
"text",
")",
":",
"class",
"Script",
"(",
"Text",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"script",
")",
":",
"# Pylint is just plain wrong about warning here; suppressing.",
"# pylint: disable=bad-super-call",
"super",
"(... | https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/common/safe_dom.py#L280-L297 | ||
keon/algorithms | 23d4e85a506eaeaff315e855be12f8dbe47a7ec3 | algorithms/graph/find_path.py | python | find_path | (graph, start, end, path=[]) | return None | [] | def find_path(graph, start, end, path=[]):
path = path + [start]
if (start == end):
return path
if not start in graph:
return None
for node in graph[start]:
if node not in path:
newpath = find_path(graph, node, end, path)
return newpath
return None | [
"def",
"find_path",
"(",
"graph",
",",
"start",
",",
"end",
",",
"path",
"=",
"[",
"]",
")",
":",
"path",
"=",
"path",
"+",
"[",
"start",
"]",
"if",
"(",
"start",
"==",
"end",
")",
":",
"return",
"path",
"if",
"not",
"start",
"in",
"graph",
":"... | https://github.com/keon/algorithms/blob/23d4e85a506eaeaff315e855be12f8dbe47a7ec3/algorithms/graph/find_path.py#L9-L19 | |||
XKNX/xknx | 1deeeb3dc0978aebacf14492a84e1f1eaf0970ed | xknx/remote_value/remote_value_climate_mode.py | python | RemoteValueOperationMode.to_knx | (self, value: Any) | return DPTArray(self._climate_mode_transcoder.to_knx(value)) | Convert value to payload. | Convert value to payload. | [
"Convert",
"value",
"to",
"payload",
"."
] | def to_knx(self, value: Any) -> DPTArray:
"""Convert value to payload."""
return DPTArray(self._climate_mode_transcoder.to_knx(value)) | [
"def",
"to_knx",
"(",
"self",
",",
"value",
":",
"Any",
")",
"->",
"DPTArray",
":",
"return",
"DPTArray",
"(",
"self",
".",
"_climate_mode_transcoder",
".",
"to_knx",
"(",
"value",
")",
")"
] | https://github.com/XKNX/xknx/blob/1deeeb3dc0978aebacf14492a84e1f1eaf0970ed/xknx/remote_value/remote_value_climate_mode.py#L96-L98 | |
LinkedInAttic/indextank-service | 880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e | storefront/boto/ec2/connection.py | python | EC2Connection.get_spot_price_history | (self, start_time=None, end_time=None,
instance_type=None, product_description=None) | return self.get_list('DescribeSpotPriceHistory', params, [('item', SpotPriceHistory)]) | Retrieve the recent history of spot instances pricing.
@type start_time: str
@param start_time: An indication of how far back to provide price
changes for. An ISO8601 DateTime string.
@type end_time: str
@param end_time: An indication of how f... | Retrieve the recent history of spot instances pricing. | [
"Retrieve",
"the",
"recent",
"history",
"of",
"spot",
"instances",
"pricing",
"."
] | def get_spot_price_history(self, start_time=None, end_time=None,
instance_type=None, product_description=None):
"""
Retrieve the recent history of spot instances pricing.
@type start_time: str
@param start_time: An indication of how far back to pro... | [
"def",
"get_spot_price_history",
"(",
"self",
",",
"start_time",
"=",
"None",
",",
"end_time",
"=",
"None",
",",
"instance_type",
"=",
"None",
",",
"product_description",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"start_time",
":",
"params",
"[... | https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/storefront/boto/ec2/connection.py#L643-L675 | |
cltk/cltk | 1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1 | src/cltk/prosody/non.py | python | LongLine.syllabify | (self, syllabifier) | >>> raw_long_line = "Deyr fé,\\ndeyja frændr"
>>> short_line = ShortLine(raw_long_line)
>>> syl = Syllabifier(language="non", break_geminants=True)
>>> syl.set_invalid_onsets(old_norse_syllabifier.invalid_onsets)
>>> short_line.syllabify(syl)
:param syllabifier: Old Norse syllab... | >>> raw_long_line = "Deyr fé,\\ndeyja frændr"
>>> short_line = ShortLine(raw_long_line)
>>> syl = Syllabifier(language="non", break_geminants=True)
>>> syl.set_invalid_onsets(old_norse_syllabifier.invalid_onsets)
>>> short_line.syllabify(syl) | [
">>>",
"raw_long_line",
"=",
"Deyr",
"fé",
"\\\\",
"ndeyja",
"frændr",
">>>",
"short_line",
"=",
"ShortLine",
"(",
"raw_long_line",
")",
">>>",
"syl",
"=",
"Syllabifier",
"(",
"language",
"=",
"non",
"break_geminants",
"=",
"True",
")",
">>>",
"syl",
".",
... | def syllabify(self, syllabifier):
"""
>>> raw_long_line = "Deyr fé,\\ndeyja frændr"
>>> short_line = ShortLine(raw_long_line)
>>> syl = Syllabifier(language="non", break_geminants=True)
>>> syl.set_invalid_onsets(old_norse_syllabifier.invalid_onsets)
>>> short_line.syllab... | [
"def",
"syllabify",
"(",
"self",
",",
"syllabifier",
")",
":",
"for",
"viisuordh",
"in",
"self",
".",
"tokenized_text",
":",
"word",
"=",
"old_norse_normalize",
"(",
"viisuordh",
")",
"if",
"word",
":",
"self",
".",
"syllabified",
".",
"append",
"(",
"syll... | https://github.com/cltk/cltk/blob/1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1/src/cltk/prosody/non.py#L154-L168 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/networkx/algorithms/components/connected.py | python | is_connected | (G) | return len(set(_plain_bfs(G, arbitrary_element(G)))) == len(G) | Return True if the graph is connected, false otherwise.
Parameters
----------
G : NetworkX Graph
An undirected graph.
Returns
-------
connected : bool
True if the graph is connected, false otherwise.
Raises
------
NetworkXNotImplemented:
If G is undirected.
... | Return True if the graph is connected, false otherwise. | [
"Return",
"True",
"if",
"the",
"graph",
"is",
"connected",
"false",
"otherwise",
"."
] | def is_connected(G):
"""Return True if the graph is connected, false otherwise.
Parameters
----------
G : NetworkX Graph
An undirected graph.
Returns
-------
connected : bool
True if the graph is connected, false otherwise.
Raises
------
NetworkXNotImplemented:
... | [
"def",
"is_connected",
"(",
"G",
")",
":",
"if",
"len",
"(",
"G",
")",
"==",
"0",
":",
"raise",
"nx",
".",
"NetworkXPointlessConcept",
"(",
"'Connectivity is undefined '",
",",
"'for the null graph.'",
")",
"return",
"len",
"(",
"set",
"(",
"_plain_bfs",
"("... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/networkx/algorithms/components/connected.py#L157-L197 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/api/rbac_authorization_v1_api.py | python | RbacAuthorizationV1Api.replace_namespaced_role | (self, name, namespace, body, **kwargs) | return self.replace_namespaced_role_with_http_info(name, namespace, body, **kwargs) | replace_namespaced_role # noqa: E501
replace the specified Role # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.replace_namespaced_role(name, namespace, body, async_req=True)
... | replace_namespaced_role # noqa: E501 | [
"replace_namespaced_role",
"#",
"noqa",
":",
"E501"
] | def replace_namespaced_role(self, name, namespace, body, **kwargs): # noqa: E501
"""replace_namespaced_role # noqa: E501
replace the specified Role # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
... | [
"def",
"replace_namespaced_role",
"(",
"self",
",",
"name",
",",
"namespace",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"replace_namespaced_role_with_http_inf... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/api/rbac_authorization_v1_api.py#L4294-L4322 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/inspect.py | python | Signature.replace | (self, *, parameters=_void, return_annotation=_void) | return type(self)(parameters,
return_annotation=return_annotation) | Creates a customized copy of the Signature.
Pass 'parameters' and/or 'return_annotation' arguments
to override them in the new copy. | Creates a customized copy of the Signature.
Pass 'parameters' and/or 'return_annotation' arguments
to override them in the new copy. | [
"Creates",
"a",
"customized",
"copy",
"of",
"the",
"Signature",
".",
"Pass",
"parameters",
"and",
"/",
"or",
"return_annotation",
"arguments",
"to",
"override",
"them",
"in",
"the",
"new",
"copy",
"."
] | def replace(self, *, parameters=_void, return_annotation=_void):
"""Creates a customized copy of the Signature.
Pass 'parameters' and/or 'return_annotation' arguments
to override them in the new copy.
"""
if parameters is _void:
parameters = self.parameters.values()
... | [
"def",
"replace",
"(",
"self",
",",
"*",
",",
"parameters",
"=",
"_void",
",",
"return_annotation",
"=",
"_void",
")",
":",
"if",
"parameters",
"is",
"_void",
":",
"parameters",
"=",
"self",
".",
"parameters",
".",
"values",
"(",
")",
"if",
"return_annot... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/inspect.py#L3007-L3020 | |
oaubert/python-vlc | 908ffdbd0844dc1849728c456e147788798c99da | generated/dev/vlc.py | python | libvlc_media_new_path | (p_instance, path) | return f(p_instance, path) | Create a media for a certain file path.
See L{libvlc_media_release}.
@param p_instance: the instance.
@param path: local filesystem path.
@return: the newly created media or None on error. | Create a media for a certain file path.
See L{libvlc_media_release}. | [
"Create",
"a",
"media",
"for",
"a",
"certain",
"file",
"path",
".",
"See",
"L",
"{",
"libvlc_media_release",
"}",
"."
] | def libvlc_media_new_path(p_instance, path):
'''Create a media for a certain file path.
See L{libvlc_media_release}.
@param p_instance: the instance.
@param path: local filesystem path.
@return: the newly created media or None on error.
'''
f = _Cfunctions.get('libvlc_media_new_path', None) ... | [
"def",
"libvlc_media_new_path",
"(",
"p_instance",
",",
"path",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_new_path'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_new_path'",
",",
"(",
"(",
"1",
",",
")",
",",
"(",
"1"... | https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/dev/vlc.py#L5256-L5266 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/distlib/util.py | python | Sequencer.add | (self, pred, succ) | [] | def add(self, pred, succ):
assert pred != succ
self._preds.setdefault(succ, set()).add(pred)
self._succs.setdefault(pred, set()).add(succ) | [
"def",
"add",
"(",
"self",
",",
"pred",
",",
"succ",
")",
":",
"assert",
"pred",
"!=",
"succ",
"self",
".",
"_preds",
".",
"setdefault",
"(",
"succ",
",",
"set",
"(",
")",
")",
".",
"add",
"(",
"pred",
")",
"self",
".",
"_succs",
".",
"setdefault... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/distlib/util.py#L1084-L1087 | ||||
kblomqvist/yasha | 56bb1f69077957954e1ebeb77f7273e8dc6a891b | yasha/cli.py | python | print_version | (ctx, param, value) | [] | def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo(yasha.__version__)
ctx.exit() | [
"def",
"print_version",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"not",
"value",
"or",
"ctx",
".",
"resilient_parsing",
":",
"return",
"click",
".",
"echo",
"(",
"yasha",
".",
"__version__",
")",
"ctx",
".",
"exit",
"(",
")"
] | https://github.com/kblomqvist/yasha/blob/56bb1f69077957954e1ebeb77f7273e8dc6a891b/yasha/cli.py#L39-L43 | ||||
zzzeek/sqlalchemy | fc5c54fcd4d868c2a4c7ac19668d72f506fe821e | lib/sqlalchemy/engine/row.py | python | Row._special_name_accessor | (name) | return go | Handle ambiguous names such as "count" and "index" | Handle ambiguous names such as "count" and "index" | [
"Handle",
"ambiguous",
"names",
"such",
"as",
"count",
"and",
"index"
] | def _special_name_accessor(name):
"""Handle ambiguous names such as "count" and "index" """
@property
def go(self):
if self._parent._has_key(name):
return self.__getattr__(name)
else:
def meth(*arg, **kw):
return getat... | [
"def",
"_special_name_accessor",
"(",
"name",
")",
":",
"@",
"property",
"def",
"go",
"(",
"self",
")",
":",
"if",
"self",
".",
"_parent",
".",
"_has_key",
"(",
"name",
")",
":",
"return",
"self",
".",
"__getattr__",
"(",
"name",
")",
"else",
":",
"d... | https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/engine/row.py#L204-L220 | |
binaryage/firelogger.py | 23980e7964fd330aa3ce48d3cc0911fe3dafbfba | gprof2dot.py | python | Profile._tarjan | (self, function, order, stack, orders, lowlinks, visited) | return order | Tarjan's strongly connected components algorithm.
See also:
- http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm | Tarjan's strongly connected components algorithm. | [
"Tarjan",
"s",
"strongly",
"connected",
"components",
"algorithm",
"."
] | def _tarjan(self, function, order, stack, orders, lowlinks, visited):
"""Tarjan's strongly connected components algorithm.
See also:
- http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm
"""
visited.add(function)
orders[function] = order
... | [
"def",
"_tarjan",
"(",
"self",
",",
"function",
",",
"order",
",",
"stack",
",",
"orders",
",",
"lowlinks",
",",
"visited",
")",
":",
"visited",
".",
"add",
"(",
"function",
")",
"orders",
"[",
"function",
"]",
"=",
"order",
"lowlinks",
"[",
"function"... | https://github.com/binaryage/firelogger.py/blob/23980e7964fd330aa3ce48d3cc0911fe3dafbfba/gprof2dot.py#L263-L292 | |
abr/abr_control | a248ec56166f01791857a766ac58ee0920c0861c | abr_control/interfaces/coppeliasim_files/sim.py | python | simxGetUIEventButton | (clientID, uiHandle, operationMode) | return ret, uiEventButtonID.value, arr | Please have a look at the function description/documentation in the CoppeliaSim user manual | Please have a look at the function description/documentation in the CoppeliaSim user manual | [
"Please",
"have",
"a",
"look",
"at",
"the",
"function",
"description",
"/",
"documentation",
"in",
"the",
"CoppeliaSim",
"user",
"manual"
] | def simxGetUIEventButton(clientID, uiHandle, operationMode):
"""
Please have a look at the function description/documentation in the CoppeliaSim user manual
"""
uiEventButtonID = ct.c_int()
auxValues = (ct.c_int * 2)()
ret = c_GetUIEventButton(
clientID, uiHandle, ct.byref(uiEventButton... | [
"def",
"simxGetUIEventButton",
"(",
"clientID",
",",
"uiHandle",
",",
"operationMode",
")",
":",
"uiEventButtonID",
"=",
"ct",
".",
"c_int",
"(",
")",
"auxValues",
"=",
"(",
"ct",
".",
"c_int",
"*",
"2",
")",
"(",
")",
"ret",
"=",
"c_GetUIEventButton",
"... | https://github.com/abr/abr_control/blob/a248ec56166f01791857a766ac58ee0920c0861c/abr_control/interfaces/coppeliasim_files/sim.py#L935-L948 | |
facebookresearch/habitat-lab | c6b96ac061f238f18ad5ca2c08f7f46819d30bd0 | habitat/tasks/rearrange/rearrange_grasp_manager.py | python | RearrangeGraspManager.is_violating_hold_constraint | (self) | return False | Returns true if the object is too far away from the gripper, meaning
the agent violated the hold constraint. | Returns true if the object is too far away from the gripper, meaning
the agent violated the hold constraint. | [
"Returns",
"true",
"if",
"the",
"object",
"is",
"too",
"far",
"away",
"from",
"the",
"gripper",
"meaning",
"the",
"agent",
"violated",
"the",
"hold",
"constraint",
"."
] | def is_violating_hold_constraint(self) -> bool:
"""
Returns true if the object is too far away from the gripper, meaning
the agent violated the hold constraint.
"""
ee_pos = self._sim.robot.ee_transform.translation
if self._snapped_obj_id is not None and (
np.... | [
"def",
"is_violating_hold_constraint",
"(",
"self",
")",
"->",
"bool",
":",
"ee_pos",
"=",
"self",
".",
"_sim",
".",
"robot",
".",
"ee_transform",
".",
"translation",
"if",
"self",
".",
"_snapped_obj_id",
"is",
"not",
"None",
"and",
"(",
"np",
".",
"linalg... | https://github.com/facebookresearch/habitat-lab/blob/c6b96ac061f238f18ad5ca2c08f7f46819d30bd0/habitat/tasks/rearrange/rearrange_grasp_manager.py#L64-L83 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/galgebra/printing.py | python | GA_Printer.__exit__ | (self, type, value, traceback) | [] | def __exit__(self, type, value, traceback):
GA_Printer._off() | [
"def",
"__exit__",
"(",
"self",
",",
"type",
",",
"value",
",",
"traceback",
")",
":",
"GA_Printer",
".",
"_off",
"(",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/galgebra/printing.py#L229-L230 | ||||
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xlgui/widgets/rating.py | python | RatingWidget.destroy | (self) | Cleanups | Cleanups | [
"Cleanups"
] | def destroy(self):
"""
Cleanups
"""
if self._player is not None:
event.remove_callback(
self.on_rating_update, 'playback_track_start', self._player
)
event.remove_callback(
self.on_rating_update, 'playback_track_end', se... | [
"def",
"destroy",
"(",
"self",
")",
":",
"if",
"self",
".",
"_player",
"is",
"not",
"None",
":",
"event",
".",
"remove_callback",
"(",
"self",
".",
"on_rating_update",
",",
"'playback_track_start'",
",",
"self",
".",
"_player",
")",
"event",
".",
"remove_c... | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xlgui/widgets/rating.py#L93-L104 | ||
Ecogenomics/GTDBTk | 1e10c56530b4a15eadce519619a62584a490632d | gtdbtk/markers.py | python | Markers.identify | (self, genomes, tln_tables, out_dir, prefix, force, write_single_copy_genes) | Identify marker genes in genomes.
Parameters
----------
genomes : dict
Genome IDs as the key, path to genome file as value.
tln_tables: Dict[str, int]
Genome ID -> translation table mapping for those user-specified.
out_dir : str
Path to the o... | Identify marker genes in genomes. | [
"Identify",
"marker",
"genes",
"in",
"genomes",
"."
] | def identify(self, genomes, tln_tables, out_dir, prefix, force, write_single_copy_genes):
"""Identify marker genes in genomes.
Parameters
----------
genomes : dict
Genome IDs as the key, path to genome file as value.
tln_tables: Dict[str, int]
Genome ID -... | [
"def",
"identify",
"(",
"self",
",",
"genomes",
",",
"tln_tables",
",",
"out_dir",
",",
"prefix",
",",
"force",
",",
"write_single_copy_genes",
")",
":",
"check_dependencies",
"(",
"[",
"'prodigal'",
",",
"'hmmsearch'",
"]",
")",
"self",
".",
"logger",
".",
... | https://github.com/Ecogenomics/GTDBTk/blob/1e10c56530b4a15eadce519619a62584a490632d/gtdbtk/markers.py#L153-L220 | ||
ricequant/rqalpha | d8b345ca3fde299e061c6a89c1f2c362c3584c96 | rqalpha/portfolio/position.py | python | PositionProxy.position_pnl | (self) | return self._long.position_pnl + self._short.position_pnl | [float] 昨仓盈亏,当前交易日盈亏中来源于昨仓的部分
多方向昨仓盈亏 = 昨日收盘时的持仓 * 合约乘数 * (最新价 - 昨收价)
空方向昨仓盈亏 = 昨日收盘时的持仓 * 合约乘数 * (昨收价 - 最新价) | [float] 昨仓盈亏,当前交易日盈亏中来源于昨仓的部分 | [
"[",
"float",
"]",
"昨仓盈亏,当前交易日盈亏中来源于昨仓的部分"
] | def position_pnl(self):
"""
[float] 昨仓盈亏,当前交易日盈亏中来源于昨仓的部分
多方向昨仓盈亏 = 昨日收盘时的持仓 * 合约乘数 * (最新价 - 昨收价)
空方向昨仓盈亏 = 昨日收盘时的持仓 * 合约乘数 * (昨收价 - 最新价)
"""
return self._long.position_pnl + self._short.position_pnl | [
"def",
"position_pnl",
"(",
"self",
")",
":",
"return",
"self",
".",
"_long",
".",
"position_pnl",
"+",
"self",
".",
"_short",
".",
"position_pnl"
] | https://github.com/ricequant/rqalpha/blob/d8b345ca3fde299e061c6a89c1f2c362c3584c96/rqalpha/portfolio/position.py#L294-L302 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/utils/hashes.py | python | Hashes.check_against_file | (self, file) | return self.check_against_chunks(read_chunks(file)) | Check good hashes against a file-like object
Raise HashMismatch if none match. | Check good hashes against a file-like object | [
"Check",
"good",
"hashes",
"against",
"a",
"file",
"-",
"like",
"object"
] | def check_against_file(self, file):
"""Check good hashes against a file-like object
Raise HashMismatch if none match.
"""
return self.check_against_chunks(read_chunks(file)) | [
"def",
"check_against_file",
"(",
"self",
",",
"file",
")",
":",
"return",
"self",
".",
"check_against_chunks",
"(",
"read_chunks",
"(",
"file",
")",
")"
] | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/utils/hashes.py#L58-L64 | |
divio/django-mailchimp | a55c6fadcc295bdeb4514eab30f61b74caf63eaf | mailchimp/chimpy/chimpy.py | python | Connection.templates | (self, template_type='user', start=0, limit=50) | return self.make_request('GET', 'templates', queries=queries) | Retrieve various templates available in the system, allowing something
similar to our template gallery to be created. | Retrieve various templates available in the system, allowing something
similar to our template gallery to be created. | [
"Retrieve",
"various",
"templates",
"available",
"in",
"the",
"system",
"allowing",
"something",
"similar",
"to",
"our",
"template",
"gallery",
"to",
"be",
"created",
"."
] | def templates(self, template_type='user', start=0, limit=50):
"""
Retrieve various templates available in the system, allowing something
similar to our template gallery to be created.
"""
queries = {
'count': limit,
'offset': start,
"type" : te... | [
"def",
"templates",
"(",
"self",
",",
"template_type",
"=",
"'user'",
",",
"start",
"=",
"0",
",",
"limit",
"=",
"50",
")",
":",
"queries",
"=",
"{",
"'count'",
":",
"limit",
",",
"'offset'",
":",
"start",
",",
"\"type\"",
":",
"template_type",
",",
... | https://github.com/divio/django-mailchimp/blob/a55c6fadcc295bdeb4514eab30f61b74caf63eaf/mailchimp/chimpy/chimpy.py#L363-L373 | |
SUSE/DeepSea | 9c7fad93915ba1250c40d50c855011e9fe41ed21 | srv/modules/runners/net.py | python | _address | (addresses, network) | return matched | Return all addresses in the given network
Note: list comprehension vs. netaddr vs. simple | Return all addresses in the given network | [
"Return",
"all",
"addresses",
"in",
"the",
"given",
"network"
] | def _address(addresses, network):
"""
Return all addresses in the given network
Note: list comprehension vs. netaddr vs. simple
"""
matched = []
for address in addresses:
log.debug("_address: ip {} in network {} ".format(address, network))
if IPAddress(address) in IPNetwork(netw... | [
"def",
"_address",
"(",
"addresses",
",",
"network",
")",
":",
"matched",
"=",
"[",
"]",
"for",
"address",
"in",
"addresses",
":",
"log",
".",
"debug",
"(",
"\"_address: ip {} in network {} \"",
".",
"format",
"(",
"address",
",",
"network",
")",
")",
"if"... | https://github.com/SUSE/DeepSea/blob/9c7fad93915ba1250c40d50c855011e9fe41ed21/srv/modules/runners/net.py#L431-L442 | |
PaddlePaddle/PaddleDetection | 635e3e0a80f3d05751cdcfca8af04ee17c601a92 | deploy/python/mot_sde_infer.py | python | SDE_DetectorPicoDet.predict | (self, image, scaled, threshold=0.5, repeats=1, add_timer=True) | return pred_dets, pred_xyxys | Args:
image (np.ndarray): image numpy data
scaled (bool): whether the coords after detector outputs are scaled,
default False in jde yolov3, set True in general detector.
threshold (float): threshold of predicted box' score
repeats (int): repeat number for... | Args:
image (np.ndarray): image numpy data
scaled (bool): whether the coords after detector outputs are scaled,
default False in jde yolov3, set True in general detector.
threshold (float): threshold of predicted box' score
repeats (int): repeat number for... | [
"Args",
":",
"image",
"(",
"np",
".",
"ndarray",
")",
":",
"image",
"numpy",
"data",
"scaled",
"(",
"bool",
")",
":",
"whether",
"the",
"coords",
"after",
"detector",
"outputs",
"are",
"scaled",
"default",
"False",
"in",
"jde",
"yolov3",
"set",
"True",
... | def predict(self, image, scaled, threshold=0.5, repeats=1, add_timer=True):
'''
Args:
image (np.ndarray): image numpy data
scaled (bool): whether the coords after detector outputs are scaled,
default False in jde yolov3, set True in general detector.
t... | [
"def",
"predict",
"(",
"self",
",",
"image",
",",
"scaled",
",",
"threshold",
"=",
"0.5",
",",
"repeats",
"=",
"1",
",",
"add_timer",
"=",
"True",
")",
":",
"# preprocess",
"if",
"add_timer",
":",
"self",
".",
"det_times",
".",
"preprocess_time_s",
".",
... | https://github.com/PaddlePaddle/PaddleDetection/blob/635e3e0a80f3d05751cdcfca8af04ee17c601a92/deploy/python/mot_sde_infer.py#L307-L375 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/vector/coordsysrect.py | python | CoordSys3D._get_lame_coeff | (curv_coord_name) | return CoordSys3D._calculate_lame_coefficients(curv_coord_name) | Store information about Lame coefficients for pre-defined
coordinate systems.
Parameters
==========
curv_coord_name : str
Name of coordinate system | Store information about Lame coefficients for pre-defined
coordinate systems. | [
"Store",
"information",
"about",
"Lame",
"coefficients",
"for",
"pre",
"-",
"defined",
"coordinate",
"systems",
"."
] | def _get_lame_coeff(curv_coord_name):
"""
Store information about Lame coefficients for pre-defined
coordinate systems.
Parameters
==========
curv_coord_name : str
Name of coordinate system
"""
if isinstance(curv_coord_name, string_types):
... | [
"def",
"_get_lame_coeff",
"(",
"curv_coord_name",
")",
":",
"if",
"isinstance",
"(",
"curv_coord_name",
",",
"string_types",
")",
":",
"if",
"curv_coord_name",
"==",
"'cartesian'",
":",
"return",
"lambda",
"x",
",",
"y",
",",
"z",
":",
"(",
"S",
".",
"One"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/vector/coordsysrect.py#L353-L374 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/pickle.py | python | Unpickler.load_binput | (self) | [] | def load_binput(self):
i = ord(self.read(1))
self.memo[repr(i)] = self.stack[-1] | [
"def",
"load_binput",
"(",
"self",
")",
":",
"i",
"=",
"ord",
"(",
"self",
".",
"read",
"(",
"1",
")",
")",
"self",
".",
"memo",
"[",
"repr",
"(",
"i",
")",
"]",
"=",
"self",
".",
"stack",
"[",
"-",
"1",
"]"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/pickle.py#L1168-L1170 | ||||
dluvizon/deephar | fbebb148a3b7153f911b86e1a7300aa32c336f31 | deephar/utils/plot.py | python | data_to_image | (x, gray_scale=False) | return Image.fromarray(buf.astype(np.uint8), 'RGB') | Convert 'x' to a RGB Image object.
# Arguments
x: image in the format (num_cols, num_rows, 3) for RGB images or
(num_cols, num_rows) for gray scale images. If None, return a
light gray image with size 100x100.
gray_scale: convert the RGB color space to a RGB gray scale space... | Convert 'x' to a RGB Image object. | [
"Convert",
"x",
"to",
"a",
"RGB",
"Image",
"object",
"."
] | def data_to_image(x, gray_scale=False):
""" Convert 'x' to a RGB Image object.
# Arguments
x: image in the format (num_cols, num_rows, 3) for RGB images or
(num_cols, num_rows) for gray scale images. If None, return a
light gray image with size 100x100.
gray_scale: conve... | [
"def",
"data_to_image",
"(",
"x",
",",
"gray_scale",
"=",
"False",
")",
":",
"if",
"x",
"is",
"None",
":",
"x",
"=",
"224",
"*",
"np",
".",
"ones",
"(",
"(",
"100",
",",
"100",
",",
"3",
")",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"if",
... | https://github.com/dluvizon/deephar/blob/fbebb148a3b7153f911b86e1a7300aa32c336f31/deephar/utils/plot.py#L21-L58 | |
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/storage/file.py | python | SimFileStream.set_state | (self, state) | [] | def set_state(self, state):
super().set_state(state)
if type(self.pos) is int:
self.pos = state.solver.BVV(self.pos, state.arch.bits)
elif len(self.pos) != state.arch.bits:
raise TypeError("SimFileStream position must be a bitvector of size %d (arch.bits)" % state.arch.bi... | [
"def",
"set_state",
"(",
"self",
",",
"state",
")",
":",
"super",
"(",
")",
".",
"set_state",
"(",
"state",
")",
"if",
"type",
"(",
"self",
".",
"pos",
")",
"is",
"int",
":",
"self",
".",
"pos",
"=",
"state",
".",
"solver",
".",
"BVV",
"(",
"se... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/storage/file.py#L350-L355 | ||||
lesscpy/lesscpy | 1172a1693df2f4bc929a88b1bebb920e666c0c9f | lesscpy/plib/call.py | python | Call.isurl | (self, string, *args) | return regex.match(arg) | Is url
args:
string (str): match
returns:
bool | Is url
args:
string (str): match
returns:
bool | [
"Is",
"url",
"args",
":",
"string",
"(",
"str",
")",
":",
"match",
"returns",
":",
"bool"
] | def isurl(self, string, *args):
"""Is url
args:
string (str): match
returns:
bool
"""
arg = utility.destring(string)
regex = re.compile(
r'^(?:http|ftp)s?://' # http:// or https://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9]... | [
"def",
"isurl",
"(",
"self",
",",
"string",
",",
"*",
"args",
")",
":",
"arg",
"=",
"utility",
".",
"destring",
"(",
"string",
")",
"regex",
"=",
"re",
".",
"compile",
"(",
"r'^(?:http|ftp)s?://'",
"# http:// or https://",
"r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z... | https://github.com/lesscpy/lesscpy/blob/1172a1693df2f4bc929a88b1bebb920e666c0c9f/lesscpy/plib/call.py#L124-L143 | |
WebwareForPython/DBUtils | 798d5ad3bdfccdebc22fd3d7b16c8b9e86bdcaf7 | dbutils/pooled_db.py | python | SharedDBConnection.__init__ | (self, con) | Create a shared connection.
con: the underlying SteadyDB connection | Create a shared connection. | [
"Create",
"a",
"shared",
"connection",
"."
] | def __init__(self, con):
"""Create a shared connection.
con: the underlying SteadyDB connection
"""
self.con = con
self.shared = 1 | [
"def",
"__init__",
"(",
"self",
",",
"con",
")",
":",
"self",
".",
"con",
"=",
"con",
"self",
".",
"shared",
"=",
"1"
] | https://github.com/WebwareForPython/DBUtils/blob/798d5ad3bdfccdebc22fd3d7b16c8b9e86bdcaf7/dbutils/pooled_db.py#L448-L454 | ||
MarioVilas/winappdbg | 975a088ac54253d0bdef39fe831e82f24b4c11f6 | winappdbg/win32/advapi32.py | python | ServiceStatusEntry.__init__ | (self, raw) | @type raw: L{ENUM_SERVICE_STATUSA} or L{ENUM_SERVICE_STATUSW}
@param raw: Raw structure for this service status entry. | [] | def __init__(self, raw):
"""
@type raw: L{ENUM_SERVICE_STATUSA} or L{ENUM_SERVICE_STATUSW}
@param raw: Raw structure for this service status entry.
"""
self.ServiceName = raw.lpServiceName
self.DisplayName = raw.lpDisplayName
self.ServiceT... | [
"def",
"__init__",
"(",
"self",
",",
"raw",
")",
":",
"self",
".",
"ServiceName",
"=",
"raw",
".",
"lpServiceName",
"self",
".",
"DisplayName",
"=",
"raw",
".",
"lpDisplayName",
"self",
".",
"ServiceType",
"=",
"raw",
".",
"ServiceStatus",
".",
"dwServiceT... | https://github.com/MarioVilas/winappdbg/blob/975a088ac54253d0bdef39fe831e82f24b4c11f6/winappdbg/win32/advapi32.py#L972-L985 | |||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/cookielib.py | python | CookieJar.extract_cookies | (self, response, request) | Extract cookies from response, where allowable given the request. | Extract cookies from response, where allowable given the request. | [
"Extract",
"cookies",
"from",
"response",
"where",
"allowable",
"given",
"the",
"request",
"."
] | def extract_cookies(self, response, request):
"""Extract cookies from response, where allowable given the request."""
_debug("extract_cookies: %s", response.info())
self._cookies_lock.acquire()
try:
self._policy._now = self._now = int(time.time())
for cookie in s... | [
"def",
"extract_cookies",
"(",
"self",
",",
"response",
",",
"request",
")",
":",
"_debug",
"(",
"\"extract_cookies: %s\"",
",",
"response",
".",
"info",
"(",
")",
")",
"self",
".",
"_cookies_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_po... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/cookielib.py#L1635-L1647 | ||
toxinu/pyhn | c36090e33ae730daa16c276e5f54c49baef2d8fe | pyhn/hnapi.py | python | HackerNewsAPI.get_best_stories | (self, extra_page=1) | return stories | Gets the "best" stories from Hacker News. | Gets the "best" stories from Hacker News. | [
"Gets",
"the",
"best",
"stories",
"from",
"Hacker",
"News",
"."
] | def get_best_stories(self, extra_page=1):
"""
Gets the "best" stories from Hacker News.
"""
stories = []
for i in range(1, extra_page + 2):
source_latest = self.get_source(
"https://news.ycombinator.com/best?p=%s" % i)
stories += self.get_s... | [
"def",
"get_best_stories",
"(",
"self",
",",
"extra_page",
"=",
"1",
")",
":",
"stories",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"extra_page",
"+",
"2",
")",
":",
"source_latest",
"=",
"self",
".",
"get_source",
"(",
"\"https://news.y... | https://github.com/toxinu/pyhn/blob/c36090e33ae730daa16c276e5f54c49baef2d8fe/pyhn/hnapi.py#L389-L398 | |
benoitc/couchdbkit | 6be148640c00b54ee87a2f2d502e9d67fa5b45a8 | couchdbkit/client.py | python | Server.delete_db | (self, dbname) | Delete database | Delete database | [
"Delete",
"database"
] | def delete_db(self, dbname):
"""
Delete database
"""
del self[dbname] | [
"def",
"delete_db",
"(",
"self",
",",
"dbname",
")",
":",
"del",
"self",
"[",
"dbname",
"]"
] | https://github.com/benoitc/couchdbkit/blob/6be148640c00b54ee87a2f2d502e9d67fa5b45a8/couchdbkit/client.py#L155-L159 | ||
tdamdouni/Pythonista | 3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad | weather/weatherdata.py | python | get_current_weather_in | (data) | Get current weather data. | Get current weather data. | [
"Get",
"current",
"weather",
"data",
"."
] | def get_current_weather_in(data):
'''
Get current weather data.
'''
#api_url_base = 'http://api.openweathermap.org/data/2.5/weather?q={data}{unit}'
api_url_base = 'http://api.openweathermap.org/data/2.5/weather?q={data}{unit}&APPID=7531e2794b160112a5202dcf3e454c8e'
try:
response = urlopen(api_url_base.format(da... | [
"def",
"get_current_weather_in",
"(",
"data",
")",
":",
"#api_url_base = 'http://api.openweathermap.org/data/2.5/weather?q={data}{unit}'",
"api_url_base",
"=",
"'http://api.openweathermap.org/data/2.5/weather?q={data}{unit}&APPID=7531e2794b160112a5202dcf3e454c8e'",
"try",
":",
"response",
... | https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/weather/weatherdata.py#L42-L57 | ||
morganstanley/treadmill | f18267c665baf6def4374d21170198f63ff1cde4 | lib/python/treadmill/scheduler/backend.py | python | Backend.__init__ | (self) | Backend constructor. | Backend constructor. | [
"Backend",
"constructor",
"."
] | def __init__(self):
"""Backend constructor.
""" | [
"def",
"__init__",
"(",
"self",
")",
":"
] | https://github.com/morganstanley/treadmill/blob/f18267c665baf6def4374d21170198f63ff1cde4/lib/python/treadmill/scheduler/backend.py#L23-L25 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/wsgiref/util.py | python | guess_scheme | (environ) | Return a guess for whether 'wsgi.url_scheme' should be 'http' or 'https' | Return a guess for whether 'wsgi.url_scheme' should be 'http' or 'https' | [
"Return",
"a",
"guess",
"for",
"whether",
"wsgi",
".",
"url_scheme",
"should",
"be",
"http",
"or",
"https"
] | def guess_scheme(environ):
"""Return a guess for whether 'wsgi.url_scheme' should be 'http' or 'https'
"""
if environ.get("HTTPS") in ('yes','on','1'):
return 'https'
else:
return 'http' | [
"def",
"guess_scheme",
"(",
"environ",
")",
":",
"if",
"environ",
".",
"get",
"(",
"\"HTTPS\"",
")",
"in",
"(",
"'yes'",
",",
"'on'",
",",
"'1'",
")",
":",
"return",
"'https'",
"else",
":",
"return",
"'http'"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/wsgiref/util.py#L35-L41 | ||
10XGenomics/cellranger | a83c753ce641db6409a59ad817328354fbe7187e | lib/python/cellranger/matrix.py | python | load_matrix_h5_custom_attrs | (filename) | Get matrix metadata attributes from an HDF5 file | Get matrix metadata attributes from an HDF5 file | [
"Get",
"matrix",
"metadata",
"attributes",
"from",
"an",
"HDF5",
"file"
] | def load_matrix_h5_custom_attrs(filename):
'''Get matrix metadata attributes from an HDF5 file'''
h5_version = CountMatrix.get_format_version_from_h5(filename)
if h5_version == 1:
# no support for custom attrs in older versions
return {}
attrs = {}
with h5.File(filename, 'r') as f:
... | [
"def",
"load_matrix_h5_custom_attrs",
"(",
"filename",
")",
":",
"h5_version",
"=",
"CountMatrix",
".",
"get_format_version_from_h5",
"(",
"filename",
")",
"if",
"h5_version",
"==",
"1",
":",
"# no support for custom attrs in older versions",
"return",
"{",
"}",
"attrs"... | https://github.com/10XGenomics/cellranger/blob/a83c753ce641db6409a59ad817328354fbe7187e/lib/python/cellranger/matrix.py#L957-L969 | ||
shuyo/iir | a9b133f27e8ab5b8ef6f528c1f212717399d852f | sequence/hmm.py | python | HMM.inference | (self) | return log_likelihood | @brief one step of EM algorithm
@return log likelihood | [] | def inference(self):
"""
@brief one step of EM algorithm
@return log likelihood
"""
pi_new = numpy.zeros(self.K)
A_new = numpy.zeros((self.K, self.K))
B_new = numpy.zeros((self.V, self.K))
log_likelihood = 0
for x in self.x_ji:
gamma, x... | [
"def",
"inference",
"(",
"self",
")",
":",
"pi_new",
"=",
"numpy",
".",
"zeros",
"(",
"self",
".",
"K",
")",
"A_new",
"=",
"numpy",
".",
"zeros",
"(",
"(",
"self",
".",
"K",
",",
"self",
".",
"K",
")",
")",
"B_new",
"=",
"numpy",
".",
"zeros",
... | https://github.com/shuyo/iir/blob/a9b133f27e8ab5b8ef6f528c1f212717399d852f/sequence/hmm.py#L124-L147 | ||
jamiemcg/Remarkable | 7b0b3dacef270a00c28e8852a88d74f72a3544d7 | pdfkit/api.py | python | from_file | (input, output_path, options=None, toc=None, cover=None, css=None,
configuration=None) | return r.to_pdf(output_path) | Convert HTML file or files to PDF document
:param input: path to HTML file or list with paths or file-like object
:param output_path: path to output PDF file. False means file will be returned as string.
:param options: (optional) dict with wkhtmltopdf options, with or w/o '--'
:param toc: (optional) d... | Convert HTML file or files to PDF document | [
"Convert",
"HTML",
"file",
"or",
"files",
"to",
"PDF",
"document"
] | def from_file(input, output_path, options=None, toc=None, cover=None, css=None,
configuration=None):
"""
Convert HTML file or files to PDF document
:param input: path to HTML file or list with paths or file-like object
:param output_path: path to output PDF file. False means file will be ... | [
"def",
"from_file",
"(",
"input",
",",
"output_path",
",",
"options",
"=",
"None",
",",
"toc",
"=",
"None",
",",
"cover",
"=",
"None",
",",
"css",
"=",
"None",
",",
"configuration",
"=",
"None",
")",
":",
"r",
"=",
"PDFKit",
"(",
"input",
",",
"'fi... | https://github.com/jamiemcg/Remarkable/blob/7b0b3dacef270a00c28e8852a88d74f72a3544d7/pdfkit/api.py#L27-L46 | |
jansel/opentuner | 070c5cef6d933eb760a2f9cd5cd08c95f27aee75 | opentuner/tuningrunmain.py | python | TuningRunMain.results_wait | (self, generation) | called by search_driver to wait for results | called by search_driver to wait for results | [
"called",
"by",
"search_driver",
"to",
"wait",
"for",
"results"
] | def results_wait(self, generation):
"""called by search_driver to wait for results"""
# single process version:
self.measurement_interface.pre_process()
self.measurement_driver.process_all()
self.measurement_interface.post_process() | [
"def",
"results_wait",
"(",
"self",
",",
"generation",
")",
":",
"# single process version:",
"self",
".",
"measurement_interface",
".",
"pre_process",
"(",
")",
"self",
".",
"measurement_driver",
".",
"process_all",
"(",
")",
"self",
".",
"measurement_interface",
... | https://github.com/jansel/opentuner/blob/070c5cef6d933eb760a2f9cd5cd08c95f27aee75/opentuner/tuningrunmain.py#L215-L220 | ||
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/kern/src/kernel_slice_operations.py | python | _slice_psi | (f) | return wrap | [] | def _slice_psi(f):
@wraps(f)
def wrap(self, Z, variational_posterior):
with _Slice_wrap(self, Z, variational_posterior) as s:
ret = f(self, s.X, s.X2)
return ret
return wrap | [
"def",
"_slice_psi",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrap",
"(",
"self",
",",
"Z",
",",
"variational_posterior",
")",
":",
"with",
"_Slice_wrap",
"(",
"self",
",",
"Z",
",",
"variational_posterior",
")",
"as",
"s",
":",
"ret"... | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/kern/src/kernel_slice_operations.py#L271-L277 | |||
scrapy/scrapy | b04cfa48328d5d5749dca6f50fa34e0cfc664c89 | scrapy/extensions/httpcache.py | python | RFC2616Policy._compute_current_age | (self, response, request, now) | return currentage | [] | def _compute_current_age(self, response, request, now):
# Reference nsHttpResponseHead::ComputeCurrentAge
# https://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpResponseHead.cpp#658
currentage = 0
# If Date header is not set we assume it is a fast connection, and
... | [
"def",
"_compute_current_age",
"(",
"self",
",",
"response",
",",
"request",
",",
"now",
")",
":",
"# Reference nsHttpResponseHead::ComputeCurrentAge",
"# https://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpResponseHead.cpp#658",
"currentage",
"=",
"0",
"# If... | https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/extensions/httpcache.py#L197-L214 | |||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/logging/config.py | python | BaseConfigurator.as_tuple | (self, value) | return value | Utility function which converts lists to tuples. | Utility function which converts lists to tuples. | [
"Utility",
"function",
"which",
"converts",
"lists",
"to",
"tuples",
"."
] | def as_tuple(self, value):
"""Utility function which converts lists to tuples."""
if isinstance(value, list):
value = tuple(value)
return value | [
"def",
"as_tuple",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"tuple",
"(",
"value",
")",
"return",
"value"
] | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/logging/config.py#L442-L446 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/scf/v20180416/models.py | python | GetProvisionedConcurrencyConfigRequest.__init__ | (self) | r"""
:param FunctionName: 需要获取预置并发详情的函数名称。
:type FunctionName: str
:param Namespace: 函数所在的命名空间,默认为default。
:type Namespace: str
:param Qualifier: 函数版本号,不传则返回函数所有版本的预置并发信息。
:type Qualifier: str | r"""
:param FunctionName: 需要获取预置并发详情的函数名称。
:type FunctionName: str
:param Namespace: 函数所在的命名空间,默认为default。
:type Namespace: str
:param Qualifier: 函数版本号,不传则返回函数所有版本的预置并发信息。
:type Qualifier: str | [
"r",
":",
"param",
"FunctionName",
":",
"需要获取预置并发详情的函数名称。",
":",
"type",
"FunctionName",
":",
"str",
":",
"param",
"Namespace",
":",
"函数所在的命名空间,默认为default。",
":",
"type",
"Namespace",
":",
"str",
":",
"param",
"Qualifier",
":",
"函数版本号,不传则返回函数所有版本的预置并发信息。",
":",
... | def __init__(self):
r"""
:param FunctionName: 需要获取预置并发详情的函数名称。
:type FunctionName: str
:param Namespace: 函数所在的命名空间,默认为default。
:type Namespace: str
:param Qualifier: 函数版本号,不传则返回函数所有版本的预置并发信息。
:type Qualifier: str
"""
self.FunctionName = None
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"FunctionName",
"=",
"None",
"self",
".",
"Namespace",
"=",
"None",
"self",
".",
"Qualifier",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/scf/v20180416/models.py#L2276-L2287 | ||
EventGhost/EventGhost | 177be516849e74970d2e13cda82244be09f277ce | lib27/site-packages/tornado/tcpserver.py | python | TCPServer.start | (self, num_processes=1) | Starts this server in the `.IOLoop`.
By default, we run the server in this process and do not fork any
additional child process.
If num_processes is ``None`` or <= 0, we detect the number of cores
available on this machine and fork that number of child
processes. If num_process... | Starts this server in the `.IOLoop`. | [
"Starts",
"this",
"server",
"in",
"the",
".",
"IOLoop",
"."
] | def start(self, num_processes=1):
"""Starts this server in the `.IOLoop`.
By default, we run the server in this process and do not fork any
additional child process.
If num_processes is ``None`` or <= 0, we detect the number of cores
available on this machine and fork that numb... | [
"def",
"start",
"(",
"self",
",",
"num_processes",
"=",
"1",
")",
":",
"assert",
"not",
"self",
".",
"_started",
"self",
".",
"_started",
"=",
"True",
"if",
"num_processes",
"!=",
"1",
":",
"process",
".",
"fork_processes",
"(",
"num_processes",
")",
"so... | https://github.com/EventGhost/EventGhost/blob/177be516849e74970d2e13cda82244be09f277ce/lib27/site-packages/tornado/tcpserver.py#L177-L203 | ||
Gandi/gandi.cli | 5de0605126247e986f8288b467a52710a78e1794 | gandi/cli/commands/vlan.py | python | delete | (gandi, background, force, resource) | return opers | Delete a vlan.
Resource can be a vlan name or an ID | Delete a vlan. | [
"Delete",
"a",
"vlan",
"."
] | def delete(gandi, background, force, resource):
"""Delete a vlan.
Resource can be a vlan name or an ID
"""
output_keys = ['id', 'type', 'step']
possible_resources = gandi.vlan.resource_list()
for item in resource:
if item not in possible_resources:
gandi.echo('Sorry vlan %s... | [
"def",
"delete",
"(",
"gandi",
",",
"background",
",",
"force",
",",
"resource",
")",
":",
"output_keys",
"=",
"[",
"'id'",
",",
"'type'",
",",
"'step'",
"]",
"possible_resources",
"=",
"gandi",
".",
"vlan",
".",
"resource_list",
"(",
")",
"for",
"item",... | https://github.com/Gandi/gandi.cli/blob/5de0605126247e986f8288b467a52710a78e1794/gandi/cli/commands/vlan.py#L104-L132 | |
abbat/ydcmd | 12f0e855fd4b7fdc7bf2ffe9c19beee439880763 | ydcmd.py | python | yd_put_retry | (options, source, target) | Реализация одной попытки помещения файла в хранилище
Аргументы:
options (ydOptions) -- Опции приложения
source (str) -- Имя локального файла
target (str) -- Имя файла в хранилище | Реализация одной попытки помещения файла в хранилище | [
"Реализация",
"одной",
"попытки",
"помещения",
"файла",
"в",
"хранилище"
] | def yd_put_retry(options, source, target):
"""
Реализация одной попытки помещения файла в хранилище
Аргументы:
options (ydOptions) -- Опции приложения
source (str) -- Имя локального файла
target (str) -- Имя файла в хранилище
"""
args = {
"path" : ... | [
"def",
"yd_put_retry",
"(",
"options",
",",
"source",
",",
"target",
")",
":",
"args",
"=",
"{",
"\"path\"",
":",
"target",
",",
"\"overwrite\"",
":",
"\"true\"",
"}",
"method",
"=",
"\"GET\"",
"url",
"=",
"options",
".",
"baseurl",
"+",
"\"/resources/uplo... | https://github.com/abbat/ydcmd/blob/12f0e855fd4b7fdc7bf2ffe9c19beee439880763/ydcmd.py#L1349-L1378 | ||
sarnthil/unify-emotion-datasets | aabc2bbb9794e51097e1778028fc66389e42f0c9 | download_datasets.py | python | download | (_, target, droot, __) | [] | def download(_, target, droot, __):
url = target["url"]
fname = target.get("target", url.split("/")[-1])
r = requests.get(
url,
stream=True,
headers={
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Saf... | [
"def",
"download",
"(",
"_",
",",
"target",
",",
"droot",
",",
"__",
")",
":",
"url",
"=",
"target",
"[",
"\"url\"",
"]",
"fname",
"=",
"target",
".",
"get",
"(",
"\"target\"",
",",
"url",
".",
"split",
"(",
"\"/\"",
")",
"[",
"-",
"1",
"]",
")... | https://github.com/sarnthil/unify-emotion-datasets/blob/aabc2bbb9794e51097e1778028fc66389e42f0c9/download_datasets.py#L28-L48 | ||||
SciTools/iris | a12d0b15bab3377b23a148e891270b13a0419c38 | lib/iris/analysis/__init__.py | python | Nearest.interpolator | (self, cube, coords) | return RectilinearInterpolator(
cube, coords, "nearest", self.extrapolation_mode
) | Creates a nearest-neighbour interpolator to perform
interpolation over the given :class:`~iris.cube.Cube` specified
by the dimensions of the specified coordinates.
Typically you should use :meth:`iris.cube.Cube.interpolate` for
interpolating a cube. There are, however, some situations w... | Creates a nearest-neighbour interpolator to perform
interpolation over the given :class:`~iris.cube.Cube` specified
by the dimensions of the specified coordinates. | [
"Creates",
"a",
"nearest",
"-",
"neighbour",
"interpolator",
"to",
"perform",
"interpolation",
"over",
"the",
"given",
":",
"class",
":",
"~iris",
".",
"cube",
".",
"Cube",
"specified",
"by",
"the",
"dimensions",
"of",
"the",
"specified",
"coordinates",
"."
] | def interpolator(self, cube, coords):
"""
Creates a nearest-neighbour interpolator to perform
interpolation over the given :class:`~iris.cube.Cube` specified
by the dimensions of the specified coordinates.
Typically you should use :meth:`iris.cube.Cube.interpolate` for
i... | [
"def",
"interpolator",
"(",
"self",
",",
"cube",
",",
"coords",
")",
":",
"return",
"RectilinearInterpolator",
"(",
"cube",
",",
"coords",
",",
"\"nearest\"",
",",
"self",
".",
"extrapolation_mode",
")"
] | https://github.com/SciTools/iris/blob/a12d0b15bab3377b23a148e891270b13a0419c38/lib/iris/analysis/__init__.py#L2592-L2634 | |
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/protocols/actionmenu/v1_0/driver_service.py | python | DriverMenuService.perform_menu_action | (
self,
profile: Profile,
action_name: str,
action_params: dict,
connection: ConnRecord = None,
thread_id: str = None,
) | return None | Perform an action defined by the active menu.
Args:
profile: The profile
action_name: The unique name of the action being performed
action_params: A collection of parameters for the action
connection: The active connection record
thread_id: The thread... | Perform an action defined by the active menu. | [
"Perform",
"an",
"action",
"defined",
"by",
"the",
"active",
"menu",
"."
] | async def perform_menu_action(
self,
profile: Profile,
action_name: str,
action_params: dict,
connection: ConnRecord = None,
thread_id: str = None,
) -> AgentMessage:
"""
Perform an action defined by the active menu.
Args:
profile:... | [
"async",
"def",
"perform_menu_action",
"(",
"self",
",",
"profile",
":",
"Profile",
",",
"action_name",
":",
"str",
",",
"action_params",
":",
"dict",
",",
"connection",
":",
"ConnRecord",
"=",
"None",
",",
"thread_id",
":",
"str",
"=",
"None",
",",
")",
... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/protocols/actionmenu/v1_0/driver_service.py#L41-L68 | |
rollbar/pyrollbar | 77cbffaa7447f04f653135e1d7f615ce41fcc4e9 | rollbar/__init__.py | python | _report_exc_info | (exc_info, request, extra_data, payload_data, level=None) | return data['uuid'] | Called by report_exc_info() wrapper | Called by report_exc_info() wrapper | [
"Called",
"by",
"report_exc_info",
"()",
"wrapper"
] | def _report_exc_info(exc_info, request, extra_data, payload_data, level=None):
"""
Called by report_exc_info() wrapper
"""
if not _check_config():
return
filtered_level = _filtered_level(exc_info[1])
if level is None:
level = filtered_level
filtered_exc_info = events.on_ex... | [
"def",
"_report_exc_info",
"(",
"exc_info",
",",
"request",
",",
"extra_data",
",",
"payload_data",
",",
"level",
"=",
"None",
")",
":",
"if",
"not",
"_check_config",
"(",
")",
":",
"return",
"filtered_level",
"=",
"_filtered_level",
"(",
"exc_info",
"[",
"1... | https://github.com/rollbar/pyrollbar/blob/77cbffaa7447f04f653135e1d7f615ce41fcc4e9/rollbar/__init__.py#L723-L788 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/getopt.py | python | do_longs | (opts, opt, longopts, args) | return opts, args | [] | def do_longs(opts, opt, longopts, args):
try:
i = opt.index('=')
except ValueError:
optarg = None
else:
opt, optarg = opt[:i], opt[i+1:]
has_arg, opt = long_has_args(opt, longopts)
if has_arg:
if optarg is None:
if not args:
raise GetoptEr... | [
"def",
"do_longs",
"(",
"opts",
",",
"opt",
",",
"longopts",
",",
"args",
")",
":",
"try",
":",
"i",
"=",
"opt",
".",
"index",
"(",
"'='",
")",
"except",
"ValueError",
":",
"optarg",
"=",
"None",
"else",
":",
"opt",
",",
"optarg",
"=",
"opt",
"["... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/getopt.py#L149-L166 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.