code stringlengths 3 6.57k |
|---|
struct.unpack(">LL", head[16:24]) |
ValueError("Invalid PNG file") |
head.startswith(b'\211PNG\r\n\032\n') |
struct.unpack(">LL", head[8:16]) |
ValueError("Invalid PNG file") |
head.startswith(b'\377\330') |
fhandle.seek(0) |
fhandle.seek(size, 1) |
fhandle.read(1) |
ord(byte) |
fhandle.read(1) |
ord(byte) |
struct.unpack('>H', fhandle.read(2) |
fhandle.seek(1, 1) |
struct.unpack('>HH', fhandle.read(4) |
except (struct.error, TypeError) |
ValueError("Invalid JPEG file") |
head.startswith(b'\x00\x00\x00\x0cjP \r\n\x87\n') |
fhandle.seek(48) |
struct.unpack('>LL', fhandle.read(8) |
ValueError("Invalid JPEG2000 file") |
head.startswith(b"\x4d\x4d\x00\x2a") |
struct.unpack('>L', head[4:8]) |
fhandle.seek(offset) |
struct.unpack(">H", fhandle.read(2) |
range(ifdsize) |
struct.unpack(">HHLL", fhandle.read(12) |
int(data / 65536) |
ValueError("Invalid TIFF file: width column data type should be SHORT/LONG.") |
int(data / 65536) |
ValueError("Invalid TIFF file: height column data type should be SHORT/LONG.") |
ValueError("Invalid TIFF file: width and/or height IDS entries are missing.") |
head.startswith(b"\x49\x49\x2a\x00") |
struct.unpack('<L', head[4:8]) |
fhandle.seek(offset) |
struct.unpack("<H", fhandle.read(2) |
range(ifdsize) |
struct.unpack("<HHLL", fhandle.read(12) |
ValueError("Invalid TIFF file: width and/or height IDS entries are missing.") |
head.startswith(b"\x49\x49\x2b\x00") |
struct.unpack('<L', head[4:8]) |
ValueError('Invalid BigTIFF file: Expected offset to be 8, found {} instead.'.format(offset) |
struct.unpack('<Q', head[8:16]) |
fhandle.seek(offset) |
struct.unpack("<Q", fhandle.read(8) |
range(ifdsize) |
struct.unpack("<HHQQ", fhandle.read(20) |
ValueError("Invalid BigTIFF file: width and/or height IDS entries are missing.") |
and (head.startswith(b'<?xml') |
head.startswith(b'<svg') |
fhandle.seek(0) |
fhandle.read(1024) |
data.decode('utf-8') |
re.search(r'[^-]width="(.*?) |
group(1) |
re.search(r'[^-]height="(.*?) |
group(1) |
ValueError("Invalid SVG file") |
_convertToPx(width) |
_convertToPx(height) |
fhandle.seek(2) |
fhandle.read(1) |
next_chr.isspace() |
ValueError("Invalid Netpbm file") |
fhandle.readline() |
next_chr.isdigit() |
ValueError("Invalid character found on Netpbm file") |
fhandle.read(1) |
next_chr.isdigit() |
fhandle.read(1) |
sizes.append(int(size) |
len(sizes) |
fhandle.seek(-1, os.SEEK_CUR) |
fhandle.close() |
getDPI(filepath) |
Return (x DPI, y DPI) |
isinstance(filepath, bytes) |
str(filepath) |
open(filepath, 'rb') |
fhandle.read(24) |
len(head) |
in (b'GIF87a', b'GIF89a') |
head.startswith(b'\211PNG\r\n\032\n') |
struct.unpack(">LLB", chunk[8:]) |
ValueError("Invalid PNG file") |
_convertToDPI(xDensity, _UNIT_1M) |
_convertToDPI(yDensity, _UNIT_1M) |
struct.unpack(">L", chunk[0:4]) |
ValueError("Invalid PNG file") |
fhandle.seek(chunkOffset) |
fhandle.read(17) |
head.startswith(b'\377\330') |
fhandle.seek(0) |
fhandle.seek(7, 1) |
struct.unpack(">BHH", fhandle.read(5) |
_convertToDPI(xDensity, _UNIT_CM) |
_convertToDPI(yDensity, _UNIT_CM) |
fhandle.seek(size, 1) |
fhandle.read(1) |
ord(byte) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.