Compare commits

..

8 Commits

View File

@ -242,25 +242,6 @@ class Message():
tags = set(sorted(data[cls.tags_yaml_key])) tags = set(sorted(data[cls.tags_yaml_key]))
return tags return tags
@classmethod
def tags_from_dir(cls: Type[MessageInst],
path: pathlib.Path,
glob: Optional[str] = None,
prefix: Optional[str] = None) -> set[Tag]:
"""
Return only the tags from message files in the given directory.
The files can be filtered using 'glob', the tags by using 'prefix'.
"""
tags: set[Tag] = set()
file_iter = path.glob(glob) if glob else path.iterdir()
for file_path in sorted(file_iter):
if file_path.is_file():
try:
tags |= cls.tags_from_file(file_path, prefix)
except MessageError as e:
print(f"Error processing message in '{file_path}': {str(e)}")
return tags
@classmethod @classmethod
def from_file(cls: Type[MessageInst], file_path: pathlib.Path, def from_file(cls: Type[MessageInst], file_path: pathlib.Path,
mfilter: Optional[MessageFilter] = None) -> Optional[MessageInst]: mfilter: Optional[MessageFilter] = None) -> Optional[MessageInst]: