( )⚙ D10215 typing: rewrite a conditional assignment to unconfuse pytype

This is an archive of the discontinued Mercurial Phabricator instance.

typing: rewrite a conditional assignment to unconfuse pytype
ClosedPublic

Authored by mharbison72 on Mar 13 2021, 2:34 PM.

Details

Summary

Otherwise, pytype and PyCharm flags it:

File "/mnt/c/Users/Matt/hg/mercurial/localrepo.py", line 2903, in wlock: No attribute 'held' on _weakref.ReferenceType[nothing] [attribute-error]
  In Optional[Union[Any, _weakref.ReferenceType[nothing]]]
File "/mnt/c/Users/Matt/hg/mercurial/localrepo.py", line 2904, in wlock: No attribute 'lock' on _weakref.ReferenceType[nothing] [attribute-error]
  In Optional[Union[Any, _weakref.ReferenceType[nothing]]]

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mharbison72 created this revision.Mar 13 2021, 2:34 PM
pulkit accepted this revision.Mar 18 2021, 3:00 PM
This revision is now accepted and ready to land.Mar 18 2021, 3:00 PM