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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | Font.SetNativeFontInfo | (*args, **kwargs) | return _gdi_.Font_SetNativeFontInfo(*args, **kwargs) | SetNativeFontInfo(self, NativeFontInfo info)
Set the font's attributes from a `wx.NativeFontInfo` object. | SetNativeFontInfo(self, NativeFontInfo info) | [
"SetNativeFontInfo",
"(",
"self",
"NativeFontInfo",
"info",
")"
] | def SetNativeFontInfo(*args, **kwargs):
"""
SetNativeFontInfo(self, NativeFontInfo info)
Set the font's attributes from a `wx.NativeFontInfo` object.
"""
return _gdi_.Font_SetNativeFontInfo(*args, **kwargs) | [
"def",
"SetNativeFontInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Font_SetNativeFontInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L2366-L2372 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/filters.py | python | do_dictsort | (value, case_sensitive=False, by='key', reverse=False) | return sorted(value.items(), key=sort_func, reverse=reverse) | Sort a dict and yield (key, value) pairs. Because python dicts are
unsorted you may want to use this function to order them by either
key or value:
.. sourcecode:: jinja
{% for item in mydict|dictsort %}
sort the dict by key, case insensitive
{% for item in mydict|dictsort(rev... | Sort a dict and yield (key, value) pairs. Because python dicts are
unsorted you may want to use this function to order them by either
key or value: | [
"Sort",
"a",
"dict",
"and",
"yield",
"(",
"key",
"value",
")",
"pairs",
".",
"Because",
"python",
"dicts",
"are",
"unsorted",
"you",
"may",
"want",
"to",
"use",
"this",
"function",
"to",
"order",
"them",
"by",
"either",
"key",
"or",
"value",
":"
] | def do_dictsort(value, case_sensitive=False, by='key', reverse=False):
"""Sort a dict and yield (key, value) pairs. Because python dicts are
unsorted you may want to use this function to order them by either
key or value:
.. sourcecode:: jinja
{% for item in mydict|dictsort %}
sort... | [
"def",
"do_dictsort",
"(",
"value",
",",
"case_sensitive",
"=",
"False",
",",
"by",
"=",
"'key'",
",",
"reverse",
"=",
"False",
")",
":",
"if",
"by",
"==",
"'key'",
":",
"pos",
"=",
"0",
"elif",
"by",
"==",
"'value'",
":",
"pos",
"=",
"1",
"else",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/filters.py#L206-L242 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plat-mac/pimp.py | python | PimpPackage_installer.installPackageOnly | (self, output=None) | return '%s: downloaded and opened. Install manually and restart Package Manager' % self.archiveFilename | Install a single source package.
If output is given it should be a file-like object and it
will receive a log of what happened. | Install a single source package. | [
"Install",
"a",
"single",
"source",
"package",
"."
] | def installPackageOnly(self, output=None):
"""Install a single source package.
If output is given it should be a file-like object and it
will receive a log of what happened."""
if 'Post-install-command' in self._dict:
return "%s: Installer package cannot have Post-install-c... | [
"def",
"installPackageOnly",
"(",
"self",
",",
"output",
"=",
"None",
")",
":",
"if",
"'Post-install-command'",
"in",
"self",
".",
"_dict",
":",
"return",
"\"%s: Installer package cannot have Post-install-command\"",
"%",
"self",
".",
"fullname",
"(",
")",
"if",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plat-mac/pimp.py#L913-L937 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/default_settings.py | python | out_folder_ios | (ctx, section_name, option_name, value) | return _get_string_value(ctx, 'Ios Output Folder', value) | Configure output folder for iOS | Configure output folder for iOS | [
"Configure",
"output",
"folder",
"for",
"iOS"
] | def out_folder_ios(ctx, section_name, option_name, value):
""" Configure output folder for iOS """
if not _is_user_input_allowed(ctx, option_name, value):
return value
# GUI
if not ctx.is_option_true('console_mode'):
return ctx.gui_get_attribute(section_name, option_name, value)
... | [
"def",
"out_folder_ios",
"(",
"ctx",
",",
"section_name",
",",
"option_name",
",",
"value",
")",
":",
"if",
"not",
"_is_user_input_allowed",
"(",
"ctx",
",",
"option_name",
",",
"value",
")",
":",
"return",
"value",
"# GUI",
"if",
"not",
"ctx",
".",
"is_op... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/default_settings.py#L343-L353 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/paginate.py | python | Paginator.paginate | (self, **kwargs) | return self.PAGE_ITERATOR_CLS(
self._method, self._input_token,
self._output_token, self._more_results,
self._result_keys, self._non_aggregate_keys,
self._limit_key,
page_params['MaxItems'],
page_params['StartingToken'],
page_params['Pa... | Create paginator object for an operation.
This returns an iterable object. Iterating over
this object will yield a single page of a response
at a time. | Create paginator object for an operation. | [
"Create",
"paginator",
"object",
"for",
"an",
"operation",
"."
] | def paginate(self, **kwargs):
"""Create paginator object for an operation.
This returns an iterable object. Iterating over
this object will yield a single page of a response
at a time.
"""
page_params = self._extract_paging_params(kwargs)
return self.PAGE_ITERA... | [
"def",
"paginate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"page_params",
"=",
"self",
".",
"_extract_paging_params",
"(",
"kwargs",
")",
"return",
"self",
".",
"PAGE_ITERATOR_CLS",
"(",
"self",
".",
"_method",
",",
"self",
".",
"_input_token",
","... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/paginate.py#L609-L626 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/parso/py2/parso/python/tree.py | python | Function.is_generator | (self) | return next(self.iter_yield_exprs(), None) is not None | :return bool: Checks if a function is a generator or not. | :return bool: Checks if a function is a generator or not. | [
":",
"return",
"bool",
":",
"Checks",
"if",
"a",
"function",
"is",
"a",
"generator",
"or",
"not",
"."
] | def is_generator(self):
"""
:return bool: Checks if a function is a generator or not.
"""
return next(self.iter_yield_exprs(), None) is not None | [
"def",
"is_generator",
"(",
"self",
")",
":",
"return",
"next",
"(",
"self",
".",
"iter_yield_exprs",
"(",
")",
",",
"None",
")",
"is",
"not",
"None"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/parso/py2/parso/python/tree.py#L656-L660 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/debugger.py | python | Pdb.print_list_lines | (self, filename, first, last) | The printing (as opposed to the parsing part of a 'list'
command. | The printing (as opposed to the parsing part of a 'list'
command. | [
"The",
"printing",
"(",
"as",
"opposed",
"to",
"the",
"parsing",
"part",
"of",
"a",
"list",
"command",
"."
] | def print_list_lines(self, filename, first, last):
"""The printing (as opposed to the parsing part of a 'list'
command."""
try:
Colors = self.color_scheme_table.active_colors
ColorsNormal = Colors.Normal
tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNorm... | [
"def",
"print_list_lines",
"(",
"self",
",",
"filename",
",",
"first",
",",
"last",
")",
":",
"try",
":",
"Colors",
"=",
"self",
".",
"color_scheme_table",
".",
"active_colors",
"ColorsNormal",
"=",
"Colors",
".",
"Normal",
"tpl_line",
"=",
"'%%s%s%%s %s%%s'",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/debugger.py#L457-L485 | ||
CGRU/cgru | 1881a4128530e3d31ac6c25314c18314fc50c2c7 | afanasy/python/af.py | python | Block.setFramesPerTask | (self, value) | Missing DocString
:param value:
:return: | Missing DocString | [
"Missing",
"DocString"
] | def setFramesPerTask(self, value):
"""Missing DocString
:param value:
:return:
"""
self.data["frames_per_task"] = int(value) | [
"def",
"setFramesPerTask",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"data",
"[",
"\"frames_per_task\"",
"]",
"=",
"int",
"(",
"value",
")"
] | https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/afanasy/python/af.py#L192-L198 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/debug/wrappers/local_cli_wrapper.py | python | LocalCLIDebugWrapperSession.__init__ | (self,
sess,
dump_root=None,
log_usage=True,
ui_type="curses",
thread_name_filter=None,
config_file_path=False) | Constructor of LocalCLIDebugWrapperSession.
Args:
sess: The TensorFlow `Session` object being wrapped.
dump_root: (`str`) optional path to the dump root directory. Must be a
directory that does not exist or an empty directory. If the directory
does not exist, it will be created by the d... | Constructor of LocalCLIDebugWrapperSession. | [
"Constructor",
"of",
"LocalCLIDebugWrapperSession",
"."
] | def __init__(self,
sess,
dump_root=None,
log_usage=True,
ui_type="curses",
thread_name_filter=None,
config_file_path=False):
"""Constructor of LocalCLIDebugWrapperSession.
Args:
sess: The TensorFlow `Session` object... | [
"def",
"__init__",
"(",
"self",
",",
"sess",
",",
"dump_root",
"=",
"None",
",",
"log_usage",
"=",
"True",
",",
"ui_type",
"=",
"\"curses\"",
",",
"thread_name_filter",
"=",
"None",
",",
"config_file_path",
"=",
"False",
")",
":",
"if",
"log_usage",
":",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/wrappers/local_cli_wrapper.py#L47-L127 | ||
dicecco1/fpga_caffe | 7a191704efd7873071cfef35772d7e7bf3e3cfd6 | python/caffe/coord_map.py | python | compose | (base_map, next_map) | return ax, a1 * a2, a1 * b2 + b1 | Compose a base coord map with scale a1, shift b1 with a further coord map
with scale a2, shift b2. The scales multiply and the further shift, b2,
is scaled by base coord scale a1. | Compose a base coord map with scale a1, shift b1 with a further coord map
with scale a2, shift b2. The scales multiply and the further shift, b2,
is scaled by base coord scale a1. | [
"Compose",
"a",
"base",
"coord",
"map",
"with",
"scale",
"a1",
"shift",
"b1",
"with",
"a",
"further",
"coord",
"map",
"with",
"scale",
"a2",
"shift",
"b2",
".",
"The",
"scales",
"multiply",
"and",
"the",
"further",
"shift",
"b2",
"is",
"scaled",
"by",
... | def compose(base_map, next_map):
"""
Compose a base coord map with scale a1, shift b1 with a further coord map
with scale a2, shift b2. The scales multiply and the further shift, b2,
is scaled by base coord scale a1.
"""
ax1, a1, b1 = base_map
ax2, a2, b2 = next_map
if ax1 is None:
... | [
"def",
"compose",
"(",
"base_map",
",",
"next_map",
")",
":",
"ax1",
",",
"a1",
",",
"b1",
"=",
"base_map",
"ax2",
",",
"a2",
",",
"b2",
"=",
"next_map",
"if",
"ax1",
"is",
"None",
":",
"ax",
"=",
"ax2",
"elif",
"ax2",
"is",
"None",
"or",
"ax1",
... | https://github.com/dicecco1/fpga_caffe/blob/7a191704efd7873071cfef35772d7e7bf3e3cfd6/python/caffe/coord_map.py#L89-L103 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/__init__.py | python | connect_ia | (ia_access_key_id=None, ia_secret_access_key=None,
is_secure=False, **kwargs) | return S3Connection(access_key, secret_key,
host='s3.us.archive.org',
calling_format=OrdinaryCallingFormat(),
is_secure=is_secure, **kwargs) | Connect to the Internet Archive via their S3-like API.
:type ia_access_key_id: string
:param ia_access_key_id: Your IA Access Key ID. This will also look
in your boto config file for an entry in the Credentials
section called "ia_access_key_id"
:type ia_secret_access_key: string
:para... | Connect to the Internet Archive via their S3-like API. | [
"Connect",
"to",
"the",
"Internet",
"Archive",
"via",
"their",
"S3",
"-",
"like",
"API",
"."
] | def connect_ia(ia_access_key_id=None, ia_secret_access_key=None,
is_secure=False, **kwargs):
"""
Connect to the Internet Archive via their S3-like API.
:type ia_access_key_id: string
:param ia_access_key_id: Your IA Access Key ID. This will also look
in your boto config file for... | [
"def",
"connect_ia",
"(",
"ia_access_key_id",
"=",
"None",
",",
"ia_secret_access_key",
"=",
"None",
",",
"is_secure",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"boto",
".",
"s3",
".",
"connection",
"import",
"S3Connection",
"from",
"boto",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/__init__.py#L581-L610 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TNEANetNodeI.__init__ | (self, *args) | __init__(TNEANetNodeI self) -> TNEANetNodeI
__init__(TNEANetNodeI self, TNEANet::TNodeI const & NodeI) -> TNEANetNodeI
Parameters:
NodeI: TNEANet::TNodeI const & | __init__(TNEANetNodeI self) -> TNEANetNodeI
__init__(TNEANetNodeI self, TNEANet::TNodeI const & NodeI) -> TNEANetNodeI | [
"__init__",
"(",
"TNEANetNodeI",
"self",
")",
"-",
">",
"TNEANetNodeI",
"__init__",
"(",
"TNEANetNodeI",
"self",
"TNEANet",
"::",
"TNodeI",
"const",
"&",
"NodeI",
")",
"-",
">",
"TNEANetNodeI"
] | def __init__(self, *args):
"""
__init__(TNEANetNodeI self) -> TNEANetNodeI
__init__(TNEANetNodeI self, TNEANet::TNodeI const & NodeI) -> TNEANetNodeI
Parameters:
NodeI: TNEANet::TNodeI const &
"""
_snap.TNEANetNodeI_swiginit(self,_snap.new_TNEANetNodeI(*arg... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"_snap",
".",
"TNEANetNodeI_swiginit",
"(",
"self",
",",
"_snap",
".",
"new_TNEANetNodeI",
"(",
"*",
"args",
")",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L20718-L20727 | ||
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | deeplearn_utils/train_fs.py | python | fetch_training_data_files | (fs_dir, subjects_dir, img_input_type, training_subject_idxs) | return training_data_files | assumes a freesurfer directory structure
# Arguments
:param fs_dir: directory with all the scanner freesurfer results stored
:param src_scanner: scanner directory name from which we want to extract training images
:param: src_img_input_type: freesurfer output that we want to extract for e.g. orig/001.mg... | assumes a freesurfer directory structure
# Arguments
:param fs_dir: directory with all the scanner freesurfer results stored
:param src_scanner: scanner directory name from which we want to extract training images
:param: src_img_input_type: freesurfer output that we want to extract for e.g. orig/001.mg... | [
"assumes",
"a",
"freesurfer",
"directory",
"structure",
"#",
"Arguments",
":",
"param",
"fs_dir",
":",
"directory",
"with",
"all",
"the",
"scanner",
"freesurfer",
"results",
"stored",
":",
"param",
"src_scanner",
":",
"scanner",
"directory",
"name",
"from",
"whi... | def fetch_training_data_files(fs_dir, subjects_dir, img_input_type, training_subject_idxs):
''' assumes a freesurfer directory structure
# Arguments
:param fs_dir: directory with all the scanner freesurfer results stored
:param src_scanner: scanner directory name from which we want to extract training i... | [
"def",
"fetch_training_data_files",
"(",
"fs_dir",
",",
"subjects_dir",
",",
"img_input_type",
",",
"training_subject_idxs",
")",
":",
"src_subj_dir_list",
"=",
"sorted",
"(",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"fs_dir",
",",
"subje... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/deeplearn_utils/train_fs.py#L51-L67 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | Printout.OnEndPrinting | (*args, **kwargs) | return _windows_.Printout_OnEndPrinting(*args, **kwargs) | OnEndPrinting(self) | OnEndPrinting(self) | [
"OnEndPrinting",
"(",
"self",
")"
] | def OnEndPrinting(*args, **kwargs):
"""OnEndPrinting(self)"""
return _windows_.Printout_OnEndPrinting(*args, **kwargs) | [
"def",
"OnEndPrinting",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"Printout_OnEndPrinting",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L5403-L5405 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Utils.py | python | nada | (*k, **kw) | Does nothing
:return: None | Does nothing | [
"Does",
"nothing"
] | def nada(*k, **kw):
"""
Does nothing
:return: None
"""
pass | [
"def",
"nada",
"(",
"*",
"k",
",",
"*",
"*",
"kw",
")",
":",
"pass"
] | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Utils.py#L752-L758 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | ToolBarBase.DoInsertTool | (*args, **kwargs) | return _controls_.ToolBarBase_DoInsertTool(*args, **kwargs) | DoInsertTool(self, size_t pos, int id, String label, Bitmap bitmap, Bitmap bmpDisabled=wxNullBitmap,
int kind=ITEM_NORMAL,
String shortHelp=EmptyString, String longHelp=EmptyString,
PyObject clientData=None) -> ToolBarToolBase | DoInsertTool(self, size_t pos, int id, String label, Bitmap bitmap, Bitmap bmpDisabled=wxNullBitmap,
int kind=ITEM_NORMAL,
String shortHelp=EmptyString, String longHelp=EmptyString,
PyObject clientData=None) -> ToolBarToolBase | [
"DoInsertTool",
"(",
"self",
"size_t",
"pos",
"int",
"id",
"String",
"label",
"Bitmap",
"bitmap",
"Bitmap",
"bmpDisabled",
"=",
"wxNullBitmap",
"int",
"kind",
"=",
"ITEM_NORMAL",
"String",
"shortHelp",
"=",
"EmptyString",
"String",
"longHelp",
"=",
"EmptyString",
... | def DoInsertTool(*args, **kwargs):
"""
DoInsertTool(self, size_t pos, int id, String label, Bitmap bitmap, Bitmap bmpDisabled=wxNullBitmap,
int kind=ITEM_NORMAL,
String shortHelp=EmptyString, String longHelp=EmptyString,
PyObject clientData=None) -> ToolBarToolBase... | [
"def",
"DoInsertTool",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ToolBarBase_DoInsertTool",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L3602-L3609 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/gdb/mongo.py | python | MongoDBJavaScriptStack.javascript_stack | () | GDB in-process python supplement. | GDB in-process python supplement. | [
"GDB",
"in",
"-",
"process",
"python",
"supplement",
"."
] | def javascript_stack():
"""GDB in-process python supplement."""
for thread in gdb.selected_inferior().threads():
try:
if not thread.is_valid():
print("Ignoring invalid thread %d in javascript_stack" % thread.num)
continue
... | [
"def",
"javascript_stack",
"(",
")",
":",
"for",
"thread",
"in",
"gdb",
".",
"selected_inferior",
"(",
")",
".",
"threads",
"(",
")",
":",
"try",
":",
"if",
"not",
"thread",
".",
"is_valid",
"(",
")",
":",
"print",
"(",
"\"Ignoring invalid thread %d in jav... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/gdb/mongo.py#L769-L814 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/ndarray/utils.py | python | load | (fname) | Loads an array from file.
See more details in ``save``.
Parameters
----------
fname : str
The filename.
Returns
-------
list of NDArray, RowSparseNDArray or CSRNDArray, or \
dict of str to NDArray, RowSparseNDArray or CSRNDArray
Loaded data. | Loads an array from file. | [
"Loads",
"an",
"array",
"from",
"file",
"."
] | def load(fname):
"""Loads an array from file.
See more details in ``save``.
Parameters
----------
fname : str
The filename.
Returns
-------
list of NDArray, RowSparseNDArray or CSRNDArray, or \
dict of str to NDArray, RowSparseNDArray or CSRNDArray
Loaded data.
... | [
"def",
"load",
"(",
"fname",
")",
":",
"if",
"not",
"isinstance",
"(",
"fname",
",",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"'fname required to be a string'",
")",
"out_size",
"=",
"mx_uint",
"(",
")",
"out_name_size",
"=",
"mx_uint",
"(",
")",... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/ndarray/utils.py#L149-L182 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | uCSIsControlPictures | (code) | return ret | Check whether the character is part of ControlPictures UCS
Block | Check whether the character is part of ControlPictures UCS
Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"ControlPictures",
"UCS",
"Block"
] | def uCSIsControlPictures(code):
"""Check whether the character is part of ControlPictures UCS
Block """
ret = libxml2mod.xmlUCSIsControlPictures(code)
return ret | [
"def",
"uCSIsControlPictures",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsControlPictures",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L1667-L1671 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pssunos.py | python | pid_exists | (pid) | return _psposix.pid_exists(pid) | Check for the existence of a unix pid. | Check for the existence of a unix pid. | [
"Check",
"for",
"the",
"existence",
"of",
"a",
"unix",
"pid",
"."
] | def pid_exists(pid):
"""Check for the existence of a unix pid."""
return _psposix.pid_exists(pid) | [
"def",
"pid_exists",
"(",
"pid",
")",
":",
"return",
"_psposix",
".",
"pid_exists",
"(",
"pid",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pssunos.py#L123-L125 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/tensor_shape.py | python | as_shape | (shape) | Converts the given object to a TensorShape. | Converts the given object to a TensorShape. | [
"Converts",
"the",
"given",
"object",
"to",
"a",
"TensorShape",
"."
] | def as_shape(shape):
"""Converts the given object to a TensorShape."""
if isinstance(shape, TensorShape):
return shape
else:
return TensorShape(shape) | [
"def",
"as_shape",
"(",
"shape",
")",
":",
"if",
"isinstance",
"(",
"shape",
",",
"TensorShape",
")",
":",
"return",
"shape",
"else",
":",
"return",
"TensorShape",
"(",
"shape",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/tensor_shape.py#L1424-L1429 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/base.py | python | Index.shape | (self) | return self._values.shape | Return a tuple of the shape of the underlying data. | Return a tuple of the shape of the underlying data. | [
"Return",
"a",
"tuple",
"of",
"the",
"shape",
"of",
"the",
"underlying",
"data",
"."
] | def shape(self):
"""
Return a tuple of the shape of the underlying data.
"""
# not using "(len(self), )" to return "correct" shape if the values
# consists of a >1 D array (see GH-27775)
# overridden in MultiIndex.shape to avoid materializing the values
return sel... | [
"def",
"shape",
"(",
"self",
")",
":",
"# not using \"(len(self), )\" to return \"correct\" shape if the values",
"# consists of a >1 D array (see GH-27775)",
"# overridden in MultiIndex.shape to avoid materializing the values",
"return",
"self",
".",
"_values",
".",
"shape"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/base.py#L5237-L5244 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/common.py | python | WriteOnDiff | (filename) | return Writer() | Write to a file only if the new contents differ.
Arguments:
filename: name of the file to potentially write to.
Returns:
A file like object which will write to temporary file and only overwrite
the target if it differs (on close). | Write to a file only if the new contents differ. | [
"Write",
"to",
"a",
"file",
"only",
"if",
"the",
"new",
"contents",
"differ",
"."
] | def WriteOnDiff(filename):
"""Write to a file only if the new contents differ.
Arguments:
filename: name of the file to potentially write to.
Returns:
A file like object which will write to temporary file and only overwrite
the target if it differs (on close).
"""
class Writer(object):
"""Wr... | [
"def",
"WriteOnDiff",
"(",
"filename",
")",
":",
"class",
"Writer",
"(",
"object",
")",
":",
"\"\"\"Wrapper around file which only covers the target if it differs.\"\"\"",
"def",
"__init__",
"(",
"self",
")",
":",
"# Pick temporary file.",
"tmp_fd",
",",
"self",
".",
... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/common.py#L329-L399 | |
KDE/krita | 10ea63984e00366865769c193ab298de73a59c5c | plugins/python/channels2layers/channels2layers.py | python | ChannelsToLayers.process | (self, pDocument, pOriginalLayer, pProgress) | return parentGroupLayer | Process given layer with current options | Process given layer with current options | [
"Process",
"given",
"layer",
"with",
"current",
"options"
] | def process(self, pDocument, pOriginalLayer, pProgress):
"""Process given layer with current options"""
self.layerNum = 0
document = pDocument
originalLayer = pOriginalLayer
parentGroupLayer = None
currentProcessedLayer = None
originalLayerIsVisible = originalLay... | [
"def",
"process",
"(",
"self",
",",
"pDocument",
",",
"pOriginalLayer",
",",
"pProgress",
")",
":",
"self",
".",
"layerNum",
"=",
"0",
"document",
"=",
"pDocument",
"originalLayer",
"=",
"pOriginalLayer",
"parentGroupLayer",
"=",
"None",
"currentProcessedLayer",
... | https://github.com/KDE/krita/blob/10ea63984e00366865769c193ab298de73a59c5c/plugins/python/channels2layers/channels2layers.py#L1206-L1445 | |
opencv/opencv | 76aff8478883858f0e46746044348ebb16dc3c67 | samples/dnn/siamrpnpp.py | python | main | () | Sample SiamRPN Tracker | Sample SiamRPN Tracker | [
"Sample",
"SiamRPN",
"Tracker"
] | def main():
""" Sample SiamRPN Tracker
"""
# Computation backends supported by layers
backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV,
cv.dnn.DNN_BACKEND_VKCOM, cv.dnn.DNN_BACKEND_CUDA)
# Target Devices... | [
"def",
"main",
"(",
")",
":",
"# Computation backends supported by layers",
"backends",
"=",
"(",
"cv",
".",
"dnn",
".",
"DNN_BACKEND_DEFAULT",
",",
"cv",
".",
"dnn",
".",
"DNN_BACKEND_HALIDE",
",",
"cv",
".",
"dnn",
".",
"DNN_BACKEND_INFERENCE_ENGINE",
",",
"cv... | https://github.com/opencv/opencv/blob/76aff8478883858f0e46746044348ebb16dc3c67/samples/dnn/siamrpnpp.py#L326-L401 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/legendre.py | python | leggrid2d | (x, y, c) | return c | Evaluate a 2-D Legendre series on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \\sum_{i,j} c_{i,j} * L_i(a) * L_j(b)
where the points `(a, b)` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulting points form a grid with
`x` i... | Evaluate a 2-D Legendre series on the Cartesian product of x and y. | [
"Evaluate",
"a",
"2",
"-",
"D",
"Legendre",
"series",
"on",
"the",
"Cartesian",
"product",
"of",
"x",
"and",
"y",
"."
] | def leggrid2d(x, y, c):
"""
Evaluate a 2-D Legendre series on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \\sum_{i,j} c_{i,j} * L_i(a) * L_j(b)
where the points `(a, b)` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulti... | [
"def",
"leggrid2d",
"(",
"x",
",",
"y",
",",
"c",
")",
":",
"c",
"=",
"legval",
"(",
"x",
",",
"c",
")",
"c",
"=",
"legval",
"(",
"y",
",",
"c",
")",
"return",
"c"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/legendre.py#L1051-L1103 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | dev/archery/archery/utils/lint.py | python | python_linter | (src, fix=False) | Run Python linters on python/pyarrow, python/examples, setup.py
and dev/. | Run Python linters on python/pyarrow, python/examples, setup.py
and dev/. | [
"Run",
"Python",
"linters",
"on",
"python",
"/",
"pyarrow",
"python",
"/",
"examples",
"setup",
".",
"py",
"and",
"dev",
"/",
"."
] | def python_linter(src, fix=False):
"""Run Python linters on python/pyarrow, python/examples, setup.py
and dev/. """
setup_py = os.path.join(src.python, "setup.py")
setup_cfg = os.path.join(src.python, "setup.cfg")
logger.info("Running Python formatter (autopep8)")
autopep8 = Autopep8()
if ... | [
"def",
"python_linter",
"(",
"src",
",",
"fix",
"=",
"False",
")",
":",
"setup_py",
"=",
"os",
".",
"path",
".",
"join",
"(",
"src",
".",
"python",
",",
"\"setup.py\"",
")",
"setup_cfg",
"=",
"os",
".",
"path",
".",
"join",
"(",
"src",
".",
"python... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/dev/archery/archery/utils/lint.py#L171-L234 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/telemetry/core/timeline/thread.py | python | Thread.EndSlice | (self, end_timestamp, end_thread_timestamp=None) | return curr_slice | Ends the last begun slice in this group and pushes it onto the slice
array.
* end_timestamp: Timestamp when the slice ended in milliseconds
* end_thread_timestamp: Timestamp when the scheduled time of the slice ended
in milliseconds
returns completed slice. | Ends the last begun slice in this group and pushes it onto the slice
array. | [
"Ends",
"the",
"last",
"begun",
"slice",
"in",
"this",
"group",
"and",
"pushes",
"it",
"onto",
"the",
"slice",
"array",
"."
] | def EndSlice(self, end_timestamp, end_thread_timestamp=None):
""" Ends the last begun slice in this group and pushes it onto the slice
array.
* end_timestamp: Timestamp when the slice ended in milliseconds
* end_thread_timestamp: Timestamp when the scheduled time of the slice ended
... | [
"def",
"EndSlice",
"(",
"self",
",",
"end_timestamp",
",",
"end_thread_timestamp",
"=",
"None",
")",
":",
"if",
"not",
"len",
"(",
"self",
".",
"_open_slices",
")",
":",
"raise",
"ValueError",
"(",
"'EndSlice called without an open slice'",
")",
"curr_slice",
"=... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/telemetry/core/timeline/thread.py#L126-L152 | |
Illumina/manta | 75b5c38d4fcd2f6961197b28a41eb61856f2d976 | src/python/lib/estimateHardware.py | python | getNodeMemMb | () | return memMb | return total memory in Mbytes
linux logic taken from R Kelley's function in IsisWorkflow | return total memory in Mbytes | [
"return",
"total",
"memory",
"in",
"Mbytes"
] | def getNodeMemMb():
"""
return total memory in Mbytes
linux logic taken from R Kelley's function in IsisWorkflow
"""
memMb = 0
import platform
if platform.system().find("Linux") > -1:
#
# get this from /proc/meminfo
#
mname="/proc/meminfo"
if not o... | [
"def",
"getNodeMemMb",
"(",
")",
":",
"memMb",
"=",
"0",
"import",
"platform",
"if",
"platform",
".",
"system",
"(",
")",
".",
"find",
"(",
"\"Linux\"",
")",
">",
"-",
"1",
":",
"#",
"# get this from /proc/meminfo",
"#",
"mname",
"=",
"\"/proc/meminfo\"",
... | https://github.com/Illumina/manta/blob/75b5c38d4fcd2f6961197b28a41eb61856f2d976/src/python/lib/estimateHardware.py#L122-L168 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | get_entry_info | (dist, group, name) | return get_distribution(dist).get_entry_info(group, name) | Return the EntryPoint object for `group`+`name`, or ``None`` | Return the EntryPoint object for `group`+`name`, or ``None`` | [
"Return",
"the",
"EntryPoint",
"object",
"for",
"group",
"+",
"name",
"or",
"None"
] | def get_entry_info(dist, group, name):
"""Return the EntryPoint object for `group`+`name`, or ``None``"""
return get_distribution(dist).get_entry_info(group, name) | [
"def",
"get_entry_info",
"(",
"dist",
",",
"group",
",",
"name",
")",
":",
"return",
"get_distribution",
"(",
"dist",
")",
".",
"get_entry_info",
"(",
"group",
",",
"name",
")"
] | 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/pkg_resources/__init__.py#L497-L499 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/indexes/base.py | python | Index.nlevels | (self) | return 1 | Number of levels. | Number of levels. | [
"Number",
"of",
"levels",
"."
] | def nlevels(self) -> int:
"""
Number of levels.
"""
return 1 | [
"def",
"nlevels",
"(",
"self",
")",
"->",
"int",
":",
"return",
"1"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L1698-L1702 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/training/python/training/resample.py | python | weighted_resample | (inputs, weights, overall_rate, scope=None,
mean_decay=0.999, warmup=10, seed=None) | Performs an approximate weighted resampling of `inputs`.
This method chooses elements from `inputs` where each item's rate of
selection is proportional to its value in `weights`, and the average
rate of selection across all inputs (and many invocations!) is
`overall_rate`.
Args:
inputs: A list of tensor... | Performs an approximate weighted resampling of `inputs`. | [
"Performs",
"an",
"approximate",
"weighted",
"resampling",
"of",
"inputs",
"."
] | def weighted_resample(inputs, weights, overall_rate, scope=None,
mean_decay=0.999, warmup=10, seed=None):
"""Performs an approximate weighted resampling of `inputs`.
This method chooses elements from `inputs` where each item's rate of
selection is proportional to its value in `weights`, and... | [
"def",
"weighted_resample",
"(",
"inputs",
",",
"weights",
",",
"overall_rate",
",",
"scope",
"=",
"None",
",",
"mean_decay",
"=",
"0.999",
",",
"warmup",
"=",
"10",
",",
"seed",
"=",
"None",
")",
":",
"# Algorithm: Just compute rates as weights/mean_weight *",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/training/python/training/resample.py#L130-L189 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ensurepip/__init__.py | python | bootstrap | (*, root=None, upgrade=False, user=False,
altinstall=False, default_pip=False,
verbosity=0) | Bootstrap pip into the current Python installation (or the given root
directory).
Note that calling this function will alter both sys.path and os.environ. | Bootstrap pip into the current Python installation (or the given root
directory). | [
"Bootstrap",
"pip",
"into",
"the",
"current",
"Python",
"installation",
"(",
"or",
"the",
"given",
"root",
"directory",
")",
"."
] | def bootstrap(*, root=None, upgrade=False, user=False,
altinstall=False, default_pip=False,
verbosity=0):
"""
Bootstrap pip into the current Python installation (or the given root
directory).
Note that calling this function will alter both sys.path and os.environ.
"""
... | [
"def",
"bootstrap",
"(",
"*",
",",
"root",
"=",
"None",
",",
"upgrade",
"=",
"False",
",",
"user",
"=",
"False",
",",
"altinstall",
"=",
"False",
",",
"default_pip",
"=",
"False",
",",
"verbosity",
"=",
"0",
")",
":",
"# Discard the return value",
"_boot... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ensurepip/__init__.py#L59-L71 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBWatchpoint.__str__ | (self) | return _lldb.SBWatchpoint___str__(self) | __str__(SBWatchpoint self) -> PyObject * | __str__(SBWatchpoint self) -> PyObject * | [
"__str__",
"(",
"SBWatchpoint",
"self",
")",
"-",
">",
"PyObject",
"*"
] | def __str__(self):
"""__str__(SBWatchpoint self) -> PyObject *"""
return _lldb.SBWatchpoint___str__(self) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBWatchpoint___str__",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L15269-L15271 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/lib2to3/pytree.py | python | Leaf.__init__ | (self, type, value,
context=None,
prefix=None,
fixers_applied=[]) | Initializer.
Takes a type constant (a token number < 256), a string value, and an
optional context keyword argument. | Initializer. | [
"Initializer",
"."
] | def __init__(self, type, value,
context=None,
prefix=None,
fixers_applied=[]):
"""
Initializer.
Takes a type constant (a token number < 256), a string value, and an
optional context keyword argument.
"""
assert 0 <= type... | [
"def",
"__init__",
"(",
"self",
",",
"type",
",",
"value",
",",
"context",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"fixers_applied",
"=",
"[",
"]",
")",
":",
"assert",
"0",
"<=",
"type",
"<",
"256",
",",
"type",
"if",
"context",
"is",
"not",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/lib2to3/pytree.py#L326-L343 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | schemaCleanupTypes | () | Cleanup the default XML Schemas type library | Cleanup the default XML Schemas type library | [
"Cleanup",
"the",
"default",
"XML",
"Schemas",
"type",
"library"
] | def schemaCleanupTypes():
"""Cleanup the default XML Schemas type library """
libxml2mod.xmlSchemaCleanupTypes() | [
"def",
"schemaCleanupTypes",
"(",
")",
":",
"libxml2mod",
".",
"xmlSchemaCleanupTypes",
"(",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L2014-L2016 | ||
martinmoene/optional-lite | a006f229a77b3b2dacf927e4029b8c1c60c86b52 | script/create-cov-rpt.py | python | executable_name | ( f ) | return os.path.basename( f ) | Folder where the executable is | Folder where the executable is | [
"Folder",
"where",
"the",
"executable",
"is"
] | def executable_name( f ):
"""Folder where the executable is"""
return os.path.basename( f ) | [
"def",
"executable_name",
"(",
"f",
")",
":",
"return",
"os",
".",
"path",
".",
"basename",
"(",
"f",
")"
] | https://github.com/martinmoene/optional-lite/blob/a006f229a77b3b2dacf927e4029b8c1c60c86b52/script/create-cov-rpt.py#L40-L42 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/richtext.py | python | RichTextPrinting.PageSetup | (*args, **kwargs) | return _richtext.RichTextPrinting_PageSetup(*args, **kwargs) | PageSetup(self) | PageSetup(self) | [
"PageSetup",
"(",
"self",
")"
] | def PageSetup(*args, **kwargs):
"""PageSetup(self)"""
return _richtext.RichTextPrinting_PageSetup(*args, **kwargs) | [
"def",
"PageSetup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextPrinting_PageSetup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L4508-L4510 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | DateTime.__le__ | (*args, **kwargs) | return _misc_.DateTime___le__(*args, **kwargs) | __le__(self, DateTime other) -> bool | __le__(self, DateTime other) -> bool | [
"__le__",
"(",
"self",
"DateTime",
"other",
")",
"-",
">",
"bool"
] | def __le__(*args, **kwargs):
"""__le__(self, DateTime other) -> bool"""
return _misc_.DateTime___le__(*args, **kwargs) | [
"def",
"__le__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime___le__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L4110-L4112 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/gluon/parameter.py | python | Parameter._get_row_sparse | (self, arr_list, device, row_id) | return results | Get row_sparse data from row_sparse parameters based on row_id. | Get row_sparse data from row_sparse parameters based on row_id. | [
"Get",
"row_sparse",
"data",
"from",
"row_sparse",
"parameters",
"based",
"on",
"row_id",
"."
] | def _get_row_sparse(self, arr_list, device, row_id):
""" Get row_sparse data from row_sparse parameters based on row_id. """
# get row sparse params based on row ids
if not isinstance(row_id, ndarray.NDArray):
raise TypeError("row_id must have NDArray type, but %s is given"%(type(row... | [
"def",
"_get_row_sparse",
"(",
"self",
",",
"arr_list",
",",
"device",
",",
"row_id",
")",
":",
"# get row sparse params based on row ids",
"if",
"not",
"isinstance",
"(",
"row_id",
",",
"ndarray",
".",
"NDArray",
")",
":",
"raise",
"TypeError",
"(",
"\"row_id m... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/gluon/parameter.py#L254-L267 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Job.py | python | Jobs._reset_sig_handler | (self) | Restore the signal handlers to their previous state (before the
call to _setup_sig_handler(). | Restore the signal handlers to their previous state (before the
call to _setup_sig_handler(). | [
"Restore",
"the",
"signal",
"handlers",
"to",
"their",
"previous",
"state",
"(",
"before",
"the",
"call",
"to",
"_setup_sig_handler",
"()",
"."
] | def _reset_sig_handler(self):
"""Restore the signal handlers to their previous state (before the
call to _setup_sig_handler()."""
signal.signal(signal.SIGINT, self.old_sigint)
signal.signal(signal.SIGTERM, self.old_sigterm)
try:
signal.signal(signal.SIGHUP, self.old... | [
"def",
"_reset_sig_handler",
"(",
"self",
")",
":",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGINT",
",",
"self",
".",
"old_sigint",
")",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGTERM",
",",
"self",
".",
"old_sigterm",
")",
"try",
":",
"s... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Job.py#L155-L164 | ||
ouster-lidar/ouster_example | 13ea8e8b8a4951fb630dbc9108666995c8443bf6 | python/src/ouster/sdk/examples/client.py | python | plot_xyz_points | (hostname: str, lidar_port: int = 7502) | Display range from a single scan as 3D points
Args:
hostname: hostname of the sensor
lidar_port: UDP port to listen on for lidar data | Display range from a single scan as 3D points | [
"Display",
"range",
"from",
"a",
"single",
"scan",
"as",
"3D",
"points"
] | def plot_xyz_points(hostname: str, lidar_port: int = 7502) -> None:
"""Display range from a single scan as 3D points
Args:
hostname: hostname of the sensor
lidar_port: UDP port to listen on for lidar data
"""
import matplotlib.pyplot as plt # type: ignore
# get single scan
met... | [
"def",
"plot_xyz_points",
"(",
"hostname",
":",
"str",
",",
"lidar_port",
":",
"int",
"=",
"7502",
")",
"->",
"None",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"# type: ignore",
"# get single scan",
"metadata",
",",
"sample",
"=",
"client",
".... | https://github.com/ouster-lidar/ouster_example/blob/13ea8e8b8a4951fb630dbc9108666995c8443bf6/python/src/ouster/sdk/examples/client.py#L186-L217 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Node.py | python | Node.chmod | (self, val) | Change file/dir permissions::
def build(bld):
bld.path.chmod(493) # 0755 | Change file/dir permissions:: | [
"Change",
"file",
"/",
"dir",
"permissions",
"::"
] | def chmod(self, val):
"""
Change file/dir permissions::
def build(bld):
bld.path.chmod(493) # 0755
"""
os.chmod(self.abspath(), val) | [
"def",
"chmod",
"(",
"self",
",",
"val",
")",
":",
"os",
".",
"chmod",
"(",
"self",
".",
"abspath",
"(",
")",
",",
"val",
")"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Node.py#L176-L183 | ||
msitt/blpapi-python | bebcf43668c9e5f5467b1f685f9baebbfc45bc87 | src/blpapi/element.py | python | Element.__str__ | (self) | return self.toString() | x.__str__() <==> str(x)
Return a string representation of this Element. Call of 'str(element)'
is equivalent to 'element.toString()' called with default parameters. | x.__str__() <==> str(x) | [
"x",
".",
"__str__",
"()",
"<",
"==",
">",
"str",
"(",
"x",
")"
] | def __str__(self):
"""x.__str__() <==> str(x)
Return a string representation of this Element. Call of 'str(element)'
is equivalent to 'element.toString()' called with default parameters.
"""
return self.toString() | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"toString",
"(",
")"
] | https://github.com/msitt/blpapi-python/blob/bebcf43668c9e5f5467b1f685f9baebbfc45bc87/src/blpapi/element.py#L211-L219 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/autograph/utils/py_func.py | python | wrap_py_func | (f, return_dtypes, args, kwargs=None, use_dummy_return=False) | return script_ops.eager_py_func(f_wrapper, tensor_args, return_dtypes) | Helper that wraps a callable to py_func.
The helper passes tensor arguments through the py_func interface. Non-tensor
arguments are allowed, and will be passed to f directly. Note that non-tensor
arguments are captured by f will not update every time the wrapper is
called (this is consistent with its argument ... | Helper that wraps a callable to py_func. | [
"Helper",
"that",
"wraps",
"a",
"callable",
"to",
"py_func",
"."
] | def wrap_py_func(f, return_dtypes, args, kwargs=None, use_dummy_return=False):
"""Helper that wraps a callable to py_func.
The helper passes tensor arguments through the py_func interface. Non-tensor
arguments are allowed, and will be passed to f directly. Note that non-tensor
arguments are captured by f will ... | [
"def",
"wrap_py_func",
"(",
"f",
",",
"return_dtypes",
",",
"args",
",",
"kwargs",
"=",
"None",
",",
"use_dummy_return",
"=",
"False",
")",
":",
"if",
"return_dtypes",
"and",
"use_dummy_return",
":",
"raise",
"ValueError",
"(",
"'if use_dummy_return is True, retur... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/autograph/utils/py_func.py#L34-L128 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/chunk.py | python | Chunk.read | (self, size=-1) | return data | Read at most size bytes from the chunk.
If size is omitted or negative, read until the end
of the chunk. | Read at most size bytes from the chunk.
If size is omitted or negative, read until the end
of the chunk. | [
"Read",
"at",
"most",
"size",
"bytes",
"from",
"the",
"chunk",
".",
"If",
"size",
"is",
"omitted",
"or",
"negative",
"read",
"until",
"the",
"end",
"of",
"the",
"chunk",
"."
] | def read(self, size=-1):
"""Read at most size bytes from the chunk.
If size is omitted or negative, read until the end
of the chunk.
"""
if self.closed:
raise ValueError("I/O operation on closed file")
if self.size_read >= self.chunksize:
return b... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"-",
"1",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"ValueError",
"(",
"\"I/O operation on closed file\"",
")",
"if",
"self",
".",
"size_read",
">=",
"self",
".",
"chunksize",
":",
"return",
"b''",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/chunk.py#L122-L143 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/docs/bcdoc/restdoc.py | python | DocumentStructure.flush_structure | (self) | return value | Flushes a doc structure to a ReSTructed string
The document is flushed out in a DFS style where sections and their
subsections' values are added to the string as they are visited. | Flushes a doc structure to a ReSTructed string | [
"Flushes",
"a",
"doc",
"structure",
"to",
"a",
"ReSTructed",
"string"
] | def flush_structure(self):
"""Flushes a doc structure to a ReSTructed string
The document is flushed out in a DFS style where sections and their
subsections' values are added to the string as they are visited.
"""
# We are at the root flush the links at the beginning of the
... | [
"def",
"flush_structure",
"(",
"self",
")",
":",
"# We are at the root flush the links at the beginning of the",
"# document",
"if",
"len",
"(",
"self",
".",
"path",
")",
"==",
"1",
":",
"if",
"self",
".",
"hrefs",
":",
"self",
".",
"style",
".",
"new_paragraph"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/docs/bcdoc/restdoc.py#L193-L209 | |
Jittor/jittor | e9aca0444c2bdc8e2389d99122954cd0903eec46 | python/jittor/__init__.py | python | load | (path: str) | return model_dict | loads an object from a file. | loads an object from a file. | [
"loads",
"an",
"object",
"from",
"a",
"file",
"."
] | def load(path: str):
''' loads an object from a file.
'''
model_dict = safeunpickle(path)
return model_dict | [
"def",
"load",
"(",
"path",
":",
"str",
")",
":",
"model_dict",
"=",
"safeunpickle",
"(",
"path",
")",
"return",
"model_dict"
] | https://github.com/Jittor/jittor/blob/e9aca0444c2bdc8e2389d99122954cd0903eec46/python/jittor/__init__.py#L734-L738 | |
lighttransport/nanort | 74063967336311f54ede5dffdfa242123825033b | deps/cpplint.py | python | FileInfo.NoExtension | (self) | return '/'.join(self.Split()[0:2]) | File has no source file extension. | File has no source file extension. | [
"File",
"has",
"no",
"source",
"file",
"extension",
"."
] | def NoExtension(self):
"""File has no source file extension."""
return '/'.join(self.Split()[0:2]) | [
"def",
"NoExtension",
"(",
"self",
")",
":",
"return",
"'/'",
".",
"join",
"(",
"self",
".",
"Split",
"(",
")",
"[",
"0",
":",
"2",
"]",
")"
] | https://github.com/lighttransport/nanort/blob/74063967336311f54ede5dffdfa242123825033b/deps/cpplint.py#L1055-L1057 | |
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | libpyclingo/clingo/script.py | python | Script.callable | (self, name: str) | Check there is a function with the given name.
Parameters
----------
name
The name of the function.
Returns
-------
Whether the function is callable. | Check there is a function with the given name. | [
"Check",
"there",
"is",
"a",
"function",
"with",
"the",
"given",
"name",
"."
] | def callable(self, name: str) -> bool:
'''
Check there is a function with the given name.
Parameters
----------
name
The name of the function.
Returns
-------
Whether the function is callable.
''' | [
"def",
"callable",
"(",
"self",
",",
"name",
":",
"str",
")",
"->",
"bool",
":"
] | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/libpyclingo/clingo/script.py#L106-L118 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/distutils/ccompiler.py | python | CCompiler_find_executables | (self) | Does nothing here, but is called by the get_version method and can be
overridden by subclasses. In particular it is redefined in the `FCompiler`
class where more documentation can be found. | Does nothing here, but is called by the get_version method and can be
overridden by subclasses. In particular it is redefined in the `FCompiler`
class where more documentation can be found. | [
"Does",
"nothing",
"here",
"but",
"is",
"called",
"by",
"the",
"get_version",
"method",
"and",
"can",
"be",
"overridden",
"by",
"subclasses",
".",
"In",
"particular",
"it",
"is",
"redefined",
"in",
"the",
"FCompiler",
"class",
"where",
"more",
"documentation",... | def CCompiler_find_executables(self):
"""
Does nothing here, but is called by the get_version method and can be
overridden by subclasses. In particular it is redefined in the `FCompiler`
class where more documentation can be found.
"""
pass | [
"def",
"CCompiler_find_executables",
"(",
"self",
")",
":",
"pass"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/distutils/ccompiler.py#L101-L108 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/saving/saved_model/load.py | python | _finalize_saved_model_layers | (layers) | Runs the final steps of loading Keras Layers from SavedModel. | Runs the final steps of loading Keras Layers from SavedModel. | [
"Runs",
"the",
"final",
"steps",
"of",
"loading",
"Keras",
"Layers",
"from",
"SavedModel",
"."
] | def _finalize_saved_model_layers(layers):
"""Runs the final steps of loading Keras Layers from SavedModel."""
# pylint: disable=protected-access
# 1. Set up call functions for all layers initialized from the SavedModel (
# and not the config)
for layer in layers:
layer.built = True
layer_call = getatt... | [
"def",
"_finalize_saved_model_layers",
"(",
"layers",
")",
":",
"# pylint: disable=protected-access",
"# 1. Set up call functions for all layers initialized from the SavedModel (",
"# and not the config)",
"for",
"layer",
"in",
"layers",
":",
"layer",
".",
"built",
"=",
"True",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/saving/saved_model/load.py#L799-L842 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | DateTime_GetCountry | (*args) | return _misc_.DateTime_GetCountry(*args) | DateTime_GetCountry() -> int | DateTime_GetCountry() -> int | [
"DateTime_GetCountry",
"()",
"-",
">",
"int"
] | def DateTime_GetCountry(*args):
"""DateTime_GetCountry() -> int"""
return _misc_.DateTime_GetCountry(*args) | [
"def",
"DateTime_GetCountry",
"(",
"*",
"args",
")",
":",
"return",
"_misc_",
".",
"DateTime_GetCountry",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L4229-L4231 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/unicode.py | python | unicode_upper | (data) | return case_operation(_ascii_upper, _unicode_upper) | Implements .upper() | Implements .upper() | [
"Implements",
".",
"upper",
"()"
] | def unicode_upper(data):
"""Implements .upper()"""
return case_operation(_ascii_upper, _unicode_upper) | [
"def",
"unicode_upper",
"(",
"data",
")",
":",
"return",
"case_operation",
"(",
"_ascii_upper",
",",
"_unicode_upper",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/unicode.py#L2093-L2095 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/factorization/python/ops/gmm_ops.py | python | GmmAlgorithm._define_prior_log_prob_operation | (self, shard_id) | Computes the prior probability of all samples.
Updates a vector where each item is the prior probabibility of an
input example.
Args:
shard_id: id of current shard_id. | Computes the prior probability of all samples. | [
"Computes",
"the",
"prior",
"probability",
"of",
"all",
"samples",
"."
] | def _define_prior_log_prob_operation(self, shard_id):
"""Computes the prior probability of all samples.
Updates a vector where each item is the prior probabibility of an
input example.
Args:
shard_id: id of current shard_id.
"""
self._prior_probs[shard_id] = tf.log(
tf.reduce_sum... | [
"def",
"_define_prior_log_prob_operation",
"(",
"self",
",",
"shard_id",
")",
":",
"self",
".",
"_prior_probs",
"[",
"shard_id",
"]",
"=",
"tf",
".",
"log",
"(",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"exp",
"(",
"self",
".",
"_probs",
"[",
"shard_id",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/factorization/python/ops/gmm_ops.py#L282-L292 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/core_set.py | python | _Compare | (a_name, b_name, csv) | Compare two core sets. | Compare two core sets. | [
"Compare",
"two",
"core",
"sets",
"."
] | def _Compare(a_name, b_name, csv):
"""Compare two core sets."""
a = _ReadCoreSet(a_name)
b = _ReadCoreSet(b_name)
result = (resource_sack.GraphSack.CoreSimilarity(a, b),
' Equal' if a == b else 'UnEqual',
'a<=b' if a <= b else 'a!<b',
'a>=b' if b <= a else 'a!>b')
if csv:
... | [
"def",
"_Compare",
"(",
"a_name",
",",
"b_name",
",",
"csv",
")",
":",
"a",
"=",
"_ReadCoreSet",
"(",
"a_name",
")",
"b",
"=",
"_ReadCoreSet",
"(",
"b_name",
")",
"result",
"=",
"(",
"resource_sack",
".",
"GraphSack",
".",
"CoreSimilarity",
"(",
"a",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/core_set.py#L96-L107 | ||
larq/compute-engine | a2611f8e33f5cb9b4d09b7c9aff7053620a24305 | configure.py | python | create_android_ndk_rule | (environ_cp) | Set ANDROID_NDK_HOME and write Android NDK WORKSPACE rule. | Set ANDROID_NDK_HOME and write Android NDK WORKSPACE rule. | [
"Set",
"ANDROID_NDK_HOME",
"and",
"write",
"Android",
"NDK",
"WORKSPACE",
"rule",
"."
] | def create_android_ndk_rule(environ_cp):
"""Set ANDROID_NDK_HOME and write Android NDK WORKSPACE rule."""
if is_windows() or is_cygwin():
default_ndk_path = cygpath("%s/Android/Sdk/ndk-bundle" % environ_cp["APPDATA"])
elif is_macos():
default_ndk_path = "%s/library/Android/Sdk/ndk-bundle" % ... | [
"def",
"create_android_ndk_rule",
"(",
"environ_cp",
")",
":",
"if",
"is_windows",
"(",
")",
"or",
"is_cygwin",
"(",
")",
":",
"default_ndk_path",
"=",
"cygpath",
"(",
"\"%s/Android/Sdk/ndk-bundle\"",
"%",
"environ_cp",
"[",
"\"APPDATA\"",
"]",
")",
"elif",
"is_... | https://github.com/larq/compute-engine/blob/a2611f8e33f5cb9b4d09b7c9aff7053620a24305/configure.py#L445-L470 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/base.py | python | ExtensionArray.nbytes | (self) | The number of bytes needed to store this object in memory. | The number of bytes needed to store this object in memory. | [
"The",
"number",
"of",
"bytes",
"needed",
"to",
"store",
"this",
"object",
"in",
"memory",
"."
] | def nbytes(self) -> int:
"""
The number of bytes needed to store this object in memory.
"""
# If this is expensive to compute, return an approximate lower bound
# on the number of bytes needed.
raise AbstractMethodError(self) | [
"def",
"nbytes",
"(",
"self",
")",
"->",
"int",
":",
"# If this is expensive to compute, return an approximate lower bound",
"# on the number of bytes needed.",
"raise",
"AbstractMethodError",
"(",
"self",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/base.py#L413-L419 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/roslaunch/src/roslaunch/server.py | python | ROSLaunchChildHandler.launch | (self, launch_xml) | Launch the roslaunch XML file. Because this is a child
roslaunch, it will not set parameters nor manipulate the
master. Call blocks until launch is complete
@param xml: roslaunch XML file to launch
@type xml: str
@return: code, msg, [ [ successful launches], [failed launches] ]
... | Launch the roslaunch XML file. Because this is a child
roslaunch, it will not set parameters nor manipulate the
master. Call blocks until launch is complete | [
"Launch",
"the",
"roslaunch",
"XML",
"file",
".",
"Because",
"this",
"is",
"a",
"child",
"roslaunch",
"it",
"will",
"not",
"set",
"parameters",
"nor",
"manipulate",
"the",
"master",
".",
"Call",
"blocks",
"until",
"launch",
"is",
"complete"
] | def launch(self, launch_xml):
"""
Launch the roslaunch XML file. Because this is a child
roslaunch, it will not set parameters nor manipulate the
master. Call blocks until launch is complete
@param xml: roslaunch XML file to launch
@type xml: str
@return: code, m... | [
"def",
"launch",
"(",
"self",
",",
"launch_xml",
")",
":",
"if",
"self",
".",
"pm",
"is",
"None",
":",
"return",
"0",
",",
"\"uninitialized\"",
",",
"-",
"1",
"rosconfig",
"=",
"roslaunch",
".",
"config",
".",
"ROSLaunchConfig",
"(",
")",
"try",
":",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/roslaunch/src/roslaunch/server.py#L303-L337 | ||
crosslife/OpenBird | 9e0198a1a2295f03fa1e8676e216e22c9c7d380b | cocos2d/tools/project-creator/module/ui.py | python | ThreadedTask.run | (self) | Create cocos project.
custom message rules to notify ui
As follow:
begin@%d@%d@%s --- create before
doing@%d@%d@%s --- creating
end@%d@%d@%s --- create after | Create cocos project.
custom message rules to notify ui
As follow:
begin | [
"Create",
"cocos",
"project",
".",
"custom",
"message",
"rules",
"to",
"notify",
"ui",
"As",
"follow",
":",
"begin"
] | def run(self):
"""Create cocos project.
custom message rules to notify ui
As follow:
begin@%d@%d@%s --- create before
doing@%d@%d@%s --- creating
end@%d@%d@%s --- create after
"""
#delete exist project.
if os.path.exists(os.path.jo... | [
"def",
"run",
"(",
"self",
")",
":",
"#delete exist project.",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"projectPath",
",",
"self",
".",
"projectName",
")",
")",
":",
"print",
"(",
"\"###begin remov... | https://github.com/crosslife/OpenBird/blob/9e0198a1a2295f03fa1e8676e216e22c9c7d380b/cocos2d/tools/project-creator/module/ui.py#L59-L92 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/parallel/_cost_model_context.py | python | reset_cost_model_context | () | Reset cost model context attributes. | Reset cost model context attributes. | [
"Reset",
"cost",
"model",
"context",
"attributes",
"."
] | def reset_cost_model_context():
"""Reset cost model context attributes."""
cost_model_context().reset_cost_model() | [
"def",
"reset_cost_model_context",
"(",
")",
":",
"cost_model_context",
"(",
")",
".",
"reset_cost_model",
"(",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/parallel/_cost_model_context.py#L618-L620 | ||
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/universe_generation/util.py | python | report_error | (msg) | Handles error messages. | Handles error messages. | [
"Handles",
"error",
"messages",
"."
] | def report_error(msg):
"""
Handles error messages.
"""
error_list.append(msg)
print(msg, file=sys.stderr) | [
"def",
"report_error",
"(",
"msg",
")",
":",
"error_list",
".",
"append",
"(",
"msg",
")",
"print",
"(",
"msg",
",",
"file",
"=",
"sys",
".",
"stderr",
")"
] | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/universe_generation/util.py#L40-L45 | ||
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/descriptor_database.py | python | DescriptorDatabase.Add | (self, file_desc_proto) | Adds the FileDescriptorProto and its types to this database.
Args:
file_desc_proto: The FileDescriptorProto to add. | Adds the FileDescriptorProto and its types to this database. | [
"Adds",
"the",
"FileDescriptorProto",
"and",
"its",
"types",
"to",
"this",
"database",
"."
] | def Add(self, file_desc_proto):
"""Adds the FileDescriptorProto and its types to this database.
Args:
file_desc_proto: The FileDescriptorProto to add.
"""
self._file_desc_protos_by_file[file_desc_proto.name] = file_desc_proto
package = file_desc_proto.package
for message in file_desc_pro... | [
"def",
"Add",
"(",
"self",
",",
"file_desc_proto",
")",
":",
"self",
".",
"_file_desc_protos_by_file",
"[",
"file_desc_proto",
".",
"name",
"]",
"=",
"file_desc_proto",
"package",
"=",
"file_desc_proto",
".",
"package",
"for",
"message",
"in",
"file_desc_proto",
... | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/descriptor_database.py#L43-L57 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py | python | FakeOsModule.umask | (self, new_mask) | return old_umask | Change the current umask.
Args:
new_mask: An integer.
Returns:
The old mask.
Raises:
TypeError: new_mask is of an invalid type. | Change the current umask. | [
"Change",
"the",
"current",
"umask",
"."
] | def umask(self, new_mask):
"""Change the current umask.
Args:
new_mask: An integer.
Returns:
The old mask.
Raises:
TypeError: new_mask is of an invalid type.
"""
if not isinstance(new_mask, int):
raise TypeError('an integer is required')
old_umask = self.filesystem... | [
"def",
"umask",
"(",
"self",
",",
"new_mask",
")",
":",
"if",
"not",
"isinstance",
"(",
"new_mask",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"'an integer is required'",
")",
"old_umask",
"=",
"self",
".",
"filesystem",
".",
"umask",
"self",
".",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py#L1333-L1349 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | MenuItem.GetFont | (*args, **kwargs) | return _core_.MenuItem_GetFont(*args, **kwargs) | GetFont(self) -> Font | GetFont(self) -> Font | [
"GetFont",
"(",
"self",
")",
"-",
">",
"Font"
] | def GetFont(*args, **kwargs):
"""GetFont(self) -> Font"""
return _core_.MenuItem_GetFont(*args, **kwargs) | [
"def",
"GetFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MenuItem_GetFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L12561-L12563 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/parallel/_auto_parallel_context.py | python | _AutoParallelContext.get_optimizer_weight_shard_size | (self) | return self._context_handle.get_optimizer_weight_shard_size() | Get optimizer_weight_shard_size. | Get optimizer_weight_shard_size. | [
"Get",
"optimizer_weight_shard_size",
"."
] | def get_optimizer_weight_shard_size(self):
"""Get optimizer_weight_shard_size."""
self.check_context_handle()
return self._context_handle.get_optimizer_weight_shard_size() | [
"def",
"get_optimizer_weight_shard_size",
"(",
"self",
")",
":",
"self",
".",
"check_context_handle",
"(",
")",
"return",
"self",
".",
"_context_handle",
".",
"get_optimizer_weight_shard_size",
"(",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/parallel/_auto_parallel_context.py#L769-L772 | |
mgbellemare/Arcade-Learning-Environment | 0af0ff4a49a981d113c67b866fa152dbc7a1c0a7 | src/gym/envs/atari/environment.py | python | AtariEnv.clone_state | (self, include_rng=False) | return self.ale.cloneState(include_rng=include_rng) | Clone emulator state w/o system state. Restoring this state will
*not* give an identical environment. For complete cloning and restoring
of the full state, see `{clone,restore}_full_state()`. | Clone emulator state w/o system state. Restoring this state will
*not* give an identical environment. For complete cloning and restoring
of the full state, see `{clone,restore}_full_state()`. | [
"Clone",
"emulator",
"state",
"w",
"/",
"o",
"system",
"state",
".",
"Restoring",
"this",
"state",
"will",
"*",
"not",
"*",
"give",
"an",
"identical",
"environment",
".",
"For",
"complete",
"cloning",
"and",
"restoring",
"of",
"the",
"full",
"state",
"see"... | def clone_state(self, include_rng=False) -> ALEState:
"""Clone emulator state w/o system state. Restoring this state will
*not* give an identical environment. For complete cloning and restoring
of the full state, see `{clone,restore}_full_state()`."""
return self.ale.cloneState(include_r... | [
"def",
"clone_state",
"(",
"self",
",",
"include_rng",
"=",
"False",
")",
"->",
"ALEState",
":",
"return",
"self",
".",
"ale",
".",
"cloneState",
"(",
"include_rng",
"=",
"include_rng",
")"
] | https://github.com/mgbellemare/Arcade-Learning-Environment/blob/0af0ff4a49a981d113c67b866fa152dbc7a1c0a7/src/gym/envs/atari/environment.py#L341-L345 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/ltisys.py | python | dbode | (system, w=None, n=100) | return w / dt, mag, phase | Calculate Bode magnitude and phase data of a discrete-time system.
Parameters
----------
system : an instance of the LTI class or a tuple describing the system.
The following gives the number of elements in the tuple and
the interpretation:
* 1 (instance of `dlti`)
... | Calculate Bode magnitude and phase data of a discrete-time system. | [
"Calculate",
"Bode",
"magnitude",
"and",
"phase",
"data",
"of",
"a",
"discrete",
"-",
"time",
"system",
"."
] | def dbode(system, w=None, n=100):
"""
Calculate Bode magnitude and phase data of a discrete-time system.
Parameters
----------
system : an instance of the LTI class or a tuple describing the system.
The following gives the number of elements in the tuple and
the interpretation:
... | [
"def",
"dbode",
"(",
"system",
",",
"w",
"=",
"None",
",",
"n",
"=",
"100",
")",
":",
"w",
",",
"y",
"=",
"dfreqresp",
"(",
"system",
",",
"w",
"=",
"w",
",",
"n",
"=",
"n",
")",
"if",
"isinstance",
"(",
"system",
",",
"dlti",
")",
":",
"dt... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/ltisys.py#L3593-L3664 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/simple.py | python | ImportCinema | (filename, view=None) | return False | ::deprecated:: 5.9
Cinema import capabilities are no longer supported in this version. | ::deprecated:: 5.9 | [
"::",
"deprecated",
"::",
"5",
".",
"9"
] | def ImportCinema(filename, view=None):
"""::deprecated:: 5.9
Cinema import capabilities are no longer supported in this version.
"""
import warnings
warnings.warn("'ImportCinema' is no longer supported", DeprecationWarning)
return False | [
"def",
"ImportCinema",
"(",
"filename",
",",
"view",
"=",
"None",
")",
":",
"import",
"warnings",
"warnings",
".",
"warn",
"(",
"\"'ImportCinema' is no longer supported\"",
",",
"DeprecationWarning",
")",
"return",
"False"
] | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/simple.py#L1236-L1243 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | GBSizerItem.GetPos | (*args, **kwargs) | return _core_.GBSizerItem_GetPos(*args, **kwargs) | GetPos(self) -> GBPosition
Get the grid position of the item | GetPos(self) -> GBPosition | [
"GetPos",
"(",
"self",
")",
"-",
">",
"GBPosition"
] | def GetPos(*args, **kwargs):
"""
GetPos(self) -> GBPosition
Get the grid position of the item
"""
return _core_.GBSizerItem_GetPos(*args, **kwargs) | [
"def",
"GetPos",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"GBSizerItem_GetPos",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L15737-L15743 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | DC.GetLogicalScale | (*args, **kwargs) | return _gdi_.DC_GetLogicalScale(*args, **kwargs) | GetLogicalScale() -> (xScale, yScale) | GetLogicalScale() -> (xScale, yScale) | [
"GetLogicalScale",
"()",
"-",
">",
"(",
"xScale",
"yScale",
")"
] | def GetLogicalScale(*args, **kwargs):
"""GetLogicalScale() -> (xScale, yScale)"""
return _gdi_.DC_GetLogicalScale(*args, **kwargs) | [
"def",
"GetLogicalScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetLogicalScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L4446-L4448 | |
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/yapf/yapf/yapflib/unwrapped_line.py | python | UnwrappedLine.AsCode | (self, indent_per_depth=2) | return indent + tokens_str | Return a "code" representation of this line.
The code representation shows how the line would be printed out as code.
TODO(eliben): for now this is rudimentary for debugging - once we add
formatting capabilities, this method will have other uses (not all tokens
have spaces around them, for example).
... | Return a "code" representation of this line. | [
"Return",
"a",
"code",
"representation",
"of",
"this",
"line",
"."
] | def AsCode(self, indent_per_depth=2):
"""Return a "code" representation of this line.
The code representation shows how the line would be printed out as code.
TODO(eliben): for now this is rudimentary for debugging - once we add
formatting capabilities, this method will have other uses (not all tokens... | [
"def",
"AsCode",
"(",
"self",
",",
"indent_per_depth",
"=",
"2",
")",
":",
"indent",
"=",
"' '",
"*",
"indent_per_depth",
"*",
"self",
".",
"depth",
"tokens_str",
"=",
"' '",
".",
"join",
"(",
"tok",
".",
"value",
"for",
"tok",
"in",
"self",
".",
"_t... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/yapf/yapf/yapflib/unwrapped_line.py#L123-L140 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/arch/isa_parser/isa_parser.py | python | ISAParser.p_opt_default_0 | (self, t) | opt_default : empty | opt_default : empty | [
"opt_default",
":",
"empty"
] | def p_opt_default_0(self, t):
'opt_default : empty'
# no default specified: reuse the one currently at the top of
# the stack
self.defaultStack.push(self.defaultStack.top())
# no meaningful value returned
t[0] = None | [
"def",
"p_opt_default_0",
"(",
"self",
",",
"t",
")",
":",
"# no default specified: reuse the one currently at the top of",
"# the stack",
"self",
".",
"defaultStack",
".",
"push",
"(",
"self",
".",
"defaultStack",
".",
"top",
"(",
")",
")",
"# no meaningful value ret... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/arch/isa_parser/isa_parser.py#L1185-L1191 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/parallel_compile/tbe_compiler/tbe_adapter.py | python | sync_fusion_env | (fusion_need_sync, module_list) | return True | Sync fusion env
:param fusion_need_sync:
:param module_list:
:return: | Sync fusion env
:param fusion_need_sync:
:param module_list:
:return: | [
"Sync",
"fusion",
"env",
":",
"param",
"fusion_need_sync",
":",
":",
"param",
"module_list",
":",
":",
"return",
":"
] | def sync_fusion_env(fusion_need_sync, module_list):
"""
Sync fusion env
:param fusion_need_sync:
:param module_list:
:return:
"""
if fusion_need_sync == 0:
return True
module_using = []
for key, value in module_list.items():
if value > 0:
module_using.app... | [
"def",
"sync_fusion_env",
"(",
"fusion_need_sync",
",",
"module_list",
")",
":",
"if",
"fusion_need_sync",
"==",
"0",
":",
"return",
"True",
"module_using",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"module_list",
".",
"items",
"(",
")",
":",
"if",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/parallel_compile/tbe_compiler/tbe_adapter.py#L505-L523 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py | python | _InstallRequirementBackedCandidate._check_metadata_consistency | (self, dist) | Check for consistency of project name and version of dist. | Check for consistency of project name and version of dist. | [
"Check",
"for",
"consistency",
"of",
"project",
"name",
"and",
"version",
"of",
"dist",
"."
] | def _check_metadata_consistency(self, dist):
# type: (Distribution) -> None
"""Check for consistency of project name and version of dist."""
canonical_name = canonicalize_name(dist.project_name)
if self._name is not None and self._name != canonical_name:
raise MetadataInconsi... | [
"def",
"_check_metadata_consistency",
"(",
"self",
",",
"dist",
")",
":",
"# type: (Distribution) -> None",
"canonical_name",
"=",
"canonicalize_name",
"(",
"dist",
".",
"project_name",
")",
"if",
"self",
".",
"_name",
"is",
"not",
"None",
"and",
"self",
".",
"_... | 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/_internal/resolution/resolvelib/candidates.py#L204-L221 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/urllib/parse.py | python | _splittype | (url) | return None, url | splittype('type:opaquestring') --> 'type', 'opaquestring'. | splittype('type:opaquestring') --> 'type', 'opaquestring'. | [
"splittype",
"(",
"type",
":",
"opaquestring",
")",
"--",
">",
"type",
"opaquestring",
"."
] | def _splittype(url):
"""splittype('type:opaquestring') --> 'type', 'opaquestring'."""
global _typeprog
if _typeprog is None:
_typeprog = re.compile('([^/:]+):(.*)', re.DOTALL)
match = _typeprog.match(url)
if match:
scheme, data = match.groups()
return scheme.lower(), data
... | [
"def",
"_splittype",
"(",
"url",
")",
":",
"global",
"_typeprog",
"if",
"_typeprog",
"is",
"None",
":",
"_typeprog",
"=",
"re",
".",
"compile",
"(",
"'([^/:]+):(.*)'",
",",
"re",
".",
"DOTALL",
")",
"match",
"=",
"_typeprog",
".",
"match",
"(",
"url",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/urllib/parse.py#L1034-L1044 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/metrics/python/ops/metric_ops.py | python | streaming_accuracy | (predictions, labels, weights=None,
metrics_collections=None, updates_collections=None,
name=None) | return streaming_mean(is_correct, weights, metrics_collections,
updates_collections, name or 'accuracy') | Calculates how often `predictions` matches `labels`.
The `streaming_accuracy` function creates two local variables, `total` and
`count` that are used to compute the frequency with which `predictions`
matches `labels`. This frequency is ultimately returned as `accuracy`: an
idempotent operation that simply divi... | Calculates how often `predictions` matches `labels`. | [
"Calculates",
"how",
"often",
"predictions",
"matches",
"labels",
"."
] | def streaming_accuracy(predictions, labels, weights=None,
metrics_collections=None, updates_collections=None,
name=None):
"""Calculates how often `predictions` matches `labels`.
The `streaming_accuracy` function creates two local variables, `total` and
`count` that a... | [
"def",
"streaming_accuracy",
"(",
"predictions",
",",
"labels",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"predictions",
",",
"labels",
"=",
"metric_ops_ut... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/metrics/python/ops/metric_ops.py#L383-L434 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/model/DrillModel.py | python | DrillModel.addSample | (self, index) | return sample | Add a sample to the model.
Args:
index (int): sample index; if -1 the sample is added to the end | Add a sample to the model. | [
"Add",
"a",
"sample",
"to",
"the",
"model",
"."
] | def addSample(self, index):
"""
Add a sample to the model.
Args:
index (int): sample index; if -1 the sample is added to the end
"""
if (index == -1) or (index >= len(self._samples)):
sample = DrillSample(len(self._samples))
self._samples.appe... | [
"def",
"addSample",
"(",
"self",
",",
"index",
")",
":",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"or",
"(",
"index",
">=",
"len",
"(",
"self",
".",
"_samples",
")",
")",
":",
"sample",
"=",
"DrillSample",
"(",
"len",
"(",
"self",
".",
"_samples"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/model/DrillModel.py#L601-L620 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | native_client_sdk/src/build_tools/apply_patch.py | python | _ChangeHunk.Apply | (self, line_num, in_file, out_file) | return line_num | Apply the change hunk to in_file.
Apply the change hunk to in_file, outputing the result to out_file. Raise a
Error exception if any inconsistency is detected.
Arguments:
line_num: the last line number read from in_file, or 0 if the file has not
yet been read from.
in_file: the input... | Apply the change hunk to in_file. | [
"Apply",
"the",
"change",
"hunk",
"to",
"in_file",
"."
] | def Apply(self, line_num, in_file, out_file):
''' Apply the change hunk to in_file.
Apply the change hunk to in_file, outputing the result to out_file. Raise a
Error exception if any inconsistency is detected.
Arguments:
line_num: the last line number read from in_file, or 0 if the file has not
... | [
"def",
"Apply",
"(",
"self",
",",
"line_num",
",",
"in_file",
",",
"out_file",
")",
":",
"# If range starts at N, consume all lines from line_num to N-1. Don't read",
"# line N yet; what we'll do with it depend on the first diff line. Each",
"# line is written to the output file.",
"wh... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/native_client_sdk/src/build_tools/apply_patch.py#L202-L251 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/format.py | python | write_array | (fp, array, version=None, allow_pickle=True, pickle_kwargs=None) | Write an array to an NPY file, including a header.
If the array is neither C-contiguous nor Fortran-contiguous AND the
file_like object is not a real file object, this function will have to
copy data in memory.
Parameters
----------
fp : file_like object
An open, writable file object, ... | Write an array to an NPY file, including a header. | [
"Write",
"an",
"array",
"to",
"an",
"NPY",
"file",
"including",
"a",
"header",
"."
] | def write_array(fp, array, version=None, allow_pickle=True, pickle_kwargs=None):
"""
Write an array to an NPY file, including a header.
If the array is neither C-contiguous nor Fortran-contiguous AND the
file_like object is not a real file object, this function will have to
copy data in memory.
... | [
"def",
"write_array",
"(",
"fp",
",",
"array",
",",
"version",
"=",
"None",
",",
"allow_pickle",
"=",
"True",
",",
"pickle_kwargs",
"=",
"None",
")",
":",
"_check_version",
"(",
"version",
")",
"_write_array_header",
"(",
"fp",
",",
"header_data_from_array_1_0... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/format.py#L623-L692 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/eager/function.py | python | ConcreteFunction.add_gradient_functions_to_graph | (self, g=None) | Add forward/backward functions to graph `g` or the current context. | Add forward/backward functions to graph `g` or the current context. | [
"Add",
"forward",
"/",
"backward",
"functions",
"to",
"graph",
"g",
"or",
"the",
"current",
"context",
"."
] | def add_gradient_functions_to_graph(self, g=None):
"""Add forward/backward functions to graph `g` or the current context."""
if not context.executing_eagerly() and not g:
g = ops.get_default_graph()
self._delayed_rewrite_functions.forward.add_to_graph(g)
forward_function, backward_function = (
... | [
"def",
"add_gradient_functions_to_graph",
"(",
"self",
",",
"g",
"=",
"None",
")",
":",
"if",
"not",
"context",
".",
"executing_eagerly",
"(",
")",
"and",
"not",
"g",
":",
"g",
"=",
"ops",
".",
"get_default_graph",
"(",
")",
"self",
".",
"_delayed_rewrite_... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/eager/function.py#L1335-L1343 | ||
GrammaTech/gtirb | 415dd72e1e3c475004d013723c16cdcb29c0826e | python/gtirb/symbol.py | python | Symbol.referent | (self) | return None | The object referred to by a Symbol, which is :class:`Block`
or None. ``value`` and ``referent`` are mutually exclusive. | The object referred to by a Symbol, which is :class:`Block`
or None. ``value`` and ``referent`` are mutually exclusive. | [
"The",
"object",
"referred",
"to",
"by",
"a",
"Symbol",
"which",
"is",
":",
"class",
":",
"Block",
"or",
"None",
".",
"value",
"and",
"referent",
"are",
"mutually",
"exclusive",
"."
] | def referent(self) -> typing.Optional[Block]:
"""The object referred to by a Symbol, which is :class:`Block`
or None. ``value`` and ``referent`` are mutually exclusive.
"""
if isinstance(self._payload, Block):
return self._payload
return None | [
"def",
"referent",
"(",
"self",
")",
"->",
"typing",
".",
"Optional",
"[",
"Block",
"]",
":",
"if",
"isinstance",
"(",
"self",
".",
"_payload",
",",
"Block",
")",
":",
"return",
"self",
".",
"_payload",
"return",
"None"
] | https://github.com/GrammaTech/gtirb/blob/415dd72e1e3c475004d013723c16cdcb29c0826e/python/gtirb/symbol.py#L72-L79 | |
sailing-pmls/bosen | 06cb58902d011fbea5f9428f10ce30e621492204 | style_script/cpplint.py | python | ProcessFileData | (filename, file_extension, lines, error,
extra_check_functions=[]) | Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
lines: An array of strings, each representing a line of the file, with the
last element being emp... | Performs lint checks and reports any errors to the given error function. | [
"Performs",
"lint",
"checks",
"and",
"reports",
"any",
"errors",
"to",
"the",
"given",
"error",
"function",
"."
] | def ProcessFileData(filename, file_extension, lines, error,
extra_check_functions=[]):
"""Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
... | [
"def",
"ProcessFileData",
"(",
"filename",
",",
"file_extension",
",",
"lines",
",",
"error",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"lines",
"=",
"(",
"[",
"'// marker so line numbers and indices both start at 1'",
"]",
"+",
"lines",
"+",
"[",
"... | https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L5997-L6046 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/factorization/python/ops/factorization_ops.py | python | WALSModel._get_sharding_func | (size, num_shards) | return func | Create sharding function for scatter update. | Create sharding function for scatter update. | [
"Create",
"sharding",
"function",
"for",
"scatter",
"update",
"."
] | def _get_sharding_func(size, num_shards):
"""Create sharding function for scatter update."""
def func(ids):
if num_shards == 1:
return None, ids
else:
ids_per_shard = size // num_shards
extras = size % num_shards
assignments = tf.maximum(ids // (ids_per_shard + 1),
... | [
"def",
"_get_sharding_func",
"(",
"size",
",",
"num_shards",
")",
":",
"def",
"func",
"(",
"ids",
")",
":",
"if",
"num_shards",
"==",
"1",
":",
"return",
"None",
",",
"ids",
"else",
":",
"ids_per_shard",
"=",
"size",
"//",
"num_shards",
"extras",
"=",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/factorization/python/ops/factorization_ops.py#L565-L579 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/_jit_internal.py | python | export | (fn) | return fn | This decorator indicates that a method on an ``nn.Module`` is used as an entry point into a
:class:`ScriptModule` and should be compiled.
``forward`` implicitly is assumed to be an entry point, so it does not need this decorator.
Functions and methods called from ``forward`` are compiled as they are seen
... | This decorator indicates that a method on an ``nn.Module`` is used as an entry point into a
:class:`ScriptModule` and should be compiled. | [
"This",
"decorator",
"indicates",
"that",
"a",
"method",
"on",
"an",
"nn",
".",
"Module",
"is",
"used",
"as",
"an",
"entry",
"point",
"into",
"a",
":",
"class",
":",
"ScriptModule",
"and",
"should",
"be",
"compiled",
"."
] | def export(fn):
"""
This decorator indicates that a method on an ``nn.Module`` is used as an entry point into a
:class:`ScriptModule` and should be compiled.
``forward`` implicitly is assumed to be an entry point, so it does not need this decorator.
Functions and methods called from ``forward`` are... | [
"def",
"export",
"(",
"fn",
")",
":",
"fn",
".",
"_torchscript_modifier",
"=",
"FunctionModifiers",
".",
"EXPORT",
"return",
"fn"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/_jit_internal.py#L465-L508 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | NativeFontInfo.SetFaceName | (*args, **kwargs) | return _gdi_.NativeFontInfo_SetFaceName(*args, **kwargs) | SetFaceName(self, String facename) -> bool | SetFaceName(self, String facename) -> bool | [
"SetFaceName",
"(",
"self",
"String",
"facename",
")",
"-",
">",
"bool"
] | def SetFaceName(*args, **kwargs):
"""SetFaceName(self, String facename) -> bool"""
return _gdi_.NativeFontInfo_SetFaceName(*args, **kwargs) | [
"def",
"SetFaceName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"NativeFontInfo_SetFaceName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1929-L1931 | |
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/Tools/hiedr2mosaic.py | python | check_output_files | (file_list) | Verify the output files were created. | Verify the output files were created. | [
"Verify",
"the",
"output",
"files",
"were",
"created",
"."
] | def check_output_files(file_list):
'''Verify the output files were created.'''
for f in file_list:
if not os.path.exists(f):
raise Exception('Failed to generate file: ' + f) | [
"def",
"check_output_files",
"(",
"file_list",
")",
":",
"for",
"f",
"in",
"file_list",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"f",
")",
":",
"raise",
"Exception",
"(",
"'Failed to generate file: '",
"+",
"f",
")"
] | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/Tools/hiedr2mosaic.py#L114-L118 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/mimetypes.py | python | MimeTypes.read_windows_registry | (self, strict=True) | Load the MIME types database from Windows registry.
If strict is true, information will be added to
list of standard types, else to the list of non-standard
types. | Load the MIME types database from Windows registry. | [
"Load",
"the",
"MIME",
"types",
"database",
"from",
"Windows",
"registry",
"."
] | def read_windows_registry(self, strict=True):
"""
Load the MIME types database from Windows registry.
If strict is true, information will be added to
list of standard types, else to the list of non-standard
types.
"""
# Windows only
if not _winreg:
... | [
"def",
"read_windows_registry",
"(",
"self",
",",
"strict",
"=",
"True",
")",
":",
"# Windows only",
"if",
"not",
"_winreg",
":",
"return",
"def",
"enum_types",
"(",
"mimedb",
")",
":",
"i",
"=",
"0",
"while",
"True",
":",
"try",
":",
"ctype",
"=",
"_w... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/mimetypes.py#L231-L270 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/base.py | python | BaseContext.unpack_value | (self, builder, ty, ptr, align=None) | return dm.load_from_data_pointer(builder, ptr, align) | Unpack value from the array storage at *ptr*.
If *align* is given, it is the guaranteed alignment for *ptr*
(by default, the standard ABI alignment). | Unpack value from the array storage at *ptr*.
If *align* is given, it is the guaranteed alignment for *ptr*
(by default, the standard ABI alignment). | [
"Unpack",
"value",
"from",
"the",
"array",
"storage",
"at",
"*",
"ptr",
"*",
".",
"If",
"*",
"align",
"*",
"is",
"given",
"it",
"is",
"the",
"guaranteed",
"alignment",
"for",
"*",
"ptr",
"*",
"(",
"by",
"default",
"the",
"standard",
"ABI",
"alignment",... | def unpack_value(self, builder, ty, ptr, align=None):
"""
Unpack value from the array storage at *ptr*.
If *align* is given, it is the guaranteed alignment for *ptr*
(by default, the standard ABI alignment).
"""
dm = self.data_model_manager[ty]
return dm.load_from... | [
"def",
"unpack_value",
"(",
"self",
",",
"builder",
",",
"ty",
",",
"ptr",
",",
"align",
"=",
"None",
")",
":",
"dm",
"=",
"self",
".",
"data_model_manager",
"[",
"ty",
"]",
"return",
"dm",
".",
"load_from_data_pointer",
"(",
"builder",
",",
"ptr",
","... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/base.py#L495-L502 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/command/build_py.py | python | build_py.check_package | (self, package, package_dir) | return init_py | Check namespace packages' __init__ for declare_namespace | Check namespace packages' __init__ for declare_namespace | [
"Check",
"namespace",
"packages",
"__init__",
"for",
"declare_namespace"
] | def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
return self.packages_checked[package]
except KeyError:
pass
init_py = orig.build_py.check_package(self, package, package_dir)
self.packages_... | [
"def",
"check_package",
"(",
"self",
",",
"package",
",",
"package_dir",
")",
":",
"try",
":",
"return",
"self",
".",
"packages_checked",
"[",
"package",
"]",
"except",
"KeyError",
":",
"pass",
"init_py",
"=",
"orig",
".",
"build_py",
".",
"check_package",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/command/build_py.py#L156-L184 | |
fenderglass/Flye | 2013acc650356cc934a2a9b82eb90af260c8b52b | flye/utils/fasta_parser.py | python | _validate_seq | (sequence) | return True | sequence : bytes | sequence : bytes | [
"sequence",
":",
"bytes"
] | def _validate_seq(sequence):
"""
sequence : bytes
"""
#if len(sequence.strip(_validate_seq.VALID_CHARS)) > 0:
# return False
if len(sequence.translate(None, _validate_seq.VALID_CHARS)):
return False
return True | [
"def",
"_validate_seq",
"(",
"sequence",
")",
":",
"#if len(sequence.strip(_validate_seq.VALID_CHARS)) > 0:",
"# return False",
"if",
"len",
"(",
"sequence",
".",
"translate",
"(",
"None",
",",
"_validate_seq",
".",
"VALID_CHARS",
")",
")",
":",
"return",
"False",
... | https://github.com/fenderglass/Flye/blob/2013acc650356cc934a2a9b82eb90af260c8b52b/flye/utils/fasta_parser.py#L189-L197 | |
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usd/usd/usdGenSchema.py | python | _GetLibMetadata | (layer) | return dict(globalPrim.customData) | Return a dictionary of library-specific data found in layer. | Return a dictionary of library-specific data found in layer. | [
"Return",
"a",
"dictionary",
"of",
"library",
"-",
"specific",
"data",
"found",
"in",
"layer",
"."
] | def _GetLibMetadata(layer):
""" Return a dictionary of library-specific data found in layer."""
globalPrim = layer.GetPrimAtPath('/GLOBAL')
if not globalPrim:
raise Exception("Code generation requires a \"/GLOBAL\" prim with "
"customData to define at least libraryName. GLOBAL prim ... | [
"def",
"_GetLibMetadata",
"(",
"layer",
")",
":",
"globalPrim",
"=",
"layer",
".",
"GetPrimAtPath",
"(",
"'/GLOBAL'",
")",
"if",
"not",
"globalPrim",
":",
"raise",
"Exception",
"(",
"\"Code generation requires a \\\"/GLOBAL\\\" prim with \"",
"\"customData to define at le... | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usd/usd/usdGenSchema.py#L156-L171 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/models/link.py | python | Link.__init__ | (
self,
url, # type: str
comes_from=None, # type: Optional[Union[str, HTMLPage]]
requires_python=None, # type: Optional[str]
yanked_reason=None, # type: Optional[str]
cache_link_parsing=True, # type: bool
) | :param url: url of the resource pointed to (href of the link)
:param comes_from: instance of HTMLPage where the link was found,
or string.
:param requires_python: String containing the `Requires-Python`
metadata field, specified in PEP 345. This may be specified by
a ... | :param url: url of the resource pointed to (href of the link)
:param comes_from: instance of HTMLPage where the link was found,
or string.
:param requires_python: String containing the `Requires-Python`
metadata field, specified in PEP 345. This may be specified by
a ... | [
":",
"param",
"url",
":",
"url",
"of",
"the",
"resource",
"pointed",
"to",
"(",
"href",
"of",
"the",
"link",
")",
":",
"param",
"comes_from",
":",
"instance",
"of",
"HTMLPage",
"where",
"the",
"link",
"was",
"found",
"or",
"string",
".",
":",
"param",
... | def __init__(
self,
url, # type: str
comes_from=None, # type: Optional[Union[str, HTMLPage]]
requires_python=None, # type: Optional[str]
yanked_reason=None, # type: Optional[str]
cache_link_parsing=True, # type: bool
):
# type: (..... | [
"def",
"__init__",
"(",
"self",
",",
"url",
",",
"# type: str",
"comes_from",
"=",
"None",
",",
"# type: Optional[Union[str, HTMLPage]]",
"requires_python",
"=",
"None",
",",
"# type: Optional[str]",
"yanked_reason",
"=",
"None",
",",
"# type: Optional[str]",
"cache_lin... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/models/link.py#L36-L81 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py | python | Distribution.reinitialize_command | (self, command, reinit_subcommands=0) | return command | Reinitializes a command to the state it was in when first
returned by 'get_command_obj()': ie., initialized but not yet
finalized. This provides the opportunity to sneak option
values in programmatically, overriding or supplementing
user-supplied values from the config files and command... | Reinitializes a command to the state it was in when first
returned by 'get_command_obj()': ie., initialized but not yet
finalized. This provides the opportunity to sneak option
values in programmatically, overriding or supplementing
user-supplied values from the config files and command... | [
"Reinitializes",
"a",
"command",
"to",
"the",
"state",
"it",
"was",
"in",
"when",
"first",
"returned",
"by",
"get_command_obj",
"()",
":",
"ie",
".",
"initialized",
"but",
"not",
"yet",
"finalized",
".",
"This",
"provides",
"the",
"opportunity",
"to",
"sneak... | def reinitialize_command(self, command, reinit_subcommands=0):
"""Reinitializes a command to the state it was in when first
returned by 'get_command_obj()': ie., initialized but not yet
finalized. This provides the opportunity to sneak option
values in programmatically, overriding or su... | [
"def",
"reinitialize_command",
"(",
"self",
",",
"command",
",",
"reinit_subcommands",
"=",
"0",
")",
":",
"from",
"distutils",
".",
"cmd",
"import",
"Command",
"if",
"not",
"isinstance",
"(",
"command",
",",
"Command",
")",
":",
"command_name",
"=",
"comman... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py#L916-L953 | |
apache/incubator-weex | 5c25f0b59f7ac90703c363e7261f60bd06356dbe | weex_core/Source/base/android/jniprebuild/jni_generator.py | python | JniParams.RemapClassName | (class_name) | return class_name | Remaps class names using the jarjar mapping table. | Remaps class names using the jarjar mapping table. | [
"Remaps",
"class",
"names",
"using",
"the",
"jarjar",
"mapping",
"table",
"."
] | def RemapClassName(class_name):
"""Remaps class names using the jarjar mapping table."""
for old, new in JniParams._remappings:
if old.endswith('**') and old[:-2] in class_name:
return class_name.replace(old[:-2], new, 1)
if '*' not in old and class_name.endswith(old):
return class_n... | [
"def",
"RemapClassName",
"(",
"class_name",
")",
":",
"for",
"old",
",",
"new",
"in",
"JniParams",
".",
"_remappings",
":",
"if",
"old",
".",
"endswith",
"(",
"'**'",
")",
"and",
"old",
"[",
":",
"-",
"2",
"]",
"in",
"class_name",
":",
"return",
"cla... | https://github.com/apache/incubator-weex/blob/5c25f0b59f7ac90703c363e7261f60bd06356dbe/weex_core/Source/base/android/jniprebuild/jni_generator.py#L360-L368 | |
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | llvm/utils/benchmark/tools/gbench/util.py | python | remove_benchmark_flags | (prefix, benchmark_flags) | return [f for f in benchmark_flags if not f.startswith(prefix)] | Return a new list containing the specified benchmark_flags except those
with the specified prefix. | Return a new list containing the specified benchmark_flags except those
with the specified prefix. | [
"Return",
"a",
"new",
"list",
"containing",
"the",
"specified",
"benchmark_flags",
"except",
"those",
"with",
"the",
"specified",
"prefix",
"."
] | def remove_benchmark_flags(prefix, benchmark_flags):
"""
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
"""
assert prefix.startswith('--') and prefix.endswith('=')
return [f for f in benchmark_flags if not f.startswith(prefix)] | [
"def",
"remove_benchmark_flags",
"(",
"prefix",
",",
"benchmark_flags",
")",
":",
"assert",
"prefix",
".",
"startswith",
"(",
"'--'",
")",
"and",
"prefix",
".",
"endswith",
"(",
"'='",
")",
"return",
"[",
"f",
"for",
"f",
"in",
"benchmark_flags",
"if",
"no... | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/llvm/utils/benchmark/tools/gbench/util.py#L100-L106 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/locale_tool.py | python | _WriteFile | (file_path, file_data) | Write |file_data| to |file_path|. | Write |file_data| to |file_path|. | [
"Write",
"|file_data|",
"to",
"|file_path|",
"."
] | def _WriteFile(file_path, file_data):
"""Write |file_data| to |file_path|."""
with open(file_path, 'w') as f:
f.write(file_data) | [
"def",
"_WriteFile",
"(",
"file_path",
",",
"file_data",
")",
":",
"with",
"open",
"(",
"file_path",
",",
"'w'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"file_data",
")"
] | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/locale_tool.py#L246-L249 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/special/orthogonal.py | python | h_roots | (n, mu=False) | r"""Gauss-Hermite (physicst's) quadrature.
Computes the sample points and weights for Gauss-Hermite quadrature.
The sample points are the roots of the n-th degree Hermite polynomial,
:math:`H_n(x)`. These sample points and weights correctly integrate
polynomials of degree :math:`2n - 1` or less over t... | r"""Gauss-Hermite (physicst's) quadrature. | [
"r",
"Gauss",
"-",
"Hermite",
"(",
"physicst",
"s",
")",
"quadrature",
"."
] | def h_roots(n, mu=False):
r"""Gauss-Hermite (physicst's) quadrature.
Computes the sample points and weights for Gauss-Hermite quadrature.
The sample points are the roots of the n-th degree Hermite polynomial,
:math:`H_n(x)`. These sample points and weights correctly integrate
polynomials of degree... | [
"def",
"h_roots",
"(",
"n",
",",
"mu",
"=",
"False",
")",
":",
"m",
"=",
"int",
"(",
"n",
")",
"if",
"n",
"<",
"1",
"or",
"n",
"!=",
"m",
":",
"raise",
"ValueError",
"(",
"\"n must be a positive integer.\"",
")",
"mu0",
"=",
"np",
".",
"sqrt",
"(... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/special/orthogonal.py#L639-L713 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/sliceviewer/presenter.py | python | SliceViewer.replace_workspace | (self, workspace_name, workspace) | Called when the SliceViewerADSObserver has detected that a workspace has changed
@param workspace_name: the name of the workspace that has changed
@param workspace: the workspace that has changed | Called when the SliceViewerADSObserver has detected that a workspace has changed | [
"Called",
"when",
"the",
"SliceViewerADSObserver",
"has",
"detected",
"that",
"a",
"workspace",
"has",
"changed"
] | def replace_workspace(self, workspace_name, workspace):
"""
Called when the SliceViewerADSObserver has detected that a workspace has changed
@param workspace_name: the name of the workspace that has changed
@param workspace: the workspace that has changed
"""
if not self.... | [
"def",
"replace_workspace",
"(",
"self",
",",
"workspace_name",
",",
"workspace",
")",
":",
"if",
"not",
"self",
".",
"model",
".",
"workspace_equals",
"(",
"workspace_name",
")",
":",
"# TODO this is a dead branch, since the ADS observer will call this if the",
"# names ... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/sliceviewer/presenter.py#L398-L422 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/stats/mstats_basic.py | python | trimboth | (data, proportiontocut=0.2, inclusive=(True,True), axis=None) | return trimr(data, limits=(proportiontocut,proportiontocut),
inclusive=inclusive, axis=axis) | Trims the smallest and largest data values.
Trims the `data` by masking the ``int(proportiontocut * n)`` smallest and
``int(proportiontocut * n)`` largest values of data along the given axis,
where n is the number of unmasked values before trimming.
Parameters
----------
data : ndarray
... | Trims the smallest and largest data values. | [
"Trims",
"the",
"smallest",
"and",
"largest",
"data",
"values",
"."
] | def trimboth(data, proportiontocut=0.2, inclusive=(True,True), axis=None):
"""
Trims the smallest and largest data values.
Trims the `data` by masking the ``int(proportiontocut * n)`` smallest and
``int(proportiontocut * n)`` largest values of data along the given axis,
where n is the number of unm... | [
"def",
"trimboth",
"(",
"data",
",",
"proportiontocut",
"=",
"0.2",
",",
"inclusive",
"=",
"(",
"True",
",",
"True",
")",
",",
"axis",
"=",
"None",
")",
":",
"return",
"trimr",
"(",
"data",
",",
"limits",
"=",
"(",
"proportiontocut",
",",
"proportionto... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/mstats_basic.py#L1473-L1499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.