swimlane.utils package¶
Utility functions
- swimlane.utils.get_recursive_subclasses(cls)[source]¶
Return list of all subclasses for a class, including subclasses of direct subclasses
- swimlane.utils.import_submodules(package)[source]¶
Return list of imported module instances from beneath root_package
- swimlane.utils.one_of_keyword_only(*valid_keywords)[source]¶
Decorator to help make one-and-only-one keyword-only argument functions more reusable
Notes
Decorated function should take 2 arguments, the first for the key, the second the value
Examples
@one_of_keyword_only('a', 'b', 'c') def func(key, value): if key == 'a': ... elif key == 'b': ... else: # key = 'c' ... ... func(a=1) func(b=2) func(c=3) try: func(d=4) except TypeError: ... try: func(a=1, b=2) except TypeError: ...
- swimlane.utils.random_string(length, source='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')[source]¶
Return random string of characters from source of specified length
- swimlane.utils.validate_type(field, value)[source]¶
Type validation for filters and fields from bulk_modify, bulk_delete and filter