RPI2026F1 added a comment.

  There are alternative ways to only import ForwardRef types for type checkers. 
A common usage I've seen is:
  
    from typing import TYPE_CHECKING
    
    if TYPE_CHECKING:
        from .mod import SomeClass
    
    def func(param: 'SomeClass') -> int: ...
  
  All static type checkers will set `TYPE_CHECKING` to True and evaluate the 
code blocks in there. Ref: 
https://docs.python.org/3/library/typing.html#typing.TYPE_CHECKING

TASK DETAIL
  https://phabricator.wikimedia.org/T331011

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: RPI2026F1
Cc: Xqt, Aklapper, pywikibot-bugs-list, RPI2026F1, PotsdamLamb, Jyoo1011, 
JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, 
Framawiki, Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, 
jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to