body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def process_meta_item(self, item, absolute_path=True, **kwargs):
'Process single meta data item\n\n Parameters\n ----------\n item : MetaDataItem\n Meta data item\n\n absolute_path : bool\n Convert file paths to be absolute\n Default value True\n\n ... | -3,948,935,948,919,123,000 | Process single meta data item
Parameters
----------
item : MetaDataItem
Meta data item
absolute_path : bool
Convert file paths to be absolute
Default value True | dcase_util/datasets/tut.py | process_meta_item | ankitshah009/dcase_util | python | def process_meta_item(self, item, absolute_path=True, **kwargs):
'Process single meta data item\n\n Parameters\n ----------\n item : MetaDataItem\n Meta data item\n\n absolute_path : bool\n Convert file paths to be absolute\n Default value True\n\n ... |
def prepare(self):
'Prepare dataset for the usage.\n\n Returns\n -------\n self\n\n '
if (not self.meta_container.exists()):
meta_data = MetaDataContainer()
annotation_files = Path().file_list(path=os.path.join(self.local_path, 'meta'), extensions=['ann'])
for... | -7,578,620,383,298,427,000 | Prepare dataset for the usage.
Returns
-------
self | dcase_util/datasets/tut.py | prepare | ankitshah009/dcase_util | python | def prepare(self):
'Prepare dataset for the usage.\n\n Returns\n -------\n self\n\n '
if (not self.meta_container.exists()):
meta_data = MetaDataContainer()
annotation_files = Path().file_list(path=os.path.join(self.local_path, 'meta'), extensions=['ann'])
for... |
def __init__(self, storage_name='TUT-sound-events-2016-evaluation', data_path=None, included_content_types=None, **kwargs):
"\n Constructor\n\n Parameters\n ----------\n\n storage_name : str\n Name to be used when storing dataset on disk\n Default value 'TUT-sound-e... | 5,616,250,338,590,877,000 | Constructor
Parameters
----------
storage_name : str
Name to be used when storing dataset on disk
Default value 'TUT-sound-events-2016-evaluation'
data_path : str
Root path where the dataset is stored. If None, os.path.join(tempfile.gettempdir(), 'dcase_util_datasets')
is used.
Default value None... | dcase_util/datasets/tut.py | __init__ | ankitshah009/dcase_util | python | def __init__(self, storage_name='TUT-sound-events-2016-evaluation', data_path=None, included_content_types=None, **kwargs):
"\n Constructor\n\n Parameters\n ----------\n\n storage_name : str\n Name to be used when storing dataset on disk\n Default value 'TUT-sound-e... |
def prepare(self):
'Prepare dataset for the usage.\n\n Returns\n -------\n self\n\n '
if ((not self.meta_container.exists()) and os.path.isdir(os.path.join(self.local_path, 'meta'))):
meta_data = MetaDataContainer()
annotation_files = Path().file_list(path=os.path.joi... | 1,593,265,729,418,320,000 | Prepare dataset for the usage.
Returns
-------
self | dcase_util/datasets/tut.py | prepare | ankitshah009/dcase_util | python | def prepare(self):
'Prepare dataset for the usage.\n\n Returns\n -------\n self\n\n '
if ((not self.meta_container.exists()) and os.path.isdir(os.path.join(self.local_path, 'meta'))):
meta_data = MetaDataContainer()
annotation_files = Path().file_list(path=os.path.joi... |
def __init__(self, storage_name='TUT-SED-synthetic-2016', data_path=None, included_content_types=None, **kwargs):
"\n Constructor\n\n Parameters\n ----------\n\n storage_name : str\n Name to be used when storing dataset on disk\n Default value 'TUT-SED-synthetic-201... | -5,004,241,706,890,039,000 | Constructor
Parameters
----------
storage_name : str
Name to be used when storing dataset on disk
Default value 'TUT-SED-synthetic-2016'
data_path : str
Root path where the dataset is stored. If None, os.path.join(tempfile.gettempdir(), 'dcase_util_datasets')
is used.
Default value None
included... | dcase_util/datasets/tut.py | __init__ | ankitshah009/dcase_util | python | def __init__(self, storage_name='TUT-SED-synthetic-2016', data_path=None, included_content_types=None, **kwargs):
"\n Constructor\n\n Parameters\n ----------\n\n storage_name : str\n Name to be used when storing dataset on disk\n Default value 'TUT-SED-synthetic-201... |
def prepare(self):
'Prepare dataset for the usage.\n\n Returns\n -------\n self\n\n '
if (not self.meta_container.exists()):
meta_files = Path().file_list(path=os.path.join(self.local_path, 'meta'), extensions=['txt'])
meta_data = MetaDataContainer()
for meta_... | -6,557,052,325,882,180,000 | Prepare dataset for the usage.
Returns
-------
self | dcase_util/datasets/tut.py | prepare | ankitshah009/dcase_util | python | def prepare(self):
'Prepare dataset for the usage.\n\n Returns\n -------\n self\n\n '
if (not self.meta_container.exists()):
meta_files = Path().file_list(path=os.path.join(self.local_path, 'meta'), extensions=['txt'])
meta_data = MetaDataContainer()
for meta_... |
def file_features(self, filename):
'Pre-calculated acoustic features for given file\n\n Parameters\n ----------\n filename : str\n File name\n\n Returns\n -------\n data : numpy.ndarray\n Matrix containing acoustic features\n\n '
filename_ =... | 428,636,534,373,538,800 | Pre-calculated acoustic features for given file
Parameters
----------
filename : str
File name
Returns
-------
data : numpy.ndarray
Matrix containing acoustic features | dcase_util/datasets/tut.py | file_features | ankitshah009/dcase_util | python | def file_features(self, filename):
'Pre-calculated acoustic features for given file\n\n Parameters\n ----------\n filename : str\n File name\n\n Returns\n -------\n data : numpy.ndarray\n Matrix containing acoustic features\n\n '
filename_ =... |
def _reset(self, new_min_lr=None, new_max_lr=None, new_base_epochs=None, new_mul_epochs=None):
'Resets cycle iterations.'
if (new_min_lr != None):
self.min_lr = new_min_lr
if (new_max_lr != None):
self.max_lr = new_max_lr
if (new_base_epochs != None):
self.base_epochs = new_base_... | -8,164,284,948,579,837,000 | Resets cycle iterations. | sgdr_callback.py | _reset | Callidior/semantic-embeddings | python | def _reset(self, new_min_lr=None, new_max_lr=None, new_base_epochs=None, new_mul_epochs=None):
if (new_min_lr != None):
self.min_lr = new_min_lr
if (new_max_lr != None):
self.max_lr = new_max_lr
if (new_base_epochs != None):
self.base_epochs = new_base_epochs
if (new_mul_epo... |
@pytest.fixture(scope='session')
def selenium_patcher():
'Add custom .'
add_custom_commands() | 1,832,878,463,908,379,400 | Add custom . | pytest_selenium_enhancer/plugin.py | selenium_patcher | popescunsergiu/pytest-selenium-enhancer | python | @pytest.fixture(scope='session')
def selenium_patcher():
add_custom_commands() |
def _check_cache_entry(self, entry):
'Assert validity of the cache entry.'
self.assertIsInstance(entry.site, BaseSite)
self.assertIsInstance(entry.site._loginstatus, int)
self.assertIsInstance(entry.site._username, list)
if (entry.site._loginstatus >= 1):
self.assertIsNotNone(entry.site._use... | -5,294,106,942,538,693,000 | Assert validity of the cache entry. | tests/cache_tests.py | _check_cache_entry | Annie201/pywikibot-core | python | def _check_cache_entry(self, entry):
self.assertIsInstance(entry.site, BaseSite)
self.assertIsInstance(entry.site._loginstatus, int)
self.assertIsInstance(entry.site._username, list)
if (entry.site._loginstatus >= 1):
self.assertIsNotNone(entry.site._username[0])
self.assertIsInstance(e... |
def test_cache(self):
'Test the apicache by doing _check_cache_entry over each entry.'
cache.process_entries(_cache_dir, self._check_cache_entry) | -1,055,730,274,172,869,800 | Test the apicache by doing _check_cache_entry over each entry. | tests/cache_tests.py | test_cache | Annie201/pywikibot-core | python | def test_cache(self):
cache.process_entries(_cache_dir, self._check_cache_entry) |
def setup_argparse_only():
'Wrapper for ``setup_argparse()`` that only returns the parser.\n\n Only used in sphinx documentation via ``sphinx-argparse``.\n '
return setup_argparse()[0] | 1,517,469,603,038,058,800 | Wrapper for ``setup_argparse()`` that only returns the parser.
Only used in sphinx documentation via ``sphinx-argparse``. | varfish_cli/__main__.py | setup_argparse_only | bihealth/varfish-cli | python | def setup_argparse_only():
'Wrapper for ``setup_argparse()`` that only returns the parser.\n\n Only used in sphinx documentation via ``sphinx-argparse``.\n '
return setup_argparse()[0] |
def setup_argparse():
'Create argument parser.'
parser = argparse.ArgumentParser(prog='varfish-cli')
parser.add_argument('--verbose', action='store_true', default=False, help='Increase verbosity.')
parser.add_argument('--version', action='version', version=('%%(prog)s %s' % __version__))
group = par... | -638,400,639,551,440,800 | Create argument parser. | varfish_cli/__main__.py | setup_argparse | bihealth/varfish-cli | python | def setup_argparse():
parser = argparse.ArgumentParser(prog='varfish-cli')
parser.add_argument('--verbose', action='store_true', default=False, help='Increase verbosity.')
parser.add_argument('--version', action='version', version=('%%(prog)s %s' % __version__))
group = parser.add_argument_group('B... |
def main(argv=None):
'Main entry point before parsing command line arguments.'
(parser, subparsers) = setup_argparse()
args = parser.parse_args(argv)
if args.verbose:
level = logging.DEBUG
else:
formatter = logzero.LogFormatter(fmt='%(color)s[%(levelname)1.1s %(asctime)s]%(end_color)... | 3,123,301,595,510,910,000 | Main entry point before parsing command line arguments. | varfish_cli/__main__.py | main | bihealth/varfish-cli | python | def main(argv=None):
(parser, subparsers) = setup_argparse()
args = parser.parse_args(argv)
if args.verbose:
level = logging.DEBUG
else:
formatter = logzero.LogFormatter(fmt='%(color)s[%(levelname)1.1s %(asctime)s]%(end_color)s %(message)s')
logzero.formatter(formatter)
... |
def get_train_hooks(name_list, use_tpu=False, **kwargs):
'Factory for getting a list of TensorFlow hooks for training by name.\n\n Args:\n name_list: a list of strings to name desired hook classes. Allowed:\n LoggingTensorHook, ProfilerHook, ExamplesPerSecondHook, which are defined\n as keys in HOOKS\... | 8,321,067,302,129,089,000 | Factory for getting a list of TensorFlow hooks for training by name.
Args:
name_list: a list of strings to name desired hook classes. Allowed:
LoggingTensorHook, ProfilerHook, ExamplesPerSecondHook, which are defined
as keys in HOOKS
use_tpu: Boolean of whether computation occurs on a TPU. This will disabl... | official/utils/logs/hooks_helper.py | get_train_hooks | Mithilesh1609/assembled-cnn | python | def get_train_hooks(name_list, use_tpu=False, **kwargs):
'Factory for getting a list of TensorFlow hooks for training by name.\n\n Args:\n name_list: a list of strings to name desired hook classes. Allowed:\n LoggingTensorHook, ProfilerHook, ExamplesPerSecondHook, which are defined\n as keys in HOOKS\... |
def get_logging_tensor_hook(every_n_iter=100, tensors_to_log=None, **kwargs):
'Function to get LoggingTensorHook.\n\n Args:\n every_n_iter: `int`, print the values of `tensors` once every N local\n steps taken on the current worker.\n tensors_to_log: List of tensor names or dictionary mapping labels to ... | -2,488,998,155,569,033,700 | Function to get LoggingTensorHook.
Args:
every_n_iter: `int`, print the values of `tensors` once every N local
steps taken on the current worker.
tensors_to_log: List of tensor names or dictionary mapping labels to tensor
names. If not set, log _TENSORS_TO_LOG by default.
**kwargs: a dictionary of argume... | official/utils/logs/hooks_helper.py | get_logging_tensor_hook | Mithilesh1609/assembled-cnn | python | def get_logging_tensor_hook(every_n_iter=100, tensors_to_log=None, **kwargs):
'Function to get LoggingTensorHook.\n\n Args:\n every_n_iter: `int`, print the values of `tensors` once every N local\n steps taken on the current worker.\n tensors_to_log: List of tensor names or dictionary mapping labels to ... |
def get_profiler_hook(model_dir, save_steps=1000, **kwargs):
'Function to get ProfilerHook.\n\n Args:\n model_dir: The directory to save the profile traces to.\n save_steps: `int`, print profile traces every N steps.\n **kwargs: a dictionary of arguments to ProfilerHook.\n\n Returns:\n Returns a Profi... | -3,053,697,511,662,991,400 | Function to get ProfilerHook.
Args:
model_dir: The directory to save the profile traces to.
save_steps: `int`, print profile traces every N steps.
**kwargs: a dictionary of arguments to ProfilerHook.
Returns:
Returns a ProfilerHook that writes out timelines that can be loaded into
profiling tools like chrom... | official/utils/logs/hooks_helper.py | get_profiler_hook | Mithilesh1609/assembled-cnn | python | def get_profiler_hook(model_dir, save_steps=1000, **kwargs):
'Function to get ProfilerHook.\n\n Args:\n model_dir: The directory to save the profile traces to.\n save_steps: `int`, print profile traces every N steps.\n **kwargs: a dictionary of arguments to ProfilerHook.\n\n Returns:\n Returns a Profi... |
def get_examples_per_second_hook(every_n_steps=100, batch_size=128, warm_steps=5, **kwargs):
'Function to get ExamplesPerSecondHook.\n\n Args:\n every_n_steps: `int`, print current and average examples per second every\n N steps.\n batch_size: `int`, total batch size used to calculate examples/second fr... | 683,162,254,790,537,200 | Function to get ExamplesPerSecondHook.
Args:
every_n_steps: `int`, print current and average examples per second every
N steps.
batch_size: `int`, total batch size used to calculate examples/second from
global time.
warm_steps: skip this number of steps before logging and running average.
**kwargs: a d... | official/utils/logs/hooks_helper.py | get_examples_per_second_hook | Mithilesh1609/assembled-cnn | python | def get_examples_per_second_hook(every_n_steps=100, batch_size=128, warm_steps=5, **kwargs):
'Function to get ExamplesPerSecondHook.\n\n Args:\n every_n_steps: `int`, print current and average examples per second every\n N steps.\n batch_size: `int`, total batch size used to calculate examples/second fr... |
def get_logging_metric_hook(tensors_to_log=None, every_n_secs=600, **kwargs):
'Function to get LoggingMetricHook.\n\n Args:\n tensors_to_log: List of tensor names or dictionary mapping labels to tensor\n names. If not set, log _TENSORS_TO_LOG by default.\n every_n_secs: `int`, the frequency for logging ... | -5,095,878,965,021,634,000 | Function to get LoggingMetricHook.
Args:
tensors_to_log: List of tensor names or dictionary mapping labels to tensor
names. If not set, log _TENSORS_TO_LOG by default.
every_n_secs: `int`, the frequency for logging the metric. Default to every
10 mins.
Returns:
Returns a LoggingMetricHook that saves ten... | official/utils/logs/hooks_helper.py | get_logging_metric_hook | Mithilesh1609/assembled-cnn | python | def get_logging_metric_hook(tensors_to_log=None, every_n_secs=600, **kwargs):
'Function to get LoggingMetricHook.\n\n Args:\n tensors_to_log: List of tensor names or dictionary mapping labels to tensor\n names. If not set, log _TENSORS_TO_LOG by default.\n every_n_secs: `int`, the frequency for logging ... |
@property
def _constructor(self):
"\n Class constructor (for this class it's just `__class__`.\n "
return type(self) | 1,696,908,129,312,269,800 | Class constructor (for this class it's just `__class__`. | pandas/core/base.py | _constructor | BryanRacic/pandas | python | @property
def _constructor(self):
"\n \n "
return type(self) |
def __repr__(self) -> str:
'\n Return a string representation for a particular object.\n '
return object.__repr__(self) | 3,016,805,634,138,606,600 | Return a string representation for a particular object. | pandas/core/base.py | __repr__ | BryanRacic/pandas | python | def __repr__(self) -> str:
'\n \n '
return object.__repr__(self) |
def _reset_cache(self, key: (str | None)=None) -> None:
'\n Reset cached properties. If ``key`` is passed, only clears that key.\n '
if (not hasattr(self, '_cache')):
return
if (key is None):
self._cache.clear()
else:
self._cache.pop(key, None) | 8,692,063,033,057,934,000 | Reset cached properties. If ``key`` is passed, only clears that key. | pandas/core/base.py | _reset_cache | BryanRacic/pandas | python | def _reset_cache(self, key: (str | None)=None) -> None:
'\n \n '
if (not hasattr(self, '_cache')):
return
if (key is None):
self._cache.clear()
else:
self._cache.pop(key, None) |
def __sizeof__(self) -> int:
'\n Generates the total memory usage for an object that returns\n either a value or Series of values\n '
memory_usage = getattr(self, 'memory_usage', None)
if memory_usage:
mem = memory_usage(deep=True)
return int((mem if is_scalar(mem) else ... | -6,205,035,213,557,224,000 | Generates the total memory usage for an object that returns
either a value or Series of values | pandas/core/base.py | __sizeof__ | BryanRacic/pandas | python | def __sizeof__(self) -> int:
'\n Generates the total memory usage for an object that returns\n either a value or Series of values\n '
memory_usage = getattr(self, 'memory_usage', None)
if memory_usage:
mem = memory_usage(deep=True)
return int((mem if is_scalar(mem) else ... |
def _freeze(self):
'\n Prevents setting additional attributes.\n '
object.__setattr__(self, '__frozen', True) | -7,029,115,408,159,700,000 | Prevents setting additional attributes. | pandas/core/base.py | _freeze | BryanRacic/pandas | python | def _freeze(self):
'\n \n '
object.__setattr__(self, '__frozen', True) |
def _gotitem(self, key, ndim: int, subset=None):
'\n sub-classes to define\n return a sliced object\n\n Parameters\n ----------\n key : str / list of selections\n ndim : {1, 2}\n requested ndim of result\n subset : object, default None\n subset ... | -4,390,008,202,310,129,000 | sub-classes to define
return a sliced object
Parameters
----------
key : str / list of selections
ndim : {1, 2}
requested ndim of result
subset : object, default None
subset to act on | pandas/core/base.py | _gotitem | BryanRacic/pandas | python | def _gotitem(self, key, ndim: int, subset=None):
'\n sub-classes to define\n return a sliced object\n\n Parameters\n ----------\n key : str / list of selections\n ndim : {1, 2}\n requested ndim of result\n subset : object, default None\n subset ... |
def transpose(self: _T, *args, **kwargs) -> _T:
'\n Return the transpose, which is by definition self.\n\n Returns\n -------\n %(klass)s\n '
nv.validate_transpose(args, kwargs)
return self | -278,207,969,909,020,400 | Return the transpose, which is by definition self.
Returns
-------
%(klass)s | pandas/core/base.py | transpose | BryanRacic/pandas | python | def transpose(self: _T, *args, **kwargs) -> _T:
'\n Return the transpose, which is by definition self.\n\n Returns\n -------\n %(klass)s\n '
nv.validate_transpose(args, kwargs)
return self |
@property
def shape(self) -> Shape:
'\n Return a tuple of the shape of the underlying data.\n '
return self._values.shape | -5,094,044,862,570,053,000 | Return a tuple of the shape of the underlying data. | pandas/core/base.py | shape | BryanRacic/pandas | python | @property
def shape(self) -> Shape:
'\n \n '
return self._values.shape |
@property
def ndim(self) -> int:
'\n Number of dimensions of the underlying data, by definition 1.\n '
return 1 | -6,934,603,568,630,411,000 | Number of dimensions of the underlying data, by definition 1. | pandas/core/base.py | ndim | BryanRacic/pandas | python | @property
def ndim(self) -> int:
'\n \n '
return 1 |
def item(self):
'\n Return the first element of the underlying data as a Python scalar.\n\n Returns\n -------\n scalar\n The first element of %(klass)s.\n\n Raises\n ------\n ValueError\n If the data is not length-1.\n '
if (len(self)... | 7,207,348,110,767,913,000 | Return the first element of the underlying data as a Python scalar.
Returns
-------
scalar
The first element of %(klass)s.
Raises
------
ValueError
If the data is not length-1. | pandas/core/base.py | item | BryanRacic/pandas | python | def item(self):
'\n Return the first element of the underlying data as a Python scalar.\n\n Returns\n -------\n scalar\n The first element of %(klass)s.\n\n Raises\n ------\n ValueError\n If the data is not length-1.\n '
if (len(self)... |
@property
def nbytes(self) -> int:
'\n Return the number of bytes in the underlying data.\n '
return self._values.nbytes | -8,601,156,375,750,126,000 | Return the number of bytes in the underlying data. | pandas/core/base.py | nbytes | BryanRacic/pandas | python | @property
def nbytes(self) -> int:
'\n \n '
return self._values.nbytes |
@property
def size(self) -> int:
'\n Return the number of elements in the underlying data.\n '
return len(self._values) | 5,262,765,579,070,325,000 | Return the number of elements in the underlying data. | pandas/core/base.py | size | BryanRacic/pandas | python | @property
def size(self) -> int:
'\n \n '
return len(self._values) |
@property
def array(self) -> ExtensionArray:
"\n The ExtensionArray of the data backing this Series or Index.\n\n Returns\n -------\n ExtensionArray\n An ExtensionArray of the values stored within. For extension\n types, this is the actual array. For NumPy native ty... | 7,608,311,211,353,715,000 | The ExtensionArray of the data backing this Series or Index.
Returns
-------
ExtensionArray
An ExtensionArray of the values stored within. For extension
types, this is the actual array. For NumPy native types, this
is a thin (no copy) wrapper around :class:`numpy.ndarray`.
``.array`` differs ``.values... | pandas/core/base.py | array | BryanRacic/pandas | python | @property
def array(self) -> ExtensionArray:
"\n The ExtensionArray of the data backing this Series or Index.\n\n Returns\n -------\n ExtensionArray\n An ExtensionArray of the values stored within. For extension\n types, this is the actual array. For NumPy native ty... |
def to_numpy(self, dtype: (npt.DTypeLike | None)=None, copy: bool=False, na_value=lib.no_default, **kwargs) -> np.ndarray:
'\n A NumPy ndarray representing the values in this Series or Index.\n\n Parameters\n ----------\n dtype : str or numpy.dtype, optional\n The dtype to pas... | 4,357,615,367,760,797,000 | A NumPy ndarray representing the values in this Series or Index.
Parameters
----------
dtype : str or numpy.dtype, optional
The dtype to pass to :meth:`numpy.asarray`.
copy : bool, default False
Whether to ensure that the returned value is not a view on
another array. Note that ``copy=False`` does not *ens... | pandas/core/base.py | to_numpy | BryanRacic/pandas | python | def to_numpy(self, dtype: (npt.DTypeLike | None)=None, copy: bool=False, na_value=lib.no_default, **kwargs) -> np.ndarray:
'\n A NumPy ndarray representing the values in this Series or Index.\n\n Parameters\n ----------\n dtype : str or numpy.dtype, optional\n The dtype to pas... |
def max(self, axis=None, skipna: bool=True, *args, **kwargs):
"\n Return the maximum value of the Index.\n\n Parameters\n ----------\n axis : int, optional\n For compatibility with NumPy. Only 0 or None are allowed.\n skipna : bool, default True\n Exclude NA/... | 4,268,672,646,825,609,700 | Return the maximum value of the Index.
Parameters
----------
axis : int, optional
For compatibility with NumPy. Only 0 or None are allowed.
skipna : bool, default True
Exclude NA/null values when showing the result.
*args, **kwargs
Additional arguments and keywords for compatibility with NumPy.
Returns
--... | pandas/core/base.py | max | BryanRacic/pandas | python | def max(self, axis=None, skipna: bool=True, *args, **kwargs):
"\n Return the maximum value of the Index.\n\n Parameters\n ----------\n axis : int, optional\n For compatibility with NumPy. Only 0 or None are allowed.\n skipna : bool, default True\n Exclude NA/... |
@doc(op='max', oppose='min', value='largest')
def argmax(self, axis=None, skipna: bool=True, *args, **kwargs) -> int:
"\n Return int position of the {value} value in the Series.\n\n If the {op}imum is achieved in multiple locations,\n the first row position is returned.\n\n Parameters\n ... | 2,756,451,465,106,003,500 | Return int position of the {value} value in the Series.
If the {op}imum is achieved in multiple locations,
the first row position is returned.
Parameters
----------
axis : {{None}}
Dummy argument for consistency with Series.
skipna : bool, default True
Exclude NA/null values when showing the result.
*args, **... | pandas/core/base.py | argmax | BryanRacic/pandas | python | @doc(op='max', oppose='min', value='largest')
def argmax(self, axis=None, skipna: bool=True, *args, **kwargs) -> int:
"\n Return int position of the {value} value in the Series.\n\n If the {op}imum is achieved in multiple locations,\n the first row position is returned.\n\n Parameters\n ... |
def min(self, axis=None, skipna: bool=True, *args, **kwargs):
"\n Return the minimum value of the Index.\n\n Parameters\n ----------\n axis : {None}\n Dummy argument for consistency with Series.\n skipna : bool, default True\n Exclude NA/null values when show... | 4,895,894,055,981,468,000 | Return the minimum value of the Index.
Parameters
----------
axis : {None}
Dummy argument for consistency with Series.
skipna : bool, default True
Exclude NA/null values when showing the result.
*args, **kwargs
Additional arguments and keywords for compatibility with NumPy.
Returns
-------
scalar
Mini... | pandas/core/base.py | min | BryanRacic/pandas | python | def min(self, axis=None, skipna: bool=True, *args, **kwargs):
"\n Return the minimum value of the Index.\n\n Parameters\n ----------\n axis : {None}\n Dummy argument for consistency with Series.\n skipna : bool, default True\n Exclude NA/null values when show... |
def tolist(self):
'\n Return a list of the values.\n\n These are each a scalar type, which is a Python scalar\n (for str, int, float) or a pandas scalar\n (for Timestamp/Timedelta/Interval/Period)\n\n Returns\n -------\n list\n\n See Also\n --------\n ... | 4,623,667,165,696,130,000 | Return a list of the values.
These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)
Returns
-------
list
See Also
--------
numpy.ndarray.tolist : Return the array as an a.ndim-levels deep
nested list of Python scalars. | pandas/core/base.py | tolist | BryanRacic/pandas | python | def tolist(self):
'\n Return a list of the values.\n\n These are each a scalar type, which is a Python scalar\n (for str, int, float) or a pandas scalar\n (for Timestamp/Timedelta/Interval/Period)\n\n Returns\n -------\n list\n\n See Also\n --------\n ... |
def __iter__(self):
'\n Return an iterator of the values.\n\n These are each a scalar type, which is a Python scalar\n (for str, int, float) or a pandas scalar\n (for Timestamp/Timedelta/Interval/Period)\n\n Returns\n -------\n iterator\n '
if (not isinsta... | 6,172,453,236,682,056,000 | Return an iterator of the values.
These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)
Returns
-------
iterator | pandas/core/base.py | __iter__ | BryanRacic/pandas | python | def __iter__(self):
'\n Return an iterator of the values.\n\n These are each a scalar type, which is a Python scalar\n (for str, int, float) or a pandas scalar\n (for Timestamp/Timedelta/Interval/Period)\n\n Returns\n -------\n iterator\n '
if (not isinsta... |
@cache_readonly
def hasnans(self) -> bool:
'\n Return if I have any nans; enables various perf speedups.\n '
return bool(isna(self).any()) | -3,629,634,497,472,234,000 | Return if I have any nans; enables various perf speedups. | pandas/core/base.py | hasnans | BryanRacic/pandas | python | @cache_readonly
def hasnans(self) -> bool:
'\n \n '
return bool(isna(self).any()) |
def _reduce(self, op, name: str, *, axis=0, skipna=True, numeric_only=None, filter_type=None, **kwds):
'\n Perform the reduction type operation if we can.\n '
func = getattr(self, name, None)
if (func is None):
raise TypeError(f'{type(self).__name__} cannot perform the operation {name}... | -6,248,915,611,062,733,000 | Perform the reduction type operation if we can. | pandas/core/base.py | _reduce | BryanRacic/pandas | python | def _reduce(self, op, name: str, *, axis=0, skipna=True, numeric_only=None, filter_type=None, **kwds):
'\n \n '
func = getattr(self, name, None)
if (func is None):
raise TypeError(f'{type(self).__name__} cannot perform the operation {name}')
return func(skipna=skipna, **kwds) |
@final
def _map_values(self, mapper, na_action=None):
"\n An internal function that maps values using the input\n correspondence (which can be a dict, Series, or function).\n\n Parameters\n ----------\n mapper : function, dict, or Series\n The input correspondence objec... | 4,348,222,714,382,488,000 | An internal function that maps values using the input
correspondence (which can be a dict, Series, or function).
Parameters
----------
mapper : function, dict, or Series
The input correspondence object
na_action : {None, 'ignore'}
If 'ignore', propagate NA values, without passing them to the
mapping functi... | pandas/core/base.py | _map_values | BryanRacic/pandas | python | @final
def _map_values(self, mapper, na_action=None):
"\n An internal function that maps values using the input\n correspondence (which can be a dict, Series, or function).\n\n Parameters\n ----------\n mapper : function, dict, or Series\n The input correspondence objec... |
def value_counts(self, normalize: bool=False, sort: bool=True, ascending: bool=False, bins=None, dropna: bool=True):
"\n Return a Series containing counts of unique values.\n\n The resulting object will be in descending order so that the\n first element is the most frequently-occurring element.... | 2,223,745,085,199,082,000 | Return a Series containing counts of unique values.
The resulting object will be in descending order so that the
first element is the most frequently-occurring element.
Excludes NA values by default.
Parameters
----------
normalize : bool, default False
If True then the object returned will contain the relative
... | pandas/core/base.py | value_counts | BryanRacic/pandas | python | def value_counts(self, normalize: bool=False, sort: bool=True, ascending: bool=False, bins=None, dropna: bool=True):
"\n Return a Series containing counts of unique values.\n\n The resulting object will be in descending order so that the\n first element is the most frequently-occurring element.... |
def nunique(self, dropna: bool=True) -> int:
"\n Return number of unique elements in the object.\n\n Excludes NA values by default.\n\n Parameters\n ----------\n dropna : bool, default True\n Don't include NaN in the count.\n\n Returns\n -------\n i... | 8,887,803,906,589,405,000 | Return number of unique elements in the object.
Excludes NA values by default.
Parameters
----------
dropna : bool, default True
Don't include NaN in the count.
Returns
-------
int
See Also
--------
DataFrame.nunique: Method nunique for DataFrame.
Series.count: Count non-NA/null observations in the Series.
Exa... | pandas/core/base.py | nunique | BryanRacic/pandas | python | def nunique(self, dropna: bool=True) -> int:
"\n Return number of unique elements in the object.\n\n Excludes NA values by default.\n\n Parameters\n ----------\n dropna : bool, default True\n Don't include NaN in the count.\n\n Returns\n -------\n i... |
@property
def is_unique(self) -> bool:
'\n Return boolean if values in the object are unique.\n\n Returns\n -------\n bool\n '
return (self.nunique(dropna=False) == len(self)) | -1,875,521,501,258,616,300 | Return boolean if values in the object are unique.
Returns
-------
bool | pandas/core/base.py | is_unique | BryanRacic/pandas | python | @property
def is_unique(self) -> bool:
'\n Return boolean if values in the object are unique.\n\n Returns\n -------\n bool\n '
return (self.nunique(dropna=False) == len(self)) |
@property
def is_monotonic(self) -> bool:
'\n Return boolean if values in the object are\n monotonic_increasing.\n\n Returns\n -------\n bool\n '
from pandas import Index
return Index(self).is_monotonic | -1,426,646,453,358,816,000 | Return boolean if values in the object are
monotonic_increasing.
Returns
-------
bool | pandas/core/base.py | is_monotonic | BryanRacic/pandas | python | @property
def is_monotonic(self) -> bool:
'\n Return boolean if values in the object are\n monotonic_increasing.\n\n Returns\n -------\n bool\n '
from pandas import Index
return Index(self).is_monotonic |
@property
def is_monotonic_increasing(self) -> bool:
'\n Alias for is_monotonic.\n '
return self.is_monotonic | 7,444,097,157,233,163,000 | Alias for is_monotonic. | pandas/core/base.py | is_monotonic_increasing | BryanRacic/pandas | python | @property
def is_monotonic_increasing(self) -> bool:
'\n \n '
return self.is_monotonic |
@property
def is_monotonic_decreasing(self) -> bool:
'\n Return boolean if values in the object are\n monotonic_decreasing.\n\n Returns\n -------\n bool\n '
from pandas import Index
return Index(self).is_monotonic_decreasing | -4,775,814,088,260,608,000 | Return boolean if values in the object are
monotonic_decreasing.
Returns
-------
bool | pandas/core/base.py | is_monotonic_decreasing | BryanRacic/pandas | python | @property
def is_monotonic_decreasing(self) -> bool:
'\n Return boolean if values in the object are\n monotonic_decreasing.\n\n Returns\n -------\n bool\n '
from pandas import Index
return Index(self).is_monotonic_decreasing |
def _memory_usage(self, deep: bool=False) -> int:
'\n Memory usage of the values.\n\n Parameters\n ----------\n deep : bool, default False\n Introspect the data deeply, interrogate\n `object` dtypes for system-level memory consumption.\n\n Returns\n --... | 2,268,990,164,839,207,200 | Memory usage of the values.
Parameters
----------
deep : bool, default False
Introspect the data deeply, interrogate
`object` dtypes for system-level memory consumption.
Returns
-------
bytes used
See Also
--------
numpy.ndarray.nbytes : Total bytes consumed by the elements of the
array.
Notes
-----
Mem... | pandas/core/base.py | _memory_usage | BryanRacic/pandas | python | def _memory_usage(self, deep: bool=False) -> int:
'\n Memory usage of the values.\n\n Parameters\n ----------\n deep : bool, default False\n Introspect the data deeply, interrogate\n `object` dtypes for system-level memory consumption.\n\n Returns\n --... |
def _construct_result(self, result, name):
'\n Construct an appropriately-wrapped result from the ArrayLike result\n of an arithmetic-like operation.\n '
raise AbstractMethodError(self) | 7,152,423,457,140,417,000 | Construct an appropriately-wrapped result from the ArrayLike result
of an arithmetic-like operation. | pandas/core/base.py | _construct_result | BryanRacic/pandas | python | def _construct_result(self, result, name):
'\n Construct an appropriately-wrapped result from the ArrayLike result\n of an arithmetic-like operation.\n '
raise AbstractMethodError(self) |
def test_random_grid_search_for_glm():
'\n Create and instantiate classes, call test methods to test randomize grid search for GLM Gaussian\n or Binomial families.\n\n :return: None\n '
test_glm_gaussian_random_grid = Test_glm_random_grid_search('gaussian')
test_glm_gaussian_random_grid.test1_gl... | -2,897,046,621,495,929,300 | Create and instantiate classes, call test methods to test randomize grid search for GLM Gaussian
or Binomial families.
:return: None | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | test_random_grid_search_for_glm | 13927729580/h2o-3 | python | def test_random_grid_search_for_glm():
'\n Create and instantiate classes, call test methods to test randomize grid search for GLM Gaussian\n or Binomial families.\n\n :return: None\n '
test_glm_gaussian_random_grid = Test_glm_random_grid_search('gaussian')
test_glm_gaussian_random_grid.test1_gl... |
def __init__(self, family):
'\n Constructor.\n\n :param family: distribution family for tests\n :return: None\n '
self.setup_data()
self.setup_grid_params() | 5,059,522,531,481,194,000 | Constructor.
:param family: distribution family for tests
:return: None | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | __init__ | 13927729580/h2o-3 | python | def __init__(self, family):
'\n Constructor.\n\n :param family: distribution family for tests\n :return: None\n '
self.setup_data()
self.setup_grid_params() |
def setup_data(self):
'\n This function performs all initializations necessary:\n load the data sets and set the training set indices and response column index\n '
self.sandbox_dir = pyunit_utils.make_Rsandbox_dir(self.current_dir, self.test_name, True)
self.training1_data = h2o.import_... | -6,597,030,469,623,763,000 | This function performs all initializations necessary:
load the data sets and set the training set indices and response column index | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | setup_data | 13927729580/h2o-3 | python | def setup_data(self):
'\n This function performs all initializations necessary:\n load the data sets and set the training set indices and response column index\n '
self.sandbox_dir = pyunit_utils.make_Rsandbox_dir(self.current_dir, self.test_name, True)
self.training1_data = h2o.import_... |
def setup_grid_params(self):
'\n This function setup the randomized gridsearch parameters that will be used later on:\n\n 1. It will first try to grab all the parameters that are griddable and parameters used by GLM.\n 2. It will find the intersection of parameters that are both griddable and u... | 8,059,243,211,549,357,000 | This function setup the randomized gridsearch parameters that will be used later on:
1. It will first try to grab all the parameters that are griddable and parameters used by GLM.
2. It will find the intersection of parameters that are both griddable and used by GLM.
3. There are several extra parameters that are used... | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | setup_grid_params | 13927729580/h2o-3 | python | def setup_grid_params(self):
'\n This function setup the randomized gridsearch parameters that will be used later on:\n\n 1. It will first try to grab all the parameters that are griddable and parameters used by GLM.\n 2. It will find the intersection of parameters that are both griddable and u... |
def tear_down(self):
'\n This function performs teardown after the dynamic test is completed. If all tests\n passed, it will delete all data sets generated since they can be quite large. It\n will move the training/validation/test data sets into a Rsandbox directory so that\n we can re... | 551,565,696,271,934,300 | This function performs teardown after the dynamic test is completed. If all tests
passed, it will delete all data sets generated since they can be quite large. It
will move the training/validation/test data sets into a Rsandbox directory so that
we can re-run the failed test. | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | tear_down | 13927729580/h2o-3 | python | def tear_down(self):
'\n This function performs teardown after the dynamic test is completed. If all tests\n passed, it will delete all data sets generated since they can be quite large. It\n will move the training/validation/test data sets into a Rsandbox directory so that\n we can re... |
def test1_glm_random_grid_search_model_number(self, metric_name):
'\n This test is used to make sure the randomized gridsearch will generate all models specified in the\n hyperparameters if no stopping condition is given in the search criterion.\n\n :param metric_name: string to denote what gri... | 1,333,334,887,265,819,400 | This test is used to make sure the randomized gridsearch will generate all models specified in the
hyperparameters if no stopping condition is given in the search criterion.
:param metric_name: string to denote what grid search model should be sort by
:return: None | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | test1_glm_random_grid_search_model_number | 13927729580/h2o-3 | python | def test1_glm_random_grid_search_model_number(self, metric_name):
'\n This test is used to make sure the randomized gridsearch will generate all models specified in the\n hyperparameters if no stopping condition is given in the search criterion.\n\n :param metric_name: string to denote what gri... |
def test2_glm_random_grid_search_max_model(self):
'\n This test is used to test the stopping condition max_model_number in the randomized gridsearch. The\n max_models parameter is randomly generated. If it is higher than the actual possible number of models\n that can be generated with the cu... | 3,782,168,255,454,180,400 | This test is used to test the stopping condition max_model_number in the randomized gridsearch. The
max_models parameter is randomly generated. If it is higher than the actual possible number of models
that can be generated with the current hyper-space parameters, randomized grid search should generate
all the models... | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | test2_glm_random_grid_search_max_model | 13927729580/h2o-3 | python | def test2_glm_random_grid_search_max_model(self):
'\n This test is used to test the stopping condition max_model_number in the randomized gridsearch. The\n max_models parameter is randomly generated. If it is higher than the actual possible number of models\n that can be generated with the cu... |
def test3_glm_random_grid_search_max_runtime_secs(self):
'\n This function will test the stopping criteria max_runtime_secs. For each model built, the field\n run_time actually denote the time in ms used to build the model. We will add up the run_time from all\n models and check against the s... | 6,804,544,480,565,740,000 | This function will test the stopping criteria max_runtime_secs. For each model built, the field
run_time actually denote the time in ms used to build the model. We will add up the run_time from all
models and check against the stopping criteria max_runtime_secs. Since each model will check its run time
differently, ... | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | test3_glm_random_grid_search_max_runtime_secs | 13927729580/h2o-3 | python | def test3_glm_random_grid_search_max_runtime_secs(self):
'\n This function will test the stopping criteria max_runtime_secs. For each model built, the field\n run_time actually denote the time in ms used to build the model. We will add up the run_time from all\n models and check against the s... |
def test4_glm_random_grid_search_metric(self, metric_name, bigger_is_better):
'\n This function will test the last stopping condition using metrics.\n\n :param metric_name: metric we want to use to test the last stopping condition\n :param bigger_is_better: higher metric value indicates better ... | -2,631,604,389,071,402,500 | This function will test the last stopping condition using metrics.
:param metric_name: metric we want to use to test the last stopping condition
:param bigger_is_better: higher metric value indicates better model performance
:return: None | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | test4_glm_random_grid_search_metric | 13927729580/h2o-3 | python | def test4_glm_random_grid_search_metric(self, metric_name, bigger_is_better):
'\n This function will test the last stopping condition using metrics.\n\n :param metric_name: metric we want to use to test the last stopping condition\n :param bigger_is_better: higher metric value indicates better ... |
def expect_cpp_code_generic_compile_error(expected_error_regex, tmppy_source, module_ir2, module_ir1, cxx_source):
"\n Tests that the given source produces the expected error during compilation.\n\n :param expected_error_regex: A regex used to match the _py2tmp error type,\n e.g. 'NoBindingFoundForA... | -7,943,035,485,855,268,000 | Tests that the given source produces the expected error during compilation.
:param expected_error_regex: A regex used to match the _py2tmp error type,
e.g. 'NoBindingFoundForAbstractClassError<ScalerImpl>'.
:param cxx_source: The second part of the source code. This will be dedented. | _py2tmp/testing/utils.py | expect_cpp_code_generic_compile_error | DalavanCloud/tmppy | python | def expect_cpp_code_generic_compile_error(expected_error_regex, tmppy_source, module_ir2, module_ir1, cxx_source):
"\n Tests that the given source produces the expected error during compilation.\n\n :param expected_error_regex: A regex used to match the _py2tmp error type,\n e.g. 'NoBindingFoundForA... |
def expect_cpp_code_compile_error(expected_py2tmp_error_regex, expected_py2tmp_error_desc_regex, tmppy_source, module_ir2, module_ir1, cxx_source):
"\n Tests that the given source produces the expected error during compilation.\n\n :param expected_py2tmp_error_regex: A regex used to match the _py2tmp error ty... | -3,876,706,337,203,248,600 | Tests that the given source produces the expected error during compilation.
:param expected_py2tmp_error_regex: A regex used to match the _py2tmp error type,
e.g. 'NoBindingFoundForAbstractClassError<ScalerImpl>'.
:param expected_py2tmp_error_desc_regex: A regex used to match the _py2tmp error description,
... | _py2tmp/testing/utils.py | expect_cpp_code_compile_error | DalavanCloud/tmppy | python | def expect_cpp_code_compile_error(expected_py2tmp_error_regex, expected_py2tmp_error_desc_regex, tmppy_source, module_ir2, module_ir1, cxx_source):
"\n Tests that the given source produces the expected error during compilation.\n\n :param expected_py2tmp_error_regex: A regex used to match the _py2tmp error ty... |
def expect_cpp_code_success(tmppy_source, module_ir2, module_ir1, cxx_source):
'\n Tests that the given source compiles and runs successfully.\n\n :param source_code: The C++ source code. This will be dedented.\n '
if ('main(' not in cxx_source):
cxx_source += textwrap.dedent('\n int... | 3,384,454,379,031,476,700 | Tests that the given source compiles and runs successfully.
:param source_code: The C++ source code. This will be dedented. | _py2tmp/testing/utils.py | expect_cpp_code_success | DalavanCloud/tmppy | python | def expect_cpp_code_success(tmppy_source, module_ir2, module_ir1, cxx_source):
'\n Tests that the given source compiles and runs successfully.\n\n :param source_code: The C++ source code. This will be dedented.\n '
if ('main(' not in cxx_source):
cxx_source += textwrap.dedent('\n int... |
def test_commit(shared_instance, dbapi_database):
'Test committing a transaction with several statements.'
want_row = (1, 'updated-first-name', 'last-name', 'example@example.com')
conn = Connection(shared_instance, dbapi_database)
cursor = conn.cursor()
cursor.execute("\nINSERT INTO contacts (contac... | 8,524,424,343,788,117,000 | Test committing a transaction with several statements. | tests/system/test_dbapi.py | test_commit | jpburbank/python-spanner | python | def test_commit(shared_instance, dbapi_database):
want_row = (1, 'updated-first-name', 'last-name', 'example@example.com')
conn = Connection(shared_instance, dbapi_database)
cursor = conn.cursor()
cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVALUES (1, 'first-n... |
def test_rollback(shared_instance, dbapi_database):
'Test rollbacking a transaction with several statements.'
want_row = (2, 'first-name', 'last-name', 'example@example.com')
conn = Connection(shared_instance, dbapi_database)
cursor = conn.cursor()
cursor.execute("\nINSERT INTO contacts (contact_id,... | 787,733,936,744,369,300 | Test rollbacking a transaction with several statements. | tests/system/test_dbapi.py | test_rollback | jpburbank/python-spanner | python | def test_rollback(shared_instance, dbapi_database):
want_row = (2, 'first-name', 'last-name', 'example@example.com')
conn = Connection(shared_instance, dbapi_database)
cursor = conn.cursor()
cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVALUES (2, 'first-name', ... |
def test_autocommit_mode_change(shared_instance, dbapi_database):
'Test auto committing a transaction on `autocommit` mode change.'
want_row = (2, 'updated-first-name', 'last-name', 'example@example.com')
conn = Connection(shared_instance, dbapi_database)
cursor = conn.cursor()
cursor.execute("\nINS... | -5,353,696,721,925,448,000 | Test auto committing a transaction on `autocommit` mode change. | tests/system/test_dbapi.py | test_autocommit_mode_change | jpburbank/python-spanner | python | def test_autocommit_mode_change(shared_instance, dbapi_database):
want_row = (2, 'updated-first-name', 'last-name', 'example@example.com')
conn = Connection(shared_instance, dbapi_database)
cursor = conn.cursor()
cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVAL... |
def test_rollback_on_connection_closing(shared_instance, dbapi_database):
"\n When closing a connection all the pending transactions\n must be rollbacked. Testing if it's working this way.\n "
want_row = (1, 'first-name', 'last-name', 'example@example.com')
conn = Connection(shared_instance, dbapi_... | -7,109,604,337,055,367,000 | When closing a connection all the pending transactions
must be rollbacked. Testing if it's working this way. | tests/system/test_dbapi.py | test_rollback_on_connection_closing | jpburbank/python-spanner | python | def test_rollback_on_connection_closing(shared_instance, dbapi_database):
"\n When closing a connection all the pending transactions\n must be rollbacked. Testing if it's working this way.\n "
want_row = (1, 'first-name', 'last-name', 'example@example.com')
conn = Connection(shared_instance, dbapi_... |
def test_results_checksum(shared_instance, dbapi_database):
'Test that results checksum is calculated properly.'
conn = Connection(shared_instance, dbapi_database)
cursor = conn.cursor()
cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVALUES\n(1, 'first-name', 'last-na... | 3,821,948,948,630,807,600 | Test that results checksum is calculated properly. | tests/system/test_dbapi.py | test_results_checksum | jpburbank/python-spanner | python | def test_results_checksum(shared_instance, dbapi_database):
conn = Connection(shared_instance, dbapi_database)
cursor = conn.cursor()
cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVALUES\n(1, 'first-name', 'last-name', 'example@example.com'),\n(2, 'first-name2', 'la... |
def test_DDL_autocommit(shared_instance, dbapi_database):
'Check that DDLs in autocommit mode are immediately executed.'
conn = Connection(shared_instance, dbapi_database)
conn.autocommit = True
cur = conn.cursor()
cur.execute('\n CREATE TABLE Singers (\n SingerId INT64 NOT NUL... | 7,331,400,359,012,387,000 | Check that DDLs in autocommit mode are immediately executed. | tests/system/test_dbapi.py | test_DDL_autocommit | jpburbank/python-spanner | python | def test_DDL_autocommit(shared_instance, dbapi_database):
conn = Connection(shared_instance, dbapi_database)
conn.autocommit = True
cur = conn.cursor()
cur.execute('\n CREATE TABLE Singers (\n SingerId INT64 NOT NULL,\n Name STRING(1024),\n ) PRIMARY KEY (... |
def test_DDL_commit(shared_instance, dbapi_database):
'Check that DDLs in commit mode are executed on calling `commit()`.'
conn = Connection(shared_instance, dbapi_database)
cur = conn.cursor()
cur.execute('\n CREATE TABLE Singers (\n SingerId INT64 NOT NULL,\n Name STRING(1024),... | 3,273,943,874,377,342,000 | Check that DDLs in commit mode are executed on calling `commit()`. | tests/system/test_dbapi.py | test_DDL_commit | jpburbank/python-spanner | python | def test_DDL_commit(shared_instance, dbapi_database):
conn = Connection(shared_instance, dbapi_database)
cur = conn.cursor()
cur.execute('\n CREATE TABLE Singers (\n SingerId INT64 NOT NULL,\n Name STRING(1024),\n ) PRIMARY KEY (SingerId)\n ')
conn.commit()
conn.cl... |
def test_ping(shared_instance, dbapi_database):
'Check connection validation method.'
conn = Connection(shared_instance, dbapi_database)
conn.validate()
conn.close() | 427,163,684,188,578,200 | Check connection validation method. | tests/system/test_dbapi.py | test_ping | jpburbank/python-spanner | python | def test_ping(shared_instance, dbapi_database):
conn = Connection(shared_instance, dbapi_database)
conn.validate()
conn.close() |
def _last_stack_str():
"Print stack trace from call that didn't originate from here"
stack = extract_stack()
for s in stack[::(- 1)]:
if (op.join('vispy', 'gloo', 'buffer.py') not in __file__):
break
return format_list([s])[0] | 615,006,874,114,146,700 | Print stack trace from call that didn't originate from here | vispy/gloo/buffer.py | _last_stack_str | CVandML/vispy | python | def _last_stack_str():
stack = extract_stack()
for s in stack[::(- 1)]:
if (op.join('vispy', 'gloo', 'buffer.py') not in __file__):
break
return format_list([s])[0] |
@property
def nbytes(self):
' Buffer size in bytes '
return self._nbytes | -2,619,702,808,926,269,000 | Buffer size in bytes | vispy/gloo/buffer.py | nbytes | CVandML/vispy | python | @property
def nbytes(self):
' '
return self._nbytes |
def set_subdata(self, data, offset=0, copy=False):
' Set a sub-region of the buffer (deferred operation).\n\n Parameters\n ----------\n\n data : ndarray\n Data to be uploaded\n offset: int\n Offset in buffer where to start copying data (in bytes)\n copy: bool... | -5,062,661,572,289,726,000 | Set a sub-region of the buffer (deferred operation).
Parameters
----------
data : ndarray
Data to be uploaded
offset: int
Offset in buffer where to start copying data (in bytes)
copy: bool
Since the operation is deferred, data may change before
data is actually uploaded to GPU memory.
Asking expli... | vispy/gloo/buffer.py | set_subdata | CVandML/vispy | python | def set_subdata(self, data, offset=0, copy=False):
' Set a sub-region of the buffer (deferred operation).\n\n Parameters\n ----------\n\n data : ndarray\n Data to be uploaded\n offset: int\n Offset in buffer where to start copying data (in bytes)\n copy: bool... |
def set_data(self, data, copy=False):
' Set data in the buffer (deferred operation).\n\n This completely resets the size and contents of the buffer.\n\n Parameters\n ----------\n data : ndarray\n Data to be uploaded\n copy: bool\n Since the operation is defer... | 768,647,042,963,925,500 | Set data in the buffer (deferred operation).
This completely resets the size and contents of the buffer.
Parameters
----------
data : ndarray
Data to be uploaded
copy: bool
Since the operation is deferred, data may change before
data is actually uploaded to GPU memory.
Asking explicitly for a copy wil... | vispy/gloo/buffer.py | set_data | CVandML/vispy | python | def set_data(self, data, copy=False):
' Set data in the buffer (deferred operation).\n\n This completely resets the size and contents of the buffer.\n\n Parameters\n ----------\n data : ndarray\n Data to be uploaded\n copy: bool\n Since the operation is defer... |
def resize_bytes(self, size):
' Resize this buffer (deferred operation). \n \n Parameters\n ----------\n size : int\n New buffer size in bytes.\n '
self._nbytes = size
self._glir.command('SIZE', self._id, size)
for view in self._views:
if (view() is ... | -7,041,053,181,543,419,000 | Resize this buffer (deferred operation).
Parameters
----------
size : int
New buffer size in bytes. | vispy/gloo/buffer.py | resize_bytes | CVandML/vispy | python | def resize_bytes(self, size):
' Resize this buffer (deferred operation). \n \n Parameters\n ----------\n size : int\n New buffer size in bytes.\n '
self._nbytes = size
self._glir.command('SIZE', self._id, size)
for view in self._views:
if (view() is ... |
def set_subdata(self, data, offset=0, copy=False, **kwargs):
' Set a sub-region of the buffer (deferred operation).\n\n Parameters\n ----------\n\n data : ndarray\n Data to be uploaded\n offset: int\n Offset in buffer where to start copying data (in bytes)\n ... | 2,903,474,374,651,890,700 | Set a sub-region of the buffer (deferred operation).
Parameters
----------
data : ndarray
Data to be uploaded
offset: int
Offset in buffer where to start copying data (in bytes)
copy: bool
Since the operation is deferred, data may change before
data is actually uploaded to GPU memory.
Asking expli... | vispy/gloo/buffer.py | set_subdata | CVandML/vispy | python | def set_subdata(self, data, offset=0, copy=False, **kwargs):
' Set a sub-region of the buffer (deferred operation).\n\n Parameters\n ----------\n\n data : ndarray\n Data to be uploaded\n offset: int\n Offset in buffer where to start copying data (in bytes)\n ... |
def set_data(self, data, copy=False, **kwargs):
' Set data (deferred operation)\n\n Parameters\n ----------\n data : ndarray\n Data to be uploaded\n copy: bool\n Since the operation is deferred, data may change before\n data is actually uploaded to GPU me... | 2,841,027,101,147,999,000 | Set data (deferred operation)
Parameters
----------
data : ndarray
Data to be uploaded
copy: bool
Since the operation is deferred, data may change before
data is actually uploaded to GPU memory.
Asking explicitly for a copy will prevent this behavior.
**kwargs : dict
Additional arguments. | vispy/gloo/buffer.py | set_data | CVandML/vispy | python | def set_data(self, data, copy=False, **kwargs):
' Set data (deferred operation)\n\n Parameters\n ----------\n data : ndarray\n Data to be uploaded\n copy: bool\n Since the operation is deferred, data may change before\n data is actually uploaded to GPU me... |
@property
def dtype(self):
' Buffer dtype '
return self._dtype | 4,078,825,277,664,268,000 | Buffer dtype | vispy/gloo/buffer.py | dtype | CVandML/vispy | python | @property
def dtype(self):
' '
return self._dtype |
@property
def offset(self):
' Buffer offset (in bytes) relative to base '
return 0 | 8,895,473,055,360,589,000 | Buffer offset (in bytes) relative to base | vispy/gloo/buffer.py | offset | CVandML/vispy | python | @property
def offset(self):
' '
return 0 |
@property
def stride(self):
' Stride of data in memory '
return self._stride | 4,803,607,196,136,743,000 | Stride of data in memory | vispy/gloo/buffer.py | stride | CVandML/vispy | python | @property
def stride(self):
' '
return self._stride |
@property
def size(self):
' Number of elements in the buffer '
return self._size | -2,399,418,111,054,706,700 | Number of elements in the buffer | vispy/gloo/buffer.py | size | CVandML/vispy | python | @property
def size(self):
' '
return self._size |
@property
def itemsize(self):
' The total number of bytes required to store the array data '
return self._itemsize | 2,928,576,800,103,052,000 | The total number of bytes required to store the array data | vispy/gloo/buffer.py | itemsize | CVandML/vispy | python | @property
def itemsize(self):
' '
return self._itemsize |
@property
def glsl_type(self):
' GLSL declaration strings required for a variable to hold this data.\n '
if (self.dtype is None):
return None
dtshape = self.dtype[0].shape
n = (dtshape[0] if dtshape else 1)
if (n > 1):
dtype = ('vec%d' % n)
else:
dtype = ('float' i... | 6,848,344,529,212,954,000 | GLSL declaration strings required for a variable to hold this data. | vispy/gloo/buffer.py | glsl_type | CVandML/vispy | python | @property
def glsl_type(self):
' \n '
if (self.dtype is None):
return None
dtshape = self.dtype[0].shape
n = (dtshape[0] if dtshape else 1)
if (n > 1):
dtype = ('vec%d' % n)
else:
dtype = ('float' if ('f' in self.dtype[0].base.kind) else 'int')
return ('attribu... |
def resize_bytes(self, size):
' Resize the buffer (in-place, deferred operation)\n\n Parameters\n ----------\n size : integer\n New buffer size in bytes\n\n Notes\n -----\n This clears any pending operations.\n '
Buffer.resize_bytes(self, size)
sel... | 3,280,132,657,365,361,700 | Resize the buffer (in-place, deferred operation)
Parameters
----------
size : integer
New buffer size in bytes
Notes
-----
This clears any pending operations. | vispy/gloo/buffer.py | resize_bytes | CVandML/vispy | python | def resize_bytes(self, size):
' Resize the buffer (in-place, deferred operation)\n\n Parameters\n ----------\n size : integer\n New buffer size in bytes\n\n Notes\n -----\n This clears any pending operations.\n '
Buffer.resize_bytes(self, size)
sel... |
def __getitem__(self, key):
' Create a view on this buffer. '
view = DataBufferView(self, key)
self._views.append(weakref.ref(view))
return view | -1,744,978,608,335,112,700 | Create a view on this buffer. | vispy/gloo/buffer.py | __getitem__ | CVandML/vispy | python | def __getitem__(self, key):
' '
view = DataBufferView(self, key)
self._views.append(weakref.ref(view))
return view |
def __setitem__(self, key, data):
' Set data (deferred operation) '
if isinstance(key, string_types):
raise ValueError('Cannot set non-contiguous data on buffer')
elif isinstance(key, int):
if (key < 0):
key += self.size
if ((key < 0) or (key > self.size)):
ra... | -7,364,368,203,983,513,000 | Set data (deferred operation) | vispy/gloo/buffer.py | __setitem__ | CVandML/vispy | python | def __setitem__(self, key, data):
' '
if isinstance(key, string_types):
raise ValueError('Cannot set non-contiguous data on buffer')
elif isinstance(key, int):
if (key < 0):
key += self.size
if ((key < 0) or (key > self.size)):
raise IndexError('Buffer assign... |
@property
def offset(self):
' Buffer offset (in bytes) relative to base '
return self._offset | 8,690,617,661,463,767,000 | Buffer offset (in bytes) relative to base | vispy/gloo/buffer.py | offset | CVandML/vispy | python | @property
def offset(self):
' '
return self._offset |
@property
def base(self):
'Buffer base if this buffer is a view on another buffer. '
return self._base | 5,915,824,618,440,580,000 | Buffer base if this buffer is a view on another buffer. | vispy/gloo/buffer.py | base | CVandML/vispy | python | @property
def base(self):
' '
return self._base |
def start():
'\n This function is run once every time the start button is pressed\n '
global max_speed
global show_triggers
global show_joysticks
print('Start function called')
rc.set_update_slow_time(0.5)
rc.drive.stop()
max_speed = 0.25
show_triggers = False
show_joystick... | -7,655,744,681,631,914,000 | This function is run once every time the start button is pressed | labs/test_utils.py | start | MITLLRacecar/racecar-allison-aj | python | def start():
'\n \n '
global max_speed
global show_triggers
global show_joysticks
print('Start function called')
rc.set_update_slow_time(0.5)
rc.drive.stop()
max_speed = 0.25
show_triggers = False
show_joysticks = False
assert (rc_utils.remap_range(5, 0, 10, 0, 50) == 2... |
def update():
'\n After start() is run, this function is run every frame until the back button\n is pressed\n '
if rc.controller.was_pressed(rc.controller.Button.A):
image = rc.camera.get_color_image()
cropped = rc_utils.crop(image, (0, 0), ((rc.camera.get_height() // 2), (rc.camera.get... | 5,690,716,355,874,481,000 | After start() is run, this function is run every frame until the back button
is pressed | labs/test_utils.py | update | MITLLRacecar/racecar-allison-aj | python | def update():
'\n After start() is run, this function is run every frame until the back button\n is pressed\n '
if rc.controller.was_pressed(rc.controller.Button.A):
image = rc.camera.get_color_image()
cropped = rc_utils.crop(image, (0, 0), ((rc.camera.get_height() // 2), (rc.camera.get... |
def shrink(coords: np.ndarray, dist: np.ndarray) -> tuple[np.ndarray]:
'Shrinks a 2D polygon by a given distance.\n\n The coordinates of the polygon are expected as an N x 2-matrix,\n and a positive distance results in inward shrinking.\n \n An empty set is returned if the shrinking operation removes al... | 9,125,759,857,284,818,000 | Shrinks a 2D polygon by a given distance.
The coordinates of the polygon are expected as an N x 2-matrix,
and a positive distance results in inward shrinking.
An empty set is returned if the shrinking operation removes all
original elements.
Args:
coords: A matrix of coordinates.
dist: The distance to shrink... | geometry_tools.py | shrink | helkebir/Reachable-Set-Inner-Approximation | python | def shrink(coords: np.ndarray, dist: np.ndarray) -> tuple[np.ndarray]:
'Shrinks a 2D polygon by a given distance.\n\n The coordinates of the polygon are expected as an N x 2-matrix,\n and a positive distance results in inward shrinking.\n \n An empty set is returned if the shrinking operation removes al... |
def hausdorff(A: np.ndarray, B: np.ndarray) -> float:
'Computes the Hausdorff distance between two 2D polygons.\n\n Args:\n A: A matrix defining the first polygon.\n B: A matrix defining the second polygon.\n \n Returns:\n A float representing the Hausdorff distance.\n '
return ... | 5,987,260,360,704,853,000 | Computes the Hausdorff distance between two 2D polygons.
Args:
A: A matrix defining the first polygon.
B: A matrix defining the second polygon.
Returns:
A float representing the Hausdorff distance. | geometry_tools.py | hausdorff | helkebir/Reachable-Set-Inner-Approximation | python | def hausdorff(A: np.ndarray, B: np.ndarray) -> float:
'Computes the Hausdorff distance between two 2D polygons.\n\n Args:\n A: A matrix defining the first polygon.\n B: A matrix defining the second polygon.\n \n Returns:\n A float representing the Hausdorff distance.\n '
return ... |
def read_polygon(file: str) -> np.ndarray:
'Reads a polygon from a table.\n\n Args:\n file: Path to a file containing a plain text, tab-separated\n table with scalars.\n \n Returns:\n A matrix containing the data in the file.\n '
return np.genfromtxt(file) | 2,876,362,114,396,736,500 | Reads a polygon from a table.
Args:
file: Path to a file containing a plain text, tab-separated
table with scalars.
Returns:
A matrix containing the data in the file. | geometry_tools.py | read_polygon | helkebir/Reachable-Set-Inner-Approximation | python | def read_polygon(file: str) -> np.ndarray:
'Reads a polygon from a table.\n\n Args:\n file: Path to a file containing a plain text, tab-separated\n table with scalars.\n \n Returns:\n A matrix containing the data in the file.\n '
return np.genfromtxt(file) |
def deserialize_args(args):
'Try to deserialize given args. Return input if not serialized'
deserialized = parse_qs(args)
if (deserialized == {}):
return args
else:
return deserialized | 5,916,436,655,583,058,000 | Try to deserialize given args. Return input if not serialized | dartui/utils.py | deserialize_args | cjlucas/DarTui | python | def deserialize_args(args):
deserialized = parse_qs(args)
if (deserialized == {}):
return args
else:
return deserialized |
def get_disk_usage(path):
"Return disk usage statistics about the given path.\n\n Returned valus is a named tuple with attributes 'total', 'used' and\n 'free', which are the amount of total, used and free space, in bytes.\n \n Source: http://stackoverflow.com/a/7285483/975118\n "
st = os.statvfs(... | -6,989,553,908,795,418,000 | Return disk usage statistics about the given path.
Returned valus is a named tuple with attributes 'total', 'used' and
'free', which are the amount of total, used and free space, in bytes.
Source: http://stackoverflow.com/a/7285483/975118 | dartui/utils.py | get_disk_usage | cjlucas/DarTui | python | def get_disk_usage(path):
"Return disk usage statistics about the given path.\n\n Returned valus is a named tuple with attributes 'total', 'used' and\n 'free', which are the amount of total, used and free space, in bytes.\n \n Source: http://stackoverflow.com/a/7285483/975118\n "
st = os.statvfs(... |
def get_torrent_files(f):
'\n Input:\n f -- cgi.FileStorage object \n Returns:\n torrent_files -- a list of TorrentFile objects\n '
torrent_files = []
if f.filename.lower().endswith('.zip'):
z = zipfile.ZipFile(f.file)
torrent_files = [TorrentFile(name=zi.filename, data=... | -3,494,092,591,716,452,000 | Input:
f -- cgi.FileStorage object
Returns:
torrent_files -- a list of TorrentFile objects | dartui/utils.py | get_torrent_files | cjlucas/DarTui | python | def get_torrent_files(f):
'\n Input:\n f -- cgi.FileStorage object \n Returns:\n torrent_files -- a list of TorrentFile objects\n '
torrent_files = []
if f.filename.lower().endswith('.zip'):
z = zipfile.ZipFile(f.file)
torrent_files = [TorrentFile(name=zi.filename, data=... |
def __init__(self, value=None, defaultFormat='%a[SHORT], %d %b[SHORT] %Y %H:%M:%S %Z'):
' The value should be in the LOCAL timezone.\n\t\t'
self.ourValue = value
self.defaultFormat = defaultFormat | -1,599,152,371,501,616,000 | The value should be in the LOCAL timezone. | lib/pubtal/DateContext.py | __init__ | owlfish/pubtal | python | def __init__(self, value=None, defaultFormat='%a[SHORT], %d %b[SHORT] %Y %H:%M:%S %Z'):
' \n\t\t'
self.ourValue = value
self.defaultFormat = defaultFormat |
def setUp(self):
'set up the test\n '
pymel.core.newFile(force=True)
self.sm = pymel.core.PyNode('sequenceManager1') | -1,835,430,997,191,037,400 | set up the test | tests/previs/test_sequence_manager_extension.py | setUp | Khosiyat/anima | python | def setUp(self):
'\n '
pymel.core.newFile(force=True)
self.sm = pymel.core.PyNode('sequenceManager1') |
def test_from_xml_path_argument_skipped(self):
'testing if a TypeError will be raised when the path argument is\n skipped\n '
sm = pymel.core.PyNode('sequenceManager1')
with self.assertRaises(TypeError) as cm:
sm.from_xml()
self.assertEqual(cm.exception.message, 'from_xml() takes e... | -9,032,480,269,813,086,000 | testing if a TypeError will be raised when the path argument is
skipped | tests/previs/test_sequence_manager_extension.py | test_from_xml_path_argument_skipped | Khosiyat/anima | python | def test_from_xml_path_argument_skipped(self):
'testing if a TypeError will be raised when the path argument is\n skipped\n '
sm = pymel.core.PyNode('sequenceManager1')
with self.assertRaises(TypeError) as cm:
sm.from_xml()
self.assertEqual(cm.exception.message, 'from_xml() takes e... |
def test_from_xml_path_argument_is_not_a_string(self):
'testing if a TypeError will be raised when the path argument is not\n a string\n '
sm = pymel.core.PyNode('sequenceManager1')
with self.assertRaises(TypeError) as cm:
sm.from_xml(30)
self.assertEqual(cm.exception.message, 'pat... | 2,190,324,599,069,293,000 | testing if a TypeError will be raised when the path argument is not
a string | tests/previs/test_sequence_manager_extension.py | test_from_xml_path_argument_is_not_a_string | Khosiyat/anima | python | def test_from_xml_path_argument_is_not_a_string(self):
'testing if a TypeError will be raised when the path argument is not\n a string\n '
sm = pymel.core.PyNode('sequenceManager1')
with self.assertRaises(TypeError) as cm:
sm.from_xml(30)
self.assertEqual(cm.exception.message, 'pat... |
def test_from_xml_path_argument_is_not_a_valid_path(self):
'testing if a IOError will be raised when the path argument is not\n a valid path\n '
sm = pymel.core.PyNode('sequenceManager1')
with self.assertRaises(IOError) as cm:
sm.from_xml('not a valid path')
self.assertEqual(cm.exc... | 1,832,061,779,750,431,200 | testing if a IOError will be raised when the path argument is not
a valid path | tests/previs/test_sequence_manager_extension.py | test_from_xml_path_argument_is_not_a_valid_path | Khosiyat/anima | python | def test_from_xml_path_argument_is_not_a_valid_path(self):
'testing if a IOError will be raised when the path argument is not\n a valid path\n '
sm = pymel.core.PyNode('sequenceManager1')
with self.assertRaises(IOError) as cm:
sm.from_xml('not a valid path')
self.assertEqual(cm.exc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.