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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4shadoww/hakkuframework | 409a11fc3819d251f86faa3473439f8c19066a21 | lib/future/standard_library/__init__.py | python | is_py2_stdlib_module | (m) | return False | Tries to infer whether the module m is from the Python 2 standard library.
This may not be reliable on all systems. | Tries to infer whether the module m is from the Python 2 standard library.
This may not be reliable on all systems. | [
"Tries",
"to",
"infer",
"whether",
"the",
"module",
"m",
"is",
"from",
"the",
"Python",
"2",
"standard",
"library",
".",
"This",
"may",
"not",
"be",
"reliable",
"on",
"all",
"systems",
"."
] | def is_py2_stdlib_module(m):
"""
Tries to infer whether the module m is from the Python 2 standard library.
This may not be reliable on all systems.
"""
if PY3:
return False
if not 'stdlib_path' in is_py2_stdlib_module.__dict__:
stdlib_files = [contextlib.__file__, os.__file__, c... | [
"def",
"is_py2_stdlib_module",
"(",
"m",
")",
":",
"if",
"PY3",
":",
"return",
"False",
"if",
"not",
"'stdlib_path'",
"in",
"is_py2_stdlib_module",
".",
"__dict__",
":",
"stdlib_files",
"=",
"[",
"contextlib",
".",
"__file__",
",",
"os",
".",
"__file__",
","... | https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/future/standard_library/__init__.py#L342-L369 | |
Komodo/KomodoEdit | 61edab75dce2bdb03943b387b0608ea36f548e8e | contrib/paramiko/tasks.py | python | release | (ctx, sdist=True, wheel=True, sign=True, dry_run=False) | Wraps invocations.packaging.release to add baked-in docs folder. | Wraps invocations.packaging.release to add baked-in docs folder. | [
"Wraps",
"invocations",
".",
"packaging",
".",
"release",
"to",
"add",
"baked",
"-",
"in",
"docs",
"folder",
"."
] | def release(ctx, sdist=True, wheel=True, sign=True, dry_run=False):
"""
Wraps invocations.packaging.release to add baked-in docs folder.
"""
# Build docs first. Use terribad workaround pending invoke #146
ctx.run("inv docs")
# Move the built docs into where Epydocs used to live
target = 'doc... | [
"def",
"release",
"(",
"ctx",
",",
"sdist",
"=",
"True",
",",
"wheel",
"=",
"True",
",",
"sign",
"=",
"True",
",",
"dry_run",
"=",
"False",
")",
":",
"# Build docs first. Use terribad workaround pending invoke #146",
"ctx",
".",
"run",
"(",
"\"inv docs\"",
")"... | https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/contrib/paramiko/tasks.py#L28-L42 | ||
spulec/moto | a688c0032596a7dfef122b69a08f2bec3be2e481 | moto/utilities/tagging_service.py | python | TaggingService.delete_all_tags_for_resource | (self, arn) | Delete all tags associated with given ARN. | Delete all tags associated with given ARN. | [
"Delete",
"all",
"tags",
"associated",
"with",
"given",
"ARN",
"."
] | def delete_all_tags_for_resource(self, arn):
"""Delete all tags associated with given ARN."""
if self.has_tags(arn):
del self.tags[arn] | [
"def",
"delete_all_tags_for_resource",
"(",
"self",
",",
"arn",
")",
":",
"if",
"self",
".",
"has_tags",
"(",
"arn",
")",
":",
"del",
"self",
".",
"tags",
"[",
"arn",
"]"
] | https://github.com/spulec/moto/blob/a688c0032596a7dfef122b69a08f2bec3be2e481/moto/utilities/tagging_service.py#L34-L37 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_namespace_spec.py | python | V1NamespaceSpec.finalizers | (self) | return self._finalizers | Gets the finalizers of this V1NamespaceSpec.
Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://git.k8s.io/community/contributors/design-proposals/namespaces.md#finalizers
:return: The finalizers of this V1NamespaceSpec.
:rtyp... | Gets the finalizers of this V1NamespaceSpec.
Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://git.k8s.io/community/contributors/design-proposals/namespaces.md#finalizers | [
"Gets",
"the",
"finalizers",
"of",
"this",
"V1NamespaceSpec",
".",
"Finalizers",
"is",
"an",
"opaque",
"list",
"of",
"values",
"that",
"must",
"be",
"empty",
"to",
"permanently",
"remove",
"object",
"from",
"storage",
".",
"More",
"info",
":",
"https",
":",
... | def finalizers(self):
"""
Gets the finalizers of this V1NamespaceSpec.
Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://git.k8s.io/community/contributors/design-proposals/namespaces.md#finalizers
:return: The finaliz... | [
"def",
"finalizers",
"(",
"self",
")",
":",
"return",
"self",
".",
"_finalizers"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_namespace_spec.py#L44-L52 | |
danecjensen/subscribely | 4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0 | src/werkzeug/contrib/sessions.py | python | SessionStore.new | (self) | return self.session_class({}, self.generate_key(), True) | Generate a new session. | Generate a new session. | [
"Generate",
"a",
"new",
"session",
"."
] | def new(self):
"""Generate a new session."""
return self.session_class({}, self.generate_key(), True) | [
"def",
"new",
"(",
"self",
")",
":",
"return",
"self",
".",
"session_class",
"(",
"{",
"}",
",",
"self",
".",
"generate_key",
"(",
")",
",",
"True",
")"
] | https://github.com/danecjensen/subscribely/blob/4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0/src/werkzeug/contrib/sessions.py#L162-L164 | |
smiley/steamapi | eb1cf49ecabc2de892f6581168a84c07a19cb36f | steamapi/user.py | python | SteamUser.time_created | (self) | return datetime.datetime.fromtimestamp(self._summary.timecreated) | :rtype: datetime | :rtype: datetime | [
":",
"rtype",
":",
"datetime"
] | def time_created(self):
"""
:rtype: datetime
"""
return datetime.datetime.fromtimestamp(self._summary.timecreated) | [
"def",
"time_created",
"(",
"self",
")",
":",
"return",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"self",
".",
"_summary",
".",
"timecreated",
")"
] | https://github.com/smiley/steamapi/blob/eb1cf49ecabc2de892f6581168a84c07a19cb36f/steamapi/user.py#L277-L281 | |
NVIDIA/hpc-container-maker | 6780d3ba048fc986d45e3b79a8af97c013824aa7 | hpccm/building_blocks/cgns.py | python | cgns.__distro | (self) | Based on the Linux distribution, set values accordingly. A user
specified value overrides any defaults. | Based on the Linux distribution, set values accordingly. A user
specified value overrides any defaults. | [
"Based",
"on",
"the",
"Linux",
"distribution",
"set",
"values",
"accordingly",
".",
"A",
"user",
"specified",
"value",
"overrides",
"any",
"defaults",
"."
] | def __distro(self):
"""Based on the Linux distribution, set values accordingly. A user
specified value overrides any defaults."""
if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
if not self.__ospackages:
self.__ospackages = ['file', 'make', 'wget', 'zlib1g-de... | [
"def",
"__distro",
"(",
"self",
")",
":",
"if",
"hpccm",
".",
"config",
".",
"g_linux_distro",
"==",
"linux_distro",
".",
"UBUNTU",
":",
"if",
"not",
"self",
".",
"__ospackages",
":",
"self",
".",
"__ospackages",
"=",
"[",
"'file'",
",",
"'make'",
",",
... | https://github.com/NVIDIA/hpc-container-maker/blob/6780d3ba048fc986d45e3b79a8af97c013824aa7/hpccm/building_blocks/cgns.py#L155-L171 | ||
oddt/oddt | 8cf555820d97a692ade81c101ebe10e28bcb3722 | oddt/scoring/__init__.py | python | ensemble_descriptor.__init__ | (self, descriptor_generators) | Proxy class to build an ensemble of destriptors with an API as one
Parameters
----------
models: array
An array of models | Proxy class to build an ensemble of destriptors with an API as one | [
"Proxy",
"class",
"to",
"build",
"an",
"ensemble",
"of",
"destriptors",
"with",
"an",
"API",
"as",
"one"
] | def __init__(self, descriptor_generators):
"""Proxy class to build an ensemble of destriptors with an API as one
Parameters
----------
models: array
An array of models
"""
self._desc_gens = (descriptor_generators if len(descriptor_generators)
... | [
"def",
"__init__",
"(",
"self",
",",
"descriptor_generators",
")",
":",
"self",
".",
"_desc_gens",
"=",
"(",
"descriptor_generators",
"if",
"len",
"(",
"descriptor_generators",
")",
"else",
"None",
")",
"self",
".",
"titles",
"=",
"list",
"(",
"chain",
"(",
... | https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/scoring/__init__.py#L406-L417 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_user.py | python | OpenShiftCLI._replace_content | (self, resource, rname, content, edits=None, force=False, sep='.') | return {'returncode': 0, 'updated': False} | replace the current object with the content | replace the current object with the content | [
"replace",
"the",
"current",
"object",
"with",
"the",
"content"
] | def _replace_content(self, resource, rname, content, edits=None, force=False, sep='.'):
''' replace the current object with the content '''
res = self._get(resource, rname)
if not res['results']:
return res
fname = Utils.create_tmpfile(rname + '-')
yed = Yedit(fname... | [
"def",
"_replace_content",
"(",
"self",
",",
"resource",
",",
"rname",
",",
"content",
",",
"edits",
"=",
"None",
",",
"force",
"=",
"False",
",",
"sep",
"=",
"'.'",
")",
":",
"res",
"=",
"self",
".",
"_get",
"(",
"resource",
",",
"rname",
")",
"if... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_user.py#L944-L975 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventTypeArg.is_paper_content_create | (self) | return self._tag == 'paper_content_create' | Check if the union tag is ``paper_content_create``.
:rtype: bool | Check if the union tag is ``paper_content_create``. | [
"Check",
"if",
"the",
"union",
"tag",
"is",
"paper_content_create",
"."
] | def is_paper_content_create(self):
"""
Check if the union tag is ``paper_content_create``.
:rtype: bool
"""
return self._tag == 'paper_content_create' | [
"def",
"is_paper_content_create",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
"==",
"'paper_content_create'"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L41303-L41309 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/priorities/tasks/velocity/postural.py | python | PosturalTask.x_desired | (self) | return self._q_d | Get the desired joint positions. | Get the desired joint positions. | [
"Get",
"the",
"desired",
"joint",
"positions",
"."
] | def x_desired(self):
"""Get the desired joint positions."""
return self._q_d | [
"def",
"x_desired",
"(",
"self",
")",
":",
"return",
"self",
".",
"_q_d"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/priorities/tasks/velocity/postural.py#L124-L126 | |
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/modules/common/structures/partitioning.py | python | PartitioningRequest.pbkdf_memory | (self, memory: Int) | Set the memory cost for PBKDF.
:param memory: the memory cost in kilobytes | Set the memory cost for PBKDF. | [
"Set",
"the",
"memory",
"cost",
"for",
"PBKDF",
"."
] | def pbkdf_memory(self, memory: Int):
"""Set the memory cost for PBKDF.
:param memory: the memory cost in kilobytes
"""
self._pbkdf_memory = memory | [
"def",
"pbkdf_memory",
"(",
"self",
",",
"memory",
":",
"Int",
")",
":",
"self",
".",
"_pbkdf_memory",
"=",
"memory"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/common/structures/partitioning.py#L175-L180 | ||
linkchecker/linkchecker | d1078ed8480e5cfc4264d0dbf026b45b45aede4d | linkcheck/checker/httpurl.py | python | HttpUrl.content_allows_robots | (self) | return not soup.find("meta", attrs={"name": "robots", "content": nofollow_re}) | Return False if the content of this URL forbids robots to
search for recursive links. | Return False if the content of this URL forbids robots to
search for recursive links. | [
"Return",
"False",
"if",
"the",
"content",
"of",
"this",
"URL",
"forbids",
"robots",
"to",
"search",
"for",
"recursive",
"links",
"."
] | def content_allows_robots(self):
"""
Return False if the content of this URL forbids robots to
search for recursive links.
"""
if not self.is_html():
return True
soup = self.get_soup()
return not soup.find("meta", attrs={"name": "robots", "content": n... | [
"def",
"content_allows_robots",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_html",
"(",
")",
":",
"return",
"True",
"soup",
"=",
"self",
".",
"get_soup",
"(",
")",
"return",
"not",
"soup",
".",
"find",
"(",
"\"meta\"",
",",
"attrs",
"=",
"{"... | https://github.com/linkchecker/linkchecker/blob/d1078ed8480e5cfc4264d0dbf026b45b45aede4d/linkcheck/checker/httpurl.py#L88-L97 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | examples/research_projects/seq2seq-distillation/utils.py | python | any_requires_grad | (model: nn.Module) | return any(grad_status(model)) | [] | def any_requires_grad(model: nn.Module) -> bool:
return any(grad_status(model)) | [
"def",
"any_requires_grad",
"(",
"model",
":",
"nn",
".",
"Module",
")",
"->",
"bool",
":",
"return",
"any",
"(",
"grad_status",
"(",
"model",
")",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/seq2seq-distillation/utils.py#L569-L570 | |||
RiskSense-Ops/CVE-2016-6366 | 0ba7426a9bf2a01c807608b7e1b63f87fe2699a5 | extrabacon-2.0/scapy/layers/inet6.py | python | defragment6 | (pktlist) | return IPv6(str(q)) | Performs defragmentation of a list of IPv6 packets. Packets are reordered.
Crap is dropped. What lacks is completed by 'X' characters. | Performs defragmentation of a list of IPv6 packets. Packets are reordered.
Crap is dropped. What lacks is completed by 'X' characters. | [
"Performs",
"defragmentation",
"of",
"a",
"list",
"of",
"IPv6",
"packets",
".",
"Packets",
"are",
"reordered",
".",
"Crap",
"is",
"dropped",
".",
"What",
"lacks",
"is",
"completed",
"by",
"X",
"characters",
"."
] | def defragment6(pktlist):
"""
Performs defragmentation of a list of IPv6 packets. Packets are reordered.
Crap is dropped. What lacks is completed by 'X' characters.
"""
l = filter(lambda x: IPv6ExtHdrFragment in x, pktlist) # remove non fragments
if not l:
return []
id = l[0][I... | [
"def",
"defragment6",
"(",
"pktlist",
")",
":",
"l",
"=",
"filter",
"(",
"lambda",
"x",
":",
"IPv6ExtHdrFragment",
"in",
"x",
",",
"pktlist",
")",
"# remove non fragments",
"if",
"not",
"l",
":",
"return",
"[",
"]",
"id",
"=",
"l",
"[",
"0",
"]",
"["... | https://github.com/RiskSense-Ops/CVE-2016-6366/blob/0ba7426a9bf2a01c807608b7e1b63f87fe2699a5/extrabacon-2.0/scapy/layers/inet6.py#L891-L940 | |
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | openWrt/files/usr/lib/python2.7/site-packages/tornado/concurrent.py | python | _DummyFuture._set_done | (self) | [] | def _set_done(self):
self._done = True
for cb in self._callbacks:
# TODO: error handling
cb(self)
self._callbacks = None | [
"def",
"_set_done",
"(",
"self",
")",
":",
"self",
".",
"_done",
"=",
"True",
"for",
"cb",
"in",
"self",
".",
"_callbacks",
":",
"# TODO: error handling",
"cb",
"(",
"self",
")",
"self",
".",
"_callbacks",
"=",
"None"
] | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/tornado/concurrent.py#L93-L98 | ||||
cloudant/bigcouch | 8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe | couchjs/scons/scons-local-2.0.1/SCons/Environment.py | python | SubstitutionEnvironment.Override | (self, overrides) | return env | Produce a modified environment whose variables are overriden by
the overrides dictionaries. "overrides" is a dictionary that
will override the variables of this environment.
This function is much more efficient than Clone() or creating
a new Environment because it doesn't copy the cons... | Produce a modified environment whose variables are overriden by
the overrides dictionaries. "overrides" is a dictionary that
will override the variables of this environment. | [
"Produce",
"a",
"modified",
"environment",
"whose",
"variables",
"are",
"overriden",
"by",
"the",
"overrides",
"dictionaries",
".",
"overrides",
"is",
"a",
"dictionary",
"that",
"will",
"override",
"the",
"variables",
"of",
"this",
"environment",
"."
] | def Override(self, overrides):
"""
Produce a modified environment whose variables are overriden by
the overrides dictionaries. "overrides" is a dictionary that
will override the variables of this environment.
This function is much more efficient than Clone() or creating
... | [
"def",
"Override",
"(",
"self",
",",
"overrides",
")",
":",
"if",
"not",
"overrides",
":",
"return",
"self",
"o",
"=",
"copy_non_reserved_keywords",
"(",
"overrides",
")",
"if",
"not",
"o",
":",
"return",
"self",
"overrides",
"=",
"{",
"}",
"merges",
"="... | https://github.com/cloudant/bigcouch/blob/8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe/couchjs/scons/scons-local-2.0.1/SCons/Environment.py#L612-L636 | |
geopy/geopy | af0eedcfeb4e3eec88f19e2f822e7f14ac3468eb | geopy/units.py | python | meters | (kilometers=0, miles=0, feet=0, nautical=0) | return (kilometers + km(nautical=nautical, miles=miles, feet=feet)) * 1000 | Convert distance to meters. | Convert distance to meters. | [
"Convert",
"distance",
"to",
"meters",
"."
] | def meters(kilometers=0, miles=0, feet=0, nautical=0):
"""
Convert distance to meters.
"""
return (kilometers + km(nautical=nautical, miles=miles, feet=feet)) * 1000 | [
"def",
"meters",
"(",
"kilometers",
"=",
"0",
",",
"miles",
"=",
"0",
",",
"feet",
"=",
"0",
",",
"nautical",
"=",
"0",
")",
":",
"return",
"(",
"kilometers",
"+",
"km",
"(",
"nautical",
"=",
"nautical",
",",
"miles",
"=",
"miles",
",",
"feet",
"... | https://github.com/geopy/geopy/blob/af0eedcfeb4e3eec88f19e2f822e7f14ac3468eb/geopy/units.py#L77-L81 | |
elfi-dev/elfi | 07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c | elfi/examples/gauss.py | python | ss_var | (y) | return ss | Return the variance summary statistic.
Parameters
----------
y : array_like
Yielded points.
Returns
-------
array_like of the shape (batch_size, dim_point) | Return the variance summary statistic. | [
"Return",
"the",
"variance",
"summary",
"statistic",
"."
] | def ss_var(y):
"""Return the variance summary statistic.
Parameters
----------
y : array_like
Yielded points.
Returns
-------
array_like of the shape (batch_size, dim_point)
"""
ss = np.var(y, axis=1)
return ss | [
"def",
"ss_var",
"(",
"y",
")",
":",
"ss",
"=",
"np",
".",
"var",
"(",
"y",
",",
"axis",
"=",
"1",
")",
"return",
"ss"
] | https://github.com/elfi-dev/elfi/blob/07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c/elfi/examples/gauss.py#L159-L173 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/wagtailadmin/widgets.py | python | AdminPageChooser.__init__ | (self, target_models=None, can_choose_root=False, user_perms=None, **kwargs) | [] | def __init__(self, target_models=None, can_choose_root=False, user_perms=None, **kwargs):
super(AdminPageChooser, self).__init__(**kwargs)
if target_models:
models = ', '.join([model._meta.verbose_name.title() for model in target_models if model is not Page])
if models:
... | [
"def",
"__init__",
"(",
"self",
",",
"target_models",
"=",
"None",
",",
"can_choose_root",
"=",
"False",
",",
"user_perms",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"AdminPageChooser",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailadmin/widgets.py#L158-L168 | ||||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Tools/gdb/libpython.py | python | PyDictObjectPtr.iteritems | (self) | Yields a sequence of (PyObjectPtr key, PyObjectPtr value) pairs,
analogous to dict.iteritems() | Yields a sequence of (PyObjectPtr key, PyObjectPtr value) pairs,
analogous to dict.iteritems() | [
"Yields",
"a",
"sequence",
"of",
"(",
"PyObjectPtr",
"key",
"PyObjectPtr",
"value",
")",
"pairs",
"analogous",
"to",
"dict",
".",
"iteritems",
"()"
] | def iteritems(self):
'''
Yields a sequence of (PyObjectPtr key, PyObjectPtr value) pairs,
analogous to dict.iteritems()
'''
keys = self.field('ma_keys')
values = self.field('ma_values')
for i in safe_range(keys['dk_size']):
ep = keys['dk_entries'].addr... | [
"def",
"iteritems",
"(",
"self",
")",
":",
"keys",
"=",
"self",
".",
"field",
"(",
"'ma_keys'",
")",
"values",
"=",
"self",
".",
"field",
"(",
"'ma_values'",
")",
"for",
"i",
"in",
"safe_range",
"(",
"keys",
"[",
"'dk_size'",
"]",
")",
":",
"ep",
"... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Tools/gdb/libpython.py#L649-L664 | ||
ioflo/ioflo | 177ac656d7c4ff801aebb0d8b401db365a5248ce | ioflo/aid/vectoring.py | python | mag2 | (v) | return (sum(e*e for e in v)) | Returns the magnitude squared of vector v | Returns the magnitude squared of vector v | [
"Returns",
"the",
"magnitude",
"squared",
"of",
"vector",
"v"
] | def mag2(v):
"""
Returns the magnitude squared of vector v
"""
return (sum(e*e for e in v)) | [
"def",
"mag2",
"(",
"v",
")",
":",
"return",
"(",
"sum",
"(",
"e",
"*",
"e",
"for",
"e",
"in",
"v",
")",
")"
] | https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/aid/vectoring.py#L27-L31 | |
ClementPinard/Pytorch-Correlation-extension | 3e8ce16124844cd7892ec965cf0ad18fdd8e6a02 | check.py | python | get_grads | (variables) | return [var.grad.clone() for var in variables] | [] | def get_grads(variables):
return [var.grad.clone() for var in variables] | [
"def",
"get_grads",
"(",
"variables",
")",
":",
"return",
"[",
"var",
".",
"grad",
".",
"clone",
"(",
")",
"for",
"var",
"in",
"variables",
"]"
] | https://github.com/ClementPinard/Pytorch-Correlation-extension/blob/3e8ce16124844cd7892ec965cf0ad18fdd8e6a02/check.py#L29-L30 | |||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | release/fabfile.py | python | get_previous_version_tag | () | Get the version of the previous release | Get the version of the previous release | [
"Get",
"the",
"version",
"of",
"the",
"previous",
"release"
] | def get_previous_version_tag():
"""
Get the version of the previous release
"""
# We try, probably too hard, to portably get the number of the previous
# release of SymPy. Our strategy is to look at the git tags. The
# following assumptions are made about the git tags:
# - The only tags ar... | [
"def",
"get_previous_version_tag",
"(",
")",
":",
"# We try, probably too hard, to portably get the number of the previous",
"# release of SymPy. Our strategy is to look at the git tags. The",
"# following assumptions are made about the git tags:",
"# - The only tags are for releases",
"# - The t... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/release/fabfile.py#L644-L679 | ||
uqfoundation/pathos | 6d9b8cb1717a36eb72cb8c328f6c12b2326413ac | pathos/hosts.py | python | get_profiles | () | return _profiles | get $PROFILE for each registered host | get $PROFILE for each registered host | [
"get",
"$PROFILE",
"for",
"each",
"registered",
"host"
] | def get_profiles():
'''get $PROFILE for each registered host'''
return _profiles | [
"def",
"get_profiles",
"(",
")",
":",
"return",
"_profiles"
] | https://github.com/uqfoundation/pathos/blob/6d9b8cb1717a36eb72cb8c328f6c12b2326413ac/pathos/hosts.py#L34-L36 | |
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/containeractions.py | python | UnrenderedCreationThread.progress_thread_complete | (self, dialog, some_number) | [] | def progress_thread_complete(self, dialog, some_number):
# Gdk.threads_enter() is done before this is called from "motion_progress_update" thread.
dialog.destroy() | [
"def",
"progress_thread_complete",
"(",
"self",
",",
"dialog",
",",
"some_number",
")",
":",
"# Gdk.threads_enter() is done before this is called from \"motion_progress_update\" thread.",
"dialog",
".",
"destroy",
"(",
")"
] | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/containeractions.py#L1191-L1193 | ||||
Pylons/pyramid_cookbook | 19b62fb7c36a2b8c5866df784fda0ccd04805995 | docs/traversal_tutorial/zodb/tutorial/views.py | python | TutorialViews.add_document | (self) | return HTTPFound(location=url) | [] | def add_document(self):
# Make a new Document
title = self.request.POST['document_title']
name = str(randint(0, 999999))
new_document = Document(title)
new_document.__name__ = name
new_document.__parent__ = self.context
self.context[name] = new_document
#... | [
"def",
"add_document",
"(",
"self",
")",
":",
"# Make a new Document",
"title",
"=",
"self",
".",
"request",
".",
"POST",
"[",
"'document_title'",
"]",
"name",
"=",
"str",
"(",
"randint",
"(",
"0",
",",
"999999",
")",
")",
"new_document",
"=",
"Document",
... | https://github.com/Pylons/pyramid_cookbook/blob/19b62fb7c36a2b8c5866df784fda0ccd04805995/docs/traversal_tutorial/zodb/tutorial/views.py#L47-L58 | |||
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py | python | LegacyMetadata._default_value | (self, name) | return 'UNKNOWN' | [] | def _default_value(self, name):
if name in _LISTFIELDS or name in _ELEMENTSFIELD:
return []
return 'UNKNOWN' | [
"def",
"_default_value",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"_LISTFIELDS",
"or",
"name",
"in",
"_ELEMENTSFIELD",
":",
"return",
"[",
"]",
"return",
"'UNKNOWN'"
] | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py#L293-L296 | |||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/statistics/distribution.py | python | Discrete.__idiv__ | (self, other) | return self | [] | def __idiv__(self, other):
super().__imul__(other)
if isinstance(other, Real):
self.unknowns /= other
return self | [
"def",
"__idiv__",
"(",
"self",
",",
"other",
")",
":",
"super",
"(",
")",
".",
"__imul__",
"(",
"other",
")",
"if",
"isinstance",
"(",
"other",
",",
"Real",
")",
":",
"self",
".",
"unknowns",
"/=",
"other",
"return",
"self"
] | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/statistics/distribution.py#L214-L218 | |||
caffeinehit/django-oauth2-provider | 6b5bc0d3ad706d2aaa47fa476f38406cddd01236 | provider/views.py | python | Authorize.get_authorization_form | (self, request, client, data, client_data) | Return a form that is capable of authorizing the client to the resource
owner.
:return: :attr:`django.forms.Form` | Return a form that is capable of authorizing the client to the resource
owner. | [
"Return",
"a",
"form",
"that",
"is",
"capable",
"of",
"authorizing",
"the",
"client",
"to",
"the",
"resource",
"owner",
"."
] | def get_authorization_form(self, request, client, data, client_data):
"""
Return a form that is capable of authorizing the client to the resource
owner.
:return: :attr:`django.forms.Form`
"""
raise NotImplementedError | [
"def",
"get_authorization_form",
"(",
"self",
",",
"request",
",",
"client",
",",
"data",
",",
"client_data",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/caffeinehit/django-oauth2-provider/blob/6b5bc0d3ad706d2aaa47fa476f38406cddd01236/provider/views.py#L172-L179 | ||
dreadatour/Flake8Lint | 8703c5633ac3fab4bd116da82aae7ff7bbc795c0 | Flake8Lint.py | python | log | (msg, level=None) | Log to ST python console.
If log level 'debug' (or None) print only if debug setting is enabled. | Log to ST python console. | [
"Log",
"to",
"ST",
"python",
"console",
"."
] | def log(msg, level=None):
"""Log to ST python console.
If log level 'debug' (or None) print only if debug setting is enabled.
"""
if level is None:
level = 'debug'
if level == 'debug' and not settings.debug:
return
print("[Flake8Lint {0}] {1}".format(level.upper(), msg)) | [
"def",
"log",
"(",
"msg",
",",
"level",
"=",
"None",
")",
":",
"if",
"level",
"is",
"None",
":",
"level",
"=",
"'debug'",
"if",
"level",
"==",
"'debug'",
"and",
"not",
"settings",
".",
"debug",
":",
"return",
"print",
"(",
"\"[Flake8Lint {0}] {1}\"",
"... | https://github.com/dreadatour/Flake8Lint/blob/8703c5633ac3fab4bd116da82aae7ff7bbc795c0/Flake8Lint.py#L242-L253 | ||
tmr232/Sark | bf961ec840530e16eac7a9027d2115276ee52387 | sark/code/instruction.py | python | Operand.size | (self) | return base.dtype_to_size(self._operand.dtype) | Size of the operand. | Size of the operand. | [
"Size",
"of",
"the",
"operand",
"."
] | def size(self):
"""Size of the operand."""
return base.dtype_to_size(self._operand.dtype) | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"base",
".",
"dtype_to_size",
"(",
"self",
".",
"_operand",
".",
"dtype",
")"
] | https://github.com/tmr232/Sark/blob/bf961ec840530e16eac7a9027d2115276ee52387/sark/code/instruction.py#L250-L252 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/email/_header_value_parser.py | python | _get_ptext_to_endchars | (value, endchars) | return ''.join(vchars), ''.join([fragment[pos:]] + remainder), had_qp | Scan printables/quoted-pairs until endchars and return unquoted ptext.
This function turns a run of qcontent, ccontent-without-comments, or
dtext-with-quoted-printables into a single string by unquoting any
quoted printables. It returns the string, the remaining value, and
a flag that is True iff ther... | Scan printables/quoted-pairs until endchars and return unquoted ptext. | [
"Scan",
"printables",
"/",
"quoted",
"-",
"pairs",
"until",
"endchars",
"and",
"return",
"unquoted",
"ptext",
"."
] | def _get_ptext_to_endchars(value, endchars):
"""Scan printables/quoted-pairs until endchars and return unquoted ptext.
This function turns a run of qcontent, ccontent-without-comments, or
dtext-with-quoted-printables into a single string by unquoting any
quoted printables. It returns the string, the r... | [
"def",
"_get_ptext_to_endchars",
"(",
"value",
",",
"endchars",
")",
":",
"fragment",
",",
"",
"*",
"remainder",
"=",
"_wsp_splitter",
"(",
"value",
",",
"1",
")",
"vchars",
"=",
"[",
"]",
"escape",
"=",
"False",
"had_qp",
"=",
"False",
"for",
"pos",
"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/email/_header_value_parser.py#L970-L998 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/functions/elementary/exponential.py | python | ExpBase.inverse | (self, argindex=1) | return log | Returns the inverse function of ``exp(x)``. | Returns the inverse function of ``exp(x)``. | [
"Returns",
"the",
"inverse",
"function",
"of",
"exp",
"(",
"x",
")",
"."
] | def inverse(self, argindex=1):
"""
Returns the inverse function of ``exp(x)``.
"""
return log | [
"def",
"inverse",
"(",
"self",
",",
"argindex",
"=",
"1",
")",
":",
"return",
"log"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/functions/elementary/exponential.py#L31-L35 | |
cbrgm/telegram-robot-rss | 58fe98de427121fdc152c8df0721f1891174e6c9 | venv/lib/python2.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py | python | HTTPConnectionPool.urlopen | (self, method, url, body=None, headers=None, retries=None,
redirect=True, assert_same_host=True, timeout=_Default,
pool_timeout=None, release_conn=None, chunked=False,
body_pos=None, **response_kw) | return response | Get a connection from the pool and perform an HTTP request. This is the
lowest level call for making a request, so you'll need to specify all
the raw details.
.. note::
More commonly, it's appropriate to use a convenience method provided
by :class:`.RequestMethods`, such ... | Get a connection from the pool and perform an HTTP request. This is the
lowest level call for making a request, so you'll need to specify all
the raw details. | [
"Get",
"a",
"connection",
"from",
"the",
"pool",
"and",
"perform",
"an",
"HTTP",
"request",
".",
"This",
"is",
"the",
"lowest",
"level",
"call",
"for",
"making",
"a",
"request",
"so",
"you",
"ll",
"need",
"to",
"specify",
"all",
"the",
"raw",
"details",
... | def urlopen(self, method, url, body=None, headers=None, retries=None,
redirect=True, assert_same_host=True, timeout=_Default,
pool_timeout=None, release_conn=None, chunked=False,
body_pos=None, **response_kw):
"""
Get a connection from the pool and perform... | [
"def",
"urlopen",
"(",
"self",
",",
"method",
",",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"retries",
"=",
"None",
",",
"redirect",
"=",
"True",
",",
"assert_same_host",
"=",
"True",
",",
"timeout",
"=",
"_Default",
",",
"p... | https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py#L463-L745 | |
Kronuz/esprima-python | 809cb6e257b1d3d5b0d23f2bca7976e21f02fc3d | esprima/scanner.py | python | Scanner.scanStringLiteral | (self) | return RawToken(
type=Token.StringLiteral,
value=str,
octal=octal,
lineNumber=self.lineNumber,
lineStart=self.lineStart,
start=start,
end=self.index
) | [] | def scanStringLiteral(self):
start = self.index
quote = self.source[start]
assert quote in ('\'', '"'), 'String literal must starts with a quote'
self.index += 1
octal = False
str = ''
while not self.eof():
ch = self.source[self.index]
se... | [
"def",
"scanStringLiteral",
"(",
"self",
")",
":",
"start",
"=",
"self",
".",
"index",
"quote",
"=",
"self",
".",
"source",
"[",
"start",
"]",
"assert",
"quote",
"in",
"(",
"'\\''",
",",
"'\"'",
")",
",",
"'String literal must starts with a quote'",
"self",
... | https://github.com/Kronuz/esprima-python/blob/809cb6e257b1d3d5b0d23f2bca7976e21f02fc3d/esprima/scanner.py#L801-L890 | |||
OpenMDAO/OpenMDAO-Framework | f2e37b7de3edeaaeb2d251b375917adec059db9b | openmdao.main/src/openmdao/main/resource.py | python | ResourceAllocationManager.add_allocator | (allocator) | Add an allocator to the list of resource allocators.
allocator: ResourceAllocator
The allocator to be added. | Add an allocator to the list of resource allocators. | [
"Add",
"an",
"allocator",
"to",
"the",
"list",
"of",
"resource",
"allocators",
"."
] | def add_allocator(allocator):
"""
Add an allocator to the list of resource allocators.
allocator: ResourceAllocator
The allocator to be added.
"""
ram = ResourceAllocationManager._get_instance()
with ResourceAllocationManager._lock:
name = allocat... | [
"def",
"add_allocator",
"(",
"allocator",
")",
":",
"ram",
"=",
"ResourceAllocationManager",
".",
"_get_instance",
"(",
")",
"with",
"ResourceAllocationManager",
".",
"_lock",
":",
"name",
"=",
"allocator",
".",
"name",
"for",
"alloc",
"in",
"ram",
".",
"_allo... | https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.main/src/openmdao/main/resource.py#L221-L234 | ||
machinalis/quepy | c0a83fab9b11056f6951ee65046a72ac5d025136 | quepy/quepyapp.py | python | QuepyApp._save_settings_values | (self) | Persists the settings values of the app to the settings module
so it can be accesible from another part of the software. | Persists the settings values of the app to the settings module
so it can be accesible from another part of the software. | [
"Persists",
"the",
"settings",
"values",
"of",
"the",
"app",
"to",
"the",
"settings",
"module",
"so",
"it",
"can",
"be",
"accesible",
"from",
"another",
"part",
"of",
"the",
"software",
"."
] | def _save_settings_values(self):
"""
Persists the settings values of the app to the settings module
so it can be accesible from another part of the software.
"""
for key in dir(self._settings_module):
if key.upper() == key:
value = getattr(self._setti... | [
"def",
"_save_settings_values",
"(",
"self",
")",
":",
"for",
"key",
"in",
"dir",
"(",
"self",
".",
"_settings_module",
")",
":",
"if",
"key",
".",
"upper",
"(",
")",
"==",
"key",
":",
"value",
"=",
"getattr",
"(",
"self",
".",
"_settings_module",
",",... | https://github.com/machinalis/quepy/blob/c0a83fab9b11056f6951ee65046a72ac5d025136/quepy/quepyapp.py#L151-L162 | ||
lpty/tensorflow_tutorial | 5369e34ef0af4133547327514e1f4d3db998dfb6 | captchaCnn/cnn_train.py | python | train | (height=CAPTCHA_HEIGHT, width=CAPTCHA_WIDTH, y_size=len(CAPTCHA_LIST)*CAPTCHA_LEN) | cnn训练
:param height:
:param width:
:param y_size:
:return: | cnn训练
:param height:
:param width:
:param y_size:
:return: | [
"cnn训练",
":",
"param",
"height",
":",
":",
"param",
"width",
":",
":",
"param",
"y_size",
":",
":",
"return",
":"
] | def train(height=CAPTCHA_HEIGHT, width=CAPTCHA_WIDTH, y_size=len(CAPTCHA_LIST)*CAPTCHA_LEN):
'''
cnn训练
:param height:
:param width:
:param y_size:
:return:
'''
# cnn在图像大小是2的倍数时性能最高, 如果图像大小不是2的倍数,可以在图像边缘补无用像素
# 在图像上补2行,下补3行,左补2行,右补2行
# np.pad(image,((2,3),(2,2)), 'constant', const... | [
"def",
"train",
"(",
"height",
"=",
"CAPTCHA_HEIGHT",
",",
"width",
"=",
"CAPTCHA_WIDTH",
",",
"y_size",
"=",
"len",
"(",
"CAPTCHA_LIST",
")",
"*",
"CAPTCHA_LEN",
")",
":",
"# cnn在图像大小是2的倍数时性能最高, 如果图像大小不是2的倍数,可以在图像边缘补无用像素",
"# 在图像上补2行,下补3行,左补2行,右补2行",
"# np.pad(image,((... | https://github.com/lpty/tensorflow_tutorial/blob/5369e34ef0af4133547327514e1f4d3db998dfb6/captchaCnn/cnn_train.py#L141-L185 | ||
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/pycparser/c_parser.py | python | CParser.p_primary_expression_2 | (self, p) | primary_expression : constant | primary_expression : constant | [
"primary_expression",
":",
"constant"
] | def p_primary_expression_2(self, p):
""" primary_expression : constant """
p[0] = p[1] | [
"def",
"p_primary_expression_2",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]"
] | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/pycparser/c_parser.py#L1572-L1574 | ||
hasanirtiza/Pedestron | 3bdcf8476edc0741f28a80dd4cb161ac532507ee | tools/ECPB/statistics.py | python | MrFppiMultiPlot.add_result | (self, result, label, linestyle=None, color=None, linewidth=None) | return self | [] | def add_result(self, result, label, linestyle=None, color=None, linewidth=None):
mr_fppi = MrFppi(result)
score = self.score_method(mr_fppi) if self.append_score_to_label else None
self.__helper.add_plot(mr_fppi.fppi, mr_fppi.mr, label=label, score=score,
linestyl... | [
"def",
"add_result",
"(",
"self",
",",
"result",
",",
"label",
",",
"linestyle",
"=",
"None",
",",
"color",
"=",
"None",
",",
"linewidth",
"=",
"None",
")",
":",
"mr_fppi",
"=",
"MrFppi",
"(",
"result",
")",
"score",
"=",
"self",
".",
"score_method",
... | https://github.com/hasanirtiza/Pedestron/blob/3bdcf8476edc0741f28a80dd4cb161ac532507ee/tools/ECPB/statistics.py#L78-L84 | |||
dmis-lab/biobert | 036f683797251328893b8f1dd6b0a3f5af29c922 | modeling.py | python | embedding_lookup | (input_ids,
vocab_size,
embedding_size=128,
initializer_range=0.02,
word_embedding_name="word_embeddings",
use_one_hot_embeddings=False) | return (output, embedding_table) | Looks up words embeddings for id tensor.
Args:
input_ids: int32 Tensor of shape [batch_size, seq_length] containing word
ids.
vocab_size: int. Size of the embedding vocabulary.
embedding_size: int. Width of the word embeddings.
initializer_range: float. Embedding initialization range.
word_... | Looks up words embeddings for id tensor. | [
"Looks",
"up",
"words",
"embeddings",
"for",
"id",
"tensor",
"."
] | def embedding_lookup(input_ids,
vocab_size,
embedding_size=128,
initializer_range=0.02,
word_embedding_name="word_embeddings",
use_one_hot_embeddings=False):
"""Looks up words embeddings for id tensor.
Args:
... | [
"def",
"embedding_lookup",
"(",
"input_ids",
",",
"vocab_size",
",",
"embedding_size",
"=",
"128",
",",
"initializer_range",
"=",
"0.02",
",",
"word_embedding_name",
"=",
"\"word_embeddings\"",
",",
"use_one_hot_embeddings",
"=",
"False",
")",
":",
"# This function as... | https://github.com/dmis-lab/biobert/blob/036f683797251328893b8f1dd6b0a3f5af29c922/modeling.py#L381-L427 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/distutils/ccompiler.py | python | CCompiler.library_dir_option | (self, dir) | Return the compiler option to add 'dir' to the list of
directories searched for libraries. | Return the compiler option to add 'dir' to the list of
directories searched for libraries. | [
"Return",
"the",
"compiler",
"option",
"to",
"add",
"dir",
"to",
"the",
"list",
"of",
"directories",
"searched",
"for",
"libraries",
"."
] | def library_dir_option(self, dir):
"""Return the compiler option to add 'dir' to the list of
directories searched for libraries.
"""
raise NotImplementedError | [
"def",
"library_dir_option",
"(",
"self",
",",
"dir",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/distutils/ccompiler.py#L742-L746 | ||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/plugins/bitbox02/qt.py | python | BitBox02_Handler._name_multisig_account | (self) | return name.text().strip() | [] | def _name_multisig_account(self):
dialog = WindowModalDialog(None, "Create Multisig Account")
vbox = QVBoxLayout()
label = QLabel(
_(
"Enter a descriptive name for your multisig account.\nYou should later be able to use the name to uniquely identify this multisig acco... | [
"def",
"_name_multisig_account",
"(",
"self",
")",
":",
"dialog",
"=",
"WindowModalDialog",
"(",
"None",
",",
"\"Create Multisig Account\"",
")",
"vbox",
"=",
"QVBoxLayout",
"(",
")",
"label",
"=",
"QLabel",
"(",
"_",
"(",
"\"Enter a descriptive name for your multis... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/plugins/bitbox02/qt.py#L92-L116 | |||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/trace.py | python | Trace.globaltrace_lt | (self, frame, why, arg) | Handler for call events.
If the code block being entered is to be ignored, returns `None',
else returns self.localtrace. | Handler for call events. | [
"Handler",
"for",
"call",
"events",
"."
] | def globaltrace_lt(self, frame, why, arg):
"""Handler for call events.
If the code block being entered is to be ignored, returns `None',
else returns self.localtrace.
"""
if why == 'call':
code = frame.f_code
filename = frame.f_globals.get('__file__', Non... | [
"def",
"globaltrace_lt",
"(",
"self",
",",
"frame",
",",
"why",
",",
"arg",
")",
":",
"if",
"why",
"==",
"'call'",
":",
"code",
"=",
"frame",
".",
"f_code",
"filename",
"=",
"frame",
".",
"f_globals",
".",
"get",
"(",
"'__file__'",
",",
"None",
")",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/trace.py#L598-L619 | ||
sosreport/sos | 900e8bea7f3cd36c1dd48f3cbb351ab92f766654 | sos/report/plugins/__init__.py | python | Plugin.get_process_pids | (self, process) | return pids | Get a list of all PIDs that match a specified name
:param process: The name of the process the get PIDs for
:type process: ``str``
:returns: A list of PIDs
:rtype: ``list`` | Get a list of all PIDs that match a specified name | [
"Get",
"a",
"list",
"of",
"all",
"PIDs",
"that",
"match",
"a",
"specified",
"name"
] | def get_process_pids(self, process):
"""Get a list of all PIDs that match a specified name
:param process: The name of the process the get PIDs for
:type process: ``str``
:returns: A list of PIDs
:rtype: ``list``
"""
pids = []
cmd_line_glob = "/proc... | [
"def",
"get_process_pids",
"(",
"self",
",",
"process",
")",
":",
"pids",
"=",
"[",
"]",
"cmd_line_glob",
"=",
"\"/proc/[0-9]*/cmdline\"",
"cmd_line_paths",
"=",
"glob",
".",
"glob",
"(",
"cmd_line_glob",
")",
"for",
"path",
"in",
"cmd_line_paths",
":",
"try",... | https://github.com/sosreport/sos/blob/900e8bea7f3cd36c1dd48f3cbb351ab92f766654/sos/report/plugins/__init__.py#L2929-L2949 | |
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/protocols/basic.py | python | IntNStringReceiver.dataReceived | (self, data) | Convert int prefixed strings into calls to stringReceived. | Convert int prefixed strings into calls to stringReceived. | [
"Convert",
"int",
"prefixed",
"strings",
"into",
"calls",
"to",
"stringReceived",
"."
] | def dataReceived(self, data):
"""
Convert int prefixed strings into calls to stringReceived.
"""
# Try to minimize string copying (via slices) by keeping one buffer
# containing all the data we have so far and a separate offset into that
# buffer.
alldata = self._... | [
"def",
"dataReceived",
"(",
"self",
",",
"data",
")",
":",
"# Try to minimize string copying (via slices) by keeping one buffer",
"# containing all the data we have so far and a separate offset into that",
"# buffer.",
"alldata",
"=",
"self",
".",
"_unprocessed",
"+",
"data",
"cu... | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/protocols/basic.py#L725-L772 | ||
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py | python | create_connection | (address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
source_address=None, socket_options=None) | Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the... | Connect to *address* and return the socket object. | [
"Connect",
"to",
"*",
"address",
"*",
"and",
"return",
"the",
"socket",
"object",
"."
] | def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
source_address=None, socket_options=None):
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the o... | [
"def",
"create_connection",
"(",
"address",
",",
"timeout",
"=",
"socket",
".",
"_GLOBAL_DEFAULT_TIMEOUT",
",",
"source_address",
"=",
"None",
",",
"socket_options",
"=",
"None",
")",
":",
"host",
",",
"port",
"=",
"address",
"if",
"host",
".",
"startswith",
... | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py#L49-L93 | ||
SFDO-Tooling/CumulusCI | 825ae1f122b25dc41761c52a4ddfa1938d2a4b6e | cumulusci/tasks/bulkdata/snowfakery.py | python | Snowfakery._loop | (
self,
template_path,
tempdir,
org_record_counts_thread,
portions: PortionGenerator,
) | return upload_status | The inner loop that controls when data is generated and when we are done. | The inner loop that controls when data is generated and when we are done. | [
"The",
"inner",
"loop",
"that",
"controls",
"when",
"data",
"is",
"generated",
"and",
"when",
"we",
"are",
"done",
"."
] | def _loop(
self,
template_path,
tempdir,
org_record_counts_thread,
portions: PortionGenerator,
):
"""The inner loop that controls when data is generated and when we are done."""
upload_status = self.get_upload_status(
portions.next_batch_size,
... | [
"def",
"_loop",
"(",
"self",
",",
"template_path",
",",
"tempdir",
",",
"org_record_counts_thread",
",",
"portions",
":",
"PortionGenerator",
",",
")",
":",
"upload_status",
"=",
"self",
".",
"get_upload_status",
"(",
"portions",
".",
"next_batch_size",
",",
")"... | https://github.com/SFDO-Tooling/CumulusCI/blob/825ae1f122b25dc41761c52a4ddfa1938d2a4b6e/cumulusci/tasks/bulkdata/snowfakery.py#L331-L365 | |
piergiaj/representation-flow-cvpr19 | b9dcb0a7750732210bccf84dbe6044cc33b48c17 | baseline_2d_resnets.py | python | resnet152 | (pretrained=False, **kwargs) | return model | Constructs a ResNet-152 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | Constructs a ResNet-152 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | [
"Constructs",
"a",
"ResNet",
"-",
"152",
"model",
".",
"Args",
":",
"pretrained",
"(",
"bool",
")",
":",
"If",
"True",
"returns",
"a",
"model",
"pre",
"-",
"trained",
"on",
"ImageNet"
] | def resnet152(pretrained=False, **kwargs):
"""Constructs a ResNet-152 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
"""
model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls['resnet152... | [
"def",
"resnet152",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"ResNet",
"(",
"Bottleneck",
",",
"[",
"3",
",",
"8",
",",
"36",
",",
"3",
"]",
",",
"*",
"*",
"kwargs",
")",
"if",
"pretrained",
":",
"model",
... | https://github.com/piergiaj/representation-flow-cvpr19/blob/b9dcb0a7750732210bccf84dbe6044cc33b48c17/baseline_2d_resnets.py#L255-L263 | |
alteryx/featuretools | d59e11082962f163540fd6e185901f65c506326a | featuretools/utils/cli_utils.py | python | get_featuretools_root | () | return os.path.dirname(featuretools.__file__) | [] | def get_featuretools_root():
return os.path.dirname(featuretools.__file__) | [
"def",
"get_featuretools_root",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"dirname",
"(",
"featuretools",
".",
"__file__",
")"
] | https://github.com/alteryx/featuretools/blob/d59e11082962f163540fd6e185901f65c506326a/featuretools/utils/cli_utils.py#L86-L87 | |||
PyCQA/astroid | a815443f62faae05249621a396dcf0afd884a619 | astroid/inference.py | python | infer_attribute | (self, context=None) | return dict(node=self, context=context) | infer an Attribute node by using getattr on the associated object | infer an Attribute node by using getattr on the associated object | [
"infer",
"an",
"Attribute",
"node",
"by",
"using",
"getattr",
"on",
"the",
"associated",
"object"
] | def infer_attribute(self, context=None):
"""infer an Attribute node by using getattr on the associated object"""
for owner in self.expr.infer(context):
if owner is util.Uninferable:
yield owner
continue
if not context:
context = InferenceContext()
ol... | [
"def",
"infer_attribute",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"for",
"owner",
"in",
"self",
".",
"expr",
".",
"infer",
"(",
"context",
")",
":",
"if",
"owner",
"is",
"util",
".",
"Uninferable",
":",
"yield",
"owner",
"continue",
"if",
... | https://github.com/PyCQA/astroid/blob/a815443f62faae05249621a396dcf0afd884a619/astroid/inference.py#L311-L333 | |
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | var/spack/repos/builtin/packages/hypre/package.py | python | Hypre.headers | (self) | return hdrs or None | Export the main hypre header, HYPRE.h; all other headers can be found
in the same directory.
Sample usage: spec['hypre'].headers.cpp_flags | Export the main hypre header, HYPRE.h; all other headers can be found
in the same directory.
Sample usage: spec['hypre'].headers.cpp_flags | [
"Export",
"the",
"main",
"hypre",
"header",
"HYPRE",
".",
"h",
";",
"all",
"other",
"headers",
"can",
"be",
"found",
"in",
"the",
"same",
"directory",
".",
"Sample",
"usage",
":",
"spec",
"[",
"hypre",
"]",
".",
"headers",
".",
"cpp_flags"
] | def headers(self):
"""Export the main hypre header, HYPRE.h; all other headers can be found
in the same directory.
Sample usage: spec['hypre'].headers.cpp_flags
"""
hdrs = find_headers('HYPRE', self.prefix.include, recursive=False)
return hdrs or None | [
"def",
"headers",
"(",
"self",
")",
":",
"hdrs",
"=",
"find_headers",
"(",
"'HYPRE'",
",",
"self",
".",
"prefix",
".",
"include",
",",
"recursive",
"=",
"False",
")",
"return",
"hdrs",
"or",
"None"
] | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/var/spack/repos/builtin/packages/hypre/package.py#L264-L270 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | calendarserver/tools/calverify.py | python | CalVerifyService.getAllResourceInfo | (self, inbox=False) | [] | def getAllResourceInfo(self, inbox=False):
co = schema.CALENDAR_OBJECT
cb = schema.CALENDAR_BIND
ch = schema.CALENDAR_HOME
if inbox:
cojoin = (cb.CALENDAR_RESOURCE_ID == co.CALENDAR_RESOURCE_ID).And(
cb.BIND_MODE == _BIND_MODE_OWN)
else:
c... | [
"def",
"getAllResourceInfo",
"(",
"self",
",",
"inbox",
"=",
"False",
")",
":",
"co",
"=",
"schema",
".",
"CALENDAR_OBJECT",
"cb",
"=",
"schema",
".",
"CALENDAR_BIND",
"ch",
"=",
"schema",
".",
"CALENDAR_HOME",
"if",
"inbox",
":",
"cojoin",
"=",
"(",
"cb... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tools/calverify.py#L483-L504 | ||||
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/operator.py | python | le | (a, b) | return a <= b | Same as a <= b. | Same as a <= b. | [
"Same",
"as",
"a",
"<",
"=",
"b",
"."
] | def le(a, b):
"Same as a <= b."
return a <= b | [
"def",
"le",
"(",
"a",
",",
"b",
")",
":",
"return",
"a",
"<=",
"b"
] | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/operator.py#L32-L34 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Hash/SHA3_384.py | python | SHA3_384_Hash.new | (self) | return type(self)(None, self._update_after_digest) | Create a fresh SHA3-384 hash object. | Create a fresh SHA3-384 hash object. | [
"Create",
"a",
"fresh",
"SHA3",
"-",
"384",
"hash",
"object",
"."
] | def new(self):
"""Create a fresh SHA3-384 hash object."""
return type(self)(None, self._update_after_digest) | [
"def",
"new",
"(",
"self",
")",
":",
"return",
"type",
"(",
"self",
")",
"(",
"None",
",",
"self",
".",
"_update_after_digest",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Hash/SHA3_384.py#L114-L117 | |
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/conpono/evals/run_squad.py | python | get_final_text | (pred_text, orig_text, do_lower_case) | return output_text | Project the tokenized prediction back to the original text. | Project the tokenized prediction back to the original text. | [
"Project",
"the",
"tokenized",
"prediction",
"back",
"to",
"the",
"original",
"text",
"."
] | def get_final_text(pred_text, orig_text, do_lower_case):
"""Project the tokenized prediction back to the original text."""
# When we created the data, we kept track of the alignment between original
# (whitespace tokenized) tokens and our WordPiece tokenized tokens. So
# now `orig_text` contains the span of ou... | [
"def",
"get_final_text",
"(",
"pred_text",
",",
"orig_text",
",",
"do_lower_case",
")",
":",
"# When we created the data, we kept track of the alignment between original",
"# (whitespace tokenized) tokens and our WordPiece tokenized tokens. So",
"# now `orig_text` contains the span of our or... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/conpono/evals/run_squad.py#L927-L1020 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | hazelcast/datadog_checks/hazelcast/config_models/shared.py | python | SharedConfig._ensure_defaults | (cls, v, field) | return getattr(defaults, f'shared_{field.name}')(field, v) | [] | def _ensure_defaults(cls, v, field):
if v is not None or field.required:
return v
return getattr(defaults, f'shared_{field.name}')(field, v) | [
"def",
"_ensure_defaults",
"(",
"cls",
",",
"v",
",",
"field",
")",
":",
"if",
"v",
"is",
"not",
"None",
"or",
"field",
".",
"required",
":",
"return",
"v",
"return",
"getattr",
"(",
"defaults",
",",
"f'shared_{field.name}'",
")",
"(",
"field",
",",
"v... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/hazelcast/datadog_checks/hazelcast/config_models/shared.py#L50-L54 | |||
cltk/cltk | 1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1 | src/cltk/phonology/non/utils.py | python | Rule.__init__ | (self, position, temp_sound, estimated_sound) | :param position: AbstractPosition
:param temp_sound: Vowel or Consonant
:param estimated_sound: Vowel or Consonant | :param position: AbstractPosition
:param temp_sound: Vowel or Consonant
:param estimated_sound: Vowel or Consonant | [
":",
"param",
"position",
":",
"AbstractPosition",
":",
"param",
"temp_sound",
":",
"Vowel",
"or",
"Consonant",
":",
"param",
"estimated_sound",
":",
"Vowel",
"or",
"Consonant"
] | def __init__(self, position, temp_sound, estimated_sound):
"""
:param position: AbstractPosition
:param temp_sound: Vowel or Consonant
:param estimated_sound: Vowel or Consonant
"""
assert isinstance(position, AbstractPosition)
self.position = position
ass... | [
"def",
"__init__",
"(",
"self",
",",
"position",
",",
"temp_sound",
",",
"estimated_sound",
")",
":",
"assert",
"isinstance",
"(",
"position",
",",
"AbstractPosition",
")",
"self",
".",
"position",
"=",
"position",
"assert",
"isinstance",
"(",
"temp_sound",
",... | https://github.com/cltk/cltk/blob/1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1/src/cltk/phonology/non/utils.py#L430-L443 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/sklearn/feature_extraction/text.py | python | CountVectorizer.fit_transform | (self, raw_documents, y=None) | return X | Learn the vocabulary dictionary and return term-document matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Parameters
----------
raw_documents : iterable
An iterable which yields either str, unicode or file objects.
... | Learn the vocabulary dictionary and return term-document matrix. | [
"Learn",
"the",
"vocabulary",
"dictionary",
"and",
"return",
"term",
"-",
"document",
"matrix",
"."
] | def fit_transform(self, raw_documents, y=None):
"""Learn the vocabulary dictionary and return term-document matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Parameters
----------
raw_documents : iterable
An iterable ... | [
"def",
"fit_transform",
"(",
"self",
",",
"raw_documents",
",",
"y",
"=",
"None",
")",
":",
"# We intentionally don't call the transform method to make",
"# fit_transform overridable without unwanted side effects in",
"# TfidfVectorizer.",
"if",
"isinstance",
"(",
"raw_documents"... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/feature_extraction/text.py#L809-L864 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/coverage/phystokens.py | python | source_token_lines | (source) | Generate a series of lines, one for each line in `source`.
Each line is a list of pairs, each pair is a token::
[('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]
Each pair has a token class, and the token text.
If you concatenate all the token texts, and then join them with newl... | Generate a series of lines, one for each line in `source`. | [
"Generate",
"a",
"series",
"of",
"lines",
"one",
"for",
"each",
"line",
"in",
"source",
"."
] | def source_token_lines(source):
"""Generate a series of lines, one for each line in `source`.
Each line is a list of pairs, each pair is a token::
[('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]
Each pair has a token class, and the token text.
If you concatenate all the to... | [
"def",
"source_token_lines",
"(",
"source",
")",
":",
"ws_tokens",
"=",
"set",
"(",
"[",
"token",
".",
"INDENT",
",",
"token",
".",
"DEDENT",
",",
"token",
".",
"NEWLINE",
",",
"tokenize",
".",
"NL",
"]",
")",
"line",
"=",
"[",
"]",
"col",
"=",
"0"... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/coverage/phystokens.py#L75-L124 | ||
obspy/obspy | 0ee5a0d2db293c8d5d4c3b1f148a6c5a85fea55f | obspy/signal/spectral_estimation.py | python | PPSD.get_percentile | (self, percentile=50) | return (self.period_bin_centers, percentile_values) | Returns periods and approximate psd values for given percentile value.
:type percentile: int
:param percentile: percentile for which to return approximate psd
value. (e.g. a value of 50 is equal to the median.)
:returns: (periods, percentile_values) | Returns periods and approximate psd values for given percentile value. | [
"Returns",
"periods",
"and",
"approximate",
"psd",
"values",
"for",
"given",
"percentile",
"value",
"."
] | def get_percentile(self, percentile=50):
"""
Returns periods and approximate psd values for given percentile value.
:type percentile: int
:param percentile: percentile for which to return approximate psd
value. (e.g. a value of 50 is equal to the median.)
:return... | [
"def",
"get_percentile",
"(",
"self",
",",
"percentile",
"=",
"50",
")",
":",
"hist_cum",
"=",
"self",
".",
"current_histogram_cumulative",
"if",
"hist_cum",
"is",
"None",
":",
"return",
"None",
"# go to percent",
"percentile",
"=",
"percentile",
"/",
"100.0",
... | https://github.com/obspy/obspy/blob/0ee5a0d2db293c8d5d4c3b1f148a6c5a85fea55f/obspy/signal/spectral_estimation.py#L1307-L1331 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_scale.py | python | Utils.find_result | (results, _name) | return rval | Find the specified result by name | Find the specified result by name | [
"Find",
"the",
"specified",
"result",
"by",
"name"
] | def find_result(results, _name):
''' Find the specified result by name'''
rval = None
for result in results:
if 'metadata' in result and result['metadata']['name'] == _name:
rval = result
break
return rval | [
"def",
"find_result",
"(",
"results",
",",
"_name",
")",
":",
"rval",
"=",
"None",
"for",
"result",
"in",
"results",
":",
"if",
"'metadata'",
"in",
"result",
"and",
"result",
"[",
"'metadata'",
"]",
"[",
"'name'",
"]",
"==",
"_name",
":",
"rval",
"=",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_scale.py#L1242-L1250 | |
lazylibrarian/LazyLibrarian | ae3c14e9db9328ce81765e094ab2a14ed7155624 | lazylibrarian/notifiers/pushbullet2.py | python | PushBullet.pushLink | (self, recipient, title, url, recipient_type="device_iden") | return self._request("POST", HOST + "/pushes", data) | Push a link
https://docs.pushbullet.com/v2/pushes
Arguments:
recipient -- a recipient
title -- link title
url -- link url
recipient_type -- a type of recipient (device, email, channel or client) | Push a link
https://docs.pushbullet.com/v2/pushes
Arguments:
recipient -- a recipient
title -- link title
url -- link url
recipient_type -- a type of recipient (device, email, channel or client) | [
"Push",
"a",
"link",
"https",
":",
"//",
"docs",
".",
"pushbullet",
".",
"com",
"/",
"v2",
"/",
"pushes",
"Arguments",
":",
"recipient",
"--",
"a",
"recipient",
"title",
"--",
"link",
"title",
"url",
"--",
"link",
"url",
"recipient_type",
"--",
"a",
"t... | def pushLink(self, recipient, title, url, recipient_type="device_iden"):
""" Push a link
https://docs.pushbullet.com/v2/pushes
Arguments:
recipient -- a recipient
title -- link title
url -- link url
recipient_type -- a type of recipient (de... | [
"def",
"pushLink",
"(",
"self",
",",
"recipient",
",",
"title",
",",
"url",
",",
"recipient_type",
"=",
"\"device_iden\"",
")",
":",
"data",
"=",
"{",
"\"type\"",
":",
"\"link\"",
",",
"\"title\"",
":",
"title",
",",
"\"url\"",
":",
"url",
",",
"recipien... | https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/lazylibrarian/notifiers/pushbullet2.py#L125-L137 | |
glumpy/glumpy | 46a7635c08d3a200478397edbe0371a6c59cd9d7 | glumpy/transforms/trackball.py | python | Trackball.__init__ | (self, *args, **kwargs) | Initialize the transform. | Initialize the transform. | [
"Initialize",
"the",
"transform",
"."
] | def __init__(self, *args, **kwargs):
"""
Initialize the transform.
"""
code = library.get("transforms/trackball.glsl")
Transform.__init__(self, code, *args, **kwargs)
self._aspect = Transform._get_kwarg("aspect", kwargs) or 1
self._znear = Transform._get_kwarg("... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"code",
"=",
"library",
".",
"get",
"(",
"\"transforms/trackball.glsl\"",
")",
"Transform",
".",
"__init__",
"(",
"self",
",",
"code",
",",
"*",
"args",
",",
"*",
"*... | https://github.com/glumpy/glumpy/blob/46a7635c08d3a200478397edbe0371a6c59cd9d7/glumpy/transforms/trackball.py#L72-L96 | ||
Arelle/Arelle | 20f3d8a8afd41668e1520799acd333349ce0ba17 | arelle/ModelInstanceObject.py | python | ModelFact.value | (self) | return v | (str) -- Text value of fact or default or fixed if any, otherwise None | (str) -- Text value of fact or default or fixed if any, otherwise None | [
"(",
"str",
")",
"--",
"Text",
"value",
"of",
"fact",
"or",
"default",
"or",
"fixed",
"if",
"any",
"otherwise",
"None"
] | def value(self):
"""(str) -- Text value of fact or default or fixed if any, otherwise None"""
v = self.textValue
if not v and self.concept is not None:
if self.concept.default is not None:
v = self.concept.default
elif self.concept.fixed is not None:
... | [
"def",
"value",
"(",
"self",
")",
":",
"v",
"=",
"self",
".",
"textValue",
"if",
"not",
"v",
"and",
"self",
".",
"concept",
"is",
"not",
"None",
":",
"if",
"self",
".",
"concept",
".",
"default",
"is",
"not",
"None",
":",
"v",
"=",
"self",
".",
... | https://github.com/Arelle/Arelle/blob/20f3d8a8afd41668e1520799acd333349ce0ba17/arelle/ModelInstanceObject.py#L359-L367 | |
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/entities/dimstyleoverride.py | python | DimStyleOverride.get_renderer | (self, ucs: "UCS" = None) | return self.doc.dimension_renderer.dispatch(self, ucs) | Get designated DIMENSION renderer. (internal API) | Get designated DIMENSION renderer. (internal API) | [
"Get",
"designated",
"DIMENSION",
"renderer",
".",
"(",
"internal",
"API",
")"
] | def get_renderer(self, ucs: "UCS" = None):
"""Get designated DIMENSION renderer. (internal API)"""
return self.doc.dimension_renderer.dispatch(self, ucs) | [
"def",
"get_renderer",
"(",
"self",
",",
"ucs",
":",
"\"UCS\"",
"=",
"None",
")",
":",
"return",
"self",
".",
"doc",
".",
"dimension_renderer",
".",
"dispatch",
"(",
"self",
",",
"ucs",
")"
] | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/entities/dimstyleoverride.py#L509-L511 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/xml/sax/saxutils.py | python | XMLGenerator.ignorableWhitespace | (self, content) | [] | def ignorableWhitespace(self, content):
if content:
self._finish_pending_start_element()
if not isinstance(content, str):
content = str(content, self._encoding)
self._write(content) | [
"def",
"ignorableWhitespace",
"(",
"self",
",",
"content",
")",
":",
"if",
"content",
":",
"self",
".",
"_finish_pending_start_element",
"(",
")",
"if",
"not",
"isinstance",
"(",
"content",
",",
"str",
")",
":",
"content",
"=",
"str",
"(",
"content",
",",
... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xml/sax/saxutils.py#L215-L220 | ||||
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | rope/contrib/fixsyntax.py | python | _Commenter.comment | (self, lineno) | [] | def comment(self, lineno):
start = _logical_start(self.lines, lineno, check_prev=True) - 1
# using self._get_stmt_end() instead of self._get_block_end()
# to lower commented lines
end = self._get_stmt_end(start)
indents = _get_line_indents(self.lines[start])
if 0 < start:... | [
"def",
"comment",
"(",
"self",
",",
"lineno",
")",
":",
"start",
"=",
"_logical_start",
"(",
"self",
".",
"lines",
",",
"lineno",
",",
"check_prev",
"=",
"True",
")",
"-",
"1",
"# using self._get_stmt_end() instead of self._get_block_end()",
"# to lower commented li... | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/rope/contrib/fixsyntax.py#L79-L93 | ||||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/returners/pushover_returner.py | python | returner | (ret) | return | Send an PushOver message with the data | Send an PushOver message with the data | [
"Send",
"an",
"PushOver",
"message",
"with",
"the",
"data"
] | def returner(ret):
"""
Send an PushOver message with the data
"""
_options = _get_options(ret)
user = _options.get("user")
device = _options.get("device")
token = _options.get("token")
title = _options.get("title")
priority = _options.get("priority")
expire = _options.get("expi... | [
"def",
"returner",
"(",
"ret",
")",
":",
"_options",
"=",
"_get_options",
"(",
"ret",
")",
"user",
"=",
"_options",
".",
"get",
"(",
"\"user\"",
")",
"device",
"=",
"_options",
".",
"get",
"(",
"\"device\"",
")",
"token",
"=",
"_options",
".",
"get",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/returners/pushover_returner.py#L205-L256 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_adm_csr.py | python | Yedit.process_edits | (edits, yamlfile) | return {'changed': len(results) > 0, 'results': results} | run through a list of edits and process them one-by-one | run through a list of edits and process them one-by-one | [
"run",
"through",
"a",
"list",
"of",
"edits",
"and",
"process",
"them",
"one",
"-",
"by",
"-",
"one"
] | def process_edits(edits, yamlfile):
'''run through a list of edits and process them one-by-one'''
results = []
for edit in edits:
value = Yedit.parse_value(edit['value'], edit.get('value_type', ''))
if edit.get('action') == 'update':
# pylint: disable=line... | [
"def",
"process_edits",
"(",
"edits",
",",
"yamlfile",
")",
":",
"results",
"=",
"[",
"]",
"for",
"edit",
"in",
"edits",
":",
"value",
"=",
"Yedit",
".",
"parse_value",
"(",
"edit",
"[",
"'value'",
"]",
",",
"edit",
".",
"get",
"(",
"'value_type'",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_adm_csr.py#L711-L736 | |
yoda-pa/yoda | e6b4325737b877488af4d1bf0b86eb1d98b88aed | modules/love.py | python | setup | () | create new setup
:return: | create new setup
:return: | [
"create",
"new",
"setup",
":",
"return",
":"
] | def setup():
"""
create new setup
:return:
"""
create_folder(LOVE_CONFIG_FOLDER_PATH)
if ask_overwrite(LOVE_CONFIG_FILE_PATH):
return
click.echo(chalk.blue("Enter their name:"))
name = input().strip()
click.echo(chalk.blue("Enter sex(M/F):"))
sex = input().strip()
... | [
"def",
"setup",
"(",
")",
":",
"create_folder",
"(",
"LOVE_CONFIG_FOLDER_PATH",
")",
"if",
"ask_overwrite",
"(",
"LOVE_CONFIG_FILE_PATH",
")",
":",
"return",
"click",
".",
"echo",
"(",
"chalk",
".",
"blue",
"(",
"\"Enter their name:\"",
")",
")",
"name",
"=",
... | https://github.com/yoda-pa/yoda/blob/e6b4325737b877488af4d1bf0b86eb1d98b88aed/modules/love.py#L47-L68 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/loader/lazy.py | python | LazyLoader._run_as | (self, _func_or_method, *args, **kwargs) | Handle setting up the context properly and call the method | Handle setting up the context properly and call the method | [
"Handle",
"setting",
"up",
"the",
"context",
"properly",
"and",
"call",
"the",
"method"
] | def _run_as(self, _func_or_method, *args, **kwargs):
"""
Handle setting up the context properly and call the method
"""
self.parent_loader = None
try:
current_loader = salt.loader.context.loader_ctxvar.get()
except LookupError:
current_loader = Non... | [
"def",
"_run_as",
"(",
"self",
",",
"_func_or_method",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parent_loader",
"=",
"None",
"try",
":",
"current_loader",
"=",
"salt",
".",
"loader",
".",
"context",
".",
"loader_ctxvar",
".",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/loader/lazy.py#L1203-L1219 | ||
steemit/steem-python | 57fb0f1436fbea27a74386d35815f45fb3076814 | steem/wallet.py | python | Wallet.locked | (self) | return False if self.decryptedKEK else True | Is the wallet database locked? | Is the wallet database locked? | [
"Is",
"the",
"wallet",
"database",
"locked?"
] | def locked(self):
""" Is the wallet database locked?
"""
return False if self.decryptedKEK else True | [
"def",
"locked",
"(",
"self",
")",
":",
"return",
"False",
"if",
"self",
".",
"decryptedKEK",
"else",
"True"
] | https://github.com/steemit/steem-python/blob/57fb0f1436fbea27a74386d35815f45fb3076814/steem/wallet.py#L113-L116 | |
JustDoPython/python-100-day | 4e75007195aa4cdbcb899aeb06b9b08996a4606c | day-005/def.py | python | reduce | (a,b) | return a-b | [] | def reduce(a,b) :
return a-b | [
"def",
"reduce",
"(",
"a",
",",
"b",
")",
":",
"return",
"a",
"-",
"b"
] | https://github.com/JustDoPython/python-100-day/blob/4e75007195aa4cdbcb899aeb06b9b08996a4606c/day-005/def.py#L19-L20 | |||
django-oscar/django-oscar-accounts | 8a6dc3b42306979779f048b4d3ed0a9fd4a2f794 | src/oscar_accounts/abstract_models.py | python | Transfer.as_dict | (self) | return {
'reference': self.reference,
'source_code': self.source.code,
'source_name': self.source.name,
'destination_code': self.destination.code,
'destination_name': self.destination.name,
'amount': "%.2f" % self.amount,
'available_to_... | [] | def as_dict(self):
return {
'reference': self.reference,
'source_code': self.source.code,
'source_name': self.source.name,
'destination_code': self.destination.code,
'destination_name': self.destination.name,
'amount': "%.2f" % self.amount,... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"'reference'",
":",
"self",
".",
"reference",
",",
"'source_code'",
":",
"self",
".",
"source",
".",
"code",
",",
"'source_name'",
":",
"self",
".",
"source",
".",
"name",
",",
"'destination_code'",
... | https://github.com/django-oscar/django-oscar-accounts/blob/8a6dc3b42306979779f048b4d3ed0a9fd4a2f794/src/oscar_accounts/abstract_models.py#L407-L424 | |||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/font_manager.py | python | FontProperties.get_file | (self) | return self._file | Return the filename of the associated font. | Return the filename of the associated font. | [
"Return",
"the",
"filename",
"of",
"the",
"associated",
"font",
"."
] | def get_file(self):
"""
Return the filename of the associated font.
"""
return self._file | [
"def",
"get_file",
"(",
"self",
")",
":",
"return",
"self",
".",
"_file"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/font_manager.py#L688-L692 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/apigateway/v20180808/apigateway_client.py | python | ApigatewayClient.CreateApiApp | (self, request) | 本接口(CreateApiApp)用于创建应用。
:param request: Request instance for CreateApiApp.
:type request: :class:`tencentcloud.apigateway.v20180808.models.CreateApiAppRequest`
:rtype: :class:`tencentcloud.apigateway.v20180808.models.CreateApiAppResponse` | 本接口(CreateApiApp)用于创建应用。 | [
"本接口(CreateApiApp)用于创建应用。"
] | def CreateApiApp(self, request):
"""本接口(CreateApiApp)用于创建应用。
:param request: Request instance for CreateApiApp.
:type request: :class:`tencentcloud.apigateway.v20180808.models.CreateApiAppRequest`
:rtype: :class:`tencentcloud.apigateway.v20180808.models.CreateApiAppResponse`
""... | [
"def",
"CreateApiApp",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"CreateApiApp\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loads",
"(",
... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/apigateway/v20180808/apigateway_client.py#L285-L310 | ||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/cookies.py | python | parse_value | (value, allow_spaces=True, unquote=default_unquote) | return value | Process a cookie value | Process a cookie value | [
"Process",
"a",
"cookie",
"value"
] | def parse_value(value, allow_spaces=True, unquote=default_unquote):
"Process a cookie value"
if value is None:
return None
value = strip_spaces_and_quotes(value)
value = parse_string(value, unquote=unquote)
if not allow_spaces:
assert ' ' not in value
return value | [
"def",
"parse_value",
"(",
"value",
",",
"allow_spaces",
"=",
"True",
",",
"unquote",
"=",
"default_unquote",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"value",
"=",
"strip_spaces_and_quotes",
"(",
"value",
")",
"value",
"=",
"parse_strin... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/cookies.py#L419-L427 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/smtplib.py | python | SMTP.verify | (self, address) | return self.getreply() | SMTP 'verify' command -- checks for address validity. | SMTP 'verify' command -- checks for address validity. | [
"SMTP",
"verify",
"command",
"--",
"checks",
"for",
"address",
"validity",
"."
] | def verify(self, address):
"""SMTP 'verify' command -- checks for address validity."""
self.putcmd("vrfy", quoteaddr(address))
return self.getreply() | [
"def",
"verify",
"(",
"self",
",",
"address",
")",
":",
"self",
".",
"putcmd",
"(",
"\"vrfy\"",
",",
"quoteaddr",
"(",
"address",
")",
")",
"return",
"self",
".",
"getreply",
"(",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/smtplib.py#L498-L501 | |
microsoft/botbuilder-python | 3d410365461dc434df59bdfeaa2f16d28d9df868 | libraries/botbuilder-schema/botbuilder/schema/_models_py3.py | python | Activity.create_contact_relation_update_activity | () | return Activity(type=ActivityTypes.contact_relation_update) | Creates an instance of the :class:`Activity` class as aContactRelationUpdateActivity object.
:returns: The new contact relation update activity. | Creates an instance of the :class:`Activity` class as aContactRelationUpdateActivity object. | [
"Creates",
"an",
"instance",
"of",
"the",
":",
"class",
":",
"Activity",
"class",
"as",
"aContactRelationUpdateActivity",
"object",
"."
] | def create_contact_relation_update_activity():
"""
Creates an instance of the :class:`Activity` class as aContactRelationUpdateActivity object.
:returns: The new contact relation update activity.
"""
return Activity(type=ActivityTypes.contact_relation_update) | [
"def",
"create_contact_relation_update_activity",
"(",
")",
":",
"return",
"Activity",
"(",
"type",
"=",
"ActivityTypes",
".",
"contact_relation_update",
")"
] | https://github.com/microsoft/botbuilder-python/blob/3d410365461dc434df59bdfeaa2f16d28d9df868/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py#L557-L563 | |
PaddlePaddle/PaddleFL | 583691acd5db0a7ca331cc9a72415017b18669b8 | python/paddle_fl/feature_engineering/core/federated_feature_engineering_server.py | python | FederatedFeatureEngineeringServer.serve | (self, server) | server init with grpc server | server init with grpc server | [
"server",
"init",
"with",
"grpc",
"server"
] | def serve(self, server):
"""
server init with grpc server
"""
self._server = server | [
"def",
"serve",
"(",
"self",
",",
"server",
")",
":",
"self",
".",
"_server",
"=",
"server"
] | https://github.com/PaddlePaddle/PaddleFL/blob/583691acd5db0a7ca331cc9a72415017b18669b8/python/paddle_fl/feature_engineering/core/federated_feature_engineering_server.py#L26-L30 | ||
otuncelli/turkish-stemmer-python | 0c22380bf84a5ab1f219f4a905274c78afa04ed1 | TurkishStemmer/__init__.py | python | HasRoundness | (vowel, candidate) | return ((vowel in UNROUNDED_VOWELS and candidate in UNROUNDED_VOWELS) or
(vowel in ROUNDED_VOWELS and candidate in FOLLOWING_ROUNDED_VOWELS)) | Checks the roundness harmony of two characters.
Args:
vowel (str): the first character
candidate (str): candidate the second character
Returns:
bool: whether the two characters have roundness harmony or not. | Checks the roundness harmony of two characters. | [
"Checks",
"the",
"roundness",
"harmony",
"of",
"two",
"characters",
"."
] | def HasRoundness(vowel, candidate):
"""
Checks the roundness harmony of two characters.
Args:
vowel (str): the first character
candidate (str): candidate the second character
Returns:
bool: whether the two characters have roundness harmony or not.
"""
return ((vowel in UNROUNDED_VO... | [
"def",
"HasRoundness",
"(",
"vowel",
",",
"candidate",
")",
":",
"return",
"(",
"(",
"vowel",
"in",
"UNROUNDED_VOWELS",
"and",
"candidate",
"in",
"UNROUNDED_VOWELS",
")",
"or",
"(",
"vowel",
"in",
"ROUNDED_VOWELS",
"and",
"candidate",
"in",
"FOLLOWING_ROUNDED_VO... | https://github.com/otuncelli/turkish-stemmer-python/blob/0c22380bf84a5ab1f219f4a905274c78afa04ed1/TurkishStemmer/__init__.py#L339-L351 | |
OpenNMT/OpenNMT-tf | 59a4dfdb911d0570ba1096b7a0a7b9fc5c7844bf | opennmt/data/vocab.py | python | Vocab.load | (self, path, file_format="default") | Loads a serialized vocabulary.
Args:
path: The path to the vocabulary to load.
file_format: Define the format of the vocabulary file. Can be: default,
sentencepiece. "default" is simply one token per line.
Raises:
ValueError: if :obj:`file_format` is invalid. | Loads a serialized vocabulary. | [
"Loads",
"a",
"serialized",
"vocabulary",
"."
] | def load(self, path, file_format="default"):
"""Loads a serialized vocabulary.
Args:
path: The path to the vocabulary to load.
file_format: Define the format of the vocabulary file. Can be: default,
sentencepiece. "default" is simply one token per line.
Raises:
... | [
"def",
"load",
"(",
"self",
",",
"path",
",",
"file_format",
"=",
"\"default\"",
")",
":",
"if",
"file_format",
"not",
"in",
"(",
"\"default\"",
",",
"\"sentencepiece\"",
")",
":",
"raise",
"ValueError",
"(",
"\"Invalid vocabulary format: %s\"",
"%",
"file_forma... | https://github.com/OpenNMT/OpenNMT-tf/blob/59a4dfdb911d0570ba1096b7a0a7b9fc5c7844bf/opennmt/data/vocab.py#L107-L140 | ||
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/quantum_info/operators/symplectic/pauli_list.py | python | PauliList.transpose | (self) | return PauliList(super().transpose()) | Return the transpose of each Pauli in the list. | Return the transpose of each Pauli in the list. | [
"Return",
"the",
"transpose",
"of",
"each",
"Pauli",
"in",
"the",
"list",
"."
] | def transpose(self):
"""Return the transpose of each Pauli in the list."""
return PauliList(super().transpose()) | [
"def",
"transpose",
"(",
"self",
")",
":",
"return",
"PauliList",
"(",
"super",
"(",
")",
".",
"transpose",
"(",
")",
")"
] | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/quantum_info/operators/symplectic/pauli_list.py#L772-L774 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/ext/mapreduce/shuffler.py | python | _sort_records_map | (records) | Map function sorting records.
Converts records to KeyValue protos, sorts them by key and writes them
into new GCS file. Creates _OutputFile entity to record resulting
file name.
Args:
records: list of records which are serialized KeyValue protos. | Map function sorting records. | [
"Map",
"function",
"sorting",
"records",
"."
] | def _sort_records_map(records):
"""Map function sorting records.
Converts records to KeyValue protos, sorts them by key and writes them
into new GCS file. Creates _OutputFile entity to record resulting
file name.
Args:
records: list of records which are serialized KeyValue protos.
"""
ctx = context.... | [
"def",
"_sort_records_map",
"(",
"records",
")",
":",
"ctx",
"=",
"context",
".",
"get",
"(",
")",
"l",
"=",
"len",
"(",
"records",
")",
"key_records",
"=",
"[",
"None",
"]",
"*",
"l",
"logging",
".",
"debug",
"(",
"\"Parsing\"",
")",
"for",
"i",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/mapreduce/shuffler.py#L140-L180 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/aifc.py | python | _read_long | (file) | [] | def _read_long(file):
try:
return struct.unpack('>l', file.read(4))[0]
except struct.error:
raise EOFError from None | [
"def",
"_read_long",
"(",
"file",
")",
":",
"try",
":",
"return",
"struct",
".",
"unpack",
"(",
"'>l'",
",",
"file",
".",
"read",
"(",
"4",
")",
")",
"[",
"0",
"]",
"except",
"struct",
".",
"error",
":",
"raise",
"EOFError",
"from",
"None"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/aifc.py#L148-L152 | ||||
wrye-bash/wrye-bash | d495c47cfdb44475befa523438a40c4419cb386f | Mopy/bash/bolt.py | python | popen_common | (popen_cmd, **kwargs) | return subprocess.Popen(popen_cmd, stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
startupinfo=startupinfo, **kwargs) | Wrapper around subprocess.Popen with commonly needed parameters. | Wrapper around subprocess.Popen with commonly needed parameters. | [
"Wrapper",
"around",
"subprocess",
".",
"Popen",
"with",
"commonly",
"needed",
"parameters",
"."
] | def popen_common(popen_cmd, **kwargs):
"""Wrapper around subprocess.Popen with commonly needed parameters."""
return subprocess.Popen(popen_cmd, stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
startupinfo=startupinfo, **kwargs) | [
"def",
"popen_common",
"(",
"popen_cmd",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"subprocess",
".",
"Popen",
"(",
"popen_cmd",
",",
"stdin",
"=",
"subprocess",
".",
"DEVNULL",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subpr... | https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/bolt.py#L976-L980 | |
RDFLib/sparqlwrapper | 3fdb48d52bf97c789d121b9650591deba16bcaa6 | SPARQLWrapper/Wrapper.py | python | SPARQLWrapper._getRequestEncodedParameters | (self, query=None) | return "&".join(pairs) | Internal method for getting the request encoded parameters.
:param query: a tuple of two items. The first item can be the string \
``query`` (for :data:`SELECT`, :data:`DESCRIBE`, :data:`ASK`, :data:`CONSTRUCT` query) or the string
``update`` (for SPARQL Update queries, like :data:`DELETE` or :... | Internal method for getting the request encoded parameters. | [
"Internal",
"method",
"for",
"getting",
"the",
"request",
"encoded",
"parameters",
"."
] | def _getRequestEncodedParameters(self, query=None):
""" Internal method for getting the request encoded parameters.
:param query: a tuple of two items. The first item can be the string \
``query`` (for :data:`SELECT`, :data:`DESCRIBE`, :data:`ASK`, :data:`CONSTRUCT` query) or the string
... | [
"def",
"_getRequestEncodedParameters",
"(",
"self",
",",
"query",
"=",
"None",
")",
":",
"query_parameters",
"=",
"self",
".",
"parameters",
".",
"copy",
"(",
")",
"# in case of query = tuple(\"query\"/\"update\", queryString)",
"if",
"query",
"and",
"(",
"isinstance"... | https://github.com/RDFLib/sparqlwrapper/blob/3fdb48d52bf97c789d121b9650591deba16bcaa6/SPARQLWrapper/Wrapper.py#L691-L738 | |
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/req/req_file.py | python | join_lines | (lines_enum) | Joins a line ending in '\' with the previous line (except when following
comments). The joined line takes on the index of the first line. | Joins a line ending in '\' with the previous line (except when following
comments). The joined line takes on the index of the first line. | [
"Joins",
"a",
"line",
"ending",
"in",
"\\",
"with",
"the",
"previous",
"line",
"(",
"except",
"when",
"following",
"comments",
")",
".",
"The",
"joined",
"line",
"takes",
"on",
"the",
"index",
"of",
"the",
"first",
"line",
"."
] | def join_lines(lines_enum):
# type: (ReqFileLines) -> ReqFileLines
"""Joins a line ending in '\' with the previous line (except when following
comments). The joined line takes on the index of the first line.
"""
primary_line_number = None
new_line = [] # type: List[Text]
for line_number, l... | [
"def",
"join_lines",
"(",
"lines_enum",
")",
":",
"# type: (ReqFileLines) -> ReqFileLines",
"primary_line_number",
"=",
"None",
"new_line",
"=",
"[",
"]",
"# type: List[Text]",
"for",
"line_number",
",",
"line",
"in",
"lines_enum",
":",
"if",
"not",
"line",
".",
"... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/req/req_file.py#L301-L326 | ||
zhaoolee/StarsAndClown | b2d4039cad2f9232b691e5976f787b49a0a2c113 | node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py | python | _LookupTargets | (names, mapping) | return [mapping[name] for name in names if name in mapping] | Returns a list of the mapping[name] for each value in |names| that is in
|mapping|. | Returns a list of the mapping[name] for each value in |names| that is in
|mapping|. | [
"Returns",
"a",
"list",
"of",
"the",
"mapping",
"[",
"name",
"]",
"for",
"each",
"value",
"in",
"|names|",
"that",
"is",
"in",
"|mapping|",
"."
] | def _LookupTargets(names, mapping):
"""Returns a list of the mapping[name] for each value in |names| that is in
|mapping|."""
return [mapping[name] for name in names if name in mapping] | [
"def",
"_LookupTargets",
"(",
"names",
",",
"mapping",
")",
":",
"return",
"[",
"mapping",
"[",
"name",
"]",
"for",
"name",
"in",
"names",
"if",
"name",
"in",
"mapping",
"]"
] | https://github.com/zhaoolee/StarsAndClown/blob/b2d4039cad2f9232b691e5976f787b49a0a2c113/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py#L569-L572 | |
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/libs/bottle.py | python | BaseResponse.set_header | (self, name, value) | Create a new response header, replacing any previously defined
headers with the same name. | Create a new response header, replacing any previously defined
headers with the same name. | [
"Create",
"a",
"new",
"response",
"header",
"replacing",
"any",
"previously",
"defined",
"headers",
"with",
"the",
"same",
"name",
"."
] | def set_header(self, name, value):
''' Create a new response header, replacing any previously defined
headers with the same name. '''
self._headers[_hkey(name)] = [str(value)] | [
"def",
"set_header",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"self",
".",
"_headers",
"[",
"_hkey",
"(",
"name",
")",
"]",
"=",
"[",
"str",
"(",
"value",
")",
"]"
] | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/libs/bottle.py#L1361-L1364 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_scatter3d.py | python | Scatter3d.surfacecolor | (self) | return self["surfacecolor"] | Sets the surface fill color.
The 'surfacecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
... | Sets the surface fill color.
The 'surfacecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
... | [
"Sets",
"the",
"surface",
"fill",
"color",
".",
"The",
"surfacecolor",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0000",
")",
"-",
"An",
"rgb",
"/",
"rgba",
"s... | def surfacecolor(self):
"""
Sets the surface fill color.
The 'surfacecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/... | [
"def",
"surfacecolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"surfacecolor\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_scatter3d.py#L1228-L1278 | |
jwyang/fpn.pytorch | 23bd1d2fa09fbb9453f11625d758a61b9d600942 | lib/model/fpn/resnet.py | python | resnet50 | (pretrained=False) | return model | Constructs a ResNet-50 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | Constructs a ResNet-50 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | [
"Constructs",
"a",
"ResNet",
"-",
"50",
"model",
".",
"Args",
":",
"pretrained",
"(",
"bool",
")",
":",
"If",
"True",
"returns",
"a",
"model",
"pre",
"-",
"trained",
"on",
"ImageNet"
] | def resnet50(pretrained=False):
"""Constructs a ResNet-50 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
"""
model = ResNet(Bottleneck, [3, 4, 6, 3])
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))
return model | [
"def",
"resnet50",
"(",
"pretrained",
"=",
"False",
")",
":",
"model",
"=",
"ResNet",
"(",
"Bottleneck",
",",
"[",
"3",
",",
"4",
",",
"6",
",",
"3",
"]",
")",
"if",
"pretrained",
":",
"model",
".",
"load_state_dict",
"(",
"model_zoo",
".",
"load_url... | https://github.com/jwyang/fpn.pytorch/blob/23bd1d2fa09fbb9453f11625d758a61b9d600942/lib/model/fpn/resnet.py#L186-L194 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/qtconsole-4.1.0-py3.3.egg/qtconsole/completion_html.py | python | SlidingInterval.stop | (self) | return self._stop | end of interval to show | end of interval to show | [
"end",
"of",
"interval",
"to",
"show"
] | def stop(self):
"""end of interval to show"""
return self._stop | [
"def",
"stop",
"(",
"self",
")",
":",
"return",
"self",
".",
"_stop"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/qtconsole-4.1.0-py3.3.egg/qtconsole/completion_html.py#L98-L100 | |
4shadoww/hakkuframework | 409a11fc3819d251f86faa3473439f8c19066a21 | lib/requests/cookies.py | python | extract_cookies_to_jar | (jar, request, response) | Extract the cookies from the response into a CookieJar.
:param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
:param request: our own requests.Request object
:param response: urllib3.HTTPResponse object | Extract the cookies from the response into a CookieJar. | [
"Extract",
"the",
"cookies",
"from",
"the",
"response",
"into",
"a",
"CookieJar",
"."
] | def extract_cookies_to_jar(jar, request, response):
"""Extract the cookies from the response into a CookieJar.
:param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
:param request: our own requests.Request object
:param response: urllib3.HTTPResponse object
"""
if not (hasattr(r... | [
"def",
"extract_cookies_to_jar",
"(",
"jar",
",",
"request",
",",
"response",
")",
":",
"if",
"not",
"(",
"hasattr",
"(",
"response",
",",
"'_original_response'",
")",
"and",
"response",
".",
"_original_response",
")",
":",
"return",
"# the _original_response fiel... | https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/requests/cookies.py#L118-L132 | ||
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/multivariate/factor_rotation/_gpa_rotation.py | python | vgQ_partial_target | (H, W=None, L=None, A=None, T=None) | return q, Gq | r"""
Subroutine for the value of vgQ using orthogonal rotation towards a partial
target matrix, i.e., we minimize:
.. math::
\phi(L) =\frac{1}{2}\|W\circ(L-H)\|^2,
where :math:`\circ` is the element-wise product or Hadamard product and
:math:`W` is a matrix whose entries can only be one or... | r"""
Subroutine for the value of vgQ using orthogonal rotation towards a partial
target matrix, i.e., we minimize: | [
"r",
"Subroutine",
"for",
"the",
"value",
"of",
"vgQ",
"using",
"orthogonal",
"rotation",
"towards",
"a",
"partial",
"target",
"matrix",
"i",
".",
"e",
".",
"we",
"minimize",
":"
] | def vgQ_partial_target(H, W=None, L=None, A=None, T=None):
r"""
Subroutine for the value of vgQ using orthogonal rotation towards a partial
target matrix, i.e., we minimize:
.. math::
\phi(L) =\frac{1}{2}\|W\circ(L-H)\|^2,
where :math:`\circ` is the element-wise product or Hadamard product... | [
"def",
"vgQ_partial_target",
"(",
"H",
",",
"W",
"=",
"None",
",",
"L",
"=",
"None",
",",
"A",
"=",
"None",
",",
"T",
"=",
"None",
")",
":",
"if",
"W",
"is",
"None",
":",
"return",
"vgQ_target",
"(",
"H",
",",
"L",
"=",
"L",
",",
"A",
"=",
... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/multivariate/factor_rotation/_gpa_rotation.py#L507-L552 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/smtplib.py | python | SMTP.helo | (self, name='') | return (code, msg) | SMTP 'helo' command.
Hostname to send for this command defaults to the FQDN of the local
host. | SMTP 'helo' command.
Hostname to send for this command defaults to the FQDN of the local
host. | [
"SMTP",
"helo",
"command",
".",
"Hostname",
"to",
"send",
"for",
"this",
"command",
"defaults",
"to",
"the",
"FQDN",
"of",
"the",
"local",
"host",
"."
] | def helo(self, name=''):
"""SMTP 'helo' command.
Hostname to send for this command defaults to the FQDN of the local
host.
"""
self.putcmd("helo", name or self.local_hostname)
(code, msg) = self.getreply()
self.helo_resp = msg
return (code, msg) | [
"def",
"helo",
"(",
"self",
",",
"name",
"=",
"''",
")",
":",
"self",
".",
"putcmd",
"(",
"\"helo\"",
",",
"name",
"or",
"self",
".",
"local_hostname",
")",
"(",
"code",
",",
"msg",
")",
"=",
"self",
".",
"getreply",
"(",
")",
"self",
".",
"helo_... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/smtplib.py#L397-L405 | |
oddt/oddt | 8cf555820d97a692ade81c101ebe10e28bcb3722 | oddt/toolkits/ob.py | python | Molecule.make2D | (self) | Generate 2D coordinates for molecule | Generate 2D coordinates for molecule | [
"Generate",
"2D",
"coordinates",
"for",
"molecule"
] | def make2D(self):
"""Generate 2D coordinates for molecule"""
pybel._operations['gen2D'].Do(self.OBMol)
self._clear_cache() | [
"def",
"make2D",
"(",
"self",
")",
":",
"pybel",
".",
"_operations",
"[",
"'gen2D'",
"]",
".",
"Do",
"(",
"self",
".",
"OBMol",
")",
"self",
".",
"_clear_cache",
"(",
")"
] | https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/toolkits/ob.py#L260-L263 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/flatmenu.py | python | FlatMenuButton.SetSize | (self, input1, input2=None) | Sets the size for :class:`FlatMenuButton`.
:param `input1`: if it is an instance of :class:`wx.Size`, it represents the :class:`FlatMenuButton`
size and the `input2` parameter is not used. Otherwise it is an integer representing
the button width;
:param `input2`: if not ``None``, it i... | Sets the size for :class:`FlatMenuButton`. | [
"Sets",
"the",
"size",
"for",
":",
"class",
":",
"FlatMenuButton",
"."
] | def SetSize(self, input1, input2=None):
"""
Sets the size for :class:`FlatMenuButton`.
:param `input1`: if it is an instance of :class:`wx.Size`, it represents the :class:`FlatMenuButton`
size and the `input2` parameter is not used. Otherwise it is an integer representing
the ... | [
"def",
"SetSize",
"(",
"self",
",",
"input1",
",",
"input2",
"=",
"None",
")",
":",
"if",
"type",
"(",
"input",
")",
"==",
"type",
"(",
"1",
")",
":",
"self",
".",
"_size",
"=",
"wx",
".",
"Size",
"(",
"input1",
",",
"input2",
")",
"else",
":",... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/flatmenu.py#L4105-L4118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.