From 4d25546e74696aa24e84aeebd3f2ab2707c4addb Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 27 Oct 2017 16:00:56 -0700 Subject: [PATCH] Update README --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 77a2c0cd..7382e338 100644 --- a/README.md +++ b/README.md @@ -27,23 +27,25 @@ but have the semantics be stable and consistent. ## Low-level For [`importlib.abc`](https://docs.python.org/3/library/importlib.html#module-importlib.abc): ```python -from typing import Optional +import abc from typing.io import BinaryIO class ResourceReader(abc.ABC): - def open_resource(self, path) -> BinaryIO: + def open_resource(self, path: str) -> BinaryIO: """Return a file-like object opened for binary reading. - The path is expected to be relative to the location of the - package this loader represents. + The 'path' argument is expected to represent only a file name. + If the resource cannot be found, FileNotFoundError is raised. """ raise FileNotFoundError - def resource_path(self, path) -> str: + def resource_path(self, path: str) -> str: """Return the file system path to the specified resource. + + The 'path' argument is expected to represent only a file name. If the resource does not exist on the file system, raise FileNotFoundError. """