@@ -566,8 +566,8 @@ def get_resource_stream(self, manager, resource_name):
566
566
567
567
`manager` must be an ``IResourceManager``"""
568
568
569
- def get_resource_string (self , manager , resource_name ):
570
- """Return a string containing the contents of `resource_name`
569
+ def get_resource_string (self , manager , resource_name ) -> bytes :
570
+ """Return a bytes string containing the contents of `resource_name`
571
571
572
572
`manager` must be an ``IResourceManager``"""
573
573
@@ -1203,8 +1203,8 @@ def resource_stream(self, package_or_requirement, resource_name):
1203
1203
self , resource_name
1204
1204
)
1205
1205
1206
- def resource_string (self , package_or_requirement , resource_name ):
1207
- """Return specified resource as a string"""
1206
+ def resource_string (self , package_or_requirement , resource_name ) -> bytes :
1207
+ """Return specified resource as a bytes string"""
1208
1208
return get_provider (package_or_requirement ).get_resource_string (
1209
1209
self , resource_name
1210
1210
)
@@ -1479,7 +1479,7 @@ def get_resource_filename(self, manager, resource_name):
1479
1479
def get_resource_stream (self , manager , resource_name ):
1480
1480
return io .BytesIO (self .get_resource_string (manager , resource_name ))
1481
1481
1482
- def get_resource_string (self , manager , resource_name ):
1482
+ def get_resource_string (self , manager , resource_name ) -> bytes :
1483
1483
return self ._get (self ._fn (self .module_path , resource_name ))
1484
1484
1485
1485
def has_resource (self , resource_name ):
@@ -1649,7 +1649,7 @@ def _validate_resource_path(path):
1649
1649
DeprecationWarning ,
1650
1650
)
1651
1651
1652
- def _get (self , path ):
1652
+ def _get (self , path ) -> bytes :
1653
1653
if hasattr (self .loader , 'get_data' ):
1654
1654
return self .loader .get_data (path )
1655
1655
raise NotImplementedError (
@@ -1706,7 +1706,7 @@ def _listdir(self, path):
1706
1706
def get_resource_stream (self , manager , resource_name ):
1707
1707
return open (self ._fn (self .module_path , resource_name ), 'rb' )
1708
1708
1709
- def _get (self , path ):
1709
+ def _get (self , path ) -> bytes :
1710
1710
with open (path , 'rb' ) as stream :
1711
1711
return stream .read ()
1712
1712
@@ -1731,8 +1731,8 @@ class EmptyProvider(NullProvider):
1731
1731
1732
1732
_isdir = _has = lambda self , path : False
1733
1733
1734
- def _get (self , path ):
1735
- return ''
1734
+ def _get (self , path ) -> bytes :
1735
+ return b ''
1736
1736
1737
1737
def _listdir (self , path ):
1738
1738
return []
0 commit comments