Skip to content

Commit

Permalink
Proper logic for splitting.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrake-merani committed Dec 4, 2024
1 parent e129a4f commit bc18b89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sasdata/ascii_reader_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ class AsciiReaderMetadata:
master_metadata: dict[str, AsciiMetadataCategory[int]] = field(default_factory=default_categories)

def filename_components(self, filename: str) -> list[str]:
return re_split(self.filename_separator[filename], filename)
splitted = re_split(f'{self.filename_separator[filename]}', filename)
# If the last component has a file extensions, remove it.
last_component = splitted[-1]
if '.' in last_component:
pos = last_component.index('.')
last_component = last_component[:pos]
splitted[-1] = last_component
return splitted

def all_file_metadata(self, filename: str) -> dict[str, AsciiMetadataCategory[str]]:
file_metadata = self.filename_specific_metadata[filename]
Expand Down

0 comments on commit bc18b89

Please sign in to comment.