From 7e6a62c990b76ac63ee53be1f4c1c147bba4b806 Mon Sep 17 00:00:00 2001 From: David Douard <david.douard@sdfa3.org> Date: Tue, 11 Oct 2022 16:30:46 +0200 Subject: [PATCH] Rename ProvenanceInterface.directory_xxx_flattenned as directory_xxx_flattened and fix all occurrences of the typo. --- swh/provenance/algos/directory.py | 10 +++++----- swh/provenance/interface.py | 8 ++++---- swh/provenance/provenance.py | 4 ++-- swh/provenance/storage/interface.py | 6 +++--- swh/provenance/storage/postgresql.py | 4 ++-- swh/provenance/tests/test_directory_flatten.py | 4 ++-- swh/provenance/tests/test_revision_content_layer.py | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/swh/provenance/algos/directory.py b/swh/provenance/algos/directory.py index 06db86f..ec7d06d 100644 --- a/swh/provenance/algos/directory.py +++ b/swh/provenance/algos/directory.py @@ -50,7 +50,7 @@ def directory_flatten_range( """Flatten the known directories from ``start_id`` to ``end_id``.""" current = start_id while current < end_id: - dirs = provenance.storage.directory_iter_not_flattenned( + dirs = provenance.storage.directory_iter_not_flattened( limit=100, start_id=current ) if not dirs: @@ -71,9 +71,9 @@ def directory_add( ) -> None: for directory in directories: # Only flatten directories that are present in the provenance model, but not - # flattenned yet. - flattenned = provenance.directory_already_flattenned(directory) - if flattenned is not None and not flattenned: + # flattened yet. + flattened = provenance.directory_already_flattened(directory) + if flattened is not None and not flattened: directory_flatten( provenance, archive, @@ -104,4 +104,4 @@ def directory_flatten( for d_child in current.dirs: # Recursively walk the child directory. stack.append((d_child, os.path.join(prefix, d_child.name))) - provenance.directory_flag_as_flattenned(directory) + provenance.directory_flag_as_flattened(directory) diff --git a/swh/provenance/interface.py b/swh/provenance/interface.py index 010bc9f..715a3f8 100644 --- a/swh/provenance/interface.py +++ b/swh/provenance/interface.py @@ -99,14 +99,14 @@ class ProvenanceInterface(Protocol): """ ... - def directory_already_flattenned(self, directory: DirectoryEntry) -> Optional[bool]: - """Check if the directory is already flattenned in the provenance model. If the + def directory_already_flattened(self, directory: DirectoryEntry) -> Optional[bool]: + """Check if the directory is already flattened in the provenance model. If the directory is unknown for the model, the methods returns None. """ ... - def directory_flag_as_flattenned(self, directory: DirectoryEntry) -> None: - """Mark the directory as flattenned in the provenance model. If the + def directory_flag_as_flattened(self, directory: DirectoryEntry) -> None: + """Mark the directory as flattened in the provenance model. If the directory is unknown for the model, this method has no effect. """ ... diff --git a/swh/provenance/provenance.py b/swh/provenance/provenance.py index 907183c..c688eeb 100644 --- a/swh/provenance/provenance.py +++ b/swh/provenance/provenance.py @@ -410,7 +410,7 @@ class Provenance: (directory.id, revision.id, path_normalize(path)) ) - def directory_already_flattenned(self, directory: DirectoryEntry) -> Optional[bool]: + def directory_already_flattened(self, directory: DirectoryEntry) -> Optional[bool]: cache = self.cache["directory_flatten"] if directory.id not in cache: cache.setdefault(directory.id, None) @@ -422,7 +422,7 @@ class Provenance: self.cache["directory"]["data"][directory.id] = dir.date return cache.get(directory.id) - def directory_flag_as_flattenned(self, directory: DirectoryEntry) -> None: + def directory_flag_as_flattened(self, directory: DirectoryEntry) -> None: self.cache["directory_flatten"][directory.id] = True def directory_get_date_in_isochrone_frontier( diff --git a/swh/provenance/storage/interface.py b/swh/provenance/storage/interface.py index c0ba7d1..f238adb 100644 --- a/swh/provenance/storage/interface.py +++ b/swh/provenance/storage/interface.py @@ -136,11 +136,11 @@ class ProvenanceStorageInterface(Protocol): """ ... - @remote_api_endpoint("directory_iter_not_flattenned") - def directory_iter_not_flattenned( + @remote_api_endpoint("directory_iter_not_flattened") + def directory_iter_not_flattened( self, limit: int, start_id: Sha1Git ) -> List[Sha1Git]: - """Retrieve the unflattenned directories after ``start_id`` up to ``limit`` entries.""" + """Retrieve the unflattened directories after ``start_id`` up to ``limit`` entries.""" ... @remote_api_endpoint("entity_get_all") diff --git a/swh/provenance/storage/postgresql.py b/swh/provenance/storage/postgresql.py index f65f092..bb24a87 100644 --- a/swh/provenance/storage/postgresql.py +++ b/swh/provenance/storage/postgresql.py @@ -199,9 +199,9 @@ class ProvenanceStoragePostgreSql: return result @statsd.timed( - metric=STORAGE_DURATION_METRIC, tags={"method": "directory_iter_not_flattenned"} + metric=STORAGE_DURATION_METRIC, tags={"method": "directory_iter_not_flattened"} ) - def directory_iter_not_flattenned( + def directory_iter_not_flattened( self, limit: int, start_id: Sha1Git ) -> List[Sha1Git]: sql = """ diff --git a/swh/provenance/tests/test_directory_flatten.py b/swh/provenance/tests/test_directory_flatten.py index 4a62b86..84b10fd 100644 --- a/swh/provenance/tests/test_directory_flatten.py +++ b/swh/provenance/tests/test_directory_flatten.py @@ -52,8 +52,8 @@ def prepare( # this query forces the directory date to be retrieved from the storage and cached # (otherwise, the flush below won't update the directory flatten flag) - flattenned = provenance.directory_already_flattenned(directory) - assert flattenned is not None and not flattenned + flattened = provenance.directory_already_flattened(directory) + assert flattened is not None and not flattened return date, directory, content1, content2 diff --git a/swh/provenance/tests/test_revision_content_layer.py b/swh/provenance/tests/test_revision_content_layer.py index a3592d0..d566a91 100644 --- a/swh/provenance/tests/test_revision_content_layer.py +++ b/swh/provenance/tests/test_revision_content_layer.py @@ -223,7 +223,7 @@ def test_revision_content_result( ).difference(prev_directories) ] for directory in directories: - assert not provenance.directory_already_flattenned(directory) + assert not provenance.directory_already_flattened(directory) directory_add(provenance, archive, directories) # each "entry" in the synth file is one new revision -- GitLab