Module: validators.py

Author:

Stefan Eletzhofer

Date:

2012-05-17

Abstract

Tis module defines some validators used by the command line parser.

Usage Example

Please see the unit tests for examples.

Module Documentation

nexiles.tools.api.validators.is_file_path(s) path

Validates s to be a valid file.

This also expands the user’s home directory, and normalizes case and path separators.

Only files pass the check, and they MUST exist.

Raises argparse.AttributeError if a validation error occurs.

Parameters:

f – the string to check

nexiles.tools.api.validators.is_oid(s) str

Validates s to be a valid OID.

Raises argparse.AttributeError if a validation error occurs.

Parameters:

oid – the string to check

nexiles.tools.api.validators.is_url(s) str

Validates s to be a url.

Raises argparse.AttributeError if a validation error occurs.

Parameters:

s – the string to check