sasdata.ascii_reader_metadata module¶
- class sasdata.ascii_reader_metadata.AsciiMetadataCategory(values: dict[str, T]=<factory>)¶
Bases:
Generic- values: dict[str, T]¶
- class sasdata.ascii_reader_metadata.AsciiReaderMetadata(filename_specific_metadata: dict[str, dict[str, sasdata.ascii_reader_metadata.AsciiMetadataCategory[str]]]=<factory>, filename_separator: dict[str, str | bool]=<factory>, master_metadata: dict[str, sasdata.ascii_reader_metadata.AsciiMetadataCategory[int]]=<factory>)¶
Bases:
object- add_file(new_filename: str)¶
Add a filename to the metadata, filling it with some default categories.
- all_file_metadata(filename: str) dict[str, AsciiMetadataCategory[str]]¶
Return all of the metadata for known for the specified filename. This will combin the master metadata specified for all files with the metadata specific to that filename.
- clear_metadata(category: str, key: str, filename: str)¶
Remove any metadata recorded for a certain filename.
- filename_components(filename: str, cut_off_extension: bool = True, capture: bool = False) list[str]¶
Split the filename into several components based on the current separator for that file.
- filename_separator: dict[str, str | bool]¶
- filename_specific_metadata: dict[str, dict[str, AsciiMetadataCategory[str]]]¶
- get_metadata(category: str, value: str, filename: str, error_on_not_found=False) str | None¶
Get a particular piece of metadata for the filename.
- init_separator(filename: str)¶
- master_metadata: dict[str, AsciiMetadataCategory[int]]¶
- purge_unreachable(filename: str)¶
This is used when the separator has changed. If lets say we now have 2 components when there were 5 but the 3rd component was selected, this will now produce an index out of range exception. Thus we’ll need to purge this to stop exceptions from happening.
- update_metadata(category: str, key: str, filename: str, new_value: str | int)¶
Update the metadata for a filename. If the new_value is a string, then this new metadata will be specific to that file. Otherwise, if new_value is an integer, then this will represent the component of the filename that this metadata applies to all.
- sasdata.ascii_reader_metadata.default_categories() dict[str, AsciiMetadataCategory[str | int]]¶