diff --git a/swh/provenance/algos/directory.py b/swh/provenance/algos/directory.py index 06db86fe369a99a57dc3848086b79557e101516e..ec7d06dcb27f1da3b168600e592211512c452621 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 010bc9f180ef9f0f2e8c33fb1cc653cbc177ebc0..715a3f8ca751146fad2475d3b5bf161440d85d57 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 907183cd517ce3263c0f90b2375a7e0eb3c0a28d..c688eeb3cd9bfc67b12cdbbe6079d82dab3b17a1 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 c0ba7d1c4cd0eca53d4ade765e30a19f3dbda08f..f238adb4915647dd1e310a5614e4570a906ce623 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 f65f0927d6f72cd1e4fac24bc7f2a6d48f6e86ce..bb24a873cf4078e3ddbca9d4895b107acc0fab79 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 4a62b8623c4528bfd94ae0356261f3ce70ee1b4e..84b10fd12383c4d51e5f23438055a550c2e67c68 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 a3592d00b56650d77b83074ae1016ccfff1ce3d7..d566a9139bd17eb544446569cf754d2f9a8fad3c 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