MCPcopy Create free account
hub / github.com/ahupp/python-magic / from_file

Method from_file

magic/__init__.py:110–119  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

108 return self._handle509Bug(e)
109
110 def from_file(self, filename):
111 # raise FileNotFoundException or IOError if the file does not exist
112 with _real_open(filename):
113 pass
114
115 with self.lock:
116 try:
117 return maybe_decode(magic_file(self.cookie, filename))
118 except MagicException as e:
119 return self._handle509Bug(e)
120
121 def from_descriptor(self, fd):
122 with self.lock:

Callers 7

test_keep_goingMethod · 0.95
test_pathlikeMethod · 0.95
assert_valuesMethod · 0.80
from_fileFunction · 0.80

Calls 3

_handle509BugMethod · 0.95
maybe_decodeFunction · 0.85
magic_fileFunction · 0.85

Tested by 6

test_keep_goingMethod · 0.76
test_pathlikeMethod · 0.76
assert_valuesMethod · 0.64