@@ -1166,10 +1166,9 @@ find and load modules.
1166
1166
.. class :: ModuleSpec(name, loader, *, origin=None, loader_state=None, is_package=None)
1167
1167
1168
1168
A specification for a module's import-system-related state. This is
1169
- typically exposed as the module's :attr: `__spec__ ` attribute. In the
1170
- descriptions below, the names in parentheses give the corresponding
1171
- attribute available directly on the module object,
1172
- e.g. ``module.__spec__.origin == module.__file__ ``. Note, however, that
1169
+ typically exposed as the module's :attr: `__spec__ ` attribute. Many
1170
+ of these attributes are also available directly on a module: for example,
1171
+ ``module.__spec__.origin == module.__file__ ``. Note, however, that
1173
1172
while the *values * are usually equivalent, they can differ since there is
1174
1173
no synchronization between the two objects. For example, it is possible to update
1175
1174
the module's :attr: `__file__ ` at runtime and this will not be automatically
@@ -1179,66 +1178,60 @@ find and load modules.
1179
1178
1180
1179
.. attribute :: name
1181
1180
1182
- (:attr: `__name__ `)
1183
-
1184
- The module's fully qualified name.
1185
- The :term: `finder ` should always set this attribute to a non-empty string.
1181
+ The module's fully qualified name
1182
+ (see :attr: `__name__ ` attributes on modules).
1183
+ The :term: `finder ` should always set this attribute to a non-empty string.
1186
1184
1187
1185
.. attribute :: loader
1188
1186
1189
- (:attr: `__loader__ `)
1190
-
1191
- The :term: `loader ` used to load the module.
1192
- The :term: `finder ` should always set this attribute.
1187
+ The :term: `loader ` used to load the module
1188
+ (see :attr: `__loader__ ` attributes on modules).
1189
+ The :term: `finder ` should always set this attribute.
1193
1190
1194
1191
.. attribute :: origin
1195
1192
1196
- (:attr: `__file__ `)
1197
-
1198
- The location the :term: `loader ` should use to load the module.
1199
- For example, for modules loaded from a .py file this is the filename.
1200
- The :term: `finder ` should always set this attribute to a meaningful value
1201
- for the :term: `loader ` to use. In the uncommon case that there is not one
1202
- (like for namespace packages), it should be set to ``None ``.
1193
+ The location the :term: `loader ` should use to load the module
1194
+ (see :attr: `__file__ ` attributes on modules).
1195
+ For example, for modules loaded from a .py file this is the filename.
1196
+ The :term: `finder ` should always set this attribute to a meaningful value
1197
+ for the :term: `loader ` to use. In the uncommon case that there is not one
1198
+ (like for namespace packages), it should be set to ``None ``.
1203
1199
1204
1200
.. attribute :: submodule_search_locations
1205
1201
1206
- (:attr: `__path__ `)
1207
-
1208
- The list of locations where the package's submodules will be found.
1209
- Most of the time this is a single directory.
1210
- The :term: `finder ` should set this attribute to a list, even an empty one, to indicate
1211
- to the import system that the module is a package. It should be set to ``None `` for
1212
- non-package modules. It is set automatically later to a special object for
1213
- namespace packages.
1202
+ The list of locations where the package's submodules will be found
1203
+ (see :attr: `__path__ ` attributes on modules).
1204
+ Most of the time this is a single directory.
1205
+ The :term: `finder ` should set this attribute to a list, even an empty one, to indicate
1206
+ to the import system that the module is a package. It should be set to ``None `` for
1207
+ non-package modules. It is set automatically later to a special object for
1208
+ namespace packages.
1214
1209
1215
1210
.. attribute :: loader_state
1216
1211
1217
- The :term: `finder ` may set this attribute to an object containing additional,
1218
- module-specific data to use when loading the module. Otherwise it should be
1219
- set to ``None ``.
1212
+ The :term: `finder ` may set this attribute to an object containing additional,
1213
+ module-specific data to use when loading the module. Otherwise it should be
1214
+ set to ``None ``.
1220
1215
1221
1216
.. attribute :: cached
1222
1217
1223
- (:attr: `__cached__ `)
1224
-
1225
- The filename of a compiled version of the module's code.
1226
- The :term: `finder ` should always set this attribute but it may be ``None ``
1227
- for modules that do not need compiled code stored.
1218
+ The filename of a compiled version of the module's code
1219
+ (see :attr: `__cached__ ` attributes on modules).
1220
+ The :term: `finder ` should always set this attribute but it may be ``None ``
1221
+ for modules that do not need compiled code stored.
1228
1222
1229
1223
.. attribute :: parent
1230
1224
1231
- (:attr: `__package__ `)
1232
-
1233
- (Read-only) The fully qualified name of the package the module is in (or the
1234
- empty string for a top-level module).
1235
- If the module is a package then this is the same as :attr: `name `.
1225
+ (Read-only) The fully qualified name of the package the module is in (or the
1226
+ empty string for a top-level module).
1227
+ See :attr: `__package__ ` attributes on modules.
1228
+ If the module is a package then this is the same as :attr: `name `.
1236
1229
1237
1230
.. attribute :: has_location
1238
1231
1239
- ``True `` if the spec's :attr: `origin ` refers to a loadable location,
1240
- ``False `` otherwise. This value impacts how :attr: `origin ` is interpreted
1241
- and how the module's :attr: `__file__ ` is populated.
1232
+ ``True `` if the spec's :attr: `origin ` refers to a loadable location,
1233
+ ``False `` otherwise. This value impacts how :attr: `origin ` is interpreted
1234
+ and how the module's :attr: `__file__ ` is populated.
1242
1235
1243
1236
1244
1237
.. class :: AppleFrameworkLoader(name, path)
0 commit comments