sio3pack.files

Submodules

Package Contents

class sio3pack.files.File(path)[source]

Base class for all files in a package.

Parameters:

path (str) – The path to the file.

abstractmethod read()[source]

Read the file content.

Returns:

The content of the file.

Return type:

str

abstractmethod write(text)[source]

Write to the file.

Parameters:

text (str) – The text to write.

class sio3pack.files.LocalFile(path, exists=True)[source]

Bases: sio3pack.files.file.File

Class for a file in a package that is stored locally.

Parameters:
  • path (str) – The path to the file.

  • filename (str) – The name of the file.

classmethod get_file_matching_extension(dir, filename, extensions)[source]

Get the file with the given filename and one of the given extensions.

Parameters:
  • dir (str) – The directory to search in.

  • filename (str) – The filename.

  • extensions (list[str]) – The extensions.

Return LocalFile:

The file object.

Raises:

FileNotFoundError – If no file is found.

Return type:

LocalFile

read()[source]

Read the file content.

Returns:

The content of the file.

Return type:

str

write(text)[source]

Write to the file.

Parameters:

text (str) – The text to write.