Mercurial > public > mercurial-scm > hg-stable
changeset 52911:a9388cf91666
largefiles: replace ersatz ternary operators that confuse pytype 2024.10.11
Specifically, it was flagging these:
/home/mharbison/projects/mercurial/mercurial-devel/hgext/largefiles/overrides.py:1340:13:
error: in overridearchive: No attribute '__exit__' on bool [attribute-error]
In Union[Any, bool, contextlib._GeneratorContextManager]
with (
~~~~~~
hasattr(sub, '_repo')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and lfstatus(sub._repo)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
or util.nullcontextmanager()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
):
~~~~~~~~~~~~~~
sub.archive(opencallback, subprefix, submatch)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mharbison/projects/mercurial/mercurial-devel/hgext/largefiles/overrides.py:1340:13:
error: in overridearchive: No attribute '__enter__' on bool [attribute-error]
In Union[Any, bool, contextlib._GeneratorContextManager]
with (
~~~~~~
hasattr(sub, '_repo')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and lfstatus(sub._repo)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
or util.nullcontextmanager()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
):
~~~~~~~~~~~~~~
sub.archive(opencallback, subprefix, submatch)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mharbison/projects/mercurial/mercurial-devel/hgext/largefiles/overrides.py:1412:9:
error: in hgsubrepoarchive: No attribute '__exit__' on bool [attribute-error]
In Union[Any, bool, contextlib._GeneratorContextManager]
with (
~~~~~~
hasattr(sub, '_repo')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and lfstatus(sub._repo)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
or util.nullcontextmanager()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
):
~~~~~~~~~~
sub.archive(opener, subprefix, submatch, decode)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mharbison/projects/mercurial/mercurial-devel/hgext/largefiles/overrides.py:1412:9:
error: in hgsubrepoarchive: No attribute '__enter__' on bool [attribute-error]
In Union[Any, bool, contextlib._GeneratorContextManager]
with (
~~~~~~
hasattr(sub, '_repo')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and lfstatus(sub._repo)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
or util.nullcontextmanager()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
):
~~~~~~~~~~
sub.archive(opener, subprefix, submatch, decode)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 11 Feb 2025 23:30:00 -0500 |
parents | 9b85f6efcc1d |
children | 0fd4b2af347b |
files | hgext/largefiles/overrides.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Tue Feb 11 21:21:17 2025 -0500 +++ b/hgext/largefiles/overrides.py Tue Feb 11 23:30:00 2025 -0500 @@ -1338,9 +1338,9 @@ # allow only hgsubrepos to set this, instead of the current scheme # where the parent sets this for the child. with ( - hasattr(sub, '_repo') - and lfstatus(sub._repo) - or util.nullcontextmanager() + lfstatus(sub._repo) + if hasattr(sub, '_repo') + else util.nullcontextmanager() ): sub.archive(opencallback, subprefix, submatch) @@ -1410,9 +1410,9 @@ # would allow only hgsubrepos to set this, instead of the current scheme # where the parent sets this for the child. with ( - hasattr(sub, '_repo') - and lfstatus(sub._repo) - or util.nullcontextmanager() + lfstatus(sub._repo) + if hasattr(sub, '_repo') + else util.nullcontextmanager() ): sub.archive(opener, subprefix, submatch, decode)