fab.parse package¶
- class fab.parse.AnalysedFile(fpath, file_hash=None)¶
Bases:
ABC
Analysis results for a single file. Abstract base class.
- Parameters:
If not provided, the self.file_hash property is lazily evaluated in case the file does not yet exist.
- property file_hash¶
- to_dict()¶
Create a dict representing the object.
The dict may be written to json, so can’t contain sets. Lists are sorted for reproducibility in testing.
- classmethod from_dict(d)¶
- save(fpath)¶
- classmethod load(fpath)¶
- classmethod field_names()¶
Defines the order in which we want fields to appear in str or repr strings.
Calling this helps to ensure any lazy attributes are evaluated before use, e.g when constructing a string representation of the instance, or generating a hash value.
- class fab.parse.EmptySourceFile(fpath)¶
Bases:
AnalysedFile
An analysis result for a file which resulted in an empty parse tree.
- classmethod from_dict(d)¶