@@ -31,7 +31,7 @@ If you have a file system layout such as::
31
31
32
32
then the directories are ``data ``, ``data/one ``, and ``data/two ``. Each of
33
33
these are also Python packages by virtue of the fact that they all contain
34
- ``__init__.py `` files [ #fn1 ]_ . That means that in Python, all of these import
34
+ ``__init__.py `` files. That means that in Python, all of these import
35
35
statements work::
36
36
37
37
import data
@@ -41,7 +41,7 @@ statements work::
41
41
Each import statement gives you a Python *module * corresponding to the
42
42
``__init__.py `` file in each of the respective directories. These modules are
43
43
packages since packages are just special module instances that have an
44
- additional attribute, namely a ``__path__ `` [#fn2 ]_.
44
+ additional attribute, namely a ``__path__ `` [#fn1 ]_.
45
45
46
46
In this analogy then, resources are just files or directories contained in a
47
47
package directory, so
@@ -108,7 +108,7 @@ Packages or package names
108
108
109
109
All of the ``importlib_resources `` APIs take a *package * as their first
110
110
parameter, but this can either be a package name (as a ``str ``) or an actual
111
- module object, though the module *must * be a package [#fn3 ]_. If a string is
111
+ module object, though the module *must * be a package [#fn2 ]_. If a string is
112
112
passed in, it must name an importable Python package, and this is first
113
113
imported. Thus the above example could also be written as::
114
114
@@ -192,18 +192,12 @@ should return a ``TraversableResources`` instance.
192
192
193
193
.. rubric :: Footnotes
194
194
195
- .. [#fn1 ] We're ignoring `PEP 420
196
- <https://www.python.org/dev/peps/pep-0420/> `_ style namespace
197
- packages, since ``importlib_resources `` does not support resources
198
- within namespace packages. Also, the example assumes that the
199
- parent directory containing ``data/ `` is on ``sys.path ``.
200
-
201
- .. [#fn2 ] As of `PEP 451 <https://www.python.org/dev/peps/pep-0451/ >`_ this
195
+ .. [#fn1 ] As of `PEP 451 <https://www.python.org/dev/peps/pep-0451/ >`_ this
202
196
information is also available on the module's
203
197
``__spec__.submodule_search_locations `` attribute, which will not be
204
198
``None `` for packages.
205
199
206
- .. [#fn3 ] Specifically, this means that in Python 2, the module object must
200
+ .. [#fn2 ] Specifically, this means that in Python 2, the module object must
207
201
have an ``__path__ `` attribute, while in Python 3, the module's
208
202
``__spec__.submodule_search_locations `` must not be ``None ``.
209
203
Otherwise a ``TypeError `` is raised.
0 commit comments