jsonextended.utils module¶
-
jsonextended.utils.
class_to_str
(obj)[source]¶ get class string from object
Examples
>>> class_to_str(list).split('.')[1] 'list'
-
jsonextended.utils.
get_data_path
(data, module, check_exists=True)[source]¶ return a directory path to data within a module
Parameters: data (str or list[str]) – file name or list of sub-directories and file name (e.g. [‘lammps’,’data.txt’])
-
jsonextended.utils.
get_test_path
()[source]¶ returns test path object
Examples
>>> path = get_test_path() >>> path.name '_example_data_folder'
-
jsonextended.utils.
load_memit
()[source]¶ load memory usage ipython magic, require memory_profiler package to be installed
to get usage: %memit?
Author: Vlad Niculae <vlad@vene.ro> Makes use of memory_profiler from Fabian Pedregosa available at https://github.com/fabianp/memory_profiler
-
jsonextended.utils.
memory_usage
()[source]¶ return memory usage of python process in MB
from http://fa.bianp.net/blog/2013/different-ways-to-get-memory-consumption-or-lessons-learned-from-memory_profiler/ psutil is quicker
>>> isinstance(memory_usage(),float) True