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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/unpacking.py | python | has_leading_dir | (paths) | return True | Returns true if all the paths have the same leading path name
(i.e., everything is in one subdirectory in an archive) | Returns true if all the paths have the same leading path name
(i.e., everything is in one subdirectory in an archive) | [
"Returns",
"true",
"if",
"all",
"the",
"paths",
"have",
"the",
"same",
"leading",
"path",
"name",
"(",
"i",
".",
"e",
".",
"everything",
"is",
"in",
"one",
"subdirectory",
"in",
"an",
"archive",
")"
] | def has_leading_dir(paths):
# type: (Iterable[str]) -> bool
"""Returns true if all the paths have the same leading path name
(i.e., everything is in one subdirectory in an archive)"""
common_prefix = None
for path in paths:
prefix, rest = split_leading_dir(path)
if not prefix:
... | [
"def",
"has_leading_dir",
"(",
"paths",
")",
":",
"# type: (Iterable[str]) -> bool",
"common_prefix",
"=",
"None",
"for",
"path",
"in",
"paths",
":",
"prefix",
",",
"rest",
"=",
"split_leading_dir",
"(",
"path",
")",
"if",
"not",
"prefix",
":",
"return",
"Fals... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/unpacking.py#L69-L82 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/calendar.py | python | CalendarEvent.GetWeekDay | (*args, **kwargs) | return _calendar.CalendarEvent_GetWeekDay(*args, **kwargs) | GetWeekDay(self) -> int | GetWeekDay(self) -> int | [
"GetWeekDay",
"(",
"self",
")",
"-",
">",
"int"
] | def GetWeekDay(*args, **kwargs):
"""GetWeekDay(self) -> int"""
return _calendar.CalendarEvent_GetWeekDay(*args, **kwargs) | [
"def",
"GetWeekDay",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_calendar",
".",
"CalendarEvent_GetWeekDay",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/calendar.py#L202-L204 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/preprocessing/data.py | python | scale | (X, axis=0, with_mean=True, with_std=True, copy=True) | return X | Standardize a dataset along any axis
Center to the mean and component wise scale to unit variance.
Read more in the :ref:`User Guide <preprocessing_scaler>`.
Parameters
----------
X : {array-like, sparse matrix}
The data to center and scale.
axis : int (0 by default)
axis use... | Standardize a dataset along any axis | [
"Standardize",
"a",
"dataset",
"along",
"any",
"axis"
] | def scale(X, axis=0, with_mean=True, with_std=True, copy=True):
"""Standardize a dataset along any axis
Center to the mean and component wise scale to unit variance.
Read more in the :ref:`User Guide <preprocessing_scaler>`.
Parameters
----------
X : {array-like, sparse matrix}
The da... | [
"def",
"scale",
"(",
"X",
",",
"axis",
"=",
"0",
",",
"with_mean",
"=",
"True",
",",
"with_std",
"=",
"True",
",",
"copy",
"=",
"True",
")",
":",
"# noqa",
"X",
"=",
"check_array",
"(",
"X",
",",
"accept_sparse",
"=",
"'csc'",
",",
"copy",
"=",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/preprocessing/data.py#L80-L183 | |
numworks/epsilon | 8952d2f8b1de1c3f064eec8ffcea804c5594ba4c | build/device/usb/backend/__init__.py | python | IBackend.open_device | (self, dev) | r"""Open the device for data exchange.
This method opens the device identified by the dev parameter for communication.
This method must be called before calling any communication related method, such
as transfer methods.
It returns a handle identifying the communication instance. This ... | r"""Open the device for data exchange. | [
"r",
"Open",
"the",
"device",
"for",
"data",
"exchange",
"."
] | def open_device(self, dev):
r"""Open the device for data exchange.
This method opens the device identified by the dev parameter for communication.
This method must be called before calling any communication related method, such
as transfer methods.
It returns a handle identifyi... | [
"def",
"open_device",
"(",
"self",
",",
"dev",
")",
":",
"_not_implemented",
"(",
"self",
".",
"open_device",
")"
] | https://github.com/numworks/epsilon/blob/8952d2f8b1de1c3f064eec8ffcea804c5594ba4c/build/device/usb/backend/__init__.py#L168-L178 | ||
mhammond/pywin32 | 44afd86ba8485194df93234639243252deeb40d5 | com/win32comext/axscript/client/framework.py | python | EventSink.GetSourceTypeInfo | (self, typeinfo) | Gets the typeinfo for the Source Events for the passed typeinfo | Gets the typeinfo for the Source Events for the passed typeinfo | [
"Gets",
"the",
"typeinfo",
"for",
"the",
"Source",
"Events",
"for",
"the",
"passed",
"typeinfo"
] | def GetSourceTypeInfo(self, typeinfo):
"""Gets the typeinfo for the Source Events for the passed typeinfo"""
attr = typeinfo.GetTypeAttr()
cFuncs = attr[6]
typeKind = attr[5]
if typeKind not in [pythoncom.TKIND_COCLASS, pythoncom.TKIND_INTERFACE]:
RaiseAssert(
... | [
"def",
"GetSourceTypeInfo",
"(",
"self",
",",
"typeinfo",
")",
":",
"attr",
"=",
"typeinfo",
".",
"GetTypeAttr",
"(",
")",
"cFuncs",
"=",
"attr",
"[",
"6",
"]",
"typeKind",
"=",
"attr",
"[",
"5",
"]",
"if",
"typeKind",
"not",
"in",
"[",
"pythoncom",
... | https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/com/win32comext/axscript/client/framework.py#L213-L235 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | ClientDC.__init__ | (self, *args, **kwargs) | __init__(self, Window win) -> ClientDC
Constructor. Pass the window on which you wish to paint. | __init__(self, Window win) -> ClientDC | [
"__init__",
"(",
"self",
"Window",
"win",
")",
"-",
">",
"ClientDC"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, Window win) -> ClientDC
Constructor. Pass the window on which you wish to paint.
"""
_gdi_.ClientDC_swiginit(self,_gdi_.new_ClientDC(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gdi_",
".",
"ClientDC_swiginit",
"(",
"self",
",",
"_gdi_",
".",
"new_ClientDC",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L5094-L5100 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | NativePixelData_Accessor.MoveTo | (*args, **kwargs) | return _gdi_.NativePixelData_Accessor_MoveTo(*args, **kwargs) | MoveTo(self, NativePixelData data, int x, int y) | MoveTo(self, NativePixelData data, int x, int y) | [
"MoveTo",
"(",
"self",
"NativePixelData",
"data",
"int",
"x",
"int",
"y",
")"
] | def MoveTo(*args, **kwargs):
"""MoveTo(self, NativePixelData data, int x, int y)"""
return _gdi_.NativePixelData_Accessor_MoveTo(*args, **kwargs) | [
"def",
"MoveTo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"NativePixelData_Accessor_MoveTo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1112-L1114 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | ExFileObject.__iter__ | (self) | Get an iterator over the file's lines. | Get an iterator over the file's lines. | [
"Get",
"an",
"iterator",
"over",
"the",
"file",
"s",
"lines",
"."
] | def __iter__(self):
"""Get an iterator over the file's lines.
"""
while True:
line = self.readline()
if not line:
break
yield line | [
"def",
"__iter__",
"(",
"self",
")",
":",
"while",
"True",
":",
"line",
"=",
"self",
".",
"readline",
"(",
")",
"if",
"not",
"line",
":",
"break",
"yield",
"line"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L1819-L1833 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/elementwise/logistic.py | python | logistic.numeric | (self, values) | return np.logaddexp(0, values[0]) | Evaluates e^x elementwise, adds 1, and takes the log. | Evaluates e^x elementwise, adds 1, and takes the log. | [
"Evaluates",
"e^x",
"elementwise",
"adds",
"1",
"and",
"takes",
"the",
"log",
"."
] | def numeric(self, values):
"""Evaluates e^x elementwise, adds 1, and takes the log.
"""
return np.logaddexp(0, values[0]) | [
"def",
"numeric",
"(",
"self",
",",
"values",
")",
":",
"return",
"np",
".",
"logaddexp",
"(",
"0",
",",
"values",
"[",
"0",
"]",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/elementwise/logistic.py#L35-L38 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | examples/python/dict_utils.py | python | LookupDictionary.get_first_key_for_value | (self, value, fail_value=None) | return fail_value | return the first key of this dictionary given the value | return the first key of this dictionary given the value | [
"return",
"the",
"first",
"key",
"of",
"this",
"dictionary",
"given",
"the",
"value"
] | def get_first_key_for_value(self, value, fail_value=None):
"""return the first key of this dictionary given the value"""
list_result = [item[0] for item in self.items() if item[1] == value]
if len(list_result) > 0:
return list_result[0]
return fail_value | [
"def",
"get_first_key_for_value",
"(",
"self",
",",
"value",
",",
"fail_value",
"=",
"None",
")",
":",
"list_result",
"=",
"[",
"item",
"[",
"0",
"]",
"for",
"item",
"in",
"self",
".",
"items",
"(",
")",
"if",
"item",
"[",
"1",
"]",
"==",
"value",
... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/examples/python/dict_utils.py#L18-L23 | |
arkenthera/electron-vibrancy | 383153ef9ccb23a6c7517150d6bb0794dff3115e | scripts/cpplint.py | python | IsInitializerList | (clean_lines, linenum) | return False | Check if current line is inside constructor initializer list.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line appears to be inside constructor initializer
list, False otherwise. | Check if current line is inside constructor initializer list. | [
"Check",
"if",
"current",
"line",
"is",
"inside",
"constructor",
"initializer",
"list",
"."
] | def IsInitializerList(clean_lines, linenum):
"""Check if current line is inside constructor initializer list.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line appears to be inside constructor initializer
list,... | [
"def",
"IsInitializerList",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"linenum",
",",
"1",
",",
"-",
"1",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"i",
"]",
"if",
"i",
"==",
"linenum",
":",
"rem... | https://github.com/arkenthera/electron-vibrancy/blob/383153ef9ccb23a6c7517150d6bb0794dff3115e/scripts/cpplint.py#L4529-L4568 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/dummy_thread.py | python | exit | () | Dummy implementation of thread.exit(). | Dummy implementation of thread.exit(). | [
"Dummy",
"implementation",
"of",
"thread",
".",
"exit",
"()",
"."
] | def exit():
"""Dummy implementation of thread.exit()."""
raise SystemExit | [
"def",
"exit",
"(",
")",
":",
"raise",
"SystemExit"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/dummy_thread.py#L58-L60 | ||
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/namespace.py | python | namespace_t.free_operator | (
self,
name=None,
function=None,
symbol=None,
return_type=None,
arg_types=None,
header_dir=None,
header_file=None,
recursive=None) | return (
self._find_single(
scopedef.scopedef_t._impl_matchers[namespace_t.free_operator],
name=self._build_operator_name(name, function, symbol),
symbol=symbol,
function=self._build_operator_function(name, function),
decl_type=... | Returns reference to free operator declaration that matches
a defined criteria. | Returns reference to free operator declaration that matches
a defined criteria. | [
"Returns",
"reference",
"to",
"free",
"operator",
"declaration",
"that",
"matches",
"a",
"defined",
"criteria",
"."
] | def free_operator(
self,
name=None,
function=None,
symbol=None,
return_type=None,
arg_types=None,
header_dir=None,
header_file=None,
recursive=None):
"""
Returns reference to free operator declara... | [
"def",
"free_operator",
"(",
"self",
",",
"name",
"=",
"None",
",",
"function",
"=",
"None",
",",
"symbol",
"=",
"None",
",",
"return_type",
"=",
"None",
",",
"arg_types",
"=",
"None",
",",
"header_dir",
"=",
"None",
",",
"header_file",
"=",
"None",
",... | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/namespace.py#L203-L230 | |
merryhime/dynarmic | a8cbfd9af4f3f3cdad6efcd067e76edec76c1338 | externals/vixl/vixl/tools/verify_assembler_traces.py | python | ConvertToLLVMFormat | (vixl_instruction, triple) | Take an string representing an instruction and convert it to assembly syntax
for LLVM. VIXL's test generation framework will print instruction
representations as a space seperated list. The first element is the mnemonic
and the following elements are operands. | Take an string representing an instruction and convert it to assembly syntax
for LLVM. VIXL's test generation framework will print instruction
representations as a space seperated list. The first element is the mnemonic
and the following elements are operands. | [
"Take",
"an",
"string",
"representing",
"an",
"instruction",
"and",
"convert",
"it",
"to",
"assembly",
"syntax",
"for",
"LLVM",
".",
"VIXL",
"s",
"test",
"generation",
"framework",
"will",
"print",
"instruction",
"representations",
"as",
"a",
"space",
"seperated... | def ConvertToLLVMFormat(vixl_instruction, triple):
"""
Take an string representing an instruction and convert it to assembly syntax
for LLVM. VIXL's test generation framework will print instruction
representations as a space seperated list. The first element is the mnemonic
and the following elements are oper... | [
"def",
"ConvertToLLVMFormat",
"(",
"vixl_instruction",
",",
"triple",
")",
":",
"def",
"DtUntypedToLLVM",
"(",
"matches",
")",
":",
"dt",
"=",
"\"\"",
"if",
"matches",
"[",
"1",
"]",
"==",
"\"untyped8\"",
":",
"dt",
"=",
"\"8\"",
"elif",
"matches",
"[",
... | https://github.com/merryhime/dynarmic/blob/a8cbfd9af4f3f3cdad6efcd067e76edec76c1338/externals/vixl/vixl/tools/verify_assembler_traces.py#L135-L337 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PropertyGridPopulator.SetState | (*args, **kwargs) | return _propgrid.PropertyGridPopulator_SetState(*args, **kwargs) | SetState(self, state) | SetState(self, state) | [
"SetState",
"(",
"self",
"state",
")"
] | def SetState(*args, **kwargs):
"""SetState(self, state)"""
return _propgrid.PropertyGridPopulator_SetState(*args, **kwargs) | [
"def",
"SetState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridPopulator_SetState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L2578-L2580 | |
google/mozc | 7329757e1ad30e327c1ae823a8302c79482d6b9c | src/build_tools/zlib_util.py | python | _Write | (buf, filename) | Writes a buffer to a file in binary mode. | Writes a buffer to a file in binary mode. | [
"Writes",
"a",
"buffer",
"to",
"a",
"file",
"in",
"binary",
"mode",
"."
] | def _Write(buf, filename):
"""Writes a buffer to a file in binary mode."""
with open(filename, 'wb') as f:
f.write(buf) | [
"def",
"_Write",
"(",
"buf",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"buf",
")"
] | https://github.com/google/mozc/blob/7329757e1ad30e327c1ae823a8302c79482d6b9c/src/build_tools/zlib_util.py#L45-L48 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | CheckBox.Create | (*args, **kwargs) | return _controls_.CheckBox_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, String label=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, Validator validator=DefaultValidator,
String name=CheckBoxNameStr) -> bool
Actually create the GUI CheckBox for 2-phase creation. | Create(self, Window parent, int id=-1, String label=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, Validator validator=DefaultValidator,
String name=CheckBoxNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"String",
"label",
"=",
"EmptyString",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"0",
"Validator",
"validator",
"=",
"DefaultValida... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, String label=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, Validator validator=DefaultValidator,
String name=CheckBoxNameStr) -> bool
Actually create the... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"CheckBox_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L356-L365 | |
bundy-dns/bundy | 3d41934996b82b0cd2fe22dd74d2abc1daba835d | src/lib/python/bundy/ddns/session.py | python | UpdateSession.__validate_error | (self, reason) | Used as error callback below. | Used as error callback below. | [
"Used",
"as",
"error",
"callback",
"below",
"."
] | def __validate_error(self, reason):
'''
Used as error callback below.
'''
logger.error(LIBDDNS_ZONE_INVALID_ERROR, self.__zname, self.__zclass,
reason) | [
"def",
"__validate_error",
"(",
"self",
",",
"reason",
")",
":",
"logger",
".",
"error",
"(",
"LIBDDNS_ZONE_INVALID_ERROR",
",",
"self",
".",
"__zname",
",",
"self",
".",
"__zclass",
",",
"reason",
")"
] | https://github.com/bundy-dns/bundy/blob/3d41934996b82b0cd2fe22dd74d2abc1daba835d/src/lib/python/bundy/ddns/session.py#L819-L824 | ||
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | hasher-matcher-actioner/hmalib/scripts/populate_config_db.py | python | load_defaults | (_args) | Load a hardcoded set of defaults which are useful in testing | Load a hardcoded set of defaults which are useful in testing | [
"Load",
"a",
"hardcoded",
"set",
"of",
"defaults",
"which",
"are",
"useful",
"in",
"testing"
] | def load_defaults(_args):
"""
Load a hardcoded set of defaults which are useful in testing
"""
# Could also put the default on the class, but seems too fancy
configs = [
ThreatExchangeConfig(
name="303636684709969",
fetcher_active=True,
privacy_group_nam... | [
"def",
"load_defaults",
"(",
"_args",
")",
":",
"# Could also put the default on the class, but seems too fancy",
"configs",
"=",
"[",
"ThreatExchangeConfig",
"(",
"name",
"=",
"\"303636684709969\"",
",",
"fetcher_active",
"=",
"True",
",",
"privacy_group_name",
"=",
"\"T... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/hasher-matcher-actioner/hmalib/scripts/populate_config_db.py#L69-L156 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/distributions/python/ops/negative_binomial.py | python | NegativeBinomial.logits | (self) | return self._logits | Log-odds of a `1` outcome (vs `0`). | Log-odds of a `1` outcome (vs `0`). | [
"Log",
"-",
"odds",
"of",
"a",
"1",
"outcome",
"(",
"vs",
"0",
")",
"."
] | def logits(self):
"""Log-odds of a `1` outcome (vs `0`)."""
return self._logits | [
"def",
"logits",
"(",
"self",
")",
":",
"return",
"self",
".",
"_logits"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/distributions/python/ops/negative_binomial.py#L116-L118 | |
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/text_format.py | python | Tokenizer.ParseError | (self, message) | return ParseError(message, self._line + 1, self._column + 1) | Creates and *returns* a ParseError for the current token. | Creates and *returns* a ParseError for the current token. | [
"Creates",
"and",
"*",
"returns",
"*",
"a",
"ParseError",
"for",
"the",
"current",
"token",
"."
] | def ParseError(self, message):
"""Creates and *returns* a ParseError for the current token."""
return ParseError(message, self._line + 1, self._column + 1) | [
"def",
"ParseError",
"(",
"self",
",",
"message",
")",
":",
"return",
"ParseError",
"(",
"message",
",",
"self",
".",
"_line",
"+",
"1",
",",
"self",
".",
"_column",
"+",
"1",
")"
] | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/text_format.py#L1219-L1221 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/third_party/Python/module/six/six.py | python | add_metaclass | (metaclass) | return wrapper | Class decorator for creating a class with a metaclass. | Class decorator for creating a class with a metaclass. | [
"Class",
"decorator",
"for",
"creating",
"a",
"class",
"with",
"a",
"metaclass",
"."
] | def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if slots is not None:
if isinstance(slots, str):
slots = [slots]
for slo... | [
"def",
"add_metaclass",
"(",
"metaclass",
")",
":",
"def",
"wrapper",
"(",
"cls",
")",
":",
"orig_vars",
"=",
"cls",
".",
"__dict__",
".",
"copy",
"(",
")",
"slots",
"=",
"orig_vars",
".",
"get",
"(",
"'__slots__'",
")",
"if",
"slots",
"is",
"not",
"... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/third_party/Python/module/six/six.py#L831-L844 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextObject.SetPosition | (*args, **kwargs) | return _richtext.RichTextObject_SetPosition(*args, **kwargs) | SetPosition(self, Point pos) | SetPosition(self, Point pos) | [
"SetPosition",
"(",
"self",
"Point",
"pos",
")"
] | def SetPosition(*args, **kwargs):
"""SetPosition(self, Point pos)"""
return _richtext.RichTextObject_SetPosition(*args, **kwargs) | [
"def",
"SetPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextObject_SetPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L1297-L1299 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/trajectory.py | python | GeodesicHermiteTrajectory.eval | (self,t,endBehavior='halt') | return res[:len(res)//2] | Evaluates the configuration at time t | Evaluates the configuration at time t | [
"Evaluates",
"the",
"configuration",
"at",
"time",
"t"
] | def eval(self,t,endBehavior='halt'):
"""Evaluates the configuration at time t"""
self._skip_deriv = True
res = Trajectory.eval_state(self,t,endBehavior)
self._skip_deriv = False
return res[:len(res)//2] | [
"def",
"eval",
"(",
"self",
",",
"t",
",",
"endBehavior",
"=",
"'halt'",
")",
":",
"self",
".",
"_skip_deriv",
"=",
"True",
"res",
"=",
"Trajectory",
".",
"eval_state",
"(",
"self",
",",
"t",
",",
"endBehavior",
")",
"self",
".",
"_skip_deriv",
"=",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/trajectory.py#L1236-L1241 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/framework.py | python | cuda_places | (device_ids=None) | return [core.CUDAPlace(dev_id) for dev_id in device_ids] | **Note**:
For multi-card tasks, please use `FLAGS_selected_gpus` environment variable to set the visible GPU device.
The next version will fix the problem with `CUDA_VISIBLE_DEVICES` environment variable.
This function creates a list of :code:`paddle.CUDAPlace` objects.
If :code:`device_ids` i... | **Note**:
For multi-card tasks, please use `FLAGS_selected_gpus` environment variable to set the visible GPU device.
The next version will fix the problem with `CUDA_VISIBLE_DEVICES` environment variable. | [
"**",
"Note",
"**",
":",
"For",
"multi",
"-",
"card",
"tasks",
"please",
"use",
"FLAGS_selected_gpus",
"environment",
"variable",
"to",
"set",
"the",
"visible",
"GPU",
"device",
".",
"The",
"next",
"version",
"will",
"fix",
"the",
"problem",
"with",
"CUDA_VI... | def cuda_places(device_ids=None):
"""
**Note**:
For multi-card tasks, please use `FLAGS_selected_gpus` environment variable to set the visible GPU device.
The next version will fix the problem with `CUDA_VISIBLE_DEVICES` environment variable.
This function creates a list of :code:`paddle.CU... | [
"def",
"cuda_places",
"(",
"device_ids",
"=",
"None",
")",
":",
"assert",
"core",
".",
"is_compiled_with_cuda",
"(",
")",
",",
"\"Not compiled with CUDA\"",
"if",
"device_ids",
"is",
"None",
":",
"device_ids",
"=",
"_cuda_ids",
"(",
")",
"elif",
"not",
"isinst... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/framework.py#L619-L664 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Log.SetVerbose | (*args, **kwargs) | return _misc_.Log_SetVerbose(*args, **kwargs) | SetVerbose(bool bVerbose=True) | SetVerbose(bool bVerbose=True) | [
"SetVerbose",
"(",
"bool",
"bVerbose",
"=",
"True",
")"
] | def SetVerbose(*args, **kwargs):
"""SetVerbose(bool bVerbose=True)"""
return _misc_.Log_SetVerbose(*args, **kwargs) | [
"def",
"SetVerbose",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Log_SetVerbose",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L1496-L1498 | |
EricLYang/courseRepo | 60679ec7ec130fe0cff9d26b704f1e286e5fde13 | 1_Introduction/build/catkin_generated/installspace/_setup_util.py | python | prepend_env_variables | (environ, env_var_subfolders, workspaces) | return lines | Generate shell code to prepend environment variables
for the all workspaces. | Generate shell code to prepend environment variables
for the all workspaces. | [
"Generate",
"shell",
"code",
"to",
"prepend",
"environment",
"variables",
"for",
"the",
"all",
"workspaces",
"."
] | def prepend_env_variables(environ, env_var_subfolders, workspaces):
'''
Generate shell code to prepend environment variables
for the all workspaces.
'''
lines = []
lines.append(comment('prepend folders of workspaces to environment variables'))
paths = [path for path in workspaces.split(os.p... | [
"def",
"prepend_env_variables",
"(",
"environ",
",",
"env_var_subfolders",
",",
"workspaces",
")",
":",
"lines",
"=",
"[",
"]",
"lines",
".",
"append",
"(",
"comment",
"(",
"'prepend folders of workspaces to environment variables'",
")",
")",
"paths",
"=",
"[",
"p... | https://github.com/EricLYang/courseRepo/blob/60679ec7ec130fe0cff9d26b704f1e286e5fde13/1_Introduction/build/catkin_generated/installspace/_setup_util.py#L130-L147 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/profileapp.py | python | ProfileList._print_profiles | (self, profiles) | print list of profiles, indented. | print list of profiles, indented. | [
"print",
"list",
"of",
"profiles",
"indented",
"."
] | def _print_profiles(self, profiles):
"""print list of profiles, indented."""
for profile in profiles:
print(' %s' % profile) | [
"def",
"_print_profiles",
"(",
"self",
",",
"profiles",
")",
":",
"for",
"profile",
"in",
"profiles",
":",
"print",
"(",
"' %s'",
"%",
"profile",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/profileapp.py#L159-L162 | ||
lighttransport/nanort | 74063967336311f54ede5dffdfa242123825033b | deps/cpplint.py | python | CheckForFunctionLengths | (filename, clean_lines, linenum,
function_state, error) | Reports for long function bodies.
For an overview why this is done, see:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Only checks unindented functions, so class members are ... | Reports for long function bodies. | [
"Reports",
"for",
"long",
"function",
"bodies",
"."
] | def CheckForFunctionLengths(filename, clean_lines, linenum,
function_state, error):
"""Reports for long function bodies.
For an overview why this is done, see:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming ... | [
"def",
"CheckForFunctionLengths",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"function_state",
",",
"error",
")",
":",
"lines",
"=",
"clean_lines",
".",
"lines",
"line",
"=",
"lines",
"[",
"linenum",
"]",
"joined_line",
"=",
"''",
"starting_func... | https://github.com/lighttransport/nanort/blob/74063967336311f54ede5dffdfa242123825033b/deps/cpplint.py#L2842-L2907 | ||
citizenfx/fivem | 88276d40cc7baf8285d02754cc5ae42ec7a8563f | vendor/chromium/base/android/jni_generator/jni_generator.py | python | JavaTypeToProxyCast | (java_type) | return 'Object' + java_type[len(raw_type):] | Maps from a java type to the type used by the native proxy GEN_JNI class | Maps from a java type to the type used by the native proxy GEN_JNI class | [
"Maps",
"from",
"a",
"java",
"type",
"to",
"the",
"type",
"used",
"by",
"the",
"native",
"proxy",
"GEN_JNI",
"class"
] | def JavaTypeToProxyCast(java_type):
"""Maps from a java type to the type used by the native proxy GEN_JNI class"""
# All the types and array types of JAVA_TYPE_MAP become jobjectArray across
# jni but they still need to be passed as the original type on the java side.
raw_type = java_type.rstrip('[]')
if raw_... | [
"def",
"JavaTypeToProxyCast",
"(",
"java_type",
")",
":",
"# All the types and array types of JAVA_TYPE_MAP become jobjectArray across",
"# jni but they still need to be passed as the original type on the java side.",
"raw_type",
"=",
"java_type",
".",
"rstrip",
"(",
"'[]'",
")",
"if... | https://github.com/citizenfx/fivem/blob/88276d40cc7baf8285d02754cc5ae42ec7a8563f/vendor/chromium/base/android/jni_generator/jni_generator.py#L201-L210 | |
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | src/EnergyPlus/api/runtime.py | python | Runtime.callback_progress | (self, state: c_void_p, f: FunctionType) | This function allows a client to register a function to be called back by EnergyPlus at the end of each
day with a progress (percentage) indicator
:param state: An active EnergyPlus "state" that is returned from a call to `api.state_manager.new_state()`.
:param f: A python function which takes ... | This function allows a client to register a function to be called back by EnergyPlus at the end of each
day with a progress (percentage) indicator | [
"This",
"function",
"allows",
"a",
"client",
"to",
"register",
"a",
"function",
"to",
"be",
"called",
"back",
"by",
"EnergyPlus",
"at",
"the",
"end",
"of",
"each",
"day",
"with",
"a",
"progress",
"(",
"percentage",
")",
"indicator"
] | def callback_progress(self, state: c_void_p, f: FunctionType) -> None:
"""
This function allows a client to register a function to be called back by EnergyPlus at the end of each
day with a progress (percentage) indicator
:param state: An active EnergyPlus "state" that is returned from ... | [
"def",
"callback_progress",
"(",
"self",
",",
"state",
":",
"c_void_p",
",",
"f",
":",
"FunctionType",
")",
"->",
"None",
":",
"self",
".",
"_check_callback_args",
"(",
"f",
",",
"1",
",",
"'callback_progress'",
")",
"cb_ptr",
"=",
"self",
".",
"py_progres... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/src/EnergyPlus/api/runtime.py#L300-L312 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | ShouldCheckNamespaceIndentation | (nesting_state, is_namespace_indent_item,
raw_lines_no_comments, linenum) | return IsBlockInNameSpace(nesting_state, is_forward_declaration) | This method determines if we should apply our namespace indentation check.
Args:
nesting_state: The current nesting state.
is_namespace_indent_item: If we just put a new class on the stack, True.
If the top of the stack is not a class, or we did not recently
add the class, False.
raw_lines_no... | This method determines if we should apply our namespace indentation check. | [
"This",
"method",
"determines",
"if",
"we",
"should",
"apply",
"our",
"namespace",
"indentation",
"check",
"."
] | def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item,
raw_lines_no_comments, linenum):
"""This method determines if we should apply our namespace indentation check.
Args:
nesting_state: The current nesting state.
is_namespace_indent_item: If we jus... | [
"def",
"ShouldCheckNamespaceIndentation",
"(",
"nesting_state",
",",
"is_namespace_indent_item",
",",
"raw_lines_no_comments",
",",
"linenum",
")",
":",
"is_forward_declaration",
"=",
"IsForwardClassDeclaration",
"(",
"raw_lines_no_comments",
",",
"linenum",
")",
"if",
"not... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L5739-L5766 | |
nektra/Deviare-InProc | e88b91afff32b773b10deeb82a928c6d4af1a9c2 | NktHookLib/Src/libudis86/source/scripts/ud_opcode.py | python | UdOpcodeTables.map | (self, tbl, opcodes, obj) | Create a mapping from a given string of opcodes to an
object in the opcode trie. Constructs trie branches as
needed. | Create a mapping from a given string of opcodes to an
object in the opcode trie. Constructs trie branches as
needed. | [
"Create",
"a",
"mapping",
"from",
"a",
"given",
"string",
"of",
"opcodes",
"to",
"an",
"object",
"in",
"the",
"opcode",
"trie",
".",
"Constructs",
"trie",
"branches",
"as",
"needed",
"."
] | def map(self, tbl, opcodes, obj):
"""Create a mapping from a given string of opcodes to an
object in the opcode trie. Constructs trie branches as
needed.
"""
opc = opcodes[0]
e = tbl.lookup(opc)
if e is None:
tbl.add(opc, self.mkTrie(opcodes[1... | [
"def",
"map",
"(",
"self",
",",
"tbl",
",",
"opcodes",
",",
"obj",
")",
":",
"opc",
"=",
"opcodes",
"[",
"0",
"]",
"e",
"=",
"tbl",
".",
"lookup",
"(",
"opc",
")",
"if",
"e",
"is",
"None",
":",
"tbl",
".",
"add",
"(",
"opc",
",",
"self",
".... | https://github.com/nektra/Deviare-InProc/blob/e88b91afff32b773b10deeb82a928c6d4af1a9c2/NktHookLib/Src/libudis86/source/scripts/ud_opcode.py#L292-L304 | ||
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/gt_single_data_layer/minibatch.py | python | get_minibatch | (roidb, voxelizer, extents) | return blobs | Given a roidb, construct a minibatch sampled from it. | Given a roidb, construct a minibatch sampled from it. | [
"Given",
"a",
"roidb",
"construct",
"a",
"minibatch",
"sampled",
"from",
"it",
"."
] | def get_minibatch(roidb, voxelizer, extents):
"""Given a roidb, construct a minibatch sampled from it."""
num_images = len(roidb)
# Get the input image blob, formatted for tensorflow
random_scale_ind = npr.randint(0, high=len(cfg.TRAIN.SCALES_BASE))
im_blob, im_rescale_blob, im_depth_blob, im_norma... | [
"def",
"get_minibatch",
"(",
"roidb",
",",
"voxelizer",
",",
"extents",
")",
":",
"num_images",
"=",
"len",
"(",
"roidb",
")",
"# Get the input image blob, formatted for tensorflow",
"random_scale_ind",
"=",
"npr",
".",
"randint",
"(",
"0",
",",
"high",
"=",
"le... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/gt_single_data_layer/minibatch.py#L22-L51 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/dist/commands.py | python | build_apps.copy_dependencies | (self, target_path, target_dir, search_path, referenced_by) | Copies the dependencies of target_path into target_dir. | Copies the dependencies of target_path into target_dir. | [
"Copies",
"the",
"dependencies",
"of",
"target_path",
"into",
"target_dir",
"."
] | def copy_dependencies(self, target_path, target_dir, search_path, referenced_by):
""" Copies the dependencies of target_path into target_dir. """
fp = open(target_path, 'rb+')
# What kind of magic does the file contain?
deps = []
magic = fp.read(4)
if magic.startswith(b... | [
"def",
"copy_dependencies",
"(",
"self",
",",
"target_path",
",",
"target_dir",
",",
"search_path",
",",
"referenced_by",
")",
":",
"fp",
"=",
"open",
"(",
"target_path",
",",
"'rb+'",
")",
"# What kind of magic does the file contain?",
"deps",
"=",
"[",
"]",
"m... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/dist/commands.py#L1385-L1424 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/io.py | python | IOBase.readlines | (self, hint=None) | return lines | Return a list of lines from the stream.
hint can be specified to control the number of lines read: no more
lines will be read if the total size (in bytes/characters) of all
lines so far exceeds hint. | Return a list of lines from the stream. | [
"Return",
"a",
"list",
"of",
"lines",
"from",
"the",
"stream",
"."
] | def readlines(self, hint=None):
"""Return a list of lines from the stream.
hint can be specified to control the number of lines read: no more
lines will be read if the total size (in bytes/characters) of all
lines so far exceeds hint.
"""
if hint is None:
hin... | [
"def",
"readlines",
"(",
"self",
",",
"hint",
"=",
"None",
")",
":",
"if",
"hint",
"is",
"None",
":",
"hint",
"=",
"-",
"1",
"if",
"not",
"isinstance",
"(",
"hint",
",",
"(",
"int",
",",
"long",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"hint m... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/io.py#L538-L558 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/calendar.py | python | GenericCalendarCtrl.GetYearControl | (*args, **kwargs) | return _calendar.GenericCalendarCtrl_GetYearControl(*args, **kwargs) | GetYearControl(self) -> Control
Get the currently shown control for year. | GetYearControl(self) -> Control | [
"GetYearControl",
"(",
"self",
")",
"-",
">",
"Control"
] | def GetYearControl(*args, **kwargs):
"""
GetYearControl(self) -> Control
Get the currently shown control for year.
"""
return _calendar.GenericCalendarCtrl_GetYearControl(*args, **kwargs) | [
"def",
"GetYearControl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_calendar",
".",
"GenericCalendarCtrl_GetYearControl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/calendar.py#L565-L571 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py | python | GenerateCopyrightHeader | () | return COPYRIGHT_HEADER_TEMPLATE % datetime.date.today().year | Generates the copyright header for JavaScript code. | Generates the copyright header for JavaScript code. | [
"Generates",
"the",
"copyright",
"header",
"for",
"JavaScript",
"code",
"."
] | def GenerateCopyrightHeader():
"""Generates the copyright header for JavaScript code."""
return COPYRIGHT_HEADER_TEMPLATE % datetime.date.today().year | [
"def",
"GenerateCopyrightHeader",
"(",
")",
":",
"return",
"COPYRIGHT_HEADER_TEMPLATE",
"%",
"datetime",
".",
"date",
".",
"today",
"(",
")",
".",
"year"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py#L439-L441 | |
manticoresoftware/manticoresearch | f675d16267543d934ce84074f087d13496ec462c | api/sphinxapi.py | python | SphinxClient.SetMaxQueryTime | (self, maxquerytime) | Set maximum query time, in milliseconds, per-index. 0 means 'do not limit'. | Set maximum query time, in milliseconds, per-index. 0 means 'do not limit'. | [
"Set",
"maximum",
"query",
"time",
"in",
"milliseconds",
"per",
"-",
"index",
".",
"0",
"means",
"do",
"not",
"limit",
"."
] | def SetMaxQueryTime (self, maxquerytime):
"""
Set maximum query time, in milliseconds, per-index. 0 means 'do not limit'.
"""
assert(isinstance(maxquerytime,int) and maxquerytime>0)
self._maxquerytime = maxquerytime | [
"def",
"SetMaxQueryTime",
"(",
"self",
",",
"maxquerytime",
")",
":",
"assert",
"(",
"isinstance",
"(",
"maxquerytime",
",",
"int",
")",
"and",
"maxquerytime",
">",
"0",
")",
"self",
".",
"_maxquerytime",
"=",
"maxquerytime"
] | https://github.com/manticoresoftware/manticoresearch/blob/f675d16267543d934ce84074f087d13496ec462c/api/sphinxapi.py#L358-L363 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/function.py | python | _FuncGraph.capture | (self, tensor, name=None) | Adds the given tensor to this graph and returns the captured tensor. | Adds the given tensor to this graph and returns the captured tensor. | [
"Adds",
"the",
"given",
"tensor",
"to",
"this",
"graph",
"and",
"returns",
"the",
"captured",
"tensor",
"."
] | def capture(self, tensor, name=None):
"""Adds the given tensor to this graph and returns the captured tensor."""
if tensor.ref() in self._captured:
# Captured already.
return self._captured[tensor.ref()]
elif self._capture_by_value:
return self._add_tensor_and_parents(tensor)
else:
... | [
"def",
"capture",
"(",
"self",
",",
"tensor",
",",
"name",
"=",
"None",
")",
":",
"if",
"tensor",
".",
"ref",
"(",
")",
"in",
"self",
".",
"_captured",
":",
"# Captured already.",
"return",
"self",
".",
"_captured",
"[",
"tensor",
".",
"ref",
"(",
")... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/function.py#L827-L835 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/sdata.py | python | SDataByAngle.get_empty | (cls: SDBA, *,
angles: Sequence[float],
frequencies: np.ndarray,
atom_keys: Sequence[str],
order_keys: Sequence[str],
**kwargs) | return cls(data=data, angles=angles, frequencies=frequencies, **kwargs) | Construct data container with zeroed arrays of appropriate dimensions
This is useful as a starting point for accumulating data in a loop.
Args:
angles: inelastic scattering angles
frequencies: inelastic scattering energies
atom_keys:
keys for atom... | Construct data container with zeroed arrays of appropriate dimensions | [
"Construct",
"data",
"container",
"with",
"zeroed",
"arrays",
"of",
"appropriate",
"dimensions"
] | def get_empty(cls: SDBA, *,
angles: Sequence[float],
frequencies: np.ndarray,
atom_keys: Sequence[str],
order_keys: Sequence[str],
**kwargs) -> SDBA:
"""Construct data container with zeroed arrays of appropriate dimensions... | [
"def",
"get_empty",
"(",
"cls",
":",
"SDBA",
",",
"*",
",",
"angles",
":",
"Sequence",
"[",
"float",
"]",
",",
"frequencies",
":",
"np",
".",
"ndarray",
",",
"atom_keys",
":",
"Sequence",
"[",
"str",
"]",
",",
"order_keys",
":",
"Sequence",
"[",
"str... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/sdata.py#L469-L507 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/factorization/python/ops/gmm_ops.py | python | GmmAlgorithm._define_partial_maximization_operation | (self, shard_id, shard) | Computes the partial statistics of the means and covariances.
Args:
shard_id: current shard id.
shard: current data shard, 1 X num_examples X dimensions. | Computes the partial statistics of the means and covariances. | [
"Computes",
"the",
"partial",
"statistics",
"of",
"the",
"means",
"and",
"covariances",
"."
] | def _define_partial_maximization_operation(self, shard_id, shard):
"""Computes the partial statistics of the means and covariances.
Args:
shard_id: current shard id.
shard: current data shard, 1 X num_examples X dimensions.
"""
# Soft assignment of each data point to each of the two cluster... | [
"def",
"_define_partial_maximization_operation",
"(",
"self",
",",
"shard_id",
",",
"shard",
")",
":",
"# Soft assignment of each data point to each of the two clusters.",
"self",
".",
"_points_in_k",
"[",
"shard_id",
"]",
"=",
"tf",
".",
"reduce_sum",
"(",
"self",
".",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/factorization/python/ops/gmm_ops.py#L307-L328 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/api.py | python | put | (url, data=None, **kwargs) | return request('put', url, data=data, **kwargs) | r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwa... | r"""Sends a PUT request. | [
"r",
"Sends",
"a",
"PUT",
"request",
"."
] | def put(url, data=None, **kwargs):
r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of t... | [
"def",
"put",
"(",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'put'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/api.py#L122-L134 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/output/base.py | python | Output.erase_down | (self) | Erases the screen from the current line down to the bottom of the
screen. | Erases the screen from the current line down to the bottom of the
screen. | [
"Erases",
"the",
"screen",
"from",
"the",
"current",
"line",
"down",
"to",
"the",
"bottom",
"of",
"the",
"screen",
"."
] | def erase_down(self) -> None:
"""
Erases the screen from the current line down to the bottom of the
screen.
""" | [
"def",
"erase_down",
"(",
"self",
")",
"->",
"None",
":"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/output/base.py#L94-L98 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vcs/__init__.py | python | VersionControl.normalize_url | (self, url) | return urllib.unquote(url).rstrip('/') | Normalize a URL for comparison by unquoting it and removing any trailing slash. | Normalize a URL for comparison by unquoting it and removing any trailing slash. | [
"Normalize",
"a",
"URL",
"for",
"comparison",
"by",
"unquoting",
"it",
"and",
"removing",
"any",
"trailing",
"slash",
"."
] | def normalize_url(self, url):
"""
Normalize a URL for comparison by unquoting it and removing any trailing slash.
"""
return urllib.unquote(url).rstrip('/') | [
"def",
"normalize_url",
"(",
"self",
",",
"url",
")",
":",
"return",
"urllib",
".",
"unquote",
"(",
"url",
")",
".",
"rstrip",
"(",
"'/'",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vcs/__init__.py#L140-L144 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/SubSequence.py | python | SubSequence.start_pos | (self) | return self._internal.get_start_pos() | Gets the starting position. | Gets the starting position. | [
"Gets",
"the",
"starting",
"position",
"."
] | def start_pos(self):
"""Gets the starting position.
"""
return self._internal.get_start_pos() | [
"def",
"start_pos",
"(",
"self",
")",
":",
"return",
"self",
".",
"_internal",
".",
"get_start_pos",
"(",
")"
] | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/SubSequence.py#L63-L66 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/util/screenshot.py | python | TryCaptureScreenShot | (platform, tab=None) | If the platform or tab supports screenshot, attempt to take a screenshot
of the current browser.
Args:
platform: current platform
tab: browser tab if available
Returns:
file handle of the tempoerary file path for the screenshot if
present, None otherwise. | If the platform or tab supports screenshot, attempt to take a screenshot
of the current browser. | [
"If",
"the",
"platform",
"or",
"tab",
"supports",
"screenshot",
"attempt",
"to",
"take",
"a",
"screenshot",
"of",
"the",
"current",
"browser",
"."
] | def TryCaptureScreenShot(platform, tab=None):
""" If the platform or tab supports screenshot, attempt to take a screenshot
of the current browser.
Args:
platform: current platform
tab: browser tab if available
Returns:
file handle of the tempoerary file path for the screenshot if
present, None... | [
"def",
"TryCaptureScreenShot",
"(",
"platform",
",",
"tab",
"=",
"None",
")",
":",
"try",
":",
"# TODO(nednguyen): once all platforms support taking screenshot,",
"# remove the tab checking logic and consider moving this to story_runner.",
"# (crbug.com/369490)",
"if",
"platform",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/util/screenshot.py#L16-L50 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distro.py | python | LinuxDistribution.linux_distribution | (self, full_distribution_name=True) | return (
self.name() if full_distribution_name else self.id(),
self.version(),
self.codename()
) | Return information about the OS distribution that is compatible
with Python's :func:`platform.linux_distribution`, supporting a subset
of its parameters.
For details, see :func:`distro.linux_distribution`. | Return information about the OS distribution that is compatible
with Python's :func:`platform.linux_distribution`, supporting a subset
of its parameters. | [
"Return",
"information",
"about",
"the",
"OS",
"distribution",
"that",
"is",
"compatible",
"with",
"Python",
"s",
":",
"func",
":",
"platform",
".",
"linux_distribution",
"supporting",
"a",
"subset",
"of",
"its",
"parameters",
"."
] | def linux_distribution(self, full_distribution_name=True):
"""
Return information about the OS distribution that is compatible
with Python's :func:`platform.linux_distribution`, supporting a subset
of its parameters.
For details, see :func:`distro.linux_distribution`.
""... | [
"def",
"linux_distribution",
"(",
"self",
",",
"full_distribution_name",
"=",
"True",
")",
":",
"return",
"(",
"self",
".",
"name",
"(",
")",
"if",
"full_distribution_name",
"else",
"self",
".",
"id",
"(",
")",
",",
"self",
".",
"version",
"(",
")",
",",... | 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/distro.py#L671-L683 | |
pskun/finance_news_analysis | 6ac13e32deede37a4cf57bba8b2897941ae3d80d | preprocess/news_preprocess_handler.py | python | NewsPreprocessHandler.insert_keyword_info | (self, news_id, data) | 插入新闻正文关键词数据 | 插入新闻正文关键词数据 | [
"插入新闻正文关键词数据"
] | def insert_keyword_info(self, news_id, data):
''' 插入新闻正文关键词数据 '''
news_keywords = data.get('all_type_keywords')
if news_keywords is not None:
# 如果提取出了关键字
for kw_type in news_keywords:
# 对每种关键字类型
for keyword in news_keywords[kw_type]:
... | [
"def",
"insert_keyword_info",
"(",
"self",
",",
"news_id",
",",
"data",
")",
":",
"news_keywords",
"=",
"data",
".",
"get",
"(",
"'all_type_keywords'",
")",
"if",
"news_keywords",
"is",
"not",
"None",
":",
"# 如果提取出了关键字",
"for",
"kw_type",
"in",
"news_keywords"... | https://github.com/pskun/finance_news_analysis/blob/6ac13e32deede37a4cf57bba8b2897941ae3d80d/preprocess/news_preprocess_handler.py#L287-L310 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/binhex.py | python | _Hqxdecoderengine.read | (self, totalwtd) | return decdata | Read at least wtd bytes (or until EOF) | Read at least wtd bytes (or until EOF) | [
"Read",
"at",
"least",
"wtd",
"bytes",
"(",
"or",
"until",
"EOF",
")"
] | def read(self, totalwtd):
"""Read at least wtd bytes (or until EOF)"""
decdata = ''
wtd = totalwtd
#
# The loop here is convoluted, since we don't really now how
# much to decode: there may be newlines in the incoming data.
while wtd > 0:
if self.eof: ... | [
"def",
"read",
"(",
"self",
",",
"totalwtd",
")",
":",
"decdata",
"=",
"''",
"wtd",
"=",
"totalwtd",
"#",
"# The loop here is convoluted, since we don't really now how",
"# much to decode: there may be newlines in the incoming data.",
"while",
"wtd",
">",
"0",
":",
"if",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/binhex.py#L279-L311 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/clustering_ops.py | python | KMeans._mini_batch_training_op | (self, inputs, cluster_idx_list, cluster_centers,
total_counts) | return control_flow_ops.group(*update_ops) | Creates an op for training for mini batch case.
Args:
inputs: list of input Tensors.
cluster_idx_list: A vector (or list of vectors). Each element in the
vector corresponds to an input row in 'inp' and specifies the cluster id
corresponding to the input.
cluster_centers: Tensor Re... | Creates an op for training for mini batch case. | [
"Creates",
"an",
"op",
"for",
"training",
"for",
"mini",
"batch",
"case",
"."
] | def _mini_batch_training_op(self, inputs, cluster_idx_list, cluster_centers,
total_counts):
"""Creates an op for training for mini batch case.
Args:
inputs: list of input Tensors.
cluster_idx_list: A vector (or list of vectors). Each element in the
vector corre... | [
"def",
"_mini_batch_training_op",
"(",
"self",
",",
"inputs",
",",
"cluster_idx_list",
",",
"cluster_centers",
",",
"total_counts",
")",
":",
"update_ops",
"=",
"[",
"]",
"for",
"inp",
",",
"cluster_idx",
"in",
"zip",
"(",
"inputs",
",",
"cluster_idx_list",
")... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/clustering_ops.py#L435-L499 | |
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/utils/network.py | python | NodeFilter.data_provider | (self) | return self.type(Host2DeviceCopy) | r"""get :class:`.DataProvider` oprs; shorthand for
``.type(DataProvider)`` | r"""get :class:`.DataProvider` oprs; shorthand for
``.type(DataProvider)`` | [
"r",
"get",
":",
"class",
":",
".",
"DataProvider",
"oprs",
";",
"shorthand",
"for",
".",
"type",
"(",
"DataProvider",
")"
] | def data_provider(self):
r"""get :class:`.DataProvider` oprs; shorthand for
``.type(DataProvider)``
"""
return self.type(Host2DeviceCopy) | [
"def",
"data_provider",
"(",
"self",
")",
":",
"return",
"self",
".",
"type",
"(",
"Host2DeviceCopy",
")"
] | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/utils/network.py#L688-L693 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/swf/layer1.py | python | Layer1.json_request | (self, action, data, object_hook=None) | return self.make_request(action, json_input, object_hook) | This method wraps around make_request() to normalize and serialize the
dictionary with request parameters.
:type action: string
:param action: Specifies an SWF action.
:type data: dict
:param data: Specifies request parameters associated with the action. | This method wraps around make_request() to normalize and serialize the
dictionary with request parameters. | [
"This",
"method",
"wraps",
"around",
"make_request",
"()",
"to",
"normalize",
"and",
"serialize",
"the",
"dictionary",
"with",
"request",
"parameters",
"."
] | def json_request(self, action, data, object_hook=None):
"""
This method wraps around make_request() to normalize and serialize the
dictionary with request parameters.
:type action: string
:param action: Specifies an SWF action.
:type data: dict
:param data: Spec... | [
"def",
"json_request",
"(",
"self",
",",
"action",
",",
"data",
",",
"object_hook",
"=",
"None",
")",
":",
"self",
".",
"_normalize_request_dict",
"(",
"data",
")",
"json_input",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
"return",
"self",
".",
"make_r... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/swf/layer1.py#L105-L118 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/html5lib/_inputstream.py | python | HTMLUnicodeInputStream.char | (self) | return char | Read one character from the stream or queue if available. Return
EOF when EOF is reached. | Read one character from the stream or queue if available. Return | [
"Read",
"one",
"character",
"from",
"the",
"stream",
"or",
"queue",
"if",
"available",
".",
"Return"
] | def char(self):
""" Read one character from the stream or queue if available. Return
EOF when EOF is reached.
"""
# Read a new chunk from the input stream if necessary
if self.chunkOffset >= self.chunkSize:
if not self.readChunk():
return EO... | [
"def",
"char",
"(",
"self",
")",
":",
"# Read a new chunk from the input stream if necessary",
"if",
"self",
".",
"chunkOffset",
">=",
"self",
".",
"chunkSize",
":",
"if",
"not",
"self",
".",
"readChunk",
"(",
")",
":",
"return",
"EOF",
"chunkOffset",
"=",
"se... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/html5lib/_inputstream.py#L467-L493 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/s3transfer/download.py | python | DownloadSubmissionTask._get_download_output_manager_cls | (self, transfer_future, osutil) | Retrieves a class for managing output for a download
:type transfer_future: s3transfer.futures.TransferFuture
:param transfer_future: The transfer future for the request
:type osutil: s3transfer.utils.OSUtils
:param osutil: The os utility associated to the transfer
:rtype: cla... | Retrieves a class for managing output for a download | [
"Retrieves",
"a",
"class",
"for",
"managing",
"output",
"for",
"a",
"download"
] | def _get_download_output_manager_cls(self, transfer_future, osutil):
"""Retrieves a class for managing output for a download
:type transfer_future: s3transfer.futures.TransferFuture
:param transfer_future: The transfer future for the request
:type osutil: s3transfer.utils.OSUtils
... | [
"def",
"_get_download_output_manager_cls",
"(",
"self",
",",
"transfer_future",
",",
"osutil",
")",
":",
"download_manager_resolver_chain",
"=",
"[",
"DownloadSpecialFilenameOutputManager",
",",
"DownloadFilenameOutputManager",
",",
"DownloadSeekableOutputManager",
",",
"Downlo... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/s3transfer/download.py#L281-L307 | ||
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_logic_utils.py | python | formula_to_clauses_aux | (f) | return [y for x in f.args for y in formula_to_clauses_aux(x)] | Clausify a formula. Outside of a TseitinContext, this requires that
the formula is in CNF and with raise ValueException otherwise. Within a
TseitinContext will do Tseitin encoding. | Clausify a formula. Outside of a TseitinContext, this requires that
the formula is in CNF and with raise ValueException otherwise. Within a
TseitinContext will do Tseitin encoding. | [
"Clausify",
"a",
"formula",
".",
"Outside",
"of",
"a",
"TseitinContext",
"this",
"requires",
"that",
"the",
"formula",
"is",
"in",
"CNF",
"and",
"with",
"raise",
"ValueException",
"otherwise",
".",
"Within",
"a",
"TseitinContext",
"will",
"do",
"Tseitin",
"enc... | def formula_to_clauses_aux(f):
""" Clausify a formula. Outside of a TseitinContext, this requires that
the formula is in CNF and with raise ValueException otherwise. Within a
TseitinContext will do Tseitin encoding. """
# print "ftc: {} : {} : {}".format(f,type(f),And)
f = drop_universals(f)
f = ... | [
"def",
"formula_to_clauses_aux",
"(",
"f",
")",
":",
"# print \"ftc: {} : {} : {}\".format(f,type(f),And)",
"f",
"=",
"drop_universals",
"(",
"f",
")",
"f",
"=",
"de_morgan",
"(",
"f",
")",
"# print \"ftc: {} : {} : {}\".format(f,type(f),And)",
"if",
"is_false",
"("... | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_logic_utils.py#L836-L849 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/configdialog.py | python | FontPage.load_tab_cfg | (self) | Load current configuration settings for the tab options.
Attributes updated:
space_num: Set to value from idleConf. | Load current configuration settings for the tab options. | [
"Load",
"current",
"configuration",
"settings",
"for",
"the",
"tab",
"options",
"."
] | def load_tab_cfg(self):
"""Load current configuration settings for the tab options.
Attributes updated:
space_num: Set to value from idleConf.
"""
# Set indent sizes.
space_num = idleConf.GetOption(
'main', 'Indent', 'num-spaces', default=4, type='int')
... | [
"def",
"load_tab_cfg",
"(",
"self",
")",
":",
"# Set indent sizes.",
"space_num",
"=",
"idleConf",
".",
"GetOption",
"(",
"'main'",
",",
"'Indent'",
",",
"'num-spaces'",
",",
"default",
"=",
"4",
",",
"type",
"=",
"'int'",
")",
"self",
".",
"space_num",
".... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/configdialog.py#L669-L678 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | SplitWords | (input_string) | Transforms a input_string into a list of lower-case components.
Args:
input_string: the input string.
Returns:
a list of lower-case words. | Transforms a input_string into a list of lower-case components. | [
"Transforms",
"a",
"input_string",
"into",
"a",
"list",
"of",
"lower",
"-",
"case",
"components",
"."
] | def SplitWords(input_string):
"""Transforms a input_string into a list of lower-case components.
Args:
input_string: the input string.
Returns:
a list of lower-case words.
"""
if input_string.find('_') > -1:
# 'some_TEXT_' -> 'some text'
return input_string.replace('_', ' ').strip().lower().... | [
"def",
"SplitWords",
"(",
"input_string",
")",
":",
"if",
"input_string",
".",
"find",
"(",
"'_'",
")",
">",
"-",
"1",
":",
"# 'some_TEXT_' -> 'some text'",
"return",
"input_string",
".",
"replace",
"(",
"'_'",
",",
"' '",
")",
".",
"strip",
"(",
")",
".... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L2516-L2536 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/autograph/operators/py_builtins.py | python | locals_in_original_context | (caller_fn_scope) | return _find_originating_frame(caller_fn_scope, innermost=True).f_locals | Executes the locals function in the context of a specified function. | Executes the locals function in the context of a specified function. | [
"Executes",
"the",
"locals",
"function",
"in",
"the",
"context",
"of",
"a",
"specified",
"function",
"."
] | def locals_in_original_context(caller_fn_scope):
"""Executes the locals function in the context of a specified function."""
return _find_originating_frame(caller_fn_scope, innermost=True).f_locals | [
"def",
"locals_in_original_context",
"(",
"caller_fn_scope",
")",
":",
"return",
"_find_originating_frame",
"(",
"caller_fn_scope",
",",
"innermost",
"=",
"True",
")",
".",
"f_locals"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/autograph/operators/py_builtins.py#L86-L88 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/plotting/_matplotlib/style.py | python | _is_single_color | (color: Color | Collection[Color]) | return False | Check if `color` is a single color, not a sequence of colors.
Single color is of these kinds:
- Named color "red", "C0", "firebrick"
- Alias "g"
- Sequence of floats, such as (0.1, 0.2, 0.3) or (0.1, 0.2, 0.3, 0.4).
See Also
--------
_is_single_string_color | Check if `color` is a single color, not a sequence of colors. | [
"Check",
"if",
"color",
"is",
"a",
"single",
"color",
"not",
"a",
"sequence",
"of",
"colors",
"."
] | def _is_single_color(color: Color | Collection[Color]) -> bool:
"""Check if `color` is a single color, not a sequence of colors.
Single color is of these kinds:
- Named color "red", "C0", "firebrick"
- Alias "g"
- Sequence of floats, such as (0.1, 0.2, 0.3) or (0.1, 0.2, 0.3, 0.4).
... | [
"def",
"_is_single_color",
"(",
"color",
":",
"Color",
"|",
"Collection",
"[",
"Color",
"]",
")",
"->",
"bool",
":",
"if",
"isinstance",
"(",
"color",
",",
"str",
")",
"and",
"_is_single_string_color",
"(",
"color",
")",
":",
"# GH #36972",
"return",
"True... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/plotting/_matplotlib/style.py#L175-L194 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextParagraphLayoutBox.MoveAnchoredObjectToParagraph | (*args, **kwargs) | return _richtext.RichTextParagraphLayoutBox_MoveAnchoredObjectToParagraph(*args, **kwargs) | MoveAnchoredObjectToParagraph(self, RichTextParagraph from, RichTextParagraph to, RichTextObject obj) | MoveAnchoredObjectToParagraph(self, RichTextParagraph from, RichTextParagraph to, RichTextObject obj) | [
"MoveAnchoredObjectToParagraph",
"(",
"self",
"RichTextParagraph",
"from",
"RichTextParagraph",
"to",
"RichTextObject",
"obj",
")"
] | def MoveAnchoredObjectToParagraph(*args, **kwargs):
"""MoveAnchoredObjectToParagraph(self, RichTextParagraph from, RichTextParagraph to, RichTextObject obj)"""
return _richtext.RichTextParagraphLayoutBox_MoveAnchoredObjectToParagraph(*args, **kwargs) | [
"def",
"MoveAnchoredObjectToParagraph",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_MoveAnchoredObjectToParagraph",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1640-L1642 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/cookielib.py | python | CookieJar.add_cookie_header | (self, request) | Add correct Cookie: header to request (urllib2.Request object).
The Cookie2 header is also added unless policy.hide_cookie2 is true. | Add correct Cookie: header to request (urllib2.Request object). | [
"Add",
"correct",
"Cookie",
":",
"header",
"to",
"request",
"(",
"urllib2",
".",
"Request",
"object",
")",
"."
] | def add_cookie_header(self, request):
"""Add correct Cookie: header to request (urllib2.Request object).
The Cookie2 header is also added unless policy.hide_cookie2 is true.
"""
_debug("add_cookie_header")
self._cookies_lock.acquire()
try:
self._policy._now... | [
"def",
"add_cookie_header",
"(",
"self",
",",
"request",
")",
":",
"_debug",
"(",
"\"add_cookie_header\"",
")",
"self",
".",
"_cookies_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_policy",
".",
"_now",
"=",
"self",
".",
"_now",
"=",
"int",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/cookielib.py#L1328-L1359 | ||
apache/impala | 8ddac48f3428c86f2cbd037ced89cfb903298b12 | shell/ext-py/prettytable-0.7.2/prettytable.py | python | PrettyTable._get_hrules | (self) | return self._hrules | Controls printing of horizontal rules after rows
Arguments:
hrules - horizontal rules style. Allowed values: FRAME, ALL, HEADER, NONE | Controls printing of horizontal rules after rows | [
"Controls",
"printing",
"of",
"horizontal",
"rules",
"after",
"rows"
] | def _get_hrules(self):
"""Controls printing of horizontal rules after rows
Arguments:
hrules - horizontal rules style. Allowed values: FRAME, ALL, HEADER, NONE"""
return self._hrules | [
"def",
"_get_hrules",
"(",
"self",
")",
":",
"return",
"self",
".",
"_hrules"
] | https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/shell/ext-py/prettytable-0.7.2/prettytable.py#L569-L575 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py | python | UBMatrixPeakTable.get_hkl | (self, row_index, is_spice_hkl) | return m_h, m_k, m_l | Get reflection's miller index
:except RuntimeError:
:param row_index:
:param is_spice_hkl:
:return: 3-tuple as H, K, L | Get reflection's miller index
:except RuntimeError:
:param row_index:
:param is_spice_hkl:
:return: 3-tuple as H, K, L | [
"Get",
"reflection",
"s",
"miller",
"index",
":",
"except",
"RuntimeError",
":",
":",
"param",
"row_index",
":",
":",
"param",
"is_spice_hkl",
":",
":",
"return",
":",
"3",
"-",
"tuple",
"as",
"H",
"K",
"L"
] | def get_hkl(self, row_index, is_spice_hkl):
"""
Get reflection's miller index
:except RuntimeError:
:param row_index:
:param is_spice_hkl:
:return: 3-tuple as H, K, L
"""
# check input
assert isinstance(row_index, int), 'Row index {0} must be an in... | [
"def",
"get_hkl",
"(",
"self",
",",
"row_index",
",",
"is_spice_hkl",
")",
":",
"# check input",
"assert",
"isinstance",
"(",
"row_index",
",",
"int",
")",
",",
"'Row index {0} must be an integer but not a {1}.'",
"''",
".",
"format",
"(",
"row_index",
",",
"type"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py#L1763-L1790 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/mailbox.py | python | _mboxMMDF.get_bytes | (self, key, from_=False) | return string.replace(linesep, b'\n') | Return a string representation or raise a KeyError. | Return a string representation or raise a KeyError. | [
"Return",
"a",
"string",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | def get_bytes(self, key, from_=False):
"""Return a string representation or raise a KeyError."""
start, stop = self._lookup(key)
self._file.seek(start)
if not from_:
self._file.readline()
string = self._file.read(stop - self._file.tell())
return string.replace... | [
"def",
"get_bytes",
"(",
"self",
",",
"key",
",",
"from_",
"=",
"False",
")",
":",
"start",
",",
"stop",
"=",
"self",
".",
"_lookup",
"(",
"key",
")",
"self",
".",
"_file",
".",
"seek",
"(",
"start",
")",
"if",
"not",
"from_",
":",
"self",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/mailbox.py#L792-L799 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cgi.py | python | FieldStorage.getlist | (self, key) | Return list of received values. | Return list of received values. | [
"Return",
"list",
"of",
"received",
"values",
"."
] | def getlist(self, key):
""" Return list of received values."""
if key in self:
value = self[key]
if type(value) is type([]):
return map(attrgetter('value'), value)
else:
return [value.value]
else:
return [] | [
"def",
"getlist",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
":",
"value",
"=",
"self",
"[",
"key",
"]",
"if",
"type",
"(",
"value",
")",
"is",
"type",
"(",
"[",
"]",
")",
":",
"return",
"map",
"(",
"attrgetter",
"(",
"'value... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cgi.py#L568-L577 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/fps/connection.py | python | FPSConnection.cancel_token | (self, action, response, **kw) | return self.get_object(action, kw, response) | Cancels any token installed by the calling application on its own
account. | Cancels any token installed by the calling application on its own
account. | [
"Cancels",
"any",
"token",
"installed",
"by",
"the",
"calling",
"application",
"on",
"its",
"own",
"account",
"."
] | def cancel_token(self, action, response, **kw):
"""
Cancels any token installed by the calling application on its own
account.
"""
return self.get_object(action, kw, response) | [
"def",
"cancel_token",
"(",
"self",
",",
"action",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"get_object",
"(",
"action",
",",
"kw",
",",
"response",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/fps/connection.py#L321-L326 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/base.py | python | merge_completers | (
completers: Sequence[Completer], deduplicate: bool = False
) | return _MergedCompleter(completers) | Combine several completers into one.
:param deduplicate: If `True`, wrap the result in a `DeduplicateCompleter`
so that completions that would result in the same text will be
deduplicated. | Combine several completers into one. | [
"Combine",
"several",
"completers",
"into",
"one",
"."
] | def merge_completers(
completers: Sequence[Completer], deduplicate: bool = False
) -> Completer:
"""
Combine several completers into one.
:param deduplicate: If `True`, wrap the result in a `DeduplicateCompleter`
so that completions that would result in the same text will be
deduplicate... | [
"def",
"merge_completers",
"(",
"completers",
":",
"Sequence",
"[",
"Completer",
"]",
",",
"deduplicate",
":",
"bool",
"=",
"False",
")",
"->",
"Completer",
":",
"if",
"deduplicate",
":",
"from",
".",
"deduplicate",
"import",
"DeduplicateCompleter",
"return",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/base.py#L342-L357 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/GettextCommon.py | python | tool_list | (platform, env) | return [ 'xgettext', 'msginit', 'msgmerge', 'msgfmt' ] | List tools that shall be generated by top-level `gettext` tool | List tools that shall be generated by top-level `gettext` tool | [
"List",
"tools",
"that",
"shall",
"be",
"generated",
"by",
"top",
"-",
"level",
"gettext",
"tool"
] | def tool_list(platform, env):
""" List tools that shall be generated by top-level `gettext` tool """
return [ 'xgettext', 'msginit', 'msgmerge', 'msgfmt' ] | [
"def",
"tool_list",
"(",
"platform",
",",
"env",
")",
":",
"return",
"[",
"'xgettext'",
",",
"'msginit'",
",",
"'msgmerge'",
",",
"'msgfmt'",
"]"
] | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/GettextCommon.py#L409-L411 | |
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | TranslationUnit.reparse | (self, unsaved_files=None, options=0) | Reparse an already parsed translation unit.
In-memory contents for files can be provided by passing a list of pairs
as unsaved_files, the first items should be the filenames to be mapped
and the second should be the contents to be substituted for the
file. The contents may be passed as ... | Reparse an already parsed translation unit. | [
"Reparse",
"an",
"already",
"parsed",
"translation",
"unit",
"."
] | def reparse(self, unsaved_files=None, options=0):
"""
Reparse an already parsed translation unit.
In-memory contents for files can be provided by passing a list of pairs
as unsaved_files, the first items should be the filenames to be mapped
and the second should be the contents ... | [
"def",
"reparse",
"(",
"self",
",",
"unsaved_files",
"=",
"None",
",",
"options",
"=",
"0",
")",
":",
"if",
"unsaved_files",
"is",
"None",
":",
"unsaved_files",
"=",
"[",
"]",
"unsaved_files_array",
"=",
"0",
"if",
"len",
"(",
"unsaved_files",
")",
":",
... | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L2371-L2398 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/image/python/ops/image_ops.py | python | angles_to_projective_transforms | (angles,
image_height,
image_width,
name=None) | Returns projective transform(s) for the given angle(s).
Args:
angles: A scalar angle to rotate all images by, or (for batches of images)
a vector with an angle to rotate each image in the batch. The rank must
be statically known (the shape is not `TensorShape(None)`.
image_height: Height of t... | Returns projective transform(s) for the given angle(s). | [
"Returns",
"projective",
"transform",
"(",
"s",
")",
"for",
"the",
"given",
"angle",
"(",
"s",
")",
"."
] | def angles_to_projective_transforms(angles,
image_height,
image_width,
name=None):
"""Returns projective transform(s) for the given angle(s).
Args:
angles: A scalar angle to rotate all images by, or (for... | [
"def",
"angles_to_projective_transforms",
"(",
"angles",
",",
"image_height",
",",
"image_width",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"angles_to_projective_transforms\"",
")",
":",
"angle_or_angles",
"=",
"ops"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/image/python/ops/image_ops.py#L130-L173 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/bond_core/smclib/python/smclib/statemap.py | python | FSMContext.pushState | (self, state) | Push the current state on top of the state stack
and make the specified state the current state. | Push the current state on top of the state stack
and make the specified state the current state. | [
"Push",
"the",
"current",
"state",
"on",
"top",
"of",
"the",
"state",
"stack",
"and",
"make",
"the",
"specified",
"state",
"the",
"current",
"state",
"."
] | def pushState(self, state):
"""Push the current state on top of the state stack
and make the specified state the current state."""
if not isinstance(state, State):
raise ValueError("state should be a statemap.State")
if self._state != None:
self._state_stack.append(self._state)
self._state = state
if ... | [
"def",
"pushState",
"(",
"self",
",",
"state",
")",
":",
"if",
"not",
"isinstance",
"(",
"state",
",",
"State",
")",
":",
"raise",
"ValueError",
"(",
"\"state should be a statemap.State\"",
")",
"if",
"self",
".",
"_state",
"!=",
"None",
":",
"self",
".",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/bond_core/smclib/python/smclib/statemap.py#L148-L157 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Window.InvalidateBestSize | (*args, **kwargs) | return _core_.Window_InvalidateBestSize(*args, **kwargs) | InvalidateBestSize(self)
Reset the cached best size value so it will be recalculated the next
time it is needed. | InvalidateBestSize(self) | [
"InvalidateBestSize",
"(",
"self",
")"
] | def InvalidateBestSize(*args, **kwargs):
"""
InvalidateBestSize(self)
Reset the cached best size value so it will be recalculated the next
time it is needed.
"""
return _core_.Window_InvalidateBestSize(*args, **kwargs) | [
"def",
"InvalidateBestSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_InvalidateBestSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L9619-L9626 | |
stulp/dmpbbo | ca900e3b851d25faaf59ea296650370c70ed7d0f | python/bbo/updaters.py | python | UpdaterCovarAdaptation.__init__ | (self,eliteness = 10, weighting_method = 'PI-BB',diagonal_max=None,diagonal_min=None,diag_only=False,learning_rate=1.0) | Constructor
\param[in] eliteness The eliteness parameter ('mu' in CMA-ES, 'h' in PI^2)
\param[in] weighting_method ('PI-BB' = PI^2 style weighting)
\param[in] base_level Small covariance matrix that is added after each update to avoid premature convergence
\param[in] diag_only Update onl... | Constructor
\param[in] eliteness The eliteness parameter ('mu' in CMA-ES, 'h' in PI^2)
\param[in] weighting_method ('PI-BB' = PI^2 style weighting)
\param[in] base_level Small covariance matrix that is added after each update to avoid premature convergence
\param[in] diag_only Update onl... | [
"Constructor",
"\\",
"param",
"[",
"in",
"]",
"eliteness",
"The",
"eliteness",
"parameter",
"(",
"mu",
"in",
"CMA",
"-",
"ES",
"h",
"in",
"PI^2",
")",
"\\",
"param",
"[",
"in",
"]",
"weighting_method",
"(",
"PI",
"-",
"BB",
"=",
"PI^2",
"style",
"wei... | def __init__(self,eliteness = 10, weighting_method = 'PI-BB',diagonal_max=None,diagonal_min=None,diag_only=False,learning_rate=1.0):
""" Constructor
\param[in] eliteness The eliteness parameter ('mu' in CMA-ES, 'h' in PI^2)
\param[in] weighting_method ('PI-BB' = PI^2 style weighting)
\pa... | [
"def",
"__init__",
"(",
"self",
",",
"eliteness",
"=",
"10",
",",
"weighting_method",
"=",
"'PI-BB'",
",",
"diagonal_max",
"=",
"None",
",",
"diagonal_min",
"=",
"None",
",",
"diag_only",
"=",
"False",
",",
"learning_rate",
"=",
"1.0",
")",
":",
"self",
... | https://github.com/stulp/dmpbbo/blob/ca900e3b851d25faaf59ea296650370c70ed7d0f/python/bbo/updaters.py#L113-L130 | ||
OAID/Tengine | 66b2c22ad129d25e2fc6de3b22a608bb54dd90db | pytengine/tengine/graph.py | python | Graph.preRun | (self) | Initialize resource for graph execution
:return: None | Initialize resource for graph execution
:return: None | [
"Initialize",
"resource",
"for",
"graph",
"execution",
":",
"return",
":",
"None"
] | def preRun(self):
"""
Initialize resource for graph execution
:return: None
"""
check_call(_LIB.prerun_graph(ctypes.c_void_p(self.graph))) | [
"def",
"preRun",
"(",
"self",
")",
":",
"check_call",
"(",
"_LIB",
".",
"prerun_graph",
"(",
"ctypes",
".",
"c_void_p",
"(",
"self",
".",
"graph",
")",
")",
")"
] | https://github.com/OAID/Tengine/blob/66b2c22ad129d25e2fc6de3b22a608bb54dd90db/pytengine/tengine/graph.py#L330-L335 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/panelbox.py | python | PanelBox.AppendItem | (self, item) | Append an item to the list
@param item: PanelBoxItem | Append an item to the list
@param item: PanelBoxItem | [
"Append",
"an",
"item",
"to",
"the",
"list",
"@param",
"item",
":",
"PanelBoxItem"
] | def AppendItem(self, item):
"""Append an item to the list
@param item: PanelBoxItem
"""
self._items.append(item)
self._sizer.Add(item, 0, wx.EXPAND)
item.Realize() | [
"def",
"AppendItem",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"_items",
".",
"append",
"(",
"item",
")",
"self",
".",
"_sizer",
".",
"Add",
"(",
"item",
",",
"0",
",",
"wx",
".",
"EXPAND",
")",
"item",
".",
"Realize",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/panelbox.py#L145-L152 | ||
Sigil-Ebook/Sigil | 0d145d3a4874b4a26f7aabd68dbd9d18a2402e52 | src/Resource_Files/plugin_launchers/python/sigil_bs4/builder/_lxml.py | python | LXMLTreeBuilder.test_fragment_to_document | (self, fragment) | return '<html><body>%s</body></html>' % fragment | See `TreeBuilder`. | See `TreeBuilder`. | [
"See",
"TreeBuilder",
"."
] | def test_fragment_to_document(self, fragment):
"""See `TreeBuilder`."""
return '<html><body>%s</body></html>' % fragment | [
"def",
"test_fragment_to_document",
"(",
"self",
",",
"fragment",
")",
":",
"return",
"'<html><body>%s</body></html>'",
"%",
"fragment"
] | https://github.com/Sigil-Ebook/Sigil/blob/0d145d3a4874b4a26f7aabd68dbd9d18a2402e52/src/Resource_Files/plugin_launchers/python/sigil_bs4/builder/_lxml.py#L306-L308 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/numpy/_op.py | python | isneginf | (x, out=None, **kwargs) | return _pure_unary_func_helper(x, _api_internal.isneginf, _np.isneginf, out=out, **kwargs) | Test element-wise for negative infinity, return result as bool array.
Parameters
----------
x : ndarray
Input array.
out : ndarray or None, optional
A location into which the result is stored.
If provided, it must have the same shape and dtype as input ndarray.
If not pr... | Test element-wise for negative infinity, return result as bool array. | [
"Test",
"element",
"-",
"wise",
"for",
"negative",
"infinity",
"return",
"result",
"as",
"bool",
"array",
"."
] | def isneginf(x, out=None, **kwargs):
"""
Test element-wise for negative infinity, return result as bool array.
Parameters
----------
x : ndarray
Input array.
out : ndarray or None, optional
A location into which the result is stored.
If provided, it must have the same sh... | [
"def",
"isneginf",
"(",
"x",
",",
"out",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_pure_unary_func_helper",
"(",
"x",
",",
"_api_internal",
".",
"isneginf",
",",
"_np",
".",
"isneginf",
",",
"out",
"=",
"out",
",",
"*",
"*",
"kwargs... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/numpy/_op.py#L8983-L9024 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/ply/example/newclasscalc/calc.py | python | Calc.p_expression_binop | (self, p) | expression : expression PLUS expression
| expression MINUS expression
| expression TIMES expression
| expression DIVIDE expression
| expression EXP expression | expression : expression PLUS expression
| expression MINUS expression
| expression TIMES expression
| expression DIVIDE expression
| expression EXP expression | [
"expression",
":",
"expression",
"PLUS",
"expression",
"|",
"expression",
"MINUS",
"expression",
"|",
"expression",
"TIMES",
"expression",
"|",
"expression",
"DIVIDE",
"expression",
"|",
"expression",
"EXP",
"expression"
] | def p_expression_binop(self, p):
"""
expression : expression PLUS expression
| expression MINUS expression
| expression TIMES expression
| expression DIVIDE expression
| expression EXP expression
"""
#print [repr(p[i... | [
"def",
"p_expression_binop",
"(",
"self",
",",
"p",
")",
":",
"#print [repr(p[i]) for i in range(0,4)]",
"if",
"p",
"[",
"2",
"]",
"==",
"'+'",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]",
"+",
"p",
"[",
"3",
"]",
"elif",
"p",
"[",
"2",
"]",... | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/ply/example/newclasscalc/calc.py#L117-L130 | ||
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | src/mdl/jit/llvm/dist/utils/lit/lit/ShUtil.py | python | ShLexer.lex_one_token | (self) | return self.lex_arg(c) | lex_one_token - Lex a single 'sh' token. | lex_one_token - Lex a single 'sh' token. | [
"lex_one_token",
"-",
"Lex",
"a",
"single",
"sh",
"token",
"."
] | def lex_one_token(self):
"""
lex_one_token - Lex a single 'sh' token. """
c = self.eat()
if c == ';':
return (c,)
if c == '|':
if self.maybe_eat('|'):
return ('||',)
return (c,)
if c == '&':
if self.maybe_ea... | [
"def",
"lex_one_token",
"(",
"self",
")",
":",
"c",
"=",
"self",
".",
"eat",
"(",
")",
"if",
"c",
"==",
"';'",
":",
"return",
"(",
"c",
",",
")",
"if",
"c",
"==",
"'|'",
":",
"if",
"self",
".",
"maybe_eat",
"(",
"'|'",
")",
":",
"return",
"("... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/src/mdl/jit/llvm/dist/utils/lit/lit/ShUtil.py#L148-L178 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/linear_model/base.py | python | sparse_center_data | (X, y, fit_intercept, normalize=False) | return X, y, X_offset, y_offset, X_std | Compute information needed to center data to have mean zero along
axis 0. Be aware that X will not be centered since it would break
the sparsity, but will be normalized if asked so. | Compute information needed to center data to have mean zero along
axis 0. Be aware that X will not be centered since it would break
the sparsity, but will be normalized if asked so. | [
"Compute",
"information",
"needed",
"to",
"center",
"data",
"to",
"have",
"mean",
"zero",
"along",
"axis",
"0",
".",
"Be",
"aware",
"that",
"X",
"will",
"not",
"be",
"centered",
"since",
"it",
"would",
"break",
"the",
"sparsity",
"but",
"will",
"be",
"no... | def sparse_center_data(X, y, fit_intercept, normalize=False):
"""
Compute information needed to center data to have mean zero along
axis 0. Be aware that X will not be centered since it would break
the sparsity, but will be normalized if asked so.
"""
if fit_intercept:
# we might require... | [
"def",
"sparse_center_data",
"(",
"X",
",",
"y",
",",
"fit_intercept",
",",
"normalize",
"=",
"False",
")",
":",
"if",
"fit_intercept",
":",
"# we might require not to change the csr matrix sometimes",
"# store a copy if normalize is True.",
"# Change dtype to float64 since mea... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/linear_model/base.py#L72-L105 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/lowering.py | python | Lower.storevar | (self, value, name) | Store the value into the given variable. | Store the value into the given variable. | [
"Store",
"the",
"value",
"into",
"the",
"given",
"variable",
"."
] | def storevar(self, value, name):
"""
Store the value into the given variable.
"""
fetype = self.typeof(name)
# Define if not already
self._alloca_var(name, fetype)
# Clean up existing value stored in the variable
old = self.loadvar(name)
self.dec... | [
"def",
"storevar",
"(",
"self",
",",
"value",
",",
"name",
")",
":",
"fetype",
"=",
"self",
".",
"typeof",
"(",
"name",
")",
"# Define if not already",
"self",
".",
"_alloca_var",
"(",
"name",
",",
"fetype",
")",
"# Clean up existing value stored in the variable... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/lowering.py#L1218-L1241 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/utils/lit/lit/ProgressBar.py | python | TerminalController.render | (self, template) | return re.sub(r'\$\$|\${\w+}', self._render_sub, template) | Replace each $-substitutions in the given template string with
the corresponding terminal control string (if it's defined) or
'' (if it's not). | Replace each $-substitutions in the given template string with
the corresponding terminal control string (if it's defined) or
'' (if it's not). | [
"Replace",
"each",
"$",
"-",
"substitutions",
"in",
"the",
"given",
"template",
"string",
"with",
"the",
"corresponding",
"terminal",
"control",
"string",
"(",
"if",
"it",
"s",
"defined",
")",
"or",
"(",
"if",
"it",
"s",
"not",
")",
"."
] | def render(self, template):
"""
Replace each $-substitutions in the given template string with
the corresponding terminal control string (if it's defined) or
'' (if it's not).
"""
return re.sub(r'\$\$|\${\w+}', self._render_sub, template) | [
"def",
"render",
"(",
"self",
",",
"template",
")",
":",
"return",
"re",
".",
"sub",
"(",
"r'\\$\\$|\\${\\w+}'",
",",
"self",
".",
"_render_sub",
",",
"template",
")"
] | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/utils/lit/lit/ProgressBar.py#L153-L159 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Tools/errcheck.py | python | options | (opt) | Error verification can be enabled by default (not just on ``waf -v``) by adding to the user script options | Error verification can be enabled by default (not just on ``waf -v``) by adding to the user script options | [
"Error",
"verification",
"can",
"be",
"enabled",
"by",
"default",
"(",
"not",
"just",
"on",
"waf",
"-",
"v",
")",
"by",
"adding",
"to",
"the",
"user",
"script",
"options"
] | def options(opt):
"""
Error verification can be enabled by default (not just on ``waf -v``) by adding to the user script options
"""
enhance_lib() | [
"def",
"options",
"(",
"opt",
")",
":",
"enhance_lib",
"(",
")"
] | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Tools/errcheck.py#L232-L236 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/turtle.py | python | TurtleScreen.onkeypress | (self, fun, key=None) | Bind fun to key-press event of key if key is given,
or to any key-press-event if no key is given.
Arguments:
fun -- a function with no arguments
key -- a string: key (e.g. "a") or key-symbol (e.g. "space")
In order to be able to register key-events, TurtleScreen
must ha... | Bind fun to key-press event of key if key is given,
or to any key-press-event if no key is given. | [
"Bind",
"fun",
"to",
"key",
"-",
"press",
"event",
"of",
"key",
"if",
"key",
"is",
"given",
"or",
"to",
"any",
"key",
"-",
"press",
"-",
"event",
"if",
"no",
"key",
"is",
"given",
"."
] | def onkeypress(self, fun, key=None):
"""Bind fun to key-press event of key if key is given,
or to any key-press-event if no key is given.
Arguments:
fun -- a function with no arguments
key -- a string: key (e.g. "a") or key-symbol (e.g. "space")
In order to be able to r... | [
"def",
"onkeypress",
"(",
"self",
",",
"fun",
",",
"key",
"=",
"None",
")",
":",
"if",
"fun",
"is",
"None",
":",
"if",
"key",
"in",
"self",
".",
"_keys",
":",
"self",
".",
"_keys",
".",
"remove",
"(",
"key",
")",
"elif",
"key",
"is",
"not",
"No... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/turtle.py#L1397-L1427 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/distutils/misc_util.py | python | Configuration.have_f77c | (self) | return flag | Check for availability of Fortran 77 compiler.
Use it inside source generating function to ensure that
setup distribution instance has been initialized.
Notes
-----
True if a Fortran 77 compiler is available (because a simple Fortran 77
code was able to be compiled succ... | Check for availability of Fortran 77 compiler. | [
"Check",
"for",
"availability",
"of",
"Fortran",
"77",
"compiler",
"."
] | def have_f77c(self):
"""Check for availability of Fortran 77 compiler.
Use it inside source generating function to ensure that
setup distribution instance has been initialized.
Notes
-----
True if a Fortran 77 compiler is available (because a simple Fortran 77
c... | [
"def",
"have_f77c",
"(",
"self",
")",
":",
"simple_fortran_subroutine",
"=",
"'''\n subroutine simple\n end\n '''",
"config_cmd",
"=",
"self",
".",
"get_config_cmd",
"(",
")",
"flag",
"=",
"config_cmd",
".",
"try_compile",
"(",
"simple_fortran_subrout... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/distutils/misc_util.py#L1815-L1832 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/nn.py | python | log_poisson_loss | (log_input, targets, compute_full_loss=False, name=None) | Computes log poisson loss given `log_input`.
Gives the log-likelihood loss between the prediction and the target under the
assumption that the target has a poisson distribution.
Caveat: By default, this is not the exact loss, but the loss minus a
constant term [log(z!)]. That has no effect for optimization, ... | Computes log poisson loss given `log_input`. | [
"Computes",
"log",
"poisson",
"loss",
"given",
"log_input",
"."
] | def log_poisson_loss(log_input, targets, compute_full_loss=False, name=None):
"""Computes log poisson loss given `log_input`.
Gives the log-likelihood loss between the prediction and the target under the
assumption that the target has a poisson distribution.
Caveat: By default, this is not the exact loss, but ... | [
"def",
"log_poisson_loss",
"(",
"log_input",
",",
"targets",
",",
"compute_full_loss",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"log_input",
",",
"targets",
"]",
",",
"name",
",",
"\"log_poisson_loss\"",
"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/nn.py#L314-L375 | ||
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.setSGroupXCoord | (self, x) | return self.dispatcher._checkResult(
Indigo._lib.indigoSetSGroupXCoord(self.id, x)
) | Sgroup method sets X coordinate
Args:
x (float): X coordinate
Returns:
int: 1 if there are no errors | Sgroup method sets X coordinate | [
"Sgroup",
"method",
"sets",
"X",
"coordinate"
] | def setSGroupXCoord(self, x):
"""Sgroup method sets X coordinate
Args:
x (float): X coordinate
Returns:
int: 1 if there are no errors
"""
self.dispatcher._setSessionId()
return self.dispatcher._checkResult(
Indigo._lib.indigoSetSGroup... | [
"def",
"setSGroupXCoord",
"(",
"self",
",",
"x",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"_checkResult",
"(",
"Indigo",
".",
"_lib",
".",
"indigoSetSGroupXCoord",
"(",
"self",
".",
"id"... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L1815-L1827 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/range.py | python | RangeIndex.__len__ | (self) | return len(self._range) | return the length of the RangeIndex | return the length of the RangeIndex | [
"return",
"the",
"length",
"of",
"the",
"RangeIndex"
] | def __len__(self) -> int:
"""
return the length of the RangeIndex
"""
return len(self._range) | [
"def",
"__len__",
"(",
"self",
")",
"->",
"int",
":",
"return",
"len",
"(",
"self",
".",
"_range",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/range.py#L675-L679 | |
mingchen/protobuf-ios | 0958df34558cd54cb7b6e6ca5c8855bf3d475046 | compiler/python/google/protobuf/internal/decoder.py | python | Decoder.ReadSInt32 | (self) | return wire_format.ZigZagDecode(self._stream.ReadVarUInt32()) | Reads and returns a signed, zigzag-encoded, varint-encoded,
32-bit integer. | Reads and returns a signed, zigzag-encoded, varint-encoded,
32-bit integer. | [
"Reads",
"and",
"returns",
"a",
"signed",
"zigzag",
"-",
"encoded",
"varint",
"-",
"encoded",
"32",
"-",
"bit",
"integer",
"."
] | def ReadSInt32(self):
"""Reads and returns a signed, zigzag-encoded, varint-encoded,
32-bit integer."""
return wire_format.ZigZagDecode(self._stream.ReadVarUInt32()) | [
"def",
"ReadSInt32",
"(",
"self",
")",
":",
"return",
"wire_format",
".",
"ZigZagDecode",
"(",
"self",
".",
"_stream",
".",
"ReadVarUInt32",
"(",
")",
")"
] | https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/internal/decoder.py#L103-L106 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/richtext.py | python | RichTextPlainText.SetText | (*args, **kwargs) | return _richtext.RichTextPlainText_SetText(*args, **kwargs) | SetText(self, String text) | SetText(self, String text) | [
"SetText",
"(",
"self",
"String",
"text",
")"
] | def SetText(*args, **kwargs):
"""SetText(self, String text)"""
return _richtext.RichTextPlainText_SetText(*args, **kwargs) | [
"def",
"SetText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextPlainText_SetText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L2100-L2102 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | Position.checkskip | (self, string) | return True | Check for a string at the given position; if there, skip it | Check for a string at the given position; if there, skip it | [
"Check",
"for",
"a",
"string",
"at",
"the",
"given",
"position",
";",
"if",
"there",
"skip",
"it"
] | def checkskip(self, string):
"Check for a string at the given position; if there, skip it"
if not self.checkfor(string):
return False
self.skip(string)
return True | [
"def",
"checkskip",
"(",
"self",
",",
"string",
")",
":",
"if",
"not",
"self",
".",
"checkfor",
"(",
"string",
")",
":",
"return",
"False",
"self",
".",
"skip",
"(",
"string",
")",
"return",
"True"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L2065-L2070 | |
dicecco1/fpga_caffe | 7a191704efd7873071cfef35772d7e7bf3e3cfd6 | scripts/cpp_lint.py | python | CheckForBadCharacters | (filename, lines, error) | Logs an error for each line containing bad characters.
Two kinds of bad characters:
1. Unicode replacement characters: These indicate that either the file
contained invalid UTF-8 (likely) or Unicode replacement characters (which
it shouldn't). Note that it's possible for this to throw off line
numbering if... | Logs an error for each line containing bad characters. | [
"Logs",
"an",
"error",
"for",
"each",
"line",
"containing",
"bad",
"characters",
"."
] | def CheckForBadCharacters(filename, lines, error):
"""Logs an error for each line containing bad characters.
Two kinds of bad characters:
1. Unicode replacement characters: These indicate that either the file
contained invalid UTF-8 (likely) or Unicode replacement characters (which
it shouldn't). Note that... | [
"def",
"CheckForBadCharacters",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"for",
"linenum",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"if",
"u'\\ufffd'",
"in",
"line",
":",
"error",
"(",
"filename",
",",
"linenum",
",",
"'reada... | https://github.com/dicecco1/fpga_caffe/blob/7a191704efd7873071cfef35772d7e7bf3e3cfd6/scripts/cpp_lint.py#L1487-L1509 | ||
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/mox.py | python | UnorderedGroup.IsSatisfied | (self) | return len(self._methods) == 0 | Return True if there are not any methods in this group. | Return True if there are not any methods in this group. | [
"Return",
"True",
"if",
"there",
"are",
"not",
"any",
"methods",
"in",
"this",
"group",
"."
] | def IsSatisfied(self):
"""Return True if there are not any methods in this group."""
return len(self._methods) == 0 | [
"def",
"IsSatisfied",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_methods",
")",
"==",
"0"
] | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/mox.py#L1257-L1260 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/magics/basic.py | python | MagicsDisplay._jsonable | (self) | return magic_dict | turn magics dict into jsonable dict of the same structure
replaces object instances with their class names as strings | turn magics dict into jsonable dict of the same structure
replaces object instances with their class names as strings | [
"turn",
"magics",
"dict",
"into",
"jsonable",
"dict",
"of",
"the",
"same",
"structure",
"replaces",
"object",
"instances",
"with",
"their",
"class",
"names",
"as",
"strings"
] | def _jsonable(self):
"""turn magics dict into jsonable dict of the same structure
replaces object instances with their class names as strings
"""
magic_dict = {}
mman = self.magics_manager
magics = mman.lsmagic()
for key, subdict in magics.items():
... | [
"def",
"_jsonable",
"(",
"self",
")",
":",
"magic_dict",
"=",
"{",
"}",
"mman",
"=",
"self",
".",
"magics_manager",
"magics",
"=",
"mman",
".",
"lsmagic",
"(",
")",
"for",
"key",
",",
"subdict",
"in",
"magics",
".",
"items",
"(",
")",
":",
"d",
"="... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/magics/basic.py#L47-L65 | |
Harick1/caffe-yolo | eea92bf3ddfe4d0ff6b0b3ba9b15c029a83ed9a3 | python/draw_net.py | python | parse_args | () | return args | Parse input arguments | Parse input arguments | [
"Parse",
"input",
"arguments"
] | def parse_args():
"""Parse input arguments
"""
parser = ArgumentParser(description=__doc__,
formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument('input_net_proto_file',
help='Input network prototxt file')
parser.add_argument('output... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
",",
"formatter_class",
"=",
"ArgumentDefaultsHelpFormatter",
")",
"parser",
".",
"add_argument",
"(",
"'input_net_proto_file'",
",",
"help",
"=",
"'Input networ... | https://github.com/Harick1/caffe-yolo/blob/eea92bf3ddfe4d0ff6b0b3ba9b15c029a83ed9a3/python/draw_net.py#L13-L33 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/reductions/solvers/conic_solvers/cvxopt_conif.py | python | CVXOPT.name | (self) | return s.CVXOPT | The name of the solver. | The name of the solver. | [
"The",
"name",
"of",
"the",
"solver",
"."
] | def name(self):
"""The name of the solver.
"""
return s.CVXOPT | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"s",
".",
"CVXOPT"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/reductions/solvers/conic_solvers/cvxopt_conif.py#L68-L71 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/ArchWall.py | python | _CommandWall.setHeight | (self,d) | Simple callback for the interactive mode gui widget to set height. | Simple callback for the interactive mode gui widget to set height. | [
"Simple",
"callback",
"for",
"the",
"interactive",
"mode",
"gui",
"widget",
"to",
"set",
"height",
"."
] | def setHeight(self,d):
"""Simple callback for the interactive mode gui widget to set height."""
self.Height = d
self.tracker.height(d)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").SetFloat("WallHeight",d) | [
"def",
"setHeight",
"(",
"self",
",",
"d",
")",
":",
"self",
".",
"Height",
"=",
"d",
"self",
".",
"tracker",
".",
"height",
"(",
"d",
")",
"FreeCAD",
".",
"ParamGet",
"(",
"\"User parameter:BaseApp/Preferences/Mod/Arch\"",
")",
".",
"SetFloat",
"(",
"\"Wa... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchWall.py#L574-L579 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/buffer.py | python | Buffer.cursor_down | (self, count: int = 1) | (for multiline edit). Move cursor to the next line. | (for multiline edit). Move cursor to the next line. | [
"(",
"for",
"multiline",
"edit",
")",
".",
"Move",
"cursor",
"to",
"the",
"next",
"line",
"."
] | def cursor_down(self, count: int = 1) -> None:
"""(for multiline edit). Move cursor to the next line."""
original_column = self.preferred_column or self.document.cursor_position_col
self.cursor_position += self.document.get_cursor_down_position(
count=count, preferred_column=original... | [
"def",
"cursor_down",
"(",
"self",
",",
"count",
":",
"int",
"=",
"1",
")",
"->",
"None",
":",
"original_column",
"=",
"self",
".",
"preferred_column",
"or",
"self",
".",
"document",
".",
"cursor_position_col",
"self",
".",
"cursor_position",
"+=",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/buffer.py#L737-L745 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/_sys_util.py | python | make_unity_server_env | () | return env | Returns the environment for unity_server.
The environment is necessary to start the unity_server
by setting the proper environments for shared libraries,
hadoop classpath, and module search paths for python lambda workers.
The environment has 3 components:
1. CLASSPATH, contains hadoop class path
... | Returns the environment for unity_server. | [
"Returns",
"the",
"environment",
"for",
"unity_server",
"."
] | def make_unity_server_env():
"""
Returns the environment for unity_server.
The environment is necessary to start the unity_server
by setting the proper environments for shared libraries,
hadoop classpath, and module search paths for python lambda workers.
The environment has 3 components:
... | [
"def",
"make_unity_server_env",
"(",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"# Add hadoop class path",
"classpath",
"=",
"get_hadoop_class_path",
"(",
")",
"if",
"\"CLASSPATH\"",
"in",
"env",
":",
"env",
"[",
"\"CLASSPATH\"",
"]",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/_sys_util.py#L23-L79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.