python
New in version 1.1.0.
Python utilities, like finding and loading modules
-
smisk.util.python.classmethods(cls)
List names of all class methods in class cls.
-
smisk.util.python.find_closest_syspath(path, namebuf)
- TODO
-
smisk.util.python.find_modules_for_classtree(cls, exclude_root=True, unique=True)
Returns a list of all modules in which cls and any subclasses are defined.
-
smisk.util.python.format_exc(exc=None, as_string=False)
-
-
smisk.util.python.list_python_filenames_in_dir(path, only_py=True)
-
-
smisk.util.python.load_modules(path, deep=False, skip_first_init=True, libdir=None, parent_name=None)
Import all modules in a directory.
Deprecated in version 1.1.1: This function will be removed in future versions.
Parameters: |
- path (string) – Path of a directory
- deep (bool) – Search subdirectories
- skip_first_init (bool) – Do not load any __init__ directly under path.
Note that if deep is True,
subdirectory/__init__ will still be loaded,
even if skip_first_init is True.
|
Returns: | A dictionary of modules imported, keyed by name.
|
Return type: | dict
|
-
smisk.util.python.unique_sorted_modules_of_items(v)
-
-
smisk.util.python.wrap_exc_in_callable(exc)
Wrap exc in a anonymous function, for later raising.