This page explains the contents and usage of the extension_checker module used for verifying the extension of the input files are correct, by comparing the files extension with the actual file structure. The extension_checker module is capable of converting from one extension to the corresponding extension that matches the file’s structure.
The module contains one class with three methods, where one method checks file structure and the other methods converts to correct extension type.
The module is built upon one public method and two private methods.
[...]
extcheck = ExtChecker("/path/to/file.filesExtension")
extcheck.check_file() #returns correct file path
[...]
If the file type doesn't match the corresponding extension, the method will change file extension to the correct type.
Example:
test.txt (actual type is pdf) -> method runs -> file converts to "test.pdf"