Skip to content

dhp252/useful_decorators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A collection of updated useful & common decorators

List of decorators:

  • @chdir_back_and_forth : Temporarily change dir to path in the function, then return back to the original cwd.
  • @timing() or @Timing() : Print out the running time of the function, support repeated run.
  • @deprecated() : Raise exception or print out the deprecated warning for the function.
  • @pass_except() : Ignore exceptions raised in the function.
  • @repeat() : Repeat a function n times.
  • @slow_down() : Pause/sleep/delay in specified seconds after the function is finished.
  • @retry() : Allow function to have n time errors.
  • @limit_run() : Raise RuntimeError if a function run exceeds n times.
  • @timeout() : Raise RuntimeError if a function run exceeds an time interval.
  • @override_args() : Override default keyword arguments of the function.
  • @force_input_arg() : Raise TypeError if kwargs_to_force is not passed in to function as kwargs.
  • @accepts() : Checks decorated function's arguments are of the expected types.
  • @returns() : Checks decorated function's return value is of the expected type.
  • @wip_warning() : Print or raise WorkInProcessWarning exception if the function is called.

About

A collection of updated useful & common decorators

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages