Patchwork D7681: pytype: suppress warnings about no 'open_binary' on importlib.resources

login
register
mail settings
Submitter phabricator
Date Dec. 17, 2019, 4:46 a.m.
Message ID <differential-rev-PHID-DREV-keceu6reb6bxn3xagsfo-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43896/
State Superseded
Headers show

Comments

phabricator - Dec. 17, 2019, 4:46 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Fixes these pytype warnings:
  
    line 43, in <module>: No attribute 'open_binary' on module 'importlib.resources' [module-attr]
    line 47, in open_resource: No attribute 'open_binary' on module 'importlib.resources' [module-attr]
  
  For some reason, I can't upgrade from 3.6.8 in my WSL environment.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/utils/resourceutil.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: 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
@@ -40,11 +40,11 @@ 
     import importlib
 
     # Force loading of the resources module
-    importlib.resources.open_binary
+    importlib.resources.open_binary  # pytype: disable=module-attr
 
     def open_resource(package, name):
         package = b'mercurial.' + package
-        return importlib.resources.open_binary(
+        return importlib.resources.open_binary(  # pytype: disable=module-attr
             pycompat.sysstr(package), pycompat.sysstr(name)
         )