TotalDepth.DeTif

Strip TIF markers from a file or scan a file and reporting errors in TIF markers.

exception TotalDepth.DeTif.DeTifException
__weakref__

list of weak references to the object (if defined)

exception TotalDepth.DeTif.DeTifExceptionCompare
exception TotalDepth.DeTif.DeTifExceptionRead
class TotalDepth.DeTif.TifMarker(tell, type, prev, next)
tell

Alias for field number 0

type

Alias for field number 1

prev

Alias for field number 2

next

Alias for field number 3

__str__() → str

Return str(self).

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, tell: int, type: int, prev: int, next: int)

Create new instance of TifMarker(tell, type, prev, next)

__repr__()

Return a nicely formatted representation string

TotalDepth.DeTif.compare_next(this: TotalDepth.DeTif.TifMarker, nxt: TotalDepth.DeTif.TifMarker) → None

Compares two adjacent TIF markers for consistency.

TotalDepth.DeTif.has_tif_file(fobj: BinaryIO) → bool

Returns True of the file in path apparently has TIF markers.

TotalDepth.DeTif.has_tif(path: str) → bool

Returns True of the file in path apparently has TIF markers.

TotalDepth.DeTif.tif_scan_file_object(fobj: BinaryIO) → List[TotalDepth.DeTif.TifMarker]

Scan a file object and return the list of TIF markers.

TotalDepth.DeTif.tif_scan_path(path: str) → List[TotalDepth.DeTif.TifMarker]

Scan a file at path and return the list of TIF markers.

TotalDepth.DeTif.get_errors(tifs: List[TotalDepth.DeTif.TifMarker], file_size: int) → List[str]

Return a list of TIF marker errors.

TotalDepth.DeTif.strip_tif(file_in: BinaryIO, file_out: BinaryIO) → Tuple[int, int]

Read file_in then strip TIF markers and write to file_out. The only error detected is negative reads. Returns a tuple of (tif_markers_stripped, bytes_written).

TotalDepth.DeTif.strip_path(path_in: str, path_out: str) → Tuple[int, int]

Read path_in then strip TIF markers and write to path_out.

TotalDepth.DeTif.de_tif_file(path_in: str, path_out: str, nervous: bool, over_write: bool) → Tuple[int, int, int]

De-TIFs a file path_in writing to path_out. Returns a tuple of (files_copied, tif_count, byte_count) where files_copied is 0 or 1, tif_count is the number of 12 byte TIF markers and byte_count is the number of bytes in path_in (if no file written) or path_out if the file is written.