crocs-muni / sec-certs

Tool for analysis of security certificates and their security targets (Common Criteria, NIST FIPS140-2...).
https://sec-certs.org
MIT License
9 stars 7 forks source link

None instead of DUMMY_NONEXISTING_PATH when path not set on Dataset instances #290

Open adamjanovsky opened 1 year ago

adamjanovsky commented 1 year ago

Currently, objects that inherit from Dataset instance can be initialized without root_dir properly set. In such case, its value is set to DUMMY_NONEXISTING_PATH (constants module) which is a path object meant to substitute None value.

When any operation that involves serialization occurs on the dataset, it is checked that root_dir was properly set by @serialize decorator which raises an exception in case it was not yet set.

What we're trying to achieve is basically None behaviour that could be somewhat tricky to handle with MyPy. ATM, we take the advantage of root_dir always being a Path instance. We should, however, replace DUMMY_NONEXISTING_PATH with None in the future. For some rationale, see https://github.com/crocs-muni/sec-certs/pull/275/commits#discussion_r1042430764