Tracking variable whereabouts in a plugin
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 20.6k
- Forks
- 3.3k
- Métriques de merge des PR
- Métriques de PR en attente
Description
Please provide more information to help us understand the issue:
- Type: question
- Referecenes:
- Expected behavior: being able to track down variable i.e. from a process it was initialized.
Code below should illustrate an expected behavior. - Actual behavior: n/a
- mypy version:
>=0.770
from luguru import logger
LOG_A = logger.opt(lazy=False)
LOG_B = logger.opt(lazy=True)
LOG_A.info('Test {}', lambda x: x) # should work
LOG_B.info('Test {}', lambda x: x) # error
logger.opt(lazy=False).info('Test {c}', c=lambda x: x) # should work
logger.opt(lazy=True).info('Test {d}', d=lambda x: x) # error
In short: with loguru you can use Callable[[], Any] for lazy loggers to avoid costly computations. But those have to be non-argument callables. Above you can find non-lazy loggers that will work just fine by doing str(callable). In other words, to rephrase question from above, how can we:
track a variable/object on which behalf a method was called?
This is quite vital because type checking cannot be done solely on a method call level because we need something from another call. There is opt method being called but having call details from it without anything to tie them to will not help too much.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par examiner la question loguru-mypy liée et la pull request originale de loguru, puis étudiez la manière dont mypy gère les appels chaînés opt(...).info(...) présentés ici. L’issue n’identifie ni fichier, ni test, ni approche d’implémentation arrêtée ; sa réalisation nécessiterait de convenir d’une façon de suivre l’objet logger à travers ces appels et de définir clairement un cas de validation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 20/100