Package concurrent_tree_crawler :: Package common :: Module resources
[hide private]
[frames] | no frames]

Source Code for Module concurrent_tree_crawler.common.resources

 1  import os.path 
 2  from pkg_resources import resource_stream 
3 4 -class Resources:
5 @staticmethod
6 - def open(_name_, relative_file_path):
7 """Safe way of accessing the resource file (it will work even in 8 code enclosed in *.egg/*.zip package) 9 10 @param _name_: C{__name__} variable (of the calling module) 11 @return: file-like object""" 12 13 return resource_stream(_name_, relative_file_path)
14 15 @staticmethod
16 - def path(_file_, relative_path):
17 """*Unsafe* way of getting path to a resource (dir/file) - it won't 18 work inside code enclosed in *.egg/*.zip package 19 20 @param _file_: C{__file__} variable of calling module 21 @return: absolute-like path to given resource""" 22 23 return os.path.join(os.path.dirname(_file_), relative_path)
24