MCPcopy Index your code
hub / github.com/python/cpython / Reader

Class Reader

Lib/test/test_importlib/resources/util.py:18–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17
18class Reader(ResourceReader):
19 def __init__(self, **kwargs):
20 vars(self).update(kwargs)
21
22 def get_resource_reader(self, package):
23 return self
24
25 def open_resource(self, path):
26 self._path = path
27 if isinstance(self.file, Exception):
28 raise self.file
29 return self.file
30
31 def resource_path(self, path_):
32 self._path = path_
33 if isinstance(self.path, Exception):
34 raise self.path
35 return self.path
36
37 def is_resource(self, path_):
38 self._path = path_
39 if isinstance(self.path, Exception):
40 raise self.path
41
42 def part(entry):
43 return entry.split('/')
44
45 return any(
46 len(parts) == 1 and parts[0] == path_ for parts in map(part, self._contents)
47 )
48
49 def contents(self):
50 if isinstance(self.path, Exception):
51 raise self.path
52 yield from self._contents
53
54
55def create_package_from_loader(loader, is_package=True):

Callers 1

create_packageFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…