PaVal module



What is PaVal?

First of all, it is a Python module, not a standalone project. Therefore, it most probably is useful for developers, only. The module can be integrated in software projects for certain purposes.


Further information about the module.

Python poweredThe PaVal module is project as well as platform independent. In first place, it has been developed to satisfy the needs of the projects provided by this website. Its name is an abbreviation of Parameter Validator.

Before, there was some code to validate the given parameters (such as directory and file paths, numbers, ranges and strings) in every project. This worked fine so far, but there was (partially the same) parameter validation code in various components.

So, if that code needed to be changed, it had to be done in various files of the project and (according to the significance of the change) also in other projects, which was sometimes pretty laborious.

Due to this, the common and non-project-specific parameter validation code has been exported from each project and merged in a single project independent module. In some cases it saved more than a hundred lines of code per project.

The module works read-only. This means, its methods validate the given values and raise an exception in case of an error, but they do not change or return anything.

The current version of PaVal comes with the following features:

Filesystem checks

  • Check a given path...
    • if it exists.
    • if it points to a directory or file.
  • Compare a file with a list of other files...
    • to check if the same file name is given multiple times.
    • to check if the file is given multiple times with a different name but the same content.

Number checks

  • Check an integer value...
    • if it is positive, zero or negative.
  • Check an integer range...
    • if the given value is inside that range.
    • if the given value is zero.

String checks

  • Check a string...
    • if it contains wildcard characters.
    • if it contains invalid characters (user-defined).
  • Compare a string with a list of other strings...
    • to check if the string is an item of the list.


Download the project.

GitHub logoDownloads and further information can be found on GitHub.