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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/rfc3986/validators.py | python | ensure_required_components_exist | (uri, required_components) | Assert that all required components are present in the URI. | Assert that all required components are present in the URI. | [
"Assert",
"that",
"all",
"required",
"components",
"are",
"present",
"in",
"the",
"URI",
"."
] | def ensure_required_components_exist(uri, required_components):
"""Assert that all required components are present in the URI."""
missing_components = sorted([
component
for component in required_components
if getattr(uri, component) is None
])
if missing_components:
rais... | [
"def",
"ensure_required_components_exist",
"(",
"uri",
",",
"required_components",
")",
":",
"missing_components",
"=",
"sorted",
"(",
"[",
"component",
"for",
"component",
"in",
"required_components",
"if",
"getattr",
"(",
"uri",
",",
"component",
")",
"is",
"Non... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/rfc3986/validators.py#L263-L271 | ||
kubeflow/pipelines | bea751c9259ff0ae85290f873170aae89284ba8e | sdk/python/kfp/v2/components/pipeline_task.py | python | PipelineTask.dependent_tasks | (self) | return self.task_spec.dependent_tasks | Returns the list of dependent task names. | Returns the list of dependent task names. | [
"Returns",
"the",
"list",
"of",
"dependent",
"task",
"names",
"."
] | def dependent_tasks(self) -> List[str]:
"""Returns the list of dependent task names."""
return self.task_spec.dependent_tasks | [
"def",
"dependent_tasks",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"self",
".",
"task_spec",
".",
"dependent_tasks"
] | https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/sdk/python/kfp/v2/components/pipeline_task.py#L179-L181 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/redis/client.py | python | PubSub.handle_message | (self, response, ignore_subscribe_messages=False) | return message | Parses a pub/sub message. If the channel or pattern was subscribed to
with a message handler, the handler is invoked instead of a parsed
message being returned. | Parses a pub/sub message. If the channel or pattern was subscribed to
with a message handler, the handler is invoked instead of a parsed
message being returned. | [
"Parses",
"a",
"pub",
"/",
"sub",
"message",
".",
"If",
"the",
"channel",
"or",
"pattern",
"was",
"subscribed",
"to",
"with",
"a",
"message",
"handler",
"the",
"handler",
"is",
"invoked",
"instead",
"of",
"a",
"parsed",
"message",
"being",
"returned",
"."
... | def handle_message(self, response, ignore_subscribe_messages=False):
"""
Parses a pub/sub message. If the channel or pattern was subscribed to
with a message handler, the handler is invoked instead of a parsed
message being returned.
"""
message_type = nativestr(response[... | [
"def",
"handle_message",
"(",
"self",
",",
"response",
",",
"ignore_subscribe_messages",
"=",
"False",
")",
":",
"message_type",
"=",
"nativestr",
"(",
"response",
"[",
"0",
"]",
")",
"if",
"message_type",
"==",
"'pmessage'",
":",
"message",
"=",
"{",
"'type... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/redis/client.py#L3309-L3366 | |
neurokernel/neurokernel | e21e4aece1e8551dfa206d96e8ffd113beb10a85 | neurokernel/plsel.py | python | SelectorMethods._multiindex_row_in | (cls, row, parse_list, start=None, stop=None) | return False | Check whether a row in a MultiIndex matches a parsed selector.
Check whether the entries in a (subinterval of a) given tuple of data
corresponding to the entries of one row in a MultiIndex match the
specified token values.
Parameters
----------
row : sequence
... | Check whether a row in a MultiIndex matches a parsed selector. | [
"Check",
"whether",
"a",
"row",
"in",
"a",
"MultiIndex",
"matches",
"a",
"parsed",
"selector",
"."
] | def _multiindex_row_in(cls, row, parse_list, start=None, stop=None):
"""
Check whether a row in a MultiIndex matches a parsed selector.
Check whether the entries in a (subinterval of a) given tuple of data
corresponding to the entries of one row in a MultiIndex match the
specifi... | [
"def",
"_multiindex_row_in",
"(",
"cls",
",",
"row",
",",
"parse_list",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
")",
":",
"row_sub",
"=",
"row",
"[",
"start",
":",
"stop",
"]",
"for",
"tokens",
"in",
"parse_list",
":",
"# A single row will n... | https://github.com/neurokernel/neurokernel/blob/e21e4aece1e8551dfa206d96e8ffd113beb10a85/neurokernel/plsel.py#L1309-L1377 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | obsolete/pipeline_snps.py | python | runGATOnQTLsSmall | ( infiles, outfile ) | run enrichment analysisusing the qtl definitions from
Jonathan Flint's group. | run enrichment analysisusing the qtl definitions from
Jonathan Flint's group. | [
"run",
"enrichment",
"analysisusing",
"the",
"qtl",
"definitions",
"from",
"Jonathan",
"Flint",
"s",
"group",
"."
] | def runGATOnQTLsSmall( infiles, outfile ):
'''run enrichment analysisusing the qtl definitions from
Jonathan Flint's group.
'''
segments = IOTools.flatten( infiles )
workspaces = [ "workspace_cds.bed", ]
annotations = [ "/net/cpp-compute/backup/andreas/projects/mousestrains/data/qtl/jonat... | [
"def",
"runGATOnQTLsSmall",
"(",
"infiles",
",",
"outfile",
")",
":",
"segments",
"=",
"IOTools",
".",
"flatten",
"(",
"infiles",
")",
"workspaces",
"=",
"[",
"\"workspace_cds.bed\"",
",",
"]",
"annotations",
"=",
"[",
"\"/net/cpp-compute/backup/andreas/projects/mou... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/obsolete/pipeline_snps.py#L3518-L3550 | ||
dgasmith/opt_einsum | 6a30cf5b2852e54824e188cb6b294890c5cf1d9c | opt_einsum/paths.py | python | auto_hq | (
inputs: List[ArrayIndexType],
output: ArrayIndexType,
size_dict: Dict[str, int],
memory_limit: Optional[int] = None,
) | return _AUTO_HQ_CHOICES.get(N, random_greedy_128)(inputs, output, size_dict, memory_limit) | Finds the contraction path by automatically choosing the method based on
how many input arguments there are, but targeting a more generous
amount of search time than ``'auto'``. | Finds the contraction path by automatically choosing the method based on
how many input arguments there are, but targeting a more generous
amount of search time than ``'auto'``. | [
"Finds",
"the",
"contraction",
"path",
"by",
"automatically",
"choosing",
"the",
"method",
"based",
"on",
"how",
"many",
"input",
"arguments",
"there",
"are",
"but",
"targeting",
"a",
"more",
"generous",
"amount",
"of",
"search",
"time",
"than",
"auto",
"."
] | def auto_hq(
inputs: List[ArrayIndexType],
output: ArrayIndexType,
size_dict: Dict[str, int],
memory_limit: Optional[int] = None,
) -> PathType:
"""Finds the contraction path by automatically choosing the method based on
how many input arguments there are, but targeting a more generous
amoun... | [
"def",
"auto_hq",
"(",
"inputs",
":",
"List",
"[",
"ArrayIndexType",
"]",
",",
"output",
":",
"ArrayIndexType",
",",
"size_dict",
":",
"Dict",
"[",
"str",
",",
"int",
"]",
",",
"memory_limit",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
")",
... | https://github.com/dgasmith/opt_einsum/blob/6a30cf5b2852e54824e188cb6b294890c5cf1d9c/opt_einsum/paths.py#L1276-L1289 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/offsetbox.py | python | OffsetImage.draw | (self, renderer) | Draw the children | Draw the children | [
"Draw",
"the",
"children"
] | def draw(self, renderer):
"""
Draw the children
"""
self.image.draw(renderer)
# bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
self.stale = False | [
"def",
"draw",
"(",
"self",
",",
"renderer",
")",
":",
"self",
".",
"image",
".",
"draw",
"(",
"renderer",
")",
"# bbox_artist(self, renderer, fill=False, props=dict(pad=0.))",
"self",
".",
"stale",
"=",
"False"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/offsetbox.py#L1356-L1362 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_container_port.py | python | V1ContainerPort.host_port | (self) | return self._host_port | Gets the host_port of this V1ContainerPort.
Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.
:return: The host_port of this V1ContainerPort.
:rtype: ... | Gets the host_port of this V1ContainerPort.
Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this. | [
"Gets",
"the",
"host_port",
"of",
"this",
"V1ContainerPort",
".",
"Number",
"of",
"port",
"to",
"expose",
"on",
"the",
"host",
".",
"If",
"specified",
"this",
"must",
"be",
"a",
"valid",
"port",
"number",
"0",
"<",
"x",
"<",
"65536",
".",
"If",
"HostNe... | def host_port(self):
"""
Gets the host_port of this V1ContainerPort.
Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.
:return: The host_port ... | [
"def",
"host_port",
"(",
"self",
")",
":",
"return",
"self",
".",
"_host_port"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_container_port.py#L104-L112 | |
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | plugins/webpage/webpage/libs/html5lib/filters/lint.py | python | Filter.__init__ | (self, source, require_matching_tags=True) | Creates a Filter
:arg source: the source token stream
:arg require_matching_tags: whether or not to require matching tags | Creates a Filter | [
"Creates",
"a",
"Filter"
] | def __init__(self, source, require_matching_tags=True):
"""Creates a Filter
:arg source: the source token stream
:arg require_matching_tags: whether or not to require matching tags
"""
super(Filter, self).__init__(source)
self.require_matching_tags = require_matching_t... | [
"def",
"__init__",
"(",
"self",
",",
"source",
",",
"require_matching_tags",
"=",
"True",
")",
":",
"super",
"(",
"Filter",
",",
"self",
")",
".",
"__init__",
"(",
"source",
")",
"self",
".",
"require_matching_tags",
"=",
"require_matching_tags"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/libs/html5lib/filters/lint.py#L18-L27 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | common/djangoapps/track/tracker.py | python | send | (event) | Send an event object to all the initialized backends. | Send an event object to all the initialized backends. | [
"Send",
"an",
"event",
"object",
"to",
"all",
"the",
"initialized",
"backends",
"."
] | def send(event):
"""
Send an event object to all the initialized backends.
"""
warnings.warn(
'track.tracker module is deprecated. Please use eventtracking to send events.', DeprecationWarning
)
for name, backend in backends.items(): # lint-amnesty, pylint: disable=unused-variable
... | [
"def",
"send",
"(",
"event",
")",
":",
"warnings",
".",
"warn",
"(",
"'track.tracker module is deprecated. Please use eventtracking to send events.'",
",",
"DeprecationWarning",
")",
"for",
"name",
",",
"backend",
"in",
"backends",
".",
"items",
"(",
")",
":",
"# li... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/track/tracker.py#L87-L96 | ||
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/share/drivers/zfssa/zfssashare.py | python | ZFSSAShareDriver.create_share | (self, context, share, share_server=None) | return self._export_location(share) | Create a share and export it based on protocol used.
The created share inherits properties from its project. | Create a share and export it based on protocol used. | [
"Create",
"a",
"share",
"and",
"export",
"it",
"based",
"on",
"protocol",
"used",
"."
] | def create_share(self, context, share, share_server=None):
"""Create a share and export it based on protocol used.
The created share inherits properties from its project.
"""
lcfg = self.configuration
arg = self.create_arg(share['size'])
arg.update(self.default_args)
... | [
"def",
"create_share",
"(",
"self",
",",
"context",
",",
"share",
",",
"share_server",
"=",
"None",
")",
":",
"lcfg",
"=",
"self",
".",
"configuration",
"arg",
"=",
"self",
".",
"create_arg",
"(",
"share",
"[",
"'size'",
"]",
")",
"arg",
".",
"update",... | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/zfssa/zfssashare.py#L203-L219 | |
pyjs/pyjs | 6c4a3d3a67300cd5df7f95a67ca9dcdc06950523 | pyjswidgets/pyjamas/selection/Range.py | python | Range.extractContents | (self) | return res | Place the contents of this range into a SPAN element, removing them
from the DOM. All tags required to make the range complete will be
included. This does not preserve the element object ids of the contents.
@return a SPAN element unattached to the DOM, containing the range
co... | Place the contents of this range into a SPAN element, removing them
from the DOM. All tags required to make the range complete will be
included. This does not preserve the element object ids of the contents. | [
"Place",
"the",
"contents",
"of",
"this",
"range",
"into",
"a",
"SPAN",
"element",
"removing",
"them",
"from",
"the",
"DOM",
".",
"All",
"tags",
"required",
"to",
"make",
"the",
"range",
"complete",
"will",
"be",
"included",
".",
"This",
"does",
"not",
"... | def extractContents(self):
"""
Place the contents of this range into a SPAN element, removing them
from the DOM. All tags required to make the range complete will be
included. This does not preserve the element object ids of the contents.
@return a SPAN element unattached to t... | [
"def",
"extractContents",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"m_document",
".",
"createSpanElement",
"(",
")",
"self",
".",
"extractContents",
"(",
"res",
")",
"return",
"res"
] | https://github.com/pyjs/pyjs/blob/6c4a3d3a67300cd5df7f95a67ca9dcdc06950523/pyjswidgets/pyjamas/selection/Range.py#L443-L454 | |
readthedocs/readthedocs.org | 0852d7c10d725d954d3e9a93513171baa1116d9f | readthedocs/config/config.py | python | BuildConfigV2._get_extra_key | (self, value) | return [] | Get the extra keyname (list form) of a dict object.
If there is more than one extra key, the first one is returned.
Example::
{
'key': {
'name': 'inner',
}
}
Will return `['key', 'name']`. | Get the extra keyname (list form) of a dict object. | [
"Get",
"the",
"extra",
"keyname",
"(",
"list",
"form",
")",
"of",
"a",
"dict",
"object",
"."
] | def _get_extra_key(self, value):
"""
Get the extra keyname (list form) of a dict object.
If there is more than one extra key, the first one is returned.
Example::
{
'key': {
'name': 'inner',
}
}
Will return `['key', 'na... | [
"def",
"_get_extra_key",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
"and",
"value",
":",
"key_name",
"=",
"next",
"(",
"iter",
"(",
"value",
")",
")",
"return",
"[",
"key_name",
"]",
"+",
"self",
".",
"... | https://github.com/readthedocs/readthedocs.org/blob/0852d7c10d725d954d3e9a93513171baa1116d9f/readthedocs/config/config.py#L1219-L1238 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/sync/v1/service/sync_map/__init__.py | python | SyncMapInstance.sid | (self) | return self._properties['sid'] | :returns: The unique string that identifies the resource
:rtype: unicode | :returns: The unique string that identifies the resource
:rtype: unicode | [
":",
"returns",
":",
"The",
"unique",
"string",
"that",
"identifies",
"the",
"resource",
":",
"rtype",
":",
"unicode"
] | def sid(self):
"""
:returns: The unique string that identifies the resource
:rtype: unicode
"""
return self._properties['sid'] | [
"def",
"sid",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'sid'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/sync/v1/service/sync_map/__init__.py#L363-L368 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_windows/systrace/catapult/third_party/pyserial/serial/urlhandler/protocol_socket.py | python | SocketSerial.flushOutput | (self) | Clear output buffer, aborting the current output and
discarding all that is in the buffer. | Clear output buffer, aborting the current output and
discarding all that is in the buffer. | [
"Clear",
"output",
"buffer",
"aborting",
"the",
"current",
"output",
"and",
"discarding",
"all",
"that",
"is",
"in",
"the",
"buffer",
"."
] | def flushOutput(self):
"""Clear output buffer, aborting the current output and
discarding all that is in the buffer."""
if not self._isOpen: raise portNotOpenError
if self.logger:
self.logger.info('ignored flushOutput') | [
"def",
"flushOutput",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_isOpen",
":",
"raise",
"portNotOpenError",
"if",
"self",
".",
"logger",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'ignored flushOutput'",
")"
] | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_windows/systrace/catapult/third_party/pyserial/serial/urlhandler/protocol_socket.py#L183-L188 | ||
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/datasets/_arff_parser.py | python | _split_sparse_columns | (
arff_data: ArffSparseDataType, include_columns: List
) | return arff_data_new | obtains several columns from sparse arff representation. Additionally, the
column indices are re-labelled, given the columns that are not included.
(e.g., when including [1, 2, 3], the columns will be relabelled to
[0, 1, 2])
Parameters
----------
arff_data : tuple
A tuple of three list... | obtains several columns from sparse arff representation. Additionally, the
column indices are re-labelled, given the columns that are not included.
(e.g., when including [1, 2, 3], the columns will be relabelled to
[0, 1, 2]) | [
"obtains",
"several",
"columns",
"from",
"sparse",
"arff",
"representation",
".",
"Additionally",
"the",
"column",
"indices",
"are",
"re",
"-",
"labelled",
"given",
"the",
"columns",
"that",
"are",
"not",
"included",
".",
"(",
"e",
".",
"g",
".",
"when",
"... | def _split_sparse_columns(
arff_data: ArffSparseDataType, include_columns: List
) -> ArffSparseDataType:
"""
obtains several columns from sparse arff representation. Additionally, the
column indices are re-labelled, given the columns that are not included.
(e.g., when including [1, 2, 3], the column... | [
"def",
"_split_sparse_columns",
"(",
"arff_data",
":",
"ArffSparseDataType",
",",
"include_columns",
":",
"List",
")",
"->",
"ArffSparseDataType",
":",
"arff_data_new",
":",
"ArffSparseDataType",
"=",
"(",
"list",
"(",
")",
",",
"list",
"(",
")",
",",
"list",
... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/datasets/_arff_parser.py#L18-L51 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/searching.py | python | Results.__nonzero__ | (self) | return not self.is_empty() | [] | def __nonzero__(self):
return not self.is_empty() | [
"def",
"__nonzero__",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"is_empty",
"(",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/searching.py#L1010-L1011 | |||
arq5x/gemini | d393bf3d76a6ff91f711525cb00b6954d2193651 | gemini/infotag.py | python | get_num_of_alleles | (var) | return _safe_single_attr(var.INFO.get('AN')) | return the total number of alleles in called genotypes,
or None if it isn't present in the VCF. | return the total number of alleles in called genotypes,
or None if it isn't present in the VCF. | [
"return",
"the",
"total",
"number",
"of",
"alleles",
"in",
"called",
"genotypes",
"or",
"None",
"if",
"it",
"isn",
"t",
"present",
"in",
"the",
"VCF",
"."
] | def get_num_of_alleles(var):
"""
return the total number of alleles in called genotypes,
or None if it isn't present in the VCF.
"""
return _safe_single_attr(var.INFO.get('AN')) | [
"def",
"get_num_of_alleles",
"(",
"var",
")",
":",
"return",
"_safe_single_attr",
"(",
"var",
".",
"INFO",
".",
"get",
"(",
"'AN'",
")",
")"
] | https://github.com/arq5x/gemini/blob/d393bf3d76a6ff91f711525cb00b6954d2193651/gemini/infotag.py#L116-L121 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/backends/cache.py | python | DummyClient.set | (self, key, value, *args, **kwargs) | [] | def set(self, key, value, *args, **kwargs):
self.cache[key] = value | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"value",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"cache",
"[",
"key",
"]",
"=",
"value"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/backends/cache.py#L70-L71 | ||||
facebookresearch/Large-Scale-VRD | 7ababfe1023941c3653d7aebe9f835a47f5e8277 | lib/utils/blob.py | python | zeros | (shape, int32=False) | return np.zeros(shape, dtype=np.int32 if int32 else np.float32) | Return a blob of all zeros of the given shape with the correct float or
int data type. | Return a blob of all zeros of the given shape with the correct float or
int data type. | [
"Return",
"a",
"blob",
"of",
"all",
"zeros",
"of",
"the",
"given",
"shape",
"with",
"the",
"correct",
"float",
"or",
"int",
"data",
"type",
"."
] | def zeros(shape, int32=False):
"""Return a blob of all zeros of the given shape with the correct float or
int data type.
"""
return np.zeros(shape, dtype=np.int32 if int32 else np.float32) | [
"def",
"zeros",
"(",
"shape",
",",
"int32",
"=",
"False",
")",
":",
"return",
"np",
".",
"zeros",
"(",
"shape",
",",
"dtype",
"=",
"np",
".",
"int32",
"if",
"int32",
"else",
"np",
".",
"float32",
")"
] | https://github.com/facebookresearch/Large-Scale-VRD/blob/7ababfe1023941c3653d7aebe9f835a47f5e8277/lib/utils/blob.py#L120-L124 | |
Kinto/kinto | a9e46e57de8f33c7be098c6f583de18df03b2824 | kinto/authorization.py | python | _resource_endpoint | (object_uri) | return resource_name, plural_endpoint | Determine the resource name and whether it is the plural endpoint from
the specified `object_uri`. Returns `(None, None)` for the root URL plural
endpoint. | Determine the resource name and whether it is the plural endpoint from
the specified `object_uri`. Returns `(None, None)` for the root URL plural
endpoint. | [
"Determine",
"the",
"resource",
"name",
"and",
"whether",
"it",
"is",
"the",
"plural",
"endpoint",
"from",
"the",
"specified",
"object_uri",
".",
"Returns",
"(",
"None",
"None",
")",
"for",
"the",
"root",
"URL",
"plural",
"endpoint",
"."
] | def _resource_endpoint(object_uri):
"""Determine the resource name and whether it is the plural endpoint from
the specified `object_uri`. Returns `(None, None)` for the root URL plural
endpoint.
"""
obj_parts = object_uri.split("/")
plural_endpoint = len(obj_parts) % 2 == 0
if plural_endpoin... | [
"def",
"_resource_endpoint",
"(",
"object_uri",
")",
":",
"obj_parts",
"=",
"object_uri",
".",
"split",
"(",
"\"/\"",
")",
"plural_endpoint",
"=",
"len",
"(",
"obj_parts",
")",
"%",
"2",
"==",
"0",
"if",
"plural_endpoint",
":",
"# /buckets/bid/collections -> /bu... | https://github.com/Kinto/kinto/blob/a9e46e57de8f33c7be098c6f583de18df03b2824/kinto/authorization.py#L59-L78 | |
ucsb-seclab/karonte | 427ac313e596f723e40768b95d13bd7a9fc92fd8 | eval/multi_bin/bdg_bins/taint_analysis/coretaint.py | python | CoreTaint._set_deref_bounds | (self, ast_node) | Check an ast node and if contains a dereferenced address, it sets
its bounds
:param ast_node: ast node
:return: None | Check an ast node and if contains a dereferenced address, it sets
its bounds
:param ast_node: ast node
:return: None | [
"Check",
"an",
"ast",
"node",
"and",
"if",
"contains",
"a",
"dereferenced",
"address",
"it",
"sets",
"its",
"bounds",
":",
"param",
"ast_node",
":",
"ast",
"node",
":",
"return",
":",
"None"
] | def _set_deref_bounds(self, ast_node):
"""
Check an ast node and if contains a dereferenced address, it sets
its bounds
:param ast_node: ast node
:return: None
"""
lb = self._deref[0]
ub = self._deref[1]
if hasattr(ast_node, 'op') and ast_node.op... | [
"def",
"_set_deref_bounds",
"(",
"self",
",",
"ast_node",
")",
":",
"lb",
"=",
"self",
".",
"_deref",
"[",
"0",
"]",
"ub",
"=",
"self",
".",
"_deref",
"[",
"1",
"]",
"if",
"hasattr",
"(",
"ast_node",
",",
"'op'",
")",
"and",
"ast_node",
".",
"op",
... | https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/eval/multi_bin/bdg_bins/taint_analysis/coretaint.py#L230-L251 | ||
mediacloud/backend | d36b489e4fbe6e44950916a04d9543a1d6cd5df0 | apps/extract-and-vector/src/python/extract_and_vector/dbi/downloads/extract.py | python | extract_and_create_download_text | (db: DatabaseHandler, download: dict, extractor_args: PyExtractorArguments) | return download_text | Extract the download and create a download_text from the extracted download. | Extract the download and create a download_text from the extracted download. | [
"Extract",
"the",
"download",
"and",
"create",
"a",
"download_text",
"from",
"the",
"extracted",
"download",
"."
] | def extract_and_create_download_text(db: DatabaseHandler, download: dict, extractor_args: PyExtractorArguments) -> dict:
"""Extract the download and create a download_text from the extracted download."""
download = decode_object_from_bytes_if_needed(download)
downloads_id = download['downloads_id']
lo... | [
"def",
"extract_and_create_download_text",
"(",
"db",
":",
"DatabaseHandler",
",",
"download",
":",
"dict",
",",
"extractor_args",
":",
"PyExtractorArguments",
")",
"->",
"dict",
":",
"download",
"=",
"decode_object_from_bytes_if_needed",
"(",
"download",
")",
"downlo... | https://github.com/mediacloud/backend/blob/d36b489e4fbe6e44950916a04d9543a1d6cd5df0/apps/extract-and-vector/src/python/extract_and_vector/dbi/downloads/extract.py#L165-L198 | |
quic/aimet | dae9bae9a77ca719aa7553fefde4768270fc3518 | TrainingExtensions/tensorflow/src/python/aimet_tensorflow/common/sub_graph_matcher.py | python | SubGraphMatcher.detect_ops_in_graph | (self, op_to_module_dict: Dict[tf.Operation, ModuleIdentifierOpInfo]) | Use the OpTypePattern objects to detect Ops in a
specific Session Graph. Keep the detected Ops and their associated internal Ops.
:param op_to_module_dict: Dictionary mapping op to module op info, to be filled in by SubGraphMatcher | Use the OpTypePattern objects to detect Ops in a
specific Session Graph. Keep the detected Ops and their associated internal Ops. | [
"Use",
"the",
"OpTypePattern",
"objects",
"to",
"detect",
"Ops",
"in",
"a",
"specific",
"Session",
"Graph",
".",
"Keep",
"the",
"detected",
"Ops",
"and",
"their",
"associated",
"internal",
"Ops",
"."
] | def detect_ops_in_graph(self, op_to_module_dict: Dict[tf.Operation, ModuleIdentifierOpInfo]):
"""
Use the OpTypePattern objects to detect Ops in a
specific Session Graph. Keep the detected Ops and their associated internal Ops.
:param op_to_module_dict: Dictionary mapping op to module o... | [
"def",
"detect_ops_in_graph",
"(",
"self",
",",
"op_to_module_dict",
":",
"Dict",
"[",
"tf",
".",
"Operation",
",",
"ModuleIdentifierOpInfo",
"]",
")",
":",
"all_op_patterns_list",
"=",
"[",
"op_dict",
"[",
"'pattern'",
"]",
"for",
"op_dict",
"in",
"list",
"("... | https://github.com/quic/aimet/blob/dae9bae9a77ca719aa7553fefde4768270fc3518/TrainingExtensions/tensorflow/src/python/aimet_tensorflow/common/sub_graph_matcher.py#L508-L562 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/transforms.py | python | BboxBase.count_overlaps | (self, bboxes) | return count_bboxes_overlapping_bbox(self, bboxes) | Count the number of bounding boxes that overlap this one.
bboxes is a sequence of :class:`BboxBase` objects | Count the number of bounding boxes that overlap this one. | [
"Count",
"the",
"number",
"of",
"bounding",
"boxes",
"that",
"overlap",
"this",
"one",
"."
] | def count_overlaps(self, bboxes):
"""
Count the number of bounding boxes that overlap this one.
bboxes is a sequence of :class:`BboxBase` objects
"""
return count_bboxes_overlapping_bbox(self, bboxes) | [
"def",
"count_overlaps",
"(",
"self",
",",
"bboxes",
")",
":",
"return",
"count_bboxes_overlapping_bbox",
"(",
"self",
",",
"bboxes",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/transforms.py#L652-L658 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/bs4/diagnose.py | python | AnnouncingParser.handle_entityref | (self, name) | [] | def handle_entityref(self, name):
self._p("%s ENTITYREF" % name) | [
"def",
"handle_entityref",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_p",
"(",
"\"%s ENTITYREF\"",
"%",
"name",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/bs4/diagnose.py#L132-L133 | ||||
twisted/ldaptor | a7f992adef3a392f568774a0ae84e67d13d49c84 | ldaptor/delta.py | python | Operation.patch | (self, root) | Find the correct entry in IConnectedLDAPEntry and patch it.
@param root: IConnectedLDAPEntry that is at the root of the
subtree the patch applies to.
@returns: Deferred with None or failure. | Find the correct entry in IConnectedLDAPEntry and patch it. | [
"Find",
"the",
"correct",
"entry",
"in",
"IConnectedLDAPEntry",
"and",
"patch",
"it",
"."
] | def patch(self, root):
"""
Find the correct entry in IConnectedLDAPEntry and patch it.
@param root: IConnectedLDAPEntry that is at the root of the
subtree the patch applies to.
@returns: Deferred with None or failure.
"""
raise NotImplementedError("%s.patch not ... | [
"def",
"patch",
"(",
"self",
",",
"root",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"%s.patch not implemented\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
")"
] | https://github.com/twisted/ldaptor/blob/a7f992adef3a392f568774a0ae84e67d13d49c84/ldaptor/delta.py#L117-L126 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/mako/cache.py | python | Cache.invalidate_def | (self, name) | Invalidate the cached content of a particular ``<%def>`` within this
template. | Invalidate the cached content of a particular ``<%def>`` within this
template. | [
"Invalidate",
"the",
"cached",
"content",
"of",
"a",
"particular",
"<%def",
">",
"within",
"this",
"template",
"."
] | def invalidate_def(self, name):
"""Invalidate the cached content of a particular ``<%def>`` within this
template.
"""
self.invalidate("render_%s" % name, __M_defname="render_%s" % name) | [
"def",
"invalidate_def",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"invalidate",
"(",
"\"render_%s\"",
"%",
"name",
",",
"__M_defname",
"=",
"\"render_%s\"",
"%",
"name",
")"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/mako/cache.py#L146-L152 | ||
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/mail/pop3client.py | python | POP3Client.apop | (self, username, digest) | return self.sendShort('APOP', username + ' ' + digest) | Perform APOP login.
This should be used in special circumstances only, when it is
known that the server supports APOP authentication, and APOP
authentication is absolutely required. For the common case,
use L{login} instead.
@param username: The username with which to log in.
... | Perform APOP login. | [
"Perform",
"APOP",
"login",
"."
] | def apop(self, username, digest):
"""Perform APOP login.
This should be used in special circumstances only, when it is
known that the server supports APOP authentication, and APOP
authentication is absolutely required. For the common case,
use L{login} instead.
@param ... | [
"def",
"apop",
"(",
"self",
",",
"username",
",",
"digest",
")",
":",
"return",
"self",
".",
"sendShort",
"(",
"'APOP'",
",",
"username",
"+",
"' '",
"+",
"digest",
")"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/mail/pop3client.py#L493-L504 | |
home-assistant/supervisor | 69c2517d5211b483fdfe968b0a2b36b672ee7ab2 | supervisor/addons/addon.py | python | Addon.ports | (self) | return self.persist.get(ATTR_NETWORK, super().ports) | Return ports of add-on. | Return ports of add-on. | [
"Return",
"ports",
"of",
"add",
"-",
"on",
"."
] | def ports(self) -> Optional[dict[str, Optional[int]]]:
"""Return ports of add-on."""
return self.persist.get(ATTR_NETWORK, super().ports) | [
"def",
"ports",
"(",
"self",
")",
"->",
"Optional",
"[",
"dict",
"[",
"str",
",",
"Optional",
"[",
"int",
"]",
"]",
"]",
":",
"return",
"self",
".",
"persist",
".",
"get",
"(",
"ATTR_NETWORK",
",",
"super",
"(",
")",
".",
"ports",
")"
] | https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/addons/addon.py#L286-L288 | |
brightmart/multi-label_classification | b5febe17eaf9d937d71cabab56c5da48ee68f7b5 | bert/optimization_finetuning.py | python | create_optimizer | (loss, init_lr, num_train_steps, num_warmup_steps, use_tpu) | return train_op | Creates an optimizer training op. | Creates an optimizer training op. | [
"Creates",
"an",
"optimizer",
"training",
"op",
"."
] | def create_optimizer(loss, init_lr, num_train_steps, num_warmup_steps, use_tpu):
"""Creates an optimizer training op."""
global_step = tf.train.get_or_create_global_step()
learning_rate = tf.constant(value=init_lr, shape=[], dtype=tf.float32)
# Implements linear decay of the learning rate.
learning_rate = t... | [
"def",
"create_optimizer",
"(",
"loss",
",",
"init_lr",
",",
"num_train_steps",
",",
"num_warmup_steps",
",",
"use_tpu",
")",
":",
"global_step",
"=",
"tf",
".",
"train",
".",
"get_or_create_global_step",
"(",
")",
"learning_rate",
"=",
"tf",
".",
"constant",
... | https://github.com/brightmart/multi-label_classification/blob/b5febe17eaf9d937d71cabab56c5da48ee68f7b5/bert/optimization_finetuning.py#L25-L84 | |
Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks | 40c985b9a9ff1189ddf278462440b120cf96b196 | libs/scapy/utils6.py | python | in6_isdocaddr | (str) | return in6_isincluded(str, '2001:db8::', 32) | Returns True if provided address in printable format belongs to
2001:db8::/32 address space reserved for documentation (as defined
in RFC 3849). | Returns True if provided address in printable format belongs to
2001:db8::/32 address space reserved for documentation (as defined
in RFC 3849). | [
"Returns",
"True",
"if",
"provided",
"address",
"in",
"printable",
"format",
"belongs",
"to",
"2001",
":",
"db8",
"::",
"/",
"32",
"address",
"space",
"reserved",
"for",
"documentation",
"(",
"as",
"defined",
"in",
"RFC",
"3849",
")",
"."
] | def in6_isdocaddr(str):
"""
Returns True if provided address in printable format belongs to
2001:db8::/32 address space reserved for documentation (as defined
in RFC 3849).
"""
return in6_isincluded(str, '2001:db8::', 32) | [
"def",
"in6_isdocaddr",
"(",
"str",
")",
":",
"return",
"in6_isincluded",
"(",
"str",
",",
"'2001:db8::'",
",",
"32",
")"
] | https://github.com/Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks/blob/40c985b9a9ff1189ddf278462440b120cf96b196/libs/scapy/utils6.py#L674-L680 | |
xzkostyan/clickhouse-sqlalchemy | 16b647255be92f0cfbd22a72e6d849e0aee26fb7 | clickhouse_sqlalchemy/drivers/http/connector.py | python | Cursor.cancel | (self) | Cancels query. Not in PEP 249 standard. | Cancels query. Not in PEP 249 standard. | [
"Cancels",
"query",
".",
"Not",
"in",
"PEP",
"249",
"standard",
"."
] | def cancel(self):
"""
Cancels query. Not in PEP 249 standard.
"""
if self._state == self._states.NONE or self._query_id is None:
raise RuntimeError("No query yet")
# Try to cancel query by sending query with the same query_id.
transport = self._connection.tra... | [
"def",
"cancel",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"==",
"self",
".",
"_states",
".",
"NONE",
"or",
"self",
".",
"_query_id",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"No query yet\"",
")",
"# Try to cancel query by sending query wi... | https://github.com/xzkostyan/clickhouse-sqlalchemy/blob/16b647255be92f0cfbd22a72e6d849e0aee26fb7/clickhouse_sqlalchemy/drivers/http/connector.py#L198-L212 | ||
nipy/nipy | d16d268938dcd5c15748ca051532c21f57cf8a22 | nipy/labs/spatial_models/hroi.py | python | HROI_from_watershed | (domain, data, threshold=NINF) | return nroi | Instantiate an HierarchicalROI as the watershed of a certain dataset
Parameters
----------
domain: discrete_domain.StructuredDomain instance
Definition of the spatial context.
data: array of shape (domain.size)
The corresponding data field.
threshold: float, optional
Thresholding ... | Instantiate an HierarchicalROI as the watershed of a certain dataset | [
"Instantiate",
"an",
"HierarchicalROI",
"as",
"the",
"watershed",
"of",
"a",
"certain",
"dataset"
] | def HROI_from_watershed(domain, data, threshold=NINF):
"""Instantiate an HierarchicalROI as the watershed of a certain dataset
Parameters
----------
domain: discrete_domain.StructuredDomain instance
Definition of the spatial context.
data: array of shape (domain.size)
The corresponding ... | [
"def",
"HROI_from_watershed",
"(",
"domain",
",",
"data",
",",
"threshold",
"=",
"NINF",
")",
":",
"if",
"threshold",
">",
"data",
".",
"max",
"(",
")",
":",
"# return an empty HROI structure",
"label",
"=",
"-",
"np",
".",
"ones",
"(",
"data",
".",
"sha... | https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/labs/spatial_models/hroi.py#L117-L146 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py | python | Join.alias | (self, sqlutil, name=None, flat=False) | r"""return an alias of this :class:`.Join`.
The default behavior here is to first produce a SELECT
construct from this :class:`.Join`, then to produce an
:class:`.Alias` from that. So given a join of the form::
j = table_a.join(table_b, table_a.c.id == table_b.c.a_id)
The... | r"""return an alias of this :class:`.Join`. | [
"r",
"return",
"an",
"alias",
"of",
"this",
":",
"class",
":",
".",
"Join",
"."
] | def alias(self, sqlutil, name=None, flat=False):
r"""return an alias of this :class:`.Join`.
The default behavior here is to first produce a SELECT
construct from this :class:`.Join`, then to produce an
:class:`.Alias` from that. So given a join of the form::
j = table_a.j... | [
"def",
"alias",
"(",
"self",
",",
"sqlutil",
",",
"name",
"=",
"None",
",",
"flat",
"=",
"False",
")",
":",
"if",
"flat",
":",
"assert",
"name",
"is",
"None",
",",
"\"Can't send name argument with flat\"",
"left_a",
",",
"right_a",
"=",
"self",
".",
"lef... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py#L1087-L1195 | ||
bslatkin/effectivepython | 4ae6f3141291ea137eb29a245bf889dbc8091713 | example_code/item_42.py | python | MyBaseClass.get_value | (self) | return self.__value | [] | def get_value(self):
return self.__value | [
"def",
"get_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"__value"
] | https://github.com/bslatkin/effectivepython/blob/4ae6f3141291ea137eb29a245bf889dbc8091713/example_code/item_42.py#L142-L143 | |||
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/aui/framemanager.py | python | AuiManager.DoDrop | (self, docks, panes, target, pt, offset=wx.Point(0, 0)) | This is an important function. It basically takes a mouse position,
and determines where the panes new position would be. If the pane is to be
dropped, it performs the drop operation using the specified dock and pane
arrays. By specifying copy dock and pane arrays when calling, a "what-if"
... | This is an important function. It basically takes a mouse position,
and determines where the panes new position would be. If the pane is to be
dropped, it performs the drop operation using the specified dock and pane
arrays. By specifying copy dock and pane arrays when calling, a "what-if"
... | [
"This",
"is",
"an",
"important",
"function",
".",
"It",
"basically",
"takes",
"a",
"mouse",
"position",
"and",
"determines",
"where",
"the",
"panes",
"new",
"position",
"would",
"be",
".",
"If",
"the",
"pane",
"is",
"to",
"be",
"dropped",
"it",
"performs",... | def DoDrop(self, docks, panes, target, pt, offset=wx.Point(0, 0)):
"""
This is an important function. It basically takes a mouse position,
and determines where the panes new position would be. If the pane is to be
dropped, it performs the drop operation using the specified dock and pane
... | [
"def",
"DoDrop",
"(",
"self",
",",
"docks",
",",
"panes",
",",
"target",
",",
"pt",
",",
"offset",
"=",
"wx",
".",
"Point",
"(",
"0",
",",
"0",
")",
")",
":",
"if",
"target",
".",
"IsToolbar",
"(",
")",
":",
"return",
"self",
".",
"DoDropToolbar"... | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/aui/framemanager.py#L7580-L7599 | ||
deepfakes/faceswap | 09c7d8aca3c608d1afad941ea78e9fd9b64d9219 | tools/manual/frameviewer/editor/extract_box.py | python | ExtractBox._update_anchor_annotation | (self, face_index, extract_box, color) | Update the anchor annotations for each corner of the extract box.
The anchors only display when the extract box editor is active.
Parameters
----------
face_index: int
The index of the face being annotated
extract_box: :class:`numpy.ndarray`
The scaled e... | Update the anchor annotations for each corner of the extract box. | [
"Update",
"the",
"anchor",
"annotations",
"for",
"each",
"corner",
"of",
"the",
"extract",
"box",
"."
] | def _update_anchor_annotation(self, face_index, extract_box, color):
""" Update the anchor annotations for each corner of the extract box.
The anchors only display when the extract box editor is active.
Parameters
----------
face_index: int
The index of the face bei... | [
"def",
"_update_anchor_annotation",
"(",
"self",
",",
"face_index",
",",
"extract_box",
",",
"color",
")",
":",
"if",
"not",
"self",
".",
"_is_active",
"or",
"self",
".",
"_globals",
".",
"is_zoomed",
":",
"self",
".",
"hide_annotation",
"(",
"\"eb_anc_dsp\"",... | https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/tools/manual/frameviewer/editor/extract_box.py#L71-L102 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/tencentcloud/cbs/v20170312/models.py | python | Filter.__init__ | (self) | :param Name: 过滤键的名称。
:type Name: str
:param Values: 一个或者多个过滤值。
:type Values: list of str | :param Name: 过滤键的名称。
:type Name: str
:param Values: 一个或者多个过滤值。
:type Values: list of str | [
":",
"param",
"Name",
":",
"过滤键的名称。",
":",
"type",
"Name",
":",
"str",
":",
"param",
"Values",
":",
"一个或者多个过滤值。",
":",
"type",
"Values",
":",
"list",
"of",
"str"
] | def __init__(self):
"""
:param Name: 过滤键的名称。
:type Name: str
:param Values: 一个或者多个过滤值。
:type Values: list of str
"""
self.Name = None
self.Values = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Name",
"=",
"None",
"self",
".",
"Values",
"=",
"None"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tencentcloud/cbs/v20170312/models.py#L752-L760 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/chapters/management/commands/clean_chapter_memberships.py | python | Command.handle | (self, *args, **kwargs) | [] | def handle(self, *args, **kwargs):
from datetime import datetime
from dateutil.relativedelta import relativedelta
from tendenci.apps.chapters.models import ChapterMembership, ChapterMembershipType
from tendenci.apps.user_groups.models import GroupMembership
for membership_type i... | [
"def",
"handle",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"datetime",
"import",
"datetime",
"from",
"dateutil",
".",
"relativedelta",
"import",
"relativedelta",
"from",
"tendenci",
".",
"apps",
".",
"chapters",
".",
"models... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/chapters/management/commands/clean_chapter_memberships.py#L10-L33 | ||||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/ImpalaService/ImpalaService.py | python | CloseInsert_args.__init__ | (self, handle=None,) | [] | def __init__(self, handle=None,):
self.handle = handle | [
"def",
"__init__",
"(",
"self",
",",
"handle",
"=",
"None",
",",
")",
":",
"self",
".",
"handle",
"=",
"handle"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/ImpalaService/ImpalaService.py#L1001-L1002 | ||||
youyuge34/PI-REC | 9f8f1adff169fda301f3134ac730991484a6b128 | scripts/BicycleGAN/combine_folders.py | python | resize | (img, height, width, centerCrop=True, interp='bilinear') | return img | [] | def resize(img, height, width, centerCrop=True, interp='bilinear'):
imgh, imgw = img.shape[0:2]
if centerCrop and imgh != imgw:
# center crop
side = np.minimum(imgh, imgw)
j = (imgh - side) // 2
i = (imgw - side) // 2
img = img[j:j + side, i:i + side, ...]
i... | [
"def",
"resize",
"(",
"img",
",",
"height",
",",
"width",
",",
"centerCrop",
"=",
"True",
",",
"interp",
"=",
"'bilinear'",
")",
":",
"imgh",
",",
"imgw",
"=",
"img",
".",
"shape",
"[",
"0",
":",
"2",
"]",
"if",
"centerCrop",
"and",
"imgh",
"!=",
... | https://github.com/youyuge34/PI-REC/blob/9f8f1adff169fda301f3134ac730991484a6b128/scripts/BicycleGAN/combine_folders.py#L8-L20 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py | python | ElasticsearchMapping.__repr__ | (self) | return '<ElasticsearchMapping: %s>' % (self.model.__name__, ) | [] | def __repr__(self):
return '<ElasticsearchMapping: %s>' % (self.model.__name__, ) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<ElasticsearchMapping: %s>'",
"%",
"(",
"self",
".",
"model",
".",
"__name__",
",",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py#L197-L198 | |||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/distlib/database.py | python | Distribution.__eq__ | (self, other) | return result | See if this distribution is the same as another.
:param other: The distribution to compare with. To be equal to one
another. distributions must have the same type, name,
version and source_url.
:return: True if it is the same, else False. | See if this distribution is the same as another.
:param other: The distribution to compare with. To be equal to one
another. distributions must have the same type, name,
version and source_url.
:return: True if it is the same, else False. | [
"See",
"if",
"this",
"distribution",
"is",
"the",
"same",
"as",
"another",
".",
":",
"param",
"other",
":",
"The",
"distribution",
"to",
"compare",
"with",
".",
"To",
"be",
"equal",
"to",
"one",
"another",
".",
"distributions",
"must",
"have",
"the",
"sa... | def __eq__(self, other):
"""
See if this distribution is the same as another.
:param other: The distribution to compare with. To be equal to one
another. distributions must have the same type, name,
version and source_url.
:return: True if it i... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"type",
"(",
"other",
")",
"is",
"not",
"type",
"(",
"self",
")",
":",
"result",
"=",
"False",
"else",
":",
"result",
"=",
"(",
"self",
".",
"name",
"==",
"other",
".",
"name",
"and",
... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/distlib/database.py#L451-L465 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Tools/scripts/find_recursionlimit.py | python | test_cpickle | (_cache={}) | [] | def test_cpickle(_cache={}):
try:
import cPickle
except ImportError:
print "cannot import cPickle, skipped!"
return
l = None
for n in itertools.count():
try:
l = _cache[n]
continue # Already tried and it works, let's save some time
except ... | [
"def",
"test_cpickle",
"(",
"_cache",
"=",
"{",
"}",
")",
":",
"try",
":",
"import",
"cPickle",
"except",
"ImportError",
":",
"print",
"\"cannot import cPickle, skipped!\"",
"return",
"l",
"=",
"None",
"for",
"n",
"in",
"itertools",
".",
"count",
"(",
")",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Tools/scripts/find_recursionlimit.py#L73-L88 | ||||
pympler/pympler | 8019a883eec547d91ecda6ba12669d4f4504c625 | pympler/asizeof.py | python | Asizer.reset | (self, above=1024, align=8, clip=80, code=False, # PYCHOK too many args
cutoff=10, derive=False, detail=0, frames=False, ignored=True,
infer=False, limit=100, stats=0, stream=None, **extra) | Reset sizing options, state, etc. to defaults.
The available options and default values are:
*above=0* -- threshold for largest objects stats
*align=8* -- size alignment
*code=False* -- incl. (byte)code size
*cutoff=10* -- li... | Reset sizing options, state, etc. to defaults. | [
"Reset",
"sizing",
"options",
"state",
"etc",
".",
"to",
"defaults",
"."
] | def reset(self, above=1024, align=8, clip=80, code=False, # PYCHOK too many args
cutoff=10, derive=False, detail=0, frames=False, ignored=True,
infer=False, limit=100, stats=0, stream=None, **extra):
'''Reset sizing options, state, etc. to defaults.
The avail... | [
"def",
"reset",
"(",
"self",
",",
"above",
"=",
"1024",
",",
"align",
"=",
"8",
",",
"clip",
"=",
"80",
",",
"code",
"=",
"False",
",",
"# PYCHOK too many args",
"cutoff",
"=",
"10",
",",
"derive",
"=",
"False",
",",
"detail",
"=",
"0",
",",
"frame... | https://github.com/pympler/pympler/blob/8019a883eec547d91ecda6ba12669d4f4504c625/pympler/asizeof.py#L2321-L2376 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/tseries/index.py | python | DatetimeIndex.to_perioddelta | (self, freq) | return to_timedelta(self.asi8 - self.to_period(freq).to_timestamp().asi8) | Calcuates TimedeltaIndex of difference between index
values and index converted to PeriodIndex at specified
freq. Used for vectorized offsets
.. versionadded:: 0.17.0
Parameters
----------
freq : Period frequency
Returns
-------
y : TimedeltaIn... | Calcuates TimedeltaIndex of difference between index
values and index converted to PeriodIndex at specified
freq. Used for vectorized offsets | [
"Calcuates",
"TimedeltaIndex",
"of",
"difference",
"between",
"index",
"values",
"and",
"index",
"converted",
"to",
"PeriodIndex",
"at",
"specified",
"freq",
".",
"Used",
"for",
"vectorized",
"offsets"
] | def to_perioddelta(self, freq):
"""
Calcuates TimedeltaIndex of difference between index
values and index converted to PeriodIndex at specified
freq. Used for vectorized offsets
.. versionadded:: 0.17.0
Parameters
----------
freq : Period frequency
... | [
"def",
"to_perioddelta",
"(",
"self",
",",
"freq",
")",
":",
"return",
"to_timedelta",
"(",
"self",
".",
"asi8",
"-",
"self",
".",
"to_period",
"(",
"freq",
")",
".",
"to_timestamp",
"(",
")",
".",
"asi8",
")"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/tseries/index.py#L903-L919 | |
nucleic/enaml | 65c2a2a2d765e88f2e1103046680571894bb41ed | enaml/widgets/toolkit_dialog.py | python | ToolkitDialog.exec_ | (self) | return self.result | Open the dialog as an application modal dialog.
Returns
-------
result : bool
Whether or not the dialog was accepted. | Open the dialog as an application modal dialog. | [
"Open",
"the",
"dialog",
"as",
"an",
"application",
"modal",
"dialog",
"."
] | def exec_(self):
""" Open the dialog as an application modal dialog.
Returns
-------
result : bool
Whether or not the dialog was accepted.
"""
if not self.is_initialized:
self.initialize()
if not self.proxy_is_active:
self.act... | [
"def",
"exec_",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_initialized",
":",
"self",
".",
"initialize",
"(",
")",
"if",
"not",
"self",
".",
"proxy_is_active",
":",
"self",
".",
"activate_proxy",
"(",
")",
"self",
".",
"_prepare",
"(",
")",
... | https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/widgets/toolkit_dialog.py#L105-L120 | |
Zephery/weiboanalysis | bee35996ffdf9f6c4bb9af349f6d4dce6666b6ab | train/training.py | python | trainingAdaboostGetDS | (iterateNum=50) | return ds_errorRate | 训练阶段,可将选择的vocabularyList也放到整个循环中,以选出
错误率最低的情况,获取最低错误率的vocabularyList | 训练阶段,可将选择的vocabularyList也放到整个循环中,以选出
错误率最低的情况,获取最低错误率的vocabularyList | [
"训练阶段,可将选择的vocabularyList也放到整个循环中,以选出",
"错误率最低的情况,获取最低错误率的vocabularyList"
] | def trainingAdaboostGetDS(iterateNum=50):
MoodWordsArray, classLables = get_feature("train.txt")
testWords = []
testWordsType = []
testCount = 100 # 从中随机选取100条用来测试,并删除原来的位置
for i in range(testCount):
try:
randomIndex = int(random.uniform(0, len(MoodWordsArray)))
test... | [
"def",
"trainingAdaboostGetDS",
"(",
"iterateNum",
"=",
"50",
")",
":",
"MoodWordsArray",
",",
"classLables",
"=",
"get_feature",
"(",
"\"train.txt\"",
")",
"testWords",
"=",
"[",
"]",
"testWordsType",
"=",
"[",
"]",
"testCount",
"=",
"100",
"# 从中随机选取100条用来测试,并删... | https://github.com/Zephery/weiboanalysis/blob/bee35996ffdf9f6c4bb9af349f6d4dce6666b6ab/train/training.py#L7-L69 | |
inventree/InvenTree | 4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b | InvenTree/InvenTree/views.py | python | AppearanceSelectView.get_user_theme | (self) | return user_theme | Get current user color theme | Get current user color theme | [
"Get",
"current",
"user",
"color",
"theme"
] | def get_user_theme(self):
""" Get current user color theme """
try:
user_theme = ColorTheme.objects.filter(user=self.request.user).get()
except ColorTheme.DoesNotExist:
user_theme = None
return user_theme | [
"def",
"get_user_theme",
"(",
"self",
")",
":",
"try",
":",
"user_theme",
"=",
"ColorTheme",
".",
"objects",
".",
"filter",
"(",
"user",
"=",
"self",
".",
"request",
".",
"user",
")",
".",
"get",
"(",
")",
"except",
"ColorTheme",
".",
"DoesNotExist",
"... | https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/InvenTree/views.py#L815-L822 | |
bokeh/bokeh | a00e59da76beb7b9f83613533cfd3aced1df5f06 | bokeh/application/handlers/handler.py | python | Handler.failed | (self) | return self._failed | ``True`` if the handler failed to modify the doc | ``True`` if the handler failed to modify the doc | [
"True",
"if",
"the",
"handler",
"failed",
"to",
"modify",
"the",
"doc"
] | def failed(self) -> bool:
''' ``True`` if the handler failed to modify the doc
'''
return self._failed | [
"def",
"failed",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_failed"
] | https://github.com/bokeh/bokeh/blob/a00e59da76beb7b9f83613533cfd3aced1df5f06/bokeh/application/handlers/handler.py#L112-L116 | |
rackerlabs/mimic | efd34108b6aa3eb7ecd26e22f1aa155c14a7885e | mimic/rest/queue_api.py | python | QueueApiRoutes._queue_collection | (self, tenant_id) | return (self._session_store.session_for_tenant_id(tenant_id)
.data_for_api(self._api_mock,
lambda: collections.defaultdict(
lambda: QueueCollection(clock=self._session_store.clock)))
[self._queue_name]) | Get the given queue-cache object for the given tenant, creating one if
there isn't one. | Get the given queue-cache object for the given tenant, creating one if
there isn't one. | [
"Get",
"the",
"given",
"queue",
"-",
"cache",
"object",
"for",
"the",
"given",
"tenant",
"creating",
"one",
"if",
"there",
"isn",
"t",
"one",
"."
] | def _queue_collection(self, tenant_id):
"""
Get the given queue-cache object for the given tenant, creating one if
there isn't one.
"""
return (self._session_store.session_for_tenant_id(tenant_id)
.data_for_api(self._api_mock,
lambda:... | [
"def",
"_queue_collection",
"(",
"self",
",",
"tenant_id",
")",
":",
"return",
"(",
"self",
".",
"_session_store",
".",
"session_for_tenant_id",
"(",
"tenant_id",
")",
".",
"data_for_api",
"(",
"self",
".",
"_api_mock",
",",
"lambda",
":",
"collections",
".",
... | https://github.com/rackerlabs/mimic/blob/efd34108b6aa3eb7ecd26e22f1aa155c14a7885e/mimic/rest/queue_api.py#L84-L93 | |
msracver/Deformable-ConvNets | 6aeda878a95bcb55eadffbe125804e730574de8d | fpn/core/module.py | python | Module.install_monitor | (self, mon) | Install monitor on all executors | Install monitor on all executors | [
"Install",
"monitor",
"on",
"all",
"executors"
] | def install_monitor(self, mon):
""" Install monitor on all executors """
assert self.binded
self._exec_group.install_monitor(mon) | [
"def",
"install_monitor",
"(",
"self",
",",
"mon",
")",
":",
"assert",
"self",
".",
"binded",
"self",
".",
"_exec_group",
".",
"install_monitor",
"(",
"mon",
")"
] | https://github.com/msracver/Deformable-ConvNets/blob/6aeda878a95bcb55eadffbe125804e730574de8d/fpn/core/module.py#L714-L717 | ||
Teichlab/cellphonedb | dca1c26555b012df30af0f2521cd4df317cf4600 | cellphonedb/src/api_endpoints/terminal_api/query_terminal_api_endpoints/query_terminal_commands.py | python | autocomplete | (partial_element: str, verbose: bool, database: str) | [] | def autocomplete(partial_element: str, verbose: bool, database: str) -> None:
LocalQueryLauncher(cpdb_app.create_app(verbose, database)).autocomplete_element(partial_element) | [
"def",
"autocomplete",
"(",
"partial_element",
":",
"str",
",",
"verbose",
":",
"bool",
",",
"database",
":",
"str",
")",
"->",
"None",
":",
"LocalQueryLauncher",
"(",
"cpdb_app",
".",
"create_app",
"(",
"verbose",
",",
"database",
")",
")",
".",
"autocomp... | https://github.com/Teichlab/cellphonedb/blob/dca1c26555b012df30af0f2521cd4df317cf4600/cellphonedb/src/api_endpoints/terminal_api/query_terminal_api_endpoints/query_terminal_commands.py#L39-L40 | ||||
francisck/DanderSpritz_docs | 86bb7caca5a957147f120b18bb5c31f299914904 | Python/Core/Lib/weakref.py | python | WeakKeyDictionary.keyrefs | (self) | return self.data.keys() | Return a list of weak references to the keys.
The references are not guaranteed to be 'live' at the time
they are used, so the result of calling the references needs
to be checked before being used. This can be used to avoid
creating references that will cause the garbage colle... | Return a list of weak references to the keys.
The references are not guaranteed to be 'live' at the time
they are used, so the result of calling the references needs
to be checked before being used. This can be used to avoid
creating references that will cause the garbage colle... | [
"Return",
"a",
"list",
"of",
"weak",
"references",
"to",
"the",
"keys",
".",
"The",
"references",
"are",
"not",
"guaranteed",
"to",
"be",
"live",
"at",
"the",
"time",
"they",
"are",
"used",
"so",
"the",
"result",
"of",
"calling",
"the",
"references",
"ne... | def keyrefs(self):
"""Return a list of weak references to the keys.
The references are not guaranteed to be 'live' at the time
they are used, so the result of calling the references needs
to be checked before being used. This can be used to avoid
creating references tha... | [
"def",
"keyrefs",
"(",
"self",
")",
":",
"return",
"self",
".",
"data",
".",
"keys",
"(",
")"
] | https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/weakref.py#L356-L366 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/printing/pycode.py | python | NumPyPrinter._print_Piecewise | (self, expr) | return '{0}({1}, {2}, default={3})'.format(
self._module_format('numpy.select'), conds, exprs,
self._print(S.NaN)) | Piecewise function printer | Piecewise function printer | [
"Piecewise",
"function",
"printer"
] | def _print_Piecewise(self, expr):
"Piecewise function printer"
exprs = '[{0}]'.format(','.join(self._print(arg.expr) for arg in expr.args))
conds = '[{0}]'.format(','.join(self._print(arg.cond) for arg in expr.args))
# If [default_value, True] is a (expr, cond) sequence in a Piecewise ob... | [
"def",
"_print_Piecewise",
"(",
"self",
",",
"expr",
")",
":",
"exprs",
"=",
"'[{0}]'",
".",
"format",
"(",
"','",
".",
"join",
"(",
"self",
".",
"_print",
"(",
"arg",
".",
"expr",
")",
"for",
"arg",
"in",
"expr",
".",
"args",
")",
")",
"conds",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/printing/pycode.py#L661-L671 | |
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/transpiler/passes/layout/set_layout.py | python | SetLayout.__init__ | (self, layout) | SetLayout initializer.
Args:
layout (Layout): the layout to set. | SetLayout initializer. | [
"SetLayout",
"initializer",
"."
] | def __init__(self, layout):
"""SetLayout initializer.
Args:
layout (Layout): the layout to set.
"""
super().__init__()
self.layout = layout | [
"def",
"__init__",
"(",
"self",
",",
"layout",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"layout",
"=",
"layout"
] | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/transpiler/passes/layout/set_layout.py#L26-L33 | ||
Theano/Theano | 8fd9203edfeecebced9344b0c70193be292a9ade | theano/compile/builders.py | python | inline_ofg_expansion | (node) | return theano.clone(
op.local_outputs, {
u: v for u, v in izip(
node.op.local_inputs, node.inputs)}) | This optimization expands internal graph of OpFromGraph.
Only performed if node.op.is_inline == True
Doing so can improve optimization at the cost of compilation speed. | This optimization expands internal graph of OpFromGraph.
Only performed if node.op.is_inline == True
Doing so can improve optimization at the cost of compilation speed. | [
"This",
"optimization",
"expands",
"internal",
"graph",
"of",
"OpFromGraph",
".",
"Only",
"performed",
"if",
"node",
".",
"op",
".",
"is_inline",
"==",
"True",
"Doing",
"so",
"can",
"improve",
"optimization",
"at",
"the",
"cost",
"of",
"compilation",
"speed",
... | def inline_ofg_expansion(node):
"""
This optimization expands internal graph of OpFromGraph.
Only performed if node.op.is_inline == True
Doing so can improve optimization at the cost of compilation speed.
"""
op = node.op
if not isinstance(op, OpFromGraph):
return False
if not op... | [
"def",
"inline_ofg_expansion",
"(",
"node",
")",
":",
"op",
"=",
"node",
".",
"op",
"if",
"not",
"isinstance",
"(",
"op",
",",
"OpFromGraph",
")",
":",
"return",
"False",
"if",
"not",
"op",
".",
"is_inline",
":",
"return",
"False",
"return",
"theano",
... | https://github.com/Theano/Theano/blob/8fd9203edfeecebced9344b0c70193be292a9ade/theano/compile/builders.py#L718-L732 | |
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | library/routes/mapper.py | python | Mapper._create_regs | (self, clist=None) | Creates regular expressions for all connected routes | Creates regular expressions for all connected routes | [
"Creates",
"regular",
"expressions",
"for",
"all",
"connected",
"routes"
] | def _create_regs(self, clist=None):
"""Creates regular expressions for all connected routes"""
if clist is None:
if self.directory:
clist = self.controller_scan(self.directory)
elif callable(self.controller_scan):
clist = self.controller_scan()
... | [
"def",
"_create_regs",
"(",
"self",
",",
"clist",
"=",
"None",
")",
":",
"if",
"clist",
"is",
"None",
":",
"if",
"self",
".",
"directory",
":",
"clist",
"=",
"self",
".",
"controller_scan",
"(",
"self",
".",
"directory",
")",
"elif",
"callable",
"(",
... | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/routes/mapper.py#L564-L596 | ||
NVIDIA-AI-IOT/trt_pose | 336b8cdd9c2d81ff527d9ff7e8f1749e39e6f6e4 | trt_pose/models/densenet.py | python | densenet161_baseline_att | (cmap_channels, paf_channels, upsample_channels=256, pretrained=True, num_upsample=3, num_flat=0) | return _densenet_pose_att(cmap_channels, paf_channels, upsample_channels, densenet, 2208, num_upsample, num_flat) | [] | def densenet161_baseline_att(cmap_channels, paf_channels, upsample_channels=256, pretrained=True, num_upsample=3, num_flat=0):
densenet = torchvision.models.densenet161(pretrained=pretrained)
return _densenet_pose_att(cmap_channels, paf_channels, upsample_channels, densenet, 2208, num_upsample, num_flat) | [
"def",
"densenet161_baseline_att",
"(",
"cmap_channels",
",",
"paf_channels",
",",
"upsample_channels",
"=",
"256",
",",
"pretrained",
"=",
"True",
",",
"num_upsample",
"=",
"3",
",",
"num_flat",
"=",
"0",
")",
":",
"densenet",
"=",
"torchvision",
".",
"models... | https://github.com/NVIDIA-AI-IOT/trt_pose/blob/336b8cdd9c2d81ff527d9ff7e8f1749e39e6f6e4/trt_pose/models/densenet.py#L69-L71 | |||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/distlib/version.py | python | _legacy_key | (s) | return tuple(result) | [] | def _legacy_key(s):
def get_parts(s):
result = []
for p in _VERSION_PART.split(s.lower()):
p = _VERSION_REPLACE.get(p, p)
if p:
if '0' <= p[:1] <= '9':
p = p.zfill(8)
else:
p = '*' + p
res... | [
"def",
"_legacy_key",
"(",
"s",
")",
":",
"def",
"get_parts",
"(",
"s",
")",
":",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"_VERSION_PART",
".",
"split",
"(",
"s",
".",
"lower",
"(",
")",
")",
":",
"p",
"=",
"_VERSION_REPLACE",
".",
"get",
"(",... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/distlib/version.py#L578-L601 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/_internal/django/template/defaultfilters.py | python | pprint | (value) | A wrapper around pprint.pprint -- for debugging, really. | A wrapper around pprint.pprint -- for debugging, really. | [
"A",
"wrapper",
"around",
"pprint",
".",
"pprint",
"--",
"for",
"debugging",
"really",
"."
] | def pprint(value):
"""A wrapper around pprint.pprint -- for debugging, really."""
from pprint import pformat
try:
return pformat(value)
except Exception, e:
return u"Error in formatting: %s" % force_unicode(e, errors="replace") | [
"def",
"pprint",
"(",
"value",
")",
":",
"from",
"pprint",
"import",
"pformat",
"try",
":",
"return",
"pformat",
"(",
"value",
")",
"except",
"Exception",
",",
"e",
":",
"return",
"u\"Error in formatting: %s\"",
"%",
"force_unicode",
"(",
"e",
",",
"errors",... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/_internal/django/template/defaultfilters.py#L855-L861 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/sets.py | python | Set.__ixor__ | (self, other) | return self | Update a set with the symmetric difference of itself and another. | Update a set with the symmetric difference of itself and another. | [
"Update",
"a",
"set",
"with",
"the",
"symmetric",
"difference",
"of",
"itself",
"and",
"another",
"."
] | def __ixor__(self, other):
"""Update a set with the symmetric difference of itself and another."""
self._binary_sanity_check(other)
self.symmetric_difference_update(other)
return self | [
"def",
"__ixor__",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"_binary_sanity_check",
"(",
"other",
")",
"self",
".",
"symmetric_difference_update",
"(",
"other",
")",
"return",
"self"
] | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/sets.py#L451-L455 | |
yankurniawan/ansible-for-aws | 99b6d82fbbd4075a2d41459717cce8a0b93d1162 | wordpress/ec2.py | python | Ec2Inventory.get_inventory_from_cache | (self) | return json_inventory | Reads the inventory from the cache file and returns it as a JSON
object | Reads the inventory from the cache file and returns it as a JSON
object | [
"Reads",
"the",
"inventory",
"from",
"the",
"cache",
"file",
"and",
"returns",
"it",
"as",
"a",
"JSON",
"object"
] | def get_inventory_from_cache(self):
''' Reads the inventory from the cache file and returns it as a JSON
object '''
cache = open(self.cache_path_cache, 'r')
json_inventory = cache.read()
return json_inventory | [
"def",
"get_inventory_from_cache",
"(",
"self",
")",
":",
"cache",
"=",
"open",
"(",
"self",
".",
"cache_path_cache",
",",
"'r'",
")",
"json_inventory",
"=",
"cache",
".",
"read",
"(",
")",
"return",
"json_inventory"
] | https://github.com/yankurniawan/ansible-for-aws/blob/99b6d82fbbd4075a2d41459717cce8a0b93d1162/wordpress/ec2.py#L565-L571 | |
pyjs/pyjs | 6c4a3d3a67300cd5df7f95a67ca9dcdc06950523 | pyjs/lib/ipaddr.py | python | _BaseV6.is_multicast | (self) | return self in IPv6Network('ff00::/8') | Test if the address is reserved for multicast use.
Returns:
A boolean, True if the address is a multicast address.
See RFC 2373 2.7 for details. | Test if the address is reserved for multicast use. | [
"Test",
"if",
"the",
"address",
"is",
"reserved",
"for",
"multicast",
"use",
"."
] | def is_multicast(self):
"""Test if the address is reserved for multicast use.
Returns:
A boolean, True if the address is a multicast address.
See RFC 2373 2.7 for details.
"""
return self in IPv6Network('ff00::/8') | [
"def",
"is_multicast",
"(",
"self",
")",
":",
"return",
"self",
"in",
"IPv6Network",
"(",
"'ff00::/8'",
")"
] | https://github.com/pyjs/pyjs/blob/6c4a3d3a67300cd5df7f95a67ca9dcdc06950523/pyjs/lib/ipaddr.py#L1667-L1675 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/backends/backend_agg.py | python | RendererAgg.option_scale_image | (self) | return False | agg backend doesn't support arbitrary scaling of image. | agg backend doesn't support arbitrary scaling of image. | [
"agg",
"backend",
"doesn",
"t",
"support",
"arbitrary",
"scaling",
"of",
"image",
"."
] | def option_scale_image(self):
"""
agg backend doesn't support arbitrary scaling of image.
"""
return False | [
"def",
"option_scale_image",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/backends/backend_agg.py#L286-L290 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/io/formats/style.py | python | Styler.render | (
self,
sparse_index: bool | None = None,
sparse_columns: bool | None = None,
**kwargs,
) | return self._render_html(sparse_index, sparse_columns, **kwargs) | Render the ``Styler`` including all applied styles to HTML.
.. deprecated:: 1.4.0
Parameters
----------
sparse_index : bool, optional
Whether to sparsify the display of a hierarchical index. Setting to False
will display each explicit level element in a hierarch... | Render the ``Styler`` including all applied styles to HTML. | [
"Render",
"the",
"Styler",
"including",
"all",
"applied",
"styles",
"to",
"HTML",
"."
] | def render(
self,
sparse_index: bool | None = None,
sparse_columns: bool | None = None,
**kwargs,
) -> str:
"""
Render the ``Styler`` including all applied styles to HTML.
.. deprecated:: 1.4.0
Parameters
----------
sparse_index : boo... | [
"def",
"render",
"(",
"self",
",",
"sparse_index",
":",
"bool",
"|",
"None",
"=",
"None",
",",
"sparse_columns",
":",
"bool",
"|",
"None",
"=",
"None",
",",
"*",
"*",
"kwargs",
",",
")",
"->",
"str",
":",
"warnings",
".",
"warn",
"(",
"\"this method ... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/io/formats/style.py#L280-L344 | |
django-fluent/django-fluent-contents | 5577567303d29b56fd48128c22c7dc5d8b2c7476 | fluent_contents/utils/html.py | python | clean_html | (input, sanitize=False) | return "".join(s.serialize(stream)) | Takes an HTML fragment and processes it using html5lib to ensure that the HTML is well-formed.
:param sanitize: Remove unwanted HTML tags and attributes.
>>> clean_html("<p>Foo<b>bar</b></p>")
u'<p>Foo<b>bar</b></p>'
>>> clean_html("<p>Foo<b>bar</b><i>Ooops!</p>")
u'<p>Foo<b>bar</b><i>Ooops!</i></... | Takes an HTML fragment and processes it using html5lib to ensure that the HTML is well-formed. | [
"Takes",
"an",
"HTML",
"fragment",
"and",
"processes",
"it",
"using",
"html5lib",
"to",
"ensure",
"that",
"the",
"HTML",
"is",
"well",
"-",
"formed",
"."
] | def clean_html(input, sanitize=False):
"""
Takes an HTML fragment and processes it using html5lib to ensure that the HTML is well-formed.
:param sanitize: Remove unwanted HTML tags and attributes.
>>> clean_html("<p>Foo<b>bar</b></p>")
u'<p>Foo<b>bar</b></p>'
>>> clean_html("<p>Foo<b>bar</b><i... | [
"def",
"clean_html",
"(",
"input",
",",
"sanitize",
"=",
"False",
")",
":",
"parser_kwargs",
"=",
"{",
"}",
"serializer_kwargs",
"=",
"{",
"}",
"if",
"sanitize",
":",
"if",
"HTMLSanitizer",
"is",
"None",
":",
"# new syntax as of 0.99999999/1.0b9 (Released on July ... | https://github.com/django-fluent/django-fluent-contents/blob/5577567303d29b56fd48128c22c7dc5d8b2c7476/fluent_contents/utils/html.py#L20-L48 | |
log2timeline/dfvfs | 4ca7bf06b15cdc000297a7122a065f0ca71de544 | dfvfs/vfs/xfs_file_system.py | python | XFSFileSystem.GetFileEntryByPathSpec | (self, path_spec) | return xfs_file_entry.XFSFileEntry(
self._resolver_context, self, path_spec,
fsxfs_file_entry=fsxfs_file_entry) | Retrieves a file entry for a path specification.
Args:
path_spec (PathSpec): path specification.
Returns:
XFSFileEntry: file entry or None if not available.
Raises:
BackEndError: if the file entry cannot be opened. | Retrieves a file entry for a path specification. | [
"Retrieves",
"a",
"file",
"entry",
"for",
"a",
"path",
"specification",
"."
] | def GetFileEntryByPathSpec(self, path_spec):
"""Retrieves a file entry for a path specification.
Args:
path_spec (PathSpec): path specification.
Returns:
XFSFileEntry: file entry or None if not available.
Raises:
BackEndError: if the file entry cannot be opened.
"""
# Openin... | [
"def",
"GetFileEntryByPathSpec",
"(",
"self",
",",
"path_spec",
")",
":",
"# Opening a file by inode is faster than opening a file by location.",
"fsxfs_file_entry",
"=",
"None",
"location",
"=",
"getattr",
"(",
"path_spec",
",",
"'location'",
",",
"None",
")",
"inode",
... | https://github.com/log2timeline/dfvfs/blob/4ca7bf06b15cdc000297a7122a065f0ca71de544/dfvfs/vfs/xfs_file_system.py#L96-L135 | |
machow/siuba | f5b36f840401225416f937900cb945923ced1629 | siuba/sql/verbs.py | python | _mutate_select | (sel, colname, func, labs, __data) | return _sql_add_columns(sel, [new_col.label(colname)]) | Return select statement containing a new column, func expr as colname.
Note: since a func can refer to previous columns generated by mutate, this
function handles whether to add a column to the existing select statement,
or to use it as a subquery. | Return select statement containing a new column, func expr as colname.
Note: since a func can refer to previous columns generated by mutate, this
function handles whether to add a column to the existing select statement,
or to use it as a subquery. | [
"Return",
"select",
"statement",
"containing",
"a",
"new",
"column",
"func",
"expr",
"as",
"colname",
".",
"Note",
":",
"since",
"a",
"func",
"can",
"refer",
"to",
"previous",
"columns",
"generated",
"by",
"mutate",
"this",
"function",
"handles",
"whether",
... | def _mutate_select(sel, colname, func, labs, __data):
"""Return select statement containing a new column, func expr as colname.
Note: since a func can refer to previous columns generated by mutate, this
function handles whether to add a column to the existing select statement,
or to use it as a sub... | [
"def",
"_mutate_select",
"(",
"sel",
",",
"colname",
",",
"func",
",",
"labs",
",",
"__data",
")",
":",
"replace_col",
"=",
"colname",
"in",
"lift_inner_cols",
"(",
"sel",
")",
"# Call objects let us check whether column expr used a derived column",
"# e.g. SELECT a as ... | https://github.com/machow/siuba/blob/f5b36f840401225416f937900cb945923ced1629/siuba/sql/verbs.py#L561-L590 | |
MultiAgentLearning/playground | 8c06a21da5758b570b708e9dd3337e1fa1e67e71 | pommerman/envs/v2.py | python | Pomme.__init__ | (self, *args, **kwargs) | [] | def __init__(self, *args, **kwargs):
self._radio_vocab_size = kwargs.get('radio_vocab_size')
self._radio_num_words = kwargs.get('radio_num_words')
if (self._radio_vocab_size and
not self._radio_num_words) or (not self._radio_vocab_size and
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_radio_vocab_size",
"=",
"kwargs",
".",
"get",
"(",
"'radio_vocab_size'",
")",
"self",
".",
"_radio_num_words",
"=",
"kwargs",
".",
"get",
"(",
"'radio_num... | https://github.com/MultiAgentLearning/playground/blob/8c06a21da5758b570b708e9dd3337e1fa1e67e71/pommerman/envs/v2.py#L24-L39 | ||||
DataIntegrationAlliance/data_integration_celery | 6775292030213dd1fa33a1ec0f542d5d2d2e612a | tasks/ifind/future/future_info_daily.py | python | import_future_daily_his | (chain_param=None, ths_code_set: set = None, begin_time=None) | 更新期货合约日级别行情信息
:param chain_param: 该参数仅用于 task.chain 串行操作时,上下传递参数使用
:param ths_code_set:
:param begin_time:
:return: | 更新期货合约日级别行情信息
:param chain_param: 该参数仅用于 task.chain 串行操作时,上下传递参数使用
:param ths_code_set:
:param begin_time:
:return: | [
"更新期货合约日级别行情信息",
":",
"param",
"chain_param",
":",
"该参数仅用于",
"task",
".",
"chain",
"串行操作时,上下传递参数使用",
":",
"param",
"ths_code_set",
":",
":",
"param",
"begin_time",
":",
":",
"return",
":"
] | def import_future_daily_his(chain_param=None, ths_code_set: set = None, begin_time=None):
"""
更新期货合约日级别行情信息
:param chain_param: 该参数仅用于 task.chain 串行操作时,上下传递参数使用
:param ths_code_set:
:param begin_time:
:return:
"""
table_name = 'ifind_future_daily'
info_table_name = 'ifind_future_info... | [
"def",
"import_future_daily_his",
"(",
"chain_param",
"=",
"None",
",",
"ths_code_set",
":",
"set",
"=",
"None",
",",
"begin_time",
"=",
"None",
")",
":",
"table_name",
"=",
"'ifind_future_daily'",
"info_table_name",
"=",
"'ifind_future_info'",
"logger",
".",
"inf... | https://github.com/DataIntegrationAlliance/data_integration_celery/blob/6775292030213dd1fa33a1ec0f542d5d2d2e612a/tasks/ifind/future/future_info_daily.py#L285-L434 | ||
OmkarPathak/pygorithm | be35813729a0151da1ac9ba013453a61ffa249b8 | pygorithm/binary/binary_utils.py | python | to_string | (binary_array, delimiter=' ') | return delimiter.join(binary_array) | Convert binary array to string | Convert binary array to string | [
"Convert",
"binary",
"array",
"to",
"string"
] | def to_string(binary_array, delimiter=' '):
"""
Convert binary array to string
"""
if type(binary_array) is not list:
raise TypeError("to_string only accepts lists, not {}".format(str(type(value))))
return delimiter.join(binary_array) | [
"def",
"to_string",
"(",
"binary_array",
",",
"delimiter",
"=",
"' '",
")",
":",
"if",
"type",
"(",
"binary_array",
")",
"is",
"not",
"list",
":",
"raise",
"TypeError",
"(",
"\"to_string only accepts lists, not {}\"",
".",
"format",
"(",
"str",
"(",
"type",
... | https://github.com/OmkarPathak/pygorithm/blob/be35813729a0151da1ac9ba013453a61ffa249b8/pygorithm/binary/binary_utils.py#L22-L28 | |
Azure/azure-cli | 6c1b085a0910c6c2139006fcbd8ade44006eb6dd | src/azure-cli-core/azure/cli/core/profiles/__init__.py | python | get_api_version | (cli_ctx, resource_type, as_sdk_profile=False) | return _sdk_get_api_version(cli_ctx.cloud.profile, resource_type, as_sdk_profile) | Get the current API version for a given resource_type.
:param resource_type: The resource type.
:type resource_type: ResourceType.
:param bool as_sdk_profile: Return SDKProfile instance.
:returns: The API version
Can return a tuple<operation_group, str> if the resource_type supports SDKProfile.
... | Get the current API version for a given resource_type. | [
"Get",
"the",
"current",
"API",
"version",
"for",
"a",
"given",
"resource_type",
"."
] | def get_api_version(cli_ctx, resource_type, as_sdk_profile=False):
""" Get the current API version for a given resource_type.
:param resource_type: The resource type.
:type resource_type: ResourceType.
:param bool as_sdk_profile: Return SDKProfile instance.
:returns: The API version
Can return... | [
"def",
"get_api_version",
"(",
"cli_ctx",
",",
"resource_type",
",",
"as_sdk_profile",
"=",
"False",
")",
":",
"from",
"azure",
".",
"cli",
".",
"core",
".",
"profiles",
".",
"_shared",
"import",
"get_api_version",
"as",
"_sdk_get_api_version",
"return",
"_sdk_g... | https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/src/azure-cli-core/azure/cli/core/profiles/__init__.py#L11-L22 | |
google-research/morph-net | be4d79dea816c473007c5967d45ab4036306c21c | morph_net/tools/configurable_ops.py | python | ConfigurableOps._get_function_and_suffix | (self, key) | return self._function_dict[key], self._suffix_dict[key] | Returns the function and suffix associated with key. | Returns the function and suffix associated with key. | [
"Returns",
"the",
"function",
"and",
"suffix",
"associated",
"with",
"key",
"."
] | def _get_function_and_suffix(self, key):
"""Returns the function and suffix associated with key."""
if key not in self._function_dict:
raise KeyError('Function "%s" not supported by function_dict' % key)
return self._function_dict[key], self._suffix_dict[key] | [
"def",
"_get_function_and_suffix",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_function_dict",
":",
"raise",
"KeyError",
"(",
"'Function \"%s\" not supported by function_dict'",
"%",
"key",
")",
"return",
"self",
".",
"_function_dic... | https://github.com/google-research/morph-net/blob/be4d79dea816c473007c5967d45ab4036306c21c/morph_net/tools/configurable_ops.py#L844-L848 | |
open-telemetry/opentelemetry-python | f5d872050204685b5ef831d02ec593956820ebe6 | exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/translate/__init__.py | python | _get_binary_key_value | (key: str, value: bytes) | return model_pb2.KeyValue(
key=key, v_binary=value, v_type=model_pb2.ValueType.BINARY
) | Returns jaeger double KeyValue. | Returns jaeger double KeyValue. | [
"Returns",
"jaeger",
"double",
"KeyValue",
"."
] | def _get_binary_key_value(key: str, value: bytes) -> model_pb2.KeyValue:
"""Returns jaeger double KeyValue."""
return model_pb2.KeyValue(
key=key, v_binary=value, v_type=model_pb2.ValueType.BINARY
) | [
"def",
"_get_binary_key_value",
"(",
"key",
":",
"str",
",",
"value",
":",
"bytes",
")",
"->",
"model_pb2",
".",
"KeyValue",
":",
"return",
"model_pb2",
".",
"KeyValue",
"(",
"key",
"=",
"key",
",",
"v_binary",
"=",
"value",
",",
"v_type",
"=",
"model_pb... | https://github.com/open-telemetry/opentelemetry-python/blob/f5d872050204685b5ef831d02ec593956820ebe6/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/translate/__init__.py#L143-L147 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/registry_client_entity.py | python | RegistryClientEntity.disconnected_node_acknowledged | (self, disconnected_node_acknowledged) | Sets the disconnected_node_acknowledged of this RegistryClientEntity.
Acknowledges that this node is disconnected to allow for mutable requests to proceed.
:param disconnected_node_acknowledged: The disconnected_node_acknowledged of this RegistryClientEntity.
:type: bool | Sets the disconnected_node_acknowledged of this RegistryClientEntity.
Acknowledges that this node is disconnected to allow for mutable requests to proceed. | [
"Sets",
"the",
"disconnected_node_acknowledged",
"of",
"this",
"RegistryClientEntity",
".",
"Acknowledges",
"that",
"this",
"node",
"is",
"disconnected",
"to",
"allow",
"for",
"mutable",
"requests",
"to",
"proceed",
"."
] | def disconnected_node_acknowledged(self, disconnected_node_acknowledged):
"""
Sets the disconnected_node_acknowledged of this RegistryClientEntity.
Acknowledges that this node is disconnected to allow for mutable requests to proceed.
:param disconnected_node_acknowledged: The disconnect... | [
"def",
"disconnected_node_acknowledged",
"(",
"self",
",",
"disconnected_node_acknowledged",
")",
":",
"self",
".",
"_disconnected_node_acknowledged",
"=",
"disconnected_node_acknowledged"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/registry_client_entity.py#L236-L245 | ||
Alfanous-team/alfanous | 594514729473c24efa3908e3107b45a38255de4b | src/alfanous/Support/whoosh/util.py | python | natural_key | (s) | return tuple(_nkconv(m) for m in _nkre.findall(s)) | Converts string ``s`` into a tuple that will sort "naturally" (i.e.,
``name5`` will come before ``name10`` and ``1`` will come before ``A``).
This function is designed to be used as the ``key`` argument to sorting
functions.
:param s: the str/unicode string to convert.
:rtype: tuple | Converts string ``s`` into a tuple that will sort "naturally" (i.e.,
``name5`` will come before ``name10`` and ``1`` will come before ``A``).
This function is designed to be used as the ``key`` argument to sorting
functions.
:param s: the str/unicode string to convert.
:rtype: tuple | [
"Converts",
"string",
"s",
"into",
"a",
"tuple",
"that",
"will",
"sort",
"naturally",
"(",
"i",
".",
"e",
".",
"name5",
"will",
"come",
"before",
"name10",
"and",
"1",
"will",
"come",
"before",
"A",
")",
".",
"This",
"function",
"is",
"designed",
"to",... | def natural_key(s):
"""Converts string ``s`` into a tuple that will sort "naturally" (i.e.,
``name5`` will come before ``name10`` and ``1`` will come before ``A``).
This function is designed to be used as the ``key`` argument to sorting
functions.
:param s: the str/unicode string to convert.
... | [
"def",
"natural_key",
"(",
"s",
")",
":",
"# Use _nkre to split the input string into a sequence of",
"# digit runs and non-digit runs. Then use _nkconv() to convert",
"# the digit runs into ints and the non-digit runs to lowercase.",
"return",
"tuple",
"(",
"_nkconv",
"(",
"m",
")",
... | https://github.com/Alfanous-team/alfanous/blob/594514729473c24efa3908e3107b45a38255de4b/src/alfanous/Support/whoosh/util.py#L230-L243 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/cryptography/x509/extensions.py | python | GeneralNames.__hash__ | (self) | return hash(tuple(self._general_names)) | [] | def __hash__(self):
return hash(tuple(self._general_names)) | [
"def",
"__hash__",
"(",
"self",
")",
":",
"return",
"hash",
"(",
"tuple",
"(",
"self",
".",
"_general_names",
")",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/cryptography/x509/extensions.py#L1234-L1235 | |||
davidkingzyb/pccold | 54a81bed5591f1a8dd1e48a60c29237cd391f6c6 | pccold/videodownload.py | python | download3DaysVideo | () | [] | def download3DaysVideo():
global conf
room_obj_list=reqVideoList(conf.video_author)
if len(room_obj_list)>0:
room_obj=room_obj_list.pop()
saveStream('source',room_obj.get('file_name','default.mp4'),url=room_obj.get('url',''))
elif conf.is_bypy:
doBypy() | [
"def",
"download3DaysVideo",
"(",
")",
":",
"global",
"conf",
"room_obj_list",
"=",
"reqVideoList",
"(",
"conf",
".",
"video_author",
")",
"if",
"len",
"(",
"room_obj_list",
")",
">",
"0",
":",
"room_obj",
"=",
"room_obj_list",
".",
"pop",
"(",
")",
"saveS... | https://github.com/davidkingzyb/pccold/blob/54a81bed5591f1a8dd1e48a60c29237cd391f6c6/pccold/videodownload.py#L79-L86 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/urllib3/contrib/pyopenssl.py | python | WrappedSocket.recv | (self, *args, **kwargs) | [] | def recv(self, *args, **kwargs):
try:
data = self.connection.recv(*args, **kwargs)
except OpenSSL.SSL.SysCallError as e:
if self.suppress_ragged_eofs and e.args == (-1, 'Unexpected EOF'):
return b''
else:
raise SocketError(str(e))
... | [
"def",
"recv",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"data",
"=",
"self",
".",
"connection",
".",
"recv",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"OpenSSL",
".",
"SSL",
".",
"SysCallError"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/urllib3/contrib/pyopenssl.py#L256-L276 | ||||
JasonKessler/scattertext | ef33f06d4c31f9d64b551a7ab86bf157aca82644 | scattertext/representations/Word2VecFromParsedCorpus.py | python | FeatsFromGensim.get_feats | (self, doc) | return ngram_counter | Parameters
----------
doc, Spacy Docs
Returns
-------
Counter (unigram, bigram) -> count | Parameters
----------
doc, Spacy Docs | [
"Parameters",
"----------",
"doc",
"Spacy",
"Docs"
] | def get_feats(self, doc):
'''
Parameters
----------
doc, Spacy Docs
Returns
-------
Counter (unigram, bigram) -> count
'''
ngram_counter = Counter()
for sent in doc.sents:
ngrams = self.phrases[str(sent)]
for subphr... | [
"def",
"get_feats",
"(",
"self",
",",
"doc",
")",
":",
"ngram_counter",
"=",
"Counter",
"(",
")",
"for",
"sent",
"in",
"doc",
".",
"sents",
":",
"ngrams",
"=",
"self",
".",
"phrases",
"[",
"str",
"(",
"sent",
")",
"]",
"for",
"subphrases",
"in",
"s... | https://github.com/JasonKessler/scattertext/blob/ef33f06d4c31f9d64b551a7ab86bf157aca82644/scattertext/representations/Word2VecFromParsedCorpus.py#L28-L45 | |
python-openxml/python-docx | 36cac78de080d412e9e50d56c2784e33655cad59 | docx/parts/document.py | python | DocumentPart._settings_part | (self) | A |SettingsPart| object providing access to the document-level
settings for this document. Creates a default settings part if one is
not present. | A |SettingsPart| object providing access to the document-level
settings for this document. Creates a default settings part if one is
not present. | [
"A",
"|SettingsPart|",
"object",
"providing",
"access",
"to",
"the",
"document",
"-",
"level",
"settings",
"for",
"this",
"document",
".",
"Creates",
"a",
"default",
"settings",
"part",
"if",
"one",
"is",
"not",
"present",
"."
] | def _settings_part(self):
"""
A |SettingsPart| object providing access to the document-level
settings for this document. Creates a default settings part if one is
not present.
"""
try:
return self.part_related_by(RT.SETTINGS)
except KeyError:
... | [
"def",
"_settings_part",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"part_related_by",
"(",
"RT",
".",
"SETTINGS",
")",
"except",
"KeyError",
":",
"settings_part",
"=",
"SettingsPart",
".",
"default",
"(",
"self",
".",
"package",
")",
"self"... | https://github.com/python-openxml/python-docx/blob/36cac78de080d412e9e50d56c2784e33655cad59/docx/parts/document.py#L130-L141 | ||
galaxyproject/galaxy | 4c03520f05062e0f4a1b3655dc0b7452fda69943 | lib/galaxy/datatypes/goldenpath.py | python | AGPGapLine._validate_line | (self) | Validation specific to AGP gap lines. | Validation specific to AGP gap lines. | [
"Validation",
"specific",
"to",
"AGP",
"gap",
"lines",
"."
] | def _validate_line(self):
""" Validation specific to AGP gap lines. """
if self.comp_type == "U" and self.gap_len != 100:
raise AGPError(self.fname, self.line_number, f"invalid gap length for component type 'U': {self.gap_len} (should be 100)")
if self.gap_type not in AGPGapLine.all... | [
"def",
"_validate_line",
"(",
"self",
")",
":",
"if",
"self",
".",
"comp_type",
"==",
"\"U\"",
"and",
"self",
".",
"gap_len",
"!=",
"100",
":",
"raise",
"AGPError",
"(",
"self",
".",
"fname",
",",
"self",
".",
"line_number",
",",
"f\"invalid gap length for... | https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/datatypes/goldenpath.py#L524-L548 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/zoombar.py | python | MakeDisabledBitmap | (original) | return wx.Bitmap(img.ConvertToGreyscale()) | Creates a disabled-looking bitmap starting from the input one.
:param `original`: an instance of :class:`wx.Bitmap` to be greyed-out. | Creates a disabled-looking bitmap starting from the input one. | [
"Creates",
"a",
"disabled",
"-",
"looking",
"bitmap",
"starting",
"from",
"the",
"input",
"one",
"."
] | def MakeDisabledBitmap(original):
"""
Creates a disabled-looking bitmap starting from the input one.
:param `original`: an instance of :class:`wx.Bitmap` to be greyed-out.
"""
img = original.ConvertToImage()
return wx.Bitmap(img.ConvertToGreyscale()) | [
"def",
"MakeDisabledBitmap",
"(",
"original",
")",
":",
"img",
"=",
"original",
".",
"ConvertToImage",
"(",
")",
"return",
"wx",
".",
"Bitmap",
"(",
"img",
".",
"ConvertToGreyscale",
"(",
")",
")"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/zoombar.py#L329-L337 | |
tosher/Mediawiker | 81bf97cace59bedcb1668e7830b85c36e014428e | lib/Crypto.lin.x64/Crypto/Util/strxor.py | python | _strxor_direct | (term1, term2, result) | Very fast XOR - check conditions! | Very fast XOR - check conditions! | [
"Very",
"fast",
"XOR",
"-",
"check",
"conditions!"
] | def _strxor_direct(term1, term2, result):
"""Very fast XOR - check conditions!"""
_raw_strxor.strxor(term1, term2, result, c_size_t(len(term1))) | [
"def",
"_strxor_direct",
"(",
"term1",
",",
"term2",
",",
"result",
")",
":",
"_raw_strxor",
".",
"strxor",
"(",
"term1",
",",
"term2",
",",
"result",
",",
"c_size_t",
"(",
"len",
"(",
"term1",
")",
")",
")"
] | https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.lin.x64/Crypto/Util/strxor.py#L79-L81 | ||
minerllabs/minerl | 0123527c334c96ebb3f0cf313df1552fa4302691 | minerl/herobraine/hero/handlers/agent/observations/location_stats.py | python | _LightLevelObservation.__init__ | (self) | [] | def __init__(self):
super().__init__(key_list=['light_level'],
space=spaces.Box(low=0.0, high=15, shape=(), dtype=np.int),
default_if_missing=15) | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"key_list",
"=",
"[",
"'light_level'",
"]",
",",
"space",
"=",
"spaces",
".",
"Box",
"(",
"low",
"=",
"0.0",
",",
"high",
"=",
"15",
",",
"shape",
"=",
"(",
")",
... | https://github.com/minerllabs/minerl/blob/0123527c334c96ebb3f0cf313df1552fa4302691/minerl/herobraine/hero/handlers/agent/observations/location_stats.py#L144-L147 | ||||
siegfried415/portia-dashboard | b1e116ea95afd736caf55df5d16e6da28c124eec | slybot/slybot/plugins/scrapely_annotations/migration.py | python | find_generated_annotation | (elem) | return annotation | Find annotation information for generated element. | Find annotation information for generated element. | [
"Find",
"annotation",
"information",
"for",
"generated",
"element",
"."
] | def find_generated_annotation(elem):
"""Find annotation information for generated element."""
elem = elem.root
previous = elem.getprevious()
insert_after = True
nodes = []
if previous is None:
previous = elem.getparent()
nodes = [previous] + previous.getchildren()
insert_... | [
"def",
"find_generated_annotation",
"(",
"elem",
")",
":",
"elem",
"=",
"elem",
".",
"root",
"previous",
"=",
"elem",
".",
"getprevious",
"(",
")",
"insert_after",
"=",
"True",
"nodes",
"=",
"[",
"]",
"if",
"previous",
"is",
"None",
":",
"previous",
"=",... | https://github.com/siegfried415/portia-dashboard/blob/b1e116ea95afd736caf55df5d16e6da28c124eec/slybot/slybot/plugins/scrapely_annotations/migration.py#L609-L661 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/contrib/localflavor/ca/forms.py | python | CASocialInsuranceNumberField.luhn_checksum_is_valid | (self, number) | return ( (sum % 10) == 0 ) | Checks to make sure that the SIN passes a luhn mod-10 checksum
See: http://en.wikipedia.org/wiki/Luhn_algorithm | Checks to make sure that the SIN passes a luhn mod-10 checksum
See: http://en.wikipedia.org/wiki/Luhn_algorithm | [
"Checks",
"to",
"make",
"sure",
"that",
"the",
"SIN",
"passes",
"a",
"luhn",
"mod",
"-",
"10",
"checksum",
"See",
":",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Luhn_algorithm"
] | def luhn_checksum_is_valid(self, number):
"""
Checks to make sure that the SIN passes a luhn mod-10 checksum
See: http://en.wikipedia.org/wiki/Luhn_algorithm
"""
sum = 0
num_digits = len(number)
oddeven = num_digits & 1
for count in range(0, num_digits):... | [
"def",
"luhn_checksum_is_valid",
"(",
"self",
",",
"number",
")",
":",
"sum",
"=",
"0",
"num_digits",
"=",
"len",
"(",
"number",
")",
"oddeven",
"=",
"num_digits",
"&",
"1",
"for",
"count",
"in",
"range",
"(",
"0",
",",
"num_digits",
")",
":",
"digit",... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/contrib/localflavor/ca/forms.py#L128-L148 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | pypy/interpreter/baseobjspace.py | python | ObjSpace.exec_ | (self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None) | return statement.exec_code(self, w_globals, w_locals) | For internal debugging. | For internal debugging. | [
"For",
"internal",
"debugging",
"."
] | def exec_(self, statement, w_globals, w_locals, hidden_applevel=False,
filename=None):
"For internal debugging."
if filename is None:
filename = '?'
from pypy.interpreter.pycode import PyCode
if isinstance(statement, str):
compiler = self.createcompi... | [
"def",
"exec_",
"(",
"self",
",",
"statement",
",",
"w_globals",
",",
"w_locals",
",",
"hidden_applevel",
"=",
"False",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"'?'",
"from",
"pypy",
".",
"interpreter... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/interpreter/baseobjspace.py#L1386-L1401 | |
sentinel-hub/eo-learn | cf964eaf173668d6a374675dbd7c1d244264c11d | core/eolearn/core/eoworkflow.py | python | EOWorkflow._execute_tasks | (self, *, input_args, out_degs, monitor) | return intermediate_results | Executes tasks comprising the workflow in the predetermined order
:param input_args: External input arguments to the workflow.
:type input_args: Dict
:param out_degs: Dictionary mapping vertices (task IDs) to their out-degrees. (The out-degree equals the number
of tasks that depend on t... | Executes tasks comprising the workflow in the predetermined order | [
"Executes",
"tasks",
"comprising",
"the",
"workflow",
"in",
"the",
"predetermined",
"order"
] | def _execute_tasks(self, *, input_args, out_degs, monitor):
""" Executes tasks comprising the workflow in the predetermined order
:param input_args: External input arguments to the workflow.
:type input_args: Dict
:param out_degs: Dictionary mapping vertices (task IDs) to their out-degr... | [
"def",
"_execute_tasks",
"(",
"self",
",",
"*",
",",
"input_args",
",",
"out_degs",
",",
"monitor",
")",
":",
"intermediate_results",
"=",
"{",
"}",
"for",
"dep",
"in",
"self",
".",
"ordered_dependencies",
":",
"result",
"=",
"self",
".",
"_execute_task",
... | https://github.com/sentinel-hub/eo-learn/blob/cf964eaf173668d6a374675dbd7c1d244264c11d/core/eolearn/core/eoworkflow.py#L193-L218 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/plat-atheos/TYPES.py | python | __FDELT | (d) | return ((d) / __NFDBITS) | [] | def __FDELT(d): return ((d) / __NFDBITS) | [
"def",
"__FDELT",
"(",
"d",
")",
":",
"return",
"(",
"(",
"d",
")",
"/",
"__NFDBITS",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/plat-atheos/TYPES.py#L72-L72 | |||
EventGhost/EventGhost | 177be516849e74970d2e13cda82244be09f277ce | lib27/site-packages/tornado/process.py | python | Subprocess.set_exit_callback | (self, callback) | Runs ``callback`` when this process exits.
The callback takes one argument, the return code of the process.
This method uses a ``SIGCHLD`` handler, which is a global setting
and may conflict if you have other libraries trying to handle the
same signal. If you are using more than one `... | Runs ``callback`` when this process exits. | [
"Runs",
"callback",
"when",
"this",
"process",
"exits",
"."
] | def set_exit_callback(self, callback):
"""Runs ``callback`` when this process exits.
The callback takes one argument, the return code of the process.
This method uses a ``SIGCHLD`` handler, which is a global setting
and may conflict if you have other libraries trying to handle the
... | [
"def",
"set_exit_callback",
"(",
"self",
",",
"callback",
")",
":",
"self",
".",
"_exit_callback",
"=",
"stack_context",
".",
"wrap",
"(",
"callback",
")",
"Subprocess",
".",
"initialize",
"(",
"self",
".",
"io_loop",
")",
"Subprocess",
".",
"_waiting",
"[",... | https://github.com/EventGhost/EventGhost/blob/177be516849e74970d2e13cda82244be09f277ce/lib27/site-packages/tornado/process.py#L253-L271 | ||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/cinder/cinder/volume/drivers/xiv.py | python | XIVDriver.remove_export | (self, context, volume) | return self.xiv_proxy.remove_export(context, volume) | Disconnect a volume from an attached instance. | Disconnect a volume from an attached instance. | [
"Disconnect",
"a",
"volume",
"from",
"an",
"attached",
"instance",
"."
] | def remove_export(self, context, volume):
"""Disconnect a volume from an attached instance."""
return self.xiv_proxy.remove_export(context, volume) | [
"def",
"remove_export",
"(",
"self",
",",
"context",
",",
"volume",
")",
":",
"return",
"self",
".",
"xiv_proxy",
".",
"remove_export",
"(",
"context",
",",
"volume",
")"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/volume/drivers/xiv.py#L88-L91 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/flatnotebook.py | python | FNBRendererVC8.__init__ | (self) | Default class constructor. | Default class constructor. | [
"Default",
"class",
"constructor",
"."
] | def __init__(self):
""" Default class constructor. """
FNBRenderer.__init__(self)
self._first = True
self._factor = 1 | [
"def",
"__init__",
"(",
"self",
")",
":",
"FNBRenderer",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"_first",
"=",
"True",
"self",
".",
"_factor",
"=",
"1"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/flatnotebook.py#L3036-L3041 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | gunicorn/datadog_checks/gunicorn/config_models/instance.py | python | InstanceConfig._ensure_defaults | (cls, v, field) | return getattr(defaults, f'instance_{field.name}')(field, v) | [] | def _ensure_defaults(cls, v, field):
if v is not None or field.required:
return v
return getattr(defaults, f'instance_{field.name}')(field, v) | [
"def",
"_ensure_defaults",
"(",
"cls",
",",
"v",
",",
"field",
")",
":",
"if",
"v",
"is",
"not",
"None",
"or",
"field",
".",
"required",
":",
"return",
"v",
"return",
"getattr",
"(",
"defaults",
",",
"f'instance_{field.name}'",
")",
"(",
"field",
",",
... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/gunicorn/datadog_checks/gunicorn/config_models/instance.py#L39-L43 | |||
Allen7D/mini-shop-server | 5f3ddd5a4e5e99a1e005f11abc620cefff2493fc | app/core/db.py | python | CRUDMixin.save | (self, commit: bool = True) | return self | 保存 | 保存 | [
"保存"
] | def save(self, commit: bool = True):
'''保存'''
db.session.add(self)
if commit:
db.session.commit()
return self | [
"def",
"save",
"(",
"self",
",",
"commit",
":",
"bool",
"=",
"True",
")",
":",
"db",
".",
"session",
".",
"add",
"(",
"self",
")",
"if",
"commit",
":",
"db",
".",
"session",
".",
"commit",
"(",
")",
"return",
"self"
] | https://github.com/Allen7D/mini-shop-server/blob/5f3ddd5a4e5e99a1e005f11abc620cefff2493fc/app/core/db.py#L154-L159 | |
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/AndroBugs/tools/modified/androguard/core/analysis/analysis.py | python | is_native_code | (dx) | return False | Native code is present ?
:param dx : the analysis virtual machine
:type dx: a :class:`VMAnalysis` object
:rtype: boolean | Native code is present ?
:param dx : the analysis virtual machine
:type dx: a :class:`VMAnalysis` object
:rtype: boolean | [
"Native",
"code",
"is",
"present",
"?",
":",
"param",
"dx",
":",
"the",
"analysis",
"virtual",
"machine",
":",
"type",
"dx",
":",
"a",
":",
"class",
":",
"VMAnalysis",
"object",
":",
"rtype",
":",
"boolean"
] | def is_native_code(dx):
"""
Native code is present ?
:param dx : the analysis virtual machine
:type dx: a :class:`VMAnalysis` object
:rtype: boolean
"""
if dx.get_tainted_packages().search_methods("Ljava/lang/System;",
"load.",
... | [
"def",
"is_native_code",
"(",
"dx",
")",
":",
"if",
"dx",
".",
"get_tainted_packages",
"(",
")",
".",
"search_methods",
"(",
"\"Ljava/lang/System;\"",
",",
"\"load.\"",
",",
"\".\"",
")",
":",
"return",
"True",
"if",
"dx",
".",
"get_tainted_packages",
"(",
"... | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/AndroBugs/tools/modified/androguard/core/analysis/analysis.py#L1408-L1425 | |
NVIDIA/NeMo | 5b0c0b4dec12d87d3cd960846de4105309ce938e | nemo/collections/nlp/modules/common/megatron/megatron_utils.py | python | get_megatron_config | (pretrained_model_name: str) | return MEGATRON_CONFIG_MAP[pretrained_model_name]["config"] | Returns Megatron-LM model config file
Args:
pretrained_model_name (str): pretrained model name
Returns:
config (dict): contains model configuration: number of hidden layers, number of attention heads, etc | Returns Megatron-LM model config file | [
"Returns",
"Megatron",
"-",
"LM",
"model",
"config",
"file"
] | def get_megatron_config(pretrained_model_name: str) -> Dict[str, int]:
"""
Returns Megatron-LM model config file
Args:
pretrained_model_name (str): pretrained model name
Returns:
config (dict): contains model configuration: number of hidden layers, number of attention heads, etc
""... | [
"def",
"get_megatron_config",
"(",
"pretrained_model_name",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"int",
"]",
":",
"_check_megatron_name",
"(",
"pretrained_model_name",
")",
"return",
"MEGATRON_CONFIG_MAP",
"[",
"pretrained_model_name",
"]",
"[",
"\"config... | https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/nlp/modules/common/megatron/megatron_utils.py#L219-L230 | |
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/topi/generic/nn.py | python | schedule_sparse_conv2d | (outs) | return _default_schedule(outs, False) | Schedule for sparse_conv2d
Parameters
----------
outs: Array of Tensor
The computation graph description of sparse_conv2d
in the format of an array of tensors.
Returns
-------
sch: Schedule
The computation schedule for the op. | Schedule for sparse_conv2d | [
"Schedule",
"for",
"sparse_conv2d"
] | def schedule_sparse_conv2d(outs):
"""Schedule for sparse_conv2d
Parameters
----------
outs: Array of Tensor
The computation graph description of sparse_conv2d
in the format of an array of tensors.
Returns
-------
sch: Schedule
The computation schedule for the op... | [
"def",
"schedule_sparse_conv2d",
"(",
"outs",
")",
":",
"return",
"_default_schedule",
"(",
"outs",
",",
"False",
")"
] | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/topi/generic/nn.py#L818-L832 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.