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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rootpy/rootpy | 3926935e1f2100d8ba68070c2ab44055d4800f73 | rootpy/plotting/base.py | python | Plottable.GetMarkerColor | (self, mode=None) | return self._markercolor(mode) | *mode* may be 'root', 'mpl', or None to return the ROOT, matplotlib,
or input value. | *mode* may be 'root', 'mpl', or None to return the ROOT, matplotlib,
or input value. | [
"*",
"mode",
"*",
"may",
"be",
"root",
"mpl",
"or",
"None",
"to",
"return",
"the",
"ROOT",
"matplotlib",
"or",
"input",
"value",
"."
] | def GetMarkerColor(self, mode=None):
"""
*mode* may be 'root', 'mpl', or None to return the ROOT, matplotlib,
or input value.
"""
return self._markercolor(mode) | [
"def",
"GetMarkerColor",
"(",
"self",
",",
"mode",
"=",
"None",
")",
":",
"return",
"self",
".",
"_markercolor",
"(",
"mode",
")"
] | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/base.py#L387-L392 | |
aio-libs/aiohttp-cors | 1627c08638e4c83022abffacab753b09896d1b9a | aiohttp_cors/urldispatcher_router_adapter.py | python | ResourcesUrlDispatcherRouterAdapter.get_non_preflight_request_config | (self, request: web.Request) | return defaulted_config | Get stored CORS configuration for routing entity that handles
specified request. | Get stored CORS configuration for routing entity that handles
specified request. | [
"Get",
"stored",
"CORS",
"configuration",
"for",
"routing",
"entity",
"that",
"handles",
"specified",
"request",
"."
] | def get_non_preflight_request_config(self, request: web.Request):
"""Get stored CORS configuration for routing entity that handles
specified request."""
assert self.is_cors_enabled_on_request(request)
resource = self._request_resource(request)
resource_config = self._resource_c... | [
"def",
"get_non_preflight_request_config",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
")",
":",
"assert",
"self",
".",
"is_cors_enabled_on_request",
"(",
"request",
")",
"resource",
"=",
"self",
".",
"_request_resource",
"(",
"request",
")",
"resou... | https://github.com/aio-libs/aiohttp-cors/blob/1627c08638e4c83022abffacab753b09896d1b9a/aiohttp_cors/urldispatcher_router_adapter.py#L302-L324 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cherrypy/_cperror.py | python | _be_ie_unfriendly | (status) | [] | def _be_ie_unfriendly(status):
response = cherrypy.serving.response
# For some statuses, Internet Explorer 5+ shows "friendly error
# messages" instead of our response.body if the body is smaller
# than a given size. Fix this by returning a body over that size
# (by adding whitespace).
# See ht... | [
"def",
"_be_ie_unfriendly",
"(",
"status",
")",
":",
"response",
"=",
"cherrypy",
".",
"serving",
".",
"response",
"# For some statuses, Internet Explorer 5+ shows \"friendly error",
"# messages\" instead of our response.body if the body is smaller",
"# than a given size. Fix this by r... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cherrypy/_cperror.py#L557-L577 | ||||
qLab/qLib | a34f45d22fe7315991bb822824c035fbc9a2a5e8 | scripts/python/qliblabels.py | python | apply_naming | (node) | . | . | [
"."
] | def apply_naming(node):
'''.'''
"""
TODO: make sure to
- remove _all_ known prefixes as well, when necessary
- rename to a default name if previous tagging had an explicit naming scheme
"""
pass
c = node.type().category().name().lower() | [
"def",
"apply_naming",
"(",
"node",
")",
":",
"\"\"\"\n\tTODO: make sure to\n\t- remove _all_ known prefixes as well, when necessary\n\t- rename to a default name if previous tagging had an explicit naming scheme\n\t\"\"\"",
"pass",
"c",
"=",
"node",
".",
"type",
"(",
")",
".",
"cate... | https://github.com/qLab/qLib/blob/a34f45d22fe7315991bb822824c035fbc9a2a5e8/scripts/python/qliblabels.py#L225-L233 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/grains/core.py | python | _bsd_cpudata | (osdata) | return grains | Return CPU information for BSD-like systems | Return CPU information for BSD-like systems | [
"Return",
"CPU",
"information",
"for",
"BSD",
"-",
"like",
"systems"
] | def _bsd_cpudata(osdata):
"""
Return CPU information for BSD-like systems
"""
# Provides:
# cpuarch
# num_cpus
# cpu_model
# cpu_flags
sysctl = salt.utils.path.which("sysctl")
arch = salt.utils.path.which("arch")
cmds = {}
if sysctl:
cmds.update(
... | [
"def",
"_bsd_cpudata",
"(",
"osdata",
")",
":",
"# Provides:",
"# cpuarch",
"# num_cpus",
"# cpu_model",
"# cpu_flags",
"sysctl",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"\"sysctl\"",
")",
"arch",
"=",
"salt",
".",
"utils",
".",
"p... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/grains/core.py#L365-L430 | |
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/property_package.py | python | PropertyPackage.plot_TP | (self, zs, Tmin=None, Tmax=None, pts=50, branches=[],
ignore_errors=True, values=False) | [] | def plot_TP(self, zs, Tmin=None, Tmax=None, pts=50, branches=[],
ignore_errors=True, values=False): # pragma: no cover
if not has_matplotlib() and not values:
raise Exception('Optional dependency matplotlib is required for plotting')
if not Tmin:
Tmin = min(self.T... | [
"def",
"plot_TP",
"(",
"self",
",",
"zs",
",",
"Tmin",
"=",
"None",
",",
"Tmax",
"=",
"None",
",",
"pts",
"=",
"50",
",",
"branches",
"=",
"[",
"]",
",",
"ignore_errors",
"=",
"True",
",",
"values",
"=",
"False",
")",
":",
"# pragma: no cover",
"if... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/property_package.py#L852-L908 | ||||
JoneXiong/oejia_weshop | 36e74b9892661ab6ef508a20b6d6922ae990f3f5 | const.py | python | SortedDict.insert | (self, index, key, value) | Inserts the key, value pair before the item with the given index. | Inserts the key, value pair before the item with the given index. | [
"Inserts",
"the",
"key",
"value",
"pair",
"before",
"the",
"item",
"with",
"the",
"given",
"index",
"."
] | def insert(self, index, key, value):
"""Inserts the key, value pair before the item with the given index."""
warnings.warn(
"SortedDict.insert is deprecated", PendingDeprecationWarning,
stacklevel=2
)
if key in self.keyOrder:
n = self.keyOrder.index(ke... | [
"def",
"insert",
"(",
"self",
",",
"index",
",",
"key",
",",
"value",
")",
":",
"warnings",
".",
"warn",
"(",
"\"SortedDict.insert is deprecated\"",
",",
"PendingDeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"if",
"key",
"in",
"self",
".",
"keyOrder... | https://github.com/JoneXiong/oejia_weshop/blob/36e74b9892661ab6ef508a20b6d6922ae990f3f5/const.py#L119-L131 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/robotparser.py | python | RobotFileParser.read | (self) | Reads the robots.txt URL and feeds it to the parser. | Reads the robots.txt URL and feeds it to the parser. | [
"Reads",
"the",
"robots",
".",
"txt",
"URL",
"and",
"feeds",
"it",
"to",
"the",
"parser",
"."
] | def read(self):
"""Reads the robots.txt URL and feeds it to the parser."""
opener = URLopener()
f = opener.open(self.url)
lines = [line.strip() for line in f]
f.close()
self.errcode = opener.errcode
if self.errcode in (401, 403):
self.disallow_all = Tr... | [
"def",
"read",
"(",
"self",
")",
":",
"opener",
"=",
"URLopener",
"(",
")",
"f",
"=",
"opener",
".",
"open",
"(",
"self",
".",
"url",
")",
"lines",
"=",
"[",
"line",
".",
"strip",
"(",
")",
"for",
"line",
"in",
"f",
"]",
"f",
".",
"close",
"(... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/robotparser.py#L54-L66 | ||
DeepRNN/image_captioning | ee6936c3a1a8872ae7b055cfc8762fa323b01412 | utils/coco/pycocoevalcap/cider/cider_scorer.py | python | CiderScorer.cook_append | (self, test, refs) | called by constructor and __iadd__ to avoid creating new instances. | called by constructor and __iadd__ to avoid creating new instances. | [
"called",
"by",
"constructor",
"and",
"__iadd__",
"to",
"avoid",
"creating",
"new",
"instances",
"."
] | def cook_append(self, test, refs):
'''called by constructor and __iadd__ to avoid creating new instances.'''
if refs is not None:
self.crefs.append(cook_refs(refs))
if test is not None:
self.ctest.append(cook_test(test)) ## N.B.: -1
else:
... | [
"def",
"cook_append",
"(",
"self",
",",
"test",
",",
"refs",
")",
":",
"if",
"refs",
"is",
"not",
"None",
":",
"self",
".",
"crefs",
".",
"append",
"(",
"cook_refs",
"(",
"refs",
")",
")",
"if",
"test",
"is",
"not",
"None",
":",
"self",
".",
"cte... | https://github.com/DeepRNN/image_captioning/blob/ee6936c3a1a8872ae7b055cfc8762fa323b01412/utils/coco/pycocoevalcap/cider/cider_scorer.py#L68-L76 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/helpdesk/models.py | python | Ticket._get_priority_css_class | (self) | Return the bootstrap class corresponding to the priority. | Return the bootstrap class corresponding to the priority. | [
"Return",
"the",
"bootstrap",
"class",
"corresponding",
"to",
"the",
"priority",
"."
] | def _get_priority_css_class(self):
"""
Return the bootstrap class corresponding to the priority.
"""
if self.priority == 2:
return "warning"
elif self.priority == 1:
return "danger"
else:
return "" | [
"def",
"_get_priority_css_class",
"(",
"self",
")",
":",
"if",
"self",
".",
"priority",
"==",
"2",
":",
"return",
"\"warning\"",
"elif",
"self",
".",
"priority",
"==",
"1",
":",
"return",
"\"danger\"",
"else",
":",
"return",
"\"\""
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/helpdesk/models.py#L435-L444 | ||
quodlibet/quodlibet | e3099c89f7aa6524380795d325cc14630031886c | quodlibet/ext/events/searchprovider.py | python | get_gs_provider_files | () | return ini_files | Return all installed search provider files for GNOME Shell | Return all installed search provider files for GNOME Shell | [
"Return",
"all",
"installed",
"search",
"provider",
"files",
"for",
"GNOME",
"Shell"
] | def get_gs_provider_files():
"""Return all installed search provider files for GNOME Shell"""
ini_files = []
for d in xdg_get_system_data_dirs():
path = os.path.join(d, "gnome-shell", "search-providers")
try:
for entry in os.listdir(path):
if entry.endswith(".ini... | [
"def",
"get_gs_provider_files",
"(",
")",
":",
"ini_files",
"=",
"[",
"]",
"for",
"d",
"in",
"xdg_get_system_data_dirs",
"(",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"d",
",",
"\"gnome-shell\"",
",",
"\"search-providers\"",
")",
"try",
... | https://github.com/quodlibet/quodlibet/blob/e3099c89f7aa6524380795d325cc14630031886c/quodlibet/ext/events/searchprovider.py#L42-L54 | |
styxit/HTPC-Manager | 490697460b4fa1797106aece27d873bc256b2ff1 | libs/formencode/htmlrename.py | python | rename | (form, rename_func) | return p.text() | Rename all the form fields in the form (a string), using rename_func
rename_func will be called with one argument, the name of the
field, and should return a new name. | Rename all the form fields in the form (a string), using rename_func | [
"Rename",
"all",
"the",
"form",
"fields",
"in",
"the",
"form",
"(",
"a",
"string",
")",
"using",
"rename_func"
] | def rename(form, rename_func):
"""
Rename all the form fields in the form (a string), using rename_func
rename_func will be called with one argument, the name of the
field, and should return a new name.
"""
p = RenamingParser(rename_func)
p.feed(form)
p.close()
return p.text() | [
"def",
"rename",
"(",
"form",
",",
"rename_func",
")",
":",
"p",
"=",
"RenamingParser",
"(",
"rename_func",
")",
"p",
".",
"feed",
"(",
"form",
")",
"p",
".",
"close",
"(",
")",
"return",
"p",
".",
"text",
"(",
")"
] | https://github.com/styxit/HTPC-Manager/blob/490697460b4fa1797106aece27d873bc256b2ff1/libs/formencode/htmlrename.py#L10-L20 | |
ethereum/py-evm | 026ee20f8d9b70d7c1b6a4fb9484d5489d425e54 | eth/db/header.py | python | HeaderDB._find_new_ancestors | (cls,
db: DatabaseAPI,
header: BlockHeaderAPI,
genesis_parent_hash: Hash32) | Returns the chain leading up from the given header until (but not including)
the first ancestor it has in common with our canonical chain.
If D is the canonical head in the following chain, and F is the new header,
then this function returns (F, E).
A - B - C - D
\
... | Returns the chain leading up from the given header until (but not including)
the first ancestor it has in common with our canonical chain. | [
"Returns",
"the",
"chain",
"leading",
"up",
"from",
"the",
"given",
"header",
"until",
"(",
"but",
"not",
"including",
")",
"the",
"first",
"ancestor",
"it",
"has",
"in",
"common",
"with",
"our",
"canonical",
"chain",
"."
] | def _find_new_ancestors(cls,
db: DatabaseAPI,
header: BlockHeaderAPI,
genesis_parent_hash: Hash32) -> Iterable[BlockHeaderAPI]:
"""
Returns the chain leading up from the given header until (but not including)
the... | [
"def",
"_find_new_ancestors",
"(",
"cls",
",",
"db",
":",
"DatabaseAPI",
",",
"header",
":",
"BlockHeaderAPI",
",",
"genesis_parent_hash",
":",
"Hash32",
")",
"->",
"Iterable",
"[",
"BlockHeaderAPI",
"]",
":",
"h",
"=",
"header",
"while",
"True",
":",
"try",... | https://github.com/ethereum/py-evm/blob/026ee20f8d9b70d7c1b6a4fb9484d5489d425e54/eth/db/header.py#L562-L599 | ||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/gui/api_call_robot_router.py | python | ApiRobotCreateFlowHandler.Handle | (self, args, context=None) | return delegate.Handle(delegate_args, context=context) | [] | def Handle(self, args, context=None):
if not args.client_id:
raise RuntimeError("Client id has to be specified.")
if not args.flow.name:
raise RuntimeError("Flow name is not specified.")
delegate = api_flow.ApiCreateFlowHandler()
# Note that runner_args are dropped. From all the arguments ... | [
"def",
"Handle",
"(",
"self",
",",
"args",
",",
"context",
"=",
"None",
")",
":",
"if",
"not",
"args",
".",
"client_id",
":",
"raise",
"RuntimeError",
"(",
"\"Client id has to be specified.\"",
")",
"if",
"not",
"args",
".",
"flow",
".",
"name",
":",
"ra... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_call_robot_router.py#L100-L113 | |||
fkie/multimaster_fkie | 3d23df29d25d71a75c66bbd3cc6e9cbb255724d8 | fkie_node_manager/src/fkie_node_manager/parameter_dialog.py | python | ArrayEntry.value | (self, with_tags=False, only_changed=False) | return result | Retruns a dictionary for an entry of an array, e.g. {name: value}.
If with_tags is True it looks like: {name: {':value': value, ':type': type}}
:rtype: dict | Retruns a dictionary for an entry of an array, e.g. {name: value}.
If with_tags is True it looks like: {name: {':value': value, ':type': type}}
:rtype: dict | [
"Retruns",
"a",
"dictionary",
"for",
"an",
"entry",
"of",
"an",
"array",
"e",
".",
"g",
".",
"{",
"name",
":",
"value",
"}",
".",
"If",
"with_tags",
"is",
"True",
"it",
"looks",
"like",
":",
"{",
"name",
":",
"{",
":",
"value",
":",
"value",
":",... | def value(self, with_tags=False, only_changed=False):
'''
Retruns a dictionary for an entry of an array, e.g. {name: value}.
If with_tags is True it looks like: {name: {':value': value, ':type': type}}
:rtype: dict
'''
result = dict()
for param in self.params:
... | [
"def",
"value",
"(",
"self",
",",
"with_tags",
"=",
"False",
",",
"only_changed",
"=",
"False",
")",
":",
"result",
"=",
"dict",
"(",
")",
"for",
"param",
"in",
"self",
".",
"params",
":",
"val",
"=",
"param",
".",
"value",
"(",
"with_tags",
")",
"... | https://github.com/fkie/multimaster_fkie/blob/3d23df29d25d71a75c66bbd3cc6e9cbb255724d8/fkie_node_manager/src/fkie_node_manager/parameter_dialog.py#L785-L796 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/distutils/sysconfig.py | python | get_config_var | (name) | return get_config_vars().get(name) | Return the value of a single variable using the dictionary
returned by 'get_config_vars()'. Equivalent to
get_config_vars().get(name) | Return the value of a single variable using the dictionary
returned by 'get_config_vars()'. Equivalent to
get_config_vars().get(name) | [
"Return",
"the",
"value",
"of",
"a",
"single",
"variable",
"using",
"the",
"dictionary",
"returned",
"by",
"get_config_vars",
"()",
".",
"Equivalent",
"to",
"get_config_vars",
"()",
".",
"get",
"(",
"name",
")"
] | def get_config_var(name):
"""Return the value of a single variable using the dictionary
returned by 'get_config_vars()'. Equivalent to
get_config_vars().get(name)
"""
return get_config_vars().get(name) | [
"def",
"get_config_var",
"(",
"name",
")",
":",
"return",
"get_config_vars",
"(",
")",
".",
"get",
"(",
"name",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/distutils/sysconfig.py#L566-L571 | |
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/python27/1.0/lib/tokenize.py | python | generate_tokens | (readline) | The generate_tokens() generator requires one argument, readline, which
must be a callable object which provides the same interface as the
readline() method of built-in file objects. Each call to the function
should return one line of input as a string. Alternately, readline
can be a callable function t... | The generate_tokens() generator requires one argument, readline, which
must be a callable object which provides the same interface as the
readline() method of built-in file objects. Each call to the function
should return one line of input as a string. Alternately, readline
can be a callable function t... | [
"The",
"generate_tokens",
"()",
"generator",
"requires",
"one",
"argument",
"readline",
"which",
"must",
"be",
"a",
"callable",
"object",
"which",
"provides",
"the",
"same",
"interface",
"as",
"the",
"readline",
"()",
"method",
"of",
"built",
"-",
"in",
"file"... | def generate_tokens(readline):
"""
The generate_tokens() generator requires one argument, readline, which
must be a callable object which provides the same interface as the
readline() method of built-in file objects. Each call to the function
should return one line of input as a string. Alternately... | [
"def",
"generate_tokens",
"(",
"readline",
")",
":",
"lnum",
"=",
"parenlev",
"=",
"continued",
"=",
"0",
"namechars",
",",
"numchars",
"=",
"string",
".",
"ascii_letters",
"+",
"'_'",
",",
"'0123456789'",
"contstr",
",",
"needcont",
"=",
"''",
",",
"0",
... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/tokenize.py#L287-L442 | ||
antlong/picka | 3f048b803a32213b4e3b64ccc64a4a78997f790c | picka/picka.py | python | email | (length=8, domain='@example.com') | return AttrDict(
{
"length": length,
"domain": domain,
"email": ''.join(choice(
ascii_lowercase) for _ in range(
length)) + domain
}
) | Generates an email address. | Generates an email address. | [
"Generates",
"an",
"email",
"address",
"."
] | def email(length=8, domain='@example.com'):
# todo: remove args on length and domain.
"""Generates an email address."""
return AttrDict(
{
"length": length,
"domain": domain,
"email": ''.join(choice(
ascii_lowercase) for _ in range(
... | [
"def",
"email",
"(",
"length",
"=",
"8",
",",
"domain",
"=",
"'@example.com'",
")",
":",
"# todo: remove args on length and domain.",
"return",
"AttrDict",
"(",
"{",
"\"length\"",
":",
"length",
",",
"\"domain\"",
":",
"domain",
",",
"\"email\"",
":",
"''",
".... | https://github.com/antlong/picka/blob/3f048b803a32213b4e3b64ccc64a4a78997f790c/picka/picka.py#L723-L734 | |
Phylliade/ikpy | 3966be998ce0ece1d1068dd11b5f2c42b172cf30 | contrib/transformations.py | python | distance | (p1, p2) | return sqrt(x * x + y * y + z * z) | Cartesian distance between two PoseStamped or PoseLists
:param p1: point 1 (list, Pose or PoseStamped)
:param p2: point 2 (list, Pose or PoseStamped)
:return: cartesian distance (float) | Cartesian distance between two PoseStamped or PoseLists
:param p1: point 1 (list, Pose or PoseStamped)
:param p2: point 2 (list, Pose or PoseStamped)
:return: cartesian distance (float) | [
"Cartesian",
"distance",
"between",
"two",
"PoseStamped",
"or",
"PoseLists",
":",
"param",
"p1",
":",
"point",
"1",
"(",
"list",
"Pose",
"or",
"PoseStamped",
")",
":",
"param",
"p2",
":",
"point",
"2",
"(",
"list",
"Pose",
"or",
"PoseStamped",
")",
":",
... | def distance(p1, p2):
"""
Cartesian distance between two PoseStamped or PoseLists
:param p1: point 1 (list, Pose or PoseStamped)
:param p2: point 2 (list, Pose or PoseStamped)
:return: cartesian distance (float)
"""
def xyz(some_pose):
if isinstance(some_pose, PoseStamped):
... | [
"def",
"distance",
"(",
"p1",
",",
"p2",
")",
":",
"def",
"xyz",
"(",
"some_pose",
")",
":",
"if",
"isinstance",
"(",
"some_pose",
",",
"PoseStamped",
")",
":",
"return",
"some_pose",
".",
"pose",
".",
"position",
".",
"x",
",",
"some_pose",
".",
"po... | https://github.com/Phylliade/ikpy/blob/3966be998ce0ece1d1068dd11b5f2c42b172cf30/contrib/transformations.py#L244-L268 | |
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/io/nwchem.py | python | NwInput.from_string | (cls, string_input) | return NwInput(
mol,
tasks=tasks,
directives=directives,
geometry_options=geom_options,
symmetry_options=symmetry_options,
memory_options=memory_options,
) | Read an NwInput from a string. Currently tested to work with
files generated from this class itself.
Args:
string_input: string_input to parse.
Returns:
NwInput object | Read an NwInput from a string. Currently tested to work with
files generated from this class itself. | [
"Read",
"an",
"NwInput",
"from",
"a",
"string",
".",
"Currently",
"tested",
"to",
"work",
"with",
"files",
"generated",
"from",
"this",
"class",
"itself",
"."
] | def from_string(cls, string_input):
"""
Read an NwInput from a string. Currently tested to work with
files generated from this class itself.
Args:
string_input: string_input to parse.
Returns:
NwInput object
"""
directives = []
ta... | [
"def",
"from_string",
"(",
"cls",
",",
"string_input",
")",
":",
"directives",
"=",
"[",
"]",
"tasks",
"=",
"[",
"]",
"charge",
"=",
"None",
"spin_multiplicity",
"=",
"None",
"title",
"=",
"None",
"basis_set",
"=",
"None",
"basis_set_option",
"=",
"None",
... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/io/nwchem.py#L435-L531 | |
iGio90/Dwarf | bb3011cdffd209c7e3f5febe558053bf649ca69c | dwarf_debugger/lib/utils.py | python | do_shell_command | (cmd, timeout=60) | Execute cmd | Execute cmd | [
"Execute",
"cmd"
] | def do_shell_command(cmd, timeout=60):
""" Execute cmd
"""
try:
# capture output is only supported in py 3.7
if sys.version_info.minor >= 7:
result = subprocess.run(
cmd.split(' '), timeout=timeout, capture_output=True)
else:
result = subproces... | [
"def",
"do_shell_command",
"(",
"cmd",
",",
"timeout",
"=",
"60",
")",
":",
"try",
":",
"# capture output is only supported in py 3.7",
"if",
"sys",
".",
"version_info",
".",
"minor",
">=",
"7",
":",
"result",
"=",
"subprocess",
".",
"run",
"(",
"cmd",
".",
... | https://github.com/iGio90/Dwarf/blob/bb3011cdffd209c7e3f5febe558053bf649ca69c/dwarf_debugger/lib/utils.py#L29-L51 | ||
goace/personal-file-sharing-center | 4a5b903b003f2db1306e77c5e51b6660fc5dbc6a | web/wsgiserver/__init__.py | python | WSGIPathInfoDispatcher.__call__ | (self, environ, start_response) | return [''] | [] | def __call__(self, environ, start_response):
path = environ["PATH_INFO"] or "/"
for p, app in self.apps:
# The apps list should be sorted by length, descending.
if path.startswith(p + "/") or path == p:
environ = environ.copy()
environ["SCRIPT_NAME... | [
"def",
"__call__",
"(",
"self",
",",
"environ",
",",
"start_response",
")",
":",
"path",
"=",
"environ",
"[",
"\"PATH_INFO\"",
"]",
"or",
"\"/\"",
"for",
"p",
",",
"app",
"in",
"self",
".",
"apps",
":",
"# The apps list should be sorted by length, descending.",
... | https://github.com/goace/personal-file-sharing-center/blob/4a5b903b003f2db1306e77c5e51b6660fc5dbc6a/web/wsgiserver/__init__.py#L2206-L2218 | |||
aws/sagemaker-containers | 526dda90d636c7fb0c25791e6c57d077bd972000 | src/sagemaker_containers/_logging.py | python | get_logger | () | return logging.getLogger("sagemaker-containers") | Returns a logger with the name 'sagemaker-containers',
creating it if necessary. | Returns a logger with the name 'sagemaker-containers',
creating it if necessary. | [
"Returns",
"a",
"logger",
"with",
"the",
"name",
"sagemaker",
"-",
"containers",
"creating",
"it",
"if",
"necessary",
"."
] | def get_logger():
"""Returns a logger with the name 'sagemaker-containers',
creating it if necessary.
"""
return logging.getLogger("sagemaker-containers") | [
"def",
"get_logger",
"(",
")",
":",
"return",
"logging",
".",
"getLogger",
"(",
"\"sagemaker-containers\"",
")"
] | https://github.com/aws/sagemaker-containers/blob/526dda90d636c7fb0c25791e6c57d077bd972000/src/sagemaker_containers/_logging.py#L22-L26 | |
fastnlp/fastNLP | fb645d370f4cc1b00c7dbb16c1ff4542327c46e5 | reproduction/Summarization/Baseline/transformer/Models.py | python | get_sinusoid_encoding_table | (n_position, d_hid, padding_idx=None) | return torch.FloatTensor(sinusoid_table) | Sinusoid position encoding table | Sinusoid position encoding table | [
"Sinusoid",
"position",
"encoding",
"table"
] | def get_sinusoid_encoding_table(n_position, d_hid, padding_idx=None):
''' Sinusoid position encoding table '''
def cal_angle(position, hid_idx):
return position / np.power(10000, 2 * (hid_idx // 2) / d_hid)
def get_posi_angle_vec(position):
return [cal_angle(position, hid_j) for hid_j in r... | [
"def",
"get_sinusoid_encoding_table",
"(",
"n_position",
",",
"d_hid",
",",
"padding_idx",
"=",
"None",
")",
":",
"def",
"cal_angle",
"(",
"position",
",",
"hid_idx",
")",
":",
"return",
"position",
"/",
"np",
".",
"power",
"(",
"10000",
",",
"2",
"*",
"... | https://github.com/fastnlp/fastNLP/blob/fb645d370f4cc1b00c7dbb16c1ff4542327c46e5/reproduction/Summarization/Baseline/transformer/Models.py#L16-L34 | |
LuxCoreRender/BlendLuxCore | bf31ca58501d54c02acd97001b6db7de81da7cbf | draw/viewport.py | python | FrameBuffer.__init__ | (self, engine, context, scene) | [] | def __init__(self, engine, context, scene):
filmsize = utils.calc_filmsize(scene, context)
self._width, self._height = filmsize
self._border = utils.calc_blender_border(scene, context)
self._offset_x, self._offset_y = self._calc_offset(context, scene, self._border)
self._pixel_si... | [
"def",
"__init__",
"(",
"self",
",",
"engine",
",",
"context",
",",
"scene",
")",
":",
"filmsize",
"=",
"utils",
".",
"calc_filmsize",
"(",
"scene",
",",
"context",
")",
"self",
".",
"_width",
",",
"self",
".",
"_height",
"=",
"filmsize",
"self",
".",
... | https://github.com/LuxCoreRender/BlendLuxCore/blob/bf31ca58501d54c02acd97001b6db7de81da7cbf/draw/viewport.py#L46-L81 | ||||
jisaacks/GitGutter | 1badb94bd1827f4b3f96fd90c26bf1b348783ff9 | modules/handler.py | python | GitGutterHandler.diff_line_change | (self, row) | return ([], -1, -1, {}) | Use cached diff result to extract the changes of a certain line.
Arguments:
row (int): The row to find the changes for
Returns:
tuple: The tuple contains 4 items of information about changes
around the row with (deleted_lines, start, size, meta). | Use cached diff result to extract the changes of a certain line. | [
"Use",
"cached",
"diff",
"result",
"to",
"extract",
"the",
"changes",
"of",
"a",
"certain",
"line",
"."
] | def diff_line_change(self, row):
"""Use cached diff result to extract the changes of a certain line.
Arguments:
row (int): The row to find the changes for
Returns:
tuple: The tuple contains 4 items of information about changes
around the row with (delete... | [
"def",
"diff_line_change",
"(",
"self",
",",
"row",
")",
":",
"hunk_re",
"=",
"r'^@@ \\-(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@'",
"hunks",
"=",
"re",
".",
"finditer",
"(",
"hunk_re",
",",
"self",
".",
"_git_diff_cache",
",",
"re",
".",
"MULTILINE",
")",
"# if wrap ... | https://github.com/jisaacks/GitGutter/blob/1badb94bd1827f4b3f96fd90c26bf1b348783ff9/modules/handler.py#L478-L559 | |
siegfried415/portia-dashboard | b1e116ea95afd736caf55df5d16e6da28c124eec | slybot/slybot/item.py | python | SlybotFieldDescriptor.__init__ | (self, name, description, field_type_processor, required=False) | Create a new SlybotFieldDescriptor with the given name and description.
The field_type_processor is used for extraction and is publicly available | Create a new SlybotFieldDescriptor with the given name and description.
The field_type_processor is used for extraction and is publicly available | [
"Create",
"a",
"new",
"SlybotFieldDescriptor",
"with",
"the",
"given",
"name",
"and",
"description",
".",
"The",
"field_type_processor",
"is",
"used",
"for",
"extraction",
"and",
"is",
"publicly",
"available"
] | def __init__(self, name, description, field_type_processor, required=False):
"""Create a new SlybotFieldDescriptor with the given name and description.
The field_type_processor is used for extraction and is publicly available
"""
FieldDescriptor.__init__(self, name, description,
... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"description",
",",
"field_type_processor",
",",
"required",
"=",
"False",
")",
":",
"FieldDescriptor",
".",
"__init__",
"(",
"self",
",",
"name",
",",
"description",
",",
"field_type_processor",
".",
"extract"... | https://github.com/siegfried415/portia-dashboard/blob/b1e116ea95afd736caf55df5d16e6da28c124eec/slybot/slybot/item.py#L61-L69 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py | python | Select.append_from | (self, fromclause) | append the given FromClause expression to this select() construct's
FROM clause.
This is an **in-place** mutation method; the
:meth:`~.Select.select_from` method is preferred, as it provides
standard :term:`method chaining`. | append the given FromClause expression to this select() construct's
FROM clause. | [
"append",
"the",
"given",
"FromClause",
"expression",
"to",
"this",
"select",
"()",
"construct",
"s",
"FROM",
"clause",
"."
] | def append_from(self, fromclause):
"""append the given FromClause expression to this select() construct's
FROM clause.
This is an **in-place** mutation method; the
:meth:`~.Select.select_from` method is preferred, as it provides
standard :term:`method chaining`.
"""
... | [
"def",
"append_from",
"(",
"self",
",",
"fromclause",
")",
":",
"self",
".",
"_reset_exported",
"(",
")",
"fromclause",
"=",
"_interpret_as_from",
"(",
"fromclause",
")",
"self",
".",
"_from_obj",
"=",
"self",
".",
"_from_obj",
".",
"union",
"(",
"[",
"fro... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py#L3419-L3430 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/SimpleXMLRPCServer.py | python | SimpleXMLRPCRequestHandler.log_request | (self, code='-', size='-') | Selectively log an accepted request. | Selectively log an accepted request. | [
"Selectively",
"log",
"an",
"accepted",
"request",
"."
] | def log_request(self, code='-', size='-'):
"""Selectively log an accepted request."""
if self.server.logRequests:
BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size) | [
"def",
"log_request",
"(",
"self",
",",
"code",
"=",
"'-'",
",",
"size",
"=",
"'-'",
")",
":",
"if",
"self",
".",
"server",
".",
"logRequests",
":",
"BaseHTTPServer",
".",
"BaseHTTPRequestHandler",
".",
"log_request",
"(",
"self",
",",
"code",
",",
"size... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/SimpleXMLRPCServer.py#L563-L567 | ||
pympler/pympler | 8019a883eec547d91ecda6ba12669d4f4504c625 | pympler/classtracker.py | python | ClassTracker.__init__ | (self, stream: Optional[IO] = None) | Creates a new `ClassTracker` object.
:param stream: Output stream to use when printing statistics via
``stats``. | Creates a new `ClassTracker` object. | [
"Creates",
"a",
"new",
"ClassTracker",
"object",
"."
] | def __init__(self, stream: Optional[IO] = None):
"""
Creates a new `ClassTracker` object.
:param stream: Output stream to use when printing statistics via
``stats``.
"""
# Dictionaries of TrackedObject objects associated with the actual
# objects that are tra... | [
"def",
"__init__",
"(",
"self",
",",
"stream",
":",
"Optional",
"[",
"IO",
"]",
"=",
"None",
")",
":",
"# Dictionaries of TrackedObject objects associated with the actual",
"# objects that are tracked. 'index' uses the class name as the key and",
"# associates a list of tracked obj... | https://github.com/pympler/pympler/blob/8019a883eec547d91ecda6ba12669d4f4504c625/pympler/classtracker.py#L258-L293 | ||
pazz/alot | 52f11f089df19cf336ad0983368e880dc5364149 | alot/buffers/thread.py | python | ThreadBuffer.focus_selected_message | (self) | focus the summary line of currently focussed message | focus the summary line of currently focussed message | [
"focus",
"the",
"summary",
"line",
"of",
"currently",
"focussed",
"message"
] | def focus_selected_message(self):
"""focus the summary line of currently focussed message"""
# move focus to summary (root of current MessageTree)
self.set_focus(self.get_selected_message_position()) | [
"def",
"focus_selected_message",
"(",
"self",
")",
":",
"# move focus to summary (root of current MessageTree)",
"self",
".",
"set_focus",
"(",
"self",
".",
"get_selected_message_position",
"(",
")",
")"
] | https://github.com/pazz/alot/blob/52f11f089df19cf336ad0983368e880dc5364149/alot/buffers/thread.py#L196-L199 | ||
TheAlgorithms/Python | 9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c | dynamic_programming/max_sub_array.py | python | max_sub_array | (nums: list[int]) | return best | Finds the contiguous subarray which has the largest sum and return its sum.
>>> max_sub_array([-2, 1, -3, 4, -1, 2, 1, -5, 4])
6
An empty (sub)array has sum 0.
>>> max_sub_array([])
0
If all elements are negative, the largest subarray would be the empty array,
having the sum 0.
>>> ma... | Finds the contiguous subarray which has the largest sum and return its sum. | [
"Finds",
"the",
"contiguous",
"subarray",
"which",
"has",
"the",
"largest",
"sum",
"and",
"return",
"its",
"sum",
"."
] | def max_sub_array(nums: list[int]) -> int:
"""
Finds the contiguous subarray which has the largest sum and return its sum.
>>> max_sub_array([-2, 1, -3, 4, -1, 2, 1, -5, 4])
6
An empty (sub)array has sum 0.
>>> max_sub_array([])
0
If all elements are negative, the largest subarray wou... | [
"def",
"max_sub_array",
"(",
"nums",
":",
"list",
"[",
"int",
"]",
")",
"->",
"int",
":",
"best",
"=",
"0",
"current",
"=",
"0",
"for",
"i",
"in",
"nums",
":",
"current",
"+=",
"i",
"if",
"current",
"<",
"0",
":",
"current",
"=",
"0",
"best",
"... | https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/dynamic_programming/max_sub_array.py#L41-L68 | |
roglew/guppy-proxy | 01df16be71dd9f23d7de415a315821659c29bc63 | guppyproxy/proxy.py | python | HTTPRequest.body | (self, bs) | [] | def body(self, bs):
self.headers_only = False
if type(bs) is str:
self._body = bs.encode()
elif type(bs) is bytes:
self._body = bs
else:
raise Exception("invalid body type: {}".format(type(bs)))
self.headers.set("Content-Length", str(len(self._... | [
"def",
"body",
"(",
"self",
",",
"bs",
")",
":",
"self",
".",
"headers_only",
"=",
"False",
"if",
"type",
"(",
"bs",
")",
"is",
"str",
":",
"self",
".",
"_body",
"=",
"bs",
".",
"encode",
"(",
")",
"elif",
"type",
"(",
"bs",
")",
"is",
"bytes",... | https://github.com/roglew/guppy-proxy/blob/01df16be71dd9f23d7de415a315821659c29bc63/guppyproxy/proxy.py#L339-L347 | ||||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/feed_item_set_service/client.py | python | FeedItemSetServiceClient.parse_common_organization_path | (path: str) | return m.groupdict() if m else {} | Parse a organization path into its component segments. | Parse a organization path into its component segments. | [
"Parse",
"a",
"organization",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_common_organization_path(path: str) -> Dict[str, str]:
"""Parse a organization path into its component segments."""
m = re.match(r"^organizations/(?P<organization>.+?)$", path)
return m.groupdict() if m else {} | [
"def",
"parse_common_organization_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^organizations/(?P<organization>.+?)$\"",
",",
"path",
")",
"return",
"m",
".",
"groupdict",
"(",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/feed_item_set_service/client.py#L240-L243 | |
gwpy/gwpy | 82becd78d166a32985cb657a54d0d39f6a207739 | gwpy/plot/gps.py | python | GPSScale.get_transform | (self) | [] | def get_transform(self):
# get current settings
epoch = self.get_epoch()
unit = self.get_unit()
# dynamically set epoch and/or unit if None
if unit is None:
self.set_unit(self._auto_unit(self.axis))
if epoch is None:
self.set_epoch(self._auto_epoc... | [
"def",
"get_transform",
"(",
"self",
")",
":",
"# get current settings",
"epoch",
"=",
"self",
".",
"get_epoch",
"(",
")",
"unit",
"=",
"self",
".",
"get_unit",
"(",
")",
"# dynamically set epoch and/or unit if None",
"if",
"unit",
"is",
"None",
":",
"self",
"... | https://github.com/gwpy/gwpy/blob/82becd78d166a32985cb657a54d0d39f6a207739/gwpy/plot/gps.py#L455-L472 | ||||
openbmc/openbmc | 5f4109adae05f4d6925bfe960007d52f98c61086 | meta-security/lib/oeqa/runtime/cases/smack.py | python | SmackChangeSelfLabelPrivilege.test_privileged_change_self_label | (self) | Test if privileged process (with CAP_MAC_ADMIN privilege)
can change its label. | Test if privileged process (with CAP_MAC_ADMIN privilege)
can change its label. | [
"Test",
"if",
"privileged",
"process",
"(",
"with",
"CAP_MAC_ADMIN",
"privilege",
")",
"can",
"change",
"its",
"label",
"."
] | def test_privileged_change_self_label(self):
'''Test if privileged process (with CAP_MAC_ADMIN privilege)
can change its label.
'''
labelf = "/proc/self/attr/current"
command = "/bin/sh -c 'echo PRIVILEGED >%s; cat %s'" %(labelf, labelf)
status, output = self.target.run... | [
"def",
"test_privileged_change_self_label",
"(",
"self",
")",
":",
"labelf",
"=",
"\"/proc/self/attr/current\"",
"command",
"=",
"\"/bin/sh -c 'echo PRIVILEGED >%s; cat %s'\"",
"%",
"(",
"labelf",
",",
"labelf",
")",
"status",
",",
"output",
"=",
"self",
".",
"target"... | https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/meta-security/lib/oeqa/runtime/cases/smack.py#L134-L146 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/db/backends/__init__.py | python | BaseDatabaseIntrospection.sequence_list | (self) | return sequence_list | Returns a list of information about all DB sequences for all models in all apps. | Returns a list of information about all DB sequences for all models in all apps. | [
"Returns",
"a",
"list",
"of",
"information",
"about",
"all",
"DB",
"sequences",
"for",
"all",
"models",
"in",
"all",
"apps",
"."
] | def sequence_list(self):
"Returns a list of information about all DB sequences for all models in all apps."
from django.db import models, router
apps = models.get_apps()
sequence_list = []
for app in apps:
for model in models.get_models(app):
if not ... | [
"def",
"sequence_list",
"(",
"self",
")",
":",
"from",
"django",
".",
"db",
"import",
"models",
",",
"router",
"apps",
"=",
"models",
".",
"get_apps",
"(",
")",
"sequence_list",
"=",
"[",
"]",
"for",
"app",
"in",
"apps",
":",
"for",
"model",
"in",
"m... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/db/backends/__init__.py#L541-L565 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/helpers/entity_registry.py | python | async_setup_entity_restore | (hass: HomeAssistant, registry: EntityRegistry) | Set up the entity restore mechanism. | Set up the entity restore mechanism. | [
"Set",
"up",
"the",
"entity",
"restore",
"mechanism",
"."
] | def async_setup_entity_restore(hass: HomeAssistant, registry: EntityRegistry) -> None:
"""Set up the entity restore mechanism."""
@callback
def cleanup_restored_states_filter(event: Event) -> bool:
"""Clean up restored states filter."""
return bool(event.data["action"] == "remove")
@ca... | [
"def",
"async_setup_entity_restore",
"(",
"hass",
":",
"HomeAssistant",
",",
"registry",
":",
"EntityRegistry",
")",
"->",
"None",
":",
"@",
"callback",
"def",
"cleanup_restored_states_filter",
"(",
"event",
":",
"Event",
")",
"->",
"bool",
":",
"\"\"\"Clean up re... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/helpers/entity_registry.py#L801-L839 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/generic.py | python | NDFrame._reindex_axes | (self, axes, level, limit, tolerance, method, fill_value,
copy) | return obj | Perform the reindex for all the axes. | Perform the reindex for all the axes. | [
"Perform",
"the",
"reindex",
"for",
"all",
"the",
"axes",
"."
] | def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value,
copy):
"""Perform the reindex for all the axes."""
obj = self
for a in self._AXIS_ORDERS:
labels = axes[a]
if labels is None:
continue
ax = self._... | [
"def",
"_reindex_axes",
"(",
"self",
",",
"axes",
",",
"level",
",",
"limit",
",",
"tolerance",
",",
"method",
",",
"fill_value",
",",
"copy",
")",
":",
"obj",
"=",
"self",
"for",
"a",
"in",
"self",
".",
"_AXIS_ORDERS",
":",
"labels",
"=",
"axes",
"[... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/generic.py#L4358-L4376 | |
MobileChromeApps/mobile-chrome-apps | ab60c264e23624917a8ac9973d43a0b44e5f96c4 | chrome-cordova/gcmServer/xmpp/protocol.py | python | DataItem.setField | (self,name) | return self.addChild(node=DataField(name)) | Create if nessessary or get the existing datafield object with name 'name' and return it. | Create if nessessary or get the existing datafield object with name 'name' and return it. | [
"Create",
"if",
"nessessary",
"or",
"get",
"the",
"existing",
"datafield",
"object",
"with",
"name",
"name",
"and",
"return",
"it",
"."
] | def setField(self,name):
""" Create if nessessary or get the existing datafield object with name 'name' and return it. """
f=self.getField(name)
if f: return f
return self.addChild(node=DataField(name)) | [
"def",
"setField",
"(",
"self",
",",
"name",
")",
":",
"f",
"=",
"self",
".",
"getField",
"(",
"name",
")",
"if",
"f",
":",
"return",
"f",
"return",
"self",
".",
"addChild",
"(",
"node",
"=",
"DataField",
"(",
"name",
")",
")"
] | https://github.com/MobileChromeApps/mobile-chrome-apps/blob/ab60c264e23624917a8ac9973d43a0b44e5f96c4/chrome-cordova/gcmServer/xmpp/protocol.py#L743-L747 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/mako/util.py | python | update_wrapper | (decorated, fn) | return decorated | [] | def update_wrapper(decorated, fn):
decorated.__wrapped__ = fn
decorated.__name__ = fn.__name__
return decorated | [
"def",
"update_wrapper",
"(",
"decorated",
",",
"fn",
")",
":",
"decorated",
".",
"__wrapped__",
"=",
"fn",
"decorated",
".",
"__name__",
"=",
"fn",
".",
"__name__",
"return",
"decorated"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/mako/util.py#L19-L22 | |||
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v5_1/git/git_client_base.py | python | GitClientBase.get_pull_request_iterations | (self, repository_id, pull_request_id, project=None, include_commits=None) | return self._deserialize('[GitPullRequestIteration]', self._unwrap_collection(response)) | GetPullRequestIterations.
Get the list of iterations for the specified pull request.
:param str repository_id: ID or name of the repository.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:param bool include_commits: If true, in... | GetPullRequestIterations.
Get the list of iterations for the specified pull request.
:param str repository_id: ID or name of the repository.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:param bool include_commits: If true, in... | [
"GetPullRequestIterations",
".",
"Get",
"the",
"list",
"of",
"iterations",
"for",
"the",
"specified",
"pull",
"request",
".",
":",
"param",
"str",
"repository_id",
":",
"ID",
"or",
"name",
"of",
"the",
"repository",
".",
":",
"param",
"int",
"pull_request_id",... | def get_pull_request_iterations(self, repository_id, pull_request_id, project=None, include_commits=None):
"""GetPullRequestIterations.
Get the list of iterations for the specified pull request.
:param str repository_id: ID or name of the repository.
:param int pull_request_id: ID of the... | [
"def",
"get_pull_request_iterations",
"(",
"self",
",",
"repository_id",
",",
"pull_request_id",
",",
"project",
"=",
"None",
",",
"include_commits",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/git/git_client_base.py#L1531-L1555 | |
sightmachine/SimpleCV | 6c4d61b6d1d9d856b471910107cad0838954d2b2 | SimpleCV/MachineLearning/query_imgs/flickrapi2.py | python | FlickrAPI.__getCachedToken | (self) | Read and return a cached token, or None if not found.
The token is read from the cached token file, which is basically the
entire RSP response containing the auth element. | Read and return a cached token, or None if not found. | [
"Read",
"and",
"return",
"a",
"cached",
"token",
"or",
"None",
"if",
"not",
"found",
"."
] | def __getCachedToken(self):
"""Read and return a cached token, or None if not found.
The token is read from the cached token file, which is basically the
entire RSP response containing the auth element.
"""
try:
f = file(self.__getCachedTokenFilename(), "r")
... | [
"def",
"__getCachedToken",
"(",
"self",
")",
":",
"try",
":",
"f",
"=",
"file",
"(",
"self",
".",
"__getCachedTokenFilename",
"(",
")",
",",
"\"r\"",
")",
"data",
"=",
"f",
".",
"read",
"(",
")",
"f",
".",
"close",
"(",
")",
"rsp",
"=",
"XMLNode",
... | https://github.com/sightmachine/SimpleCV/blob/6c4d61b6d1d9d856b471910107cad0838954d2b2/SimpleCV/MachineLearning/query_imgs/flickrapi2.py#L403-L421 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_manage_node.py | python | Utils._write | (filename, contents) | Actually write the file contents to disk. This helps with mocking. | Actually write the file contents to disk. This helps with mocking. | [
"Actually",
"write",
"the",
"file",
"contents",
"to",
"disk",
".",
"This",
"helps",
"with",
"mocking",
"."
] | def _write(filename, contents):
''' Actually write the file contents to disk. This helps with mocking. '''
with open(filename, 'w') as sfd:
sfd.write(str(contents)) | [
"def",
"_write",
"(",
"filename",
",",
"contents",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"sfd",
":",
"sfd",
".",
"write",
"(",
"str",
"(",
"contents",
")",
")"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_manage_node.py#L1176-L1180 | ||
kamalgill/flask-appengine-template | 11760f83faccbb0d0afe416fc58e67ecfb4643c2 | src/lib/click/core.py | python | Parameter.__init__ | (self, param_decls=None, type=None, required=False,
default=None, callback=None, nargs=None, metavar=None,
expose_value=True, is_eager=False, envvar=None) | [] | def __init__(self, param_decls=None, type=None, required=False,
default=None, callback=None, nargs=None, metavar=None,
expose_value=True, is_eager=False, envvar=None):
self.name, self.opts, self.secondary_opts = \
self._parse_decls(param_decls or (), expose_value)
... | [
"def",
"__init__",
"(",
"self",
",",
"param_decls",
"=",
"None",
",",
"type",
"=",
"None",
",",
"required",
"=",
"False",
",",
"default",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"nargs",
"=",
"None",
",",
"metavar",
"=",
"None",
",",
"expose_... | https://github.com/kamalgill/flask-appengine-template/blob/11760f83faccbb0d0afe416fc58e67ecfb4643c2/src/lib/click/core.py#L1262-L1286 | ||||
laszukdawid/PyEMD | 9caf51c6cd1bc1e869d67d002310c1e81cba541a | PyEMD/compact.py | python | pade6 | (vec, h) | return TDMAsolver(Da, Db, Dc, rhs) | 6th Order compact finite difference scheme (non-periodic BC).
Lele, S. K. - Compact finite difference schemes with spectral-like
resolution. Journal of Computational Physics 103 (1992) 16-42 | 6th Order compact finite difference scheme (non-periodic BC). | [
"6th",
"Order",
"compact",
"finite",
"difference",
"scheme",
"(",
"non",
"-",
"periodic",
"BC",
")",
"."
] | def pade6(vec, h):
"""
6th Order compact finite difference scheme (non-periodic BC).
Lele, S. K. - Compact finite difference schemes with spectral-like
resolution. Journal of Computational Physics 103 (1992) 16-42
"""
n = len(vec)
rhs = np.zeros(n)
a = 14.0 / 18.0
b = 1.0 / 36.0
... | [
"def",
"pade6",
"(",
"vec",
",",
"h",
")",
":",
"n",
"=",
"len",
"(",
"vec",
")",
"rhs",
"=",
"np",
".",
"zeros",
"(",
"n",
")",
"a",
"=",
"14.0",
"/",
"18.0",
"b",
"=",
"1.0",
"/",
"36.0",
"rhs",
"[",
"2",
":",
"-",
"2",
"]",
"=",
"(",... | https://github.com/laszukdawid/PyEMD/blob/9caf51c6cd1bc1e869d67d002310c1e81cba541a/PyEMD/compact.py#L93-L161 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/django/http/request.py | python | QueryDict.copy | (self) | return self.__deepcopy__({}) | Returns a mutable copy of this object. | Returns a mutable copy of this object. | [
"Returns",
"a",
"mutable",
"copy",
"of",
"this",
"object",
"."
] | def copy(self):
"""Returns a mutable copy of this object."""
return self.__deepcopy__({}) | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"self",
".",
"__deepcopy__",
"(",
"{",
"}",
")"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/http/request.py#L366-L368 | |
encode/django-rest-framework | c5be86a6dbf3d21b00a296af5994fa075826bf0b | rest_framework/schemas/coreapi.py | python | is_enabled | () | return issubclass(api_settings.DEFAULT_SCHEMA_CLASS, AutoSchema) | Is CoreAPI Mode enabled? | Is CoreAPI Mode enabled? | [
"Is",
"CoreAPI",
"Mode",
"enabled?"
] | def is_enabled():
"""Is CoreAPI Mode enabled?"""
return issubclass(api_settings.DEFAULT_SCHEMA_CLASS, AutoSchema) | [
"def",
"is_enabled",
"(",
")",
":",
"return",
"issubclass",
"(",
"api_settings",
".",
"DEFAULT_SCHEMA_CLASS",
",",
"AutoSchema",
")"
] | https://github.com/encode/django-rest-framework/blob/c5be86a6dbf3d21b00a296af5994fa075826bf0b/rest_framework/schemas/coreapi.py#L610-L612 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/plecost/xgoogle/BeautifulSoup.py | python | PageElement.substituteEncoding | (self, str, encoding=None) | return str.replace("%SOUP-ENCODING%", encoding) | [] | def substituteEncoding(self, str, encoding=None):
encoding = encoding or "utf-8"
return str.replace("%SOUP-ENCODING%", encoding) | [
"def",
"substituteEncoding",
"(",
"self",
",",
"str",
",",
"encoding",
"=",
"None",
")",
":",
"encoding",
"=",
"encoding",
"or",
"\"utf-8\"",
"return",
"str",
".",
"replace",
"(",
"\"%SOUP-ENCODING%\"",
",",
"encoding",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/plecost/xgoogle/BeautifulSoup.py#L370-L372 | |||
securityclippy/elasticintel | aa08d3e9f5ab1c000128e95161139ce97ff0e334 | ingest_feed_lambda/pandas/io/formats/style.py | python | Styler._translate | (self) | return dict(head=head, cellstyle=cellstyle, body=body, uuid=uuid,
precision=precision, table_styles=table_styles,
caption=caption, table_attributes=self.table_attributes) | Convert the DataFrame in `self.data` and the attrs from `_build_styles`
into a dictionary of {head, body, uuid, cellstyle} | Convert the DataFrame in `self.data` and the attrs from `_build_styles`
into a dictionary of {head, body, uuid, cellstyle} | [
"Convert",
"the",
"DataFrame",
"in",
"self",
".",
"data",
"and",
"the",
"attrs",
"from",
"_build_styles",
"into",
"a",
"dictionary",
"of",
"{",
"head",
"body",
"uuid",
"cellstyle",
"}"
] | def _translate(self):
"""
Convert the DataFrame in `self.data` and the attrs from `_build_styles`
into a dictionary of {head, body, uuid, cellstyle}
"""
table_styles = self.table_styles or []
caption = self.caption
ctx = self.ctx
precision = self.precision... | [
"def",
"_translate",
"(",
"self",
")",
":",
"table_styles",
"=",
"self",
".",
"table_styles",
"or",
"[",
"]",
"caption",
"=",
"self",
".",
"caption",
"ctx",
"=",
"self",
".",
"ctx",
"precision",
"=",
"self",
".",
"precision",
"uuid",
"=",
"self",
".",
... | https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/pandas/io/formats/style.py#L181-L328 | |
davidhalter/parso | ee5edaf22ff3941cbdfa4efd8cb3e8f69779fd56 | parso/python/tree.py | python | Module.__init__ | (self, children) | [] | def __init__(self, children):
super().__init__(children)
self._used_names = None | [
"def",
"__init__",
"(",
"self",
",",
"children",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"children",
")",
"self",
".",
"_used_names",
"=",
"None"
] | https://github.com/davidhalter/parso/blob/ee5edaf22ff3941cbdfa4efd8cb3e8f69779fd56/parso/python/tree.py#L386-L388 | ||||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/number_field/number_field_ideal.py | python | basis_to_module | (B, K) | return M.span_of_basis(C) | r"""
Given a basis `B` of elements for a `\ZZ`-submodule of a number
field `K`, return the corresponding `\ZZ`-submodule.
EXAMPLES::
sage: K.<w> = NumberField(x^4 + 1)
sage: from sage.rings.number_field.number_field_ideal import basis_to_module
sage: basis_to_module([K.0, K.0^2 + 3... | r"""
Given a basis `B` of elements for a `\ZZ`-submodule of a number
field `K`, return the corresponding `\ZZ`-submodule. | [
"r",
"Given",
"a",
"basis",
"B",
"of",
"elements",
"for",
"a",
"\\",
"ZZ",
"-",
"submodule",
"of",
"a",
"number",
"field",
"K",
"return",
"the",
"corresponding",
"\\",
"ZZ",
"-",
"submodule",
"."
] | def basis_to_module(B, K):
r"""
Given a basis `B` of elements for a `\ZZ`-submodule of a number
field `K`, return the corresponding `\ZZ`-submodule.
EXAMPLES::
sage: K.<w> = NumberField(x^4 + 1)
sage: from sage.rings.number_field.number_field_ideal import basis_to_module
sage: ... | [
"def",
"basis_to_module",
"(",
"B",
",",
"K",
")",
":",
"V",
",",
"from_V",
",",
"to_V",
"=",
"K",
".",
"absolute_vector_space",
"(",
")",
"M",
"=",
"ZZ",
"**",
"(",
"V",
".",
"dimension",
"(",
")",
")",
"C",
"=",
"[",
"to_V",
"(",
"K",
"(",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/number_field/number_field_ideal.py#L1693-L1711 | |
lxtGH/OctaveConv_pytorch | 079f7da29d55c2eeed8985d33f0b2f765d7a469e | libs/nn/resnet_adaptiveconv.py | python | PixelAwareResnet50 | (pretrained=False, **kwargs) | return model | Constructs a ResNet-50 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | Constructs a ResNet-50 model. | [
"Constructs",
"a",
"ResNet",
"-",
"50",
"model",
"."
] | def PixelAwareResnet50(pretrained=False, **kwargs):
"""Constructs a ResNet-50 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
"""
model = ResNet(PixelAwareAdaptiveBottleneck, [3, 4, 6, 3], **kwargs)
return model | [
"def",
"PixelAwareResnet50",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"ResNet",
"(",
"PixelAwareAdaptiveBottleneck",
",",
"[",
"3",
",",
"4",
",",
"6",
",",
"3",
"]",
",",
"*",
"*",
"kwargs",
")",
"return",
"m... | https://github.com/lxtGH/OctaveConv_pytorch/blob/079f7da29d55c2eeed8985d33f0b2f765d7a469e/libs/nn/resnet_adaptiveconv.py#L278-L285 | |
catalyst-team/catalyst | 678dc06eda1848242df010b7f34adb572def2598 | catalyst/callbacks/scheduler.py | python | LRFinder.on_batch_end | (self, runner: "IRunner") | Batch end hook. Make scheduler step and stops iterating if needed.
Args:
runner: current runner
Raises:
KeyboardInterrupt: at the end of LRFinder | Batch end hook. Make scheduler step and stops iterating if needed. | [
"Batch",
"end",
"hook",
".",
"Make",
"scheduler",
"step",
"and",
"stops",
"iterating",
"if",
"needed",
"."
] | def on_batch_end(self, runner: "IRunner"):
"""Batch end hook. Make scheduler step and stops iterating if needed.
Args:
runner: current runner
Raises:
KeyboardInterrupt: at the end of LRFinder
"""
super().on_batch_end(runner=runner)
if self.iterat... | [
"def",
"on_batch_end",
"(",
"self",
",",
"runner",
":",
"\"IRunner\"",
")",
":",
"super",
"(",
")",
".",
"on_batch_end",
"(",
"runner",
"=",
"runner",
")",
"if",
"self",
".",
"iteration",
">",
"self",
".",
"num_steps",
":",
"# runner.need_early_stop = True",... | https://github.com/catalyst-team/catalyst/blob/678dc06eda1848242df010b7f34adb572def2598/catalyst/callbacks/scheduler.py#L426-L438 | ||
thonny/thonny | 39d96f7dc6a12845daed3424eb42bb57712cbf93 | thonny/plugins/micropython/uf2dialog.py | python | Uf2FlashingDialog._get_vid_pids_to_wait_for | (self) | return set() | If result is non-empty then the process completes until a device with one of the vid-pid pairs appears | If result is non-empty then the process completes until a device with one of the vid-pid pairs appears | [
"If",
"result",
"is",
"non",
"-",
"empty",
"then",
"the",
"process",
"completes",
"until",
"a",
"device",
"with",
"one",
"of",
"the",
"vid",
"-",
"pid",
"pairs",
"appears"
] | def _get_vid_pids_to_wait_for(self):
"""If result is non-empty then the process completes until a device with one of the vid-pid pairs appears"""
return set() | [
"def",
"_get_vid_pids_to_wait_for",
"(",
"self",
")",
":",
"return",
"set",
"(",
")"
] | https://github.com/thonny/thonny/blob/39d96f7dc6a12845daed3424eb42bb57712cbf93/thonny/plugins/micropython/uf2dialog.py#L265-L267 | |
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idc.py | python | GetLastBmask | (enum_id) | return idaapi.get_last_bmask(enum_id) | Get last bitmask in the enum (bitfield)
@param enum_id: id of enum
@return: the biggest bitmask or -1 no bitmasks are defined yet
All bitmasks are sorted by their values as unsigned longs. | Get last bitmask in the enum (bitfield) | [
"Get",
"last",
"bitmask",
"in",
"the",
"enum",
"(",
"bitfield",
")"
] | def GetLastBmask(enum_id):
"""
Get last bitmask in the enum (bitfield)
@param enum_id: id of enum
@return: the biggest bitmask or -1 no bitmasks are defined yet
All bitmasks are sorted by their values as unsigned longs.
"""
return idaapi.get_last_bmask(enum_id) | [
"def",
"GetLastBmask",
"(",
"enum_id",
")",
":",
"return",
"idaapi",
".",
"get_last_bmask",
"(",
"enum_id",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idc.py#L5920-L5929 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/robots/robot.py | python | Robot.has_floating_base | (self) | return not self.fixed_base | Return True if the robot has a floating base (i.e. floating root link). Otherwise, it is a fixed base.
Returns:
bool: True if the robot has a floating base. | Return True if the robot has a floating base (i.e. floating root link). Otherwise, it is a fixed base. | [
"Return",
"True",
"if",
"the",
"robot",
"has",
"a",
"floating",
"base",
"(",
"i",
".",
"e",
".",
"floating",
"root",
"link",
")",
".",
"Otherwise",
"it",
"is",
"a",
"fixed",
"base",
"."
] | def has_floating_base(self):
"""
Return True if the robot has a floating base (i.e. floating root link). Otherwise, it is a fixed base.
Returns:
bool: True if the robot has a floating base.
"""
# return self.floating_base
return not self.fixed_base | [
"def",
"has_floating_base",
"(",
"self",
")",
":",
"# return self.floating_base",
"return",
"not",
"self",
".",
"fixed_base"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/robots/robot.py#L554-L562 | |
catalyst-team/catalyst | 678dc06eda1848242df010b7f34adb572def2598 | catalyst/contrib/datasets/mnist.py | python | MnistQGDataset.targets | (self) | return self._mnist.targets | Labels of digits | Labels of digits | [
"Labels",
"of",
"digits"
] | def targets(self) -> torch.Tensor:
"""Labels of digits"""
return self._mnist.targets | [
"def",
"targets",
"(",
"self",
")",
"->",
"torch",
".",
"Tensor",
":",
"return",
"self",
".",
"_mnist",
".",
"targets"
] | https://github.com/catalyst-team/catalyst/blob/678dc06eda1848242df010b7f34adb572def2598/catalyst/contrib/datasets/mnist.py#L351-L353 | |
certbot/certbot | 30b066f08260b73fc26256b5484a180468b9d0a6 | acme/acme/mixins.py | python | ResourceMixin.to_partial_json | (self) | return _safe_jobj_compliance(super(),
'to_partial_json', 'resource') | See josepy.JSONDeserializable.to_partial_json() | See josepy.JSONDeserializable.to_partial_json() | [
"See",
"josepy",
".",
"JSONDeserializable",
".",
"to_partial_json",
"()"
] | def to_partial_json(self) -> Dict[str, Any]:
"""See josepy.JSONDeserializable.to_partial_json()"""
return _safe_jobj_compliance(super(),
'to_partial_json', 'resource') | [
"def",
"to_partial_json",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"_safe_jobj_compliance",
"(",
"super",
"(",
")",
",",
"'to_partial_json'",
",",
"'resource'",
")"
] | https://github.com/certbot/certbot/blob/30b066f08260b73fc26256b5484a180468b9d0a6/acme/acme/mixins.py#L33-L36 | |
quentinhardy/odat | 364b94cc662dcbb95a0b28880c6a71ddfc66dd6b | texttable.py | python | Texttable._has_header | (self) | return self._deco & Texttable.HEADER > 0 | Return a boolean, if header line is required or not | Return a boolean, if header line is required or not | [
"Return",
"a",
"boolean",
"if",
"header",
"line",
"is",
"required",
"or",
"not"
] | def _has_header(self):
"""Return a boolean, if header line is required or not
"""
return self._deco & Texttable.HEADER > 0 | [
"def",
"_has_header",
"(",
"self",
")",
":",
"return",
"self",
".",
"_deco",
"&",
"Texttable",
".",
"HEADER",
">",
"0"
] | https://github.com/quentinhardy/odat/blob/364b94cc662dcbb95a0b28880c6a71ddfc66dd6b/texttable.py#L445-L449 | |
modflowpy/flopy | eecd1ad193c5972093c9712e5c4b7a83284f0688 | flopy/modflow/mfmnw2.py | python | Mnw.get_default_spd_dtype | (structured=True) | Get the default stress period data dtype
Parameters
----------
structured : bool
Boolean that defines if a structured (True) or unstructured (False)
dtype will be created (default is True). Not implemented for
unstructured.
Returns
-------
... | Get the default stress period data dtype | [
"Get",
"the",
"default",
"stress",
"period",
"data",
"dtype"
] | def get_default_spd_dtype(structured=True):
"""
Get the default stress period data dtype
Parameters
----------
structured : bool
Boolean that defines if a structured (True) or unstructured (False)
dtype will be created (default is True). Not implemented f... | [
"def",
"get_default_spd_dtype",
"(",
"structured",
"=",
"True",
")",
":",
"if",
"structured",
":",
"return",
"np",
".",
"dtype",
"(",
"[",
"(",
"\"k\"",
",",
"int",
")",
",",
"(",
"\"i\"",
",",
"int",
")",
",",
"(",
"\"j\"",
",",
"int",
")",
",",
... | https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/modflow/mfmnw2.py#L528-L564 | ||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/big_bird/tokenization_big_bird.py | python | BigBirdTokenizer._tokenize | (self, text: str) | return self.sp_model.encode(text, out_type=str) | Take as input a string and return a list of strings (tokens) for words/sub-words | Take as input a string and return a list of strings (tokens) for words/sub-words | [
"Take",
"as",
"input",
"a",
"string",
"and",
"return",
"a",
"list",
"of",
"strings",
"(",
"tokens",
")",
"for",
"words",
"/",
"sub",
"-",
"words"
] | def _tokenize(self, text: str) -> List[str]:
"""Take as input a string and return a list of strings (tokens) for words/sub-words"""
return self.sp_model.encode(text, out_type=str) | [
"def",
"_tokenize",
"(",
"self",
",",
"text",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"self",
".",
"sp_model",
".",
"encode",
"(",
"text",
",",
"out_type",
"=",
"str",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/big_bird/tokenization_big_bird.py#L166-L168 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/logging/handlers.py | python | SMTPHandler.emit | (self, record) | Emit a record.
Format the record and send it to the specified addressees. | Emit a record. | [
"Emit",
"a",
"record",
"."
] | def emit(self, record):
"""
Emit a record.
Format the record and send it to the specified addressees.
"""
try:
import smtplib
from email.message import EmailMessage
import email.utils
port = self.mailport
if not port:
... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"try",
":",
"import",
"smtplib",
"from",
"email",
".",
"message",
"import",
"EmailMessage",
"import",
"email",
".",
"utils",
"port",
"=",
"self",
".",
"mailport",
"if",
"not",
"port",
":",
"port",
"=... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/logging/handlers.py#L960-L990 | ||
lohriialo/photoshop-scripting-python | 6b97da967a5d0a45e54f7c99631b29773b923f09 | api_reference/photoshop_CC_2018.py | python | LayerComp.__iter__ | (self) | return win32com.client.util.Iterator(ob, None) | Return a Python iterator for this object | Return a Python iterator for this object | [
"Return",
"a",
"Python",
"iterator",
"for",
"this",
"object"
] | def __iter__(self):
"Return a Python iterator for this object"
try:
ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),())
except pythoncom.error:
raise TypeError("This object does not support enumeration")
return win32com.client.util.Iterator(ob, None) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"try",
":",
"ob",
"=",
"self",
".",
"_oleobj_",
".",
"InvokeTypes",
"(",
"-",
"4",
",",
"LCID",
",",
"3",
",",
"(",
"13",
",",
"10",
")",
",",
"(",
")",
")",
"except",
"pythoncom",
".",
"error",
":",
... | https://github.com/lohriialo/photoshop-scripting-python/blob/6b97da967a5d0a45e54f7c99631b29773b923f09/api_reference/photoshop_CC_2018.py#L1998-L2004 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/bdf/bdf_interface/add_card.py | python | AddCards.add_spline4 | (self, eid: int, caero: int, aelist: int, setg: int,
dz: float, method: str, usage: str,
nelements: int, melements: int, comment: str='') | return spline | Creates a SPLINE4 card, which defines a curved Infinite Plate,
Thin Plate, or Finite Plate Spline.
Parameters
----------
eid : int
spline id
caero : int
CAEROx id that defines the plane of the spline
box1 / box2 : int
First/last box id... | Creates a SPLINE4 card, which defines a curved Infinite Plate,
Thin Plate, or Finite Plate Spline. | [
"Creates",
"a",
"SPLINE4",
"card",
"which",
"defines",
"a",
"curved",
"Infinite",
"Plate",
"Thin",
"Plate",
"or",
"Finite",
"Plate",
"Spline",
"."
] | def add_spline4(self, eid: int, caero: int, aelist: int, setg: int,
dz: float, method: str, usage: str,
nelements: int, melements: int, comment: str='') -> SPLINE4:
"""
Creates a SPLINE4 card, which defines a curved Infinite Plate,
Thin Plate, or Finite Pl... | [
"def",
"add_spline4",
"(",
"self",
",",
"eid",
":",
"int",
",",
"caero",
":",
"int",
",",
"aelist",
":",
"int",
",",
"setg",
":",
"int",
",",
"dz",
":",
"float",
",",
"method",
":",
"str",
",",
"usage",
":",
"str",
",",
"nelements",
":",
"int",
... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/bdf_interface/add_card.py#L5379-L5421 | |
quodlibet/quodlibet | e3099c89f7aa6524380795d325cc14630031886c | quodlibet/library/file.py | python | FileLibrary.get_masked | (self, mount_point) | return list(self._masked.get(mount_point, {}).values()) | List of items for a mount point | List of items for a mount point | [
"List",
"of",
"items",
"for",
"a",
"mount",
"point"
] | def get_masked(self, mount_point):
"""List of items for a mount point"""
return list(self._masked.get(mount_point, {}).values()) | [
"def",
"get_masked",
"(",
"self",
",",
"mount_point",
")",
":",
"return",
"list",
"(",
"self",
".",
"_masked",
".",
"get",
"(",
"mount_point",
",",
"{",
"}",
")",
".",
"values",
"(",
")",
")"
] | https://github.com/quodlibet/quodlibet/blob/e3099c89f7aa6524380795d325cc14630031886c/quodlibet/library/file.py#L314-L317 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/apis/core_v1_api.py | python | CoreV1Api.replace_node | (self, name, body, **kwargs) | replace the specified Node
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
... | replace the specified Node
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
... | [
"replace",
"the",
"specified",
"Node",
"This",
"method",
"makes",
"a",
"synchronous",
"HTTP",
"request",
"by",
"default",
".",
"To",
"make",
"an",
"asynchronous",
"HTTP",
"request",
"please",
"define",
"a",
"callback",
"function",
"to",
"be",
"invoked",
"when"... | def replace_node(self, name, body, **kwargs):
"""
replace the specified Node
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_func... | [
"def",
"replace_node",
"(",
"self",
",",
"name",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"replace_node_wi... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/apis/core_v1_api.py#L28562-L28587 | ||
websauna/websauna | a57de54fb8a3fae859f24f373f0292e1e4b3c344 | websauna/system/user/views.py | python | reset_password | (request: Request) | return {
'form': form.render(
appstruct=dict(
user=user.friendly_name
)
)
} | Reset password view.
User arrives on the page and enters the new password.
:param request: Pyramid request.
:return: Context to be used by the renderer. | Reset password view. | [
"Reset",
"password",
"view",
"."
] | def reset_password(request: Request) -> dict:
"""Reset password view.
User arrives on the page and enters the new password.
:param request: Pyramid request.
:return: Context to be used by the renderer.
"""
schema = request.registry.getUtility(IResetPasswordSchema)
schema = schema().bind(re... | [
"def",
"reset_password",
"(",
"request",
":",
"Request",
")",
"->",
"dict",
":",
"schema",
"=",
"request",
".",
"registry",
".",
"getUtility",
"(",
"IResetPasswordSchema",
")",
"schema",
"=",
"schema",
"(",
")",
".",
"bind",
"(",
"request",
"=",
"request",... | https://github.com/websauna/websauna/blob/a57de54fb8a3fae859f24f373f0292e1e4b3c344/websauna/system/user/views.py#L228-L262 | |
constverum/ProxyBroker | d21aae8575fc3a95493233ecfd2c7cf47b36b069 | proxybroker/providers.py | python | Provider._get | (self, url, data=None, headers=None, method='GET') | return page | [] | async def _get(self, url, data=None, headers=None, method='GET'):
page = ''
try:
timeout = aiohttp.ClientTimeout(total=self._timeout)
async with self._sem_provider, self._session.request(
method, url, data=data, headers=headers, timeout=timeout
) as re... | [
"async",
"def",
"_get",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"method",
"=",
"'GET'",
")",
":",
"page",
"=",
"''",
"try",
":",
"timeout",
"=",
"aiohttp",
".",
"ClientTimeout",
"(",
"total",
"=",
"self"... | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/providers.py#L131-L155 | |||
chubin/cheat.sh | 46d1a5f73c6b88da15d809154245dbf234e9479e | lib/adapter/adapter.py | python | Adapter.current_state_command | (cls) | Get current state of repository (current revision).
This is used to find what cache entries should be invalidated. | Get current state of repository (current revision).
This is used to find what cache entries should be invalidated. | [
"Get",
"current",
"state",
"of",
"repository",
"(",
"current",
"revision",
")",
".",
"This",
"is",
"used",
"to",
"find",
"what",
"cache",
"entries",
"should",
"be",
"invalidated",
"."
] | def current_state_command(cls):
"""
Get current state of repository (current revision).
This is used to find what cache entries should be invalidated.
"""
if not cls._repository_url:
return None
local_repository_dir = cls.local_repository_location()
... | [
"def",
"current_state_command",
"(",
"cls",
")",
":",
"if",
"not",
"cls",
".",
"_repository_url",
":",
"return",
"None",
"local_repository_dir",
"=",
"cls",
".",
"local_repository_location",
"(",
")",
"if",
"not",
"local_repository_dir",
":",
"return",
"None",
"... | https://github.com/chubin/cheat.sh/blob/46d1a5f73c6b88da15d809154245dbf234e9479e/lib/adapter/adapter.py#L251-L267 | ||
quay/quay | b7d325ed42827db9eda2d9f341cb5a6cdfd155a6 | data/model/image.py | python | get_min_id_for_sec_scan | (version) | return Image.select(fn.Min(Image.id)).where(Image.security_indexed_engine < version).scalar() | Gets the minimum id for a clair sec scan. | Gets the minimum id for a clair sec scan. | [
"Gets",
"the",
"minimum",
"id",
"for",
"a",
"clair",
"sec",
"scan",
"."
] | def get_min_id_for_sec_scan(version):
"""
Gets the minimum id for a clair sec scan.
"""
return Image.select(fn.Min(Image.id)).where(Image.security_indexed_engine < version).scalar() | [
"def",
"get_min_id_for_sec_scan",
"(",
"version",
")",
":",
"return",
"Image",
".",
"select",
"(",
"fn",
".",
"Min",
"(",
"Image",
".",
"id",
")",
")",
".",
"where",
"(",
"Image",
".",
"security_indexed_engine",
"<",
"version",
")",
".",
"scalar",
"(",
... | https://github.com/quay/quay/blob/b7d325ed42827db9eda2d9f341cb5a6cdfd155a6/data/model/image.py#L502-L506 | |
tacnetsol/ghidra_scripts | 5c4d24bc7166f672015003572daeeb04d2e1f30e | utils/mipsrop.py | python | is_jump | (ins) | return flow.isCall() or flow.isJump() or flow.isTerminal() | Is instruction a jump (or call).
:param ins: Instruction to inspect.
:type ins: ghidra.program.model.listing.Instruction
:returns: True if instruction is a jump, False otherwise. | Is instruction a jump (or call). | [
"Is",
"instruction",
"a",
"jump",
"(",
"or",
"call",
")",
"."
] | def is_jump(ins):
"""
Is instruction a jump (or call).
:param ins: Instruction to inspect.
:type ins: ghidra.program.model.listing.Instruction
:returns: True if instruction is a jump, False otherwise.
"""
flow = ins.getFlowType()
return flow.isCall() or flow.isJump() or flow.isTerminal... | [
"def",
"is_jump",
"(",
"ins",
")",
":",
"flow",
"=",
"ins",
".",
"getFlowType",
"(",
")",
"return",
"flow",
".",
"isCall",
"(",
")",
"or",
"flow",
".",
"isJump",
"(",
")",
"or",
"flow",
".",
"isTerminal",
"(",
")"
] | https://github.com/tacnetsol/ghidra_scripts/blob/5c4d24bc7166f672015003572daeeb04d2e1f30e/utils/mipsrop.py#L783-L793 | |
sfyc23/EverydayWechat | 6b81d03dde92cfef584428bc1e59d2858e94204e | everyday_wechat/control/weather/sojson.py | python | get_sojson_weather | (city_name, is_tomorrow=False) | 获取天气信息。网址:https://www.sojson.com/blog/305.html .
:param city_name: str,城市名
:return: str ,例如:2019-06-12 星期三 晴 南风 3-4级 高温 22.0℃ 低温 18.0℃ 愿你拥有比阳光明媚的心情 | 获取天气信息。网址:https://www.sojson.com/blog/305.html .
:param city_name: str,城市名
:return: str ,例如:2019-06-12 星期三 晴 南风 3-4级 高温 22.0℃ 低温 18.0℃ 愿你拥有比阳光明媚的心情 | [
"获取天气信息。网址:https",
":",
"//",
"www",
".",
"sojson",
".",
"com",
"/",
"blog",
"/",
"305",
".",
"html",
".",
":",
"param",
"city_name",
":",
"str",
"城市名",
":",
"return",
":",
"str",
"例如:2019",
"-",
"06",
"-",
"12",
"星期三",
"晴",
"南风",
"3",
"-",
"4级",... | def get_sojson_weather(city_name, is_tomorrow=False):
"""
获取天气信息。网址:https://www.sojson.com/blog/305.html .
:param city_name: str,城市名
:return: str ,例如:2019-06-12 星期三 晴 南风 3-4级 高温 22.0℃ 低温 18.0℃ 愿你拥有比阳光明媚的心情
"""
if is_tomorrow:
return get_sojson_weather_tomorrow(city_name)
if not city... | [
"def",
"get_sojson_weather",
"(",
"city_name",
",",
"is_tomorrow",
"=",
"False",
")",
":",
"if",
"is_tomorrow",
":",
"return",
"get_sojson_weather_tomorrow",
"(",
"city_name",
")",
"if",
"not",
"city_name",
":",
"return",
"None",
"city_code",
"=",
"CITY_CODE_DICT"... | https://github.com/sfyc23/EverydayWechat/blob/6b81d03dde92cfef584428bc1e59d2858e94204e/everyday_wechat/control/weather/sojson.py#L18-L80 | ||
AnasAboureada/Penetration-Testing-Study-Notes | 8152fd609cf818dba2f07e060738a24c56221687 | scripts/string_decode.py | python | MD5APR | () | [] | def MD5APR():
hs='$apr1$qAUKoKlG$3LuCncByN76eLxZAh/Ldr1'
if len(hash)==len(hs) and hash.isdigit()==False and hash.isalpha()==False and hash[0:4].find('$apr')==0:
jerar.append("108020") | [
"def",
"MD5APR",
"(",
")",
":",
"hs",
"=",
"'$apr1$qAUKoKlG$3LuCncByN76eLxZAh/Ldr1'",
"if",
"len",
"(",
"hash",
")",
"==",
"len",
"(",
"hs",
")",
"and",
"hash",
".",
"isdigit",
"(",
")",
"==",
"False",
"and",
"hash",
".",
"isalpha",
"(",
")",
"==",
"... | https://github.com/AnasAboureada/Penetration-Testing-Study-Notes/blob/8152fd609cf818dba2f07e060738a24c56221687/scripts/string_decode.py#L265-L268 | ||||
interpretml/DiCE | e6a1dc3893799a364da993d4a368b7ccfabe4447 | dice_ml/explainer_interfaces/explainer_base.py | python | ExplainerBase.is_cf_valid | (self, model_score) | Check if a cf belongs to the target class or target range. | Check if a cf belongs to the target class or target range. | [
"Check",
"if",
"a",
"cf",
"belongs",
"to",
"the",
"target",
"class",
"or",
"target",
"range",
"."
] | def is_cf_valid(self, model_score):
"""Check if a cf belongs to the target class or target range.
"""
# Converting to single prediction if the prediction is provided as a
# singleton array
correct_dim = 1 if self.model.model_type == ModelTypes.Classifier else 0
if hasattr... | [
"def",
"is_cf_valid",
"(",
"self",
",",
"model_score",
")",
":",
"# Converting to single prediction if the prediction is provided as a",
"# singleton array",
"correct_dim",
"=",
"1",
"if",
"self",
".",
"model",
".",
"model_type",
"==",
"ModelTypes",
".",
"Classifier",
"... | https://github.com/interpretml/DiCE/blob/e6a1dc3893799a364da993d4a368b7ccfabe4447/dice_ml/explainer_interfaces/explainer_base.py#L601-L634 | ||
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/clipmenuaction.py | python | MatchFrameWriter.__init__ | (self, clip, clip_frame, track, display_on_right) | [] | def __init__(self, clip, clip_frame, track, display_on_right):
self.clip = clip
self.clip_frame = clip_frame
self.track = track
self.display_on_right = display_on_right | [
"def",
"__init__",
"(",
"self",
",",
"clip",
",",
"clip_frame",
",",
"track",
",",
"display_on_right",
")",
":",
"self",
".",
"clip",
"=",
"clip",
"self",
".",
"clip_frame",
"=",
"clip_frame",
"self",
".",
"track",
"=",
"track",
"self",
".",
"display_on_... | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/clipmenuaction.py#L654-L658 | ||||
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | deep-learning/1-pixel-attack/networks/capsulenet/capsulelayers.py | python | CapsuleLayer.call | (self, inputs, training=None) | return K.reshape(outputs, [-1, self.num_capsule, self.dim_vector]) | # Begin: inputs_hat computation V1 ---------------------------------------------------------------------#
# Compute `inputs * W` by expanding the first dim of W. More time-consuming and need batch_size.
# w_tiled.shape = [batch_size, input_num_capsule, num_capsule, input_dim_vector, dim_vector]
... | # Begin: inputs_hat computation V1 ---------------------------------------------------------------------#
# Compute `inputs * W` by expanding the first dim of W. More time-consuming and need batch_size.
# w_tiled.shape = [batch_size, input_num_capsule, num_capsule, input_dim_vector, dim_vector]
... | [
"#",
"Begin",
":",
"inputs_hat",
"computation",
"V1",
"---------------------------------------------------------------------",
"#",
"#",
"Compute",
"inputs",
"*",
"W",
"by",
"expanding",
"the",
"first",
"dim",
"of",
"W",
".",
"More",
"time",
"-",
"consuming",
"and",... | def call(self, inputs, training=None):
# inputs.shape=[None, input_num_capsule, input_dim_vector]
# Expand dims to [None, input_num_capsule, 1, 1, input_dim_vector]
inputs_expand = K.expand_dims(K.expand_dims(inputs, 2), 2)
# Replicate num_capsule dimension to prepare being multiplied b... | [
"def",
"call",
"(",
"self",
",",
"inputs",
",",
"training",
"=",
"None",
")",
":",
"# inputs.shape=[None, input_num_capsule, input_dim_vector]",
"# Expand dims to [None, input_num_capsule, 1, 1, input_dim_vector]",
"inputs_expand",
"=",
"K",
".",
"expand_dims",
"(",
"K",
".... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/deep-learning/1-pixel-attack/networks/capsulenet/capsulelayers.py#L106-L166 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/vera/climate.py | python | VeraThermostat.operation | (self) | return self.vera_device.get_hvac_mode() | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | [
"Return",
"current",
"operation",
"ie",
".",
"heat",
"cool",
"idle",
"."
] | def operation(self) -> str:
"""Return current operation ie. heat, cool, idle."""
return self.vera_device.get_hvac_mode() | [
"def",
"operation",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"vera_device",
".",
"get_hvac_mode",
"(",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/vera/climate.py#L136-L138 | |
lonePatient/BERT-NER-Pytorch | bc9276185539c59bbd3d310ea808fea2b618fedf | callback/lr_scheduler.py | python | ReduceLRWDOnPlateau.epoch_step | (self, metrics, epoch) | [] | def epoch_step(self, metrics, epoch):
current = metrics
if current is None:
warnings.warn('Learning Rate Plateau Reducing requires metrics available!', RuntimeWarning)
else:
if self.in_cooldown():
self.cooldown_counter -= 1
self.wait = 0
... | [
"def",
"epoch_step",
"(",
"self",
",",
"metrics",
",",
"epoch",
")",
":",
"current",
"=",
"metrics",
"if",
"current",
"is",
"None",
":",
"warnings",
".",
"warn",
"(",
"'Learning Rate Plateau Reducing requires metrics available!'",
",",
"RuntimeWarning",
")",
"else... | https://github.com/lonePatient/BERT-NER-Pytorch/blob/bc9276185539c59bbd3d310ea808fea2b618fedf/callback/lr_scheduler.py#L351-L382 | ||||
meduza-corp/interstellar | 40a801ccd7856491726f5a126621d9318cabe2e1 | gsutil/third_party/python-gflags/gflags.py | python | FlagValues.MainModuleHelp | (self) | return self.ModuleHelp(_GetMainModule()) | Describe the key flags of the main module.
Returns:
string describing the key flags of a module. | Describe the key flags of the main module. | [
"Describe",
"the",
"key",
"flags",
"of",
"the",
"main",
"module",
"."
] | def MainModuleHelp(self):
"""Describe the key flags of the main module.
Returns:
string describing the key flags of a module.
"""
return self.ModuleHelp(_GetMainModule()) | [
"def",
"MainModuleHelp",
"(",
"self",
")",
":",
"return",
"self",
".",
"ModuleHelp",
"(",
"_GetMainModule",
"(",
")",
")"
] | https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/python-gflags/gflags.py#L1428-L1434 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/zlib_codec.py | python | getregentry | () | return codecs.CodecInfo(
name='zlib',
encode=zlib_encode,
decode=zlib_decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
_is_text_encoding=False,
) | [] | def getregentry():
return codecs.CodecInfo(
name='zlib',
encode=zlib_encode,
decode=zlib_decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
_is_text_encoding=False... | [
"def",
"getregentry",
"(",
")",
":",
"return",
"codecs",
".",
"CodecInfo",
"(",
"name",
"=",
"'zlib'",
",",
"encode",
"=",
"zlib_encode",
",",
"decode",
"=",
"zlib_decode",
",",
"incrementalencoder",
"=",
"IncrementalEncoder",
",",
"incrementaldecoder",
"=",
"... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/zlib_codec.py#L67-L77 | |||
sio2project/oioioi | adeb6a7b278b6bed853405e525f87fd2726c06ac | oioioi/problems/views.py | python | filter_problems_by_origin | (problems, origin_tags) | return problems | The filters are almost always logical ANDed, the only exception to
this are OriginInfoValues within their OriginInfoCategory, which are
logical ORred - it is possible to search for example for tasks from
round "1 or 2" and year "2011 or 2012 or 2013".
Searching in Problemset from the Task Archive relies... | The filters are almost always logical ANDed, the only exception to
this are OriginInfoValues within their OriginInfoCategory, which are
logical ORred - it is possible to search for example for tasks from
round "1 or 2" and year "2011 or 2012 or 2013".
Searching in Problemset from the Task Archive relies... | [
"The",
"filters",
"are",
"almost",
"always",
"logical",
"ANDed",
"the",
"only",
"exception",
"to",
"this",
"are",
"OriginInfoValues",
"within",
"their",
"OriginInfoCategory",
"which",
"are",
"logical",
"ORred",
"-",
"it",
"is",
"possible",
"to",
"search",
"for",... | def filter_problems_by_origin(problems, origin_tags):
"""The filters are almost always logical ANDed, the only exception to
this are OriginInfoValues within their OriginInfoCategory, which are
logical ORred - it is possible to search for example for tasks from
round "1 or 2" and year "2011 or 2012 or 20... | [
"def",
"filter_problems_by_origin",
"(",
"problems",
",",
"origin_tags",
")",
":",
"info",
"=",
"{",
"}",
"for",
"tag",
"in",
"origin_tags",
":",
"tag",
"=",
"tag",
".",
"split",
"(",
"'_'",
")",
"if",
"len",
"(",
"tag",
")",
"in",
"(",
"1",
",",
"... | https://github.com/sio2project/oioioi/blob/adeb6a7b278b6bed853405e525f87fd2726c06ac/oioioi/problems/views.py#L219-L258 | |
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/engine/runners.py | python | Runner.stop | (self) | Stop the internal event loop. | Stop the internal event loop. | [
"Stop",
"the",
"internal",
"event",
"loop",
"."
] | def stop(self) -> None:
"""Stop the internal event loop."""
self._loop.stop() | [
"def",
"stop",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_loop",
".",
"stop",
"(",
")"
] | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/engine/runners.py#L151-L153 | ||
gwpy/gwpy | 82becd78d166a32985cb657a54d0d39f6a207739 | gwpy/timeseries/core.py | python | TimeSeriesBase.epoch | (self, epoch) | [] | def epoch(self, epoch):
if epoch is None:
del self.t0
elif isinstance(epoch, Time):
self.t0 = epoch.gps
else:
try:
self.t0 = to_gps(epoch)
except TypeError:
self.t0 = epoch | [
"def",
"epoch",
"(",
"self",
",",
"epoch",
")",
":",
"if",
"epoch",
"is",
"None",
":",
"del",
"self",
".",
"t0",
"elif",
"isinstance",
"(",
"epoch",
",",
"Time",
")",
":",
"self",
".",
"t0",
"=",
"epoch",
".",
"gps",
"else",
":",
"try",
":",
"s... | https://github.com/gwpy/gwpy/blob/82becd78d166a32985cb657a54d0d39f6a207739/gwpy/timeseries/core.py#L219-L228 | ||||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/codecs.py | python | getwriter | (encoding) | return lookup(encoding).streamwriter | Lookup up the codec for the given encoding and return
its StreamWriter class or factory function.
Raises a LookupError in case the encoding cannot be found. | Lookup up the codec for the given encoding and return
its StreamWriter class or factory function. | [
"Lookup",
"up",
"the",
"codec",
"for",
"the",
"given",
"encoding",
"and",
"return",
"its",
"StreamWriter",
"class",
"or",
"factory",
"function",
"."
] | def getwriter(encoding):
""" Lookup up the codec for the given encoding and return
its StreamWriter class or factory function.
Raises a LookupError in case the encoding cannot be found.
"""
return lookup(encoding).streamwriter | [
"def",
"getwriter",
"(",
"encoding",
")",
":",
"return",
"lookup",
"(",
"encoding",
")",
".",
"streamwriter"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/codecs.py#L1001-L1009 | |
zatosource/zato | 2a9d273f06f9d776fbfeb53e73855af6e40fa208 | code/zato-server/src/zato/server/file_transfer/observer/local_.py | python | LocalObserver.move_file | (self, path_from, path_to, _ignored_event, _ignored_snapshot_maker) | Moves a file to a selected directory. | Moves a file to a selected directory. | [
"Moves",
"a",
"file",
"to",
"a",
"selected",
"directory",
"."
] | def move_file(self, path_from, path_to, _ignored_event, _ignored_snapshot_maker):
""" Moves a file to a selected directory.
"""
shutil_copy(path_from, path_to) | [
"def",
"move_file",
"(",
"self",
",",
"path_from",
",",
"path_to",
",",
"_ignored_event",
",",
"_ignored_snapshot_maker",
")",
":",
"shutil_copy",
"(",
"path_from",
",",
"path_to",
")"
] | https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/zato-server/src/zato/server/file_transfer/observer/local_.py#L68-L71 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/rpi_gpio/cover.py | python | RPiGPIOCover.close_cover | (self, **kwargs) | Close the cover. | Close the cover. | [
"Close",
"the",
"cover",
"."
] | def close_cover(self, **kwargs):
"""Close the cover."""
if not self.is_closed:
self._trigger() | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"is_closed",
":",
"self",
".",
"_trigger",
"(",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/rpi_gpio/cover.py#L131-L134 | ||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/data/owdatasets.py | python | UniformHeightDelegate.sizeHint | (self, option, index) | return sh | [] | def sizeHint(self, option, index):
# type: (QStyleOptionViewItem, QModelIndex) -> QSize
opt = QStyleOptionViewItem(option)
self.initStyleOption(option, index)
opt.features |= QStyleOptionViewItem.HasDecoration
widget = option.widget
style = widget.style() if widget is not... | [
"def",
"sizeHint",
"(",
"self",
",",
"option",
",",
"index",
")",
":",
"# type: (QStyleOptionViewItem, QModelIndex) -> QSize",
"opt",
"=",
"QStyleOptionViewItem",
"(",
"option",
")",
"self",
".",
"initStyleOption",
"(",
"option",
",",
"index",
")",
"opt",
".",
"... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/owdatasets.py#L64-L73 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/distutils/misc_util.py | python | Configuration.__init__ | (self,
package_name=None,
parent_name=None,
top_path=None,
package_path=None,
caller_level=1,
setup_name='setup.py',
**attrs) | Construct configuration instance of a package.
package_name -- name of the package
Ex.: 'distutils'
parent_name -- name of the parent package
Ex.: 'numpy'
top_path -- directory of the toplevel package
Ex.: the director... | Construct configuration instance of a package. | [
"Construct",
"configuration",
"instance",
"of",
"a",
"package",
"."
] | def __init__(self,
package_name=None,
parent_name=None,
top_path=None,
package_path=None,
caller_level=1,
setup_name='setup.py',
**attrs):
"""Construct configuration instance of a package.
... | [
"def",
"__init__",
"(",
"self",
",",
"package_name",
"=",
"None",
",",
"parent_name",
"=",
"None",
",",
"top_path",
"=",
"None",
",",
"package_path",
"=",
"None",
",",
"caller_level",
"=",
"1",
",",
"setup_name",
"=",
"'setup.py'",
",",
"*",
"*",
"attrs"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/distutils/misc_util.py#L742-L837 | ||
TRI-ML/packnet-sfm | f59b1d615777a9987285a10e45b5d87b0369fa7d | packnet_sfm/datasets/kitti_dataset.py | python | KITTIDataset._get_imu2cam_transform | (self, image_file) | return imu2cam | Gets the transformation between IMU an camera from an image file | Gets the transformation between IMU an camera from an image file | [
"Gets",
"the",
"transformation",
"between",
"IMU",
"an",
"camera",
"from",
"an",
"image",
"file"
] | def _get_imu2cam_transform(self, image_file):
"""Gets the transformation between IMU an camera from an image file"""
parent_folder = self._get_parent_folder(image_file)
if image_file in self.imu2velo_calib_cache:
return self.imu2velo_calib_cache[image_file]
cam2cam = read_ca... | [
"def",
"_get_imu2cam_transform",
"(",
"self",
",",
"image_file",
")",
":",
"parent_folder",
"=",
"self",
".",
"_get_parent_folder",
"(",
"image_file",
")",
"if",
"image_file",
"in",
"self",
".",
"imu2velo_calib_cache",
":",
"return",
"self",
".",
"imu2velo_calib_c... | https://github.com/TRI-ML/packnet-sfm/blob/f59b1d615777a9987285a10e45b5d87b0369fa7d/packnet_sfm/datasets/kitti_dataset.py#L282-L298 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/storage/localfs/_table.py | python | StorageTable._count | (self) | return count | [] | def _count(self):
count = 0
for _ in self._as_generator():
count += 1
return count | [
"def",
"_count",
"(",
"self",
")",
":",
"count",
"=",
"0",
"for",
"_",
"in",
"self",
".",
"_as_generator",
"(",
")",
":",
"count",
"+=",
"1",
"return",
"count"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/storage/localfs/_table.py#L96-L100 | |||
mit-han-lab/data-efficient-gans | 6858275f08f43a33026844c8c2ac4e703e8a07ba | DiffAugment-stylegan2/dnnlib/submission/run_context.py | python | RunContext.__exit__ | (self, exc_type: Any, exc_value: Any, traceback: Any) | [] | def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
self.close() | [
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
":",
"Any",
",",
"exc_value",
":",
"Any",
",",
"traceback",
":",
"Any",
")",
"->",
"None",
":",
"self",
".",
"close",
"(",
")"
] | https://github.com/mit-han-lab/data-efficient-gans/blob/6858275f08f43a33026844c8c2ac4e703e8a07ba/DiffAugment-stylegan2/dnnlib/submission/run_context.py#L60-L61 | ||||
jiangxufeng/v2rayL | 27f89dfe3a8e22f4dd191cc1cc1e7fd9aef3e683 | v2rayL-GUI/v2rayL_api.py | python | V2rayL.connect | (self, region, flag) | 连接VPN
:param region: VPN别名
:param flag: 是否是正常连接/更新端口重连
:return: | 连接VPN
:param region: VPN别名
:param flag: 是否是正常连接/更新端口重连
:return: | [
"连接VPN",
":",
"param",
"region",
":",
"VPN别名",
":",
"param",
"flag",
":",
"是否是正常连接",
"/",
"更新端口重连",
":",
"return",
":"
] | def connect(self, region, flag):
"""
连接VPN
:param region: VPN别名
:param flag: 是否是正常连接/更新端口重连
:return:
"""
if not flag:
self.subs.setconf(region, self.current_status.http, self.current_status.socks, self.current_status.proxy)
try:
out... | [
"def",
"connect",
"(",
"self",
",",
"region",
",",
"flag",
")",
":",
"if",
"not",
"flag",
":",
"self",
".",
"subs",
".",
"setconf",
"(",
"region",
",",
"self",
".",
"current_status",
".",
"http",
",",
"self",
".",
"current_status",
".",
"socks",
",",... | https://github.com/jiangxufeng/v2rayL/blob/27f89dfe3a8e22f4dd191cc1cc1e7fd9aef3e683/v2rayL-GUI/v2rayL_api.py#L90-L113 | ||
NervanaSystems/neon | 8c3fb8a93b4a89303467b25817c60536542d08bd | examples/skip-thought/data_loader.py | python | load_json | (fname) | return data | load json object from file | load json object from file | [
"load",
"json",
"object",
"from",
"file"
] | def load_json(fname):
"""
load json object from file
"""
with open(fname) as f:
data = json.load(f)
return data | [
"def",
"load_json",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
")",
"as",
"f",
":",
"data",
"=",
"json",
".",
"load",
"(",
"f",
")",
"return",
"data"
] | https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/examples/skip-thought/data_loader.py#L31-L37 | |
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/beeswax/BeeswaxService.py | python | query_result.write | (self, oprot) | [] | def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('query_result')
if self.success is not None:
oprot.writeFi... | [
"def",
"write",
"(",
"self",
",",
"oprot",
")",
":",
"if",
"oprot",
".",
"_fast_encode",
"is",
"not",
"None",
"and",
"self",
".",
"thrift_spec",
"is",
"not",
"None",
":",
"oprot",
".",
"trans",
".",
"write",
"(",
"oprot",
".",
"_fast_encode",
"(",
"s... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/beeswax/BeeswaxService.py#L987-L1001 | ||||
wistful/SublimeAutoPEP8 | ea8bbdd811f7987cb8106aa099fa885df8a5a9b2 | sublimeautopep8lib/pycodestyle.py | python | whitespace_around_operator | (logical_line) | r"""Avoid extraneous whitespace around an operator.
Okay: a = 12 + 3
E221: a = 4 + 5
E222: a = 4 + 5
E223: a = 4\t+ 5
E224: a = 4 +\t5 | r"""Avoid extraneous whitespace around an operator. | [
"r",
"Avoid",
"extraneous",
"whitespace",
"around",
"an",
"operator",
"."
] | def whitespace_around_operator(logical_line):
r"""Avoid extraneous whitespace around an operator.
Okay: a = 12 + 3
E221: a = 4 + 5
E222: a = 4 + 5
E223: a = 4\t+ 5
E224: a = 4 +\t5
"""
for match in OPERATOR_REGEX.finditer(logical_line):
before, after = match.groups()
... | [
"def",
"whitespace_around_operator",
"(",
"logical_line",
")",
":",
"for",
"match",
"in",
"OPERATOR_REGEX",
".",
"finditer",
"(",
"logical_line",
")",
":",
"before",
",",
"after",
"=",
"match",
".",
"groups",
"(",
")",
"if",
"'\\t'",
"in",
"before",
":",
"... | https://github.com/wistful/SublimeAutoPEP8/blob/ea8bbdd811f7987cb8106aa099fa885df8a5a9b2/sublimeautopep8lib/pycodestyle.py#L821-L841 | ||
bububa/MongoHub | 7f761c424741d88bb234426b74b4092c40fb4987 | Resources/pymongo/database.py | python | Database.last_status | (self) | return self._command({"getlasterror": 1}) | Get status information from the last operation.
Returns a SON object with status information. | Get status information from the last operation. | [
"Get",
"status",
"information",
"from",
"the",
"last",
"operation",
"."
] | def last_status(self):
"""Get status information from the last operation.
Returns a SON object with status information.
"""
return self._command({"getlasterror": 1}) | [
"def",
"last_status",
"(",
"self",
")",
":",
"return",
"self",
".",
"_command",
"(",
"{",
"\"getlasterror\"",
":",
"1",
"}",
")"
] | https://github.com/bububa/MongoHub/blob/7f761c424741d88bb234426b74b4092c40fb4987/Resources/pymongo/database.py#L291-L296 | |
liangliangyy/DjangoBlog | 51d3cb9a29964904b6d59da3b771bb2454fd16ee | blog/models.py | python | Article.get_category_tree | (self) | return names | [] | def get_category_tree(self):
tree = self.category.get_category_tree()
names = list(map(lambda c: (c.name, c.get_absolute_url()), tree))
return names | [
"def",
"get_category_tree",
"(",
"self",
")",
":",
"tree",
"=",
"self",
".",
"category",
".",
"get_category_tree",
"(",
")",
"names",
"=",
"list",
"(",
"map",
"(",
"lambda",
"c",
":",
"(",
"c",
".",
"name",
",",
"c",
".",
"get_absolute_url",
"(",
")"... | https://github.com/liangliangyy/DjangoBlog/blob/51d3cb9a29964904b6d59da3b771bb2454fd16ee/blog/models.py#L128-L132 | |||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/ticker.py | python | LogLocator.base | (self, base) | set the base of the log scaling (major tick every base**i, i integer) | set the base of the log scaling (major tick every base**i, i integer) | [
"set",
"the",
"base",
"of",
"the",
"log",
"scaling",
"(",
"major",
"tick",
"every",
"base",
"**",
"i",
"i",
"integer",
")"
] | def base(self, base):
"""
set the base of the log scaling (major tick every base**i, i integer)
"""
self._base = base + 0.0 | [
"def",
"base",
"(",
"self",
",",
"base",
")",
":",
"self",
".",
"_base",
"=",
"base",
"+",
"0.0"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/ticker.py#L1393-L1397 | ||
debian-calibre/calibre | 020fc81d3936a64b2ac51459ecb796666ab6a051 | src/calibre/ebooks/rtf2xml/field_strings.py | python | FieldStrings.__include_text_func | (self, field_name, name, line) | return [None, None, the_string] | Required:
field_name -- the first word in the string
name --the changed name according to the dictionary
line -- the string to be parse
Returns:
The name of the field
Logic: | Required:
field_name -- the first word in the string
name --the changed name according to the dictionary
line -- the string to be parse
Returns:
The name of the field
Logic: | [
"Required",
":",
"field_name",
"--",
"the",
"first",
"word",
"in",
"the",
"string",
"name",
"--",
"the",
"changed",
"name",
"according",
"to",
"the",
"dictionary",
"line",
"--",
"the",
"string",
"to",
"be",
"parse",
"Returns",
":",
"The",
"name",
"of",
"... | def __include_text_func(self, field_name, name, line):
"""
Required:
field_name -- the first word in the string
name --the changed name according to the dictionary
line -- the string to be parse
Returns:
The name of the field
Logic:
... | [
"def",
"__include_text_func",
"(",
"self",
",",
"field_name",
",",
"name",
",",
"line",
")",
":",
"the_string",
"=",
"name",
"match_group",
"=",
"re",
".",
"search",
"(",
"self",
".",
"__format_text_exp",
",",
"line",
")",
"if",
"match_group",
":",
"name",... | https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/ebooks/rtf2xml/field_strings.py#L442-L482 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.