comparison mercurial/utils/resourceutil.py @ 51762:ca7bde5dbafb

black: format the codebase with 23.3.0 The CI has moved to 23.3.0, which is the last version that supports 3.7 at runtime, so we should honor this change. # skip-blame mass-reformating only
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 18 Jul 2024 12:36:12 +0200
parents 7f0cb9ee0534
children 16d63d7799fa
comparison
equal deleted inserted replaced
51761:b0a4de6c14f8 51762:ca7bde5dbafb
50 def _package_path(package: bytes) -> bytes: 50 def _package_path(package: bytes) -> bytes:
51 dirs = package.split(b".") 51 dirs = package.split(b".")
52 assert dirs[0] == b"mercurial" 52 assert dirs[0] == b"mercurial"
53 return os.path.join(_rootpath, *dirs[1:]) 53 return os.path.join(_rootpath, *dirs[1:])
54 54
55
56 else: 55 else:
57 datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__))) 56 datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__)))
58 _rootpath = os.path.dirname(datapath) 57 _rootpath = os.path.dirname(datapath)
59 58
60 def _package_path(package: bytes) -> bytes: 59 def _package_path(package: bytes) -> bytes:
96 path = pycompat.fsdecode(_package_path(package)) 95 path = pycompat.fsdecode(_package_path(package))
97 96
98 for p in os.listdir(path): 97 for p in os.listdir(path):
99 yield pycompat.fsencode(p) 98 yield pycompat.fsencode(p)
100 99
101
102 else: 100 else:
103 from .. import encoding 101 from .. import encoding
104 102
105 def open_resource(package: bytes, name: bytes) -> "BinaryIO": 103 def open_resource(package: bytes, name: bytes) -> "BinaryIO":
106 if hasattr(resources, 'files'): 104 if hasattr(resources, 'files'):