@@ -99,11 +99,10 @@ for example, a package and its resources can be imported from a zip file using
99
99
Added support for *traversable * representing a directory.
100
100
101
101
102
- Deprecated functions
103
- ^^^^^^^^^^^^^^^^^^^^
102
+ Functional API
103
+ ^^^^^^^^^^^^^^
104
104
105
- An older, deprecated set of functions is still available, but is
106
- scheduled for removal in a future version of Python.
105
+ An older, previously deprecated set of functions is still available.
107
106
The main drawback of these functions is that they do not support
108
107
directories: they assume all resources are located directly within a *package *.
109
108
@@ -116,8 +115,6 @@ directories: they assume all resources are located directly within a *package*.
116
115
117
116
The ``Package `` type is defined as ``Union[str, ModuleType] ``.
118
117
119
- .. deprecated :: 3.12
120
-
121
118
122
119
.. data :: Resource
123
120
@@ -138,11 +135,9 @@ directories: they assume all resources are located directly within a *package*.
138
135
sub-resources (i.e. it cannot be a directory). This function returns a
139
136
``typing.BinaryIO `` instance, a binary I/O stream open for reading.
140
137
141
- .. deprecated :: 3.11
142
-
143
- Calls to this function can be replaced by::
138
+ This function is roughly equivalent to::
144
139
145
- files(package).joinpath(resource).open('rb')
140
+ files(package).joinpath(resource).open('rb')
146
141
147
142
148
143
.. function :: open_text(package, resource, encoding='utf-8', errors='strict')
@@ -159,11 +154,9 @@ directories: they assume all resources are located directly within a *package*.
159
154
This function returns a ``typing.TextIO `` instance, a text I/O stream open
160
155
for reading.
161
156
162
- .. deprecated :: 3.11
157
+ This function is roughly equivalent to::
163
158
164
- Calls to this function can be replaced by::
165
-
166
- files(package).joinpath(resource).open('r', encoding=encoding)
159
+ files(package).joinpath(resource).open('r', encoding=encoding)
167
160
168
161
169
162
.. function :: read_binary(package, resource)
@@ -177,11 +170,9 @@ directories: they assume all resources are located directly within a *package*.
177
170
sub-resources (i.e. it cannot be a directory). This function returns the
178
171
contents of the resource as :class: `bytes `.
179
172
180
- .. deprecated :: 3.11
181
-
182
- Calls to this function can be replaced by::
173
+ This function is roughly equivalent to::
183
174
184
- files(package).joinpath(resource).read_bytes()
175
+ files(package).joinpath(resource).read_bytes()
185
176
186
177
187
178
.. function :: read_text(package, resource, encoding='utf-8', errors='strict')
@@ -196,11 +187,9 @@ directories: they assume all resources are located directly within a *package*.
196
187
have the same meaning as with built-in :func: `open `. This function
197
188
returns the contents of the resource as :class: `str `.
198
189
199
- .. deprecated :: 3.11
190
+ This function is roughly equivalent to::
200
191
201
- Calls to this function can be replaced by::
202
-
203
- files(package).joinpath(resource).read_text(encoding=encoding)
192
+ files(package).joinpath(resource).read_text(encoding=encoding)
204
193
205
194
206
195
.. function :: path(package, resource)
@@ -217,11 +206,9 @@ directories: they assume all resources are located directly within a *package*.
217
206
within *package *; it may not contain path separators and it may not have
218
207
sub-resources (i.e. it cannot be a directory).
219
208
220
- .. deprecated :: 3.11
221
-
222
- Calls to this function can be replaced using :func: `as_file `::
209
+ This function is roughly equivalent to ::
223
210
224
- as_file(files(package).joinpath(resource))
211
+ as_file(files(package).joinpath(resource))
225
212
226
213
227
214
.. function :: is_resource(package, name)
@@ -232,11 +219,9 @@ directories: they assume all resources are located directly within a *package*.
232
219
*package * is either a name or a module object which conforms to the
233
220
``Package `` requirements.
234
221
235
- .. deprecated :: 3.11
222
+ This function is roughly equivalent to::
236
223
237
- Calls to this function can be replaced by::
238
-
239
- files(package).joinpath(resource).is_file()
224
+ files(package).joinpath(resource).is_file()
240
225
241
226
242
227
.. function :: contents(package)
@@ -248,8 +233,6 @@ directories: they assume all resources are located directly within a *package*.
248
233
*package * is either a name or a module object which conforms to the
249
234
``Package `` requirements.
250
235
251
- .. deprecated :: 3.11
252
-
253
- Calls to this function can be replaced by::
236
+ This function is roughly equivalent to::
254
237
255
- (resource.name for resource in files(package).iterdir() if resource.is_file())
238
+ (resource.name for resource in files(package).iterdir() if resource.is_file())
0 commit comments