wmwpy.utils.file_types package

Submodules

wmwpy.utils.file_types.Documents module

class wmwpy.utils.file_types.Documents.DatabaseFile[source]

Bases: Reader

EXTENSION = 'db'
MIME = 'application/x-sqlite3'
check(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Check file type.

Parameters:
  • mime (str) – File mime.

  • extension (str) – File extension

  • rawdata (io.BytesIO) – Contents of file as file-like object.

Returns:

Whether the file is of this type.

Return type:

bool

read(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Read file.

Parameters:
  • mime (str) – Mime of file.

  • extension (str) – File extension.

  • rawdata (io.BytesIO) – File data as file-like object.

Returns:

File data.

Return type:

Any

save(data: Connection) bytes[source]
class wmwpy.utils.file_types.Documents.ImagelistFile[source]

Bases: Reader

EXTENSION = 'imagelist'
MIME = 'text/imagelist'
check(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Check file type.

Parameters:
  • mime (str) – File mime.

  • extension (str) – File extension

  • rawdata (io.BytesIO) – Contents of file as file-like object.

Returns:

Whether the file is of this type.

Return type:

bool

read(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Read file.

Parameters:
  • mime (str) – Mime of file.

  • extension (str) – File extension.

  • rawdata (io.BytesIO) – File data as file-like object.

Returns:

File data.

Return type:

Any

class wmwpy.utils.file_types.Documents.ObjectFile[source]

Bases: Reader

EXTENSION = 'hs'
MIME = 'text/hs'
check(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Check file type.

Parameters:
  • mime (str) – File mime.

  • extension (str) – File extension

  • rawdata (io.BytesIO) – Contents of file as file-like object.

Returns:

Whether the file is of this type.

Return type:

bool

read(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Read file.

Parameters:
  • mime (str) – Mime of file.

  • extension (str) – File extension.

  • rawdata (io.BytesIO) – File data as file-like object.

Returns:

File data.

Return type:

Any

class wmwpy.utils.file_types.Documents.SpriteFile[source]

Bases: Reader

EXTENSION = 'sprite'
MIME = 'text/sprite'
check(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Check file type.

Parameters:
  • mime (str) – File mime.

  • extension (str) – File extension

  • rawdata (io.BytesIO) – Contents of file as file-like object.

Returns:

Whether the file is of this type.

Return type:

bool

read(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Read file.

Parameters:
  • mime (str) – Mime of file.

  • extension (str) – File extension.

  • rawdata (io.BytesIO) – File data as file-like object.

Returns:

File data.

Return type:

Any

class wmwpy.utils.file_types.Documents.XMLFile[source]

Bases: Reader

EXTENSION = 'xml'
MIME = 'text/xml'
check(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Check file type.

Parameters:
  • mime (str) – File mime.

  • extension (str) – File extension

  • rawdata (io.BytesIO) – Contents of file as file-like object.

Returns:

Whether the file is of this type.

Return type:

bool

read(mime: str, extension: str, rawdata: BytesIO, **kwargs) ElementBase[source]

Read file.

Parameters:
  • mime (str) – Mime of file.

  • extension (str) – File extension.

  • rawdata (io.BytesIO) – File data as file-like object.

Returns:

File data.

Return type:

Any

wmwpy.utils.file_types.Images module

class wmwpy.utils.file_types.Images.ImageFile[source]

Bases: Reader

EXTENSION = ''
MIME = 'image/'
check(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Check file type.

Parameters:
  • mime (str) – File mime.

  • extension (str) – File extension

  • rawdata (io.BytesIO) – Contents of file as file-like object.

Returns:

Whether the file is of this type.

Return type:

bool

read(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Read file.

Parameters:
  • mime (str) – Mime of file.

  • extension (str) – File extension.

  • rawdata (io.BytesIO) – File data as file-like object.

Returns:

File data.

Return type:

Any

class wmwpy.utils.file_types.Images.WaltexFile[source]

Bases: Reader

EXTENSION = 'waltex'
MIME = 'image/waltex'
check(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Check file type.

Parameters:
  • mime (str) – File mime.

  • extension (str) – File extension

  • rawdata (io.BytesIO) – Contents of file as file-like object.

Returns:

Whether the file is of this type.

Return type:

bool

read(mime: str, extension: str, rawdata: BytesIO, **kwargs)[source]

Read file.

Parameters:
  • mime (str) – Mime of file.

  • extension (str) – File extension.

  • rawdata (io.BytesIO) – File data as file-like object.

Returns:

File data.

Return type:

Any

Module contents