RulePathNotExist Class
- class kwhelp.rules.RulePathNotExist(key: str, name: str, value: object, raise_errors: bool, originator: object)[source]
Bases:
kwhelp.rules.RulePath
Rule that matched only if value is instance of
Path
and path does not exist.- __init__(key: str, name: str, value: object, raise_errors: bool, originator: object)
Constructor
- Parameters
key (str) – the key that rule is to apply to.
name (str) – the name of the field that value was assigned
value (object) – the value that is assigned to
field_name
raise_errors (bool) – determinins if rule could raise an error when validation fails
originator (object) – the object that attributes validated for
- Raises
TypeError – If any arg is not of the correct type
- validate() bool [source]
Validates that value to assign is a Path that does not exist
- Raises
FileExistsError – If
raise_errors
isTrue
andfield_value
is path that is existing.- Returns
True
iffield_value
is a p ath that does not exist; Otherwise,False
.- Return type
bool
- property field_name: str
Name of the field assigned.
- Getter
Gets the name of the field assigned
- Setter
Sets the name of the field assigned
- property field_value: object
The value assigned to
field_name
- Getter
Gets value assigned to
field_name
- Setter
Sets value assigned to
field_name
- property key: str
Gets the key currently being read
- property originator: object
Gets object that attributes validated for
- property raise_errors: bool
Determines if a rule can raise an error when validation fails.
- Getter
Gets if a rule could raise an error when validation fails
- Setter
Sets if a rule could raise an error when validation fails