MCPcopy
hub / github.com/codelucas/newspaper / loadResourceFile

Method loadResourceFile

newspaper/utils.py:33–45  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

31class FileHelper(object):
32 @classmethod
33 def loadResourceFile(self, filename):
34 if not os.path.isabs(filename):
35 dirpath = os.path.abspath(os.path.dirname(__file__))
36 path = os.path.join(dirpath, 'resources', filename)
37 else:
38 path = filename
39 try:
40 f = codecs.open(path, 'r', 'utf-8')
41 content = f.read()
42 f.close()
43 return content
44 except IOError:
45 raise IOError("Couldn't open file %s" % path)
46
47
48class ParsingCandidate(object):

Callers 1

__init__Method · 0.80

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected