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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
compas-dev/compas | 0b33f8786481f710115fb1ae5fe79abc2a9a5175 | src/compas/files/gltf/gltf_mesh.py | python | GLTFMesh.from_data | (cls, mesh, context, primitive_data_list) | return cls(
primitive_data_list=primitive_data_list,
context=context,
mesh_name=mesh.get('name'),
weights=mesh.get('weights'),
extras=mesh.get('extras'),
extensions=mesh.get('extensions'),
) | Creates a :class:`compas.files.GLTFMesh` from a glTF node dictionary
and inserts it in the provided context.
Parameters
----------
mesh : dict
context : :class:`compas.files.GLTFContent`
primitive_data_list : list
Returns
-------
:class:`compas.f... | Creates a :class:`compas.files.GLTFMesh` from a glTF node dictionary
and inserts it in the provided context. | [
"Creates",
"a",
":",
"class",
":",
"compas",
".",
"files",
".",
"GLTFMesh",
"from",
"a",
"glTF",
"node",
"dictionary",
"and",
"inserts",
"it",
"in",
"the",
"provided",
"context",
"."
] | def from_data(cls, mesh, context, primitive_data_list):
"""Creates a :class:`compas.files.GLTFMesh` from a glTF node dictionary
and inserts it in the provided context.
Parameters
----------
mesh : dict
context : :class:`compas.files.GLTFContent`
primitive_data_li... | [
"def",
"from_data",
"(",
"cls",
",",
"mesh",
",",
"context",
",",
"primitive_data_list",
")",
":",
"if",
"mesh",
"is",
"None",
":",
"return",
"None",
"return",
"cls",
"(",
"primitive_data_list",
"=",
"primitive_data_list",
",",
"context",
"=",
"context",
","... | https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/files/gltf/gltf_mesh.py#L229-L252 | |
NVlabs/selfsupervised-denoising | a41e0dbf135f532c892834b2aeedeaae79d9be9b | dnnlib/tflib/optimizer.py | python | Optimizer.register_gradients | (self, loss: TfExpression, trainable_vars: Union[List, dict]) | Register the gradients of the given loss function with respect to the given variables.
Intended to be called once per GPU. | Register the gradients of the given loss function with respect to the given variables.
Intended to be called once per GPU. | [
"Register",
"the",
"gradients",
"of",
"the",
"given",
"loss",
"function",
"with",
"respect",
"to",
"the",
"given",
"variables",
".",
"Intended",
"to",
"be",
"called",
"once",
"per",
"GPU",
"."
] | def register_gradients(self, loss: TfExpression, trainable_vars: Union[List, dict]) -> None:
"""Register the gradients of the given loss function with respect to the given variables.
Intended to be called once per GPU."""
assert not self._updates_applied
# Validate arguments.
if... | [
"def",
"register_gradients",
"(",
"self",
",",
"loss",
":",
"TfExpression",
",",
"trainable_vars",
":",
"Union",
"[",
"List",
",",
"dict",
"]",
")",
"->",
"None",
":",
"assert",
"not",
"self",
".",
"_updates_applied",
"# Validate arguments.",
"if",
"isinstance... | https://github.com/NVlabs/selfsupervised-denoising/blob/a41e0dbf135f532c892834b2aeedeaae79d9be9b/dnnlib/tflib/optimizer.py#L67-L100 | ||
brian-team/brian2 | c212a57cb992b766786b5769ebb830ff12d8a8ad | brian2/input/spikegeneratorgroup.py | python | SpikeGeneratorGroup.spikes | (self) | return spikespace[:spikespace[-1]] | The spikes returned by the most recent thresholding operation. | The spikes returned by the most recent thresholding operation. | [
"The",
"spikes",
"returned",
"by",
"the",
"most",
"recent",
"thresholding",
"operation",
"."
] | def spikes(self):
"""
The spikes returned by the most recent thresholding operation.
"""
# Note that we have to directly access the ArrayVariable object here
# instead of using the Group mechanism by accessing self._spikespace
# Using the latter would cut _spikespace to t... | [
"def",
"spikes",
"(",
"self",
")",
":",
"# Note that we have to directly access the ArrayVariable object here",
"# instead of using the Group mechanism by accessing self._spikespace",
"# Using the latter would cut _spikespace to the length of the group",
"spikespace",
"=",
"self",
".",
"va... | https://github.com/brian-team/brian2/blob/c212a57cb992b766786b5769ebb830ff12d8a8ad/brian2/input/spikegeneratorgroup.py#L305-L313 | |
chaoss/grimoirelab-perceval | ba19bfd5e40bffdd422ca8e68526326b47f97491 | perceval/backends/core/phabricator.py | python | Phabricator.parse_phids | (results) | Parse a Phabicator PHIDs JSON stream.
This method parses a JSON stream and returns a list iterator.
Each item is a dictionary that contains the PHID parsed data.
:param results: JSON to parse
:returns: a generator of parsed PHIDs | Parse a Phabicator PHIDs JSON stream. | [
"Parse",
"a",
"Phabicator",
"PHIDs",
"JSON",
"stream",
"."
] | def parse_phids(results):
"""Parse a Phabicator PHIDs JSON stream.
This method parses a JSON stream and returns a list iterator.
Each item is a dictionary that contains the PHID parsed data.
:param results: JSON to parse
:returns: a generator of parsed PHIDs
"""
... | [
"def",
"parse_phids",
"(",
"results",
")",
":",
"for",
"phid",
"in",
"results",
"[",
"'result'",
"]",
".",
"values",
"(",
")",
":",
"yield",
"phid"
] | https://github.com/chaoss/grimoirelab-perceval/blob/ba19bfd5e40bffdd422ca8e68526326b47f97491/perceval/backends/core/phabricator.py#L216-L228 | ||
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/pymysql/connections.py | python | Connection.thread_id | (self) | return self.server_thread_id[0] | [] | def thread_id(self):
return self.server_thread_id[0] | [
"def",
"thread_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"server_thread_id",
"[",
"0",
"]"
] | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/pymysql/connections.py#L1193-L1194 | |||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/nova/nova/db/api.py | python | service_get_all_by_topic | (context, topic) | return IMPL.service_get_all_by_topic(context, topic) | Get all services for a given topic. | Get all services for a given topic. | [
"Get",
"all",
"services",
"for",
"a",
"given",
"topic",
"."
] | def service_get_all_by_topic(context, topic):
"""Get all services for a given topic."""
return IMPL.service_get_all_by_topic(context, topic) | [
"def",
"service_get_all_by_topic",
"(",
"context",
",",
"topic",
")",
":",
"return",
"IMPL",
".",
"service_get_all_by_topic",
"(",
"context",
",",
"topic",
")"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/db/api.py#L135-L137 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/engine/result.py | python | ResultProxy.is_insert | (self) | return self.context.isinsert | True if this :class:`.ResultProxy` is the result
of a executing an expression language compiled
:func:`.expression.insert` construct.
When True, this implies that the
:attr:`inserted_primary_key` attribute is accessible,
assuming the statement did not include
a user defi... | True if this :class:`.ResultProxy` is the result
of a executing an expression language compiled
:func:`.expression.insert` construct. | [
"True",
"if",
"this",
":",
"class",
":",
".",
"ResultProxy",
"is",
"the",
"result",
"of",
"a",
"executing",
"an",
"expression",
"language",
"compiled",
":",
"func",
":",
".",
"expression",
".",
"insert",
"construct",
"."
] | def is_insert(self):
"""True if this :class:`.ResultProxy` is the result
of a executing an expression language compiled
:func:`.expression.insert` construct.
When True, this implies that the
:attr:`inserted_primary_key` attribute is accessible,
assuming the statement did... | [
"def",
"is_insert",
"(",
"self",
")",
":",
"return",
"self",
".",
"context",
".",
"isinsert"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/engine/result.py#L500-L511 | |
aws/serverless-application-model | ab6943a340a3f489af62b8c70c1366242b2887fe | samtranslator/model/__init__.py | python | ResourceTypeResolver.resolve_resource_type | (self, resource_dict) | return self.resource_types[resource_dict["Type"]] | Returns the Resource class corresponding to the 'Type' key in the given resource dict.
:param dict resource_dict: the resource dict to resolve
:returns: the resolved Resource class
:rtype: class | Returns the Resource class corresponding to the 'Type' key in the given resource dict. | [
"Returns",
"the",
"Resource",
"class",
"corresponding",
"to",
"the",
"Type",
"key",
"in",
"the",
"given",
"resource",
"dict",
"."
] | def resolve_resource_type(self, resource_dict):
"""Returns the Resource class corresponding to the 'Type' key in the given resource dict.
:param dict resource_dict: the resource dict to resolve
:returns: the resolved Resource class
:rtype: class
"""
if not self.can_resol... | [
"def",
"resolve_resource_type",
"(",
"self",
",",
"resource_dict",
")",
":",
"if",
"not",
"self",
".",
"can_resolve",
"(",
"resource_dict",
")",
":",
"raise",
"TypeError",
"(",
"\"Resource dict has missing or invalid value for key Type. Event Type is: {}.\"",
".",
"format... | https://github.com/aws/serverless-application-model/blob/ab6943a340a3f489af62b8c70c1366242b2887fe/samtranslator/model/__init__.py#L497-L512 | |
PaddlePaddle/models | 511e2e282960ed4c7440c3f1d1e62017acb90e11 | tutorials/mobilenetv3_prod/Step1-5/mobilenetv3_ref/torchvision/transforms/transforms.py | python | RandomSizedCrop.__init__ | (self, *args, **kwargs) | [] | def __init__(self, *args, **kwargs):
warnings.warn(
"The use of the transforms.RandomSizedCrop transform is deprecated, "
+ "please use transforms.RandomResizedCrop instead.")
super(RandomSizedCrop, self).__init__(*args, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"The use of the transforms.RandomSizedCrop transform is deprecated, \"",
"+",
"\"please use transforms.RandomResizedCrop instead.\"",
")",
"super",
"(",
... | https://github.com/PaddlePaddle/models/blob/511e2e282960ed4c7440c3f1d1e62017acb90e11/tutorials/mobilenetv3_prod/Step1-5/mobilenetv3_ref/torchvision/transforms/transforms.py#L988-L992 | ||||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/venv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | ResourceManager.extraction_error | (self) | Give an error message for problems extracting file(s) | Give an error message for problems extracting file(s) | [
"Give",
"an",
"error",
"message",
"for",
"problems",
"extracting",
"file",
"(",
"s",
")"
] | def extraction_error(self):
"""Give an error message for problems extracting file(s)"""
old_exc = sys.exc_info()[1]
cache_path = self.extraction_path or get_default_cache()
tmpl = textwrap.dedent("""
Can't extract file(s) to egg cache
The following error occurr... | [
"def",
"extraction_error",
"(",
"self",
")",
":",
"old_exc",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"cache_path",
"=",
"self",
".",
"extraction_path",
"or",
"get_default_cache",
"(",
")",
"tmpl",
"=",
"textwrap",
".",
"dedent",
"(",
"\"\"\... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1224-L1250 | ||
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extractTheSunIsColdTranslations.py | python | extractTheSunIsColdTranslations | (item) | return False | Parser for 'The Sun Is Cold Translations' | Parser for 'The Sun Is Cold Translations' | [
"Parser",
"for",
"The",
"Sun",
"Is",
"Cold",
"Translations"
] | def extractTheSunIsColdTranslations(item):
"""
Parser for 'The Sun Is Cold Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if '108 maidens' in item['tags']:
return buildReleaseMessageWithType(ite... | [
"def",
"extractTheSunIsColdTranslations",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"'preview'",
"... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractTheSunIsColdTranslations.py#L1-L12 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/plugins/lib/libprogen.py | python | ProgenParser.create_families | (self) | Method to import Families | Method to import Families | [
"Method",
"to",
"import",
"Families"
] | def create_families(self):
"""
Method to import Families
"""
table = self.def_['Table_2']
LOG.info(table.get_field_names())
# We'll start with F03: Husband
# Note: We like this to be computed just once.
family_ix = [0, 0]
for count in range(2, len... | [
"def",
"create_families",
"(",
"self",
")",
":",
"table",
"=",
"self",
".",
"def_",
"[",
"'Table_2'",
"]",
"LOG",
".",
"info",
"(",
"table",
".",
"get_field_names",
"(",
")",
")",
"# We'll start with F03: Husband",
"# Note: We like this to be computed just once.",
... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/lib/libprogen.py#L1569-L1887 | ||
mlcommons/training | 4a4d5a0b7efe99c680306b1940749211d4238a84 | rnn_translator/pytorch/seq2seq/data/sampler.py | python | DistributedSampler.__init__ | (self, dataset, batch_size, seeds, world_size=None, rank=None) | Constructor for the DistributedSampler.
:param dataset: dataset
:param batch_size: local batch size
:param seeds: list of seeds, one seed for each training epoch
:param world_size: number of distributed workers
:param rank: rank of the current process | Constructor for the DistributedSampler. | [
"Constructor",
"for",
"the",
"DistributedSampler",
"."
] | def __init__(self, dataset, batch_size, seeds, world_size=None, rank=None):
"""
Constructor for the DistributedSampler.
:param dataset: dataset
:param batch_size: local batch size
:param seeds: list of seeds, one seed for each training epoch
:param world_size: number of ... | [
"def",
"__init__",
"(",
"self",
",",
"dataset",
",",
"batch_size",
",",
"seeds",
",",
"world_size",
"=",
"None",
",",
"rank",
"=",
"None",
")",
":",
"if",
"world_size",
"is",
"None",
":",
"world_size",
"=",
"get_world_size",
"(",
")",
"if",
"rank",
"is... | https://github.com/mlcommons/training/blob/4a4d5a0b7efe99c680306b1940749211d4238a84/rnn_translator/pytorch/seq2seq/data/sampler.py#L13-L40 | ||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/data/utils/pythoneditor/completer.py | python | CompletionWidget.focusOutEvent | (self, event) | Override Qt method. | Override Qt method. | [
"Override",
"Qt",
"method",
"."
] | def focusOutEvent(self, event):
"""Override Qt method."""
event.ignore()
# Don't hide it on Mac when main window loses focus because
# keyboard input is lost.
# Fixes spyder-ide/spyder#1318.
if sys.platform == "darwin":
if event.reason() != Qt.ActiveWindowFocu... | [
"def",
"focusOutEvent",
"(",
"self",
",",
"event",
")",
":",
"event",
".",
"ignore",
"(",
")",
"# Don't hide it on Mac when main window loses focus because",
"# keyboard input is lost.",
"# Fixes spyder-ide/spyder#1318.",
"if",
"sys",
".",
"platform",
"==",
"\"darwin\"",
... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/utils/pythoneditor/completer.py#L418-L433 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/boto/__init__.py | python | connect_configservice | (aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs) | return ConfigServiceConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
) | Connect to AWS Config
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kms.layer1.ConfigServiceConnection`
:return: A connection to the AWS Config s... | Connect to AWS Config | [
"Connect",
"to",
"AWS",
"Config"
] | def connect_configservice(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to AWS Config
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws... | [
"def",
"connect_configservice",
"(",
"aws_access_key_id",
"=",
"None",
",",
"aws_secret_access_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"boto",
".",
"configservice",
".",
"layer1",
"import",
"ConfigServiceConnection",
"return",
"ConfigServiceCon... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/__init__.py#L1024-L1044 | |
goldsborough/ig | b7f9d88c7d1a524333609fa40735cfb4987183b9 | ig/graph.py | python | Graph.add | (self, node_name, neighbors) | Adds a new node to the graph, along with its adjacent neighbors.
Args:
node_name: The name of the node (i.e. current file)
neighbors: A list of names of neighbors (included files) | Adds a new node to the graph, along with its adjacent neighbors. | [
"Adds",
"a",
"new",
"node",
"to",
"the",
"graph",
"along",
"with",
"its",
"adjacent",
"neighbors",
"."
] | def add(self, node_name, neighbors):
'''
Adds a new node to the graph, along with its adjacent neighbors.
Args:
node_name: The name of the node (i.e. current file)
neighbors: A list of names of neighbors (included files)
'''
node = self._get_or_add_node(n... | [
"def",
"add",
"(",
"self",
",",
"node_name",
",",
"neighbors",
")",
":",
"node",
"=",
"self",
".",
"_get_or_add_node",
"(",
"node_name",
")",
"if",
"not",
"self",
".",
"is_included_by_relation",
":",
"node",
"[",
"'size'",
"]",
"=",
"len",
"(",
"neighbor... | https://github.com/goldsborough/ig/blob/b7f9d88c7d1a524333609fa40735cfb4987183b9/ig/graph.py#L45-L62 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/urllib/parse.py | python | splitnport | (host, defport=-1) | return host, defport | Split host and port, returning numeric port.
Return given default port if no ':' found; defaults to -1.
Return numerical port if a valid number are found after ':'.
Return None if ':' but not a valid number. | Split host and port, returning numeric port.
Return given default port if no ':' found; defaults to -1.
Return numerical port if a valid number are found after ':'.
Return None if ':' but not a valid number. | [
"Split",
"host",
"and",
"port",
"returning",
"numeric",
"port",
".",
"Return",
"given",
"default",
"port",
"if",
"no",
":",
"found",
";",
"defaults",
"to",
"-",
"1",
".",
"Return",
"numerical",
"port",
"if",
"a",
"valid",
"number",
"are",
"found",
"after... | def splitnport(host, defport=-1):
"""Split host and port, returning numeric port.
Return given default port if no ':' found; defaults to -1.
Return numerical port if a valid number are found after ':'.
Return None if ':' but not a valid number."""
global _nportprog
if _nportprog is None:
... | [
"def",
"splitnport",
"(",
"host",
",",
"defport",
"=",
"-",
"1",
")",
":",
"global",
"_nportprog",
"if",
"_nportprog",
"is",
"None",
":",
"_nportprog",
"=",
"re",
".",
"compile",
"(",
"'^(.*):(.*)$'",
")",
"match",
"=",
"_nportprog",
".",
"match",
"(",
... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/urllib/parse.py#L917-L935 | |
mysql/mysql-utilities | 08276b2258bf9739f53406b354b21195ff69a261 | mysql/utilities/common/sql_transform.py | python | SQLTransformer._get_foreign_keys | (self, src_db, src_name, dest_db, dest_name) | return (drop_constraints, add_constraints) | Get the foreign key constraints
This method returns the table foreign keys via ALTER TABLE clauses
gathered from the Table class methods.
src_db[in] database name for source table
src_name[in] table name for source table
dest_db[in] database name for destin... | Get the foreign key constraints | [
"Get",
"the",
"foreign",
"key",
"constraints"
] | def _get_foreign_keys(self, src_db, src_name, dest_db, dest_name):
"""Get the foreign key constraints
This method returns the table foreign keys via ALTER TABLE clauses
gathered from the Table class methods.
src_db[in] database name for source table
src_name[in] t... | [
"def",
"_get_foreign_keys",
"(",
"self",
",",
"src_db",
",",
"src_name",
",",
"dest_db",
",",
"dest_name",
")",
":",
"from",
"mysql",
".",
"utilities",
".",
"common",
".",
"table",
"import",
"Table",
"from",
"mysql",
".",
"utilities",
".",
"common",
".",
... | https://github.com/mysql/mysql-utilities/blob/08276b2258bf9739f53406b354b21195ff69a261/mysql/utilities/common/sql_transform.py#L867-L912 | |
girder/girder | 0766ba8e7f9b25ce81e7c0d19bd343479bceea20 | girder/models/model_base.py | python | Model.ensureIndex | (self, index) | Like ensureIndices, but declares just a single index rather than a list
of them. | Like ensureIndices, but declares just a single index rather than a list
of them. | [
"Like",
"ensureIndices",
"but",
"declares",
"just",
"a",
"single",
"index",
"rather",
"than",
"a",
"list",
"of",
"them",
"."
] | def ensureIndex(self, index):
"""
Like ensureIndices, but declares just a single index rather than a list
of them.
"""
self._indices.append(index)
if self._connected:
self._createIndex(index) | [
"def",
"ensureIndex",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"_indices",
".",
"append",
"(",
"index",
")",
"if",
"self",
".",
"_connected",
":",
"self",
".",
"_createIndex",
"(",
"index",
")"
] | https://github.com/girder/girder/blob/0766ba8e7f9b25ce81e7c0d19bd343479bceea20/girder/models/model_base.py#L226-L233 | ||
burke-software/schooldriver | a07262ba864aee0182548ecceb661e49c925725f | ecwsp/schedule/models.py | python | CourseSection.shortname | (self) | return self.course.shortname | Course short name | Course short name | [
"Course",
"short",
"name"
] | def shortname(self):
""" Course short name """
return self.course.shortname | [
"def",
"shortname",
"(",
"self",
")",
":",
"return",
"self",
".",
"course",
".",
"shortname"
] | https://github.com/burke-software/schooldriver/blob/a07262ba864aee0182548ecceb661e49c925725f/ecwsp/schedule/models.py#L526-L528 | |
marinho/geraldo | 868ebdce67176d9b6205cddc92476f642c783fff | site/newsite/site-geraldo/django/template/defaultfilters.py | python | pluralize | (value, arg=u's') | return singular_suffix | Returns a plural suffix if the value is not 1. By default, 's' is used as
the suffix:
* If value is 0, vote{{ value|pluralize }} displays "0 votes".
* If value is 1, vote{{ value|pluralize }} displays "1 vote".
* If value is 2, vote{{ value|pluralize }} displays "2 votes".
If an argument is provid... | Returns a plural suffix if the value is not 1. By default, 's' is used as
the suffix: | [
"Returns",
"a",
"plural",
"suffix",
"if",
"the",
"value",
"is",
"not",
"1",
".",
"By",
"default",
"s",
"is",
"used",
"as",
"the",
"suffix",
":"
] | def pluralize(value, arg=u's'):
"""
Returns a plural suffix if the value is not 1. By default, 's' is used as
the suffix:
* If value is 0, vote{{ value|pluralize }} displays "0 votes".
* If value is 1, vote{{ value|pluralize }} displays "1 vote".
* If value is 2, vote{{ value|pluralize }} displ... | [
"def",
"pluralize",
"(",
"value",
",",
"arg",
"=",
"u's'",
")",
":",
"if",
"not",
"u','",
"in",
"arg",
":",
"arg",
"=",
"u','",
"+",
"arg",
"bits",
"=",
"arg",
".",
"split",
"(",
"u','",
")",
"if",
"len",
"(",
"bits",
")",
">",
"2",
":",
"ret... | https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/site-geraldo/django/template/defaultfilters.py#L745-L786 | |
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/nltk/probability.py | python | ProbabilisticMixIn.set_logprob | (self, logprob) | Set the log probability associated with this object to
``logprob``. I.e., set the probability associated with this
object to ``2**(logprob)``.
:param logprob: The new log probability
:type logprob: float | Set the log probability associated with this object to
``logprob``. I.e., set the probability associated with this
object to ``2**(logprob)``. | [
"Set",
"the",
"log",
"probability",
"associated",
"with",
"this",
"object",
"to",
"logprob",
".",
"I",
".",
"e",
".",
"set",
"the",
"probability",
"associated",
"with",
"this",
"object",
"to",
"2",
"**",
"(",
"logprob",
")",
"."
] | def set_logprob(self, logprob):
"""
Set the log probability associated with this object to
``logprob``. I.e., set the probability associated with this
object to ``2**(logprob)``.
:param logprob: The new log probability
:type logprob: float
"""
self.__log... | [
"def",
"set_logprob",
"(",
"self",
",",
"logprob",
")",
":",
"self",
".",
"__logprob",
"=",
"logprob",
"self",
".",
"__prob",
"=",
"None"
] | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/probability.py#L2377-L2387 | ||
MVIG-SJTU/WSHP | 84f53673d7f3cb0da5dffaa84d6cd1d2f0971819 | parsing_network/deeplab_resnet/image_reader.py | python | random_crop_and_pad_image_and_labels | (image, label, crop_h, crop_w, ignore_label=255) | return img_crop, label_crop | Randomly crop and pads the input images.
Args:
image: Training image to crop/ pad.
label: Segmentation mask to crop/ pad.
crop_h: Height of cropped segment.
crop_w: Width of cropped segment.
ignore_label: Label to ignore during the training. | Randomly crop and pads the input images. | [
"Randomly",
"crop",
"and",
"pads",
"the",
"input",
"images",
"."
] | def random_crop_and_pad_image_and_labels(image, label, crop_h, crop_w, ignore_label=255):
"""
Randomly crop and pads the input images.
Args:
image: Training image to crop/ pad.
label: Segmentation mask to crop/ pad.
crop_h: Height of cropped segment.
crop_w: Width of cropped segment... | [
"def",
"random_crop_and_pad_image_and_labels",
"(",
"image",
",",
"label",
",",
"crop_h",
",",
"crop_w",
",",
"ignore_label",
"=",
"255",
")",
":",
"label",
"=",
"tf",
".",
"cast",
"(",
"label",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
"label",
"=",... | https://github.com/MVIG-SJTU/WSHP/blob/84f53673d7f3cb0da5dffaa84d6cd1d2f0971819/parsing_network/deeplab_resnet/image_reader.py#L41-L70 | |
RobRomijnders/weight_uncertainty | 2a525074c64cbe2fcecbfc0f297461dabd0460a1 | weight_uncertainty/util/model.py | python | Model.add_tensorboard_summaries | (self, grads_norm=0.0) | Add some nice summaries for Tensorboard
:param grads_norm:
:return: | Add some nice summaries for Tensorboard
:param grads_norm:
:return: | [
"Add",
"some",
"nice",
"summaries",
"for",
"Tensorboard",
":",
"param",
"grads_norm",
":",
":",
"return",
":"
] | def add_tensorboard_summaries(self, grads_norm=0.0):
"""
Add some nice summaries for Tensorboard
:param grads_norm:
:return:
"""
# Summaries for TensorBoard
with tf.name_scope("summaries"):
tf.summary.scalar("loss", self.loss)
tf.summary.sc... | [
"def",
"add_tensorboard_summaries",
"(",
"self",
",",
"grads_norm",
"=",
"0.0",
")",
":",
"# Summaries for TensorBoard",
"with",
"tf",
".",
"name_scope",
"(",
"\"summaries\"",
")",
":",
"tf",
".",
"summary",
".",
"scalar",
"(",
"\"loss\"",
",",
"self",
".",
... | https://github.com/RobRomijnders/weight_uncertainty/blob/2a525074c64cbe2fcecbfc0f297461dabd0460a1/weight_uncertainty/util/model.py#L149-L163 | ||
shopkick/flawless | a4d158914225ff01ab336be62070be80b2acc511 | flawless/server/api/Flawless.py | python | Iface.record_error | (self, request) | Parameters:
- request | Parameters:
- request | [
"Parameters",
":",
"-",
"request"
] | def record_error(self, request):
"""
Parameters:
- request
"""
pass | [
"def",
"record_error",
"(",
"self",
",",
"request",
")",
":",
"pass"
] | https://github.com/shopkick/flawless/blob/a4d158914225ff01ab336be62070be80b2acc511/flawless/server/api/Flawless.py#L22-L27 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/storage/_table.py | python | StorageTableMeta.get_store_type | (self) | return self.store_type | [] | def get_store_type(self):
return self.store_type | [
"def",
"get_store_type",
"(",
"self",
")",
":",
"return",
"self",
".",
"store_type"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/storage/_table.py#L355-L356 | |||
EducationalTestingService/skll | 1502fe8455cbb2c76cfc819db66f02f8ae11d321 | skll/experiments/output.py | python | _write_learning_curve_file | (result_json_paths, output_file) | Function to take a list of paths to individual learning curve
results json files and writes out a single TSV file with the
learning curve data.
Parameters
----------
result_json_paths : list of str
A list of paths to the individual result JSON files.
output_file : str
The path t... | Function to take a list of paths to individual learning curve
results json files and writes out a single TSV file with the
learning curve data. | [
"Function",
"to",
"take",
"a",
"list",
"of",
"paths",
"to",
"individual",
"learning",
"curve",
"results",
"json",
"files",
"and",
"writes",
"out",
"a",
"single",
"TSV",
"file",
"with",
"the",
"learning",
"curve",
"data",
"."
] | def _write_learning_curve_file(result_json_paths, output_file):
"""
Function to take a list of paths to individual learning curve
results json files and writes out a single TSV file with the
learning curve data.
Parameters
----------
result_json_paths : list of str
A list of paths t... | [
"def",
"_write_learning_curve_file",
"(",
"result_json_paths",
",",
"output_file",
")",
":",
"learner_result_dicts",
"=",
"[",
"]",
"# Map from feature set names to all features in them",
"logger",
"=",
"get_skll_logger",
"(",
"'experiment'",
")",
"for",
"json_path",
"in",
... | https://github.com/EducationalTestingService/skll/blob/1502fe8455cbb2c76cfc819db66f02f8ae11d321/skll/experiments/output.py#L270-L341 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/babel/dates.py | python | format_skeleton | (skeleton, datetime=None, tzinfo=None, fuzzy=True, locale=LC_TIME) | return format_datetime(datetime, format, tzinfo, locale) | r"""Return a time and/or date formatted according to the given pattern.
The skeletons are defined in the CLDR data and provide more flexibility
than the simple short/long/medium formats, but are a bit harder to use.
The are defined using the date/time symbols without order or punctuation
and map to a s... | r"""Return a time and/or date formatted according to the given pattern. | [
"r",
"Return",
"a",
"time",
"and",
"/",
"or",
"date",
"formatted",
"according",
"to",
"the",
"given",
"pattern",
"."
] | def format_skeleton(skeleton, datetime=None, tzinfo=None, fuzzy=True, locale=LC_TIME):
r"""Return a time and/or date formatted according to the given pattern.
The skeletons are defined in the CLDR data and provide more flexibility
than the simple short/long/medium formats, but are a bit harder to use.
... | [
"def",
"format_skeleton",
"(",
"skeleton",
",",
"datetime",
"=",
"None",
",",
"tzinfo",
"=",
"None",
",",
"fuzzy",
"=",
"True",
",",
"locale",
"=",
"LC_TIME",
")",
":",
"locale",
"=",
"Locale",
".",
"parse",
"(",
"locale",
")",
"if",
"fuzzy",
"and",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/babel/dates.py#L804-L839 | |
readthedocs/readthedocs.org | 0852d7c10d725d954d3e9a93513171baa1116d9f | readthedocs/search/parsers.py | python | SphinxParser._generate_domains_data | (self, body) | return domain_data | Generate sphinx domain objects' docstrings.
Returns a dict with the generated data.
The returned dict is in the following form::
{
"domain-id-1": "docstrings for the domain-id-1",
"domain-id-2": "docstrings for the domain-id-2",
}
.. not... | Generate sphinx domain objects' docstrings. | [
"Generate",
"sphinx",
"domain",
"objects",
"docstrings",
"."
] | def _generate_domains_data(self, body):
"""
Generate sphinx domain objects' docstrings.
Returns a dict with the generated data.
The returned dict is in the following form::
{
"domain-id-1": "docstrings for the domain-id-1",
"domain-id-2": "do... | [
"def",
"_generate_domains_data",
"(",
"self",
",",
"body",
")",
":",
"domain_data",
"=",
"{",
"}",
"dl_tags",
"=",
"body",
".",
"css",
"(",
"'dl'",
")",
"number_of_domains",
"=",
"0",
"for",
"dl_tag",
"in",
"dl_tags",
":",
"dt",
"=",
"dl_tag",
".",
"cs... | https://github.com/readthedocs/readthedocs.org/blob/0852d7c10d725d954d3e9a93513171baa1116d9f/readthedocs/search/parsers.py#L437-L483 | |
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/beeswax/BeeswaxService.py | python | Processor.process_get_results_metadata | (self, seqid, iprot, oprot) | [] | def process_get_results_metadata(self, seqid, iprot, oprot):
args = get_results_metadata_args()
args.read(iprot)
iprot.readMessageEnd()
result = get_results_metadata_result()
try:
result.success = self._handler.get_results_metadata(args.handle)
msg_type = ... | [
"def",
"process_get_results_metadata",
"(",
"self",
",",
"seqid",
",",
"iprot",
",",
"oprot",
")",
":",
"args",
"=",
"get_results_metadata_args",
"(",
")",
"args",
".",
"read",
"(",
"iprot",
")",
"iprot",
".",
"readMessageEnd",
"(",
")",
"result",
"=",
"ge... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/beeswax/BeeswaxService.py#L711-L735 | ||||
usnistgov/fipy | 6809b180b41a11de988a48655575df7e142c93b9 | fipy/variables/noiseVariable.py | python | NoiseVariable.scramble | (self) | Generate a new random distribution. | Generate a new random distribution. | [
"Generate",
"a",
"new",
"random",
"distribution",
"."
] | def scramble(self):
"""
Generate a new random distribution.
"""
self._markStale() | [
"def",
"scramble",
"(",
"self",
")",
":",
"self",
".",
"_markStale",
"(",
")"
] | https://github.com/usnistgov/fipy/blob/6809b180b41a11de988a48655575df7e142c93b9/fipy/variables/noiseVariable.py#L40-L44 | ||
mongodb-labs/edda | 5acaf9918d9aae6a6acbbfe48741d8a20aae1f21 | edda/filters/restart.py | python | criteria | (msg) | return 0 | Does the given log line fit the criteria for this filter?
If so, return an integer code. Otherwise, return 0. | Does the given log line fit the criteria for this filter?
If so, return an integer code. Otherwise, return 0. | [
"Does",
"the",
"given",
"log",
"line",
"fit",
"the",
"criteria",
"for",
"this",
"filter?",
"If",
"so",
"return",
"an",
"integer",
"code",
".",
"Otherwise",
"return",
"0",
"."
] | def criteria(msg):
"""Does the given log line fit the criteria for this filter?
If so, return an integer code. Otherwise, return 0.
"""
if '***** SERVER RESTARTED *****' in msg:
return 1
return 0 | [
"def",
"criteria",
"(",
"msg",
")",
":",
"if",
"'***** SERVER RESTARTED *****'",
"in",
"msg",
":",
"return",
"1",
"return",
"0"
] | https://github.com/mongodb-labs/edda/blob/5acaf9918d9aae6a6acbbfe48741d8a20aae1f21/edda/filters/restart.py#L21-L27 | |
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/tencentcloud/cvm/v20170312/models.py | python | InquiryPriceResetInstanceRequest.__init__ | (self) | :param InstanceId: 实例ID。可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。
:type InstanceId: str
:param ImageId: 指定有效的[镜像](/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:<br/><li>公共镜像</li><li>自定义镜像</li><li>共享镜像</li><li>服务市场镜像</li><br/>可通过以下方式获取可用的镜像ID... | :param InstanceId: 实例ID。可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。
:type InstanceId: str
:param ImageId: 指定有效的[镜像](/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:<br/><li>公共镜像</li><li>自定义镜像</li><li>共享镜像</li><li>服务市场镜像</li><br/>可通过以下方式获取可用的镜像ID... | [
":",
"param",
"InstanceId",
":",
"实例ID。可通过",
"[",
"DescribeInstances",
"]",
"(",
"https",
":",
"//",
"cloud",
".",
"tencent",
".",
"com",
"/",
"document",
"/",
"api",
"/",
"213",
"/",
"15728",
")",
"API返回值中的",
"InstanceId",
"获取。",
":",
"type",
"InstanceI... | def __init__(self):
"""
:param InstanceId: 实例ID。可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。
:type InstanceId: str
:param ImageId: 指定有效的[镜像](/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:<br/><li>公共镜像</li><li>自定义镜像</li><li>共享镜像<... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"InstanceId",
"=",
"None",
"self",
".",
"ImageId",
"=",
"None",
"self",
".",
"SystemDisk",
"=",
"None",
"self",
".",
"LoginSettings",
"=",
"None",
"self",
".",
"EnhancedService",
"=",
"None"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tencentcloud/cvm/v20170312/models.py#L1903-L1920 | ||
IndicoDataSolutions/Passage | af6e100804dfe332c88bd2cd192e93a807377887 | passage/preprocessing.py | python | Tokenizer.fit_transform | (self, texts) | return tokens | [] | def fit_transform(self, texts):
self.fit(texts)
tokens = self.transform(texts)
return tokens | [
"def",
"fit_transform",
"(",
"self",
",",
"texts",
")",
":",
"self",
".",
"fit",
"(",
"texts",
")",
"tokens",
"=",
"self",
".",
"transform",
"(",
"texts",
")",
"return",
"tokens"
] | https://github.com/IndicoDataSolutions/Passage/blob/af6e100804dfe332c88bd2cd192e93a807377887/passage/preprocessing.py#L138-L141 | |||
tdamdouni/Pythonista | 3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad | math/fmath.py | python | tri | (n) | return seq | List the first n numbers of the triangular numbers.\nARGS: ({n}) | List the first n numbers of the triangular numbers.\nARGS: ({n}) | [
"List",
"the",
"first",
"n",
"numbers",
"of",
"the",
"triangular",
"numbers",
".",
"\\",
"nARGS",
":",
"(",
"{",
"n",
"}",
")"
] | def tri(n):
'''List the first n numbers of the triangular numbers.\nARGS: ({n})'''
seq = []
n1 = 0
while n1 < n:
i = (n1*(n1 + 1)) / 2
seq.append(i)
n1 += 1
return seq | [
"def",
"tri",
"(",
"n",
")",
":",
"seq",
"=",
"[",
"]",
"n1",
"=",
"0",
"while",
"n1",
"<",
"n",
":",
"i",
"=",
"(",
"n1",
"*",
"(",
"n1",
"+",
"1",
")",
")",
"/",
"2",
"seq",
".",
"append",
"(",
"i",
")",
"n1",
"+=",
"1",
"return",
"... | https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/math/fmath.py#L139-L147 | |
rmmh/skybot | aff044596b09e25e80187f90cbf7bfa31f68335c | plugins/somethingawful.py | python | profile_username | (inp, api_key=None) | return format_profile_response(profile, show_link=True) | .profile <username> - get the SomethingAwful profile for a user via their username | .profile <username> - get the SomethingAwful profile for a user via their username | [
".",
"profile",
"<username",
">",
"-",
"get",
"the",
"SomethingAwful",
"profile",
"for",
"a",
"user",
"via",
"their",
"username"
] | def profile_username(inp, api_key=None):
""".profile <username> - get the SomethingAwful profile for a user via their username"""
if api_key is None or "user" not in api_key or "password" not in api_key:
return
profile = get_profile_by_username(api_key, inp)
return format_profile_response(prof... | [
"def",
"profile_username",
"(",
"inp",
",",
"api_key",
"=",
"None",
")",
":",
"if",
"api_key",
"is",
"None",
"or",
"\"user\"",
"not",
"in",
"api_key",
"or",
"\"password\"",
"not",
"in",
"api_key",
":",
"return",
"profile",
"=",
"get_profile_by_username",
"("... | https://github.com/rmmh/skybot/blob/aff044596b09e25e80187f90cbf7bfa31f68335c/plugins/somethingawful.py#L277-L284 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | twistedcaldav/ical.py | python | Component.hasPropertyInAnyComponent | (self, properties) | return False | Test for the existence of one or more properties in any component.
@param properties: property name(s) to test for
@type properties: C{list}, C{tuple} or C{str} | Test for the existence of one or more properties in any component. | [
"Test",
"for",
"the",
"existence",
"of",
"one",
"or",
"more",
"properties",
"in",
"any",
"component",
"."
] | def hasPropertyInAnyComponent(self, properties):
"""
Test for the existence of one or more properties in any component.
@param properties: property name(s) to test for
@type properties: C{list}, C{tuple} or C{str}
"""
if isinstance(properties, str):
properti... | [
"def",
"hasPropertyInAnyComponent",
"(",
"self",
",",
"properties",
")",
":",
"if",
"isinstance",
"(",
"properties",
",",
"str",
")",
":",
"properties",
"=",
"(",
"properties",
",",
")",
"for",
"property",
"in",
"properties",
":",
"if",
"self",
".",
"hasPr... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/ical.py#L2518-L2537 | |
Tencent/PocketFlow | 53b82cba5a34834400619e7c335a23995d45c2a6 | nets/vgg_at_pascalvoc.py | python | ModelHelper.model_name | (self) | return 'ssd_vgg_300' | Model's name. | Model's name. | [
"Model",
"s",
"name",
"."
] | def model_name(self):
"""Model's name."""
return 'ssd_vgg_300' | [
"def",
"model_name",
"(",
"self",
")",
":",
"return",
"'ssd_vgg_300'"
] | https://github.com/Tencent/PocketFlow/blob/53b82cba5a34834400619e7c335a23995d45c2a6/nets/vgg_at_pascalvoc.py#L586-L589 | |
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | src/outwiker/gui/controls/ultimatelistctrl.py | python | UltimateListCtrl.Update | (self) | Calling this method immediately repaints the invalidated area of the window
and all of its children recursively while this would usually only happen when
the flow of control returns to the event loop.
:note: This function doesn't invalidate any area of the window so nothing
happens if ... | Calling this method immediately repaints the invalidated area of the window
and all of its children recursively while this would usually only happen when
the flow of control returns to the event loop. | [
"Calling",
"this",
"method",
"immediately",
"repaints",
"the",
"invalidated",
"area",
"of",
"the",
"window",
"and",
"all",
"of",
"its",
"children",
"recursively",
"while",
"this",
"would",
"usually",
"only",
"happen",
"when",
"the",
"flow",
"of",
"control",
"r... | def Update(self):
"""
Calling this method immediately repaints the invalidated area of the window
and all of its children recursively while this would usually only happen when
the flow of control returns to the event loop.
:note: This function doesn't invalidate any area of the ... | [
"def",
"Update",
"(",
"self",
")",
":",
"self",
".",
"_mainWin",
".",
"ResetVisibleLinesRange",
"(",
"True",
")",
"wx",
".",
"Control",
".",
"Update",
"(",
"self",
")"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L12818-L12832 | ||
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v6_0/symbol/symbol_client.py | python | SymbolClient.delete_requests_request_id | (self, request_id, synchronous=None) | DeleteRequestsRequestId.
[Preview API] Delete a symbol request by request identifier.
:param str request_id: The symbol request identifier.
:param bool synchronous: If true, delete all the debug entries under this request synchronously in the current session. If false, the deletion will be postp... | DeleteRequestsRequestId.
[Preview API] Delete a symbol request by request identifier.
:param str request_id: The symbol request identifier.
:param bool synchronous: If true, delete all the debug entries under this request synchronously in the current session. If false, the deletion will be postp... | [
"DeleteRequestsRequestId",
".",
"[",
"Preview",
"API",
"]",
"Delete",
"a",
"symbol",
"request",
"by",
"request",
"identifier",
".",
":",
"param",
"str",
"request_id",
":",
"The",
"symbol",
"request",
"identifier",
".",
":",
"param",
"bool",
"synchronous",
":",... | def delete_requests_request_id(self, request_id, synchronous=None):
"""DeleteRequestsRequestId.
[Preview API] Delete a symbol request by request identifier.
:param str request_id: The symbol request identifier.
:param bool synchronous: If true, delete all the debug entries under this req... | [
"def",
"delete_requests_request_id",
"(",
"self",
",",
"request_id",
",",
"synchronous",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"request_id",
"is",
"not",
"None",
":",
"route_values",
"[",
"'requestId'",
"]",
"=",
"self",
".",
"_serializ... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v6_0/symbol/symbol_client.py#L116-L132 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/ntpath.py | python | join | (path, *paths) | return result_drive + result_path | [] | def join(path, *paths):
sep = _get_sep(path)
seps = _get_bothseps(path)
colon = _get_colon(path)
result_drive, result_path = splitdrive(path)
for p in paths:
p_drive, p_path = splitdrive(p)
if p_path and p_path[0] in seps:
# Second path is absolute
if p_drive ... | [
"def",
"join",
"(",
"path",
",",
"*",
"paths",
")",
":",
"sep",
"=",
"_get_sep",
"(",
"path",
")",
"seps",
"=",
"_get_bothseps",
"(",
"path",
")",
"colon",
"=",
"_get_colon",
"(",
"path",
")",
"result_drive",
",",
"result_path",
"=",
"splitdrive",
"(",... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/ntpath.py#L104-L133 | |||
liberapay/liberapay.com | 037f8bb1f7a5d7ddafb5aad46981a15913185b96 | liberapay/models/__init__.py | python | _check_bundles_grouped_by_withdrawal_against_exchanges | (cursor) | Check that bundles grouped by withdrawal are coherent with exchanges. | Check that bundles grouped by withdrawal are coherent with exchanges. | [
"Check",
"that",
"bundles",
"grouped",
"by",
"withdrawal",
"are",
"coherent",
"with",
"exchanges",
"."
] | def _check_bundles_grouped_by_withdrawal_against_exchanges(cursor):
"""Check that bundles grouped by withdrawal are coherent with exchanges.
"""
l = cursor.all("""
WITH r AS (
SELECT e.id as e_id
, (CASE WHEN (e.amount > 0 OR e.status = 'failed' OR EXISTS (
... | [
"def",
"_check_bundles_grouped_by_withdrawal_against_exchanges",
"(",
"cursor",
")",
":",
"l",
"=",
"cursor",
".",
"all",
"(",
"\"\"\"\n WITH r AS (\n SELECT e.id as e_id\n , (CASE WHEN (e.amount > 0 OR e.status = 'failed' OR EXISTS (\n ... | https://github.com/liberapay/liberapay.com/blob/037f8bb1f7a5d7ddafb5aad46981a15913185b96/liberapay/models/__init__.py#L199-L228 | ||
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/messaging/decorators/thread_decorator.py | python | ThreadDecorator.sender_order | (self) | return self._sender_order | Get sender order.
Returns:
A number that tells where this message fits in the sequence of all
messages that the current sender has contributed to this thread | Get sender order. | [
"Get",
"sender",
"order",
"."
] | def sender_order(self) -> int:
"""
Get sender order.
Returns:
A number that tells where this message fits in the sequence of all
messages that the current sender has contributed to this thread
"""
return self._sender_order | [
"def",
"sender_order",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_sender_order"
] | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/messaging/decorators/thread_decorator.py#L101-L110 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/werkzeug/wsgi.py | python | get_current_url | (environ, root_only=False, strip_querystring=False,
host_only=False, trusted_hosts=None) | return uri_to_iri(''.join(tmp)) | A handy helper function that recreates the full URL for the current
request or parts of it. Here an example:
>>> from werkzeug.test import create_environ
>>> env = create_environ("/?param=foo", "http://localhost/script")
>>> get_current_url(env)
'http://localhost/script/?param=foo'
>>> get_cur... | A handy helper function that recreates the full URL for the current
request or parts of it. Here an example: | [
"A",
"handy",
"helper",
"function",
"that",
"recreates",
"the",
"full",
"URL",
"for",
"the",
"current",
"request",
"or",
"parts",
"of",
"it",
".",
"Here",
"an",
"example",
":"
] | def get_current_url(environ, root_only=False, strip_querystring=False,
host_only=False, trusted_hosts=None):
"""A handy helper function that recreates the full URL for the current
request or parts of it. Here an example:
>>> from werkzeug.test import create_environ
>>> env = create... | [
"def",
"get_current_url",
"(",
"environ",
",",
"root_only",
"=",
"False",
",",
"strip_querystring",
"=",
"False",
",",
"host_only",
"=",
"False",
",",
"trusted_hosts",
"=",
"None",
")",
":",
"tmp",
"=",
"[",
"environ",
"[",
"'wsgi.url_scheme'",
"]",
",",
"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/werkzeug/wsgi.py#L43-L82 | |
openwisp/netjsonconfig | b09d8a7c8c7fdf7e009d5190ce5f15287d9f412e | netjsonconfig/backends/base/backend.py | python | BaseBackend._process_files | (self, tar) | Adds files specified in self.config['files'] to tarfile instance.
:param tar: tarfile instance
:returns: None | Adds files specified in self.config['files'] to tarfile instance. | [
"Adds",
"files",
"specified",
"in",
"self",
".",
"config",
"[",
"files",
"]",
"to",
"tarfile",
"instance",
"."
] | def _process_files(self, tar):
"""
Adds files specified in self.config['files'] to tarfile instance.
:param tar: tarfile instance
:returns: None
"""
# insert additional files
for file_item in self.config.get('files', []):
path = file_item['path']
... | [
"def",
"_process_files",
"(",
"self",
",",
"tar",
")",
":",
"# insert additional files",
"for",
"file_item",
"in",
"self",
".",
"config",
".",
"get",
"(",
"'files'",
",",
"[",
"]",
")",
":",
"path",
"=",
"file_item",
"[",
"'path'",
"]",
"# remove leading s... | https://github.com/openwisp/netjsonconfig/blob/b09d8a7c8c7fdf7e009d5190ce5f15287d9f412e/netjsonconfig/backends/base/backend.py#L234-L252 | ||
pyfa-org/Pyfa | feaa52c36beeda21ab380fc74d8f871b81d49729 | service/market.py | python | Market.getItemsByGroup | (self, group) | return items | Get items assigned to group | Get items assigned to group | [
"Get",
"items",
"assigned",
"to",
"group"
] | def getItemsByGroup(self, group):
"""Get items assigned to group"""
# Return only public items; also, filter out items
# which were forcibly set to other groups
groupItems = set(group.items)
if hasattr(group, 'addItems'):
groupItems.update(group.addItems)
item... | [
"def",
"getItemsByGroup",
"(",
"self",
",",
"group",
")",
":",
"# Return only public items; also, filter out items",
"# which were forcibly set to other groups",
"groupItems",
"=",
"set",
"(",
"group",
".",
"items",
")",
"if",
"hasattr",
"(",
"group",
",",
"'addItems'",... | https://github.com/pyfa-org/Pyfa/blob/feaa52c36beeda21ab380fc74d8f871b81d49729/service/market.py#L730-L740 | |
ironport/shrapnel | 9496a64c46271b0c5cef0feb8f2cdf33cb752bb6 | old/coro_postgres.py | python | postgres_client._simple_query | (self, query) | return result | Execute a simple query.
query can be None, which skips sending the query
packet, and immediately goes to processing backend
messages. | Execute a simple query. | [
"Execute",
"a",
"simple",
"query",
"."
] | def _simple_query(self, query):
"""Execute a simple query.
query can be None, which skips sending the query
packet, and immediately goes to processing backend
messages."""
if query is not None:
self._exit_copy_mode('New query started')
self.send_packet(P... | [
"def",
"_simple_query",
"(",
"self",
",",
"query",
")",
":",
"if",
"query",
"is",
"not",
"None",
":",
"self",
".",
"_exit_copy_mode",
"(",
"'New query started'",
")",
"self",
".",
"send_packet",
"(",
"PG_QUERY_MSG",
",",
"query",
")",
"exception",
"=",
"No... | https://github.com/ironport/shrapnel/blob/9496a64c46271b0c5cef0feb8f2cdf33cb752bb6/old/coro_postgres.py#L686-L755 | |
wagtail/wagtail | ba8207a5d82c8a1de8f5f9693a7cd07421762999 | wagtail/documents/rich_text/contentstate.py | python | document_link_entity | (props) | return DOM.create_element('a', {
'linktype': 'document',
'id': props.get('id'),
}, props['children']) | Helper to construct elements of the form
<a id="1" linktype="document">document link</a>
when converting from contentstate data | Helper to construct elements of the form
<a id="1" linktype="document">document link</a>
when converting from contentstate data | [
"Helper",
"to",
"construct",
"elements",
"of",
"the",
"form",
"<a",
"id",
"=",
"1",
"linktype",
"=",
"document",
">",
"document",
"link<",
"/",
"a",
">",
"when",
"converting",
"from",
"contentstate",
"data"
] | def document_link_entity(props):
"""
Helper to construct elements of the form
<a id="1" linktype="document">document link</a>
when converting from contentstate data
"""
return DOM.create_element('a', {
'linktype': 'document',
'id': props.get('id'),
}, props['children']) | [
"def",
"document_link_entity",
"(",
"props",
")",
":",
"return",
"DOM",
".",
"create_element",
"(",
"'a'",
",",
"{",
"'linktype'",
":",
"'document'",
",",
"'id'",
":",
"props",
".",
"get",
"(",
"'id'",
")",
",",
"}",
",",
"props",
"[",
"'children'",
"]... | https://github.com/wagtail/wagtail/blob/ba8207a5d82c8a1de8f5f9693a7cd07421762999/wagtail/documents/rich_text/contentstate.py#L10-L20 | |
mutpy/mutpy | 5c8b3ca0d365083a4da8333f7fce8783114371fa | example/simple.py | python | Simple.handle_exception | (self) | [] | def handle_exception(self):
try:
raise AttributeError
except AttributeError:
return 1 | [
"def",
"handle_exception",
"(",
"self",
")",
":",
"try",
":",
"raise",
"AttributeError",
"except",
"AttributeError",
":",
"return",
"1"
] | https://github.com/mutpy/mutpy/blob/5c8b3ca0d365083a4da8333f7fce8783114371fa/example/simple.py#L87-L91 | ||||
gdraheim/docker-systemctl-replacement | 9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c | files/docker/systemctl3.py | python | Systemctl.scan_unit_sysv_files | (self, module = None) | return list(self._file_for_unit_sysv.keys()) | reads all init.d files, returns the first filename when unit is a '.service' | reads all init.d files, returns the first filename when unit is a '.service' | [
"reads",
"all",
"init",
".",
"d",
"files",
"returns",
"the",
"first",
"filename",
"when",
"unit",
"is",
"a",
".",
"service"
] | def scan_unit_sysv_files(self, module = None): # -> [ unit-names,... ]
""" reads all init.d files, returns the first filename when unit is a '.service' """
if self._file_for_unit_sysv is None:
self._file_for_unit_sysv = {}
for folder in self.init_folders():
if not... | [
"def",
"scan_unit_sysv_files",
"(",
"self",
",",
"module",
"=",
"None",
")",
":",
"# -> [ unit-names,... ]",
"if",
"self",
".",
"_file_for_unit_sysv",
"is",
"None",
":",
"self",
".",
"_file_for_unit_sysv",
"=",
"{",
"}",
"for",
"folder",
"in",
"self",
".",
"... | https://github.com/gdraheim/docker-systemctl-replacement/blob/9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c/files/docker/systemctl3.py#L1310-L1328 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/controllers/ci/moth.py | python | get_moth_http | (path='/') | return 'http://%s%s' % (whereis_moth()['http'], path) | [] | def get_moth_http(path='/'):
return 'http://%s%s' % (whereis_moth()['http'], path) | [
"def",
"get_moth_http",
"(",
"path",
"=",
"'/'",
")",
":",
"return",
"'http://%s%s'",
"%",
"(",
"whereis_moth",
"(",
")",
"[",
"'http'",
"]",
",",
"path",
")"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/ci/moth.py#L57-L58 | |||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib_pypy/_csv.py | python | writer | (*args, **kwargs) | return Writer(*args, **kwargs) | csv_writer = csv.writer(fileobj [, dialect='excel']
[optional keyword args])
for row in sequence:
csv_writer.writerow(row)
[or]
csv_writer = csv.writer(fileobj [, dialect='excel']
[optional keyword args])
csv_writer.writerows(rows)
T... | csv_writer = csv.writer(fileobj [, dialect='excel']
[optional keyword args])
for row in sequence:
csv_writer.writerow(row) | [
"csv_writer",
"=",
"csv",
".",
"writer",
"(",
"fileobj",
"[",
"dialect",
"=",
"excel",
"]",
"[",
"optional",
"keyword",
"args",
"]",
")",
"for",
"row",
"in",
"sequence",
":",
"csv_writer",
".",
"writerow",
"(",
"row",
")"
] | def writer(*args, **kwargs):
"""
csv_writer = csv.writer(fileobj [, dialect='excel']
[optional keyword args])
for row in sequence:
csv_writer.writerow(row)
[or]
csv_writer = csv.writer(fileobj [, dialect='excel']
[optional keyword arg... | [
"def",
"writer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"Writer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib_pypy/_csv.py#L539-L553 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/cgi.py | python | FieldStorage.getlist | (self, key) | Return list of received values. | Return list of received values. | [
"Return",
"list",
"of",
"received",
"values",
"."
] | def getlist(self, key):
""" Return list of received values."""
if key in self:
value = self[key]
if type(value) is type([]):
return map(attrgetter('value'), value)
else:
return [value.value]
else:
return [] | [
"def",
"getlist",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
":",
"value",
"=",
"self",
"[",
"key",
"]",
"if",
"type",
"(",
"value",
")",
"is",
"type",
"(",
"[",
"]",
")",
":",
"return",
"map",
"(",
"attrgetter",
"(",
"'value... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/cgi.py#L569-L578 | ||
rq/rq | c5a1ef17345e17269085e7f72858ac9bd6faf1dd | rq/compat/dictconfig.py | python | ConvertingDict.__getitem__ | (self, key) | return result | [] | def __getitem__(self, key):
value = dict.__getitem__(self, key)
result = self.configurator.convert(value)
#If the converted value is different, save for next time
if value is not result:
self[key] = result
if type(result) in (ConvertingDict, ConvertingList,
... | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"value",
"=",
"dict",
".",
"__getitem__",
"(",
"self",
",",
"key",
")",
"result",
"=",
"self",
".",
"configurator",
".",
"convert",
"(",
"value",
")",
"#If the converted value is different, save for next... | https://github.com/rq/rq/blob/c5a1ef17345e17269085e7f72858ac9bd6faf1dd/rq/compat/dictconfig.py#L65-L75 | |||
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | code/default/lib/noarch/hyper/packages/hpack/hpack.py | python | Encoder.add | (self, to_add, sensitive, huffman=False) | return encoded | This function takes a header key-value tuple and serializes it. | This function takes a header key-value tuple and serializes it. | [
"This",
"function",
"takes",
"a",
"header",
"key",
"-",
"value",
"tuple",
"and",
"serializes",
"it",
"."
] | def add(self, to_add, sensitive, huffman=False):
"""
This function takes a header key-value tuple and serializes it.
"""
log.debug("Adding %s to the header table", to_add)
name, value = to_add
# Set our indexing mode
indexbit = INDEX_INCREMENTAL if not sensitive... | [
"def",
"add",
"(",
"self",
",",
"to_add",
",",
"sensitive",
",",
"huffman",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"\"Adding %s to the header table\"",
",",
"to_add",
")",
"name",
",",
"value",
"=",
"to_add",
"# Set our indexing mode",
"indexbit",
... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/code/default/lib/noarch/hyper/packages/hpack/hpack.py#L267-L309 | |
bundlewrap/bundlewrap | 49a5e1802878f272f2f4855fe23b93e0e5f6c546 | bundlewrap/operations.py | python | upload | (
hostname,
local_path,
remote_path,
add_host_keys=False,
group="",
mode=None,
owner="",
ignore_failure=False,
username=None,
wrapper_inner="{}",
wrapper_outer="{}",
) | return result.return_code == 0 | Upload a file. | Upload a file. | [
"Upload",
"a",
"file",
"."
] | def upload(
hostname,
local_path,
remote_path,
add_host_keys=False,
group="",
mode=None,
owner="",
ignore_failure=False,
username=None,
wrapper_inner="{}",
wrapper_outer="{}",
):
"""
Upload a file.
"""
io.debug(_("uploading {path} -> {host}:{target}").format(
... | [
"def",
"upload",
"(",
"hostname",
",",
"local_path",
",",
"remote_path",
",",
"add_host_keys",
"=",
"False",
",",
"group",
"=",
"\"\"",
",",
"mode",
"=",
"None",
",",
"owner",
"=",
"\"\"",
",",
"ignore_failure",
"=",
"False",
",",
"username",
"=",
"None"... | https://github.com/bundlewrap/bundlewrap/blob/49a5e1802878f272f2f4855fe23b93e0e5f6c546/bundlewrap/operations.py#L252-L348 | |
laspy/laspy | c9d9b9c0e8d84288134c02bf4ecec3964f5afa29 | laspy/header.py | python | LasHeader.major_version | (self) | return self.version.major | [] | def major_version(self) -> int:
return self.version.major | [
"def",
"major_version",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"version",
".",
"major"
] | https://github.com/laspy/laspy/blob/c9d9b9c0e8d84288134c02bf4ecec3964f5afa29/laspy/header.py#L773-L774 | |||
aianaconda/TensorFlow_Engineering_Implementation | cb787e359da9ac5a08d00cd2458fecb4cb5a3a31 | tf2code/Chapter8/code8.4/Code8-9/backend.py | python | update_sub | (x, decrement) | return state_ops.assign_sub(x, decrement) | Update the value of `x` by subtracting `decrement`.
Arguments:
x: A Variable.
decrement: A tensor of same shape as `x`.
Returns:
The variable `x` updated. | Update the value of `x` by subtracting `decrement`. | [
"Update",
"the",
"value",
"of",
"x",
"by",
"subtracting",
"decrement",
"."
] | def update_sub(x, decrement):
"""Update the value of `x` by subtracting `decrement`.
Arguments:
x: A Variable.
decrement: A tensor of same shape as `x`.
Returns:
The variable `x` updated.
"""
return state_ops.assign_sub(x, decrement) | [
"def",
"update_sub",
"(",
"x",
",",
"decrement",
")",
":",
"return",
"state_ops",
".",
"assign_sub",
"(",
"x",
",",
"decrement",
")"
] | https://github.com/aianaconda/TensorFlow_Engineering_Implementation/blob/cb787e359da9ac5a08d00cd2458fecb4cb5a3a31/tf2code/Chapter8/code8.4/Code8-9/backend.py#L1581-L1591 | |
leonardr/olipy | 2fdb924c35f1f88fa41f24a58940bcd679815775 | olipy/alphabet.py | python | Alphabet.random_choice_no_modifiers | (cls, minimum_size=2) | return chars | A completely random choice among non-modifier alphabets. | A completely random choice among non-modifier alphabets. | [
"A",
"completely",
"random",
"choice",
"among",
"non",
"-",
"modifier",
"alphabets",
"."
] | def random_choice_no_modifiers(cls, minimum_size=2):
"""A completely random choice among non-modifier alphabets."""
choice = None
while choice is None:
choice = random.choice(list(cls.by_name.keys()))
if choice in cls.MODIFIERS:
choice = None
#... | [
"def",
"random_choice_no_modifiers",
"(",
"cls",
",",
"minimum_size",
"=",
"2",
")",
":",
"choice",
"=",
"None",
"while",
"choice",
"is",
"None",
":",
"choice",
"=",
"random",
".",
"choice",
"(",
"list",
"(",
"cls",
".",
"by_name",
".",
"keys",
"(",
")... | https://github.com/leonardr/olipy/blob/2fdb924c35f1f88fa41f24a58940bcd679815775/olipy/alphabet.py#L95-L108 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/mrs/v20200910/models.py | python | IndicatorItem.__init__ | (self) | r"""
:param Code: 英文缩写
注意:此字段可能返回 null,表示取不到有效值。
:type Code: str
:param Scode: 标准缩写
注意:此字段可能返回 null,表示取不到有效值。
:type Scode: str
:param Name: 项目名称
注意:此字段可能返回 null,表示取不到有效值。
:type Name: str
:param Sname: 标准名
注意:此字段可能返回 null,表示取不到有效值。
:type Sname: str
... | r"""
:param Code: 英文缩写
注意:此字段可能返回 null,表示取不到有效值。
:type Code: str
:param Scode: 标准缩写
注意:此字段可能返回 null,表示取不到有效值。
:type Scode: str
:param Name: 项目名称
注意:此字段可能返回 null,表示取不到有效值。
:type Name: str
:param Sname: 标准名
注意:此字段可能返回 null,表示取不到有效值。
:type Sname: str
... | [
"r",
":",
"param",
"Code",
":",
"英文缩写",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"Code",
":",
"str",
":",
"param",
"Scode",
":",
"标准缩写",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"Scode",
":",
"str",
":",
"param",
"Name",
":",
"项目名称",
"注意:此字段可能返回",
... | def __init__(self):
r"""
:param Code: 英文缩写
注意:此字段可能返回 null,表示取不到有效值。
:type Code: str
:param Scode: 标准缩写
注意:此字段可能返回 null,表示取不到有效值。
:type Scode: str
:param Name: 项目名称
注意:此字段可能返回 null,表示取不到有效值。
:type Name: str
:param Sname: 标准名
注意:此字段可能返回 null,表示取不到有效值。
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Code",
"=",
"None",
"self",
".",
"Scode",
"=",
"None",
"self",
".",
"Name",
"=",
"None",
"self",
".",
"Sname",
"=",
"None",
"self",
".",
"Result",
"=",
"None",
"self",
".",
"Unit",
"=",
"Non... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/mrs/v20200910/models.py#L1365-L1407 | ||
kornia/kornia | b12d6611b1c41d47b2c93675f0ea344b5314a688 | kornia/augmentation/container/augment.py | python | AugmentationSequential.forward | ( # type: ignore
self,
*args: AugmentationSequentialInput,
label: Optional[torch.Tensor] = None,
params: Optional[List[ParamItem]] = None,
data_keys: Optional[List[Union[str, int, DataKey]]] = None,
) | return self.__packup_output__(outputs, label) | Compute multiple tensors simultaneously according to ``self.data_keys``. | Compute multiple tensors simultaneously according to ``self.data_keys``. | [
"Compute",
"multiple",
"tensors",
"simultaneously",
"according",
"to",
"self",
".",
"data_keys",
"."
] | def forward( # type: ignore
self,
*args: AugmentationSequentialInput,
label: Optional[torch.Tensor] = None,
params: Optional[List[ParamItem]] = None,
data_keys: Optional[List[Union[str, int, DataKey]]] = None,
) -> Union[
AugmentationSequentialInput,
Tuple[Au... | [
"def",
"forward",
"(",
"# type: ignore",
"self",
",",
"*",
"args",
":",
"AugmentationSequentialInput",
",",
"label",
":",
"Optional",
"[",
"torch",
".",
"Tensor",
"]",
"=",
"None",
",",
"params",
":",
"Optional",
"[",
"List",
"[",
"ParamItem",
"]",
"]",
... | https://github.com/kornia/kornia/blob/b12d6611b1c41d47b2c93675f0ea344b5314a688/kornia/augmentation/container/augment.py#L287-L381 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | contrib/performance/httpclient.py | python | StringProducer.__init__ | (self, body) | [] | def __init__(self, body):
if not isinstance(body, str):
raise TypeError(
"StringProducer body must be str, not %r" % (type(body),))
self._body = body
self.length = len(self._body) | [
"def",
"__init__",
"(",
"self",
",",
"body",
")",
":",
"if",
"not",
"isinstance",
"(",
"body",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"StringProducer body must be str, not %r\"",
"%",
"(",
"type",
"(",
"body",
")",
",",
")",
")",
"self",
".",... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/contrib/performance/httpclient.py#L51-L56 | ||||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/config_models/defaults.py | python | instance_tls_private_key | (field, value) | return get_default_field_value(field, value) | [] | def instance_tls_private_key(field, value):
return get_default_field_value(field, value) | [
"def",
"instance_tls_private_key",
"(",
"field",
",",
"value",
")",
":",
"return",
"get_default_field_value",
"(",
"field",
",",
"value",
")"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/config_models/defaults.py#L245-L246 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.3/django/contrib/gis/db/models/fields.py | python | GeometryField.geodetic | (self, connection) | return self.units_name(connection) in self.geodetic_units | Returns true if this field's SRID corresponds with a coordinate
system that uses non-projected units (e.g., latitude/longitude). | Returns true if this field's SRID corresponds with a coordinate
system that uses non-projected units (e.g., latitude/longitude). | [
"Returns",
"true",
"if",
"this",
"field",
"s",
"SRID",
"corresponds",
"with",
"a",
"coordinate",
"system",
"that",
"uses",
"non",
"-",
"projected",
"units",
"(",
"e",
".",
"g",
".",
"latitude",
"/",
"longitude",
")",
"."
] | def geodetic(self, connection):
"""
Returns true if this field's SRID corresponds with a coordinate
system that uses non-projected units (e.g., latitude/longitude).
"""
return self.units_name(connection) in self.geodetic_units | [
"def",
"geodetic",
"(",
"self",
",",
"connection",
")",
":",
"return",
"self",
".",
"units_name",
"(",
"connection",
")",
"in",
"self",
".",
"geodetic_units"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/contrib/gis/db/models/fields.py#L126-L131 | |
nvaccess/nvda | 20d5a25dced4da34338197f0ef6546270ebca5d0 | source/gui/settingsDialogs.py | python | SettingsPanel.onDiscard | (self) | Take action in response to the parent's dialog Cancel button being pressed.
Sub-classes may override this method.
MultiCategorySettingsDialog is responsible for cleaning up the panel when Cancel is pressed. | Take action in response to the parent's dialog Cancel button being pressed.
Sub-classes may override this method.
MultiCategorySettingsDialog is responsible for cleaning up the panel when Cancel is pressed. | [
"Take",
"action",
"in",
"response",
"to",
"the",
"parent",
"s",
"dialog",
"Cancel",
"button",
"being",
"pressed",
".",
"Sub",
"-",
"classes",
"may",
"override",
"this",
"method",
".",
"MultiCategorySettingsDialog",
"is",
"responsible",
"for",
"cleaning",
"up",
... | def onDiscard(self):
"""Take action in response to the parent's dialog Cancel button being pressed.
Sub-classes may override this method.
MultiCategorySettingsDialog is responsible for cleaning up the panel when Cancel is pressed.
""" | [
"def",
"onDiscard",
"(",
"self",
")",
":"
] | https://github.com/nvaccess/nvda/blob/20d5a25dced4da34338197f0ef6546270ebca5d0/source/gui/settingsDialogs.py#L379-L383 | ||
rnd-team-dev/plotoptix | d8c12fd18ceae4af0fc1a4644add9f5878239760 | plotoptix/npoptix.py | python | NpOptiX.set_displacement | (self, name: str, data: Any,
addr_mode: Union[TextureAddressMode, str] = TextureAddressMode.Wrap,
keep_on_host: bool = False,
refresh: bool = False) | Set surface displacement data.
Set displacement data for the object ``name``. Geometry attribute program of the object
has to be set to :attr:`plotoptix.enums.GeomAttributeProgram.DisplacedSurface`. The ``data``
has to be a 2D array containing displacement map.
Use ``keep_on_host=True`... | Set surface displacement data. | [
"Set",
"surface",
"displacement",
"data",
"."
] | def set_displacement(self, name: str, data: Any,
addr_mode: Union[TextureAddressMode, str] = TextureAddressMode.Wrap,
keep_on_host: bool = False,
refresh: bool = False) -> None:
"""Set surface displacement data.
Set displacement... | [
"def",
"set_displacement",
"(",
"self",
",",
"name",
":",
"str",
",",
"data",
":",
"Any",
",",
"addr_mode",
":",
"Union",
"[",
"TextureAddressMode",
",",
"str",
"]",
"=",
"TextureAddressMode",
".",
"Wrap",
",",
"keep_on_host",
":",
"bool",
"=",
"False",
... | https://github.com/rnd-team-dev/plotoptix/blob/d8c12fd18ceae4af0fc1a4644add9f5878239760/plotoptix/npoptix.py#L1424-L1470 | ||
dipu-bd/lightnovel-crawler | eca7a71f217ce7a6b0a54d2e2afb349571871880 | lncrawl/bots/console/output_style.py | python | get_output_formats | (self) | return {x: (x in formats) for x in available_formats} | Returns a dictionary of output formats. | Returns a dictionary of output formats. | [
"Returns",
"a",
"dictionary",
"of",
"output",
"formats",
"."
] | def get_output_formats(self):
'''Returns a dictionary of output formats.'''
args = get_args()
formats = args.output_formats
if not (formats or args.suppress):
answer = prompt([
{
'type': 'checkbox',
'name': 'formats',
'message': 'Which... | [
"def",
"get_output_formats",
"(",
"self",
")",
":",
"args",
"=",
"get_args",
"(",
")",
"formats",
"=",
"args",
".",
"output_formats",
"if",
"not",
"(",
"formats",
"or",
"args",
".",
"suppress",
")",
":",
"answer",
"=",
"prompt",
"(",
"[",
"{",
"'type'"... | https://github.com/dipu-bd/lightnovel-crawler/blob/eca7a71f217ce7a6b0a54d2e2afb349571871880/lncrawl/bots/console/output_style.py#L87-L108 | |
ilastik/ilastik | 6acd2c554bc517e9c8ddad3623a7aaa2e6970c28 | ilastik/excepthooks.py | python | init_early_exit_excepthook | () | This excepthook is used during automated testing.
If an unhandled exception occurs, it is logged and the app exits immediately. | This excepthook is used during automated testing.
If an unhandled exception occurs, it is logged and the app exits immediately. | [
"This",
"excepthook",
"is",
"used",
"during",
"automated",
"testing",
".",
"If",
"an",
"unhandled",
"exception",
"occurs",
"it",
"is",
"logged",
"and",
"the",
"app",
"exits",
"immediately",
"."
] | def init_early_exit_excepthook():
"""
This excepthook is used during automated testing.
If an unhandled exception occurs, it is logged and the app exits immediately.
"""
from PyQt5.QtWidgets import QApplication
def print_exc_and_exit(*exc_info):
_log_exception(*exc_info)
logger.... | [
"def",
"init_early_exit_excepthook",
"(",
")",
":",
"from",
"PyQt5",
".",
"QtWidgets",
"import",
"QApplication",
"def",
"print_exc_and_exit",
"(",
"*",
"exc_info",
")",
":",
"_log_exception",
"(",
"*",
"exc_info",
")",
"logger",
".",
"error",
"(",
"\"Exiting ear... | https://github.com/ilastik/ilastik/blob/6acd2c554bc517e9c8ddad3623a7aaa2e6970c28/ilastik/excepthooks.py#L36-L49 | ||
laspy/laspy | c9d9b9c0e8d84288134c02bf4ecec3964f5afa29 | laspy/vlrs/known.py | python | IKnownVLR.official_record_ids | () | Shall return the official record_id for the VLR
.. note::
Even if the VLR has one record_id, the return type must be a tuple
Returns
-------
tuple of int
The record_ids this VLR type can have | Shall return the official record_id for the VLR | [
"Shall",
"return",
"the",
"official",
"record_id",
"for",
"the",
"VLR"
] | def official_record_ids() -> Tuple[int, ...]:
"""Shall return the official record_id for the VLR
.. note::
Even if the VLR has one record_id, the return type must be a tuple
Returns
-------
tuple of int
The record_ids this VLR type can have
"""
... | [
"def",
"official_record_ids",
"(",
")",
"->",
"Tuple",
"[",
"int",
",",
"...",
"]",
":",
"pass"
] | https://github.com/laspy/laspy/blob/c9d9b9c0e8d84288134c02bf4ecec3964f5afa29/laspy/vlrs/known.py#L44-L56 | ||
EventGhost/EventGhost | 177be516849e74970d2e13cda82244be09f277ce | lib27/site-packages/tornado/auth.py | python | _oauth10a_signature | (consumer_token, method, url, parameters={}, token=None) | return binascii.b2a_base64(hash.digest())[:-1] | Calculates the HMAC-SHA1 OAuth 1.0a signature for the given request.
See http://oauth.net/core/1.0a/#signing_process | Calculates the HMAC-SHA1 OAuth 1.0a signature for the given request. | [
"Calculates",
"the",
"HMAC",
"-",
"SHA1",
"OAuth",
"1",
".",
"0a",
"signature",
"for",
"the",
"given",
"request",
"."
] | def _oauth10a_signature(consumer_token, method, url, parameters={}, token=None):
"""Calculates the HMAC-SHA1 OAuth 1.0a signature for the given request.
See http://oauth.net/core/1.0a/#signing_process
"""
parts = urlparse.urlparse(url)
scheme, netloc, path = parts[:3]
normalized_url = scheme.lo... | [
"def",
"_oauth10a_signature",
"(",
"consumer_token",
",",
"method",
",",
"url",
",",
"parameters",
"=",
"{",
"}",
",",
"token",
"=",
"None",
")",
":",
"parts",
"=",
"urlparse",
".",
"urlparse",
"(",
"url",
")",
"scheme",
",",
"netloc",
",",
"path",
"="... | https://github.com/EventGhost/EventGhost/blob/177be516849e74970d2e13cda82244be09f277ce/lib27/site-packages/tornado/auth.py#L1098-L1119 | |
blanu/Dust | aca19633bf6e62e97d8a3537e9b32a136ba42729 | historical/v1/py/deps/distribute_setup.py | python | main | (argv, version=DEFAULT_VERSION) | Install or upgrade setuptools and EasyInstall | Install or upgrade setuptools and EasyInstall | [
"Install",
"or",
"upgrade",
"setuptools",
"and",
"EasyInstall"
] | def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
tarball = download_setuptools()
_install(tarball) | [
"def",
"main",
"(",
"argv",
",",
"version",
"=",
"DEFAULT_VERSION",
")",
":",
"tarball",
"=",
"download_setuptools",
"(",
")",
"_install",
"(",
"tarball",
")"
] | https://github.com/blanu/Dust/blob/aca19633bf6e62e97d8a3537e9b32a136ba42729/historical/v1/py/deps/distribute_setup.py#L478-L481 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py | python | Client.get_partitions_by_expr | (self, req) | return self.recv_get_partitions_by_expr() | Parameters:
- req | Parameters:
- req | [
"Parameters",
":",
"-",
"req"
] | def get_partitions_by_expr(self, req):
"""
Parameters:
- req
"""
self.send_get_partitions_by_expr(req)
return self.recv_get_partitions_by_expr() | [
"def",
"get_partitions_by_expr",
"(",
"self",
",",
"req",
")",
":",
"self",
".",
"send_get_partitions_by_expr",
"(",
"req",
")",
"return",
"self",
".",
"recv_get_partitions_by_expr",
"(",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py#L3766-L3773 | |
brython-dev/brython | 9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3 | www/src/Lib/time.py | python | _is_dst | (secs = None) | return dst | Check if data has daylight saving time | Check if data has daylight saving time | [
"Check",
"if",
"data",
"has",
"daylight",
"saving",
"time"
] | def _is_dst(secs = None):
"Check if data has daylight saving time"
d = date()
if secs is not None:
d = date(secs * 1000)
# calculate if we are in daylight savings time or not.
# borrowed from http://stackoverflow.com/questions/11887934/
# check-if-daylight-saving-time-is-in-effect-and-if... | [
"def",
"_is_dst",
"(",
"secs",
"=",
"None",
")",
":",
"d",
"=",
"date",
"(",
")",
"if",
"secs",
"is",
"not",
"None",
":",
"d",
"=",
"date",
"(",
"secs",
"*",
"1000",
")",
"# calculate if we are in daylight savings time or not.",
"# borrowed from http://stackov... | https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/time.py#L107-L119 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pygments/formatters/img.py | python | ImageFormatter._draw_line_numbers | (self) | Create drawables for the line numbers. | Create drawables for the line numbers. | [
"Create",
"drawables",
"for",
"the",
"line",
"numbers",
"."
] | def _draw_line_numbers(self):
"""
Create drawables for the line numbers.
"""
if not self.line_numbers:
return
for p in xrange(self.maxlineno):
n = p + self.line_number_start
if (n % self.line_number_step) == 0:
self._draw_linenu... | [
"def",
"_draw_line_numbers",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"line_numbers",
":",
"return",
"for",
"p",
"in",
"xrange",
"(",
"self",
".",
"maxlineno",
")",
":",
"n",
"=",
"p",
"+",
"self",
".",
"line_number_start",
"if",
"(",
"n",
"%... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pygments/formatters/img.py#L500-L509 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/click/decorators.py | python | confirmation_option | (*param_decls, **attrs) | return decorator | Shortcut for confirmation prompts that can be ignored by passing
``--yes`` as parameter.
This is equivalent to decorating a function with :func:`option` with
the following parameters::
def callback(ctx, param, value):
if not value:
ctx.abort()
@click.command()
... | Shortcut for confirmation prompts that can be ignored by passing
``--yes`` as parameter. | [
"Shortcut",
"for",
"confirmation",
"prompts",
"that",
"can",
"be",
"ignored",
"by",
"passing",
"--",
"yes",
"as",
"parameter",
"."
] | def confirmation_option(*param_decls, **attrs):
"""Shortcut for confirmation prompts that can be ignored by passing
``--yes`` as parameter.
This is equivalent to decorating a function with :func:`option` with
the following parameters::
def callback(ctx, param, value):
if not value:... | [
"def",
"confirmation_option",
"(",
"*",
"param_decls",
",",
"*",
"*",
"attrs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"def",
"callback",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"ctx",
".",
"abort",
"(... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/click/decorators.py#L178-L205 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/root_system/type_B_affine.py | python | CartanType._default_folded_cartan_type | (self) | return CartanTypeFolded(self, ['D', n + 1, 1],
[[i] for i in range(n)] + [[n, n+1]]) | Return the default folded Cartan type.
EXAMPLES::
sage: CartanType(['B', 4, 1])._default_folded_cartan_type()
['B', 4, 1] as a folding of ['D', 5, 1] | Return the default folded Cartan type. | [
"Return",
"the",
"default",
"folded",
"Cartan",
"type",
"."
] | def _default_folded_cartan_type(self):
"""
Return the default folded Cartan type.
EXAMPLES::
sage: CartanType(['B', 4, 1])._default_folded_cartan_type()
['B', 4, 1] as a folding of ['D', 5, 1]
"""
from sage.combinat.root_system.type_folded import CartanT... | [
"def",
"_default_folded_cartan_type",
"(",
"self",
")",
":",
"from",
"sage",
".",
"combinat",
".",
"root_system",
".",
"type_folded",
"import",
"CartanTypeFolded",
"n",
"=",
"self",
".",
"n",
"if",
"n",
"==",
"1",
":",
"return",
"CartanTypeFolded",
"(",
"sel... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/root_system/type_B_affine.py#L198-L212 | |
googleapis/python-ndb | e780c81cde1016651afbfcad8180d9912722cf1b | google/cloud/ndb/_datastore_api.py | python | put | (entity, options) | Store an entity in datastore.
The entity can be a new entity to be saved for the first time or an
existing entity that has been updated.
Args:
entity_pb (datastore.Entity): The entity to be stored.
options (_options.Options): Options for this request.
Returns:
tasklets.Future:... | Store an entity in datastore. | [
"Store",
"an",
"entity",
"in",
"datastore",
"."
] | def put(entity, options):
"""Store an entity in datastore.
The entity can be a new entity to be saved for the first time or an
existing entity that has been updated.
Args:
entity_pb (datastore.Entity): The entity to be stored.
options (_options.Options): Options for this request.
... | [
"def",
"put",
"(",
"entity",
",",
"options",
")",
":",
"context",
"=",
"context_module",
".",
"get_context",
"(",
")",
"use_global_cache",
"=",
"context",
".",
"_use_global_cache",
"(",
"entity",
".",
"key",
",",
"options",
")",
"use_datastore",
"=",
"contex... | https://github.com/googleapis/python-ndb/blob/e780c81cde1016651afbfcad8180d9912722cf1b/google/cloud/ndb/_datastore_api.py#L347-L405 | ||
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/xmldsig/__init__.py | python | seed_from_string | (xml_string) | return saml2.create_class_from_xml_string(Seed, xml_string) | [] | def seed_from_string(xml_string):
return saml2.create_class_from_xml_string(Seed, xml_string) | [
"def",
"seed_from_string",
"(",
"xml_string",
")",
":",
"return",
"saml2",
".",
"create_class_from_xml_string",
"(",
"Seed",
",",
"xml_string",
")"
] | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/xmldsig/__init__.py#L636-L637 | |||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/op2/writer/geom3_writer.py | python | _write_grav | (load_type, loads, nloads, op2_file, op2_ascii, endian) | return nbytes | writes the GRAVs | writes the GRAVs | [
"writes",
"the",
"GRAVs"
] | def _write_grav(load_type, loads, nloads, op2_file, op2_ascii, endian):
"""writes the GRAVs"""
key = (4401, 44, 26)
nfields = 7
#(sid, cid, a, n1, n2, n3, mb) = out
spack = Struct(endian + b'ii4fi')
nbytes = write_header(load_type, nfields, nloads, key, op2_file, op2_ascii)
for load in loads... | [
"def",
"_write_grav",
"(",
"load_type",
",",
"loads",
",",
"nloads",
",",
"op2_file",
",",
"op2_ascii",
",",
"endian",
")",
":",
"key",
"=",
"(",
"4401",
",",
"44",
",",
"26",
")",
"nfields",
"=",
"7",
"#(sid, cid, a, n1, n2, n3, mb) = out",
"spack",
"=",
... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/writer/geom3_writer.py#L380-L391 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/simplejson/raw_json.py | python | RawJSON.__init__ | (self, encoded_json) | [] | def __init__(self, encoded_json):
self.encoded_json = encoded_json | [
"def",
"__init__",
"(",
"self",
",",
"encoded_json",
")",
":",
"self",
".",
"encoded_json",
"=",
"encoded_json"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/simplejson/raw_json.py#L8-L9 | ||||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/numpy/_import_tools.py | python | PackageLoaderDebug._execcmd | (self, cmdstr) | return | Execute command in parent_frame. | Execute command in parent_frame. | [
"Execute",
"command",
"in",
"parent_frame",
"."
] | def _execcmd(self, cmdstr):
""" Execute command in parent_frame."""
frame = self.parent_frame
print('Executing', repr(cmdstr), '...', end=' ')
sys.stdout.flush()
exec (cmdstr, frame.f_globals, frame.f_locals)
print('ok')
sys.stdout.flush()
return | [
"def",
"_execcmd",
"(",
"self",
",",
"cmdstr",
")",
":",
"frame",
"=",
"self",
".",
"parent_frame",
"print",
"(",
"'Executing'",
",",
"repr",
"(",
"cmdstr",
")",
",",
"'...'",
",",
"end",
"=",
"' '",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/_import_tools.py#L337-L345 | |
NoGameNoLife00/mybolg | afe17ea5bfe405e33766e5682c43a4262232ee12 | libs/sqlalchemy/util/deprecations.py | python | _decorate_with_warning | (func, wtype, message, docstring_header=None) | return decorated | Wrap a function with a warnings.warn and augmented docstring. | Wrap a function with a warnings.warn and augmented docstring. | [
"Wrap",
"a",
"function",
"with",
"a",
"warnings",
".",
"warn",
"and",
"augmented",
"docstring",
"."
] | def _decorate_with_warning(func, wtype, message, docstring_header=None):
"""Wrap a function with a warnings.warn and augmented docstring."""
message = _sanitize_restructured_text(message)
@decorator
def warned(fn, *args, **kwargs):
warnings.warn(wtype(message), stacklevel=3)
return fn(... | [
"def",
"_decorate_with_warning",
"(",
"func",
",",
"wtype",
",",
"message",
",",
"docstring_header",
"=",
"None",
")",
":",
"message",
"=",
"_sanitize_restructured_text",
"(",
"message",
")",
"@",
"decorator",
"def",
"warned",
"(",
"fn",
",",
"*",
"args",
",... | https://github.com/NoGameNoLife00/mybolg/blob/afe17ea5bfe405e33766e5682c43a4262232ee12/libs/sqlalchemy/util/deprecations.py#L98-L116 | |
huawei-noah/Pretrained-Language-Model | d4694a134bdfacbaef8ff1d99735106bd3b3372b | DynaBERT/transformers/data/processors/utils.py | python | DataProcessor.get_labels | (self) | Gets the list of labels for this data set. | Gets the list of labels for this data set. | [
"Gets",
"the",
"list",
"of",
"labels",
"for",
"this",
"data",
"set",
"."
] | def get_labels(self):
"""Gets the list of labels for this data set."""
raise NotImplementedError() | [
"def",
"get_labels",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/huawei-noah/Pretrained-Language-Model/blob/d4694a134bdfacbaef8ff1d99735106bd3b3372b/DynaBERT/transformers/data/processors/utils.py#L111-L113 | ||
tdamdouni/Pythonista | 3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad | stash/autopep8.py | python | FixPEP8.fix_w391 | (self, _) | return range(1, 1 + original_length) | Remove trailing blank lines. | Remove trailing blank lines. | [
"Remove",
"trailing",
"blank",
"lines",
"."
] | def fix_w391(self, _):
"""Remove trailing blank lines."""
blank_count = 0
for line in reversed(self.source):
line = line.rstrip()
if line:
break
else:
blank_count += 1
original_length = len(self.source)
self.sou... | [
"def",
"fix_w391",
"(",
"self",
",",
"_",
")",
":",
"blank_count",
"=",
"0",
"for",
"line",
"in",
"reversed",
"(",
"self",
".",
"source",
")",
":",
"line",
"=",
"line",
".",
"rstrip",
"(",
")",
"if",
"line",
":",
"break",
"else",
":",
"blank_count"... | https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/stash/autopep8.py#L1004-L1016 | |
huggingface/neuralcoref | 60338df6f9b0a44a6728b442193b7c66653b0731 | neuralcoref/train/document.py | python | Document.__len__ | (self) | return len(self.mentions) | Return the number of mentions (not utterances) since it is what we really care about | Return the number of mentions (not utterances) since it is what we really care about | [
"Return",
"the",
"number",
"of",
"mentions",
"(",
"not",
"utterances",
")",
"since",
"it",
"is",
"what",
"we",
"really",
"care",
"about"
] | def __len__(self):
""" Return the number of mentions (not utterances) since it is what we really care about """
return len(self.mentions) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"mentions",
")"
] | https://github.com/huggingface/neuralcoref/blob/60338df6f9b0a44a6728b442193b7c66653b0731/neuralcoref/train/document.py#L701-L703 | |
PaddlePaddle/PaddleHub | 107ee7e1a49d15e9c94da3956475d88a53fc165f | paddlehub/module/cv_module.py | python | Yolov3Module.training_step | (self, batch: int, batch_idx: int) | return self.validation_step(batch, batch_idx) | One step for training, which should be called as forward computation.
Args:
batch(list[paddle.Tensor]): The one batch data, which contains images, ground truth boxes, labels and scores.
batch_idx(int): The index of batch.
Returns:
results(dict): The model outputs, s... | One step for training, which should be called as forward computation. | [
"One",
"step",
"for",
"training",
"which",
"should",
"be",
"called",
"as",
"forward",
"computation",
"."
] | def training_step(self, batch: int, batch_idx: int) -> dict:
'''
One step for training, which should be called as forward computation.
Args:
batch(list[paddle.Tensor]): The one batch data, which contains images, ground truth boxes, labels and scores.
batch_idx(int): The ... | [
"def",
"training_step",
"(",
"self",
",",
"batch",
":",
"int",
",",
"batch_idx",
":",
"int",
")",
"->",
"dict",
":",
"return",
"self",
".",
"validation_step",
"(",
"batch",
",",
"batch_idx",
")"
] | https://github.com/PaddlePaddle/PaddleHub/blob/107ee7e1a49d15e9c94da3956475d88a53fc165f/paddlehub/module/cv_module.py#L331-L343 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/wagtailadmin/forms.py | python | CopyForm.clean | (self) | return cleaned_data | [] | def clean(self):
cleaned_data = super(CopyForm, self).clean()
# Make sure the slug isn't already in use
slug = cleaned_data.get('new_slug')
# New parent page given in form or parent of source, if parent_page is empty
parent_page = cleaned_data.get('new_parent_page') or self.pag... | [
"def",
"clean",
"(",
"self",
")",
":",
"cleaned_data",
"=",
"super",
"(",
"CopyForm",
",",
"self",
")",
".",
"clean",
"(",
")",
"# Make sure the slug isn't already in use",
"slug",
"=",
"cleaned_data",
".",
"get",
"(",
"'new_slug'",
")",
"# New parent page given... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailadmin/forms.py#L165-L194 | |||
dulwich/dulwich | 1f66817d712e3563ce1ff53b1218491a2eae39da | dulwich/pack.py | python | FilePackIndex._unpack_name | (self, i) | Unpack the i-th name from the index file. | Unpack the i-th name from the index file. | [
"Unpack",
"the",
"i",
"-",
"th",
"name",
"from",
"the",
"index",
"file",
"."
] | def _unpack_name(self, i):
"""Unpack the i-th name from the index file."""
raise NotImplementedError(self._unpack_name) | [
"def",
"_unpack_name",
"(",
"self",
",",
"i",
")",
":",
"raise",
"NotImplementedError",
"(",
"self",
".",
"_unpack_name",
")"
] | https://github.com/dulwich/dulwich/blob/1f66817d712e3563ce1ff53b1218491a2eae39da/dulwich/pack.py#L536-L538 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | tokenMap | (func, *args) | return pa | Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional
args are passed, they are forwarded to the given function as additional arguments after
the token, as in C{hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))}, which will convert the
pa... | Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional
args are passed, they are forwarded to the given function as additional arguments after
the token, as in C{hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))}, which will convert the
pa... | [
"Helper",
"to",
"define",
"a",
"parse",
"action",
"by",
"mapping",
"a",
"function",
"to",
"all",
"elements",
"of",
"a",
"ParseResults",
"list",
".",
"If",
"any",
"additional",
"args",
"are",
"passed",
"they",
"are",
"forwarded",
"to",
"the",
"given",
"func... | def tokenMap(func, *args):
"""
Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional
args are passed, they are forwarded to the given function as additional arguments after
the token, as in C{hex_integer = Word(hexnums).setParseAction(tokenMap(in... | [
"def",
"tokenMap",
"(",
"func",
",",
"*",
"args",
")",
":",
"def",
"pa",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"return",
"[",
"func",
"(",
"tokn",
",",
"*",
"args",
")",
"for",
"tokn",
"in",
"t",
"]",
"try",
":",
"func_name",
"=",
"getattr"... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L4784-L4826 | |
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/_deprecate/frame.py | python | Column.__getitem__ | (self, idx) | Return the feature data given the index.
Parameters
----------
idx : utils.Index
The index.
Returns
-------
Tensor
The feature data | Return the feature data given the index. | [
"Return",
"the",
"feature",
"data",
"given",
"the",
"index",
"."
] | def __getitem__(self, idx):
"""Return the feature data given the index.
Parameters
----------
idx : utils.Index
The index.
Returns
-------
Tensor
The feature data
"""
if idx.slice_data() is not None:
slc = idx.... | [
"def",
"__getitem__",
"(",
"self",
",",
"idx",
")",
":",
"if",
"idx",
".",
"slice_data",
"(",
")",
"is",
"not",
"None",
":",
"slc",
"=",
"idx",
".",
"slice_data",
"(",
")",
"return",
"F",
".",
"narrow_row",
"(",
"self",
".",
"data",
",",
"slc",
"... | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/_deprecate/frame.py#L86-L104 | ||
sunpy/sunpy | 528579df0a4c938c133bd08971ba75c131b189a7 | sunpy/map/mapbase.py | python | GenericMap.date_end | (self) | return self._get_date('date-end') | Time of the end of the image acquisition.
Taken from the DATE-END FITS keyword. | Time of the end of the image acquisition. | [
"Time",
"of",
"the",
"end",
"of",
"the",
"image",
"acquisition",
"."
] | def date_end(self):
"""
Time of the end of the image acquisition.
Taken from the DATE-END FITS keyword.
"""
return self._get_date('date-end') | [
"def",
"date_end",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_date",
"(",
"'date-end'",
")"
] | https://github.com/sunpy/sunpy/blob/528579df0a4c938c133bd08971ba75c131b189a7/sunpy/map/mapbase.py#L790-L796 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_api_service_condition.py | python | V1APIServiceCondition.last_transition_time | (self, last_transition_time) | Sets the last_transition_time of this V1APIServiceCondition.
Last time the condition transitioned from one status to another. # noqa: E501
:param last_transition_time: The last_transition_time of this V1APIServiceCondition. # noqa: E501
:type: datetime | Sets the last_transition_time of this V1APIServiceCondition. | [
"Sets",
"the",
"last_transition_time",
"of",
"this",
"V1APIServiceCondition",
"."
] | def last_transition_time(self, last_transition_time):
"""Sets the last_transition_time of this V1APIServiceCondition.
Last time the condition transitioned from one status to another. # noqa: E501
:param last_transition_time: The last_transition_time of this V1APIServiceCondition. # noqa: E50... | [
"def",
"last_transition_time",
"(",
"self",
",",
"last_transition_time",
")",
":",
"self",
".",
"_last_transition_time",
"=",
"last_transition_time"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_api_service_condition.py#L85-L94 | ||
OpenAgricultureFoundation/openag-device-software | a51d2de399c0a6781ae51d0dcfaae1583d75f346 | app/viewers.py | python | DeviceConfigViewer.__init__ | (self, device_config_object: models.DeviceConfigModel) | Initializes viewer. | Initializes viewer. | [
"Initializes",
"viewer",
"."
] | def __init__(self, device_config_object: models.DeviceConfigModel) -> None:
"""Initializes viewer."""
self.dict = json_.loads(device_config_object.json)
self.uuid = self.dict.get("uuid", "UNKNOWN")
self.name = self.dict.get("name", "UNKNOWN") | [
"def",
"__init__",
"(",
"self",
",",
"device_config_object",
":",
"models",
".",
"DeviceConfigModel",
")",
"->",
"None",
":",
"self",
".",
"dict",
"=",
"json_",
".",
"loads",
"(",
"device_config_object",
".",
"json",
")",
"self",
".",
"uuid",
"=",
"self",
... | https://github.com/OpenAgricultureFoundation/openag-device-software/blob/a51d2de399c0a6781ae51d0dcfaae1583d75f346/app/viewers.py#L36-L40 | ||
aws/aws-xray-sdk-python | 71436ad7f275c603298da68bee072af7c214cfc3 | aws_xray_sdk/core/sampling/rule_poller.py | python | RulePoller._reset_time_to_wait | (self) | A random jitter of up to 5 seconds is injected after each run
to ensure the calls eventually get evenly distributed over
the 5 minute window. | A random jitter of up to 5 seconds is injected after each run
to ensure the calls eventually get evenly distributed over
the 5 minute window. | [
"A",
"random",
"jitter",
"of",
"up",
"to",
"5",
"seconds",
"is",
"injected",
"after",
"each",
"run",
"to",
"ensure",
"the",
"calls",
"eventually",
"get",
"evenly",
"distributed",
"over",
"the",
"5",
"minute",
"window",
"."
] | def _reset_time_to_wait(self):
"""
A random jitter of up to 5 seconds is injected after each run
to ensure the calls eventually get evenly distributed over
the 5 minute window.
"""
self._time_to_wait = DEFAULT_INTERVAL + self._random.random() * 5 | [
"def",
"_reset_time_to_wait",
"(",
"self",
")",
":",
"self",
".",
"_time_to_wait",
"=",
"DEFAULT_INTERVAL",
"+",
"self",
".",
"_random",
".",
"random",
"(",
")",
"*",
"5"
] | https://github.com/aws/aws-xray-sdk-python/blob/71436ad7f275c603298da68bee072af7c214cfc3/aws_xray_sdk/core/sampling/rule_poller.py#L55-L61 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/inject/lib/utils/xrange.py | python | xrange.__getitem__ | (self, index) | [] | def __getitem__(self, index):
if isinstance(index, slice):
start, stop, step = index.indices(self._len())
return xrange(self._index(start),
self._index(stop), step*self.step)
elif isinstance(index, (int, long)):
if index < 0:
... | [
"def",
"__getitem__",
"(",
"self",
",",
"index",
")",
":",
"if",
"isinstance",
"(",
"index",
",",
"slice",
")",
":",
"start",
",",
"stop",
",",
"step",
"=",
"index",
".",
"indices",
"(",
"self",
".",
"_len",
"(",
")",
")",
"return",
"xrange",
"(",
... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/lib/utils/xrange.py#L68-L84 | ||||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | py2manager/gluon/fileutils.py | python | readlines_file | (filename, mode='r') | return read_file(filename, mode).split('\n') | Applies .split('\n') to the output of `read_file()` | Applies .split('\n') to the output of `read_file()` | [
"Applies",
".",
"split",
"(",
"\\",
"n",
")",
"to",
"the",
"output",
"of",
"read_file",
"()"
] | def readlines_file(filename, mode='r'):
"""Applies .split('\n') to the output of `read_file()`
"""
return read_file(filename, mode).split('\n') | [
"def",
"readlines_file",
"(",
"filename",
",",
"mode",
"=",
"'r'",
")",
":",
"return",
"read_file",
"(",
"filename",
",",
"mode",
")",
".",
"split",
"(",
"'\\n'",
")"
] | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/py2manager/gluon/fileutils.py#L121-L124 | |
stopstalk/stopstalk-deployment | 10c3ab44c4ece33ae515f6888c15033db2004bb1 | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/html5lib/treebuilders/base.py | python | Node.cloneNode | (self) | Return a shallow copy of the current node i.e. a node with the same
name and attributes but with no parent or child nodes | Return a shallow copy of the current node i.e. a node with the same
name and attributes but with no parent or child nodes | [
"Return",
"a",
"shallow",
"copy",
"of",
"the",
"current",
"node",
"i",
".",
"e",
".",
"a",
"node",
"with",
"the",
"same",
"name",
"and",
"attributes",
"but",
"with",
"no",
"parent",
"or",
"child",
"nodes"
] | def cloneNode(self):
"""Return a shallow copy of the current node i.e. a node with the same
name and attributes but with no parent or child nodes
"""
raise NotImplementedError | [
"def",
"cloneNode",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/html5lib/treebuilders/base.py#L110-L114 | ||
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/django/contrib/gis/geos/geometry.py | python | GEOSGeometry.equals_exact | (self, other, tolerance=0) | return capi.geos_equalsexact(self.ptr, other.ptr, float(tolerance)) | Returns true if the two Geometries are exactly equal, up to a
specified tolerance. | Returns true if the two Geometries are exactly equal, up to a
specified tolerance. | [
"Returns",
"true",
"if",
"the",
"two",
"Geometries",
"are",
"exactly",
"equal",
"up",
"to",
"a",
"specified",
"tolerance",
"."
] | def equals_exact(self, other, tolerance=0):
"""
Returns true if the two Geometries are exactly equal, up to a
specified tolerance.
"""
return capi.geos_equalsexact(self.ptr, other.ptr, float(tolerance)) | [
"def",
"equals_exact",
"(",
"self",
",",
"other",
",",
"tolerance",
"=",
"0",
")",
":",
"return",
"capi",
".",
"geos_equalsexact",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
",",
"float",
"(",
"tolerance",
")",
")"
] | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/contrib/gis/geos/geometry.py#L318-L323 | |
google/trax | d6cae2067dedd0490b78d831033607357e975015 | trax/data/tf_inputs.py | python | convert_to_subtract | (const_string) | return 'subtract({},const_0)'.format(const_string) | [] | def convert_to_subtract(const_string):
return 'subtract({},const_0)'.format(const_string) | [
"def",
"convert_to_subtract",
"(",
"const_string",
")",
":",
"return",
"'subtract({},const_0)'",
".",
"format",
"(",
"const_string",
")"
] | https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/data/tf_inputs.py#L2203-L2204 | |||
rspeer/wordfreq | 11a3138cea5f46d2229a110c1774ac64a2fcd92b | wordfreq/transliterate.py | python | transliterate | (table, text) | Transliterate text according to one of the tables above.
`table` chooses the table. It looks like a language code but comes from a
very restricted set:
- 'sr-Latn' means to convert Serbian, which may be in Cyrillic, into the
Latin alphabet.
- 'az-Latn' means the same for Azerbaijani Cyrillic to ... | Transliterate text according to one of the tables above. | [
"Transliterate",
"text",
"according",
"to",
"one",
"of",
"the",
"tables",
"above",
"."
] | def transliterate(table, text):
"""
Transliterate text according to one of the tables above.
`table` chooses the table. It looks like a language code but comes from a
very restricted set:
- 'sr-Latn' means to convert Serbian, which may be in Cyrillic, into the
Latin alphabet.
- 'az-Latn'... | [
"def",
"transliterate",
"(",
"table",
",",
"text",
")",
":",
"if",
"table",
"==",
"'sr-Latn'",
":",
"return",
"text",
".",
"translate",
"(",
"SR_LATN_TABLE",
")",
"elif",
"table",
"==",
"'az-Latn'",
":",
"return",
"text",
".",
"translate",
"(",
"AZ_LATN_TA... | https://github.com/rspeer/wordfreq/blob/11a3138cea5f46d2229a110c1774ac64a2fcd92b/wordfreq/transliterate.py#L92-L108 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.