Patchwork D10205: typing: disable a few errors calling py3.7+ functions in resourceutil.py

login
register
mail settings
Submitter phabricator
Date March 13, 2021, 7:33 p.m.
Message ID <differential-rev-PHID-DREV-6xqip4uxxt43lindmfd4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48518/
State Superseded
Headers show

Comments

phabricator - March 13, 2021, 7:33 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  There's a graceful fallback when these methods are unavailable.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10205

AFFECTED FILES
  mercurial/utils/resourceutil.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py
--- a/mercurial/utils/resourceutil.py
+++ b/mercurial/utils/resourceutil.py
@@ -70,12 +70,14 @@ 
         )
 
     def is_resource(package, name):
-        return resources.is_resource(
+        return resources.is_resource(  # pytype: disable=module-attr
             pycompat.sysstr(package), encoding.strfromlocal(name)
         )
 
     def contents(package):
+        # pytype: disable=module-attr
         for r in resources.contents(pycompat.sysstr(package)):
+            # pytype: enable=module-attr
             yield encoding.strtolocal(r)