anatoly-scherbakov / anatoly-scherbakov/documented

Implement @documented decorator for functions

Offen
#4 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
16
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

```python
@documented
def calculate_customers_report(customers: List[Customer], requested_by: User) -> CustomerReport:
"""
Build customers report.

Requested by: {requested_by}.
"""
```

When this function is executed, the following message can be printed:

```
Build customers report.

Requested by: John Doe.
```

Before executing the function, its wrapper will substitute the arguments of the function call into the docstring and then will print the docstring using built-in Python logging system.

Purpose of this is to illustrate what is happening in the program in a human readable way in its log.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.