Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
Configuration.add_include_dirs
(self,*paths)
Add paths to configuration include directories. Add the given sequence of paths to the beginning of the include_dirs list. This list will be visible to all extension modules of the current package.
Add paths to configuration include directories.
def add_include_dirs(self,*paths): """Add paths to configuration include directories. Add the given sequence of paths to the beginning of the include_dirs list. This list will be visible to all extension modules of the current package. """ include_dirs = self.paths(paths...
[ "def", "add_include_dirs", "(", "self", ",", "*", "paths", ")", ":", "include_dirs", "=", "self", ".", "paths", "(", "paths", ")", "dist", "=", "self", ".", "get_distribution", "(", ")", "if", "dist", "is", "not", "None", ":", "if", "dist", ".", "inc...
[ 1351, 4 ]
[ 1365, 50 ]
python
en
['en', 'en', 'en']
True
Configuration.add_headers
(self,*files)
Add installable headers to configuration. Add the given sequence of files to the beginning of the headers list. By default, headers will be installed under <python- include>/<self.name.replace('.','/')>/ directory. If an item of files is a tuple, then its first argument specifies the ac...
Add installable headers to configuration.
def add_headers(self,*files): """Add installable headers to configuration. Add the given sequence of files to the beginning of the headers list. By default, headers will be installed under <python- include>/<self.name.replace('.','/')>/ directory. If an item of files is a tuple,...
[ "def", "add_headers", "(", "self", ",", "*", "files", ")", ":", "headers", "=", "[", "]", "for", "path", "in", "files", ":", "if", "is_string", "(", "path", ")", ":", "[", "headers", ".", "append", "(", "(", "self", ".", "name", ",", "p", ")", ...
[ 1367, 4 ]
[ 1399, 40 ]
python
en
['en', 'en', 'en']
True
Configuration.paths
(self,*paths,**kws)
Apply glob to paths and prepend local_path if needed. Applies glob.glob(...) to each path in the sequence (if needed) and pre-pends the local_path if needed. Because this is called on all source lists, this allows wildcard characters to be specified in lists of sources for extension mod...
Apply glob to paths and prepend local_path if needed.
def paths(self,*paths,**kws): """Apply glob to paths and prepend local_path if needed. Applies glob.glob(...) to each path in the sequence (if needed) and pre-pends the local_path if needed. Because this is called on all source lists, this allows wildcard characters to be specified in l...
[ "def", "paths", "(", "self", ",", "*", "paths", ",", "*", "*", "kws", ")", ":", "include_non_existing", "=", "kws", ".", "get", "(", "'include_non_existing'", ",", "True", ")", "return", "gpaths", "(", "paths", ",", "local_path", "=", "self", ".", "loc...
[ 1401, 4 ]
[ 1414, 64 ]
python
en
['en', 'en', 'en']
True
Configuration.add_extension
(self,name,sources,**kw)
Add extension to configuration. Create and add an Extension instance to the ext_modules list. This method also takes the following optional keyword arguments that are passed on to the Extension constructor. Parameters ---------- name : str name of the extens...
Add extension to configuration.
def add_extension(self,name,sources,**kw): """Add extension to configuration. Create and add an Extension instance to the ext_modules list. This method also takes the following optional keyword arguments that are passed on to the Extension constructor. Parameters ------...
[ "def", "add_extension", "(", "self", ",", "name", ",", "sources", ",", "*", "*", "kw", ")", ":", "ext_args", "=", "copy", ".", "copy", "(", "kw", ")", "ext_args", "[", "'name'", "]", "=", "dot_join", "(", "self", ".", "name", ",", "name", ")", "e...
[ 1424, 4 ]
[ 1525, 18 ]
python
en
['en', 'en', 'en']
True
Configuration.add_library
(self,name,sources,**build_info)
Add library to configuration. Parameters ---------- name : str Name of the extension. sources : sequence List of the sources. The list of sources may contain functions (called source generators) which must take an extension instance ...
Add library to configuration.
def add_library(self,name,sources,**build_info): """ Add library to configuration. Parameters ---------- name : str Name of the extension. sources : sequence List of the sources. The list of sources may contain functions (called source...
[ "def", "add_library", "(", "self", ",", "name", ",", "sources", ",", "*", "*", "build_info", ")", ":", "self", ".", "_add_library", "(", "name", ",", "sources", ",", "None", ",", "build_info", ")", "dist", "=", "self", ".", "get_distribution", "(", ")"...
[ 1527, 4 ]
[ 1561, 68 ]
python
en
['en', 'error', 'th']
False
Configuration._add_library
(self, name, sources, install_dir, build_info)
Common implementation for add_library and add_installed_library. Do not use directly
Common implementation for add_library and add_installed_library. Do not use directly
def _add_library(self, name, sources, install_dir, build_info): """Common implementation for add_library and add_installed_library. Do not use directly""" build_info = copy.copy(build_info) build_info['sources'] = sources # Sometimes, depends is not set up to an empty list by de...
[ "def", "_add_library", "(", "self", ",", "name", ",", "sources", ",", "install_dir", ",", "build_info", ")", ":", "build_info", "=", "copy", ".", "copy", "(", "build_info", ")", "build_info", "[", "'sources'", "]", "=", "sources", "# Sometimes, depends is not ...
[ 1563, 4 ]
[ 1577, 49 ]
python
en
['en', 'en', 'en']
True
Configuration.add_installed_library
(self, name, sources, install_dir, build_info=None)
Similar to add_library, but the specified library is installed. Most C libraries used with `distutils` are only used to build python extensions, but libraries built through this method will be installed so that they can be reused by third-party packages. Parameters ---...
Similar to add_library, but the specified library is installed.
def add_installed_library(self, name, sources, install_dir, build_info=None): """ Similar to add_library, but the specified library is installed. Most C libraries used with `distutils` are only used to build python extensions, but libraries built through this method will be installed ...
[ "def", "add_installed_library", "(", "self", ",", "name", ",", "sources", ",", "install_dir", ",", "build_info", "=", "None", ")", ":", "if", "not", "build_info", ":", "build_info", "=", "{", "}", "install_dir", "=", "os", ".", "path", ".", "join", "(", ...
[ 1579, 4 ]
[ 1628, 86 ]
python
en
['en', 'error', 'th']
False
Configuration.add_npy_pkg_config
(self, template, install_dir, subst_dict=None)
Generate and install a npy-pkg config file from a template. The config file generated from `template` is installed in the given install directory, using `subst_dict` for variable substitution. Parameters ---------- template : str The path of the template, r...
Generate and install a npy-pkg config file from a template.
def add_npy_pkg_config(self, template, install_dir, subst_dict=None): """ Generate and install a npy-pkg config file from a template. The config file generated from `template` is installed in the given install directory, using `subst_dict` for variable substitution. Parameters ...
[ "def", "add_npy_pkg_config", "(", "self", ",", "template", ",", "install_dir", ",", "subst_dict", "=", "None", ")", ":", "if", "subst_dict", "is", "None", ":", "subst_dict", "=", "{", "}", "template", "=", "os", ".", "path", ".", "join", "(", "self", "...
[ 1630, 4 ]
[ 1699, 28 ]
python
en
['en', 'error', 'th']
False
Configuration.add_scripts
(self,*files)
Add scripts to configuration. Add the sequence of files to the beginning of the scripts list. Scripts will be installed under the <prefix>/bin/ directory.
Add scripts to configuration.
def add_scripts(self,*files): """Add scripts to configuration. Add the sequence of files to the beginning of the scripts list. Scripts will be installed under the <prefix>/bin/ directory. """ scripts = self.paths(files) dist = self.get_distribution() if dist is ...
[ "def", "add_scripts", "(", "self", ",", "*", "files", ")", ":", "scripts", "=", "self", ".", "paths", "(", "files", ")", "dist", "=", "self", ".", "get_distribution", "(", ")", "if", "dist", "is", "not", "None", ":", "if", "dist", ".", "scripts", "...
[ 1702, 4 ]
[ 1716, 40 ]
python
en
['en', 'en', 'en']
True
Configuration.get_config_cmd
(self)
Returns the numpy.distutils config command instance.
Returns the numpy.distutils config command instance.
def get_config_cmd(self): """ Returns the numpy.distutils config command instance. """ cmd = get_cmd('config') cmd.ensure_finalized() cmd.dump_source = 0 cmd.noisy = 0 old_path = os.environ.get('PATH') if old_path: path = os.pathsep.joi...
[ "def", "get_config_cmd", "(", "self", ")", ":", "cmd", "=", "get_cmd", "(", "'config'", ")", "cmd", ".", "ensure_finalized", "(", ")", "cmd", ".", "dump_source", "=", "0", "cmd", ".", "noisy", "=", "0", "old_path", "=", "os", ".", "environ", ".", "ge...
[ 1756, 4 ]
[ 1768, 18 ]
python
en
['en', 'error', 'th']
False
Configuration.get_build_temp_dir
(self)
Return a path to a temporary directory where temporary files should be placed.
Return a path to a temporary directory where temporary files should be placed.
def get_build_temp_dir(self): """ Return a path to a temporary directory where temporary files should be placed. """ cmd = get_cmd('build') cmd.ensure_finalized() return cmd.build_temp
[ "def", "get_build_temp_dir", "(", "self", ")", ":", "cmd", "=", "get_cmd", "(", "'build'", ")", "cmd", ".", "ensure_finalized", "(", ")", "return", "cmd", ".", "build_temp" ]
[ 1770, 4 ]
[ 1777, 29 ]
python
en
['en', 'error', 'th']
False
Configuration.have_f77c
(self)
Check for availability of Fortran 77 compiler. Use it inside source generating function to ensure that setup distribution instance has been initialized. Notes ----- True if a Fortran 77 compiler is available (because a simple Fortran 77 code was able to be compiled succ...
Check for availability of Fortran 77 compiler.
def have_f77c(self): """Check for availability of Fortran 77 compiler. Use it inside source generating function to ensure that setup distribution instance has been initialized. Notes ----- True if a Fortran 77 compiler is available (because a simple Fortran 77 c...
[ "def", "have_f77c", "(", "self", ")", ":", "simple_fortran_subroutine", "=", "'''\n subroutine simple\n end\n '''", "config_cmd", "=", "self", ".", "get_config_cmd", "(", ")", "flag", "=", "config_cmd", ".", "try_compile", "(", "simple_fortran_subrout...
[ 1779, 4 ]
[ 1796, 19 ]
python
en
['en', 'en', 'en']
True
Configuration.have_f90c
(self)
Check for availability of Fortran 90 compiler. Use it inside source generating function to ensure that setup distribution instance has been initialized. Notes ----- True if a Fortran 90 compiler is available (because a simple Fortran 90 code was able to be compiled succ...
Check for availability of Fortran 90 compiler.
def have_f90c(self): """Check for availability of Fortran 90 compiler. Use it inside source generating function to ensure that setup distribution instance has been initialized. Notes ----- True if a Fortran 90 compiler is available (because a simple Fortran 90 c...
[ "def", "have_f90c", "(", "self", ")", ":", "simple_fortran_subroutine", "=", "'''\n subroutine simple\n end\n '''", "config_cmd", "=", "self", ".", "get_config_cmd", "(", ")", "flag", "=", "config_cmd", ".", "try_compile", "(", "simple_fortran_subrout...
[ 1798, 4 ]
[ 1815, 19 ]
python
en
['en', 'en', 'en']
True
Configuration.append_to
(self, extlib)
Append libraries, include_dirs to extension or library item.
Append libraries, include_dirs to extension or library item.
def append_to(self, extlib): """Append libraries, include_dirs to extension or library item. """ if is_sequence(extlib): lib_name, build_info = extlib dict_append(build_info, libraries=self.libraries, include_dirs=self.inclu...
[ "def", "append_to", "(", "self", ",", "extlib", ")", ":", "if", "is_sequence", "(", "extlib", ")", ":", "lib_name", ",", "build_info", "=", "extlib", "dict_append", "(", "build_info", ",", "libraries", "=", "self", ".", "libraries", ",", "include_dirs", "=...
[ 1817, 4 ]
[ 1829, 57 ]
python
en
['en', 'en', 'en']
True
Configuration._get_svn_revision
(self, path)
Return path's SVN revision number.
Return path's SVN revision number.
def _get_svn_revision(self, path): """Return path's SVN revision number. """ try: output = subprocess.check_output( ['svnversion'], shell=True, cwd=path) except (subprocess.CalledProcessError, OSError): pass else: m = re.match(r...
[ "def", "_get_svn_revision", "(", "self", ",", "path", ")", ":", "try", ":", "output", "=", "subprocess", ".", "check_output", "(", "[", "'svnversion'", "]", ",", "shell", "=", "True", ",", "cwd", "=", "path", ")", "except", "(", "subprocess", ".", "Cal...
[ 1831, 4 ]
[ 1859, 19 ]
python
en
['en', 'en', 'en']
True
Configuration._get_hg_revision
(self, path)
Return path's Mercurial revision number.
Return path's Mercurial revision number.
def _get_hg_revision(self, path): """Return path's Mercurial revision number. """ try: output = subprocess.check_output( ['hg identify --num'], shell=True, cwd=path) except (subprocess.CalledProcessError, OSError): pass else: m ...
[ "def", "_get_hg_revision", "(", "self", ",", "path", ")", ":", "try", ":", "output", "=", "subprocess", ".", "check_output", "(", "[", "'hg identify --num'", "]", ",", "shell", "=", "True", ",", "cwd", "=", "path", ")", "except", "(", "subprocess", ".", ...
[ 1861, 4 ]
[ 1895, 19 ]
python
en
['en', 'en', 'en']
True
Configuration.get_version
(self, version_file=None, version_variable=None)
Try to get version string of a package. Return a version string of the current package or None if the version information could not be detected. Notes ----- This method scans files named __version__.py, <packagename>_version.py, version.py, and __svn_version__.p...
Try to get version string of a package.
def get_version(self, version_file=None, version_variable=None): """Try to get version string of a package. Return a version string of the current package or None if the version information could not be detected. Notes ----- This method scans files named __versi...
[ "def", "get_version", "(", "self", ",", "version_file", "=", "None", ",", "version_variable", "=", "None", ")", ":", "version", "=", "getattr", "(", "self", ",", "'version'", ",", "None", ")", "if", "version", "is", "not", "None", ":", "return", "version...
[ 1898, 4 ]
[ 1966, 22 ]
python
en
['en', 'en', 'en']
True
Configuration.make_svn_version_py
(self, delete=True)
Appends a data function to the data_files list that will generate __svn_version__.py file to the current package directory. Generate package __svn_version__.py file from SVN revision number, it will be removed after python exits but will be available when sdist, etc commands are execute...
Appends a data function to the data_files list that will generate __svn_version__.py file to the current package directory.
def make_svn_version_py(self, delete=True): """Appends a data function to the data_files list that will generate __svn_version__.py file to the current package directory. Generate package __svn_version__.py file from SVN revision number, it will be removed after python exits but will be...
[ "def", "make_svn_version_py", "(", "self", ",", "delete", "=", "True", ")", ":", "target", "=", "njoin", "(", "self", ".", "local_path", ",", "'__svn_version__.py'", ")", "revision", "=", "self", ".", "_get_svn_revision", "(", "self", ".", "local_path", ")",...
[ 1968, 4 ]
[ 2007, 64 ]
python
en
['en', 'en', 'en']
True
Configuration.make_hg_version_py
(self, delete=True)
Appends a data function to the data_files list that will generate __hg_version__.py file to the current package directory. Generate package __hg_version__.py file from Mercurial revision, it will be removed after python exits but will be available when sdist, etc commands are executed. ...
Appends a data function to the data_files list that will generate __hg_version__.py file to the current package directory.
def make_hg_version_py(self, delete=True): """Appends a data function to the data_files list that will generate __hg_version__.py file to the current package directory. Generate package __hg_version__.py file from Mercurial revision, it will be removed after python exits but will be ava...
[ "def", "make_hg_version_py", "(", "self", ",", "delete", "=", "True", ")", ":", "target", "=", "njoin", "(", "self", ".", "local_path", ",", "'__hg_version__.py'", ")", "revision", "=", "self", ".", "_get_hg_revision", "(", "self", ".", "local_path", ")", ...
[ 2009, 4 ]
[ 2047, 63 ]
python
en
['en', 'en', 'en']
True
Configuration.make_config_py
(self,name='__config__')
Generate package __config__.py file containing system_info information used during building the package. This file is installed to the package installation directory.
Generate package __config__.py file containing system_info information used during building the package.
def make_config_py(self,name='__config__'): """Generate package __config__.py file containing system_info information used during building the package. This file is installed to the package installation directory. """ self.py_modules.append((self.name, name, generate_co...
[ "def", "make_config_py", "(", "self", ",", "name", "=", "'__config__'", ")", ":", "self", ".", "py_modules", ".", "append", "(", "(", "self", ".", "name", ",", "name", ",", "generate_config_py", ")", ")" ]
[ 2049, 4 ]
[ 2057, 69 ]
python
en
['en', 'en', 'en']
True
Configuration.get_info
(self,*names)
Get resources information. Return information (from system_info.get_info) for all of the names in the argument list in a single dictionary.
Get resources information.
def get_info(self,*names): """Get resources information. Return information (from system_info.get_info) for all of the names in the argument list in a single dictionary. """ from .system_info import get_info, dict_append info_dict = {} for a in names: ...
[ "def", "get_info", "(", "self", ",", "*", "names", ")", ":", "from", ".", "system_info", "import", "get_info", ",", "dict_append", "info_dict", "=", "{", "}", "for", "a", "in", "names", ":", "dict_append", "(", "info_dict", ",", "*", "*", "get_info", "...
[ 2059, 4 ]
[ 2069, 24 ]
python
en
['en', 'de', 'en']
True
test_metric_lightning_log
(tmpdir)
Test logging a metric object and that the metric state gets reset after each epoch.
Test logging a metric object and that the metric state gets reset after each epoch.
def test_metric_lightning_log(tmpdir): """ Test logging a metric object and that the metric state gets reset after each epoch.""" class TestModel(BoringModel): def __init__(self): super().__init__() self.metric_step = SumMetric() self.metric_epoch = SumMetric() ...
[ "def", "test_metric_lightning_log", "(", "tmpdir", ")", ":", "class", "TestModel", "(", "BoringModel", ")", ":", "def", "__init__", "(", "self", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "metric_step", "=", "SumMetric", "(", ")...
[ 68, 0 ]
[ 107, 71 ]
python
en
['en', 'en', 'en']
True
TestPolynomial.test_poly_int_overflow
(self)
Regression test for gh-5096.
Regression test for gh-5096.
def test_poly_int_overflow(self): """ Regression test for gh-5096. """ v = np.arange(1, 21) assert_almost_equal(np.poly(v), np.poly(np.diag(v)))
[ "def", "test_poly_int_overflow", "(", "self", ")", ":", "v", "=", "np", ".", "arange", "(", "1", ",", "21", ")", "assert_almost_equal", "(", "np", ".", "poly", "(", "v", ")", ",", "np", ".", "poly", "(", "np", ".", "diag", "(", "v", ")", ")", "...
[ 224, 4 ]
[ 229, 60 ]
python
en
['en', 'error', 'th']
False
TestPolynomial.test_poly_coeffs_mutable
(self)
Coefficients should be modifiable
Coefficients should be modifiable
def test_poly_coeffs_mutable(self): """ Coefficients should be modifiable """ p = np.poly1d([1, 2, 3]) p.coeffs += 1 assert_equal(p.coeffs, [2, 3, 4]) p.coeffs[2] += 10 assert_equal(p.coeffs, [2, 3, 14]) # this never used to be allowed - let's not add features ...
[ "def", "test_poly_coeffs_mutable", "(", "self", ")", ":", "p", "=", "np", ".", "poly1d", "(", "[", "1", ",", "2", ",", "3", "]", ")", "p", ".", "coeffs", "+=", "1", "assert_equal", "(", "p", ".", "coeffs", ",", "[", "2", ",", "3", ",", "4", "...
[ 248, 4 ]
[ 260, 72 ]
python
en
['en', 'en', 'en']
True
test_auto_move_data
(src_device, dest_device)
Test that the decorator moves the data to the device the model is on.
Test that the decorator moves the data to the device the model is on.
def test_auto_move_data(src_device, dest_device): """ Test that the decorator moves the data to the device the model is on. """ class CurrentModel(BoringModel): @auto_move_data def forward(self, *args, **kwargs): return super().forward(*args, **kwargs) model = CurrentModel() ...
[ "def", "test_auto_move_data", "(", "src_device", ",", "dest_device", ")", ":", "class", "CurrentModel", "(", "BoringModel", ")", ":", "@", "auto_move_data", "def", "forward", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "supe...
[ 27, 0 ]
[ 44, 91 ]
python
en
['en', 'en', 'en']
True
strptime
(s, fmt=None)
This function is available in the datetime module only from Python >= 2.5.
This function is available in the datetime module only from Python >= 2.5.
def strptime(s, fmt=None): """ This function is available in the datetime module only from Python >= 2.5. """ if type(s) == bytes: s = s.decode("latin1") return datetime(*time.strptime(s, fmt)[:3])
[ "def", "strptime", "(", "s", ",", "fmt", "=", "None", ")", ":", "if", "type", "(", "s", ")", "==", "bytes", ":", "s", "=", "s", ".", "decode", "(", "\"latin1\"", ")", "return", "datetime", "(", "*", "time", ".", "strptime", "(", "s", ",", "fmt"...
[ 61, 0 ]
[ 69, 47 ]
python
en
['en', 'error', 'th']
False
RoundtripTest.roundtrip
(self, save_func, *args, **kwargs)
save_func : callable Function used to save arrays to file. file_on_disk : bool If true, store the file on disk, instead of in a string buffer. save_kwds : dict Parameters passed to `save_func`. load_kwds : dict Parameters passe...
save_func : callable Function used to save arrays to file. file_on_disk : bool If true, store the file on disk, instead of in a string buffer. save_kwds : dict Parameters passed to `save_func`. load_kwds : dict Parameters passe...
def roundtrip(self, save_func, *args, **kwargs): """ save_func : callable Function used to save arrays to file. file_on_disk : bool If true, store the file on disk, instead of in a string buffer. save_kwds : dict Parameters passed to `save_...
[ "def", "roundtrip", "(", "self", ",", "save_func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "save_kwds", "=", "kwargs", ".", "get", "(", "'save_kwds'", ",", "{", "}", ")", "load_kwds", "=", "kwargs", ".", "get", "(", "'load_kwds'", ",", ...
[ 73, 4 ]
[ 119, 51 ]
python
en
['en', 'error', 'th']
False
NumpyVersion._compare_version
(self, other)
Compare major.minor.bugfix
Compare major.minor.bugfix
def _compare_version(self, other): """Compare major.minor.bugfix""" if self.major == other.major: if self.minor == other.minor: if self.bugfix == other.bugfix: vercmp = 0 elif self.bugfix > other.bugfix: vercmp = 1 ...
[ "def", "_compare_version", "(", "self", ",", "other", ")", ":", "if", "self", ".", "major", "==", "other", ".", "major", ":", "if", "self", ".", "minor", "==", "other", ".", "minor", ":", "if", "self", ".", "bugfix", "==", "other", ".", "bugfix", "...
[ 81, 4 ]
[ 100, 21 ]
python
en
['en', 'it', 'en']
False
NumpyVersion._compare_pre_release
(self, other)
Compare alpha/beta/rc/final.
Compare alpha/beta/rc/final.
def _compare_pre_release(self, other): """Compare alpha/beta/rc/final.""" if self.pre_release == other.pre_release: vercmp = 0 elif self.pre_release == 'final': vercmp = 1 elif other.pre_release == 'final': vercmp = -1 elif self.pre_release > o...
[ "def", "_compare_pre_release", "(", "self", ",", "other", ")", ":", "if", "self", ".", "pre_release", "==", "other", ".", "pre_release", ":", "vercmp", "=", "0", "elif", "self", ".", "pre_release", "==", "'final'", ":", "vercmp", "=", "1", "elif", "other...
[ 102, 4 ]
[ 115, 21 ]
python
en
['en', 'pt', 'en']
False
as_strided
(x, shape=None, strides=None, subok=False, writeable=True)
Create a view into the array with the given shape and strides. .. warning:: This function has to be used with extreme care, see notes. Parameters ---------- x : ndarray Array to create a new. shape : sequence of int, optional The shape of the new array. Defaults to ``x.shape``...
Create a view into the array with the given shape and strides.
def as_strided(x, shape=None, strides=None, subok=False, writeable=True): """ Create a view into the array with the given shape and strides. .. warning:: This function has to be used with extreme care, see notes. Parameters ---------- x : ndarray Array to create a new. shape : sequ...
[ "def", "as_strided", "(", "x", ",", "shape", "=", "None", ",", "strides", "=", "None", ",", "subok", "=", "False", ",", "writeable", "=", "True", ")", ":", "# first convert input to array, possibly keeping subclass", "x", "=", "np", ".", "array", "(", "x", ...
[ 38, 0 ]
[ 112, 15 ]
python
en
['en', 'error', 'th']
False
broadcast_to
(array, shape, subok=False)
Broadcast an array to a new shape. Parameters ---------- array : array_like The array to broadcast. shape : tuple The shape of the desired array. subok : bool, optional If True, then sub-classes will be passed-through, otherwise the returned array will be forced to b...
Broadcast an array to a new shape.
def broadcast_to(array, shape, subok=False): """Broadcast an array to a new shape. Parameters ---------- array : array_like The array to broadcast. shape : tuple The shape of the desired array. subok : bool, optional If True, then sub-classes will be passed-through, othe...
[ "def", "broadcast_to", "(", "array", ",", "shape", ",", "subok", "=", "False", ")", ":", "return", "_broadcast_to", "(", "array", ",", "shape", ",", "subok", "=", "subok", ",", "readonly", "=", "True", ")" ]
[ 143, 0 ]
[ 181, 66 ]
python
en
['en', 'haw', 'en']
True
_broadcast_shape
(*args)
Returns the shape of the arrays that would result from broadcasting the supplied arrays against each other.
Returns the shape of the arrays that would result from broadcasting the supplied arrays against each other.
def _broadcast_shape(*args): """Returns the shape of the arrays that would result from broadcasting the supplied arrays against each other. """ # use the old-iterator because np.nditer does not handle size 0 arrays # consistently b = np.broadcast(*args[:32]) # unfortunately, it cannot handle...
[ "def", "_broadcast_shape", "(", "*", "args", ")", ":", "# use the old-iterator because np.nditer does not handle size 0 arrays", "# consistently", "b", "=", "np", ".", "broadcast", "(", "*", "args", "[", ":", "32", "]", ")", "# unfortunately, it cannot handle 32 or more a...
[ 184, 0 ]
[ 198, 18 ]
python
en
['en', 'en', 'en']
True
broadcast_arrays
(*args, **kwargs)
Broadcast any number of arrays against each other. Parameters ---------- `*args` : array_likes The arrays to broadcast. subok : bool, optional If True, then sub-classes will be passed-through, otherwise the returned arrays will be forced to be a base-class array (default)....
Broadcast any number of arrays against each other.
def broadcast_arrays(*args, **kwargs): """ Broadcast any number of arrays against each other. Parameters ---------- `*args` : array_likes The arrays to broadcast. subok : bool, optional If True, then sub-classes will be passed-through, otherwise the returned arrays will...
[ "def", "broadcast_arrays", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# nditer is not used here to avoid the limit of 32 arrays.", "# Otherwise, something like the following one-liner would suffice:", "# return np.nditer(args, flags=['multi_index', 'zerosize_ok'],", "# ...
[ 206, 0 ]
[ 270, 30 ]
python
en
['en', 'error', 'th']
False
set_requires_grad
(nets, requires_grad=False)
Set requies_grad for all the networks. Args: nets (nn.Module | list[nn.Module]): A list of networks or a single network. requires_grad (bool): Whether the networks require gradients or not
Set requies_grad for all the networks.
def set_requires_grad(nets, requires_grad=False): """Set requies_grad for all the networks. Args: nets (nn.Module | list[nn.Module]): A list of networks or a single network. requires_grad (bool): Whether the networks require gradients or not """ if not isinstance(nets, list)...
[ "def", "set_requires_grad", "(", "nets", ",", "requires_grad", "=", "False", ")", ":", "if", "not", "isinstance", "(", "nets", ",", "list", ")", ":", "nets", "=", "[", "nets", "]", "for", "net", "in", "nets", ":", "if", "net", "is", "not", "None", ...
[ 10, 0 ]
[ 23, 51 ]
python
en
['en', 'en', 'en']
True
MLFlowLogger.experiment
(self)
r""" Actual MLflow object. To use MLflow features in your :class:`~pytorch_lightning.core.lightning.LightningModule` do the following. Example:: self.logger.experiment.some_mlflow_function()
r""" Actual MLflow object. To use MLflow features in your :class:`~pytorch_lightning.core.lightning.LightningModule` do the following.
def experiment(self) -> MlflowClient: r""" Actual MLflow object. To use MLflow features in your :class:`~pytorch_lightning.core.lightning.LightningModule` do the following. Example:: self.logger.experiment.some_mlflow_function() """ if self._experiment_id i...
[ "def", "experiment", "(", "self", ")", "->", "MlflowClient", ":", "if", "self", ".", "_experiment_id", "is", "None", ":", "expt", "=", "self", ".", "_mlflow_client", ".", "get_experiment_by_name", "(", "self", ".", "_experiment_name", ")", "if", "expt", "is"...
[ 112, 4 ]
[ 133, 34 ]
python
cy
['en', 'cy', 'hi']
False
MLFlowLogger.save_dir
(self)
The root file directory in which MLflow experiments are saved. Return: Local path to the root experiment directory if the tracking uri is local. Otherwhise returns `None`.
The root file directory in which MLflow experiments are saved.
def save_dir(self) -> Optional[str]: """ The root file directory in which MLflow experiments are saved. Return: Local path to the root experiment directory if the tracking uri is local. Otherwhise returns `None`. """ if self._tracking_uri.startswith(LOCAL...
[ "def", "save_dir", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "_tracking_uri", ".", "startswith", "(", "LOCAL_FILE_URI_PREFIX", ")", ":", "return", "self", ".", "_tracking_uri", ".", "lstrip", "(", "LOCAL_FILE_URI_PREFIX", "...
[ 190, 4 ]
[ 199, 67 ]
python
en
['en', 'error', 'th']
False
build
(cfg, registry, default_args=None)
Build a module. Args: cfg (dict, list[dict]): The config of modules, it is either a dict or a list of configs. registry (:obj:`Registry`): A registry the module belongs to. default_args (dict, optional): Default arguments to build the module. Defaults to None. R...
Build a module.
def build(cfg, registry, default_args=None): """Build a module. Args: cfg (dict, list[dict]): The config of modules, it is either a dict or a list of configs. registry (:obj:`Registry`): A registry the module belongs to. default_args (dict, optional): Default arguments to bu...
[ "def", "build", "(", "cfg", ",", "registry", ",", "default_args", "=", "None", ")", ":", "if", "isinstance", "(", "cfg", ",", "list", ")", ":", "modules", "=", "[", "build_from_cfg", "(", "cfg_", ",", "registry", ",", "default_args", ")", "for", "cfg_"...
[ 6, 0 ]
[ 26, 54 ]
python
en
['en', 'ro', 'en']
True
build_backbone
(cfg)
Build backbone.
Build backbone.
def build_backbone(cfg): """Build backbone.""" return build(cfg, BACKBONES)
[ "def", "build_backbone", "(", "cfg", ")", ":", "return", "build", "(", "cfg", ",", "BACKBONES", ")" ]
[ 29, 0 ]
[ 31, 32 ]
python
en
['en', 'tr', 'en']
False
build_head
(cfg)
Build head.
Build head.
def build_head(cfg): """Build head.""" return build(cfg, HEADS)
[ "def", "build_head", "(", "cfg", ")", ":", "return", "build", "(", "cfg", ",", "HEADS", ")" ]
[ 34, 0 ]
[ 36, 28 ]
python
en
['en', 'es', 'en']
False
build_loss
(cfg)
Build loss.
Build loss.
def build_loss(cfg): """Build loss.""" return build(cfg, LOSSES)
[ "def", "build_loss", "(", "cfg", ")", ":", "return", "build", "(", "cfg", ",", "LOSSES", ")" ]
[ 39, 0 ]
[ 41, 29 ]
python
en
['en', 'fil', 'en']
False
build_posenet
(cfg)
Build posenet.
Build posenet.
def build_posenet(cfg): """Build posenet.""" return build(cfg, POSENETS)
[ "def", "build_posenet", "(", "cfg", ")", ":", "return", "build", "(", "cfg", ",", "POSENETS", ")" ]
[ 44, 0 ]
[ 46, 31 ]
python
en
['en', 'sr', 'en']
False
Getter.user_info
(self, user_id)
returns dict with user's info. You can pass as username as user_id.
returns dict with user's info. You can pass as username as user_id.
def user_info(self, user_id): """ returns dict with user's info. You can pass as username as user_id. """ time.sleep(1 * random()) return self._get_user_info(user_id)
[ "def", "user_info", "(", "self", ",", "user_id", ")", ":", "time", ".", "sleep", "(", "1", "*", "random", "(", ")", ")", "return", "self", ".", "_get_user_info", "(", "user_id", ")" ]
[ 144, 4 ]
[ 147, 43 ]
python
en
['en', 'en', 'en']
True
Getter.user_followers
(self, user_id, total=None)
generator to iterate over user's followers
generator to iterate over user's followers
def user_followers(self, user_id, total=None): """ generator to iterate over user's followers """ return self.generator(self._get_user_followers, user_id, total=total)
[ "def", "user_followers", "(", "self", ",", "user_id", ",", "total", "=", "None", ")", ":", "return", "self", ".", "generator", "(", "self", ".", "_get_user_followers", ",", "user_id", ",", "total", "=", "total", ")" ]
[ 149, 4 ]
[ 151, 77 ]
python
en
['en', 'en', 'en']
True
Getter.user_following
(self, user_id, total=None)
generator to iterate over user's following
generator to iterate over user's following
def user_following(self, user_id, total=None): """ generator to iterate over user's following """ return self.generator(self._get_user_following, user_id, total=total)
[ "def", "user_following", "(", "self", ",", "user_id", ",", "total", "=", "None", ")", ":", "return", "self", ".", "generator", "(", "self", ".", "_get_user_following", ",", "user_id", ",", "total", "=", "total", ")" ]
[ 153, 4 ]
[ 155, 77 ]
python
en
['en', 'en', 'en']
True
Getter.user_feed
(self, user_id, total=None)
generator to iterate over user feed
generator to iterate over user feed
def user_feed(self, user_id, total=None): """ generator to iterate over user feed """ return self.generator(self._get_user_feed, user_id, total=total)
[ "def", "user_feed", "(", "self", ",", "user_id", ",", "total", "=", "None", ")", ":", "return", "self", ".", "generator", "(", "self", ".", "_get_user_feed", ",", "user_id", ",", "total", "=", "total", ")" ]
[ 157, 4 ]
[ 159, 72 ]
python
en
['en', 'en', 'en']
True
Getter.geo_medias
(self, location_id, total=None)
generator to iterate over geo medias
generator to iterate over geo medias
def geo_medias(self, location_id, total=None): """ generator to iterate over geo medias """ return self.generator(self._get_geo_medias, location_id, total=total)
[ "def", "geo_medias", "(", "self", ",", "location_id", ",", "total", "=", "None", ")", ":", "return", "self", ".", "generator", "(", "self", ".", "_get_geo_medias", ",", "location_id", ",", "total", "=", "total", ")" ]
[ 166, 4 ]
[ 168, 77 ]
python
en
['en', 'la', 'en']
True
Getter.hashtag_medias
(self, hashtag, total=None)
generator to iterate over hashtag medias
generator to iterate over hashtag medias
def hashtag_medias(self, hashtag, total=None): """ generator to iterate over hashtag medias """ return self.generator(self._get_hashtag_medias, hashtag, total=total)
[ "def", "hashtag_medias", "(", "self", ",", "hashtag", ",", "total", "=", "None", ")", ":", "return", "self", ".", "generator", "(", "self", ".", "_get_hashtag_medias", ",", "hashtag", ",", "total", "=", "total", ")" ]
[ 170, 4 ]
[ 172, 77 ]
python
en
['en', 'la', 'en']
True
getChars
()
Método para obter uma lista contendo todas as letras do alfabeto e números.
Método para obter uma lista contendo todas as letras do alfabeto e números.
def getChars(): """ Método para obter uma lista contendo todas as letras do alfabeto e números. """ chars = [] # Acrescenta à lista todas as letras maiúsculas for id_ in range(ord("A"), ord("Z") + 1): chars.append(chr(id_)) # Acrescenta à lista todas as letras minúsculas fo...
[ "def", "getChars", "(", ")", ":", "chars", "=", "[", "]", "# Acrescenta à lista todas as letras maiúsculas", "for", "id_", "in", "range", "(", "ord", "(", "\"A\"", ")", ",", "ord", "(", "\"Z\"", ")", "+", "1", ")", ":", "chars", ".", "append", "(", "ch...
[ 32, 0 ]
[ 51, 16 ]
python
en
['en', 'error', 'th']
False
PytestTester.__call__
(self, label='fast', verbose=1, extra_argv=None, doctests=False, coverage=False, durations=-1, tests=None)
Run tests for module using pytest. Parameters ---------- label : {'fast', 'full'}, optional Identifies the tests to run. When set to 'fast', tests decorated with `pytest.mark.slow` are skipped, when 'full', the slow marker is ignored. verbose...
Run tests for module using pytest.
def __call__(self, label='fast', verbose=1, extra_argv=None, doctests=False, coverage=False, durations=-1, tests=None): """ Run tests for module using pytest. Parameters ---------- label : {'fast', 'full'}, optional Identifies the tests to run. When ...
[ "def", "__call__", "(", "self", ",", "label", "=", "'fast'", ",", "verbose", "=", "1", ",", "extra_argv", "=", "None", ",", "doctests", "=", "False", ",", "coverage", "=", "False", ",", "durations", "=", "-", "1", ",", "tests", "=", "None", ")", ":...
[ 74, 4 ]
[ 208, 24 ]
python
en
['en', 'error', 'th']
False
test_reference_data
()
Check that SeedSequence generates data the same as the C++ reference. https://gist.github.com/imneme/540829265469e673d045
Check that SeedSequence generates data the same as the C++ reference.
def test_reference_data(): """ Check that SeedSequence generates data the same as the C++ reference. https://gist.github.com/imneme/540829265469e673d045 """ inputs = [ [3735928559, 195939070, 229505742, 305419896], [3668361503, 4165561550, 1661411377, 3634257570], [164546577, 41...
[ "def", "test_reference_data", "(", ")", ":", "inputs", "=", "[", "[", "3735928559", ",", "195939070", ",", "229505742", ",", "305419896", "]", ",", "[", "3668361503", ",", "4165561550", ",", "1661411377", ",", "3634257570", "]", ",", "[", "164546577", ",",...
[ 6, 0 ]
[ 53, 47 ]
python
en
['en', 'en', 'en']
True
Array1TestCase.testConstructor0
(self)
Test Array1 default constructor
Test Array1 default constructor
def testConstructor0(self): "Test Array1 default constructor" a = Array.Array1() self.failUnless(isinstance(a, Array.Array1)) self.failUnless(len(a) == 0)
[ "def", "testConstructor0", "(", "self", ")", ":", "a", "=", "Array", ".", "Array1", "(", ")", "self", ".", "failUnless", "(", "isinstance", "(", "a", ",", "Array", ".", "Array1", ")", ")", "self", ".", "failUnless", "(", "len", "(", "a", ")", "==",...
[ 27, 4 ]
[ 31, 36 ]
python
en
['es', 'fr', 'en']
False
Array1TestCase.testConstructor1
(self)
Test Array1 length constructor
Test Array1 length constructor
def testConstructor1(self): "Test Array1 length constructor" self.failUnless(isinstance(self.array1, Array.Array1))
[ "def", "testConstructor1", "(", "self", ")", ":", "self", ".", "failUnless", "(", "isinstance", "(", "self", ".", "array1", ",", "Array", ".", "Array1", ")", ")" ]
[ 33, 4 ]
[ 35, 62 ]
python
en
['en', 'ga', 'en']
True
Array1TestCase.testConstructor2
(self)
Test Array1 array constructor
Test Array1 array constructor
def testConstructor2(self): "Test Array1 array constructor" na = np.arange(self.length) aa = Array.Array1(na) self.failUnless(isinstance(aa, Array.Array1))
[ "def", "testConstructor2", "(", "self", ")", ":", "na", "=", "np", ".", "arange", "(", "self", ".", "length", ")", "aa", "=", "Array", ".", "Array1", "(", "na", ")", "self", ".", "failUnless", "(", "isinstance", "(", "aa", ",", "Array", ".", "Array...
[ 37, 4 ]
[ 41, 53 ]
python
en
['en', 'ga', 'tr']
False
Array1TestCase.testConstructor3
(self)
Test Array1 copy constructor
Test Array1 copy constructor
def testConstructor3(self): "Test Array1 copy constructor" for i in range(self.array1.length()): self.array1[i] = i arrayCopy = Array.Array1(self.array1) self.failUnless(arrayCopy == self.array1)
[ "def", "testConstructor3", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "array1", ".", "length", "(", ")", ")", ":", "self", ".", "array1", "[", "i", "]", "=", "i", "arrayCopy", "=", "Array", ".", "Array1", "(", "self", "."...
[ 43, 4 ]
[ 47, 49 ]
python
en
['en', 'en', 'en']
True
Array1TestCase.testConstructorBad
(self)
Test Array1 length constructor, negative
Test Array1 length constructor, negative
def testConstructorBad(self): "Test Array1 length constructor, negative" self.assertRaises(ValueError, Array.Array1, -4)
[ "def", "testConstructorBad", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "Array", ".", "Array1", ",", "-", "4", ")" ]
[ 49, 4 ]
[ 51, 55 ]
python
en
['sl', 'en', 'en']
True
Array1TestCase.testLength
(self)
Test Array1 length method
Test Array1 length method
def testLength(self): "Test Array1 length method" self.failUnless(self.array1.length() == self.length)
[ "def", "testLength", "(", "self", ")", ":", "self", ".", "failUnless", "(", "self", ".", "array1", ".", "length", "(", ")", "==", "self", ".", "length", ")" ]
[ 53, 4 ]
[ 55, 60 ]
python
en
['en', 'ga', 'en']
True
Array1TestCase.testLen
(self)
Test Array1 __len__ method
Test Array1 __len__ method
def testLen(self): "Test Array1 __len__ method" self.failUnless(len(self.array1) == self.length)
[ "def", "testLen", "(", "self", ")", ":", "self", ".", "failUnless", "(", "len", "(", "self", ".", "array1", ")", "==", "self", ".", "length", ")" ]
[ 57, 4 ]
[ 59, 56 ]
python
en
['en', 'hu', 'tr']
False
Array1TestCase.testResize0
(self)
Test Array1 resize method, length
Test Array1 resize method, length
def testResize0(self): "Test Array1 resize method, length" newLen = 2 * self.length self.array1.resize(newLen) self.failUnless(len(self.array1) == newLen)
[ "def", "testResize0", "(", "self", ")", ":", "newLen", "=", "2", "*", "self", ".", "length", "self", ".", "array1", ".", "resize", "(", "newLen", ")", "self", ".", "failUnless", "(", "len", "(", "self", ".", "array1", ")", "==", "newLen", ")" ]
[ 61, 4 ]
[ 65, 51 ]
python
en
['fr', 'no', 'en']
False
Array1TestCase.testResize1
(self)
Test Array1 resize method, array
Test Array1 resize method, array
def testResize1(self): "Test Array1 resize method, array" a = np.zeros((2*self.length,), dtype='l') self.array1.resize(a) self.failUnless(len(self.array1) == a.size)
[ "def", "testResize1", "(", "self", ")", ":", "a", "=", "np", ".", "zeros", "(", "(", "2", "*", "self", ".", "length", ",", ")", ",", "dtype", "=", "'l'", ")", "self", ".", "array1", ".", "resize", "(", "a", ")", "self", ".", "failUnless", "(", ...
[ 67, 4 ]
[ 71, 51 ]
python
en
['en', 'hu', 'en']
True
Array1TestCase.testResizeBad
(self)
Test Array1 resize method, negative length
Test Array1 resize method, negative length
def testResizeBad(self): "Test Array1 resize method, negative length" self.assertRaises(ValueError, self.array1.resize, -5)
[ "def", "testResizeBad", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "self", ".", "array1", ".", "resize", ",", "-", "5", ")" ]
[ 73, 4 ]
[ 75, 61 ]
python
cs
['sl', 'cs', 'en']
False
Array1TestCase.testSetGet
(self)
Test Array1 __setitem__, __getitem__ methods
Test Array1 __setitem__, __getitem__ methods
def testSetGet(self): "Test Array1 __setitem__, __getitem__ methods" n = self.length for i in range(n): self.array1[i] = i*i for i in range(n): self.failUnless(self.array1[i] == i*i)
[ "def", "testSetGet", "(", "self", ")", ":", "n", "=", "self", ".", "length", "for", "i", "in", "range", "(", "n", ")", ":", "self", ".", "array1", "[", "i", "]", "=", "i", "*", "i", "for", "i", "in", "range", "(", "n", ")", ":", "self", "."...
[ 77, 4 ]
[ 83, 50 ]
python
en
['en', 'et', 'hi']
False
Array1TestCase.testSetBad1
(self)
Test Array1 __setitem__ method, negative index
Test Array1 __setitem__ method, negative index
def testSetBad1(self): "Test Array1 __setitem__ method, negative index" self.assertRaises(IndexError, self.array1.__setitem__, -1, 0)
[ "def", "testSetBad1", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "IndexError", ",", "self", ".", "array1", ".", "__setitem__", ",", "-", "1", ",", "0", ")" ]
[ 85, 4 ]
[ 87, 69 ]
python
da
['sl', 'da', 'hi']
False
Array1TestCase.testSetBad2
(self)
Test Array1 __setitem__ method, out-of-range index
Test Array1 __setitem__ method, out-of-range index
def testSetBad2(self): "Test Array1 __setitem__ method, out-of-range index" self.assertRaises(IndexError, self.array1.__setitem__, self.length+1, 0)
[ "def", "testSetBad2", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "IndexError", ",", "self", ".", "array1", ".", "__setitem__", ",", "self", ".", "length", "+", "1", ",", "0", ")" ]
[ 89, 4 ]
[ 91, 80 ]
python
en
['en', 'da', 'en']
True
Array1TestCase.testGetBad1
(self)
Test Array1 __getitem__ method, negative index
Test Array1 __getitem__ method, negative index
def testGetBad1(self): "Test Array1 __getitem__ method, negative index" self.assertRaises(IndexError, self.array1.__getitem__, -1)
[ "def", "testGetBad1", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "IndexError", ",", "self", ".", "array1", ".", "__getitem__", ",", "-", "1", ")" ]
[ 93, 4 ]
[ 95, 66 ]
python
da
['sl', 'da', 'hi']
False
Array1TestCase.testGetBad2
(self)
Test Array1 __getitem__ method, out-of-range index
Test Array1 __getitem__ method, out-of-range index
def testGetBad2(self): "Test Array1 __getitem__ method, out-of-range index" self.assertRaises(IndexError, self.array1.__getitem__, self.length+1)
[ "def", "testGetBad2", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "IndexError", ",", "self", ".", "array1", ".", "__getitem__", ",", "self", ".", "length", "+", "1", ")" ]
[ 97, 4 ]
[ 99, 77 ]
python
en
['en', 'da', 'en']
True
Array1TestCase.testAsString
(self)
Test Array1 asString method
Test Array1 asString method
def testAsString(self): "Test Array1 asString method" for i in range(self.array1.length()): self.array1[i] = i+1 self.failUnless(self.array1.asString() == "[ 1, 2, 3, 4, 5 ]")
[ "def", "testAsString", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "array1", ".", "length", "(", ")", ")", ":", "self", ".", "array1", "[", "i", "]", "=", "i", "+", "1", "self", ".", "failUnless", "(", "self", ".", "arra...
[ 101, 4 ]
[ 104, 70 ]
python
en
['en', 'no', 'en']
True
Array1TestCase.testStr
(self)
Test Array1 __str__ method
Test Array1 __str__ method
def testStr(self): "Test Array1 __str__ method" for i in range(self.array1.length()): self.array1[i] = i-2 self.failUnless(str(self.array1) == "[ -2, -1, 0, 1, 2 ]")
[ "def", "testStr", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "array1", ".", "length", "(", ")", ")", ":", "self", ".", "array1", "[", "i", "]", "=", "i", "-", "2", "self", ".", "failUnless", "(", "str", "(", "self", "...
[ 106, 4 ]
[ 109, 66 ]
python
en
['en', 'is', 'tr']
False
Array1TestCase.testView
(self)
Test Array1 view method
Test Array1 view method
def testView(self): "Test Array1 view method" for i in range(self.array1.length()): self.array1[i] = i+1 a = self.array1.view() self.failUnless(isinstance(a, np.ndarray)) self.failUnless(len(a) == self.length) self.failUnless((a == [1, 2, 3, 4, 5]).all())
[ "def", "testView", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "array1", ".", "length", "(", ")", ")", ":", "self", ".", "array1", "[", "i", "]", "=", "i", "+", "1", "a", "=", "self", ".", "array1", ".", "view", "(", ...
[ 111, 4 ]
[ 117, 53 ]
python
en
['en', 'en', 'en']
True
Array2TestCase.testConstructor0
(self)
Test Array2 default constructor
Test Array2 default constructor
def testConstructor0(self): "Test Array2 default constructor" a = Array.Array2() self.failUnless(isinstance(a, Array.Array2)) self.failUnless(len(a) == 0)
[ "def", "testConstructor0", "(", "self", ")", ":", "a", "=", "Array", ".", "Array2", "(", ")", "self", ".", "failUnless", "(", "isinstance", "(", "a", ",", "Array", ".", "Array2", ")", ")", "self", ".", "failUnless", "(", "len", "(", "a", ")", "==",...
[ 128, 4 ]
[ 132, 36 ]
python
en
['es', 'fr', 'en']
False
Array2TestCase.testConstructor1
(self)
Test Array2 nrows, ncols constructor
Test Array2 nrows, ncols constructor
def testConstructor1(self): "Test Array2 nrows, ncols constructor" self.failUnless(isinstance(self.array2, Array.Array2))
[ "def", "testConstructor1", "(", "self", ")", ":", "self", ".", "failUnless", "(", "isinstance", "(", "self", ".", "array2", ",", "Array", ".", "Array2", ")", ")" ]
[ 134, 4 ]
[ 136, 62 ]
python
en
['en', 'en', 'nl']
True
Array2TestCase.testConstructor2
(self)
Test Array2 array constructor
Test Array2 array constructor
def testConstructor2(self): "Test Array2 array constructor" na = np.zeros((3, 4), dtype="l") aa = Array.Array2(na) self.failUnless(isinstance(aa, Array.Array2))
[ "def", "testConstructor2", "(", "self", ")", ":", "na", "=", "np", ".", "zeros", "(", "(", "3", ",", "4", ")", ",", "dtype", "=", "\"l\"", ")", "aa", "=", "Array", ".", "Array2", "(", "na", ")", "self", ".", "failUnless", "(", "isinstance", "(", ...
[ 138, 4 ]
[ 142, 53 ]
python
en
['en', 'ga', 'hi']
False
Array2TestCase.testConstructor3
(self)
Test Array2 copy constructor
Test Array2 copy constructor
def testConstructor3(self): "Test Array2 copy constructor" for i in range(self.nrows): for j in range(self.ncols): self.array2[i][j] = i * j arrayCopy = Array.Array2(self.array2) self.failUnless(arrayCopy == self.array2)
[ "def", "testConstructor3", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "nrows", ")", ":", "for", "j", "in", "range", "(", "self", ".", "ncols", ")", ":", "self", ".", "array2", "[", "i", "]", "[", "j", "]", "=", "i", "...
[ 144, 4 ]
[ 150, 49 ]
python
en
['en', 'en', 'en']
True
Array2TestCase.testConstructorBad1
(self)
Test Array2 nrows, ncols constructor, negative nrows
Test Array2 nrows, ncols constructor, negative nrows
def testConstructorBad1(self): "Test Array2 nrows, ncols constructor, negative nrows" self.assertRaises(ValueError, Array.Array2, -4, 4)
[ "def", "testConstructorBad1", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "Array", ".", "Array2", ",", "-", "4", ",", "4", ")" ]
[ 152, 4 ]
[ 154, 58 ]
python
en
['sl', 'en', 'pt']
False
Array2TestCase.testConstructorBad2
(self)
Test Array2 nrows, ncols constructor, negative ncols
Test Array2 nrows, ncols constructor, negative ncols
def testConstructorBad2(self): "Test Array2 nrows, ncols constructor, negative ncols" self.assertRaises(ValueError, Array.Array2, 4, -4)
[ "def", "testConstructorBad2", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "Array", ".", "Array2", ",", "4", ",", "-", "4", ")" ]
[ 156, 4 ]
[ 158, 58 ]
python
en
['sl', 'en', 'pt']
False
Array2TestCase.testNrows
(self)
Test Array2 nrows method
Test Array2 nrows method
def testNrows(self): "Test Array2 nrows method" self.failUnless(self.array2.nrows() == self.nrows)
[ "def", "testNrows", "(", "self", ")", ":", "self", ".", "failUnless", "(", "self", ".", "array2", ".", "nrows", "(", ")", "==", "self", ".", "nrows", ")" ]
[ 160, 4 ]
[ 162, 58 ]
python
en
['en', 'be', 'en']
True
Array2TestCase.testNcols
(self)
Test Array2 ncols method
Test Array2 ncols method
def testNcols(self): "Test Array2 ncols method" self.failUnless(self.array2.ncols() == self.ncols)
[ "def", "testNcols", "(", "self", ")", ":", "self", ".", "failUnless", "(", "self", ".", "array2", ".", "ncols", "(", ")", "==", "self", ".", "ncols", ")" ]
[ 164, 4 ]
[ 166, 58 ]
python
en
['en', 'et', 'en']
True
Array2TestCase.testLen
(self)
Test Array2 __len__ method
Test Array2 __len__ method
def testLen(self): "Test Array2 __len__ method" self.failUnless(len(self.array2) == self.nrows*self.ncols)
[ "def", "testLen", "(", "self", ")", ":", "self", ".", "failUnless", "(", "len", "(", "self", ".", "array2", ")", "==", "self", ".", "nrows", "*", "self", ".", "ncols", ")" ]
[ 168, 4 ]
[ 170, 66 ]
python
en
['en', 'hu', 'tr']
False
Array2TestCase.testResize0
(self)
Test Array2 resize method, size
Test Array2 resize method, size
def testResize0(self): "Test Array2 resize method, size" newRows = 2 * self.nrows newCols = 2 * self.ncols self.array2.resize(newRows, newCols) self.failUnless(len(self.array2) == newRows * newCols)
[ "def", "testResize0", "(", "self", ")", ":", "newRows", "=", "2", "*", "self", ".", "nrows", "newCols", "=", "2", "*", "self", ".", "ncols", "self", ".", "array2", ".", "resize", "(", "newRows", ",", "newCols", ")", "self", ".", "failUnless", "(", ...
[ 172, 4 ]
[ 177, 62 ]
python
en
['en', 'hu', 'en']
True
Array2TestCase.testResize1
(self)
Test Array2 resize method, array
Test Array2 resize method, array
def testResize1(self): "Test Array2 resize method, array" a = np.zeros((2*self.nrows, 2*self.ncols), dtype='l') self.array2.resize(a) self.failUnless(len(self.array2) == a.size)
[ "def", "testResize1", "(", "self", ")", ":", "a", "=", "np", ".", "zeros", "(", "(", "2", "*", "self", ".", "nrows", ",", "2", "*", "self", ".", "ncols", ")", ",", "dtype", "=", "'l'", ")", "self", ".", "array2", ".", "resize", "(", "a", ")",...
[ 179, 4 ]
[ 183, 51 ]
python
en
['en', 'hu', 'en']
True
Array2TestCase.testResizeBad1
(self)
Test Array2 resize method, negative nrows
Test Array2 resize method, negative nrows
def testResizeBad1(self): "Test Array2 resize method, negative nrows" self.assertRaises(ValueError, self.array2.resize, -5, 5)
[ "def", "testResizeBad1", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "self", ".", "array2", ".", "resize", ",", "-", "5", ",", "5", ")" ]
[ 185, 4 ]
[ 187, 64 ]
python
en
['sl', 'en', 'en']
True
Array2TestCase.testResizeBad2
(self)
Test Array2 resize method, negative ncols
Test Array2 resize method, negative ncols
def testResizeBad2(self): "Test Array2 resize method, negative ncols" self.assertRaises(ValueError, self.array2.resize, 5, -5)
[ "def", "testResizeBad2", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "self", ".", "array2", ".", "resize", ",", "5", ",", "-", "5", ")" ]
[ 189, 4 ]
[ 191, 64 ]
python
en
['sl', 'zu', 'en']
False
Array2TestCase.testSetGet1
(self)
Test Array2 __setitem__, __getitem__ methods
Test Array2 __setitem__, __getitem__ methods
def testSetGet1(self): "Test Array2 __setitem__, __getitem__ methods" m = self.nrows n = self.ncols array1 = [ ] a = np.arange(n, dtype="l") for i in range(m): array1.append(Array.Array1(i*a)) for i in range(m): self.array2[i] = array1[i] ...
[ "def", "testSetGet1", "(", "self", ")", ":", "m", "=", "self", ".", "nrows", "n", "=", "self", ".", "ncols", "array1", "=", "[", "]", "a", "=", "np", ".", "arange", "(", "n", ",", "dtype", "=", "\"l\"", ")", "for", "i", "in", "range", "(", "m...
[ 193, 4 ]
[ 204, 56 ]
python
en
['en', 'et', 'hi']
False
Array2TestCase.testSetGet2
(self)
Test Array2 chained __setitem__, __getitem__ methods
Test Array2 chained __setitem__, __getitem__ methods
def testSetGet2(self): "Test Array2 chained __setitem__, __getitem__ methods" m = self.nrows n = self.ncols for i in range(m): for j in range(n): self.array2[i][j] = i*j for i in range(m): for j in range(n): self.failUnless(...
[ "def", "testSetGet2", "(", "self", ")", ":", "m", "=", "self", ".", "nrows", "n", "=", "self", ".", "ncols", "for", "i", "in", "range", "(", "m", ")", ":", "for", "j", "in", "range", "(", "n", ")", ":", "self", ".", "array2", "[", "i", "]", ...
[ 206, 4 ]
[ 215, 57 ]
python
en
['en', 'et', 'hi']
False
Array2TestCase.testSetBad1
(self)
Test Array2 __setitem__ method, negative index
Test Array2 __setitem__ method, negative index
def testSetBad1(self): "Test Array2 __setitem__ method, negative index" a = Array.Array1(self.ncols) self.assertRaises(IndexError, self.array2.__setitem__, -1, a)
[ "def", "testSetBad1", "(", "self", ")", ":", "a", "=", "Array", ".", "Array1", "(", "self", ".", "ncols", ")", "self", ".", "assertRaises", "(", "IndexError", ",", "self", ".", "array2", ".", "__setitem__", ",", "-", "1", ",", "a", ")" ]
[ 217, 4 ]
[ 220, 69 ]
python
da
['sl', 'da', 'hi']
False
Array2TestCase.testSetBad2
(self)
Test Array2 __setitem__ method, out-of-range index
Test Array2 __setitem__ method, out-of-range index
def testSetBad2(self): "Test Array2 __setitem__ method, out-of-range index" a = Array.Array1(self.ncols) self.assertRaises(IndexError, self.array2.__setitem__, self.nrows+1, a)
[ "def", "testSetBad2", "(", "self", ")", ":", "a", "=", "Array", ".", "Array1", "(", "self", ".", "ncols", ")", "self", ".", "assertRaises", "(", "IndexError", ",", "self", ".", "array2", ".", "__setitem__", ",", "self", ".", "nrows", "+", "1", ",", ...
[ 222, 4 ]
[ 225, 79 ]
python
en
['en', 'da', 'en']
True
Array2TestCase.testGetBad1
(self)
Test Array2 __getitem__ method, negative index
Test Array2 __getitem__ method, negative index
def testGetBad1(self): "Test Array2 __getitem__ method, negative index" self.assertRaises(IndexError, self.array2.__getitem__, -1)
[ "def", "testGetBad1", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "IndexError", ",", "self", ".", "array2", ".", "__getitem__", ",", "-", "1", ")" ]
[ 227, 4 ]
[ 229, 66 ]
python
da
['sl', 'da', 'hi']
False
Array2TestCase.testGetBad2
(self)
Test Array2 __getitem__ method, out-of-range index
Test Array2 __getitem__ method, out-of-range index
def testGetBad2(self): "Test Array2 __getitem__ method, out-of-range index" self.assertRaises(IndexError, self.array2.__getitem__, self.nrows+1)
[ "def", "testGetBad2", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "IndexError", ",", "self", ".", "array2", ".", "__getitem__", ",", "self", ".", "nrows", "+", "1", ")" ]
[ 231, 4 ]
[ 233, 76 ]
python
en
['en', 'da', 'en']
True
Array2TestCase.testAsString
(self)
Test Array2 asString method
Test Array2 asString method
def testAsString(self): "Test Array2 asString method" result = """\ [ [ 0, 1, 2, 3 ], [ 1, 2, 3, 4 ], [ 2, 3, 4, 5 ], [ 3, 4, 5, 6 ], [ 4, 5, 6, 7 ] ] """ for i in range(self.nrows): for j in range(self.ncols): self.array2[i][j] = i+j self.failUnless(s...
[ "def", "testAsString", "(", "self", ")", ":", "result", "=", "\"\"\"\\\n[ [ 0, 1, 2, 3 ],\n [ 1, 2, 3, 4 ],\n [ 2, 3, 4, 5 ],\n [ 3, 4, 5, 6 ],\n [ 4, 5, 6, 7 ] ]\n\"\"\"", "for", "i", "in", "range", "(", "self", ".", "nrows", ")", ":", "for", "j", "in", "range", "(...
[ 235, 4 ]
[ 247, 57 ]
python
en
['en', 'no', 'en']
True
Array2TestCase.testStr
(self)
Test Array2 __str__ method
Test Array2 __str__ method
def testStr(self): "Test Array2 __str__ method" result = """\ [ [ 0, -1, -2, -3 ], [ 1, 0, -1, -2 ], [ 2, 1, 0, -1 ], [ 3, 2, 1, 0 ], [ 4, 3, 2, 1 ] ] """ for i in range(self.nrows): for j in range(self.ncols): self.array2[i][j] = i-j self.failUnless(s...
[ "def", "testStr", "(", "self", ")", ":", "result", "=", "\"\"\"\\\n[ [ 0, -1, -2, -3 ],\n [ 1, 0, -1, -2 ],\n [ 2, 1, 0, -1 ],\n [ 3, 2, 1, 0 ],\n [ 4, 3, 2, 1 ] ]\n\"\"\"", "for", "i", "in", "range", "(", "self", ".", "nrows", ")", ":", "for", "j", "in", "range", "...
[ 249, 4 ]
[ 261, 51 ]
python
en
['en', 'is', 'en']
True
Array2TestCase.testView
(self)
Test Array2 view method
Test Array2 view method
def testView(self): "Test Array2 view method" a = self.array2.view() self.failUnless(isinstance(a, np.ndarray)) self.failUnless(len(a) == self.nrows)
[ "def", "testView", "(", "self", ")", ":", "a", "=", "self", ".", "array2", ".", "view", "(", ")", "self", ".", "failUnless", "(", "isinstance", "(", "a", ",", "np", ".", "ndarray", ")", ")", "self", ".", "failUnless", "(", "len", "(", "a", ")", ...
[ 263, 4 ]
[ 267, 45 ]
python
en
['en', 'en', 'en']
True
ArrayZTestCase.testConstructor0
(self)
Test ArrayZ default constructor
Test ArrayZ default constructor
def testConstructor0(self): "Test ArrayZ default constructor" a = Array.ArrayZ() self.failUnless(isinstance(a, Array.ArrayZ)) self.failUnless(len(a) == 0)
[ "def", "testConstructor0", "(", "self", ")", ":", "a", "=", "Array", ".", "ArrayZ", "(", ")", "self", ".", "failUnless", "(", "isinstance", "(", "a", ",", "Array", ".", "ArrayZ", ")", ")", "self", ".", "failUnless", "(", "len", "(", "a", ")", "==",...
[ 277, 4 ]
[ 281, 36 ]
python
en
['es', 'fr', 'en']
False
ArrayZTestCase.testConstructor1
(self)
Test ArrayZ length constructor
Test ArrayZ length constructor
def testConstructor1(self): "Test ArrayZ length constructor" self.failUnless(isinstance(self.array3, Array.ArrayZ))
[ "def", "testConstructor1", "(", "self", ")", ":", "self", ".", "failUnless", "(", "isinstance", "(", "self", ".", "array3", ",", "Array", ".", "ArrayZ", ")", ")" ]
[ 283, 4 ]
[ 285, 62 ]
python
en
['en', 'ga', 'en']
True
ArrayZTestCase.testConstructor2
(self)
Test ArrayZ array constructor
Test ArrayZ array constructor
def testConstructor2(self): "Test ArrayZ array constructor" na = np.arange(self.length, dtype=np.complex128) aa = Array.ArrayZ(na) self.failUnless(isinstance(aa, Array.ArrayZ))
[ "def", "testConstructor2", "(", "self", ")", ":", "na", "=", "np", ".", "arange", "(", "self", ".", "length", ",", "dtype", "=", "np", ".", "complex128", ")", "aa", "=", "Array", ".", "ArrayZ", "(", "na", ")", "self", ".", "failUnless", "(", "isins...
[ 287, 4 ]
[ 291, 53 ]
python
en
['en', 'ga', 'tr']
False
ArrayZTestCase.testConstructor3
(self)
Test ArrayZ copy constructor
Test ArrayZ copy constructor
def testConstructor3(self): "Test ArrayZ copy constructor" for i in range(self.array3.length()): self.array3[i] = complex(i,-i) arrayCopy = Array.ArrayZ(self.array3) self.failUnless(arrayCopy == self.array3)
[ "def", "testConstructor3", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "array3", ".", "length", "(", ")", ")", ":", "self", ".", "array3", "[", "i", "]", "=", "complex", "(", "i", ",", "-", "i", ")", "arrayCopy", "=", "A...
[ 293, 4 ]
[ 297, 49 ]
python
en
['en', 'pl', 'tr']
False
ArrayZTestCase.testConstructorBad
(self)
Test ArrayZ length constructor, negative
Test ArrayZ length constructor, negative
def testConstructorBad(self): "Test ArrayZ length constructor, negative" self.assertRaises(ValueError, Array.ArrayZ, -4)
[ "def", "testConstructorBad", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "Array", ".", "ArrayZ", ",", "-", "4", ")" ]
[ 299, 4 ]
[ 301, 55 ]
python
cs
['sl', 'cs', 'en']
False
ArrayZTestCase.testLength
(self)
Test ArrayZ length method
Test ArrayZ length method
def testLength(self): "Test ArrayZ length method" self.failUnless(self.array3.length() == self.length)
[ "def", "testLength", "(", "self", ")", ":", "self", ".", "failUnless", "(", "self", ".", "array3", ".", "length", "(", ")", "==", "self", ".", "length", ")" ]
[ 303, 4 ]
[ 305, 60 ]
python
en
['en', 'ga', 'en']
True
ArrayZTestCase.testLen
(self)
Test ArrayZ __len__ method
Test ArrayZ __len__ method
def testLen(self): "Test ArrayZ __len__ method" self.failUnless(len(self.array3) == self.length)
[ "def", "testLen", "(", "self", ")", ":", "self", ".", "failUnless", "(", "len", "(", "self", ".", "array3", ")", "==", "self", ".", "length", ")" ]
[ 307, 4 ]
[ 309, 56 ]
python
tr
['en', 'tr', 'tr']
True
ArrayZTestCase.testResize0
(self)
Test ArrayZ resize method, length
Test ArrayZ resize method, length
def testResize0(self): "Test ArrayZ resize method, length" newLen = 2 * self.length self.array3.resize(newLen) self.failUnless(len(self.array3) == newLen)
[ "def", "testResize0", "(", "self", ")", ":", "newLen", "=", "2", "*", "self", ".", "length", "self", ".", "array3", ".", "resize", "(", "newLen", ")", "self", ".", "failUnless", "(", "len", "(", "self", ".", "array3", ")", "==", "newLen", ")" ]
[ 311, 4 ]
[ 315, 51 ]
python
en
['fr', 'hu', 'en']
False
ArrayZTestCase.testResize1
(self)
Test ArrayZ resize method, array
Test ArrayZ resize method, array
def testResize1(self): "Test ArrayZ resize method, array" a = np.zeros((2*self.length,), dtype=np.complex128) self.array3.resize(a) self.failUnless(len(self.array3) == a.size)
[ "def", "testResize1", "(", "self", ")", ":", "a", "=", "np", ".", "zeros", "(", "(", "2", "*", "self", ".", "length", ",", ")", ",", "dtype", "=", "np", ".", "complex128", ")", "self", ".", "array3", ".", "resize", "(", "a", ")", "self", ".", ...
[ 317, 4 ]
[ 321, 51 ]
python
en
['en', 'hu', 'en']
True
ArrayZTestCase.testResizeBad
(self)
Test ArrayZ resize method, negative length
Test ArrayZ resize method, negative length
def testResizeBad(self): "Test ArrayZ resize method, negative length" self.assertRaises(ValueError, self.array3.resize, -5)
[ "def", "testResizeBad", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "self", ".", "array3", ".", "resize", ",", "-", "5", ")" ]
[ 323, 4 ]
[ 325, 61 ]
python
cs
['sl', 'cs', 'en']
False