https://github.com/grgomariani/python-decorators
A list of useful python decorators
https://github.com/grgomariani/python-decorators
bdd console debug decorator dfa python-decorators
Last synced: about 15 hours ago
JSON representation
A list of useful python decorators
- Host: GitHub
- URL: https://github.com/grgomariani/python-decorators
- Owner: GrgoMariani
- License: gpl-3.0
- Created: 2018-05-17T12:06:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-18T21:15:59.000Z (almost 5 years ago)
- Last Synced: 2025-04-24T03:47:46.864Z (about 15 hours ago)
- Topics: bdd, console, debug, decorator, dfa, python-decorators
- Language: Python
- Size: 34.2 KB
- Stars: 14
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: change/__init__.py
- License: LICENSE
Awesome Lists containing this project
README
# Python Decorators
#### Description
A list of helpful self-made Python decorators.
Might be of use to someone while thinking about some design patterns you could use in your next project.All code and examples are made to run on Python 3.3+
```python
@use_this_decorator
def on_this_function():
pass
```## Analyze
A group of helpful decorators for debugging and optimizing your code. Decorate your functions to keep track of how many times you call them and how long their execution takes.[___Check Example Code___](example_analyze.py)
## BDD tests
A short take on Behaviour Driven Development testing.[___Check Example Code___](example_bdd_tests.py)
## Change
Decorators that change the function or it's input arguments. Or both.[___Check Example Code___](example_change.py)
## Command Line
A fun way to emulate the command line in under 50 lines of code. Try it
## Conditional
The decorator that executes the given function only if the condition is met.[___Check Example Code___](example_conditional.py)
## DFA
Deterministic Finite Automaton Emulator. A really simplified one, at least.[___Check Example Code___](example_dfa.py)
## do in main thread
Executes the given function in the main thread.[___Check Example Code___](example_do_in_main_thread.py)
## Max Refresh
I should really get a better name for this. Best to check the example.[___Check Example Code___](example_max_refresh.py)
## Print Me
Prints the function, it's arguments and result. Really helpful for debugging.[___Check Example Code___](example_print_me.py)
## Stack Results
Emulates a giant stack on which to put results that can be taken care of later.[___Check Example Code___](example_stack_results.py)
## Ternary
A slightly different take on ternary operator.[___Check Example Code___](example_ternary.py)
## TODO
Writing a lot of functions that are only defined? Use this.[___Check Example Code___](example_todo.py)
## VA_ARGS
C-style va_args operator.[___Check Example Code___](example_va_args.py)