Skip to content

Commit a4cf54d

Browse files
committed
Move as_file to the global namespace and update documentation accordingly. Closes python#86.
1 parent 6e91e7f commit a4cf54d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

importlib_resources/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
import sys
44

55
from ._compat import metadata
6+
from .trees import as_file
67

78

89
__all__ = [
910
'Package',
1011
'Resource',
1112
'ResourceReader',
13+
'as_file',
1214
'contents',
1315
'files',
1416
'is_resource',

importlib_resources/docs/using.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ to this temporary file as a :py:class:`pathlib.Path` object. In order to
155155
properly clean up this temporary file, what's actually returned is a context
156156
manager that you can use in a ``with``-statement::
157157

158-
from importlib_resources import files
159-
from importlib_resources.trees import as_file
158+
from importlib_resources import files, as_file
160159

161160
source = files(email.tests.data).joinpath('message.eml')
162161
with as_file(source) as eml:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy