Skip to main content

Jazal

Français

Avant qu'une application utilise le chemin d'un fichier, il peut importer de vérifier s'il a la bonne extension, s'il existe et s'il s'agit d'un dossier ou d'un fichier. À cette fin, la bibliothèque Jazal fournit la classe PathChecker et sa sous-classe ReactivePathChecker. Cette dernière permet en plus d'avertir l'utilisateur que le chemin est invalide et de le remplacer par une valeur correcte. Ces deux classes dépendent de pathlib.Path.

Jazal offre aussi la classe MissingPathArgWarner, qui produit un message explicite si l'utilisateur omet de fournir un argument chemin obligatoire. Si le chemin est donné, cette classe peut instancier PathChecker ou ReactivePathChecker de telle manière que chaque information requise ne soit donnée qu'une seule fois. Si un chemin optionnel est omis, MissingPathArgWarner peut aider à générer une valeur par défaut en fournissant l'extension attendue.

De plus, cette bibliothèque contient des fonctions qui aident à produire des valeurs par défaut pour les chemins manquants ou invalides.

Voir les scripts demo_with_files.py et demo_with_dirs.py pour savoir comment employer Jazal.

Le nom de cette bibliothèque vient de la chanson polonaise Hej, sokoły!. La répétition du mot żal [ʒal] dans les paroles a insprié le nom Jazal.

Tests unitaires de Jazal

Les tests unitaires de cette bibliothèque dépendent du cadriciel pytest. Pour lancer une suite de tests contenue dans le dossier tests, écrivez en ligne de commande une instruction correspondant au modèle suivant.

pytest <file name>.py

Exécutez le script run_all_tests.py pour lancer tous les tests.

python run_all_tests.py

Puisque plusieurs tests utilisent des chemins relatifs menant à un dossier et à un fichier réels, lancez-les depuis le dossier tests pour éviter des exceptions.

English

Before an application uses a path to a file, it may be important to verify whether it has the right extension, whether it exists and whether it points to a directory or a file. For this purpose, library Jazal provides class PathChecker and its subclass ReactivePathChecker. The latter is also able to warn the user about invalid paths and make correct ones. These two classes depend on pathlib.Path.

Jazal also offers class MissingPathArgWarner, which makes an explicit message if the user omits to provide a mandatory path argument. If the path is given, this class can instantiate PathChecker or ReactivePathChecker in such a way that each required information is given only once. If an optional path is omitted, MissingPathArgWarner can help generating a default value by providing the expected extension.

In addition, this library contains functions that help making default values for missing or invalid paths.

See scripts demo_with_files.py and demo_with_dirs.py to know how to use Jazal.

This library's name is based on the Polish song Hej, sokoły!. The repetition of the word żal [ʒal] in the lyrics inspired the name Jazal.

Jazal Unit Tests

This library's unit tests depend on framework pytest. In order to run a test suite contained in directory tests, type an instruction matching the following template in command line.

pytest <file name>.py

Execute script run_all_tests.py to perform all the tests.

python run_all_tests.py

Since several tests use relative paths to an actual directory and an actual file, run them from directory tests to prevent exceptions.

Release files for jazal 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jazal 2.0.0
File Size Uploaded
jazal-2.0.0.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jazal 2.0.0
File Interpreter ABI Platform
jazal-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / jazal-2.0.0.tar.gz

Download URL jazal-2.0.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6ff63cce5fc6aedddaa509d1a3ea32ab4aff5245c6d33877b1b593cbeb210b42
BLAKE2b-256 checksum
How to use checksums
fc10c73196cd78989723442665e1cc84b671db31b10227d6d0d019f2844fce34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / jazal-2.0.0-py3-none-any.whl

Download URL jazal-2.0.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f0b9c656775de272451e0d32e58567e765defe0ba518d13e762bad3a697779a
BLAKE2b-256 checksum
How to use checksums
676f0cb8dfa04e9ed4816198b773230041cc953f22fabc25bce0dfe4b73baf5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page