nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/distutils/sysconfig.py | python | get_python_inc | (plat_specific=0, prefix=None) | Return the directory containing installed Python header files.
If 'plat_specific' is false (the default), this is the path to the
non-platform-specific header files, i.e. Python.h and so on;
otherwise, this is the path to platform-specific header files
(namely pyconfig.h).
If 'prefix' is supplied,... | Return the directory containing installed Python header files. | [
"Return",
"the",
"directory",
"containing",
"installed",
"Python",
"header",
"files",
"."
] | def get_python_inc(plat_specific=0, prefix=None):
"""Return the directory containing installed Python header files.
If 'plat_specific' is false (the default), this is the path to the
non-platform-specific header files, i.e. Python.h and so on;
otherwise, this is the path to platform-specific header fil... | [
"def",
"get_python_inc",
"(",
"plat_specific",
"=",
"0",
",",
"prefix",
"=",
"None",
")",
":",
"if",
"prefix",
"is",
"None",
":",
"prefix",
"=",
"plat_specific",
"and",
"BASE_EXEC_PREFIX",
"or",
"BASE_PREFIX",
"if",
"os",
".",
"name",
"==",
"\"posix\"",
":... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/distutils/sysconfig.py#L87-L124 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-utils/blocktool/core/comments.py | python | validate_message_port | (self, message_ports, suppress_input, suppress_output) | function to solve conflicts if any in the
*message_port* comments and the implementation information | function to solve conflicts if any in the
*message_port* comments and the implementation information | [
"function",
"to",
"solve",
"conflicts",
"if",
"any",
"in",
"the",
"*",
"message_port",
"*",
"comments",
"and",
"the",
"implementation",
"information"
] | def validate_message_port(self, message_ports, suppress_input, suppress_output):
"""
function to solve conflicts if any in the
*message_port* comments and the implementation information
"""
if message_ports['input'] != self.parsed_data['message_port']['input']:
if not suppress_input:
... | [
"def",
"validate_message_port",
"(",
"self",
",",
"message_ports",
",",
"suppress_input",
",",
"suppress_output",
")",
":",
"if",
"message_ports",
"[",
"'input'",
"]",
"!=",
"self",
".",
"parsed_data",
"[",
"'message_port'",
"]",
"[",
"'input'",
"]",
":",
"if"... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-utils/blocktool/core/comments.py#L41-L55 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/httplib.py | python | HTTPResponse._safe_read | (self, amt) | return ''.join(s) | Read the number of bytes requested, compensating for partial reads.
Normally, we have a blocking socket, but a read() can be interrupted
by a signal (resulting in a partial read).
Note that we cannot distinguish between EOF and an interrupt when zero
bytes have been read. IncompleteRea... | Read the number of bytes requested, compensating for partial reads. | [
"Read",
"the",
"number",
"of",
"bytes",
"requested",
"compensating",
"for",
"partial",
"reads",
"."
] | def _safe_read(self, amt):
"""Read the number of bytes requested, compensating for partial reads.
Normally, we have a blocking socket, but a read() can be interrupted
by a signal (resulting in a partial read).
Note that we cannot distinguish between EOF and an interrupt when zero
... | [
"def",
"_safe_read",
"(",
"self",
",",
"amt",
")",
":",
"# NOTE(gps): As of svn r74426 socket._fileobject.read(x) will never",
"# return less than x bytes unless EOF is encountered. It now handles",
"# signal interruptions (socket.error EINTR) internally. This code",
"# never caught that exc... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/httplib.py#L637-L663 | |
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | third_party/cpplint.py | python | CleanseRawStrings | (raw_lines) | return lines_without_raw_strings | Removes C++11 raw strings from lines.
Before:
static const char kData[] = R"(
multi-line string
)";
After:
static const char kData[] = ""
(replaced by blank line)
"";
Args:
raw_lines: list of raw lines.
Returns:
list of lines with C++11 raw str... | Removes C++11 raw strings from lines. | [
"Removes",
"C",
"++",
"11",
"raw",
"strings",
"from",
"lines",
"."
] | def CleanseRawStrings(raw_lines):
"""Removes C++11 raw strings from lines.
Before:
static const char kData[] = R"(
multi-line string
)";
After:
static const char kData[] = ""
(replaced by blank line)
"";
Args:
raw_lines: list of raw lines.
Return... | [
"def",
"CleanseRawStrings",
"(",
"raw_lines",
")",
":",
"delimiter",
"=",
"None",
"lines_without_raw_strings",
"=",
"[",
"]",
"for",
"line",
"in",
"raw_lines",
":",
"if",
"delimiter",
":",
"# Inside a raw string, look for the end",
"end",
"=",
"line",
".",
"find",... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/third_party/cpplint.py#L1286-L1359 | |
facebook/openr | ed38bdfd6bf290084bfab4821b59f83e7b59315d | build/fbcode_builder/getdeps/builder.py | python | BuilderBase.run_tests | (
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
) | Execute any tests that we know how to run. If they fail,
raise an exception. | Execute any tests that we know how to run. If they fail,
raise an exception. | [
"Execute",
"any",
"tests",
"that",
"we",
"know",
"how",
"to",
"run",
".",
"If",
"they",
"fail",
"raise",
"an",
"exception",
"."
] | def run_tests(
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
):
"""Execute any tests that we know how to run. If they fail,
raise an exception."""
pass | [
"def",
"run_tests",
"(",
"self",
",",
"install_dirs",
",",
"schedule_type",
",",
"owner",
",",
"test_filter",
",",
"retry",
",",
"no_testpilot",
")",
":",
"pass"
] | https://github.com/facebook/openr/blob/ed38bdfd6bf290084bfab4821b59f83e7b59315d/build/fbcode_builder/getdeps/builder.py#L122-L127 | ||
Jack-Cherish/LeetCode | de27c8eefd1f484ada0bc2fd506b09a9d17ff8a7 | String/Easy/14.Longest Common Prefix/Longest Common Prefix.py | python | Solution.longestCommonPrefix | (self, strs) | return min(strs) | :type strs: List[str]
:rtype: str | :type strs: List[str]
:rtype: str | [
":",
"type",
"strs",
":",
"List",
"[",
"str",
"]",
":",
"rtype",
":",
"str"
] | def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if not strs:
return ""
for i, letter_group in enumerate(zip(*strs)):
if len(set(letter_group)) > 1:
return strs[0][:i]
return min(st... | [
"def",
"longestCommonPrefix",
"(",
"self",
",",
"strs",
")",
":",
"if",
"not",
"strs",
":",
"return",
"\"\"",
"for",
"i",
",",
"letter_group",
"in",
"enumerate",
"(",
"zip",
"(",
"*",
"strs",
")",
")",
":",
"if",
"len",
"(",
"set",
"(",
"letter_group... | https://github.com/Jack-Cherish/LeetCode/blob/de27c8eefd1f484ada0bc2fd506b09a9d17ff8a7/String/Easy/14.Longest Common Prefix/Longest Common Prefix.py#L3-L14 | |
cornell-zhang/heterocl | 6d9e4b4acc2ee2707b2d25b27298c0335bccedfd | hlib/python/hlib/frontend/relay_parser.py | python | gen_params | (type_dict, env) | return params | Finds the parameters that we need to extract from the model
Parameters
---------
type_dict: dict
the dictionary that contains the type of each variable in the environment
env: dict
the dictionary that contains the computational environment that sets up the
contained function {k... | Finds the parameters that we need to extract from the model | [
"Finds",
"the",
"parameters",
"that",
"we",
"need",
"to",
"extract",
"from",
"the",
"model"
] | def gen_params(type_dict, env):
"""Finds the parameters that we need to extract from the model
Parameters
---------
type_dict: dict
the dictionary that contains the type of each variable in the environment
env: dict
the dictionary that contains the computational environment that se... | [
"def",
"gen_params",
"(",
"type_dict",
",",
"env",
")",
":",
"params",
"=",
"[",
"]",
"for",
"var",
"in",
"type_dict",
":",
"if",
"type_dict",
"[",
"var",
"]",
"==",
"Var",
":",
"params",
".",
"append",
"(",
"env",
"[",
"var",
"]",
")",
"elif",
"... | https://github.com/cornell-zhang/heterocl/blob/6d9e4b4acc2ee2707b2d25b27298c0335bccedfd/hlib/python/hlib/frontend/relay_parser.py#L41-L66 | |
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Modules/Scripted/DICOM/DICOM.py | python | DICOM.onURLReceived | (self, urlString) | Process DICOM view requests. Example:
slicer://viewer/?studyUID=2.16.840.1.113669.632.20.121711.10000158860
&access_token=k0zR6WAPpNbVguQ8gGUHp6
&dicomweb_endpoint=http%3A%2F%2Fdemo.kheops.online%2Fapi
&dicomweb_uri_endpoint=%20http%3A%2F%2Fdemo.kheops.online%2Fapi%2Fwado | Process DICOM view requests. Example:
slicer://viewer/?studyUID=2.16.840.1.113669.632.20.121711.10000158860
&access_token=k0zR6WAPpNbVguQ8gGUHp6
&dicomweb_endpoint=http%3A%2F%2Fdemo.kheops.online%2Fapi
&dicomweb_uri_endpoint=%20http%3A%2F%2Fdemo.kheops.online%2Fapi%2Fwado | [
"Process",
"DICOM",
"view",
"requests",
".",
"Example",
":",
"slicer",
":",
"//",
"viewer",
"/",
"?studyUID",
"=",
"2",
".",
"16",
".",
"840",
".",
"1",
".",
"113669",
".",
"632",
".",
"20",
".",
"121711",
".",
"10000158860",
"&access_token",
"=",
"k... | def onURLReceived(self, urlString):
"""Process DICOM view requests. Example:
slicer://viewer/?studyUID=2.16.840.1.113669.632.20.121711.10000158860
&access_token=k0zR6WAPpNbVguQ8gGUHp6
&dicomweb_endpoint=http%3A%2F%2Fdemo.kheops.online%2Fapi
&dicomweb_uri_endpoint=%20http%3A%2F%2Fdemo.kheops.on... | [
"def",
"onURLReceived",
"(",
"self",
",",
"urlString",
")",
":",
"url",
"=",
"qt",
".",
"QUrl",
"(",
"urlString",
")",
"if",
"(",
"url",
".",
"authority",
"(",
")",
".",
"lower",
"(",
")",
"!=",
"\"viewer\"",
")",
":",
"logging",
".",
"debug",
"(",... | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Modules/Scripted/DICOM/DICOM.py#L111-L150 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | DateTime.GetLastMonthDay | (*args, **kwargs) | return _misc_.DateTime_GetLastMonthDay(*args, **kwargs) | GetLastMonthDay(self, int month=Inv_Month, int year=Inv_Year) -> DateTime | GetLastMonthDay(self, int month=Inv_Month, int year=Inv_Year) -> DateTime | [
"GetLastMonthDay",
"(",
"self",
"int",
"month",
"=",
"Inv_Month",
"int",
"year",
"=",
"Inv_Year",
")",
"-",
">",
"DateTime"
] | def GetLastMonthDay(*args, **kwargs):
"""GetLastMonthDay(self, int month=Inv_Month, int year=Inv_Year) -> DateTime"""
return _misc_.DateTime_GetLastMonthDay(*args, **kwargs) | [
"def",
"GetLastMonthDay",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_GetLastMonthDay",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L3890-L3892 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/shutil.py | python | copystat | (src, dst) | Copy all stat info (mode bits, atime, mtime, flags) from src to dst | Copy all stat info (mode bits, atime, mtime, flags) from src to dst | [
"Copy",
"all",
"stat",
"info",
"(",
"mode",
"bits",
"atime",
"mtime",
"flags",
")",
"from",
"src",
"to",
"dst"
] | def copystat(src, dst):
"""Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
if hasattr(os, 'utime'):
os.utime(dst, (st.st_atime, st.st_mtime))
if hasattr(os, 'chmod'):
os.chmod(dst, mode)
if hasattr(os, 'chfl... | [
"def",
"copystat",
"(",
"src",
",",
"dst",
")",
":",
"st",
"=",
"os",
".",
"stat",
"(",
"src",
")",
"mode",
"=",
"stat",
".",
"S_IMODE",
"(",
"st",
".",
"st_mode",
")",
"if",
"hasattr",
"(",
"os",
",",
"'utime'",
")",
":",
"os",
".",
"utime",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/shutil.py#L93-L109 | ||
lightvector/KataGo | 20d34784703c5b4000643d3ccc43bb37d418f3b5 | python/sgfmill/sgf.py | python | Sgf_game.get_player_name | (self, colour) | Return the name of the specified player.
Returns None if there is no corresponding 'PB' or 'PW' property. | Return the name of the specified player. | [
"Return",
"the",
"name",
"of",
"the",
"specified",
"player",
"."
] | def get_player_name(self, colour):
"""Return the name of the specified player.
Returns None if there is no corresponding 'PB' or 'PW' property.
"""
try:
return self.root.get({'b' : 'PB', 'w' : 'PW'}[colour])
except KeyError:
return None | [
"def",
"get_player_name",
"(",
"self",
",",
"colour",
")",
":",
"try",
":",
"return",
"self",
".",
"root",
".",
"get",
"(",
"{",
"'b'",
":",
"'PB'",
",",
"'w'",
":",
"'PW'",
"}",
"[",
"colour",
"]",
")",
"except",
"KeyError",
":",
"return",
"None"
... | https://github.com/lightvector/KataGo/blob/20d34784703c5b4000643d3ccc43bb37d418f3b5/python/sgfmill/sgf.py#L807-L816 | ||
google/sandboxed-api | 7004d59150c9fbfaa3e5fd1872affffd1ab14fe8 | sandboxed_api/tools/generator2/code.py | python | Type.contains_declaration | (self, other) | return (other_extent.start in self_extent and
other_extent.end in self_extent) | Checks if string representation of a type contains the other type. | Checks if string representation of a type contains the other type. | [
"Checks",
"if",
"string",
"representation",
"of",
"a",
"type",
"contains",
"the",
"other",
"type",
"."
] | def contains_declaration(self, other):
# type: (Type) -> bool
"""Checks if string representation of a type contains the other type."""
self_extent = self._get_declaration().extent
other_extent = other._get_declaration().extent # pylint: disable=protected-access
if other_extent.start.file is None:
... | [
"def",
"contains_declaration",
"(",
"self",
",",
"other",
")",
":",
"# type: (Type) -> bool",
"self_extent",
"=",
"self",
".",
"_get_declaration",
"(",
")",
".",
"extent",
"other_extent",
"=",
"other",
".",
"_get_declaration",
"(",
")",
".",
"extent",
"# pylint:... | https://github.com/google/sandboxed-api/blob/7004d59150c9fbfaa3e5fd1872affffd1ab14fe8/sandboxed_api/tools/generator2/code.py#L318-L327 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | DC.SetAxisOrientation | (*args, **kwargs) | return _gdi_.DC_SetAxisOrientation(*args, **kwargs) | SetAxisOrientation(self, bool xLeftRight, bool yBottomUp)
Sets the x and y axis orientation (i.e., the direction from lowest to
highest values on the axis). The default orientation is the natural
orientation, e.g. x axis from left to right and y axis from bottom up. | SetAxisOrientation(self, bool xLeftRight, bool yBottomUp) | [
"SetAxisOrientation",
"(",
"self",
"bool",
"xLeftRight",
"bool",
"yBottomUp",
")"
] | def SetAxisOrientation(*args, **kwargs):
"""
SetAxisOrientation(self, bool xLeftRight, bool yBottomUp)
Sets the x and y axis orientation (i.e., the direction from lowest to
highest values on the axis). The default orientation is the natural
orientation, e.g. x axis from left to ... | [
"def",
"SetAxisOrientation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_SetAxisOrientation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L4478-L4486 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros/rosunit/src/rosunit/junitxml.py | python | TestCaseResult._passed | (self) | return not self.errors and not self.failures | @return: True if test passed
@rtype: bool | [] | def _passed(self):
"""
@return: True if test passed
@rtype: bool
"""
return not self.errors and not self.failures | [
"def",
"_passed",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"errors",
"and",
"not",
"self",
".",
"failures"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/rosunit/src/rosunit/junitxml.py#L114-L119 | ||
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/tools/clang/bindings/python/clang/cindex.py | python | Diagnostic.option | (self) | return conf.lib.clang_getDiagnosticOption(self, None) | The command-line option that enables this diagnostic. | The command-line option that enables this diagnostic. | [
"The",
"command",
"-",
"line",
"option",
"that",
"enables",
"this",
"diagnostic",
"."
] | def option(self):
"""The command-line option that enables this diagnostic."""
return conf.lib.clang_getDiagnosticOption(self, None) | [
"def",
"option",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getDiagnosticOption",
"(",
"self",
",",
"None",
")"
] | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/bindings/python/clang/cindex.py#L471-L473 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FlatMenuItem.GetKind | (self) | return self._kind | Returns the menu item kind, can be one of ``wx.ITEM_SEPARATOR``, ``wx.ITEM_NORMAL``,
``wx.ITEM_CHECK`` or ``wx.ITEM_RADIO``. | Returns the menu item kind, can be one of ``wx.ITEM_SEPARATOR``, ``wx.ITEM_NORMAL``,
``wx.ITEM_CHECK`` or ``wx.ITEM_RADIO``. | [
"Returns",
"the",
"menu",
"item",
"kind",
"can",
"be",
"one",
"of",
"wx",
".",
"ITEM_SEPARATOR",
"wx",
".",
"ITEM_NORMAL",
"wx",
".",
"ITEM_CHECK",
"or",
"wx",
".",
"ITEM_RADIO",
"."
] | def GetKind(self):
"""
Returns the menu item kind, can be one of ``wx.ITEM_SEPARATOR``, ``wx.ITEM_NORMAL``,
``wx.ITEM_CHECK`` or ``wx.ITEM_RADIO``.
"""
return self._kind | [
"def",
"GetKind",
"(",
"self",
")",
":",
"return",
"self",
".",
"_kind"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L4933-L4939 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/grid.py | python | Grid.HideCol | (*args, **kwargs) | return _grid.Grid_HideCol(*args, **kwargs) | HideCol(self, int col) | HideCol(self, int col) | [
"HideCol",
"(",
"self",
"int",
"col",
")"
] | def HideCol(*args, **kwargs):
"""HideCol(self, int col)"""
return _grid.Grid_HideCol(*args, **kwargs) | [
"def",
"HideCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_HideCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/grid.py#L1838-L1840 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/prefilter.py | python | PrefilterManager.unregister_checker | (self, checker) | Unregister a checker instance. | Unregister a checker instance. | [
"Unregister",
"a",
"checker",
"instance",
"."
] | def unregister_checker(self, checker):
"""Unregister a checker instance."""
if checker in self._checkers:
self._checkers.remove(checker) | [
"def",
"unregister_checker",
"(",
"self",
",",
"checker",
")",
":",
"if",
"checker",
"in",
"self",
".",
"_checkers",
":",
"self",
".",
"_checkers",
".",
"remove",
"(",
"checker",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/prefilter.py#L194-L197 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/plan/robotoptimize.py | python | RobotOptimizationProblem.rename | (self,itemname,newname) | Renames a Variable, UserData, or managed KlamptVariable. | Renames a Variable, UserData, or managed KlamptVariable. | [
"Renames",
"a",
"Variable",
"UserData",
"or",
"managed",
"KlamptVariable",
"."
] | def rename(self,itemname,newname):
"""Renames a Variable, UserData, or managed KlamptVariable."""
if itemname in self.managedVariables:
item = self.managedVariables[itemname]
del self.managedVariables[itemname]
item.name = newname
print "Renaming KlamptVar... | [
"def",
"rename",
"(",
"self",
",",
"itemname",
",",
"newname",
")",
":",
"if",
"itemname",
"in",
"self",
".",
"managedVariables",
":",
"item",
"=",
"self",
".",
"managedVariables",
"[",
"itemname",
"]",
"del",
"self",
".",
"managedVariables",
"[",
"itemnam... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/plan/robotoptimize.py#L333-L357 | ||
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/vqs/base.py | python | reset | (self) | r"""Resets the internal cache of th variational state.
Called automatically when the parameters/state is updated. | r"""Resets the internal cache of th variational state.
Called automatically when the parameters/state is updated. | [
"r",
"Resets",
"the",
"internal",
"cache",
"of",
"th",
"variational",
"state",
".",
"Called",
"automatically",
"when",
"the",
"parameters",
"/",
"state",
"is",
"updated",
"."
] | def reset(self):
r"""Resets the internal cache of th variational state.
Called automatically when the parameters/state is updated.
""" | [
"def",
"reset",
"(",
"self",
")",
":"
] | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/vqs/base.py#L148-L151 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-blocks/python/blocks/qa_multiply_matrix_xx.py | python | test_multiply_matrix_xx.test_001_t_complex | (self) | Simplest possible check: N==M, unit matrix | Simplest possible check: N==M, unit matrix | [
"Simplest",
"possible",
"check",
":",
"N",
"==",
"M",
"unit",
"matrix"
] | def test_001_t_complex(self):
""" Simplest possible check: N==M, unit matrix """
X_in = (
(1, 2, 3, 4),
(5, 6, 7, 8),
)
A = (
(1, 0),
(0, 1),
)
self.run_once(X_in, A, datatype='complex') | [
"def",
"test_001_t_complex",
"(",
"self",
")",
":",
"X_in",
"=",
"(",
"(",
"1",
",",
"2",
",",
"3",
",",
"4",
")",
",",
"(",
"5",
",",
"6",
",",
"7",
",",
"8",
")",
",",
")",
"A",
"=",
"(",
"(",
"1",
",",
"0",
")",
",",
"(",
"0",
",",... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-blocks/python/blocks/qa_multiply_matrix_xx.py#L104-L114 | ||
apple/foundationdb | f7118ad406f44ab7a33970fc8370647ed0085e18 | layers/containers/highcontention/queue.py | python | Queue.pop | (self, db) | return self._decodeValue(result) | Pop the next item from the queue. Cannot be composed with other functions in a single transaction. | Pop the next item from the queue. Cannot be composed with other functions in a single transaction. | [
"Pop",
"the",
"next",
"item",
"from",
"the",
"queue",
".",
"Cannot",
"be",
"composed",
"with",
"other",
"functions",
"in",
"a",
"single",
"transaction",
"."
] | def pop(self, db):
"""Pop the next item from the queue. Cannot be composed with other functions in a single transaction."""
if self.highContention:
result = self._popHighContention(db)
else:
result = self._popSimple(db)
if result is None:
return resu... | [
"def",
"pop",
"(",
"self",
",",
"db",
")",
":",
"if",
"self",
".",
"highContention",
":",
"result",
"=",
"self",
".",
"_popHighContention",
"(",
"db",
")",
"else",
":",
"result",
"=",
"self",
".",
"_popSimple",
"(",
"db",
")",
"if",
"result",
"is",
... | https://github.com/apple/foundationdb/blob/f7118ad406f44ab7a33970fc8370647ed0085e18/layers/containers/highcontention/queue.py#L98-L109 | |
facebook/rocksdb | 073ac547391870f464fae324a19a6bc6a70188dc | tools/block_cache_analyzer/block_cache_pysim.py | python | Cache.access | (self, trace_record) | Access a trace record. The simulator calls this function to access a
trace record. | Access a trace record. The simulator calls this function to access a
trace record. | [
"Access",
"a",
"trace",
"record",
".",
"The",
"simulator",
"calls",
"this",
"function",
"to",
"access",
"a",
"trace",
"record",
"."
] | def access(self, trace_record):
"""
Access a trace record. The simulator calls this function to access a
trace record.
"""
assert self.used_size <= self.cache_size
if (
self.enable_cache_row_key > 0
and trace_record.caller == 1
and trac... | [
"def",
"access",
"(",
"self",
",",
"trace_record",
")",
":",
"assert",
"self",
".",
"used_size",
"<=",
"self",
".",
"cache_size",
"if",
"(",
"self",
".",
"enable_cache_row_key",
">",
"0",
"and",
"trace_record",
".",
"caller",
"==",
"1",
"and",
"trace_recor... | https://github.com/facebook/rocksdb/blob/073ac547391870f464fae324a19a6bc6a70188dc/tools/block_cache_analyzer/block_cache_pysim.py#L724-L748 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py | python | GetEnvironFallback | (var_list, default) | return default | Look up a key in the environment, with fallback to secondary keys
and finally falling back to a default value. | Look up a key in the environment, with fallback to secondary keys
and finally falling back to a default value. | [
"Look",
"up",
"a",
"key",
"in",
"the",
"environment",
"with",
"fallback",
"to",
"secondary",
"keys",
"and",
"finally",
"falling",
"back",
"to",
"a",
"default",
"value",
"."
] | def GetEnvironFallback(var_list, default):
"""Look up a key in the environment, with fallback to secondary keys
and finally falling back to a default value."""
for var in var_list:
if var in os.environ:
return os.environ[var]
return default | [
"def",
"GetEnvironFallback",
"(",
"var_list",
",",
"default",
")",
":",
"for",
"var",
"in",
"var_list",
":",
"if",
"var",
"in",
"os",
".",
"environ",
":",
"return",
"os",
".",
"environ",
"[",
"var",
"]",
"return",
"default"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py#L119-L125 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/util/tf_decorator.py | python | rewrap | (decorator_func, previous_target, new_target) | return decorator_func | Injects a new target into a function built by make_decorator.
This function allows replacing a function wrapped by `decorator_func`,
assuming the decorator that wraps the function is written as described below.
The decorator function must use `<decorator name>.__wrapped__` instead of the
wrapped function that... | Injects a new target into a function built by make_decorator. | [
"Injects",
"a",
"new",
"target",
"into",
"a",
"function",
"built",
"by",
"make_decorator",
"."
] | def rewrap(decorator_func, previous_target, new_target):
"""Injects a new target into a function built by make_decorator.
This function allows replacing a function wrapped by `decorator_func`,
assuming the decorator that wraps the function is written as described below.
The decorator function must use `<decor... | [
"def",
"rewrap",
"(",
"decorator_func",
",",
"previous_target",
",",
"new_target",
")",
":",
"# Because the process mutates the decorator, we only need to alter the",
"# innermost function that wraps previous_target.",
"cur",
"=",
"decorator_func",
"innermost_decorator",
"=",
"None... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/util/tf_decorator.py#L128-L197 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py | python | Canvas.create_arc | (self, *args, **kw) | return self._create('arc', args, kw) | Create arc shaped region with coordinates x1,y1,x2,y2. | Create arc shaped region with coordinates x1,y1,x2,y2. | [
"Create",
"arc",
"shaped",
"region",
"with",
"coordinates",
"x1",
"y1",
"x2",
"y2",
"."
] | def create_arc(self, *args, **kw):
"""Create arc shaped region with coordinates x1,y1,x2,y2."""
return self._create('arc', args, kw) | [
"def",
"create_arc",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_create",
"(",
"'arc'",
",",
"args",
",",
"kw",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L2481-L2483 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py | python | Maildir.get_message | (self, key) | return msg | Return a Message representation or raise a KeyError. | Return a Message representation or raise a KeyError. | [
"Return",
"a",
"Message",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | def get_message(self, key):
"""Return a Message representation or raise a KeyError."""
subpath = self._lookup(key)
with open(os.path.join(self._path, subpath), 'rb') as f:
if self._factory:
msg = self._factory(f)
else:
msg = MaildirMessage(... | [
"def",
"get_message",
"(",
"self",
",",
"key",
")",
":",
"subpath",
"=",
"self",
".",
"_lookup",
"(",
"key",
")",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"subpath",
")",
",",
"'rb'",
")",
"as",
"f",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py#L370-L383 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Misc._substitute | (self, *args) | return (e,) | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def _substitute(self, *args):
"""Internal function."""
if len(args) != len(self._subst_format): return args
getboolean = self.tk.getboolean
getint = self.tk.getint
def getint_event(s):
"""Tk changed behavior in 8.4.2, returning "??" rather more often."""
... | [
"def",
"_substitute",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"len",
"(",
"self",
".",
"_subst_format",
")",
":",
"return",
"args",
"getboolean",
"=",
"self",
".",
"tk",
".",
"getboolean",
"getint",
"=",
"self",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L1388-L1447 | |
s9xie/hed | 94fb22f10cbfec8d84fbc0642b224022014b6bd6 | python/caffe/net_spec.py | python | to_proto | (*tops) | return net | Generate a NetParameter that contains all layers needed to compute
all arguments. | Generate a NetParameter that contains all layers needed to compute
all arguments. | [
"Generate",
"a",
"NetParameter",
"that",
"contains",
"all",
"layers",
"needed",
"to",
"compute",
"all",
"arguments",
"."
] | def to_proto(*tops):
"""Generate a NetParameter that contains all layers needed to compute
all arguments."""
layers = OrderedDict()
autonames = Counter()
for top in tops:
top.fn._to_proto(layers, {}, autonames)
net = caffe_pb2.NetParameter()
net.layer.extend(layers.values())
ret... | [
"def",
"to_proto",
"(",
"*",
"tops",
")",
":",
"layers",
"=",
"OrderedDict",
"(",
")",
"autonames",
"=",
"Counter",
"(",
")",
"for",
"top",
"in",
"tops",
":",
"top",
".",
"fn",
".",
"_to_proto",
"(",
"layers",
",",
"{",
"}",
",",
"autonames",
")",
... | https://github.com/s9xie/hed/blob/94fb22f10cbfec8d84fbc0642b224022014b6bd6/python/caffe/net_spec.py#L43-L53 | |
msitt/blpapi-python | bebcf43668c9e5f5467b1f685f9baebbfc45bc87 | src/blpapi/session.py | python | Session.sendRequestTemplate | (self, requestTemplate, correlationId=None) | return correlationId | Send a request defined by the specified ``requestTemplate``.
Args:
requestTemplate (RequestTemplate): Template that defines the
request
correlationId (CorrelationId): Correlation id to associate with the
request
Returns:
CorrelationId... | Send a request defined by the specified ``requestTemplate``. | [
"Send",
"a",
"request",
"defined",
"by",
"the",
"specified",
"requestTemplate",
"."
] | def sendRequestTemplate(self, requestTemplate, correlationId=None):
"""Send a request defined by the specified ``requestTemplate``.
Args:
requestTemplate (RequestTemplate): Template that defines the
request
correlationId (CorrelationId): Correlation id to associa... | [
"def",
"sendRequestTemplate",
"(",
"self",
",",
"requestTemplate",
",",
"correlationId",
"=",
"None",
")",
":",
"if",
"correlationId",
"is",
"None",
":",
"correlationId",
"=",
"CorrelationId",
"(",
")",
"res",
"=",
"internals",
".",
"blpapi_Session_sendRequestTemp... | https://github.com/msitt/blpapi-python/blob/bebcf43668c9e5f5467b1f685f9baebbfc45bc87/src/blpapi/session.py#L471-L503 | |
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usdImaging/usdviewq/appController.py | python | AppController._resetGUI | (self) | Perform a full refresh/resync of all GUI contents. This should be
called whenever the USD stage is modified, and assumes that all data
previously fetched from the stage is invalid. In the future, more
granular updates will be supported by listening to UsdNotice objects on
the active stag... | Perform a full refresh/resync of all GUI contents. This should be
called whenever the USD stage is modified, and assumes that all data
previously fetched from the stage is invalid. In the future, more
granular updates will be supported by listening to UsdNotice objects on
the active stag... | [
"Perform",
"a",
"full",
"refresh",
"/",
"resync",
"of",
"all",
"GUI",
"contents",
".",
"This",
"should",
"be",
"called",
"whenever",
"the",
"USD",
"stage",
"is",
"modified",
"and",
"assumes",
"that",
"all",
"data",
"previously",
"fetched",
"from",
"the",
"... | def _resetGUI(self):
"""Perform a full refresh/resync of all GUI contents. This should be
called whenever the USD stage is modified, and assumes that all data
previously fetched from the stage is invalid. In the future, more
granular updates will be supported by listening to UsdNotice ob... | [
"def",
"_resetGUI",
"(",
"self",
")",
":",
"with",
"BusyContext",
"(",
")",
":",
"if",
"self",
".",
"_hasPrimResync",
":",
"self",
".",
"_resetPrimView",
"(",
")",
"self",
".",
"_hasPrimResync",
"=",
"False",
"else",
":",
"self",
".",
"_resetPrimViewVis",
... | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/appController.py#L1771-L1795 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/mox.py | python | StrContains.__init__ | (self, search_string) | Initialize.
Args:
# search_string: the string you are searching for
search_string: str | Initialize. | [
"Initialize",
"."
] | def __init__(self, search_string):
"""Initialize.
Args:
# search_string: the string you are searching for
search_string: str
"""
self._search_string = search_string | [
"def",
"__init__",
"(",
"self",
",",
"search_string",
")",
":",
"self",
".",
"_search_string",
"=",
"search_string"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/mox.py#L874-L882 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/training/saving/functional_saver.py | python | _SingleDeviceSaver.save | (self, file_prefix, options=None) | Save the saveable objects to a checkpoint with `file_prefix`.
Args:
file_prefix: A string or scalar string Tensor containing the prefix to
save under.
options: Optional `CheckpointOptions` object.
Returns:
An `Operation`, or None when executing eagerly. | Save the saveable objects to a checkpoint with `file_prefix`. | [
"Save",
"the",
"saveable",
"objects",
"to",
"a",
"checkpoint",
"with",
"file_prefix",
"."
] | def save(self, file_prefix, options=None):
"""Save the saveable objects to a checkpoint with `file_prefix`.
Args:
file_prefix: A string or scalar string Tensor containing the prefix to
save under.
options: Optional `CheckpointOptions` object.
Returns:
An `Operation`, or None when ... | [
"def",
"save",
"(",
"self",
",",
"file_prefix",
",",
"options",
"=",
"None",
")",
":",
"options",
"=",
"options",
"or",
"checkpoint_options",
".",
"CheckpointOptions",
"(",
")",
"tensor_names",
"=",
"[",
"]",
"tensors",
"=",
"[",
"]",
"tensor_slices",
"=",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/saving/functional_saver.py#L54-L80 | ||
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | cnx/bar.py | python | Bar.getDateTime | (self) | Returns the :class:`datetime.datetime`. | Returns the :class:`datetime.datetime`. | [
"Returns",
"the",
":",
"class",
":",
"datetime",
".",
"datetime",
"."
] | def getDateTime(self):
"""Returns the :class:`datetime.datetime`."""
raise NotImplementedError() | [
"def",
"getDateTime",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/cnx/bar.py#L64-L66 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibar.py | python | AuiToolBar.AddTool | (self, tool_id, label, bitmap, disabled_bitmap, kind, short_help_string='', long_help_string='', client_data=None, target=None) | return self._items[-1] | Adds a tool to the toolbar. This is the full feature version of :meth:`AddTool`.
:param integer `tool_id`: an integer by which the tool may be identified in subsequent operations;
:param string `label`: the toolbar tool label;
:param Bitmap `bitmap`: the primary tool bitmap;
:param Bitm... | Adds a tool to the toolbar. This is the full feature version of :meth:`AddTool`. | [
"Adds",
"a",
"tool",
"to",
"the",
"toolbar",
".",
"This",
"is",
"the",
"full",
"feature",
"version",
"of",
":",
"meth",
":",
"AddTool",
"."
] | def AddTool(self, tool_id, label, bitmap, disabled_bitmap, kind, short_help_string='', long_help_string='', client_data=None, target=None):
"""
Adds a tool to the toolbar. This is the full feature version of :meth:`AddTool`.
:param integer `tool_id`: an integer by which the tool may be identifi... | [
"def",
"AddTool",
"(",
"self",
",",
"tool_id",
",",
"label",
",",
"bitmap",
",",
"disabled_bitmap",
",",
"kind",
",",
"short_help_string",
"=",
"''",
",",
"long_help_string",
"=",
"''",
",",
"client_data",
"=",
"None",
",",
"target",
"=",
"None",
")",
":... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L1767-L1829 | |
blackberry/Boost | fc90c3fde129c62565c023f091eddc4a7ed9902b | tools/build/v2/build/property.py | python | change | (properties, feature, value = None) | return result | Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed. | Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed. | [
"Returns",
"a",
"modified",
"version",
"of",
"properties",
"with",
"all",
"values",
"of",
"the",
"given",
"feature",
"replaced",
"by",
"the",
"given",
"value",
".",
"If",
"value",
"is",
"None",
"the",
"feature",
"will",
"be",
"removed",
"."
] | def change (properties, feature, value = None):
""" Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed.
"""
result = []
feature = add_grist (feature)
for p in properties:
... | [
"def",
"change",
"(",
"properties",
",",
"feature",
",",
"value",
"=",
"None",
")",
":",
"result",
"=",
"[",
"]",
"feature",
"=",
"add_grist",
"(",
"feature",
")",
"for",
"p",
"in",
"properties",
":",
"if",
"get_grist",
"(",
"p",
")",
"==",
"feature"... | https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/tools/build/v2/build/property.py#L316-L333 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/dataset.py | python | DataSet.save_undistorted_image | (self, image, array) | Save undistorted image pixels. | Save undistorted image pixels. | [
"Save",
"undistorted",
"image",
"pixels",
"."
] | def save_undistorted_image(self, image, array):
"""Save undistorted image pixels."""
io.mkdir_p(self._undistorted_image_path())
io.imwrite(self._undistorted_image_file(image), array) | [
"def",
"save_undistorted_image",
"(",
"self",
",",
"image",
",",
"array",
")",
":",
"io",
".",
"mkdir_p",
"(",
"self",
".",
"_undistorted_image_path",
"(",
")",
")",
"io",
".",
"imwrite",
"(",
"self",
".",
"_undistorted_image_file",
"(",
"image",
")",
",",... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/dataset.py#L91-L94 | ||
baidu/AnyQ | d94d450d2aaa5f7ed73424b10aa4539835b97527 | tools/simnet/preprocess/operation_unit.py | python | OpWriteData.write_data | (self, dataset, outdir, setname, pro) | write data | write data | [
"write",
"data"
] | def write_data(self, dataset, outdir, setname, pro):
"""
write data
"""
outlist = open(os.path.join(outdir, '%s.list' % setname), 'w')
len_set = len(dataset)
for i, subset in enumerate(dataset):
outf = open(os.path.join(outdir, '%s/part-000%02d' % (setname, i)... | [
"def",
"write_data",
"(",
"self",
",",
"dataset",
",",
"outdir",
",",
"setname",
",",
"pro",
")",
":",
"outlist",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"outdir",
",",
"'%s.list'",
"%",
"setname",
")",
",",
"'w'",
")",
"len_set",
"=... | https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/simnet/preprocess/operation_unit.py#L299-L319 | ||
grame-cncm/faust | ffee6904612a1f908b7343a2c43b0c87bc36719c | tools/physicalModeling/inkscape2scad/paths2openscad.py | python | parseLengthWithUnits | ( str ) | return v, u | Parse an SVG value which may or may not have units attached
This version is greatly simplified in that it only allows: no units,
units of px, and units of %. Everything else, it returns None for.
There is a more general routine to consider in scour.py if more
generality is ever needed. | Parse an SVG value which may or may not have units attached
This version is greatly simplified in that it only allows: no units,
units of px, and units of %. Everything else, it returns None for.
There is a more general routine to consider in scour.py if more
generality is ever needed. | [
"Parse",
"an",
"SVG",
"value",
"which",
"may",
"or",
"may",
"not",
"have",
"units",
"attached",
"This",
"version",
"is",
"greatly",
"simplified",
"in",
"that",
"it",
"only",
"allows",
":",
"no",
"units",
"units",
"of",
"px",
"and",
"units",
"of",
"%",
... | def parseLengthWithUnits( str ):
'''
Parse an SVG value which may or may not have units attached
This version is greatly simplified in that it only allows: no units,
units of px, and units of %. Everything else, it returns None for.
There is a more general routine to consider in scour.py if more
generality is e... | [
"def",
"parseLengthWithUnits",
"(",
"str",
")",
":",
"u",
"=",
"'px'",
"s",
"=",
"str",
".",
"strip",
"(",
")",
"if",
"s",
"[",
"-",
"2",
":",
"]",
"==",
"'px'",
":",
"s",
"=",
"s",
"[",
":",
"-",
"2",
"]",
"elif",
"s",
"[",
"-",
"1",
":"... | https://github.com/grame-cncm/faust/blob/ffee6904612a1f908b7343a2c43b0c87bc36719c/tools/physicalModeling/inkscape2scad/paths2openscad.py#L51-L74 | |
OkCupid/okws | 1c337392c676ccb4e9a4c92d11d5d2fada6427d2 | contrib/pub3-upgrade.py | python | Pub1Lexer.__init__ | (self, **kwargs) | Ply magic to turn this class into a scanner
given the class variables we set below. | Ply magic to turn this class into a scanner
given the class variables we set below. | [
"Ply",
"magic",
"to",
"turn",
"this",
"class",
"into",
"a",
"scanner",
"given",
"the",
"class",
"variables",
"we",
"set",
"below",
"."
] | def __init__ (self, **kwargs):
"""Ply magic to turn this class into a scanner
given the class variables we set below."""
for t in [ "PTSWITCH", "PTSET", "PTINCLUDE", "PTLOAD", "HTML" ]:
setattr (self, "t_nhtml_" + t, getattr (self, "t_" + t))
self.lexer = ply.lex.lex (modul... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"t",
"in",
"[",
"\"PTSWITCH\"",
",",
"\"PTSET\"",
",",
"\"PTINCLUDE\"",
",",
"\"PTLOAD\"",
",",
"\"HTML\"",
"]",
":",
"setattr",
"(",
"self",
",",
"\"t_nhtml_\"",
"+",
"t",
",",
... | https://github.com/OkCupid/okws/blob/1c337392c676ccb4e9a4c92d11d5d2fada6427d2/contrib/pub3-upgrade.py#L89-L97 | ||
google/google-api-cpp-client | 3df15df632bef43eb320645ac3329d872aabf5ad | prepare_dependencies.py | python | ConfigInfo.install_packages | (self) | return self._install_packages | Returns whether we wwant to install the packages. | Returns whether we wwant to install the packages. | [
"Returns",
"whether",
"we",
"wwant",
"to",
"install",
"the",
"packages",
"."
] | def install_packages(self):
"""Returns whether we wwant to install the packages."""
return self._install_packages | [
"def",
"install_packages",
"(",
"self",
")",
":",
"return",
"self",
".",
"_install_packages"
] | https://github.com/google/google-api-cpp-client/blob/3df15df632bef43eb320645ac3329d872aabf5ad/prepare_dependencies.py#L177-L179 | |
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | scripts/dev/find_byref_bool_override.py | python | lookup_errors_in_source_file | (source_file, found_functions) | return errors | Looks up the function bodies corresponding to each function
in found_functions, and checks if a passed-by-reference bool is forced to
false
Args:
-----
* source_file (str): path to the .cc file
* found_functions (list of dict): see `parse_function_signatures_in_header`
Returns:
-------... | Looks up the function bodies corresponding to each function
in found_functions, and checks if a passed-by-reference bool is forced to
false | [
"Looks",
"up",
"the",
"function",
"bodies",
"corresponding",
"to",
"each",
"function",
"in",
"found_functions",
"and",
"checks",
"if",
"a",
"passed",
"-",
"by",
"-",
"reference",
"bool",
"is",
"forced",
"to",
"false"
] | def lookup_errors_in_source_file(source_file, found_functions):
"""
Looks up the function bodies corresponding to each function
in found_functions, and checks if a passed-by-reference bool is forced to
false
Args:
-----
* source_file (str): path to the .cc file
* found_functions (list o... | [
"def",
"lookup_errors_in_source_file",
"(",
"source_file",
",",
"found_functions",
")",
":",
"# Relative path, for cleaner reporting",
"rel_file",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"source_file",
",",
"start",
"=",
"REPO_ROOT",
")",
"try",
":",
"with",
... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/scripts/dev/find_byref_bool_override.py#L618-L756 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/hermite_e.py | python | hermevander | (x, deg) | return np.moveaxis(v, 0, -1) | Pseudo-Vandermonde matrix of given degree.
Returns the pseudo-Vandermonde matrix of degree `deg` and sample points
`x`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., i] = He_i(x),
where `0 <= i <= deg`. The leading indices of `V` index the elements of
`x` and the last index is the ... | Pseudo-Vandermonde matrix of given degree. | [
"Pseudo",
"-",
"Vandermonde",
"matrix",
"of",
"given",
"degree",
"."
] | def hermevander(x, deg):
"""Pseudo-Vandermonde matrix of given degree.
Returns the pseudo-Vandermonde matrix of degree `deg` and sample points
`x`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., i] = He_i(x),
where `0 <= i <= deg`. The leading indices of `V` index the elements of
... | [
"def",
"hermevander",
"(",
"x",
",",
"deg",
")",
":",
"ideg",
"=",
"int",
"(",
"deg",
")",
"if",
"ideg",
"!=",
"deg",
":",
"raise",
"ValueError",
"(",
"\"deg must be integer\"",
")",
"if",
"ideg",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"deg must ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/hermite_e.py#L1175-L1234 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/model/create/moving_base_robot.py | python | send_xform_linear | (controller,R,t,dt) | For a moving base robot model, send a command to move to the
rotation matrix R and translation t using linear interpolation
over the duration dt.
Note: with the reflex model, can't currently set hand commands
and linear base commands simultaneously | For a moving base robot model, send a command to move to the
rotation matrix R and translation t using linear interpolation
over the duration dt. | [
"For",
"a",
"moving",
"base",
"robot",
"model",
"send",
"a",
"command",
"to",
"move",
"to",
"the",
"rotation",
"matrix",
"R",
"and",
"translation",
"t",
"using",
"linear",
"interpolation",
"over",
"the",
"duration",
"dt",
"."
] | def send_xform_linear(controller,R,t,dt):
"""For a moving base robot model, send a command to move to the
rotation matrix R and translation t using linear interpolation
over the duration dt.
Note: with the reflex model, can't currently set hand commands
and linear base commands simultaneously
"""
q = controller... | [
"def",
"send_xform_linear",
"(",
"controller",
",",
"R",
",",
"t",
",",
"dt",
")",
":",
"q",
"=",
"controller",
".",
"getCommandedConfig",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"q",
"[",
"i",
"]",
"=",
"t",
"[",
"i",
"]",
"ro... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/create/moving_base_robot.py#L122-L137 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextBuffer.GetFontTable | (*args, **kwargs) | return _richtext.RichTextBuffer_GetFontTable(*args, **kwargs) | GetFontTable(self) -> RichTextFontTable | GetFontTable(self) -> RichTextFontTable | [
"GetFontTable",
"(",
"self",
")",
"-",
">",
"RichTextFontTable"
] | def GetFontTable(*args, **kwargs):
"""GetFontTable(self) -> RichTextFontTable"""
return _richtext.RichTextBuffer_GetFontTable(*args, **kwargs) | [
"def",
"GetFontTable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_GetFontTable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L2229-L2231 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py2/prompt_toolkit/interface.py | python | CommandLineInterface.run_in_terminal | (self, func, render_cli_done=False, cooked_mode=True) | return result | Run function on the terminal above the prompt.
What this does is first hiding the prompt, then running this callable
(which can safely output to the terminal), and then again rendering the
prompt which causes the output of this function to scroll above the
prompt.
:param func: ... | Run function on the terminal above the prompt. | [
"Run",
"function",
"on",
"the",
"terminal",
"above",
"the",
"prompt",
"."
] | def run_in_terminal(self, func, render_cli_done=False, cooked_mode=True):
"""
Run function on the terminal above the prompt.
What this does is first hiding the prompt, then running this callable
(which can safely output to the terminal), and then again rendering the
prompt which... | [
"def",
"run_in_terminal",
"(",
"self",
",",
"func",
",",
"render_cli_done",
"=",
"False",
",",
"cooked_mode",
"=",
"True",
")",
":",
"# Draw interface in 'done' state, or erase.",
"if",
"render_cli_done",
":",
"self",
".",
"_return_value",
"=",
"True",
"self",
"."... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/interface.py#L614-L653 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | Treebook.ExpandNode | (*args, **kwargs) | return _controls_.Treebook_ExpandNode(*args, **kwargs) | ExpandNode(self, size_t pos, bool expand=True) -> bool | ExpandNode(self, size_t pos, bool expand=True) -> bool | [
"ExpandNode",
"(",
"self",
"size_t",
"pos",
"bool",
"expand",
"=",
"True",
")",
"-",
">",
"bool"
] | def ExpandNode(*args, **kwargs):
"""ExpandNode(self, size_t pos, bool expand=True) -> bool"""
return _controls_.Treebook_ExpandNode(*args, **kwargs) | [
"def",
"ExpandNode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Treebook_ExpandNode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L3327-L3329 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/distributions/transformed_distribution.py | python | _pick_scalar_condition | (pred, cond_true, cond_false) | return cond_true if pred_ else cond_false | Convenience function which chooses the condition based on the predicate. | Convenience function which chooses the condition based on the predicate. | [
"Convenience",
"function",
"which",
"chooses",
"the",
"condition",
"based",
"on",
"the",
"predicate",
"."
] | def _pick_scalar_condition(pred, cond_true, cond_false):
"""Convenience function which chooses the condition based on the predicate."""
# Note: This function is only valid if all of pred, cond_true, and cond_false
# are scalars. This means its semantics are arguably more like tf.cond than
# tf.select even thoug... | [
"def",
"_pick_scalar_condition",
"(",
"pred",
",",
"cond_true",
",",
"cond_false",
")",
":",
"# Note: This function is only valid if all of pred, cond_true, and cond_false",
"# are scalars. This means its semantics are arguably more like tf.cond than",
"# tf.select even though we use tf.sele... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/distributions/transformed_distribution.py#L88-L96 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/layers/python/layers/feature_column.py | python | _FeatureColumn._to_dnn_input_layer | (self,
input_tensor,
weight_collection=None,
trainable=True,
output_rank=2) | Returns a Tensor as an input to the first layer of neural network. | Returns a Tensor as an input to the first layer of neural network. | [
"Returns",
"a",
"Tensor",
"as",
"an",
"input",
"to",
"the",
"first",
"layer",
"of",
"neural",
"network",
"."
] | def _to_dnn_input_layer(self,
input_tensor,
weight_collection=None,
trainable=True,
output_rank=2):
"""Returns a Tensor as an input to the first layer of neural network."""
raise ValueError("Calling an abstra... | [
"def",
"_to_dnn_input_layer",
"(",
"self",
",",
"input_tensor",
",",
"weight_collection",
"=",
"None",
",",
"trainable",
"=",
"True",
",",
"output_rank",
"=",
"2",
")",
":",
"raise",
"ValueError",
"(",
"\"Calling an abstract method.\"",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/layers/python/layers/feature_column.py#L178-L184 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py | python | FlagValues._RegisterKeyFlagForModule | (self, module_name, flag) | Specifies that a flag is a key flag for a module.
Args:
module_name: A string, the name of a Python module.
flag: A Flag object, a flag that is key to the module. | Specifies that a flag is a key flag for a module. | [
"Specifies",
"that",
"a",
"flag",
"is",
"a",
"key",
"flag",
"for",
"a",
"module",
"."
] | def _RegisterKeyFlagForModule(self, module_name, flag):
"""Specifies that a flag is a key flag for a module.
Args:
module_name: A string, the name of a Python module.
flag: A Flag object, a flag that is key to the module.
"""
key_flags_by_module = self.KeyFlagsByModuleDict()
# The list ... | [
"def",
"_RegisterKeyFlagForModule",
"(",
"self",
",",
"module_name",
",",
"flag",
")",
":",
"key_flags_by_module",
"=",
"self",
".",
"KeyFlagsByModuleDict",
"(",
")",
"# The list of key flags for the module named module_name.",
"key_flags",
"=",
"key_flags_by_module",
".",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py#L899-L911 | ||
mozilla/DeepSpeech | aa1d28530d531d0d92289bf5f11a49fe516fdc86 | bin/import_lingua_libre.py | python | one_sample | (sample) | return (counter, rows) | Take a audio file, and optionally convert it to 16kHz WAV | Take a audio file, and optionally convert it to 16kHz WAV | [
"Take",
"a",
"audio",
"file",
"and",
"optionally",
"convert",
"it",
"to",
"16kHz",
"WAV"
] | def one_sample(sample):
""" Take a audio file, and optionally convert it to 16kHz WAV """
ogg_filename = sample[0]
# Storing wav files next to the ogg ones - just with a different suffix
wav_filename = os.path.splitext(ogg_filename)[0] + ".wav"
_maybe_convert_wav(ogg_filename, wav_filename)
file... | [
"def",
"one_sample",
"(",
"sample",
")",
":",
"ogg_filename",
"=",
"sample",
"[",
"0",
"]",
"# Storing wav files next to the ogg ones - just with a different suffix",
"wav_filename",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"ogg_filename",
")",
"[",
"0",
"]",
... | https://github.com/mozilla/DeepSpeech/blob/aa1d28530d531d0d92289bf5f11a49fe516fdc86/bin/import_lingua_libre.py#L60-L98 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/opt/python/training/moving_average_optimizer.py | python | MovingAverageOptimizer.swapping_saver | (self, var_list=None, name='swapping_saver', **kwargs) | return saver.Saver(swapped_var_list, name=name, **kwargs) | Create a saver swapping moving averages and variables.
You should use this saver during training. It will save the moving averages
of the trained parameters under the original parameter names. For
evaluations or inference you should use a regular saver and it will
automatically use the moving average... | Create a saver swapping moving averages and variables. | [
"Create",
"a",
"saver",
"swapping",
"moving",
"averages",
"and",
"variables",
"."
] | def swapping_saver(self, var_list=None, name='swapping_saver', **kwargs):
"""Create a saver swapping moving averages and variables.
You should use this saver during training. It will save the moving averages
of the trained parameters under the original parameter names. For
evaluations or inference yo... | [
"def",
"swapping_saver",
"(",
"self",
",",
"var_list",
"=",
"None",
",",
"name",
"=",
"'swapping_saver'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_variable_map",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'Must call apply_gradients or min... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/opt/python/training/moving_average_optimizer.py#L106-L147 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGrid.SetCurrentCategory | (*args, **kwargs) | return _propgrid.PropertyGrid_SetCurrentCategory(*args, **kwargs) | SetCurrentCategory(self, PGPropArg id) | SetCurrentCategory(self, PGPropArg id) | [
"SetCurrentCategory",
"(",
"self",
"PGPropArg",
"id",
")"
] | def SetCurrentCategory(*args, **kwargs):
"""SetCurrentCategory(self, PGPropArg id)"""
return _propgrid.PropertyGrid_SetCurrentCategory(*args, **kwargs) | [
"def",
"SetCurrentCategory",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_SetCurrentCategory",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2251-L2253 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/api/quote_api.py | python | QuoteApi.quote_get | (self, **kwargs) | Get Quotes. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.quote_get(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str symbol: Instrument s... | Get Quotes. # noqa: E501 | [
"Get",
"Quotes",
".",
"#",
"noqa",
":",
"E501"
] | def quote_get(self, **kwargs): # noqa: E501
"""Get Quotes. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.quote_get(async_req=True)
>>> result = thread.get()
:para... | [
"def",
"quote_get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'async_req'",
")",
":",
"return",
"self",
".",
"quote_get_with_http_info",
"(",... | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/api/quote_api.py#L36-L62 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/motionplanning.py | python | PlannerInterface.getSolutionPath | (self) | return _motionplanning.PlannerInterface_getSolutionPath(self) | r"""
getSolutionPath(PlannerInterface self) -> PyObject * | r"""
getSolutionPath(PlannerInterface self) -> PyObject * | [
"r",
"getSolutionPath",
"(",
"PlannerInterface",
"self",
")",
"-",
">",
"PyObject",
"*"
] | def getSolutionPath(self) -> "PyObject *":
r"""
getSolutionPath(PlannerInterface self) -> PyObject *
"""
return _motionplanning.PlannerInterface_getSolutionPath(self) | [
"def",
"getSolutionPath",
"(",
"self",
")",
"->",
"\"PyObject *\"",
":",
"return",
"_motionplanning",
".",
"PlannerInterface_getSolutionPath",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/motionplanning.py#L955-L961 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | samples/networking/02-time-synced-connection/client.py | python | GameClientRepository.syncReady | (self) | Now we've got the TimeManager manifested, and we're in
sync with the server time. Now we can enter the world. Check
to see if we've received our doIdBase yet. | Now we've got the TimeManager manifested, and we're in
sync with the server time. Now we can enter the world. Check
to see if we've received our doIdBase yet. | [
"Now",
"we",
"ve",
"got",
"the",
"TimeManager",
"manifested",
"and",
"we",
"re",
"in",
"sync",
"with",
"the",
"server",
"time",
".",
"Now",
"we",
"can",
"enter",
"the",
"world",
".",
"Check",
"to",
"see",
"if",
"we",
"ve",
"received",
"our",
"doIdBase"... | def syncReady(self):
""" Now we've got the TimeManager manifested, and we're in
sync with the server time. Now we can enter the world. Check
to see if we've received our doIdBase yet. """
# This method checks whether we actually have a valid doID range
# to create distributed ... | [
"def",
"syncReady",
"(",
"self",
")",
":",
"# This method checks whether we actually have a valid doID range",
"# to create distributed objects yet",
"if",
"self",
".",
"haveCreateAuthority",
"(",
")",
":",
"# we already have one",
"self",
".",
"gotCreateReady",
"(",
")",
"... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/samples/networking/02-time-synced-connection/client.py#L103-L115 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/tix.py | python | Grid.nearest | (self, x, y) | return self._getints(self.tk.call(self, 'nearest', x, y)) | Return coordinate of cell nearest pixel coordinate (x,y) | Return coordinate of cell nearest pixel coordinate (x,y) | [
"Return",
"coordinate",
"of",
"cell",
"nearest",
"pixel",
"coordinate",
"(",
"x",
"y",
")"
] | def nearest(self, x, y):
"Return coordinate of cell nearest pixel coordinate (x,y)"
return self._getints(self.tk.call(self, 'nearest', x, y)) | [
"def",
"nearest",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"return",
"self",
".",
"_getints",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"self",
",",
"'nearest'",
",",
"x",
",",
"y",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/tix.py#L1867-L1869 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/Direct/NonIDF_Properties.py | python | NonIDF_Properties.log | (self, msg,level="notice") | Send a log message to the location defined | Send a log message to the location defined | [
"Send",
"a",
"log",
"message",
"to",
"the",
"location",
"defined"
] | def log(self, msg,level="notice"):
"""Send a log message to the location defined
"""
lev,logger = NonIDF_Properties.log_options[level]
if self._log_to_mantid:
logger(msg)
else:
# TODO: reconcile this with Mantid.
if lev <= self._current_log_level:
... | [
"def",
"log",
"(",
"self",
",",
"msg",
",",
"level",
"=",
"\"notice\"",
")",
":",
"lev",
",",
"logger",
"=",
"NonIDF_Properties",
".",
"log_options",
"[",
"level",
"]",
"if",
"self",
".",
"_log_to_mantid",
":",
"logger",
"(",
"msg",
")",
"else",
":",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/NonIDF_Properties.py#L86-L95 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/abc.py | python | ExecutionLoader.get_filename | (self, fullname) | Abstract method which should return the value that __file__ is to be
set to.
Raises ImportError if the module cannot be found. | Abstract method which should return the value that __file__ is to be
set to. | [
"Abstract",
"method",
"which",
"should",
"return",
"the",
"value",
"that",
"__file__",
"is",
"to",
"be",
"set",
"to",
"."
] | def get_filename(self, fullname):
"""Abstract method which should return the value that __file__ is to be
set to.
Raises ImportError if the module cannot be found.
"""
raise ImportError | [
"def",
"get_filename",
"(",
"self",
",",
"fullname",
")",
":",
"raise",
"ImportError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/abc.py#L262-L268 | ||
evpo/EncryptPad | 156904860aaba8e7e8729b44e269b2992f9fe9f4 | deps/libencryptmsg/scripts/install.py | python | prepend_destdir | (path) | return path | Needed because os.path.join() discards the first path if the
second one is absolute, which is usually the case here. Still, we
want relative paths to work and leverage the os awareness of
os.path.join(). | Needed because os.path.join() discards the first path if the
second one is absolute, which is usually the case here. Still, we
want relative paths to work and leverage the os awareness of
os.path.join(). | [
"Needed",
"because",
"os",
".",
"path",
".",
"join",
"()",
"discards",
"the",
"first",
"path",
"if",
"the",
"second",
"one",
"is",
"absolute",
"which",
"is",
"usually",
"the",
"case",
"here",
".",
"Still",
"we",
"want",
"relative",
"paths",
"to",
"work",... | def prepend_destdir(path):
"""
Needed because os.path.join() discards the first path if the
second one is absolute, which is usually the case here. Still, we
want relative paths to work and leverage the os awareness of
os.path.join().
"""
destdir = os.environ.get('DESTDIR', "")
if destd... | [
"def",
"prepend_destdir",
"(",
"path",
")",
":",
"destdir",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'DESTDIR'",
",",
"\"\"",
")",
"if",
"destdir",
":",
"# DESTDIR is non-empty, but we only join absolute paths on UNIX-like file systems",
"if",
"os",
".",
"path",... | https://github.com/evpo/EncryptPad/blob/156904860aaba8e7e8729b44e269b2992f9fe9f4/deps/libencryptmsg/scripts/install.py#L74-L99 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/array_ops.py | python | _autopacking_conversion_function | (v, dtype=None, name=None, as_ref=False) | return _autopacking_helper(v, inferred_dtype, name or "packed") | Tensor conversion function that automatically packs arguments. | Tensor conversion function that automatically packs arguments. | [
"Tensor",
"conversion",
"function",
"that",
"automatically",
"packs",
"arguments",
"."
] | def _autopacking_conversion_function(v, dtype=None, name=None, as_ref=False):
"""Tensor conversion function that automatically packs arguments."""
if as_ref:
return NotImplemented
inferred_dtype = _get_dtype_from_nested_lists(v)
if inferred_dtype is None:
# We did not find any tensor-like objects in the... | [
"def",
"_autopacking_conversion_function",
"(",
"v",
",",
"dtype",
"=",
"None",
",",
"name",
"=",
"None",
",",
"as_ref",
"=",
"False",
")",
":",
"if",
"as_ref",
":",
"return",
"NotImplemented",
"inferred_dtype",
"=",
"_get_dtype_from_nested_lists",
"(",
"v",
"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/array_ops.py#L730-L741 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | tools/scons/site_scons/site_tools/emscripten/emscripten.py | python | exists | (env) | return 1 | NOOP method required by SCons | NOOP method required by SCons | [
"NOOP",
"method",
"required",
"by",
"SCons"
] | def exists(env):
""" NOOP method required by SCons """
return 1 | [
"def",
"exists",
"(",
"env",
")",
":",
"return",
"1"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/tools/scons/site_scons/site_tools/emscripten/emscripten.py#L56-L58 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/design-tic-tac-toe.py | python | TicTacToe.__init__ | (self, n) | Initialize your data structure here.
:type n: int | Initialize your data structure here.
:type n: int | [
"Initialize",
"your",
"data",
"structure",
"here",
".",
":",
"type",
"n",
":",
"int"
] | def __init__(self, n):
"""
Initialize your data structure here.
:type n: int
"""
self.__size = n
self.__rows = [[0, 0] for _ in xrange(n)]
self.__cols = [[0, 0] for _ in xrange(n)]
self.__diagonal = [0, 0]
self.__anti_diagonal = [0, 0] | [
"def",
"__init__",
"(",
"self",
",",
"n",
")",
":",
"self",
".",
"__size",
"=",
"n",
"self",
".",
"__rows",
"=",
"[",
"[",
"0",
",",
"0",
"]",
"for",
"_",
"in",
"xrange",
"(",
"n",
")",
"]",
"self",
".",
"__cols",
"=",
"[",
"[",
"0",
",",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/design-tic-tac-toe.py#L7-L16 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/util/_print_versions.py | python | _get_commit_hash | () | return versions["full-revisionid"] | Use vendored versioneer code to get git hash, which handles
git worktree correctly. | Use vendored versioneer code to get git hash, which handles
git worktree correctly. | [
"Use",
"vendored",
"versioneer",
"code",
"to",
"get",
"git",
"hash",
"which",
"handles",
"git",
"worktree",
"correctly",
"."
] | def _get_commit_hash() -> str | None:
"""
Use vendored versioneer code to get git hash, which handles
git worktree correctly.
"""
from pandas._version import get_versions
versions = get_versions()
return versions["full-revisionid"] | [
"def",
"_get_commit_hash",
"(",
")",
"->",
"str",
"|",
"None",
":",
"from",
"pandas",
".",
"_version",
"import",
"get_versions",
"versions",
"=",
"get_versions",
"(",
")",
"return",
"versions",
"[",
"\"full-revisionid\"",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/util/_print_versions.py#L19-L27 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/models.py | python | PreparedRequest.prepare_headers | (self, headers) | Prepares the given HTTP headers. | Prepares the given HTTP headers. | [
"Prepares",
"the",
"given",
"HTTP",
"headers",
"."
] | def prepare_headers(self, headers):
"""Prepares the given HTTP headers."""
self.headers = CaseInsensitiveDict()
if headers:
for header in headers.items():
# Raise exception on invalid header value.
check_header_validity(header)
name, v... | [
"def",
"prepare_headers",
"(",
"self",
",",
"headers",
")",
":",
"self",
".",
"headers",
"=",
"CaseInsensitiveDict",
"(",
")",
"if",
"headers",
":",
"for",
"header",
"in",
"headers",
".",
"items",
"(",
")",
":",
"# Raise exception on invalid header value.",
"c... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/models.py#L442-L451 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/mixed_precision/loss_scale_optimizer.py | python | _op_in_graph_mode | (tensor) | return tensor.op | Returns the tensor's op in graph mode, or the tensor in eager mode.
This is useful because sometimes an op is needed in graph mode instead of a
tensor. In eager mode, there are no ops.
Args:
tensor: A tensor.
Returns:
The tensor's op in graph mode. The tensor in eager mode. | Returns the tensor's op in graph mode, or the tensor in eager mode. | [
"Returns",
"the",
"tensor",
"s",
"op",
"in",
"graph",
"mode",
"or",
"the",
"tensor",
"in",
"eager",
"mode",
"."
] | def _op_in_graph_mode(tensor):
"""Returns the tensor's op in graph mode, or the tensor in eager mode.
This is useful because sometimes an op is needed in graph mode instead of a
tensor. In eager mode, there are no ops.
Args:
tensor: A tensor.
Returns:
The tensor's op in graph mode. The tensor in ea... | [
"def",
"_op_in_graph_mode",
"(",
"tensor",
")",
":",
"if",
"context",
".",
"executing_eagerly",
"(",
")",
":",
"return",
"tensor",
"return",
"tensor",
".",
"op"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/mixed_precision/loss_scale_optimizer.py#L72-L86 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/training/saver.py | python | get_checkpoint_state | (checkpoint_dir, latest_filename=None) | return ckpt | Returns CheckpointState proto from the "checkpoint" file.
If the "checkpoint" file contains a valid CheckpointState
proto, returns it.
Args:
checkpoint_dir: The directory of checkpoints.
latest_filename: Optional name of the checkpoint file. Default to
'checkpoint'.
Returns:
A CheckpointSt... | Returns CheckpointState proto from the "checkpoint" file. | [
"Returns",
"CheckpointState",
"proto",
"from",
"the",
"checkpoint",
"file",
"."
] | def get_checkpoint_state(checkpoint_dir, latest_filename=None):
"""Returns CheckpointState proto from the "checkpoint" file.
If the "checkpoint" file contains a valid CheckpointState
proto, returns it.
Args:
checkpoint_dir: The directory of checkpoints.
latest_filename: Optional name of the checkpoint... | [
"def",
"get_checkpoint_state",
"(",
"checkpoint_dir",
",",
"latest_filename",
"=",
"None",
")",
":",
"ckpt",
"=",
"None",
"coord_checkpoint_filename",
"=",
"_GetCheckpointFilename",
"(",
"checkpoint_dir",
",",
"latest_filename",
")",
"f",
"=",
"None",
"try",
":",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/training/saver.py#L751-L805 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | build/android/android_commands.py | python | GetLogTimestamp | (log_line) | Returns the timestamp of the given |log_line|. | Returns the timestamp of the given |log_line|. | [
"Returns",
"the",
"timestamp",
"of",
"the",
"given",
"|log_line|",
"."
] | def GetLogTimestamp(log_line):
"""Returns the timestamp of the given |log_line|."""
try:
return datetime.datetime.strptime(log_line[:18], '%m-%d %H:%M:%S.%f')
except (ValueError, IndexError):
logging.critical('Error reading timestamp from ' + log_line)
return None | [
"def",
"GetLogTimestamp",
"(",
"log_line",
")",
":",
"try",
":",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"log_line",
"[",
":",
"18",
"]",
",",
"'%m-%d %H:%M:%S.%f'",
")",
"except",
"(",
"ValueError",
",",
"IndexError",
")",
":",
"loggi... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/build/android/android_commands.py#L193-L199 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/internal/python_message.py | python | _AddPrivateHelperMethods | (message_descriptor, cls) | Adds implementation of private helper methods to cls. | Adds implementation of private helper methods to cls. | [
"Adds",
"implementation",
"of",
"private",
"helper",
"methods",
"to",
"cls",
"."
] | def _AddPrivateHelperMethods(message_descriptor, cls):
"""Adds implementation of private helper methods to cls."""
def Modified(self):
"""Sets the _cached_byte_size_dirty bit to true,
and propagates this to our listener iff this was a state change.
"""
# Note: Some callers check _cached_byte_size... | [
"def",
"_AddPrivateHelperMethods",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"def",
"Modified",
"(",
"self",
")",
":",
"\"\"\"Sets the _cached_byte_size_dirty bit to true,\n and propagates this to our listener iff this was a state change.\n \"\"\"",
"# Note: Some callers ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/internal/python_message.py#L1443-L1474 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/hypertreelist.py | python | TreeListHeaderWindow.DrawCurrent | (self) | Draws the column resize line on a :class:`ScreenDC`. | Draws the column resize line on a :class:`ScreenDC`. | [
"Draws",
"the",
"column",
"resize",
"line",
"on",
"a",
":",
"class",
":",
"ScreenDC",
"."
] | def DrawCurrent(self):
""" Draws the column resize line on a :class:`ScreenDC`. """
x1, y1 = self._currentX, 0
x1, y1 = self.ClientToScreen((x1, y1))
x2 = self._currentX-1
if wx.Platform == "__WXMSW__":
x2 += 1 # but why ????
y2 = 0
dummy, y2... | [
"def",
"DrawCurrent",
"(",
"self",
")",
":",
"x1",
",",
"y1",
"=",
"self",
".",
"_currentX",
",",
"0",
"x1",
",",
"y1",
"=",
"self",
".",
"ClientToScreen",
"(",
"(",
"x1",
",",
"y1",
")",
")",
"x2",
"=",
"self",
".",
"_currentX",
"-",
"1",
"if"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/hypertreelist.py#L893-L913 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/configure.d/nodedownload.py | python | retrievefile | (url, targetfile) | fetch file 'url' as 'targetfile'. Return targetfile or throw. | fetch file 'url' as 'targetfile'. Return targetfile or throw. | [
"fetch",
"file",
"url",
"as",
"targetfile",
".",
"Return",
"targetfile",
"or",
"throw",
"."
] | def retrievefile(url, targetfile):
"""fetch file 'url' as 'targetfile'. Return targetfile or throw."""
try:
sys.stdout.write(' <%s>\nConnecting...\r' % url)
sys.stdout.flush()
ConfigOpener().retrieve(url, targetfile, reporthook=reporthook)
print('') # clear the line
retu... | [
"def",
"retrievefile",
"(",
"url",
",",
"targetfile",
")",
":",
"try",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"' <%s>\\nConnecting...\\r'",
"%",
"url",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"ConfigOpener",
"(",
")",
".",
"retrieve",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/configure.d/nodedownload.py#L36-L49 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | buildscripts/cpplint.py | python | CheckComment | (line, filename, linenum, next_line_start, error) | Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
error: The function to call with any errors found. | Checks for common mistakes in comments. | [
"Checks",
"for",
"common",
"mistakes",
"in",
"comments",
"."
] | def CheckComment(line, filename, linenum, next_line_start, error):
"""Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
er... | [
"def",
"CheckComment",
"(",
"line",
",",
"filename",
",",
"linenum",
",",
"next_line_start",
",",
"error",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
":",
"# Check if the // may be in quotes. If so,... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/buildscripts/cpplint.py#L2901-L2952 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/command/bdist_egg.py | python | make_zipfile | (zip_filename, base_dir, verbose=0, dry_run=0, compress=True,
mode='w') | return zip_filename | Create a zip file from all the files under 'base_dir'. The output
zip file will be named 'base_dir' + ".zip". Uses either the "zipfile"
Python module (if available) or the InfoZIP "zip" utility (if installed
and found on the default search path). If neither tool is available,
raises DistutilsExecErro... | Create a zip file from all the files under 'base_dir'. The output
zip file will be named 'base_dir' + ".zip". Uses either the "zipfile"
Python module (if available) or the InfoZIP "zip" utility (if installed
and found on the default search path). If neither tool is available,
raises DistutilsExecErro... | [
"Create",
"a",
"zip",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
".",
"The",
"output",
"zip",
"file",
"will",
"be",
"named",
"base_dir",
"+",
".",
"zip",
".",
"Uses",
"either",
"the",
"zipfile",
"Python",
"module",
"(",
"if",
"available"... | def make_zipfile(zip_filename, base_dir, verbose=0, dry_run=0, compress=True,
mode='w'):
"""Create a zip file from all the files under 'base_dir'. The output
zip file will be named 'base_dir' + ".zip". Uses either the "zipfile"
Python module (if available) or the InfoZIP "zip" utility (if... | [
"def",
"make_zipfile",
"(",
"zip_filename",
",",
"base_dir",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"compress",
"=",
"True",
",",
"mode",
"=",
"'w'",
")",
":",
"import",
"zipfile",
"mkpath",
"(",
"os",
".",
"path",
".",
"dirname",
"... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/command/bdist_egg.py#L471-L502 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/shortcuts/progress_bar/base.py | python | ProgressBarCounter.done | (self) | return self._done | Whether a counter has been completed.
Done counter have been stopped (see stopped) and removed depending on
remove_when_done value.
Contrast this with stopped. A stopped counter may be terminated before
100% completion. A done counter has reached its 100% completion. | Whether a counter has been completed. | [
"Whether",
"a",
"counter",
"has",
"been",
"completed",
"."
] | def done(self) -> bool:
"""Whether a counter has been completed.
Done counter have been stopped (see stopped) and removed depending on
remove_when_done value.
Contrast this with stopped. A stopped counter may be terminated before
100% completion. A done counter has reached its ... | [
"def",
"done",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_done"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/shortcuts/progress_bar/base.py#L364-L373 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarInfo._create_header | (info, format, encoding, errors) | return buf | Return a header block. info is a dictionary with file
information, format must be one of the *_FORMAT constants. | Return a header block. info is a dictionary with file
information, format must be one of the *_FORMAT constants. | [
"Return",
"a",
"header",
"block",
".",
"info",
"is",
"a",
"dictionary",
"with",
"file",
"information",
"format",
"must",
"be",
"one",
"of",
"the",
"*",
"_FORMAT",
"constants",
"."
] | def _create_header(info, format, encoding, errors):
"""Return a header block. info is a dictionary with file
information, format must be one of the *_FORMAT constants.
"""
parts = [
stn(info.get("name", ""), 100, encoding, errors),
itn(info.get("mode", 0) & 0o7... | [
"def",
"_create_header",
"(",
"info",
",",
"format",
",",
"encoding",
",",
"errors",
")",
":",
"parts",
"=",
"[",
"stn",
"(",
"info",
".",
"get",
"(",
"\"name\"",
",",
"\"\"",
")",
",",
"100",
",",
"encoding",
",",
"errors",
")",
",",
"itn",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L1114-L1139 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/aui.py | python | AuiManager.DrawHintRect | (*args, **kwargs) | return _aui.AuiManager_DrawHintRect(*args, **kwargs) | DrawHintRect(self, Window paneWindow, Point pt, Point offset) | DrawHintRect(self, Window paneWindow, Point pt, Point offset) | [
"DrawHintRect",
"(",
"self",
"Window",
"paneWindow",
"Point",
"pt",
"Point",
"offset",
")"
] | def DrawHintRect(*args, **kwargs):
"""DrawHintRect(self, Window paneWindow, Point pt, Point offset)"""
return _aui.AuiManager_DrawHintRect(*args, **kwargs) | [
"def",
"DrawHintRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiManager_DrawHintRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/aui.py#L719-L721 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py | python | TurtleScreen.mode | (self, mode=None) | Set turtle-mode ('standard', 'logo' or 'world') and perform reset.
Optional argument:
mode -- on of the strings 'standard', 'logo' or 'world'
Mode 'standard' is compatible with turtle.py.
Mode 'logo' is compatible with most Logo-Turtle-Graphics.
Mode 'world' uses userdefined 'w... | Set turtle-mode ('standard', 'logo' or 'world') and perform reset. | [
"Set",
"turtle",
"-",
"mode",
"(",
"standard",
"logo",
"or",
"world",
")",
"and",
"perform",
"reset",
"."
] | def mode(self, mode=None):
"""Set turtle-mode ('standard', 'logo' or 'world') and perform reset.
Optional argument:
mode -- on of the strings 'standard', 'logo' or 'world'
Mode 'standard' is compatible with turtle.py.
Mode 'logo' is compatible with most Logo-Turtle-Graphics.
... | [
"def",
"mode",
"(",
"self",
",",
"mode",
"=",
"None",
")",
":",
"if",
"mode",
"is",
"None",
":",
"return",
"self",
".",
"_mode",
"mode",
"=",
"mode",
".",
"lower",
"(",
")",
"if",
"mode",
"not",
"in",
"[",
"\"standard\"",
",",
"\"logo\"",
",",
"\... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py#L980-L1012 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/lib/demo.py | python | Demo.show | (self,index=None) | Show a single block on screen | Show a single block on screen | [
"Show",
"a",
"single",
"block",
"on",
"screen"
] | def show(self,index=None):
"""Show a single block on screen"""
index = self._get_index(index)
if index is None:
return
print(self.marquee('<%s> block # %s (%s remaining)' %
(self.title,index,self.nblocks-index-1)))
print(self.src_blocks_co... | [
"def",
"show",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"index",
"=",
"self",
".",
"_get_index",
"(",
"index",
")",
"if",
"index",
"is",
"None",
":",
"return",
"print",
"(",
"self",
".",
"marquee",
"(",
"'<%s> block # %s (%s remaining)'",
"%",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/lib/demo.py#L416-L426 | ||
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | utils/grid.py | python | MainWindow.__dialog_response_cb | (self, widget, response) | return | ! Dialog Response Callback
@param self this object
@param widget widget
@param response response
@return none | ! Dialog Response Callback | [
"!",
"Dialog",
"Response",
"Callback"
] | def __dialog_response_cb(self, widget, response):
"""! Dialog Response Callback
@param self this object
@param widget widget
@param response response
@return none
"""
if response == 1:
filename = self.__dialog.get_filename()
self.__render.o... | [
"def",
"__dialog_response_cb",
"(",
"self",
",",
"widget",
",",
"response",
")",
":",
"if",
"response",
"==",
"1",
":",
"filename",
"=",
"self",
".",
"__dialog",
".",
"get_filename",
"(",
")",
"self",
".",
"__render",
".",
"output_png",
"(",
"filename",
... | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/utils/grid.py#L1604-L1615 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | RobotModel.getTorqueLimits | (self) | return _robotsim.RobotModel_getTorqueLimits(self) | getTorqueLimits(RobotModel self)
Retrieve the torque limit vector tmax, the constraint is :math:`|torque[i]|
\leq tmax[i]` | getTorqueLimits(RobotModel self) | [
"getTorqueLimits",
"(",
"RobotModel",
"self",
")"
] | def getTorqueLimits(self):
"""
getTorqueLimits(RobotModel self)
Retrieve the torque limit vector tmax, the constraint is :math:`|torque[i]|
\leq tmax[i]`
"""
return _robotsim.RobotModel_getTorqueLimits(self) | [
"def",
"getTorqueLimits",
"(",
"self",
")",
":",
"return",
"_robotsim",
".",
"RobotModel_getTorqueLimits",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L4763-L4773 | |
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/train/training_session.py | python | CheckpointConfig.__init__ | (self, filename, frequency=None,
restore=True, preserve_all=False) | Sets configuration of checkpointing behavior.
Args:
filename (str): checkpoint file name.
frequency (int, tuple): checkpoint period (number samples between checkpoints). If 0, no checkpointing takes place.
If ``sys.maxsize``, a single checkpoint is taken at the end of the ... | Sets configuration of checkpointing behavior. | [
"Sets",
"configuration",
"of",
"checkpointing",
"behavior",
"."
] | def __init__(self, filename, frequency=None,
restore=True, preserve_all=False):
'''Sets configuration of checkpointing behavior.
Args:
filename (str): checkpoint file name.
frequency (int, tuple): checkpoint period (number samples between checkpoints). If 0, no ... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
",",
"frequency",
"=",
"None",
",",
"restore",
"=",
"True",
",",
"preserve_all",
"=",
"False",
")",
":",
"frequency",
",",
"frequency_unit",
"=",
"_unpack_parameter_frequency",
"(",
"frequency",
")",
"if",
"fi... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/train/training_session.py#L70-L99 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/dashboard/dashboard/layered_cache.py | python | Get | (key) | return None | Gets the value from the datastore. | Gets the value from the datastore. | [
"Gets",
"the",
"value",
"from",
"the",
"datastore",
"."
] | def Get(key):
"""Gets the value from the datastore."""
namespaced_key = _NamespaceKey(key)
entity = ndb.Key('CachedPickledString', namespaced_key).get(
read_policy=ndb.EVENTUAL_CONSISTENCY)
if entity:
return cPickle.loads(entity.value)
return None | [
"def",
"Get",
"(",
"key",
")",
":",
"namespaced_key",
"=",
"_NamespaceKey",
"(",
"key",
")",
"entity",
"=",
"ndb",
".",
"Key",
"(",
"'CachedPickledString'",
",",
"namespaced_key",
")",
".",
"get",
"(",
"read_policy",
"=",
"ndb",
".",
"EVENTUAL_CONSISTENCY",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dashboard/dashboard/layered_cache.py#L98-L105 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/parallel_with_gloo.py | python | gloo_release | () | Release the parallel environment initialized by gloo
Args:
None
Returns:
None
Examples:
.. code-block:: python
import paddle
import multiprocessing
from contextlib import closing
import socket
port_set = set()
... | Release the parallel environment initialized by gloo | [
"Release",
"the",
"parallel",
"environment",
"initialized",
"by",
"gloo"
] | def gloo_release():
"""
Release the parallel environment initialized by gloo
Args:
None
Returns:
None
Examples:
.. code-block:: python
import paddle
import multiprocessing
from contextlib import closing
import socket
... | [
"def",
"gloo_release",
"(",
")",
":",
"if",
"_global_gloo_ctx",
"is",
"not",
"None",
":",
"_global_gloo_ctx",
".",
"release",
"(",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/parallel_with_gloo.py#L193-L249 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/typing.py | python | _strip_annotations | (t) | return t | Strips the annotations from a given type. | Strips the annotations from a given type. | [
"Strips",
"the",
"annotations",
"from",
"a",
"given",
"type",
"."
] | def _strip_annotations(t):
"""Strips the annotations from a given type.
"""
if isinstance(t, _AnnotatedAlias):
return _strip_annotations(t.__origin__)
if isinstance(t, _GenericAlias):
stripped_args = tuple(_strip_annotations(a) for a in t.__args__)
if stripped_args == t.__args__:... | [
"def",
"_strip_annotations",
"(",
"t",
")",
":",
"if",
"isinstance",
"(",
"t",
",",
"_AnnotatedAlias",
")",
":",
"return",
"_strip_annotations",
"(",
"t",
".",
"__origin__",
")",
"if",
"isinstance",
"(",
"t",
",",
"_GenericAlias",
")",
":",
"stripped_args",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/typing.py#L1503-L1518 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/numbers.py | python | Complex.__div__ | (self, other) | self / other without __future__ division
May promote to float. | self / other without __future__ division | [
"self",
"/",
"other",
"without",
"__future__",
"division"
] | def __div__(self, other):
"""self / other without __future__ division
May promote to float.
"""
raise NotImplementedError | [
"def",
"__div__",
"(",
"self",
",",
"other",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/numbers.py#L111-L116 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | tools/idl_parser/idl_parser.py | python | IDLParser.p_FloatLiteral | (self, p) | FloatLiteral : float
| '-' INFINITY
| INFINITY
| NAN | FloatLiteral : float
| '-' INFINITY
| INFINITY
| NAN | [
"FloatLiteral",
":",
"float",
"|",
"-",
"INFINITY",
"|",
"INFINITY",
"|",
"NAN"
] | def p_FloatLiteral(self, p):
"""FloatLiteral : float
| '-' INFINITY
| INFINITY
| NAN """
if len(p) > 2:
val = '-Infinity'
else:
val = p[1]
p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'float'),
self.Bu... | [
"def",
"p_FloatLiteral",
"(",
"self",
",",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
">",
"2",
":",
"val",
"=",
"'-Infinity'",
"else",
":",
"val",
"=",
"p",
"[",
"1",
"]",
"p",
"[",
"0",
"]",
"=",
"ListFromConcat",
"(",
"self",
".",
"BuildAttr... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/tools/idl_parser/idl_parser.py#L439-L449 | ||
hydrogen-music/hydrogen | 8a4eff74f9706922bd3a649a17cb18f4f5849cc1 | windows/ci/copy_thirdparty_dlls.py | python | LibraryResolver.process_file | (self, path: str) | Process single input file | Process single input file | [
"Process",
"single",
"input",
"file"
] | def process_file(self, path: str) -> None:
""" Process single input file """
base_name = os.path.basename(path)
deps = self.scan_dependencies(path)
info = Library(base_name, path, LibraryKind.INPUT, deps)
self.record(info) | [
"def",
"process_file",
"(",
"self",
",",
"path",
":",
"str",
")",
"->",
"None",
":",
"base_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
"deps",
"=",
"self",
".",
"scan_dependencies",
"(",
"path",
")",
"info",
"=",
"Library",
"(",... | https://github.com/hydrogen-music/hydrogen/blob/8a4eff74f9706922bd3a649a17cb18f4f5849cc1/windows/ci/copy_thirdparty_dlls.py#L85-L90 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | Joystick.GetProductName | (*args, **kwargs) | return _misc_.Joystick_GetProductName(*args, **kwargs) | GetProductName(self) -> String | GetProductName(self) -> String | [
"GetProductName",
"(",
"self",
")",
"-",
">",
"String"
] | def GetProductName(*args, **kwargs):
"""GetProductName(self) -> String"""
return _misc_.Joystick_GetProductName(*args, **kwargs) | [
"def",
"GetProductName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Joystick_GetProductName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L2182-L2184 | |
apache/kudu | 90895ce76590f10730ad7aac3613b69d89ff5422 | build-support/iwyu/fix_includes.py | python | _CommonPrefixLength | (a, b) | return end | Given two lists, returns the index of 1st element not common to both. | Given two lists, returns the index of 1st element not common to both. | [
"Given",
"two",
"lists",
"returns",
"the",
"index",
"of",
"1st",
"element",
"not",
"common",
"to",
"both",
"."
] | def _CommonPrefixLength(a, b):
"""Given two lists, returns the index of 1st element not common to both."""
end = min(len(a), len(b))
for i in range(end):
if a[i] != b[i]:
return i
return end | [
"def",
"_CommonPrefixLength",
"(",
"a",
",",
"b",
")",
":",
"end",
"=",
"min",
"(",
"len",
"(",
"a",
")",
",",
"len",
"(",
"b",
")",
")",
"for",
"i",
"in",
"range",
"(",
"end",
")",
":",
"if",
"a",
"[",
"i",
"]",
"!=",
"b",
"[",
"i",
"]",... | https://github.com/apache/kudu/blob/90895ce76590f10730ad7aac3613b69d89ff5422/build-support/iwyu/fix_includes.py#L1979-L1985 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/compat/numpy/function.py | python | validate_argmin_with_skipna | (skipna, args, kwargs) | return skipna | If 'Series.argmin' is called via the 'numpy' library, the third parameter
in its signature is 'out', which takes either an ndarray or 'None', so
check if the 'skipna' parameter is either an instance of ndarray or is
None, since 'skipna' itself should be a boolean | If 'Series.argmin' is called via the 'numpy' library, the third parameter
in its signature is 'out', which takes either an ndarray or 'None', so
check if the 'skipna' parameter is either an instance of ndarray or is
None, since 'skipna' itself should be a boolean | [
"If",
"Series",
".",
"argmin",
"is",
"called",
"via",
"the",
"numpy",
"library",
"the",
"third",
"parameter",
"in",
"its",
"signature",
"is",
"out",
"which",
"takes",
"either",
"an",
"ndarray",
"or",
"None",
"so",
"check",
"if",
"the",
"skipna",
"parameter... | def validate_argmin_with_skipna(skipna, args, kwargs):
"""
If 'Series.argmin' is called via the 'numpy' library, the third parameter
in its signature is 'out', which takes either an ndarray or 'None', so
check if the 'skipna' parameter is either an instance of ndarray or is
None, since 'skipna' itse... | [
"def",
"validate_argmin_with_skipna",
"(",
"skipna",
",",
"args",
",",
"kwargs",
")",
":",
"skipna",
",",
"args",
"=",
"process_skipna",
"(",
"skipna",
",",
"args",
")",
"validate_argmin",
"(",
"args",
",",
"kwargs",
")",
"return",
"skipna"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/compat/numpy/function.py#L95-L104 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mailbox.py | python | MH.remove_folder | (self, folder) | Delete the named folder, which must be empty. | Delete the named folder, which must be empty. | [
"Delete",
"the",
"named",
"folder",
"which",
"must",
"be",
"empty",
"."
] | def remove_folder(self, folder):
"""Delete the named folder, which must be empty."""
path = os.path.join(self._path, folder)
entries = os.listdir(path)
if entries == ['.mh_sequences']:
os.remove(os.path.join(path, '.mh_sequences'))
elif entries == []:
pass... | [
"def",
"remove_folder",
"(",
"self",
",",
"folder",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"folder",
")",
"entries",
"=",
"os",
".",
"listdir",
"(",
"path",
")",
"if",
"entries",
"==",
"[",
"'.mh_sequ... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mailbox.py#L1110-L1120 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/mixture/base.py | python | BaseMixture._estimate_log_prob | (self, X) | Estimate the log-probabilities log P(X | Z).
Compute the log-probabilities per each component for each sample.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Returns
-------
log_prob : array, shape (n_samples, n_component) | Estimate the log-probabilities log P(X | Z). | [
"Estimate",
"the",
"log",
"-",
"probabilities",
"log",
"P",
"(",
"X",
"|",
"Z",
")",
"."
] | def _estimate_log_prob(self, X):
"""Estimate the log-probabilities log P(X | Z).
Compute the log-probabilities per each component for each sample.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Returns
-------
log_prob : array, shap... | [
"def",
"_estimate_log_prob",
"(",
"self",
",",
"X",
")",
":",
"pass"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/mixture/base.py#L435-L448 | ||
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/internal/python_message.py | python | GeneratedProtocolMessageType.__init__ | (cls, name, bases, dictionary) | Here we perform the majority of our work on the class.
We add enum getters, an __init__ method, implementations
of all Message methods, and properties for all fields
in the protocol type.
Args:
name: Name of the class (ignored, but required by the
metaclass protocol).
bases: Base cl... | Here we perform the majority of our work on the class.
We add enum getters, an __init__ method, implementations
of all Message methods, and properties for all fields
in the protocol type. | [
"Here",
"we",
"perform",
"the",
"majority",
"of",
"our",
"work",
"on",
"the",
"class",
".",
"We",
"add",
"enum",
"getters",
"an",
"__init__",
"method",
"implementations",
"of",
"all",
"Message",
"methods",
"and",
"properties",
"for",
"all",
"fields",
"in",
... | def __init__(cls, name, bases, dictionary):
"""Here we perform the majority of our work on the class.
We add enum getters, an __init__ method, implementations
of all Message methods, and properties for all fields
in the protocol type.
Args:
name: Name of the class (ignored, but required by th... | [
"def",
"__init__",
"(",
"cls",
",",
"name",
",",
"bases",
",",
"dictionary",
")",
":",
"descriptor",
"=",
"dictionary",
"[",
"GeneratedProtocolMessageType",
".",
"_DESCRIPTOR_KEY",
"]",
"cls",
".",
"_decoders_by_tag",
"=",
"{",
"}",
"if",
"(",
"descriptor",
... | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/internal/python_message.py#L135-L173 | ||
nsnam/ns-3-dev-git | efdb2e21f45c0a87a60b47c547b68fa140a7b686 | utils/check-style.py | python | PatchChunk.__init__ | (self, src_pos, dst_pos) | ! Initializer
@param self: this object
@param src_pos: source position
@param dst_pos: destination position | ! Initializer | [
"!",
"Initializer"
] | def __init__(self, src_pos, dst_pos):
"""! Initializer
@param self: this object
@param src_pos: source position
@param dst_pos: destination position
"""
self.__lines = []
self.__src_pos = int(src_pos)
self.__dst_pos = int(dst_pos) | [
"def",
"__init__",
"(",
"self",
",",
"src_pos",
",",
"dst_pos",
")",
":",
"self",
".",
"__lines",
"=",
"[",
"]",
"self",
".",
"__src_pos",
"=",
"int",
"(",
"src_pos",
")",
"self",
".",
"__dst_pos",
"=",
"int",
"(",
"dst_pos",
")"
] | https://github.com/nsnam/ns-3-dev-git/blob/efdb2e21f45c0a87a60b47c547b68fa140a7b686/utils/check-style.py#L241-L249 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/dnsmasq.py | python | install_dnsmasq | (remote) | If dnsmasq is not installed, install it for the duration of the task. | If dnsmasq is not installed, install it for the duration of the task. | [
"If",
"dnsmasq",
"is",
"not",
"installed",
"install",
"it",
"for",
"the",
"duration",
"of",
"the",
"task",
"."
] | def install_dnsmasq(remote):
"""
If dnsmasq is not installed, install it for the duration of the task.
"""
try:
existing = packaging.get_package_version(remote, 'dnsmasq')
except:
existing = None
if existing is None:
packaging.install_package('dnsmasq', remote)
try:
... | [
"def",
"install_dnsmasq",
"(",
"remote",
")",
":",
"try",
":",
"existing",
"=",
"packaging",
".",
"get_package_version",
"(",
"remote",
",",
"'dnsmasq'",
")",
"except",
":",
"existing",
"=",
"None",
"if",
"existing",
"is",
"None",
":",
"packaging",
".",
"i... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/dnsmasq.py#L16-L31 | ||
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | dali/python/nvidia/dali/math.py | python | sinh | (input) | return _arithm_op("sinh", input) | Computes hyperbolic sine of values in ``input``.
:rtype: TensorList of sinh(input). If input is an integer, the result will be float,
otherwise the type is preserved. | Computes hyperbolic sine of values in ``input``. | [
"Computes",
"hyperbolic",
"sine",
"of",
"values",
"in",
"input",
"."
] | def sinh(input):
"""Computes hyperbolic sine of values in ``input``.
:rtype: TensorList of sinh(input). If input is an integer, the result will be float,
otherwise the type is preserved.
"""
return _arithm_op("sinh", input) | [
"def",
"sinh",
"(",
"input",
")",
":",
"return",
"_arithm_op",
"(",
"\"sinh\"",
",",
"input",
")"
] | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/dali/python/nvidia/dali/math.py#L160-L166 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | ctpx/ctp2/ctptd.py | python | CtpTd.onRspQryProductExchRate | (self, ProductExchRateField, RspInfoField, requestId, final) | 请求查询产品报价汇率 | 请求查询产品报价汇率 | [
"请求查询产品报价汇率"
] | def onRspQryProductExchRate(self, ProductExchRateField, RspInfoField, requestId, final):
"""请求查询产品报价汇率"""
pass | [
"def",
"onRspQryProductExchRate",
"(",
"self",
",",
"ProductExchRateField",
",",
"RspInfoField",
",",
"requestId",
",",
"final",
")",
":",
"pass"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/ctpx/ctp2/ctptd.py#L290-L292 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/compiler/xla/xla.py | python | is_flat | (outputs) | return True | Checks if outputs is a flat structure.
Following structures and values are considered flat:
1) None
2) A single object
3) A list or tuple of Tensors/Operations
The only structures that this function understands are sequences and
dictionaries. E.g. this means that if outputs contains a single
... | Checks if outputs is a flat structure. | [
"Checks",
"if",
"outputs",
"is",
"a",
"flat",
"structure",
"."
] | def is_flat(outputs):
"""Checks if outputs is a flat structure.
Following structures and values are considered flat:
1) None
2) A single object
3) A list or tuple of Tensors/Operations
The only structures that this function understands are sequences and
dictionaries. E.g. this means that if... | [
"def",
"is_flat",
"(",
"outputs",
")",
":",
"# If outputs is a list or tuple, check if it has any nested structure. If",
"# there is, then outputs is non-flat.",
"if",
"isinstance",
"(",
"outputs",
",",
"collections",
".",
"Sequence",
")",
":",
"for",
"o",
"in",
"outputs",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/compiler/xla/xla.py#L397-L429 | |
DGA-MI-SSI/YaCo | 9b85e6ca1809114c4df1382c11255f7e38408912 | deps/libxml2-2.7.8/python/libxml.py | python | SAXCallback.startDocument | (self) | called at the start of the document | called at the start of the document | [
"called",
"at",
"the",
"start",
"of",
"the",
"document"
] | def startDocument(self):
"""called at the start of the document"""
pass | [
"def",
"startDocument",
"(",
"self",
")",
":",
"pass"
] | https://github.com/DGA-MI-SSI/YaCo/blob/9b85e6ca1809114c4df1382c11255f7e38408912/deps/libxml2-2.7.8/python/libxml.py#L136-L138 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/financial.py | python | rate | (nper, pmt, pv, fv, when='end', guess=None, tol=None, maxiter=100) | Compute the rate of interest per period.
.. deprecated:: 1.18
`rate` is deprecated; for details, see NEP 32 [1]_.
Use the corresponding function in the numpy-financial library,
https://pypi.org/project/numpy-financial.
Parameters
----------
nper : array_like
Number of com... | Compute the rate of interest per period. | [
"Compute",
"the",
"rate",
"of",
"interest",
"per",
"period",
"."
] | def rate(nper, pmt, pv, fv, when='end', guess=None, tol=None, maxiter=100):
"""
Compute the rate of interest per period.
.. deprecated:: 1.18
`rate` is deprecated; for details, see NEP 32 [1]_.
Use the corresponding function in the numpy-financial library,
https://pypi.org/project/num... | [
"def",
"rate",
"(",
"nper",
",",
"pmt",
",",
"pv",
",",
"fv",
",",
"when",
"=",
"'end'",
",",
"guess",
"=",
"None",
",",
"tol",
"=",
"None",
",",
"maxiter",
"=",
"100",
")",
":",
"when",
"=",
"_convert_when",
"(",
"when",
")",
"default_type",
"="... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/financial.py#L658-L736 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.