From patchwork Sat Mar 13 19:33:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D10205: typing: disable a few errors calling py3.7+ functions in resourceutil.py From: phabricator X-Patchwork-Id: 48518 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Sat, 13 Mar 2021 19:33:39 +0000 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 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)