|
|
@@ -29,7 +29,7 @@ class Storage(abc.ABC): |
|
|
|
''' |
|
|
|
Search all metadata in storage by criteria. |
|
|
|
Refer to `codearchiver.core.Metadata.matches` for the semantics of `criteria`. |
|
|
|
Yields all filenames where all criteria match. |
|
|
|
Yields all filenames where all criteria match in lexicographical order. |
|
|
|
''' |
|
|
|
|
|
|
|
@abc.abstractmethod |
|
|
@@ -78,7 +78,9 @@ class DirectoryStorage(Storage): |
|
|
|
# Replace this with `root_dir` when dropping Python 3.9 support |
|
|
|
escapedDirPrefix = os.path.join(glob.escape(self._directory), '') |
|
|
|
escapedDirPrefixLen = len(escapedDirPrefix) |
|
|
|
for metadataFilename in glob.glob(f'{escapedDirPrefix}*.codearchiver-metadata'): |
|
|
|
files = glob.glob(f'{escapedDirPrefix}*.codearchiver-metadata') |
|
|
|
files.sort() |
|
|
|
for metadataFilename in files: |
|
|
|
metadataFilename = metadataFilename[escapedDirPrefixLen:] |
|
|
|
_logger.info(f'Searching metadata {metadataFilename}') |
|
|
|
with self.open(metadataFilename, 'r') as fp: |
|
|
|