File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
domdf_python_tools/compat Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -30,39 +30,39 @@ def _normalize_path(path: Any) -> str:
30
30
raise ValueError (f'{ path !r} must be only a file name' )
31
31
return file_name
32
32
33
- def open_binary (package : importlib_resources . Package , resource : importlib_resources . Resource ) -> BinaryIO :
33
+ def open_binary (package : Package , resource : Resource ) -> BinaryIO :
34
34
"""
35
35
Return a file-like object opened for binary reading of the resource.
36
36
"""
37
37
38
- return (importlib_resources . files (package ) / _normalize_path (resource )).open ("rb" )
38
+ return (files (package ) / _normalize_path (resource )).open ("rb" )
39
39
40
- def read_binary (package : importlib_resources . Package , resource : importlib_resources . Resource ) -> bytes :
40
+ def read_binary (package : Package , resource : Resource ) -> bytes :
41
41
"""
42
42
Return the binary contents of the resource.
43
43
"""
44
44
45
- return (importlib_resources . files (package ) / _normalize_path (resource )).read_bytes ()
45
+ return (files (package ) / _normalize_path (resource )).read_bytes ()
46
46
47
47
def open_text (
48
- package : importlib_resources . Package ,
49
- resource : importlib_resources . Resource ,
48
+ package : Package ,
49
+ resource : Resource ,
50
50
encoding : str = "utf-8" ,
51
51
errors : str = "strict" ,
52
52
) -> TextIO :
53
53
"""
54
54
Return a file-like object opened for text reading of the resource.
55
55
"""
56
56
57
- return (importlib_resources . files (package ) / _normalize_path (resource )).open (
57
+ return (files (package ) / _normalize_path (resource )).open (
58
58
'r' ,
59
59
encoding = encoding ,
60
60
errors = errors ,
61
61
)
62
62
63
63
def read_text (
64
- package : importlib_resources . Package ,
65
- resource : importlib_resources . Resource ,
64
+ package : Package ,
65
+ resource : Resource ,
66
66
encoding : str = "utf-8" ,
67
67
errors : str = "strict" ,
68
68
) -> str :
You can’t perform that action at this time.
0 commit comments