Lines Matching refs:self
18 def open_resource(self, resource: Text) -> BinaryIO:
30 def resource_path(self, resource: Text) -> Text:
43 def is_resource(self, path: Text) -> bool:
51 def contents(self) -> Iterable[str]:
67 def iterdir(self) -> Iterator["Traversable"]:
69 Yield Traversable objects in self
72 def read_bytes(self) -> bytes:
74 Read contents of self as bytes
76 with self.open('rb') as strm:
79 def read_text(self, encoding: Optional[str] = None) -> str:
81 Read contents of self as text
83 with self.open(encoding=encoding) as strm:
87 def is_dir(self) -> bool:
89 Return True if self is a directory
93 def is_file(self) -> bool:
95 Return True if self is a file
99 def joinpath(self, *descendants: StrPath) -> "Traversable":
103 Each descendant should be a path segment relative to self
108 def __truediv__(self, child: StrPath) -> "Traversable":
110 Return Traversable child in self
112 return self.joinpath(child)
115 def open(self, mode='r', *args, **kwargs):
125 def name(self) -> str:
138 def files(self) -> "Traversable":
141 def open_resource(self, resource: StrPath) -> io.BufferedReader:
142 return self.files().joinpath(resource).open('rb')
144 def resource_path(self, resource: Any) -> NoReturn:
147 def is_resource(self, path: StrPath) -> bool:
148 return self.files().joinpath(path).is_file()
150 def contents(self) -> Iterator[str]:
151 return (item.name for item in self.files().iterdir())