Validation

flutils offers the following validation functions.

flutils.validate_identifier(identifier, allow_underscore=True)[source]

Validate the given string is a proper identifier.

This validator will also raise an error if the given identifier is a keyword or a builtin identifier.

Parameters:
  • identifier (str) – The value to be tested.
  • allow_underscore (bool, optional) – A value of False will raise an error when the identifier has a value that starts with an underscore _. (Use False when validating potential namedtuple keys) Default: True.
Raises:
Return type:

None