Initial ExifRead stubs (#9401)

This commit is contained in:
Sebastian Rittau
2022-12-23 12:37:44 +01:00
committed by GitHub
parent 44cdc6e284
commit db6644790b
19 changed files with 224 additions and 0 deletions

View File

@@ -31,6 +31,7 @@
"stubs/cryptography",
"stubs/dateparser",
"stubs/docutils",
"stubs/ExifRead",
"stubs/Flask-Migrate",
"stubs/Flask-SQLAlchemy",
"stubs/fpdf2",

View File

@@ -0,0 +1,7 @@
# The following constants are only re-exported at runtime as a side effect
# of Python's import system.
exifread.DEFAULT_STOP_TAG
exifread.classes.DEFAULT_STOP_TAG
exifread.classes.EXIF_TAGS
exifread.classes.FIELD_TYPES
exifread.classes.IGNORE_TAGS

View File

@@ -0,0 +1,4 @@
version = "3.0.*"
[tool.stubtest]
ignore_missing_stub = false

View File

@@ -0,0 +1,7 @@
from _typeshed import Incomplete
logger: Incomplete
def process_file(
fh, stop_tag=..., details: bool = ..., strict: bool = ..., debug: bool = ..., truncate_tags: bool = ..., auto_seek: bool = ...
): ...

View File

@@ -0,0 +1,42 @@
from _typeshed import Incomplete
logger: Incomplete
class IfdTag:
printable: Incomplete
tag: Incomplete
field_type: Incomplete
field_offset: Incomplete
field_length: Incomplete
values: Incomplete
def __init__(self, printable: str, tag: int, field_type: int, values, field_offset: int, field_length: int) -> None: ...
class ExifHeader:
file_handle: Incomplete
endian: Incomplete
offset: Incomplete
fake_exif: Incomplete
strict: Incomplete
debug: Incomplete
detailed: Incomplete
truncate_tags: Incomplete
tags: Incomplete
def __init__(
self,
file_handle,
endian,
offset,
fake_exif,
strict: bool,
debug: bool = ...,
detailed: bool = ...,
truncate_tags: bool = ...,
) -> None: ...
def s2n(self, offset, length: int, signed: bool = ...) -> int: ...
def n2b(self, offset, length) -> bytes: ...
def list_ifd(self) -> list[Incomplete]: ...
def dump_ifd(self, ifd, ifd_name: str, tag_dict: Incomplete | None = ..., relative: int = ..., stop_tag=...) -> None: ...
def extract_tiff_thumbnail(self, thumb_ifd: int) -> None: ...
def extract_jpeg_thumbnail(self) -> None: ...
def decode_maker_note(self) -> None: ...
def parse_xmp(self, xmp_bytes: bytes): ...

View File

@@ -0,0 +1,2 @@
class InvalidExif(Exception): ...
class ExifNotFound(Exception): ...

View File

@@ -0,0 +1,25 @@
import logging
from _typeshed import Incomplete
TEXT_NORMAL: int
TEXT_BOLD: int
TEXT_RED: int
TEXT_GREEN: int
TEXT_YELLOW: int
TEXT_BLUE: int
TEXT_MAGENTA: int
TEXT_CYAN: int
def get_logger(): ...
def setup_logger(debug, color) -> None: ...
class Formatter(logging.Formatter):
color: Incomplete
debug: Incomplete
def __init__(self, debug: bool = ..., color: bool = ...) -> None: ...
def format(self, record): ...
class Handler(logging.StreamHandler[Incomplete]):
color: Incomplete
debug: Incomplete
def __init__(self, log_level, debug: bool = ..., color: bool = ...) -> None: ...

View File

@@ -0,0 +1,54 @@
from _typeshed import Incomplete
from collections.abc import Callable
logger: Incomplete
class WrongBox(Exception): ...
class NoParser(Exception): ...
class BoxVersion(Exception): ...
class BadSize(Exception): ...
class Box:
version: int
minor_version: int
item_count: int
size: int
after: int
pos: int
compat: list[Incomplete]
base_offset: int
subs: dict[str, Box]
locs: dict[Incomplete, Incomplete]
exif_infe: Box | None
item_id: int
item_type: bytes
item_name: bytes
item_protection_index: int
major_brand: bytes
offset_size: int
length_size: int
base_offset_size: int
index_size: int
flags: int
name: Incomplete
def __init__(self, name: str) -> None: ...
def set_sizes(self, offset: int, length: int, base_offset: int, index: int): ...
def set_full(self, vflags: int): ...
class HEICExifFinder:
file_handle: Incomplete
def __init__(self, file_handle) -> None: ...
def get(self, nbytes: int) -> bytes: ...
def get16(self) -> int: ...
def get32(self) -> int: ...
def get64(self) -> int: ...
def get_int4x2(self) -> tuple[Incomplete, Incomplete]: ...
def get_int(self, size: int) -> int: ...
def get_string(self) -> bytes: ...
def next_box(self) -> Box: ...
def get_full(self, box: Box): ...
def skip(self, box: Box): ...
def expect_parse(self, name: str) -> Box: ...
def get_parser(self, box: Box) -> Callable[..., Incomplete]: ...
def parse_box(self, box: Box) -> Box: ...
def find_exif(self) -> tuple[Incomplete, Incomplete]: ...

View File

@@ -0,0 +1,5 @@
from _typeshed import Incomplete
logger: Incomplete
def find_jpeg_exif(fh, data, fake_exif) -> tuple[Incomplete, Incomplete, Incomplete]: ...

View File

@@ -0,0 +1,15 @@
from _typeshed import Incomplete
from exifread.tags.exif import EXIF_TAGS as EXIF_TAGS
from exifread.tags.makernote import (
apple as apple,
canon as canon,
casio as casio,
fujifilm as fujifilm,
nikon as nikon,
olympus as olympus,
)
DEFAULT_STOP_TAG: str
FIELD_TYPES: Incomplete
IGNORE_TAGS: Incomplete

View File

@@ -0,0 +1,7 @@
from _typeshed import Incomplete
INTEROP_TAGS: Incomplete
INTEROP_INFO: Incomplete
GPS_TAGS: Incomplete
GPS_INFO: Incomplete
EXIF_TAGS: Incomplete

View File

@@ -0,0 +1,3 @@
from _typeshed import Incomplete
TAGS: Incomplete

View File

@@ -0,0 +1,19 @@
from _typeshed import Incomplete
TAGS: Incomplete
CAMERA_SETTINGS: Incomplete
FOCAL_LENGTH: Incomplete
SHOT_INFO: Incomplete
AF_INFO_2: Incomplete
FILE_INFO: Incomplete
def add_one(value): ...
def subtract_one(value): ...
def convert_temp(value): ...
CAMERA_INFO_TAG_NAME: str
CAMERA_INFO_5D: Incomplete
CAMERA_INFO_5DMKII: Incomplete
CAMERA_INFO_5DMKIII: Incomplete
CAMERA_INFO_600D: Incomplete
CAMERA_INFO_MODEL_MAP: Incomplete

View File

@@ -0,0 +1,3 @@
from _typeshed import Incomplete
TAGS: Incomplete

View File

@@ -0,0 +1,3 @@
from _typeshed import Incomplete
TAGS: Incomplete

View File

@@ -0,0 +1,6 @@
from _typeshed import Incomplete
def ev_bias(seq) -> str: ...
TAGS_NEW: Incomplete
TAGS_OLD: Incomplete

View File

@@ -0,0 +1,6 @@
from _typeshed import Incomplete
def special_mode(val): ...
TAGS: Incomplete
TAG_0x2020: Incomplete

View File

@@ -0,0 +1,15 @@
from _typeshed import Incomplete
from fractions import Fraction
def ord_(dta): ...
def make_string(seq: bytes | list[Incomplete]) -> str: ...
def make_string_uc(seq) -> str: ...
def get_gps_coords(tags: dict[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ...
class Ratio(Fraction):
def __new__(cls, numerator: int = ..., denominator: Incomplete | None = ...): ...
@property
def num(self): ...
@property
def den(self): ...
def decimal(self) -> float: ...