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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_obj.py | python | OCObject.create | (self, files=None, content=None) | return self._create(content_file['path']) | Create a config
NOTE: This creates the first file OR the first conent.
TODO: Handle all files and content passed in | Create a config | [
"Create",
"a",
"config"
] | def create(self, files=None, content=None):
'''
Create a config
NOTE: This creates the first file OR the first conent.
TODO: Handle all files and content passed in
'''
if files:
return self._create(files[0])
# pylint: disable=no-member
... | [
"def",
"create",
"(",
"self",
",",
"files",
"=",
"None",
",",
"content",
"=",
"None",
")",
":",
"if",
"files",
":",
"return",
"self",
".",
"_create",
"(",
"files",
"[",
"0",
"]",
")",
"# pylint: disable=no-member",
"# The purpose of this change is twofold:",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_obj.py#L1531-L1553 | |
zeropointdynamics/zelos | 0c5bd57b4bab56c23c27dc5301ba1a42ee054726 | src/zelos/api/memory_api.py | python | MemoryApi.get_region | (self, address: int) | return self._memory.get_region(address) | Returns the memory region that the specified address is mapped in,
if one exists, otherwise returns None.
Args:
address: Address used to specify a region of memory.
Returns:
A :py:class:`zelos.emulator.base.MemoryRegion` containing the
specified address, or ... | Returns the memory region that the specified address is mapped in,
if one exists, otherwise returns None. | [
"Returns",
"the",
"memory",
"region",
"that",
"the",
"specified",
"address",
"is",
"mapped",
"in",
"if",
"one",
"exists",
"otherwise",
"returns",
"None",
"."
] | def get_region(self, address: int) -> Optional[MemoryRegion]:
"""
Returns the memory region that the specified address is mapped in,
if one exists, otherwise returns None.
Args:
address: Address used to specify a region of memory.
Returns:
A :py:class:`z... | [
"def",
"get_region",
"(",
"self",
",",
"address",
":",
"int",
")",
"->",
"Optional",
"[",
"MemoryRegion",
"]",
":",
"return",
"self",
".",
"_memory",
".",
"get_region",
"(",
"address",
")"
] | https://github.com/zeropointdynamics/zelos/blob/0c5bd57b4bab56c23c27dc5301ba1a42ee054726/src/zelos/api/memory_api.py#L285-L298 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | pypy/module/cpyext/funcobject.py | python | PyMethod_New | (space, w_func, w_self, w_cls) | return Method(space, w_func, w_self, w_cls) | Return a new method object, with func being any callable object; this is the
function that will be called when the method is called. If this method should
be bound to an instance, self should be the instance and class should be the
class of self, otherwise self should be NULL and class should be the
cl... | Return a new method object, with func being any callable object; this is the
function that will be called when the method is called. If this method should
be bound to an instance, self should be the instance and class should be the
class of self, otherwise self should be NULL and class should be the
cl... | [
"Return",
"a",
"new",
"method",
"object",
"with",
"func",
"being",
"any",
"callable",
"object",
";",
"this",
"is",
"the",
"function",
"that",
"will",
"be",
"called",
"when",
"the",
"method",
"is",
"called",
".",
"If",
"this",
"method",
"should",
"be",
"b... | def PyMethod_New(space, w_func, w_self, w_cls):
"""Return a new method object, with func being any callable object; this is the
function that will be called when the method is called. If this method should
be bound to an instance, self should be the instance and class should be the
class of self, other... | [
"def",
"PyMethod_New",
"(",
"space",
",",
"w_func",
",",
"w_self",
",",
"w_cls",
")",
":",
"return",
"Method",
"(",
"space",
",",
"w_func",
",",
"w_self",
",",
"w_cls",
")"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/module/cpyext/funcobject.py#L94-L100 | |
microsoft/msticpy | 2a401444ee529114004f496f4c0376ff25b5268a | msticpy/common/exceptions.py | python | MsticpyImportExtraError.__init__ | (
self, *args, help_uri: Union[Tuple[str, str], str, None] = None, **kwargs
) | Create import missing extra exception.
Parameters
----------
help_uri : Union[Tuple[str, str], str, None], optional
Override the default help URI.
extra : str
The name of the setup extra that needs to be installed. | Create import missing extra exception. | [
"Create",
"import",
"missing",
"extra",
"exception",
"."
] | def __init__(
self, *args, help_uri: Union[Tuple[str, str], str, None] = None, **kwargs
):
"""
Create import missing extra exception.
Parameters
----------
help_uri : Union[Tuple[str, str], str, None], optional
Override the default help URI.
extra... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"help_uri",
":",
"Union",
"[",
"Tuple",
"[",
"str",
",",
"str",
"]",
",",
"str",
",",
"None",
"]",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"extra",
"=",
"kwargs",
".",
"pop",
"(",
... | https://github.com/microsoft/msticpy/blob/2a401444ee529114004f496f4c0376ff25b5268a/msticpy/common/exceptions.py#L371-L398 | ||
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/xlwt/Workbook.py | python | Workbook.__protect_rec | (self) | return BIFFRecords.ProtectRecord(self.__protect).get() | [] | def __protect_rec(self):
return BIFFRecords.ProtectRecord(self.__protect).get() | [
"def",
"__protect_rec",
"(",
"self",
")",
":",
"return",
"BIFFRecords",
".",
"ProtectRecord",
"(",
"self",
".",
"__protect",
")",
".",
"get",
"(",
")"
] | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/xlwt/Workbook.py#L508-L509 | |||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/geometry/util.py | python | _symbol | (s, matching_symbol=None) | Return s if s is a Symbol, else return either a new Symbol (real=True)
with the same name s or the matching_symbol if s is a string and it matches
the name of the matching_symbol.
>>> from sympy import Symbol
>>> from sympy.geometry.util import _symbol
>>> x = Symbol('x')
>>> _symbol('y')
y... | Return s if s is a Symbol, else return either a new Symbol (real=True)
with the same name s or the matching_symbol if s is a string and it matches
the name of the matching_symbol. | [
"Return",
"s",
"if",
"s",
"is",
"a",
"Symbol",
"else",
"return",
"either",
"a",
"new",
"Symbol",
"(",
"real",
"=",
"True",
")",
"with",
"the",
"same",
"name",
"s",
"or",
"the",
"matching_symbol",
"if",
"s",
"is",
"a",
"string",
"and",
"it",
"matches"... | def _symbol(s, matching_symbol=None):
"""Return s if s is a Symbol, else return either a new Symbol (real=True)
with the same name s or the matching_symbol if s is a string and it matches
the name of the matching_symbol.
>>> from sympy import Symbol
>>> from sympy.geometry.util import _symbol
>... | [
"def",
"_symbol",
"(",
"s",
",",
"matching_symbol",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"string_types",
")",
":",
"if",
"matching_symbol",
"and",
"matching_symbol",
".",
"name",
"==",
"s",
":",
"return",
"matching_symbol",
"return",
"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/geometry/util.py#L78-L116 | ||
mu-editor/mu | 5a5d7723405db588f67718a63a0ec0ecabebae33 | mu/modes/base.py | python | REPLConnection.execute | (self, commands) | Execute a series of commands over a period of time (scheduling
remaining commands to be run in the next iteration of the event loop). | Execute a series of commands over a period of time (scheduling
remaining commands to be run in the next iteration of the event loop). | [
"Execute",
"a",
"series",
"of",
"commands",
"over",
"a",
"period",
"of",
"time",
"(",
"scheduling",
"remaining",
"commands",
"to",
"be",
"run",
"in",
"the",
"next",
"iteration",
"of",
"the",
"event",
"loop",
")",
"."
] | def execute(self, commands):
"""
Execute a series of commands over a period of time (scheduling
remaining commands to be run in the next iteration of the event loop).
"""
if commands:
command = commands[0]
logger.info("Sending command {}".format(command))
... | [
"def",
"execute",
"(",
"self",
",",
"commands",
")",
":",
"if",
"commands",
":",
"command",
"=",
"commands",
"[",
"0",
"]",
"logger",
".",
"info",
"(",
"\"Sending command {}\"",
".",
"format",
"(",
"command",
")",
")",
"self",
".",
"write",
"(",
"comma... | https://github.com/mu-editor/mu/blob/5a5d7723405db588f67718a63a0ec0ecabebae33/mu/modes/base.py#L155-L166 | ||
titusjan/argos | 5a9c31a8a9a2ca825bbf821aa1e685740e3682d7 | argos/config/untypedcti.py | python | UntypedCtiEditor.getData | (self) | return self.lineEditor.text() | Gets data from the editor widget. | Gets data from the editor widget. | [
"Gets",
"data",
"from",
"the",
"editor",
"widget",
"."
] | def getData(self):
""" Gets data from the editor widget.
"""
return self.lineEditor.text() | [
"def",
"getData",
"(",
"self",
")",
":",
"return",
"self",
".",
"lineEditor",
".",
"text",
"(",
")"
] | https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/config/untypedcti.py#L79-L82 | |
google/clusterfuzz | f358af24f414daa17a3649b143e71ea71871ef59 | src/clusterfuzz/fuzz/__init__.py | python | is_fuzz_target | (file_path, file_handle=None) | return utils.is_fuzz_target_local(file_path, file_handle) | Returns whether |file_path| is a fuzz target. | Returns whether |file_path| is a fuzz target. | [
"Returns",
"whether",
"|file_path|",
"is",
"a",
"fuzz",
"target",
"."
] | def is_fuzz_target(file_path, file_handle=None):
"""Returns whether |file_path| is a fuzz target."""
return utils.is_fuzz_target_local(file_path, file_handle) | [
"def",
"is_fuzz_target",
"(",
"file_path",
",",
"file_handle",
"=",
"None",
")",
":",
"return",
"utils",
".",
"is_fuzz_target_local",
"(",
"file_path",
",",
"file_handle",
")"
] | https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/fuzz/__init__.py#L45-L47 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/misc/viewer.py | python | Viewer._set | (self, app=None, TYPE='browser') | r"""
Change the default viewer. Return the current setting if the
argument ``app`` is ``None``.
INPUT:
- ``app`` -- ``None`` or a string, the program to use
- ``TYPE`` -- a string, must be in the list ``VIEWERS`` defined in
:module:`sage.misc.viewer`. Default 'browse... | r"""
Change the default viewer. Return the current setting if the
argument ``app`` is ``None``. | [
"r",
"Change",
"the",
"default",
"viewer",
".",
"Return",
"the",
"current",
"setting",
"if",
"the",
"argument",
"app",
"is",
"None",
"."
] | def _set(self, app=None, TYPE='browser'):
r"""
Change the default viewer. Return the current setting if the
argument ``app`` is ``None``.
INPUT:
- ``app`` -- ``None`` or a string, the program to use
- ``TYPE`` -- a string, must be in the list ``VIEWERS`` defined in
... | [
"def",
"_set",
"(",
"self",
",",
"app",
"=",
"None",
",",
"TYPE",
"=",
"'browser'",
")",
":",
"TYPE",
"=",
"TYPE",
".",
"lower",
"(",
")",
"if",
"TYPE",
"not",
"in",
"VIEWERS",
":",
"raise",
"ValueError",
"(",
"'Unrecognized type of viewer: {}'",
".",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/misc/viewer.py#L157-L191 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/navoptapi-0.1.0/versioneer.py | python | git_versions_from_keywords | (keywords, tag_prefix, verbose) | return {"version": "0+unknown",
"full-revisionid": keywords["full"].strip(),
"dirty": False, "error": "no suitable tags", "date": None} | Get version information from git keywords. | Get version information from git keywords. | [
"Get",
"version",
"information",
"from",
"git",
"keywords",
"."
] | def git_versions_from_keywords(keywords, tag_prefix, verbose):
"""Get version information from git keywords."""
if not keywords:
raise NotThisMethod("no keywords at all, weird")
date = keywords.get("date")
if date is not None:
# git-2.2.0 added "%cI", which expands to an ISO-8601 -compli... | [
"def",
"git_versions_from_keywords",
"(",
"keywords",
",",
"tag_prefix",
",",
"verbose",
")",
":",
"if",
"not",
"keywords",
":",
"raise",
"NotThisMethod",
"(",
"\"no keywords at all, weird\"",
")",
"date",
"=",
"keywords",
".",
"get",
"(",
"\"date\"",
")",
"if",... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/navoptapi-0.1.0/versioneer.py#L974-L1025 | |
jhpyle/docassemble | b90c84e57af59aa88b3404d44d0b125c70f832cc | docassemble_base/docassemble/base/marisol/marisol.py | python | Document.add_overlay | (self, overlay) | return self | Add an overlay to the page in addition to the bates stamp.
Args:
overlay (Marisol.GenericTextOverlay): Overlay to apply
Raises:
ValueError: When area is already reserved for Bates Stamp | Add an overlay to the page in addition to the bates stamp. | [
"Add",
"an",
"overlay",
"to",
"the",
"page",
"in",
"addition",
"to",
"the",
"bates",
"stamp",
"."
] | def add_overlay(self, overlay):
"""
Add an overlay to the page in addition to the bates stamp.
Args:
overlay (Marisol.GenericTextOverlay): Overlay to apply
Raises:
ValueError: When area is already reserved for Bates Stamp
"""
area = overlay.are... | [
"def",
"add_overlay",
"(",
"self",
",",
"overlay",
")",
":",
"area",
"=",
"overlay",
".",
"area",
"if",
"isinstance",
"(",
"self",
".",
"overlays",
"[",
"area",
"]",
",",
"BatesOverlay",
")",
":",
"raise",
"ValueError",
"(",
"\"Area {} is already reserved fo... | https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/marisol/marisol.py#L219-L233 | |
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extractGzetranslationsHomeBlog.py | python | extractGzetranslationsHomeBlog | (item) | return False | Parser for 'gzetranslations.home.blog' | Parser for 'gzetranslations.home.blog' | [
"Parser",
"for",
"gzetranslations",
".",
"home",
".",
"blog"
] | def extractGzetranslationsHomeBlog(item):
'''
Parser for 'gzetranslations.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Lo... | [
"def",
"extractGzetranslationsHomeBlog",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"\"preview\"",
... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractGzetranslationsHomeBlog.py#L2-L21 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/django/http/response.py | python | HttpResponse.serialize | (self) | return self.serialize_headers() + b'\r\n\r\n' + self.content | Full HTTP message, including headers, as a bytestring. | Full HTTP message, including headers, as a bytestring. | [
"Full",
"HTTP",
"message",
"including",
"headers",
"as",
"a",
"bytestring",
"."
] | def serialize(self):
"""Full HTTP message, including headers, as a bytestring."""
return self.serialize_headers() + b'\r\n\r\n' + self.content | [
"def",
"serialize",
"(",
"self",
")",
":",
"return",
"self",
".",
"serialize_headers",
"(",
")",
"+",
"b'\\r\\n\\r\\n'",
"+",
"self",
".",
"content"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/http/response.py#L262-L264 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/lib-tk/turtle.py | python | TurtleScreen.listen | (self, xdummy=None, ydummy=None) | Set focus on TurtleScreen (in order to collect key-events)
No arguments.
Dummy arguments are provided in order
to be able to pass listen to the onclick method.
Example (for a TurtleScreen instance named screen):
>>> screen.listen() | Set focus on TurtleScreen (in order to collect key-events) | [
"Set",
"focus",
"on",
"TurtleScreen",
"(",
"in",
"order",
"to",
"collect",
"key",
"-",
"events",
")"
] | def listen(self, xdummy=None, ydummy=None):
"""Set focus on TurtleScreen (in order to collect key-events)
No arguments.
Dummy arguments are provided in order
to be able to pass listen to the onclick method.
Example (for a TurtleScreen instance named screen):
>>> screen.... | [
"def",
"listen",
"(",
"self",
",",
"xdummy",
"=",
"None",
",",
"ydummy",
"=",
"None",
")",
":",
"self",
".",
"_listen",
"(",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/turtle.py#L1345-L1355 | ||
Tencent/QT4A | cc99ce12bd10f864c95b7bf0675fd1b757bce4bb | qt4a/androiddriver/devicedriver.py | python | DeviceDriver._send_command | (self, cmd_type, **kwds) | return result["Result"] | 发送命令 | 发送命令 | [
"发送命令"
] | def _send_command(self, cmd_type, **kwds):
"""发送命令
"""
result = self.client.send_command(cmd_type, **kwds)
if result == None:
logger.error("系统测试桩连接错误")
self._kill_server()
if self._client:
self._client.close()
self._client =... | [
"def",
"_send_command",
"(",
"self",
",",
"cmd_type",
",",
"*",
"*",
"kwds",
")",
":",
"result",
"=",
"self",
".",
"client",
".",
"send_command",
"(",
"cmd_type",
",",
"*",
"*",
"kwds",
")",
"if",
"result",
"==",
"None",
":",
"logger",
".",
"error",
... | https://github.com/Tencent/QT4A/blob/cc99ce12bd10f864c95b7bf0675fd1b757bce4bb/qt4a/androiddriver/devicedriver.py#L484-L500 | |
aws/aws-sam-cli | 2aa7bf01b2e0b0864ef63b1898a8b30577443acc | samcli/lib/package/utils.py | python | is_s3_url | (url: str) | return any(regex.match(url) for regex in _S3_URL_REGEXS) | Check whether a URL is a S3 access URL
specified at https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/UsingBucket.html | Check whether a URL is a S3 access URL
specified at https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/UsingBucket.html | [
"Check",
"whether",
"a",
"URL",
"is",
"a",
"S3",
"access",
"URL",
"specified",
"at",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"AmazonS3",
"/",
"latest",
"/",
"dev",
"-",
"retired",
"/",
"UsingBucket",
".",
"html"
] | def is_s3_url(url: str) -> bool:
"""
Check whether a URL is a S3 access URL
specified at https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/UsingBucket.html
"""
return any(regex.match(url) for regex in _S3_URL_REGEXS) | [
"def",
"is_s3_url",
"(",
"url",
":",
"str",
")",
"->",
"bool",
":",
"return",
"any",
"(",
"regex",
".",
"match",
"(",
"url",
")",
"for",
"regex",
"in",
"_S3_URL_REGEXS",
")"
] | https://github.com/aws/aws-sam-cli/blob/2aa7bf01b2e0b0864ef63b1898a8b30577443acc/samcli/lib/package/utils.py#L69-L74 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_clusterrole.py | python | OCClusterRole.clusterrole | (self) | return self._clusterrole | property for clusterrole | property for clusterrole | [
"property",
"for",
"clusterrole"
] | def clusterrole(self):
''' property for clusterrole'''
if self._clusterrole is None:
self.get()
return self._clusterrole | [
"def",
"clusterrole",
"(",
"self",
")",
":",
"if",
"self",
".",
"_clusterrole",
"is",
"None",
":",
"self",
".",
"get",
"(",
")",
"return",
"self",
".",
"_clusterrole"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_clusterrole.py#L1692-L1696 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/lib-tk/turtle.py | python | TurtleScreen.turtles | (self) | return self._turtles | Return the list of turtles on the screen.
Example (for a TurtleScreen instance named screen):
>>> screen.turtles()
[<turtle.Turtle object at 0x00E11FB0>] | Return the list of turtles on the screen. | [
"Return",
"the",
"list",
"of",
"turtles",
"on",
"the",
"screen",
"."
] | def turtles(self):
"""Return the list of turtles on the screen.
Example (for a TurtleScreen instance named screen):
>>> screen.turtles()
[<turtle.Turtle object at 0x00E11FB0>]
"""
return self._turtles | [
"def",
"turtles",
"(",
"self",
")",
":",
"return",
"self",
".",
"_turtles"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/lib-tk/turtle.py#L1161-L1168 | |
Calysto/calysto_scheme | 15bf81987870bcae1264e5a0a06feb9a8ee12b8b | calysto_scheme/scheme.py | python | symbol_q_hat | (asexp) | return (atom_q_hat(asexp)) and (symbol_q(untag_atom_hat(asexp))) | [] | def symbol_q_hat(asexp):
return (atom_q_hat(asexp)) and (symbol_q(untag_atom_hat(asexp))) | [
"def",
"symbol_q_hat",
"(",
"asexp",
")",
":",
"return",
"(",
"atom_q_hat",
"(",
"asexp",
")",
")",
"and",
"(",
"symbol_q",
"(",
"untag_atom_hat",
"(",
"asexp",
")",
")",
")"
] | https://github.com/Calysto/calysto_scheme/blob/15bf81987870bcae1264e5a0a06feb9a8ee12b8b/calysto_scheme/scheme.py#L6234-L6235 | |||
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | theme/forms.py | python | ThreadedCommentForm.save | (self, request) | return comment | Saves a new comment and sends any notification emails. | Saves a new comment and sends any notification emails. | [
"Saves",
"a",
"new",
"comment",
"and",
"sends",
"any",
"notification",
"emails",
"."
] | def save(self, request):
"""
Saves a new comment and sends any notification emails.
"""
comment = self.get_comment_object()
obj = comment.content_object
if request.user.is_authenticated():
comment.user = request.user
comment.user_name = best_name(c... | [
"def",
"save",
"(",
"self",
",",
"request",
")",
":",
"comment",
"=",
"self",
".",
"get_comment_object",
"(",
")",
"obj",
"=",
"comment",
".",
"content_object",
"if",
"request",
".",
"user",
".",
"is_authenticated",
"(",
")",
":",
"comment",
".",
"user",... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/theme/forms.py#L135-L169 | |
jaychsu/algorithm | 87dac5456b74a515dd97507ac68e9b8588066a04 | lintcode/52_next_permutation.py | python | Solution.nextPermutation | (self, nums) | return nums | :type nums: list[int]
:rtype: list[int] | :type nums: list[int]
:rtype: list[int] | [
":",
"type",
"nums",
":",
"list",
"[",
"int",
"]",
":",
"rtype",
":",
"list",
"[",
"int",
"]"
] | def nextPermutation(self, nums):
"""
:type nums: list[int]
:rtype: list[int]
"""
if not nums or len(nums) < 2:
return nums
n = len(nums)
i = n - 2
while i >= 0 and nums[i] >= nums[i + 1]:
i -= 1
if i >= 0:
j = ... | [
"def",
"nextPermutation",
"(",
"self",
",",
"nums",
")",
":",
"if",
"not",
"nums",
"or",
"len",
"(",
"nums",
")",
"<",
"2",
":",
"return",
"nums",
"n",
"=",
"len",
"(",
"nums",
")",
"i",
"=",
"n",
"-",
"2",
"while",
"i",
">=",
"0",
"and",
"nu... | https://github.com/jaychsu/algorithm/blob/87dac5456b74a515dd97507ac68e9b8588066a04/lintcode/52_next_permutation.py#L16-L42 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/hdmi_cec/__init__.py | python | CecEntity.extra_state_attributes | (self) | return state_attr | Return the state attributes. | Return the state attributes. | [
"Return",
"the",
"state",
"attributes",
"."
] | def extra_state_attributes(self):
"""Return the state attributes."""
state_attr = {}
if self.vendor_id is not None:
state_attr[ATTR_VENDOR_ID] = self.vendor_id
state_attr[ATTR_VENDOR_NAME] = self.vendor_name
if self.type_id is not None:
state_attr[ATTR... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"state_attr",
"=",
"{",
"}",
"if",
"self",
".",
"vendor_id",
"is",
"not",
"None",
":",
"state_attr",
"[",
"ATTR_VENDOR_ID",
"]",
"=",
"self",
".",
"vendor_id",
"state_attr",
"[",
"ATTR_VENDOR_NAME",
"]"... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/hdmi_cec/__init__.py#L464-L475 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/pydoc.py | python | render_doc | (thing, title='Python Library Documentation: %s', forceload=0) | return title % desc + '\n\n' + text.document(object, name) | Render text documentation, given an object or a path to an object. | Render text documentation, given an object or a path to an object. | [
"Render",
"text",
"documentation",
"given",
"an",
"object",
"or",
"a",
"path",
"to",
"an",
"object",
"."
] | def render_doc(thing, title='Python Library Documentation: %s', forceload=0):
"""Render text documentation, given an object or a path to an object."""
object, name = resolve(thing, forceload)
desc = describe(object)
module = inspect.getmodule(object)
if name and '.' in name:
desc += ' in ' +... | [
"def",
"render_doc",
"(",
"thing",
",",
"title",
"=",
"'Python Library Documentation: %s'",
",",
"forceload",
"=",
"0",
")",
":",
"object",
",",
"name",
"=",
"resolve",
"(",
"thing",
",",
"forceload",
")",
"desc",
"=",
"describe",
"(",
"object",
")",
"modu... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/pydoc.py#L1483-L1506 | |
chainer/chainerui | 91c5c26d9154a008079dbb0bcbf69b5590d105f7 | chainerui/views/project.py | python | ProjectAPI.get | (self, id=None) | get. | get. | [
"get",
"."
] | def get(self, id=None):
"""get."""
if id is None:
path = request.args.get('path_name', default=None)
if path is not None:
project = db.session.query(Project).filter_by(
path_name=path).first()
if project is None:
... | [
"def",
"get",
"(",
"self",
",",
"id",
"=",
"None",
")",
":",
"if",
"id",
"is",
"None",
":",
"path",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'path_name'",
",",
"default",
"=",
"None",
")",
"if",
"path",
"is",
"not",
"None",
":",
"project",
... | https://github.com/chainer/chainerui/blob/91c5c26d9154a008079dbb0bcbf69b5590d105f7/chainerui/views/project.py#L12-L41 | ||
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/gui/base/ThemesManager.py | python | ThemesManager.get_name_list | (self) | return items | return a list with the name of all the available themes | return a list with the name of all the available themes | [
"return",
"a",
"list",
"with",
"the",
"name",
"of",
"all",
"the",
"available",
"themes"
] | def get_name_list(self):
'''return a list with the name of all the available themes
'''
items = []
for item in self.list():
item = self.get_name_from_path(item)
items.append(item)
return items | [
"def",
"get_name_list",
"(",
"self",
")",
":",
"items",
"=",
"[",
"]",
"for",
"item",
"in",
"self",
".",
"list",
"(",
")",
":",
"item",
"=",
"self",
".",
"get_name_from_path",
"(",
"item",
")",
"items",
".",
"append",
"(",
"item",
")",
"return",
"i... | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/gui/base/ThemesManager.py#L70-L79 | |
crossbario/autobahn-python | fa9f2da0c5005574e63456a3a04f00e405744014 | autobahn/xbr/_eip712_market_join.py | python | sign_eip712_market_join | (eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes,
joined: int, marketId: bytes, actorType: int, meta: str) | return sign(eth_privkey, data) | :param eth_privkey: Ethereum address of buyer (a raw 20 bytes Ethereum address).
:type eth_privkey: bytes
:return: The signature according to EIP712 (32+32+1 raw bytes).
:rtype: bytes | [] | def sign_eip712_market_join(eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes,
joined: int, marketId: bytes, actorType: int, meta: str) -> bytes:
"""
:param eth_privkey: Ethereum address of buyer (a raw 20 bytes Ethereum address).
:type eth_privkey: bytes... | [
"def",
"sign_eip712_market_join",
"(",
"eth_privkey",
":",
"bytes",
",",
"chainId",
":",
"int",
",",
"verifyingContract",
":",
"bytes",
",",
"member",
":",
"bytes",
",",
"joined",
":",
"int",
",",
"marketId",
":",
"bytes",
",",
"actorType",
":",
"int",
","... | https://github.com/crossbario/autobahn-python/blob/fa9f2da0c5005574e63456a3a04f00e405744014/autobahn/xbr/_eip712_market_join.py#L115-L129 | ||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/lnhtlc.py | python | HTLCManager.get_next_htlc_id | (self, sub: HTLCOwner) | return self.log[sub]['next_htlc_id'] | [] | def get_next_htlc_id(self, sub: HTLCOwner) -> int:
return self.log[sub]['next_htlc_id'] | [
"def",
"get_next_htlc_id",
"(",
"self",
",",
"sub",
":",
"HTLCOwner",
")",
"->",
"int",
":",
"return",
"self",
".",
"log",
"[",
"sub",
"]",
"[",
"'next_htlc_id'",
"]"
] | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/lnhtlc.py#L66-L67 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tdmq/v20200217/models.py | python | DescribeClusterDetailResponse.__init__ | (self) | r"""
:param ClusterSet: 集群的详细信息
:type ClusterSet: :class:`tencentcloud.tdmq.v20200217.models.Cluster`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param ClusterSet: 集群的详细信息
:type ClusterSet: :class:`tencentcloud.tdmq.v20200217.models.Cluster`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"ClusterSet",
":",
"集群的详细信息",
":",
"type",
"ClusterSet",
":",
":",
"class",
":",
"tencentcloud",
".",
"tdmq",
".",
"v20200217",
".",
"models",
".",
"Cluster",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要提供该次请求的",
"RequestId。"... | def __init__(self):
r"""
:param ClusterSet: 集群的详细信息
:type ClusterSet: :class:`tencentcloud.tdmq.v20200217.models.Cluster`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.ClusterSet = None
self.RequestId = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ClusterSet",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tdmq/v20200217/models.py#L4035-L4043 | ||
soeaver/Pytorch_Mask_RCNN | aaee46490340cec83c2fbd72471c4020786c5266 | preprocess/InputProcess.py | python | unmold_image | (normalized_images, config) | return (normalized_images + config.MEAN_PIXEL).astype(np.uint8) | Takes a image normalized with mold() and returns the original. | Takes a image normalized with mold() and returns the original. | [
"Takes",
"a",
"image",
"normalized",
"with",
"mold",
"()",
"and",
"returns",
"the",
"original",
"."
] | def unmold_image(normalized_images, config):
"""Takes a image normalized with mold() and returns the original."""
return (normalized_images + config.MEAN_PIXEL).astype(np.uint8) | [
"def",
"unmold_image",
"(",
"normalized_images",
",",
"config",
")",
":",
"return",
"(",
"normalized_images",
"+",
"config",
".",
"MEAN_PIXEL",
")",
".",
"astype",
"(",
"np",
".",
"uint8",
")"
] | https://github.com/soeaver/Pytorch_Mask_RCNN/blob/aaee46490340cec83c2fbd72471c4020786c5266/preprocess/InputProcess.py#L143-L145 | |
p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch | 135d3e2e06bbde2868047d738e3fc2d73fd8cc93 | utilities/Parallel_Experience_Generator.py | python | Parallel_Experience_Generator.reset_game | (self) | return state | Resets the game environment so it is ready to play a new episode | Resets the game environment so it is ready to play a new episode | [
"Resets",
"the",
"game",
"environment",
"so",
"it",
"is",
"ready",
"to",
"play",
"a",
"new",
"episode"
] | def reset_game(self):
"""Resets the game environment so it is ready to play a new episode"""
seed = randint(0, sys.maxsize)
torch.manual_seed(seed) # Need to do this otherwise each worker generates same experience
state = self.environment.reset()
if self.action_types == "CONTINUO... | [
"def",
"reset_game",
"(",
"self",
")",
":",
"seed",
"=",
"randint",
"(",
"0",
",",
"sys",
".",
"maxsize",
")",
"torch",
".",
"manual_seed",
"(",
"seed",
")",
"# Need to do this otherwise each worker generates same experience",
"state",
"=",
"self",
".",
"environ... | https://github.com/p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch/blob/135d3e2e06bbde2868047d738e3fc2d73fd8cc93/utilities/Parallel_Experience_Generator.py#L60-L66 | |
zym1119/DeepLabv3_MobileNetv2_PyTorch | 5f3ee3060fa005657e8ff3bc301197107a06444c | network.py | python | MobileNetv2_DeepLabv3.val_one_epoch | (self) | Validate network in one epoch every m training epochs,
m is defined in params.val_every | Validate network in one epoch every m training epochs,
m is defined in params.val_every | [
"Validate",
"network",
"in",
"one",
"epoch",
"every",
"m",
"training",
"epochs",
"m",
"is",
"defined",
"in",
"params",
".",
"val_every"
] | def val_one_epoch(self):
"""
Validate network in one epoch every m training epochs,
m is defined in params.val_every
"""
# TODO: add IoU compute function
print('Validating:')
# set mode eval
self.network.eval()
# prepare data
val_loss... | [
"def",
"val_one_epoch",
"(",
"self",
")",
":",
"# TODO: add IoU compute function",
"print",
"(",
"'Validating:'",
")",
"# set mode eval",
"self",
".",
"network",
".",
"eval",
"(",
")",
"# prepare data",
"val_loss",
"=",
"0",
"val_loader",
"=",
"DataLoader",
"(",
... | https://github.com/zym1119/DeepLabv3_MobileNetv2_PyTorch/blob/5f3ee3060fa005657e8ff3bc301197107a06444c/network.py#L151-L201 | ||
uwdata/termite-data-server | 1085571407c627bdbbd21c352e793fed65d09599 | web2py/gluon/contrib/markdown/markdown2.py | python | _xml_oneliner_re_from_tab_width | (tab_width) | return re.compile(r"""
(?:
(?<=\n\n) # Starting after a blank line
| # or
\A\n? # the beginning of the doc
)
( # save in $1
[ ]{0,%d}
(?:
<\?\w+\b\s+.*?\?> # XML ... | Standalone XML processing instruction regex. | Standalone XML processing instruction regex. | [
"Standalone",
"XML",
"processing",
"instruction",
"regex",
"."
] | def _xml_oneliner_re_from_tab_width(tab_width):
"""Standalone XML processing instruction regex."""
return re.compile(r"""
(?:
(?<=\n\n) # Starting after a blank line
| # or
\A\n? # the beginning of the doc
)
( ... | [
"def",
"_xml_oneliner_re_from_tab_width",
"(",
"tab_width",
")",
":",
"return",
"re",
".",
"compile",
"(",
"r\"\"\"\n (?:\n (?<=\\n\\n) # Starting after a blank line\n | # or\n \\A\\n? # the beginning of the doc\n )\n... | https://github.com/uwdata/termite-data-server/blob/1085571407c627bdbbd21c352e793fed65d09599/web2py/gluon/contrib/markdown/markdown2.py#L1703-L1721 | |
kubeflow/pipelines | bea751c9259ff0ae85290f873170aae89284ba8e | sdk/python/kfp/_local_client.py | python | _Dag.get_follows | (self, source_node: str) | return self._graph.get(source_node, []) | Get all target nodes start from the specified source node.
Args::
source_node: the source node | Get all target nodes start from the specified source node. | [
"Get",
"all",
"target",
"nodes",
"start",
"from",
"the",
"specified",
"source",
"node",
"."
] | def get_follows(self, source_node: str) -> List[str]:
"""Get all target nodes start from the specified source node.
Args::
source_node: the source node
"""
return self._graph.get(source_node, []) | [
"def",
"get_follows",
"(",
"self",
",",
"source_node",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_graph",
".",
"get",
"(",
"source_node",
",",
"[",
"]",
")"
] | https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/sdk/python/kfp/_local_client.py#L65-L71 | |
log2timeline/dfvfs | 4ca7bf06b15cdc000297a7122a065f0ca71de544 | dfvfs/helpers/volume_scanner.py | python | VolumeScannerMediator.UnlockEncryptedVolume | (
self, source_scanner_object, scan_context, locked_scan_node, credentials) | Unlocks an encrypted volume.
This method can be used to prompt the user to provide encrypted volume
credentials.
Args:
source_scanner_object (SourceScanner): source scanner.
scan_context (SourceScannerContext): source scanner context.
locked_scan_node (SourceScanNode): locked scan node.
... | Unlocks an encrypted volume. | [
"Unlocks",
"an",
"encrypted",
"volume",
"."
] | def UnlockEncryptedVolume(
self, source_scanner_object, scan_context, locked_scan_node, credentials):
"""Unlocks an encrypted volume.
This method can be used to prompt the user to provide encrypted volume
credentials.
Args:
source_scanner_object (SourceScanner): source scanner.
scan_... | [
"def",
"UnlockEncryptedVolume",
"(",
"self",
",",
"source_scanner_object",
",",
"scan_context",
",",
"locked_scan_node",
",",
"credentials",
")",
":"
] | https://github.com/log2timeline/dfvfs/blob/4ca7bf06b15cdc000297a7122a065f0ca71de544/dfvfs/helpers/volume_scanner.py#L154-L169 | ||
hellojialee/Improved-Body-Parts | 0fa17dff1ea829c2951c18185d5f1ce7fe0072fc | config/config_final.py | python | CanonicalConfig.__init__ | (self) | [] | def __init__(self):
self.width = 384
self.height = 384
self.stride = 4 # 用于计算网络输出的feature map的尺寸
# self.img_mean = [0.485, 0.456, 0.406] # RGB format mean and standard variance
# self.img_std = [0.229, 0.224, 0.225]
self.parts = ["nose", "neck", "Rsho", "Relb", "Rwri", ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"width",
"=",
"384",
"self",
".",
"height",
"=",
"384",
"self",
".",
"stride",
"=",
"4",
"# 用于计算网络输出的feature map的尺寸",
"# self.img_mean = [0.485, 0.456, 0.406] # RGB format mean and standard variance",
"# self.img_s... | https://github.com/hellojialee/Improved-Body-Parts/blob/0fa17dff1ea829c2951c18185d5f1ce7fe0072fc/config/config_final.py#L53-L124 | ||||
getting-things-gnome/gtg | 4b02c43744b32a00facb98174f04ec5953bd055d | GTG/core/task.py | python | Task.duplicate | (self) | return copy | Duplicates a task with a new ID | Duplicates a task with a new ID | [
"Duplicates",
"a",
"task",
"with",
"a",
"new",
"ID"
] | def duplicate(self):
""" Duplicates a task with a new ID """
copy = self.req.ds.new_task()
# Inherit the recurrency
copy.set_recurring(True, self.recurring_term)
nextdate = self.get_next_occurrence()
copy.set_due_date(nextdate)
copy.set_title(self.title)
... | [
"def",
"duplicate",
"(",
"self",
")",
":",
"copy",
"=",
"self",
".",
"req",
".",
"ds",
".",
"new_task",
"(",
")",
"# Inherit the recurrency",
"copy",
".",
"set_recurring",
"(",
"True",
",",
"self",
".",
"recurring_term",
")",
"nextdate",
"=",
"self",
"."... | https://github.com/getting-things-gnome/gtg/blob/4b02c43744b32a00facb98174f04ec5953bd055d/GTG/core/task.py#L130-L143 | |
privacyidea/privacyidea | 9490c12ddbf77a34ac935b082d09eb583dfafa2c | privacyidea/lib/subscriptions.py | python | delete_subscription | (application) | return ret | Delete the subscription for the given application
:param application:
:return: True in case of success | Delete the subscription for the given application | [
"Delete",
"the",
"subscription",
"for",
"the",
"given",
"application"
] | def delete_subscription(application):
"""
Delete the subscription for the given application
:param application:
:return: True in case of success
"""
ret = -1
sub = Subscription.query.filter(Subscription.application ==
application).first()
if sub:
... | [
"def",
"delete_subscription",
"(",
"application",
")",
":",
"ret",
"=",
"-",
"1",
"sub",
"=",
"Subscription",
".",
"query",
".",
"filter",
"(",
"Subscription",
".",
"application",
"==",
"application",
")",
".",
"first",
"(",
")",
"if",
"sub",
":",
"sub",... | https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/lib/subscriptions.py#L189-L203 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_certificate_signing_request.py | python | V1CertificateSigningRequest.__init__ | (self, api_version=None, kind=None, metadata=None, spec=None, status=None, local_vars_configuration=None) | V1CertificateSigningRequest - a model defined in OpenAPI | V1CertificateSigningRequest - a model defined in OpenAPI | [
"V1CertificateSigningRequest",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, api_version=None, kind=None, metadata=None, spec=None, status=None, local_vars_configuration=None): # noqa: E501
"""V1CertificateSigningRequest - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
... | [
"def",
"__init__",
"(",
"self",
",",
"api_version",
"=",
"None",
",",
"kind",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"spec",
"=",
"None",
",",
"status",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_certificate_signing_request.py#L51-L72 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/boto3_elasticache.py | python | modify_cache_cluster | (
name,
wait=600,
security_groups=None,
region=None,
key=None,
keyid=None,
profile=None,
**args
) | return _modify_resource(
name,
name_param="CacheClusterId",
desc="cache cluster",
res_type="cache_cluster",
wait=wait,
status_param="CacheClusterStatus",
region=region,
key=key,
keyid=keyid,
profile=profile,
**args
) | Update a cache cluster in place.
Notes: {ApplyImmediately: False} is pretty danged silly in the context of salt.
You can pass it, but for fairly obvious reasons the results over multiple
runs will be undefined and probably contrary to your desired state.
Reducing the number of ... | Update a cache cluster in place. | [
"Update",
"a",
"cache",
"cluster",
"in",
"place",
"."
] | def modify_cache_cluster(
name,
wait=600,
security_groups=None,
region=None,
key=None,
keyid=None,
profile=None,
**args
):
"""
Update a cache cluster in place.
Notes: {ApplyImmediately: False} is pretty danged silly in the context of salt.
You can pass it, but f... | [
"def",
"modify_cache_cluster",
"(",
"name",
",",
"wait",
"=",
"600",
",",
"security_groups",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"args",
")",
":",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/boto3_elasticache.py#L449-L500 | |
mherrmann/selenium-python-helium | 02f9a5a872871999d683c84461ac0d0b3e9da192 | helium/__init__.py | python | TextField.is_enabled | (self) | return self._impl.is_enabled() | Returns true if this UI element can currently be interacted with.
The difference between a text field being 'enabled' and 'editable' is
mostly visual: If a text field is not enabled, it is usually greyed out,
whereas if it is not editable it looks normal. See also ``is_editable``. | Returns true if this UI element can currently be interacted with. | [
"Returns",
"true",
"if",
"this",
"UI",
"element",
"can",
"currently",
"be",
"interacted",
"with",
"."
] | def is_enabled(self):
"""
Returns true if this UI element can currently be interacted with.
The difference between a text field being 'enabled' and 'editable' is
mostly visual: If a text field is not enabled, it is usually greyed out,
whereas if it is not editable it looks normal. See also ``is_editable``.
... | [
"def",
"is_enabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_impl",
".",
"is_enabled",
"(",
")"
] | https://github.com/mherrmann/selenium-python-helium/blob/02f9a5a872871999d683c84461ac0d0b3e9da192/helium/__init__.py#L837-L845 | |
madduck/reclass | 9c3478498a5dfa3d1e5cf7aa3b602ca3b53ee15b | reclass/utils/refvalue.py | python | RefValue._parse | (self, string) | [] | def _parse(self, string):
parts = RefValue.INTERPOLATION_RE.split(string)
self._refs = parts[1:][::2]
self._strings = parts[0:][::2]
self._check_strings(string) | [
"def",
"_parse",
"(",
"self",
",",
"string",
")",
":",
"parts",
"=",
"RefValue",
".",
"INTERPOLATION_RE",
".",
"split",
"(",
"string",
")",
"self",
".",
"_refs",
"=",
"parts",
"[",
"1",
":",
"]",
"[",
":",
":",
"2",
"]",
"self",
".",
"_strings",
... | https://github.com/madduck/reclass/blob/9c3478498a5dfa3d1e5cf7aa3b602ca3b53ee15b/reclass/utils/refvalue.py#L65-L69 | ||||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/urllib3/response.py | python | DeflateDecoder.decompress | (self, data) | [] | def decompress(self, data):
if not data:
return data
if not self._first_try:
return self._obj.decompress(data)
self._data += data
try:
decompressed = self._obj.decompress(data)
if decompressed:
self._first_try = False
... | [
"def",
"decompress",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"data",
"if",
"not",
"self",
".",
"_first_try",
":",
"return",
"self",
".",
"_obj",
".",
"decompress",
"(",
"data",
")",
"self",
".",
"_data",
"+=",
"data",
... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/urllib3/response.py#L44-L64 | ||||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_daemon_set_status.py | python | V1DaemonSetStatus.__repr__ | (self) | return self.to_str() | For `print` and `pprint` | For `print` and `pprint` | [
"For",
"print",
"and",
"pprint"
] | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_daemon_set_status.py#L362-L364 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/tkinter/ttk.py | python | Scale.configure | (self, cnf=None, **kw) | Modify or query scale options.
Setting a value for any of the "from", "from_" or "to" options
generates a <<RangeChanged>> event. | Modify or query scale options. | [
"Modify",
"or",
"query",
"scale",
"options",
"."
] | def configure(self, cnf=None, **kw):
"""Modify or query scale options.
Setting a value for any of the "from", "from_" or "to" options
generates a <<RangeChanged>> event."""
if cnf:
kw.update(cnf)
Widget.configure(self, **kw)
if any(['from' in kw, 'from_' in k... | [
"def",
"configure",
"(",
"self",
",",
"cnf",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"cnf",
":",
"kw",
".",
"update",
"(",
"cnf",
")",
"Widget",
".",
"configure",
"(",
"self",
",",
"*",
"*",
"kw",
")",
"if",
"any",
"(",
"[",
"'from'... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tkinter/ttk.py#L1103-L1112 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/StringIO.py | python | StringIO.flush | (self) | Flush the internal buffer | Flush the internal buffer | [
"Flush",
"the",
"internal",
"buffer"
] | def flush(self):
"""Flush the internal buffer
"""
_complain_ifclosed(self.closed) | [
"def",
"flush",
"(",
"self",
")",
":",
"_complain_ifclosed",
"(",
"self",
".",
"closed",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/StringIO.py#L253-L256 | ||
CompVis/adaptive-style-transfer | 51b4c90dbd998d9efd1dc821ad7a8df69bef61da | evaluation/feature_extractor/feature_extractor.py | python | SlimFeatureExtractor.extract | (self, image_paths, layer_names, flipped=False, batch_size=64,
should_reshape_vectors=True, verbose=2, spatial_pool=None) | return features | Extract features from the image | Extract features from the image | [
"Extract",
"features",
"from",
"the",
"image"
] | def extract(self, image_paths, layer_names, flipped=False, batch_size=64,
should_reshape_vectors=True, verbose=2, spatial_pool=None):
"""
Extract features from the image
"""
try:
image_paths.__getattribute__('__len__')
except AttributeError:
... | [
"def",
"extract",
"(",
"self",
",",
"image_paths",
",",
"layer_names",
",",
"flipped",
"=",
"False",
",",
"batch_size",
"=",
"64",
",",
"should_reshape_vectors",
"=",
"True",
",",
"verbose",
"=",
"2",
",",
"spatial_pool",
"=",
"None",
")",
":",
"try",
":... | https://github.com/CompVis/adaptive-style-transfer/blob/51b4c90dbd998d9efd1dc821ad7a8df69bef61da/evaluation/feature_extractor/feature_extractor.py#L132-L181 | |
nytimes/collectd-rabbitmq | 63822f67c6ebb992672541f3b2b3583c69d592ed | collectd_rabbitmq/collectd_plugin.py | python | configure | (config_values) | Converts a collectd configuration into rabbitmq configuration. | Converts a collectd configuration into rabbitmq configuration. | [
"Converts",
"a",
"collectd",
"configuration",
"into",
"rabbitmq",
"configuration",
"."
] | def configure(config_values):
"""
Converts a collectd configuration into rabbitmq configuration.
"""
collectd.debug('Configuring RabbitMQ Plugin')
data_to_ignore = dict()
scheme = 'http'
validate_certs = True
vhost_prefix = None
for config_value in config_values.children:
c... | [
"def",
"configure",
"(",
"config_values",
")",
":",
"collectd",
".",
"debug",
"(",
"'Configuring RabbitMQ Plugin'",
")",
"data_to_ignore",
"=",
"dict",
"(",
")",
"scheme",
"=",
"'http'",
"validate_certs",
"=",
"True",
"vhost_prefix",
"=",
"None",
"for",
"config_... | https://github.com/nytimes/collectd-rabbitmq/blob/63822f67c6ebb992672541f3b2b3583c69d592ed/collectd_rabbitmq/collectd_plugin.py#L32-L74 | ||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/plecost/xgoogle/googlesets.py | python | GoogleSets._maybe_raise | (self, cls, *arg) | [] | def _maybe_raise(self, cls, *arg):
if self.debug:
raise cls(*arg) | [
"def",
"_maybe_raise",
"(",
"self",
",",
"cls",
",",
"*",
"arg",
")",
":",
"if",
"self",
".",
"debug",
":",
"raise",
"cls",
"(",
"*",
"arg",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/plecost/xgoogle/googlesets.py#L61-L63 | ||||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/sat/solvers/cryptominisat.py | python | CryptoMiniSat.clauses | (self, filename=None) | r"""
Return original clauses.
INPUT:
- ``filename`` -- if not ``None`` clauses are written to ``filename`` in
DIMACS format (default: ``None``)
OUTPUT:
If ``filename`` is ``None`` then a list of ``lits, is_xor, rhs``
tuples is returned, where ``lits`... | r"""
Return original clauses. | [
"r",
"Return",
"original",
"clauses",
"."
] | def clauses(self, filename=None):
r"""
Return original clauses.
INPUT:
- ``filename`` -- if not ``None`` clauses are written to ``filename`` in
DIMACS format (default: ``None``)
OUTPUT:
If ``filename`` is ``None`` then a list of ``lits, is_xor, rhs``
... | [
"def",
"clauses",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"return",
"self",
".",
"_clauses",
"else",
":",
"from",
"sage",
".",
"sat",
".",
"solvers",
".",
"dimacs",
"import",
"DIMACS",
"DIMACS",
".",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/sat/solvers/cryptominisat.py#L213-L285 | ||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/databases/mysql_pool.py | python | Pool.get | (self, blocking=True) | return _ConnectionProxy(self, c) | Gets a connection.
Args:
blocking: Whether to block when max_size connections are already in use.
If false, may return None.
Returns:
A connection to the database.
Raises:
PoolAlreadyClosedError: if close() method was already called on
this pool. | Gets a connection. | [
"Gets",
"a",
"connection",
"."
] | def get(self, blocking=True):
"""Gets a connection.
Args:
blocking: Whether to block when max_size connections are already in use.
If false, may return None.
Returns:
A connection to the database.
Raises:
PoolAlreadyClosedError: if close() method was already called on
... | [
"def",
"get",
"(",
"self",
",",
"blocking",
"=",
"True",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"PoolAlreadyClosedError",
"(",
"\"Connection pool is already closed.\"",
")",
"# NOTE: Once we acquire capacity from the semaphore, it is essential that we",
"# ret... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/databases/mysql_pool.py#L49-L83 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/importlib/util.py | python | find_spec | (name, package=None) | Return the spec for the specified module.
First, sys.modules is checked to see if the module was already imported. If
so, then sys.modules[name].__spec__ is returned. If that happens to be
set to None, then ValueError is raised. If the module is not in
sys.modules, then sys.meta_path is searched for a ... | Return the spec for the specified module. | [
"Return",
"the",
"spec",
"for",
"the",
"specified",
"module",
"."
] | def find_spec(name, package=None):
"""Return the spec for the specified module.
First, sys.modules is checked to see if the module was already imported. If
so, then sys.modules[name].__spec__ is returned. If that happens to be
set to None, then ValueError is raised. If the module is not in
sys.modu... | [
"def",
"find_spec",
"(",
"name",
",",
"package",
"=",
"None",
")",
":",
"fullname",
"=",
"resolve_name",
"(",
"name",
",",
"package",
")",
"if",
"name",
".",
"startswith",
"(",
"'.'",
")",
"else",
"name",
"if",
"fullname",
"not",
"in",
"sys",
".",
"m... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/importlib/util.py#L73-L115 | ||
runawayhorse001/LearningApacheSpark | 67f3879dce17553195f094f5728b94a01badcf24 | pyspark/ml/linalg/__init__.py | python | Vectors.squared_distance | (v1, v2) | return v1.squared_distance(v2) | Squared distance between two vectors.
a and b can be of type SparseVector, DenseVector, np.ndarray
or array.array.
>>> a = Vectors.sparse(4, [(0, 1), (3, 4)])
>>> b = Vectors.dense([2, 5, 4, 1])
>>> a.squared_distance(b)
51.0 | Squared distance between two vectors.
a and b can be of type SparseVector, DenseVector, np.ndarray
or array.array. | [
"Squared",
"distance",
"between",
"two",
"vectors",
".",
"a",
"and",
"b",
"can",
"be",
"of",
"type",
"SparseVector",
"DenseVector",
"np",
".",
"ndarray",
"or",
"array",
".",
"array",
"."
] | def squared_distance(v1, v2):
"""
Squared distance between two vectors.
a and b can be of type SparseVector, DenseVector, np.ndarray
or array.array.
>>> a = Vectors.sparse(4, [(0, 1), (3, 4)])
>>> b = Vectors.dense([2, 5, 4, 1])
>>> a.squared_distance(b)
... | [
"def",
"squared_distance",
"(",
"v1",
",",
"v2",
")",
":",
"v1",
",",
"v2",
"=",
"_convert_to_vector",
"(",
"v1",
")",
",",
"_convert_to_vector",
"(",
"v2",
")",
"return",
"v1",
".",
"squared_distance",
"(",
"v2",
")"
] | https://github.com/runawayhorse001/LearningApacheSpark/blob/67f3879dce17553195f094f5728b94a01badcf24/pyspark/ml/linalg/__init__.py#L796-L808 | |
translate/translate | 72816df696b5263abfe80ab59129b299b85ae749 | translate/tools/poterminology.py | python | TerminologyOptionParser.recursiveprocess | (self, options) | recurse through directories and process files | recurse through directories and process files | [
"recurse",
"through",
"directories",
"and",
"process",
"files"
] | def recursiveprocess(self, options):
"""recurse through directories and process files"""
if self.isrecursive(options.input, "input") and getattr(
options, "allowrecursiveinput", True
):
if isinstance(options.input, list):
inputfiles = self.recurseinputfile... | [
"def",
"recursiveprocess",
"(",
"self",
",",
"options",
")",
":",
"if",
"self",
".",
"isrecursive",
"(",
"options",
".",
"input",
",",
"\"input\"",
")",
"and",
"getattr",
"(",
"options",
",",
"\"allowrecursiveinput\"",
",",
"True",
")",
":",
"if",
"isinsta... | https://github.com/translate/translate/blob/72816df696b5263abfe80ab59129b299b85ae749/translate/tools/poterminology.py#L466-L500 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/inject/thirdparty/bottle/bottle.py | python | BaseRequest.copy | (self) | return Request(self.environ.copy()) | Return a new :class:`Request` with a shallow :attr:`environ` copy. | Return a new :class:`Request` with a shallow :attr:`environ` copy. | [
"Return",
"a",
"new",
":",
"class",
":",
"Request",
"with",
"a",
"shallow",
":",
"attr",
":",
"environ",
"copy",
"."
] | def copy(self):
""" Return a new :class:`Request` with a shallow :attr:`environ` copy. """
return Request(self.environ.copy()) | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"Request",
"(",
"self",
".",
"environ",
".",
"copy",
"(",
")",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/thirdparty/bottle/bottle.py#L1203-L1205 | |
slashmili/python-jalali | 468e7c687fe83af51ed957958374f1acc5245299 | jdatetime/__init__.py | python | datetime.ctime | (self) | return self.strftime("%c") | Return ctime() style string. | Return ctime() style string. | [
"Return",
"ctime",
"()",
"style",
"string",
"."
] | def ctime(self):
"""Return ctime() style string."""
return self.strftime("%c") | [
"def",
"ctime",
"(",
"self",
")",
":",
"return",
"self",
".",
"strftime",
"(",
"\"%c\"",
")"
] | https://github.com/slashmili/python-jalali/blob/468e7c687fe83af51ed957958374f1acc5245299/jdatetime/__init__.py#L1229-L1231 | |
onaio/onadata | 89ad16744e8f247fb748219476f6ac295869a95f | onadata/libs/mixins/profiler_mixin.py | python | ProfilerMixin.get_serializer | (self, instance=None, data=empty, **kwargs) | return serializer_class(instance, data=data, **kwargs) | [] | def get_serializer(self, instance=None, data=empty, **kwargs):
serializer_class = self.get_serializer_class()
kwargs['context'] = self.get_serializer_context()
if settings.PROFILE_API_ACTION_FUNCTION:
global serializer_time
serializer_start = time.time()
ser... | [
"def",
"get_serializer",
"(",
"self",
",",
"instance",
"=",
"None",
",",
"data",
"=",
"empty",
",",
"*",
"*",
"kwargs",
")",
":",
"serializer_class",
"=",
"self",
".",
"get_serializer_class",
"(",
")",
"kwargs",
"[",
"'context'",
"]",
"=",
"self",
".",
... | https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/libs/mixins/profiler_mixin.py#L15-L27 | |||
Galvant/InstrumentKit | 6d216bd7f8e9ec7918762fe5fb7a306d5bd0eb1f | instruments/ondax/lm.py | python | LM.reset | (self) | Reset the laser controller. | Reset the laser controller. | [
"Reset",
"the",
"laser",
"controller",
"."
] | def reset(self):
"""
Reset the laser controller.
"""
self.sendcmd("reset") | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"sendcmd",
"(",
"\"reset\"",
")"
] | https://github.com/Galvant/InstrumentKit/blob/6d216bd7f8e9ec7918762fe5fb7a306d5bd0eb1f/instruments/ondax/lm.py#L540-L544 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/tkinter/tix.py | python | HList.__init__ | (self,master=None,cnf={}, **kw) | [] | def __init__ (self,master=None,cnf={}, **kw):
TixWidget.__init__(self, master, 'tixHList',
['columns', 'options'], cnf, kw) | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"TixWidget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"'tixHList'",
",",
"[",
"'columns'",
",",
"'options'",
"]",
",",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tkinter/tix.py#L876-L878 | ||||
git-big-picture/git-big-picture | 98a954f3eb225c275b1e1b4818fc0e4ddf9baaea | git_big_picture/_main.py | python | CommitGraph._generate_dot_file | (self,
sha_ones_on_labels,
with_commit_messages,
sha_one_digits=None,
history_direction=None) | return dot_file_lines | Generate graphviz input.
Parameters
----------
sha_ones_on_labels : boolean
if True show sha1 (or minimal) on labels in addition to ref names
with_commit_messages : boolean
if True the commit messages are displyed too
sha_one_digits : int
numb... | Generate graphviz input. | [
"Generate",
"graphviz",
"input",
"."
] | def _generate_dot_file(self,
sha_ones_on_labels,
with_commit_messages,
sha_one_digits=None,
history_direction=None):
""" Generate graphviz input.
Parameters
----------
sha_ones_on... | [
"def",
"_generate_dot_file",
"(",
"self",
",",
"sha_ones_on_labels",
",",
"with_commit_messages",
",",
"sha_one_digits",
"=",
"None",
",",
"history_direction",
"=",
"None",
")",
":",
"def",
"format_sha_one",
"(",
"sha_one",
")",
":",
"\"\"\" Shorten sha1 if required. ... | https://github.com/git-big-picture/git-big-picture/blob/98a954f3eb225c275b1e1b4818fc0e4ddf9baaea/git_big_picture/_main.py#L929-L1002 | |
duointeractive/django-fabtastic | f0fa1f9b2247ab7899d620e4f7f92f410e90295a | fabtastic/fabric/commands/c_common.py | python | pip_update_reqs | (roles=['webapp_servers', 'celery_servers']) | Updates your virtualenv from requirements.txt. | Updates your virtualenv from requirements.txt. | [
"Updates",
"your",
"virtualenv",
"from",
"requirements",
".",
"txt",
"."
] | def pip_update_reqs(roles=['webapp_servers', 'celery_servers']):
"""
Updates your virtualenv from requirements.txt.
"""
if _current_host_has_role(roles):
print("=== UPDATING REQUIREMENTS ===")
with cd(env.REMOTE_CODEBASE_PATH):
run("workon %s && ./manage.py ft_pip_update_reqs... | [
"def",
"pip_update_reqs",
"(",
"roles",
"=",
"[",
"'webapp_servers'",
",",
"'celery_servers'",
"]",
")",
":",
"if",
"_current_host_has_role",
"(",
"roles",
")",
":",
"print",
"(",
"\"=== UPDATING REQUIREMENTS ===\"",
")",
"with",
"cd",
"(",
"env",
".",
"REMOTE_C... | https://github.com/duointeractive/django-fabtastic/blob/f0fa1f9b2247ab7899d620e4f7f92f410e90295a/fabtastic/fabric/commands/c_common.py#L68-L75 | ||
CLUEbenchmark/CLUE | 5bd39732734afecb490cf18a5212e692dbf2c007 | baselines/models/classifier_utils.py | python | AFQMCProcessor.get_test_examples | (self, data_dir) | return self._create_examples(
self._read_json(os.path.join(data_dir, "test.json")), "test") | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_test_examples(self, data_dir):
"""See base class."""
return self._create_examples(
self._read_json(os.path.join(data_dir, "test.json")), "test") | [
"def",
"get_test_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"return",
"self",
".",
"_create_examples",
"(",
"self",
".",
"_read_json",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"test.json\"",
")",
")",
",",
"\"test\"",
")"
] | https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models/classifier_utils.py#L345-L348 | |
home-assistant/supervisor | 69c2517d5211b483fdfe968b0a2b36b672ee7ab2 | supervisor/jobs/decorator.py | python | Job._check_conditions | (self) | Check conditions. | Check conditions. | [
"Check",
"conditions",
"."
] | def _check_conditions(self):
"""Check conditions."""
used_conditions = set(self.conditions) - set(self.sys_jobs.ignore_conditions)
ignored_conditions = set(self.conditions) & set(self.sys_jobs.ignore_conditions)
# Check if somethings is ignored
if ignored_conditions:
... | [
"def",
"_check_conditions",
"(",
"self",
")",
":",
"used_conditions",
"=",
"set",
"(",
"self",
".",
"conditions",
")",
"-",
"set",
"(",
"self",
".",
"sys_jobs",
".",
"ignore_conditions",
")",
"ignored_conditions",
"=",
"set",
"(",
"self",
".",
"conditions",
... | https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/jobs/decorator.py#L120-L182 | ||
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | Literal.__init__ | ( self, matchString ) | [] | def __init__( self, matchString ):
super(Literal,self).__init__()
self.match = matchString
self.matchLen = len(matchString)
try:
self.firstMatchChar = matchString[0]
except IndexError:
warnings.warn("null string passed to Literal; use Empty() instead",
... | [
"def",
"__init__",
"(",
"self",
",",
"matchString",
")",
":",
"super",
"(",
"Literal",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"match",
"=",
"matchString",
"self",
".",
"matchLen",
"=",
"len",
"(",
"matchString",
")",
"try",
":",
"s... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L2412-L2425 | ||||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/colourchooser/canvas.py | python | BitmapBuffer.GetBitmap | (self) | return self.bitmap | Returns the internal bitmap for direct drawing. | Returns the internal bitmap for direct drawing. | [
"Returns",
"the",
"internal",
"bitmap",
"for",
"direct",
"drawing",
"."
] | def GetBitmap(self):
"""Returns the internal bitmap for direct drawing."""
return self.bitmap | [
"def",
"GetBitmap",
"(",
"self",
")",
":",
"return",
"self",
".",
"bitmap"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/colourchooser/canvas.py#L53-L55 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_aws_elastic_block_store_volume_source.py | python | V1AWSElasticBlockStoreVolumeSource.fs_type | (self, fs_type) | Sets the fs_type of this V1AWSElasticBlockStoreVolumeSource.
Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernet... | Sets the fs_type of this V1AWSElasticBlockStoreVolumeSource.
Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernet... | [
"Sets",
"the",
"fs_type",
"of",
"this",
"V1AWSElasticBlockStoreVolumeSource",
".",
"Filesystem",
"type",
"of",
"the",
"volume",
"that",
"you",
"want",
"to",
"mount",
".",
"Tip",
":",
"Ensure",
"that",
"the",
"filesystem",
"type",
"is",
"supported",
"by",
"the"... | def fs_type(self, fs_type):
"""
Sets the fs_type of this V1AWSElasticBlockStoreVolumeSource.
Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ex... | [
"def",
"fs_type",
"(",
"self",
",",
"fs_type",
")",
":",
"self",
".",
"_fs_type",
"=",
"fs_type"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_aws_elastic_block_store_volume_source.py#L64-L73 | ||
poodarchu/Det3D | 01258d8cb26656c5b950f8d41f9dcc1dd62a391e | det3d/visualization/vtk_visualizer/visualizercontrol.py | python | VTKVisualizerControl.AddHedgeHogActorWithScalars | (self, pc, scale) | return obj | Add shaded points with surface normals and scalars to the visualizer
The input is a NumPy array with dimension Nx7 with (x,y,z),
(nx,ny,nz) and scalar (the last dimension contains the scalars)
The normals will be scaled according to given scale factor | Add shaded points with surface normals and scalars to the visualizer
The input is a NumPy array with dimension Nx7 with (x,y,z),
(nx,ny,nz) and scalar (the last dimension contains the scalars)
The normals will be scaled according to given scale factor | [
"Add",
"shaded",
"points",
"with",
"surface",
"normals",
"and",
"scalars",
"to",
"the",
"visualizer",
"The",
"input",
"is",
"a",
"NumPy",
"array",
"with",
"dimension",
"Nx7",
"with",
"(",
"x",
"y",
"z",
")",
"(",
"nx",
"ny",
"nz",
")",
"and",
"scalar",... | def AddHedgeHogActorWithScalars(self, pc, scale):
"""Add shaded points with surface normals and scalars to the visualizer
The input is a NumPy array with dimension Nx7 with (x,y,z),
(nx,ny,nz) and scalar (the last dimension contains the scalars)
The normals will be scal... | [
"def",
"AddHedgeHogActorWithScalars",
"(",
"self",
",",
"pc",
",",
"scale",
")",
":",
"# Add the points",
"obj",
"=",
"self",
".",
"AddPointCloudActor",
"(",
"pc",
"[",
":",
",",
"[",
"0",
",",
"1",
",",
"2",
",",
"-",
"1",
"]",
"]",
")",
"actor",
... | https://github.com/poodarchu/Det3D/blob/01258d8cb26656c5b950f8d41f9dcc1dd62a391e/det3d/visualization/vtk_visualizer/visualizercontrol.py#L133-L147 | |
selimsef/dfdc_deepfake_challenge | 89c6290490bac96b29193a4061b3db9dd3933e36 | training/zoo/classifiers.py | python | GlobalWeightedAvgPool2d.forward | (self, x) | return x | [] | def forward(self, x):
input_x = x
x = self.fscore(x)
x = self.norm(x)
x = x * input_x
x = x.sum(dim=[2, 3], keepdim=not self.flatten)
return x | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"input_x",
"=",
"x",
"x",
"=",
"self",
".",
"fscore",
"(",
"x",
")",
"x",
"=",
"self",
".",
"norm",
"(",
"x",
")",
"x",
"=",
"x",
"*",
"input_x",
"x",
"=",
"x",
".",
"sum",
"(",
"dim",
"=... | https://github.com/selimsef/dfdc_deepfake_challenge/blob/89c6290490bac96b29193a4061b3db9dd3933e36/training/zoo/classifiers.py#L132-L138 | |||
s-leger/archipack | 5a6243bf1edf08a6b429661ce291dacb551e5f8a | pygeos/noding.py | python | SegmentNodeList.findCollapsesFromExistingVertices | (self, collapsedVertexIndexes: list) | * Adds nodes for any collapsed edge pairs
* which are pre-existing in the vertex list. | * Adds nodes for any collapsed edge pairs
* which are pre-existing in the vertex list. | [
"*",
"Adds",
"nodes",
"for",
"any",
"collapsed",
"edge",
"pairs",
"*",
"which",
"are",
"pre",
"-",
"existing",
"in",
"the",
"vertex",
"list",
"."
] | def findCollapsesFromExistingVertices(self, collapsedVertexIndexes: list) -> None:
"""
* Adds nodes for any collapsed edge pairs
* which are pre-existing in the vertex list.
"""
coords = self.edge.coords
# or we'll never exit the loop below
if len(coords) < 2:
... | [
"def",
"findCollapsesFromExistingVertices",
"(",
"self",
",",
"collapsedVertexIndexes",
":",
"list",
")",
"->",
"None",
":",
"coords",
"=",
"self",
".",
"edge",
".",
"coords",
"# or we'll never exit the loop below",
"if",
"len",
"(",
"coords",
")",
"<",
"2",
":"... | https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/noding.py#L434-L447 | ||
CiscoDevNet/webexteamssdk | 673312779b8e05cf0535bea8b96599015cccbff1 | webexteamssdk/utils.py | python | is_local_file | (string) | return os.path.isfile(string) | Check to see if string is a valid local file path. | Check to see if string is a valid local file path. | [
"Check",
"to",
"see",
"if",
"string",
"is",
"a",
"valid",
"local",
"file",
"path",
"."
] | def is_local_file(string):
"""Check to see if string is a valid local file path."""
assert isinstance(string, basestring)
return os.path.isfile(string) | [
"def",
"is_local_file",
"(",
"string",
")",
":",
"assert",
"isinstance",
"(",
"string",
",",
"basestring",
")",
"return",
"os",
".",
"path",
".",
"isfile",
"(",
"string",
")"
] | https://github.com/CiscoDevNet/webexteamssdk/blob/673312779b8e05cf0535bea8b96599015cccbff1/webexteamssdk/utils.py#L115-L118 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/adodbapi/adodbapi.py | python | TimeConverter.Time | (self,hour,minute,second) | This function constructs an object holding a time value. | This function constructs an object holding a time value. | [
"This",
"function",
"constructs",
"an",
"object",
"holding",
"a",
"time",
"value",
"."
] | def Time(self,hour,minute,second):
"This function constructs an object holding a time value. "
raise NotImplementedError | [
"def",
"Time",
"(",
"self",
",",
"hour",
",",
"minute",
",",
"second",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/adodbapi/adodbapi.py#L114-L116 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/enzyme/parsers/ebml/readers.py | python | read_element_unicode | (stream, size) | return _read(stream, size).decode('utf-8') | Read the Element Data of type :data:`UNICODE`
:param stream: file-like object from which to read
:param int size: size of element's data
:raise ReadError: when not all the required bytes could be read
:raise SizeError: if size is incorrect
:return: the read utf-8-decoded string
:rtype: unicode | Read the Element Data of type :data:`UNICODE` | [
"Read",
"the",
"Element",
"Data",
"of",
"type",
":",
"data",
":",
"UNICODE"
] | def read_element_unicode(stream, size):
"""Read the Element Data of type :data:`UNICODE`
:param stream: file-like object from which to read
:param int size: size of element's data
:raise ReadError: when not all the required bytes could be read
:raise SizeError: if size is incorrect
:return: the... | [
"def",
"read_element_unicode",
"(",
"stream",
",",
"size",
")",
":",
"return",
"_read",
"(",
"stream",
",",
"size",
")",
".",
"decode",
"(",
"'utf-8'",
")"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/enzyme/parsers/ebml/readers.py#L193-L204 | |
flairNLP/flair | b774774752c8338aab3d620f7e5062f66ec7a69d | flair/models/sequence_tagger_utils/viterbi.py | python | ViterbiLoss.forward | (self, features_tuple: tuple, targets: torch.tensor) | return viterbi_loss | Forward propagation of Viterbi Loss
:param features_tuple: CRF scores from forward method in shape (batch size, seq len, tagset size, tagset size),
lengths of sentences in batch, transitions from CRF
:param targets: true tags for sentences which will be converted to matrix indices.
... | Forward propagation of Viterbi Loss | [
"Forward",
"propagation",
"of",
"Viterbi",
"Loss"
] | def forward(self, features_tuple: tuple, targets: torch.tensor) -> torch.tensor:
"""
Forward propagation of Viterbi Loss
:param features_tuple: CRF scores from forward method in shape (batch size, seq len, tagset size, tagset size),
lengths of sentences in batch, transitions from CR... | [
"def",
"forward",
"(",
"self",
",",
"features_tuple",
":",
"tuple",
",",
"targets",
":",
"torch",
".",
"tensor",
")",
"->",
"torch",
".",
"tensor",
":",
"features",
",",
"lengths",
",",
"transitions",
"=",
"features_tuple",
"batch_size",
"=",
"features",
"... | https://github.com/flairNLP/flair/blob/b774774752c8338aab3d620f7e5062f66ec7a69d/flair/models/sequence_tagger_utils/viterbi.py#L29-L79 | |
jamescasbon/pypackage | f172fad9b8c2457f17e1a08cd2b9f171709f04a1 | virtualenv.py | python | ConfigOptionParser.update_defaults | (self, defaults) | return defaults | Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists). | Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists). | [
"Updates",
"the",
"given",
"defaults",
"with",
"values",
"from",
"the",
"config",
"files",
"and",
"the",
"environ",
".",
"Does",
"a",
"little",
"special",
"handling",
"for",
"certain",
"types",
"of",
"options",
"(",
"lists",
")",
"."
] | def update_defaults(self, defaults):
"""
Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists).
"""
# Then go and look for the other sources of configuration:
config = {}
... | [
"def",
"update_defaults",
"(",
"self",
",",
"defaults",
")",
":",
"# Then go and look for the other sources of configuration:",
"config",
"=",
"{",
"}",
"# 1. config files",
"config",
".",
"update",
"(",
"dict",
"(",
"self",
".",
"get_config_section",
"(",
"'virtualen... | https://github.com/jamescasbon/pypackage/blob/f172fad9b8c2457f17e1a08cd2b9f171709f04a1/virtualenv.py#L697-L733 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/lib-tk/turtle.py | python | TPen.pen | (self, pen=None, **pendict) | Return or set the pen's attributes.
Arguments:
pen -- a dictionary with some or all of the below listed keys.
**pendict -- one or more keyword-arguments with the below
listed keys as keywords.
Return or set the pen's attributes in a 'pen-dictionary'
... | Return or set the pen's attributes. | [
"Return",
"or",
"set",
"the",
"pen",
"s",
"attributes",
"."
] | def pen(self, pen=None, **pendict):
"""Return or set the pen's attributes.
Arguments:
pen -- a dictionary with some or all of the below listed keys.
**pendict -- one or more keyword-arguments with the below
listed keys as keywords.
Return or set... | [
"def",
"pen",
"(",
"self",
",",
"pen",
"=",
"None",
",",
"*",
"*",
"pendict",
")",
":",
"_pd",
"=",
"{",
"\"shown\"",
":",
"self",
".",
"_shown",
",",
"\"pendown\"",
":",
"self",
".",
"_drawing",
",",
"\"pencolor\"",
":",
"self",
".",
"_pencolor",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/lib-tk/turtle.py#L2251-L2364 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v2beta1_metric_spec.py | python | V2beta1MetricSpec.to_dict | (self) | return result | Returns the model properties as a dict | Returns the model properties as a dict | [
"Returns",
"the",
"model",
"properties",
"as",
"a",
"dict"
] | def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if has... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"attr",
",",
"_",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"openapi_types",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"attr",
")",
"if",
"isinstance",
"(",
... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v2beta1_metric_spec.py#L209-L231 | |
roddhjav/pass-import | 47f8b3a8654a7b9a775f7f7b50b93b24c5df85f4 | pass_import/formats/cli.py | python | CLI.parse | (self) | Parse the password manager repository and retrieve passwords. | Parse the password manager repository and retrieve passwords. | [
"Parse",
"the",
"password",
"manager",
"repository",
"and",
"retrieve",
"passwords",
"."
] | def parse(self):
"""Parse the password manager repository and retrieve passwords.""" | [
"def",
"parse",
"(",
"self",
")",
":"
] | https://github.com/roddhjav/pass-import/blob/47f8b3a8654a7b9a775f7f7b50b93b24c5df85f4/pass_import/formats/cli.py#L61-L62 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/opengarage/binary_sensor.py | python | OpenGarageBinarySensor.available | (self) | return super().available and self._available | Return True if entity is available. | Return True if entity is available. | [
"Return",
"True",
"if",
"entity",
"is",
"available",
"."
] | def available(self) -> bool:
"""Return True if entity is available."""
return super().available and self._available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"super",
"(",
")",
".",
"available",
"and",
"self",
".",
"_available"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/opengarage/binary_sensor.py#L53-L55 | |
ansible/ansible-modules-core | 00911a75ad6635834b6d28eef41f197b2f73c381 | packaging/os/redhat_subscription.py | python | Rhsm.enable | (self) | Enable the system to receive updates from subscription-manager.
This involves updating affected yum plugins and removing any
conflicting yum repositories. | Enable the system to receive updates from subscription-manager.
This involves updating affected yum plugins and removing any
conflicting yum repositories. | [
"Enable",
"the",
"system",
"to",
"receive",
"updates",
"from",
"subscription",
"-",
"manager",
".",
"This",
"involves",
"updating",
"affected",
"yum",
"plugins",
"and",
"removing",
"any",
"conflicting",
"yum",
"repositories",
"."
] | def enable(self):
'''
Enable the system to receive updates from subscription-manager.
This involves updating affected yum plugins and removing any
conflicting yum repositories.
'''
RegistrationBase.enable(self)
self.update_plugin_conf('rhnplugin', Fals... | [
"def",
"enable",
"(",
"self",
")",
":",
"RegistrationBase",
".",
"enable",
"(",
"self",
")",
"self",
".",
"update_plugin_conf",
"(",
"'rhnplugin'",
",",
"False",
")",
"self",
".",
"update_plugin_conf",
"(",
"'subscription-manager'",
",",
"True",
")"
] | https://github.com/ansible/ansible-modules-core/blob/00911a75ad6635834b6d28eef41f197b2f73c381/packaging/os/redhat_subscription.py#L236-L244 | ||
KanjiVG/kanjivg | e1d99250c5477796c1d08bc3e032566c5be3538a | xmlhandler.py | python | BasicHandler.startElement | (self, qName, atts) | return True | [] | def startElement(self, qName, atts):
self.elementsTree.append(str(qName))
attrName = "handle_start_" + str(qName)
if hasattr(self, attrName):
rfunc = getattr(self, attrName)
rfunc(atts)
self.characters = ""
return True | [
"def",
"startElement",
"(",
"self",
",",
"qName",
",",
"atts",
")",
":",
"self",
".",
"elementsTree",
".",
"append",
"(",
"str",
"(",
"qName",
")",
")",
"attrName",
"=",
"\"handle_start_\"",
"+",
"str",
"(",
"qName",
")",
"if",
"hasattr",
"(",
"self",
... | https://github.com/KanjiVG/kanjivg/blob/e1d99250c5477796c1d08bc3e032566c5be3538a/xmlhandler.py#L29-L36 | |||
svinota/pyroute2 | d320acd67067206b4217bb862afdae23bcb55266 | pyroute2.ipdb/pr2modules/ipdb/linkedset.py | python | LinkedSet.connect | (self, link) | Connect a LinkedSet instance to this one. Connected
sets will be updated together with this instance. | Connect a LinkedSet instance to this one. Connected
sets will be updated together with this instance. | [
"Connect",
"a",
"LinkedSet",
"instance",
"to",
"this",
"one",
".",
"Connected",
"sets",
"will",
"be",
"updated",
"together",
"with",
"this",
"instance",
"."
] | def connect(self, link):
'''
Connect a LinkedSet instance to this one. Connected
sets will be updated together with this instance.
'''
if not isinstance(link, LinkedSet):
raise TypeError()
self.links.append(link) | [
"def",
"connect",
"(",
"self",
",",
"link",
")",
":",
"if",
"not",
"isinstance",
"(",
"link",
",",
"LinkedSet",
")",
":",
"raise",
"TypeError",
"(",
")",
"self",
".",
"links",
".",
"append",
"(",
"link",
")"
] | https://github.com/svinota/pyroute2/blob/d320acd67067206b4217bb862afdae23bcb55266/pyroute2.ipdb/pr2modules/ipdb/linkedset.py#L143-L150 | ||
neptune-ai/open-solution-salt-identification | 394f16b23b6e30543aee54701f81a06b5dd92a98 | common_blocks/architectures/base.py | python | GlobalConvolutionalNetwork.__init__ | (self, in_channels, out_channels, kernel_size, use_relu=False) | [] | def __init__(self, in_channels, out_channels, kernel_size, use_relu=False):
super().__init__()
self.conv1 = nn.Sequential(Conv2dBnRelu(in_channels=in_channels,
out_channels=out_channels,
kernel_size=(kernel_... | [
"def",
"__init__",
"(",
"self",
",",
"in_channels",
",",
"out_channels",
",",
"kernel_size",
",",
"use_relu",
"=",
"False",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"conv1",
"=",
"nn",
".",
"Sequential",
"(",
"Conv2dBnRelu",
... | https://github.com/neptune-ai/open-solution-salt-identification/blob/394f16b23b6e30543aee54701f81a06b5dd92a98/common_blocks/architectures/base.py#L153-L173 | ||||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/base.py | python | DropboxBase.users_features_get_values | (self,
features) | return r | Get a list of feature values that may be configured for the current
account.
:param List[:class:`dropbox.users.UserFeature`] features: A list of
features in :class:`dropbox.users.UserFeature`. If the list is
empty, this route will return
:class:`dropbox.users.UserFea... | Get a list of feature values that may be configured for the current
account. | [
"Get",
"a",
"list",
"of",
"feature",
"values",
"that",
"may",
"be",
"configured",
"for",
"the",
"current",
"account",
"."
] | def users_features_get_values(self,
features):
"""
Get a list of feature values that may be configured for the current
account.
:param List[:class:`dropbox.users.UserFeature`] features: A list of
features in :class:`dropbox.users.UserFeature... | [
"def",
"users_features_get_values",
"(",
"self",
",",
"features",
")",
":",
"arg",
"=",
"users",
".",
"UserFeaturesGetValuesBatchArg",
"(",
"features",
")",
"r",
"=",
"self",
".",
"request",
"(",
"users",
".",
"features_get_values",
",",
"'users'",
",",
"arg",... | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/base.py#L5217-L5240 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/converters/fast/fgrid_reader.py | python | read_fgrid | (fgrid_filename, unused_dimension_flag, log=None, debug=False) | return model | loads a *.fgrid file | loads a *.fgrid file | [
"loads",
"a",
"*",
".",
"fgrid",
"file"
] | def read_fgrid(fgrid_filename, unused_dimension_flag, log=None, debug=False):
"""loads a *.fgrid file"""
model = FGridReader(log=log, debug=debug)
model.read_fgrid(fgrid_filename, unused_dimension_flag=3)
return model | [
"def",
"read_fgrid",
"(",
"fgrid_filename",
",",
"unused_dimension_flag",
",",
"log",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"model",
"=",
"FGridReader",
"(",
"log",
"=",
"log",
",",
"debug",
"=",
"debug",
")",
"model",
".",
"read_fgrid",
"("... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/converters/fast/fgrid_reader.py#L6-L10 | |
CLUEbenchmark/CLUE | 5bd39732734afecb490cf18a5212e692dbf2c007 | baselines/models_pytorch/classifier_pytorch/transformers/modeling_bert.py | python | BertAttention.__init__ | (self, config) | [] | def __init__(self, config):
super(BertAttention, self).__init__()
self.self = BertSelfAttention(config)
self.output = BertSelfOutput(config)
self.pruned_heads = set() | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"super",
"(",
"BertAttention",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"self",
"=",
"BertSelfAttention",
"(",
"config",
")",
"self",
".",
"output",
"=",
"BertSelfOutput",
"(",
"... | https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models_pytorch/classifier_pytorch/transformers/modeling_bert.py#L253-L257 | ||||
qibinlou/SinaWeibo-Emotion-Classification | f336fc104abd68b0ec4180fe2ed80fafe49cb790 | nltk/sem/logic.py | python | NegatedExpression._set_type | (self, other_type=ANY_TYPE, signature=None) | :see Expression._set_type() | :see Expression._set_type() | [
":",
"see",
"Expression",
".",
"_set_type",
"()"
] | def _set_type(self, other_type=ANY_TYPE, signature=None):
""":see Expression._set_type()"""
assert isinstance(other_type, Type)
if signature is None:
signature = defaultdict(list)
if not other_type.matches(TRUTH_TYPE):
raise IllegalTypeException(self, other_type... | [
"def",
"_set_type",
"(",
"self",
",",
"other_type",
"=",
"ANY_TYPE",
",",
"signature",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"other_type",
",",
"Type",
")",
"if",
"signature",
"is",
"None",
":",
"signature",
"=",
"defaultdict",
"(",
"list",
... | https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/nltk/sem/logic.py#L1097-L1106 | ||
skylines-project/skylines | ce68ee280af05498b3859fc2c199b08043ad58a9 | skylines/database.py | python | query | (cls, **kw) | return q | [] | def query(cls, **kw):
q = db.session.query(cls)
if kw:
q = q.filter_by(**kw)
return q | [
"def",
"query",
"(",
"cls",
",",
"*",
"*",
"kw",
")",
":",
"q",
"=",
"db",
".",
"session",
".",
"query",
"(",
"cls",
")",
"if",
"kw",
":",
"q",
"=",
"q",
".",
"filter_by",
"(",
"*",
"*",
"kw",
")",
"return",
"q"
] | https://github.com/skylines-project/skylines/blob/ce68ee280af05498b3859fc2c199b08043ad58a9/skylines/database.py#L4-L10 | |||
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/hotshot/__init__.py | python | Profile.runcall | (self, func, *args, **kw) | return self._prof.runcall(func, args, kw) | Profile a single call of a callable.
Additional positional and keyword arguments may be passed
along; the result of the call is returned, and exceptions are
allowed to propagate cleanly, while ensuring that profiling is
disabled on the way out. | Profile a single call of a callable. | [
"Profile",
"a",
"single",
"call",
"of",
"a",
"callable",
"."
] | def runcall(self, func, *args, **kw):
"""Profile a single call of a callable.
Additional positional and keyword arguments may be passed
along; the result of the call is returned, and exceptions are
allowed to propagate cleanly, while ensuring that profiling is
disabled on the wa... | [
"def",
"runcall",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_prof",
".",
"runcall",
"(",
"func",
",",
"args",
",",
"kw",
")"
] | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/hotshot/__init__.py#L70-L78 | |
svenkreiss/pysparkling | f0e8e8d039f3313c2693b7c7576cb1b7ba5a6d78 | pysparkling/_version.py | python | versions_from_parentdir | (parentdir_prefix, root, verbose) | Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an appropriately named parent directory | Try to determine the version from the parent directory name. | [
"Try",
"to",
"determine",
"the",
"version",
"from",
"the",
"parent",
"directory",
"name",
"."
] | def versions_from_parentdir(parentdir_prefix, root, verbose):
"""Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an ap... | [
"def",
"versions_from_parentdir",
"(",
"parentdir_prefix",
",",
"root",
",",
"verbose",
")",
":",
"rootdirs",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"root",
")",
"if",
"d... | https://github.com/svenkreiss/pysparkling/blob/f0e8e8d039f3313c2693b7c7576cb1b7ba5a6d78/pysparkling/_version.py#L107-L129 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/floatcanvas/FCObjects.py | python | Line.__init__ | (self, Points,
LineColor = "Black",
LineStyle = "Solid",
LineWidth = 1,
InForeground = False) | Default class constructor.
:param `Points`: takes a 2-tuple, or a (2,)
`NumPy <http://www.numpy.org/>`_ array of point coordinates
:param `LineColor`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor`
:param `LineStyle`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.Set... | Default class constructor. | [
"Default",
"class",
"constructor",
"."
] | def __init__(self, Points,
LineColor = "Black",
LineStyle = "Solid",
LineWidth = 1,
InForeground = False):
"""
Default class constructor.
:param `Points`: takes a 2-tuple, or a (2,)
`NumPy <http://www.numpy.org/>`_ ... | [
"def",
"__init__",
"(",
"self",
",",
"Points",
",",
"LineColor",
"=",
"\"Black\"",
",",
"LineStyle",
"=",
"\"Solid\"",
",",
"LineWidth",
"=",
"1",
",",
"InForeground",
"=",
"False",
")",
":",
"DrawObject",
".",
"__init__",
"(",
"self",
",",
"InForeground",... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/floatcanvas/FCObjects.py#L712-L740 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | hdfs_namenode/datadog_checks/hdfs_namenode/config_models/defaults.py | python | instance_kerberos_auth | (field, value) | return 'disabled' | [] | def instance_kerberos_auth(field, value):
return 'disabled' | [
"def",
"instance_kerberos_auth",
"(",
"field",
",",
"value",
")",
":",
"return",
"'disabled'"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/hdfs_namenode/datadog_checks/hdfs_namenode/config_models/defaults.py#L73-L74 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/crypto/util.py | python | carmichael_lambda | (n) | return lcm(t) | r"""
Return the Carmichael function of a positive integer ``n``.
The Carmichael function of `n`, denoted `\lambda(n)`, is the smallest
positive integer `k` such that `a^k \equiv 1 \pmod{n}` for all
`a \in \ZZ/n\ZZ` satisfying `\gcd(a, n) = 1`. Thus, `\lambda(n) = k`
is the exponent of the multiplic... | r"""
Return the Carmichael function of a positive integer ``n``. | [
"r",
"Return",
"the",
"Carmichael",
"function",
"of",
"a",
"positive",
"integer",
"n",
"."
] | def carmichael_lambda(n):
r"""
Return the Carmichael function of a positive integer ``n``.
The Carmichael function of `n`, denoted `\lambda(n)`, is the smallest
positive integer `k` such that `a^k \equiv 1 \pmod{n}` for all
`a \in \ZZ/n\ZZ` satisfying `\gcd(a, n) = 1`. Thus, `\lambda(n) = k`
is... | [
"def",
"carmichael_lambda",
"(",
"n",
")",
":",
"n",
"=",
"Integer",
"(",
"n",
")",
"# sanity check",
"if",
"n",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"\"Input n must be a positive integer.\"",
")",
"L",
"=",
"n",
".",
"factor",
"(",
")",
"t",
"=",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/crypto/util.py#L258-L408 | |
abarker/pdfCropMargins | d9378cd6cba55ff137d80ff2d1f098bf6938f759 | src/pdfCropMargins/external_program_calls.py | python | init_and_test_pdftoppm_executable | (prefer_local=False, exit_on_fail=False) | return pdftoppm_executable | Find a pdftoppm executable and test it. If a good one is found, set
this module's global pdftoppm_executable variable to that path and return
that string. Otherwise return None. Any path string set from the
command line gets priority, and is not tested. | Find a pdftoppm executable and test it. If a good one is found, set
this module's global pdftoppm_executable variable to that path and return
that string. Otherwise return None. Any path string set from the
command line gets priority, and is not tested. | [
"Find",
"a",
"pdftoppm",
"executable",
"and",
"test",
"it",
".",
"If",
"a",
"good",
"one",
"is",
"found",
"set",
"this",
"module",
"s",
"global",
"pdftoppm_executable",
"variable",
"to",
"that",
"path",
"and",
"return",
"that",
"string",
".",
"Otherwise",
... | def init_and_test_pdftoppm_executable(prefer_local=False, exit_on_fail=False):
"""Find a pdftoppm executable and test it. If a good one is found, set
this module's global pdftoppm_executable variable to that path and return
that string. Otherwise return None. Any path string set from the
command line... | [
"def",
"init_and_test_pdftoppm_executable",
"(",
"prefer_local",
"=",
"False",
",",
"exit_on_fail",
"=",
"False",
")",
":",
"ignore_called_process_errors",
"=",
"False",
"global",
"pdftoppm_executable",
"if",
"pdftoppm_executable",
":",
"return",
"pdftoppm_executable",
"#... | https://github.com/abarker/pdfCropMargins/blob/d9378cd6cba55ff137d80ff2d1f098bf6938f759/src/pdfCropMargins/external_program_calls.py#L410-L482 | |
santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning | 97ff2ae3ba9f2d478e174444c4e0f5349f28c319 | texar_repo/texar/data/data/paired_text_data.py | python | PairedTextData.target_utterance_cnt_name | (self) | return name | The name of the target text utterance count tensor,
"target_utterance_cnt" by default. | The name of the target text utterance count tensor,
"target_utterance_cnt" by default. | [
"The",
"name",
"of",
"the",
"target",
"text",
"utterance",
"count",
"tensor",
"target_utterance_cnt",
"by",
"default",
"."
] | def target_utterance_cnt_name(self):
"""The name of the target text utterance count tensor,
"target_utterance_cnt" by default.
"""
if not self._hparams.target_dataset.variable_utterance:
raise ValueError(
"`utterance_cnt_name` of target data is undefined.")
... | [
"def",
"target_utterance_cnt_name",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_hparams",
".",
"target_dataset",
".",
"variable_utterance",
":",
"raise",
"ValueError",
"(",
"\"`utterance_cnt_name` of target data is undefined.\"",
")",
"name",
"=",
"dsutils",
".... | https://github.com/santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning/blob/97ff2ae3ba9f2d478e174444c4e0f5349f28c319/texar_repo/texar/data/data/paired_text_data.py#L610-L620 | |
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/pygimplib/_lib/future/future/backports/datetime.py | python | datetime.__str__ | (self) | return self.isoformat(sep=' ') | Convert to string, for str(). | Convert to string, for str(). | [
"Convert",
"to",
"string",
"for",
"str",
"()",
"."
] | def __str__(self):
"Convert to string, for str()."
return self.isoformat(sep=' ') | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"isoformat",
"(",
"sep",
"=",
"' '",
")"
] | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/future/future/backports/datetime.py#L1595-L1597 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/functools.py | python | wraps | (wrapped,
assigned = WRAPPER_ASSIGNMENTS,
updated = WRAPPER_UPDATES) | return partial(update_wrapper, wrapped=wrapped,
assigned=assigned, updated=updated) | Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenien... | Decorator factory to apply update_wrapper() to a wrapper function | [
"Decorator",
"factory",
"to",
"apply",
"update_wrapper",
"()",
"to",
"a",
"wrapper",
"function"
] | def wraps(wrapped,
assigned = WRAPPER_ASSIGNMENTS,
updated = WRAPPER_UPDATES):
"""Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as... | [
"def",
"wraps",
"(",
"wrapped",
",",
"assigned",
"=",
"WRAPPER_ASSIGNMENTS",
",",
"updated",
"=",
"WRAPPER_UPDATES",
")",
":",
"return",
"partial",
"(",
"update_wrapper",
",",
"wrapped",
"=",
"wrapped",
",",
"assigned",
"=",
"assigned",
",",
"updated",
"=",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/functools.py#L67-L79 | |
rwightman/pytorch-image-models | ccfeb06936549f19c453b7f1f27e8e632cfbe1c2 | timm/models/nfnet.py | python | nf_resnet50 | (pretrained=False, **kwargs) | return _create_normfreenet('nf_resnet50', pretrained=pretrained, **kwargs) | Normalization-Free ResNet-50
`Characterizing signal propagation to close the performance gap in unnormalized ResNets`
- https://arxiv.org/abs/2101.08692 | Normalization-Free ResNet-50
`Characterizing signal propagation to close the performance gap in unnormalized ResNets`
- https://arxiv.org/abs/2101.08692 | [
"Normalization",
"-",
"Free",
"ResNet",
"-",
"50",
"Characterizing",
"signal",
"propagation",
"to",
"close",
"the",
"performance",
"gap",
"in",
"unnormalized",
"ResNets",
"-",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"2101",
".",
"08692"
] | def nf_resnet50(pretrained=False, **kwargs):
""" Normalization-Free ResNet-50
`Characterizing signal propagation to close the performance gap in unnormalized ResNets`
- https://arxiv.org/abs/2101.08692
"""
return _create_normfreenet('nf_resnet50', pretrained=pretrained, **kwargs) | [
"def",
"nf_resnet50",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_create_normfreenet",
"(",
"'nf_resnet50'",
",",
"pretrained",
"=",
"pretrained",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/rwightman/pytorch-image-models/blob/ccfeb06936549f19c453b7f1f27e8e632cfbe1c2/timm/models/nfnet.py#L912-L917 | |
kamalgill/flask-appengine-template | 11760f83faccbb0d0afe416fc58e67ecfb4643c2 | src/lib/werkzeug/http.py | python | parse_authorization_header | (value) | Parse an HTTP basic/digest authorization header transmitted by the web
browser. The return value is either `None` if the header was invalid or
not given, otherwise an :class:`~werkzeug.datastructures.Authorization`
object.
:param value: the authorization header to parse.
:return: a :class:`~werkze... | Parse an HTTP basic/digest authorization header transmitted by the web
browser. The return value is either `None` if the header was invalid or
not given, otherwise an :class:`~werkzeug.datastructures.Authorization`
object. | [
"Parse",
"an",
"HTTP",
"basic",
"/",
"digest",
"authorization",
"header",
"transmitted",
"by",
"the",
"web",
"browser",
".",
"The",
"return",
"value",
"is",
"either",
"None",
"if",
"the",
"header",
"was",
"invalid",
"or",
"not",
"given",
"otherwise",
"an",
... | def parse_authorization_header(value):
"""Parse an HTTP basic/digest authorization header transmitted by the web
browser. The return value is either `None` if the header was invalid or
not given, otherwise an :class:`~werkzeug.datastructures.Authorization`
object.
:param value: the authorization h... | [
"def",
"parse_authorization_header",
"(",
"value",
")",
":",
"if",
"not",
"value",
":",
"return",
"value",
"=",
"wsgi_to_bytes",
"(",
"value",
")",
"try",
":",
"auth_type",
",",
"auth_info",
"=",
"value",
".",
"split",
"(",
"None",
",",
"1",
")",
"auth_t... | https://github.com/kamalgill/flask-appengine-template/blob/11760f83faccbb0d0afe416fc58e67ecfb4643c2/src/lib/werkzeug/http.py#L466-L498 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/logging/__init__.py | python | addLevelName | (level, levelName) | Associate 'levelName' with 'level'.
This is used when converting levels to text during message formatting. | Associate 'levelName' with 'level'. | [
"Associate",
"levelName",
"with",
"level",
"."
] | def addLevelName(level, levelName):
"""
Associate 'levelName' with 'level'.
This is used when converting levels to text during message formatting.
"""
_acquireLock()
try: #unlikely to cause an exception, but you never know...
_levelNames[level] = levelName
_levelNames[levelNa... | [
"def",
"addLevelName",
"(",
"level",
",",
"levelName",
")",
":",
"_acquireLock",
"(",
")",
"try",
":",
"#unlikely to cause an exception, but you never know...",
"_levelNames",
"[",
"level",
"]",
"=",
"levelName",
"_levelNames",
"[",
"levelName",
"]",
"=",
"level",
... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/logging/__init__.py#L164-L175 | ||
openmc-dev/openmc | 0cf7d9283786677e324bfbdd0984a54d1c86dacc | openmc/mgxs/library.py | python | Library.get_mgxs | (self, domain, mgxs_type) | return self.all_mgxs[domain_id][mgxs_type] | Return the MGXS object for some domain and reaction rate type.
This routine searches the library for an MGXS object for the spatial
domain and reaction rate type requested by the user.
NOTE: This routine must be called after the build_library() routine.
Parameters
----------
... | Return the MGXS object for some domain and reaction rate type. | [
"Return",
"the",
"MGXS",
"object",
"for",
"some",
"domain",
"and",
"reaction",
"rate",
"type",
"."
] | def get_mgxs(self, domain, mgxs_type):
"""Return the MGXS object for some domain and reaction rate type.
This routine searches the library for an MGXS object for the spatial
domain and reaction rate type requested by the user.
NOTE: This routine must be called after the build_library()... | [
"def",
"get_mgxs",
"(",
"self",
",",
"domain",
",",
"mgxs_type",
")",
":",
"if",
"self",
".",
"domain_type",
"==",
"'material'",
":",
"cv",
".",
"check_type",
"(",
"'domain'",
",",
"domain",
",",
"(",
"openmc",
".",
"Material",
",",
"Integral",
")",
")... | https://github.com/openmc-dev/openmc/blob/0cf7d9283786677e324bfbdd0984a54d1c86dacc/openmc/mgxs/library.py#L605-L662 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.