summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hupp <adam@hupp.org>2021-01-15 14:43:15 -0800
committerAdam Hupp <adam@hupp.org>2021-01-15 14:43:15 -0800
commit665b7bdcc3df29039f64ed7d9e49fc77842942d9 (patch)
treed6c4f176720bd6e1e4d4275572942758589db33f
parentd61e3856696f8a88bc88b10eda6ac3b88710bc35 (diff)
downloadpython-magic-665b7bdcc3df29039f64ed7d9e49fc77842942d9.tar.gz
remove from_open_file, since its duplicative with from_descriptor and hasnt been released yet
-rw-r--r--magic/__init__.py8
-rwxr-xr-xtest/test.py9
2 files changed, 0 insertions, 17 deletions
diff --git a/magic/__init__.py b/magic/__init__.py
index 7eeb088..86b1dc5 100644
--- a/magic/__init__.py
+++ b/magic/__init__.py
@@ -108,14 +108,6 @@ class Magic:
except MagicException as e:
return self._handle509Bug(e)
- def from_open_file(self, open_file):
- with self.lock:
- try:
- fd = open_file.fileno()
- return maybe_decode(magic_descriptor(self.cookie, fd))
- except MagicException as e:
- return self._handle509Bug(e)
-
def from_file(self, filename):
# raise FileNotFoundException or IOError if the file does not exist
with _real_open(filename):
diff --git a/test/test.py b/test/test.py
index e333641..949c77e 100755
--- a/test/test.py
+++ b/test/test.py
@@ -83,15 +83,6 @@ class MagicTest(unittest.TestCase):
m.from_buffer(b'#!/usr/bin/env python\nprint("foo")')
in ("text/x-python", "text/x-script.python"))
- def test_open_file(self):
- if SKIP_FROM_DESCRIPTOR:
- self.skipTest("magic_descriptor is broken in this version of libmagic")
-
- m = magic.Magic(mime=True)
- filename = os.path.join(self.TESTDATA_DIR, "test.pdf")
- with open(filename) as f:
- self.assertEqual("application/pdf", m.from_open_file(f))
-
def test_mime_types(self):
dest = os.path.join(MagicTest.TESTDATA_DIR,
b'\xce\xbb'.decode('utf-8'))