ats_utilities.config_io.ifile_check module

Module

ifile_check.py

Copyright

Copyright (C) 2017 - 2026 Vladimir Roncevic <elektron.ronca@gmail.com> ats_utilities is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ats_utilities is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Info

Defines abstract class IFileCheck with attribute(s) and method(s). Creates an interface for file checking operations.

class ats_utilities.config_io.ifile_check.IFileCheck[source]

Bases: ABC

Defines abstract class IFileCheck with attribute(s) and method(s). Creates an interface for file checking operations.

It defines:

attributes:
MODES - Mode file operations.
TRUSTED_EXTENSIONS - List of trusted file extensions.
methods:
check_path - Checks file path.
check_mode - Checks file mode.
check_format - Checks file format by extension.
is_file_ok - Returns aggregated file status.
__str__ - Returns the IFileCheck as string representation.
MODES: list[str] = ['r', 'w', 'a', 'b', 'x', 't', '+']
TRUSTED_EXTENSIONS: list[str] = ['makefile']
_abc_impl = <_abc._abc_data object>
abstractmethod check_format(file_path: str | None, file_format: str | None) None[source]

Checks file format by extension.

Parameters:
  • file_path (<str | None>) – File path in string format | None.

  • file_format (<str | None>) – File format in string format (extension) | None.

Exceptions:

NotImplementedError..

abstractmethod check_mode(file_mode: str | None) None[source]

Checks file mode in string format.

Parameters:

file_mode (<str | None>) – File mode in string format | None.

Exceptions:

NotImplementedError..

abstractmethod check_path(file_path: str | None) None[source]

Checks file path in string format.

Parameters:

file_path (<str | None>) – File path in string format | None.

Exceptions:

NotImplementedError..

abstractmethod is_file_ok() bool[source]

Returns aggregated file status.

Returns:

True (success) | False (fail).

Return type:

<bool>

Exceptions:

NotImplementedError..