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

Function detect_from_fobj

magic/compat.py:269–277  ·  view source on GitHub ↗

Detect mime type, encoding and file type from file-like object Returns a `FileMagic` namedtuple.

(fobj)

Source from the content-addressed store, hash-verified

267
268
269def detect_from_fobj(fobj):
270 '''Detect mime type, encoding and file type from file-like object
271
272 Returns a `FileMagic` namedtuple.
273 '''
274
275 file_descriptor = fobj.fileno()
276 return _create_filemagic(mime_magic.descriptor(file_descriptor),
277 none_magic.descriptor(file_descriptor))
278
279
280def detect_from_content(byte_content):

Callers

nothing calls this directly

Calls 2

_create_filemagicFunction · 0.85
descriptorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…