diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2022-11-14 16:43:12 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2022-11-14 16:43:12 +0530 |
commit | d47f8b48935d258f4c5c3e2267911753bebd5214 (patch) | |
tree | 3ed04e75bc3fc7c8e4ce618f527565da1df630a1 /env/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py | |
parent | 9468226a9e2e2ab8cdd599f1d8538e860ca86120 (diff) | |
download | idcard-d47f8b48935d258f4c5c3e2267911753bebd5214.tar.gz idcard-d47f8b48935d258f4c5c3e2267911753bebd5214.tar.bz2 idcard-d47f8b48935d258f4c5c3e2267911753bebd5214.zip |
id card
Diffstat (limited to 'env/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py')
-rw-r--r-- | env/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/env/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py b/env/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py deleted file mode 100644 index 9510f73..0000000 --- a/env/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py +++ /dev/null @@ -1,73 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# BUFR stub adapter -# -# Copyright (c) 1996-2003 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# - -from . import Image, ImageFile - -_handler = None - - -def register_handler(handler): - """ - Install application-specific BUFR image handler. - - :param handler: Handler object. - """ - global _handler - _handler = handler - - -# -------------------------------------------------------------------- -# Image adapter - - -def _accept(prefix): - return prefix[:4] == b"BUFR" or prefix[:4] == b"ZCZC" - - -class BufrStubImageFile(ImageFile.StubImageFile): - - format = "BUFR" - format_description = "BUFR" - - def _open(self): - - offset = self.fp.tell() - - if not _accept(self.fp.read(4)): - raise SyntaxError("Not a BUFR file") - - self.fp.seek(offset) - - # make something up - self.mode = "F" - self._size = 1, 1 - - loader = self._load() - if loader: - loader.open(self) - - def _load(self): - return _handler - - -def _save(im, fp, filename): - if _handler is None or not hasattr(_handler, "save"): - raise OSError("BUFR save handler not installed") - _handler.save(im, fp, filename) - - -# -------------------------------------------------------------------- -# Registry - -Image.register_open(BufrStubImageFile.format, BufrStubImageFile, _accept) -Image.register_save(BufrStubImageFile.format, _save) - -Image.register_extension(BufrStubImageFile.format, ".bufr") |