From bf21d264c981109b2fd3dcabbad4592d4885e731 Mon Sep 17 00:00:00 2001 From: Bastien Abadie <abadie@teklia.com> Date: Fri, 4 Feb 2022 11:11:45 +0000 Subject: [PATCH] Add codespell on CI --- .pre-commit-config.yaml | 6 ++++++ README.md | 2 +- arkindex/dataimport/api.py | 4 ++-- arkindex/dataimport/management/commands/import_s3.py | 2 +- arkindex/dataimport/models.py | 6 +++--- arkindex/dataimport/providers.py | 4 ++-- arkindex/dataimport/serializers/imports.py | 4 ++-- arkindex/dataimport/serializers/workers.py | 4 ++-- arkindex/dataimport/tests/test_imports.py | 6 +++--- arkindex/dataimport/tests/test_workeractivity.py | 2 +- arkindex/dataimport/tests/test_workerruns.py | 2 +- arkindex/dataimport/tests/test_workers.py | 2 +- arkindex/documents/api/elements.py | 6 +++--- arkindex/documents/date_parser.py | 2 +- arkindex/documents/deletion.py | 2 +- arkindex/documents/migrations/0006_preflight.py | 2 +- .../migrations/0034_transcriptionentity_worker_version.py | 4 ++-- arkindex/documents/serializers/entities.py | 4 ++-- arkindex/documents/serializers/ml.py | 6 +++--- arkindex/documents/tests/test_corpus_elements.py | 2 +- arkindex/documents/tests/test_create_transcriptions.py | 2 +- arkindex/images/serializers.py | 2 +- arkindex/project/mixins.py | 2 +- arkindex/project/pagination.py | 2 +- arkindex/project/tests/test_acl_mixin.py | 4 ++-- arkindex/sql_validation/element_dot_delete.sql | 2 +- arkindex/users/api.py | 2 +- arkindex/users/models.py | 2 +- arkindex/users/serializers.py | 4 ++-- arkindex/users/tests/test_generic_memberships.py | 4 ++-- 30 files changed, 52 insertions(+), 46 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 02ef6f4264..9d40e165c3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,12 @@ repos: - id: requirements-txt-fixer - id: end-of-file-fixer - id: mixed-line-ending + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: ['--write-changes'] + exclude: '^arkindex\/(documents\/export|sql_validation)\/.*\.sql' - repo: meta hooks: - id: check-useless-excludes diff --git a/README.md b/README.md index 956b652406..4096f9b9d5 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ gitlab: ### Local image server -Arkindex splits up image URLs in their image server and the image path. For example, a IIIF server at `http://iiif.irht.cnrs.fr/iiif/` and an image at `/Paris/JJ042/1.jpg` would be represented as an ImageServer instance holding one Image. Since Arkindex has a local IIIF server for image uploads and thumbnails, a special instance of ImageServer is required to point to this local server. In local developement, this server should be available at `https://ark.localhost/iiif`. You will therefore need to create an ImageServer via the Django admin or the Django shell with this URL. To set the local server ID, you can add a custom setting in `arkindex/config.yml`: +Arkindex splits up image URLs in their image server and the image path. For example, a IIIF server at `http://iiif.irht.cnrs.fr/iiif/` and an image at `/Paris/JJ042/1.jpg` would be represented as an ImageServer instance holding one Image. Since Arkindex has a local IIIF server for image uploads and thumbnails, a special instance of ImageServer is required to point to this local server. In local development, this server should be available at `https://ark.localhost/iiif`. You will therefore need to create an ImageServer via the Django admin or the Django shell with this URL. To set the local server ID, you can add a custom setting in `arkindex/config.yml`: ```yaml local_imageserver_id: 999 diff --git a/arkindex/dataimport/api.py b/arkindex/dataimport/api.py index 1cc90ba96f..3b8044fa90 100644 --- a/arkindex/dataimport/api.py +++ b/arkindex/dataimport/api.py @@ -888,7 +888,7 @@ class WorkerVersionList(WorkerACLMixin, ListCreateAPIView): filters = Q() if self.simple_mode: - # Limit output to versions with tags or master/main branchs + # Limit output to versions with tags or master/main branches filters = Q(revision__refs__type=GitRefType.Tag) | Q(revision__refs__type=GitRefType.Branch, revision__refs__name__in=["master", "main"]) return worker.versions \ @@ -975,7 +975,7 @@ class WorkerVersionRetrieve(RetrieveUpdateAPIView): def check_object_permissions(self, request, instance): """ Allow any user to retrieve a worker version without authentication - This behavior allows to retrieve a version information on public ressources + This behavior allows to retrieve a version information on public resources Only internal users are allowed to update a worker version """ diff --git a/arkindex/dataimport/management/commands/import_s3.py b/arkindex/dataimport/management/commands/import_s3.py index eb318c2923..036e23db1f 100644 --- a/arkindex/dataimport/management/commands/import_s3.py +++ b/arkindex/dataimport/management/commands/import_s3.py @@ -73,7 +73,7 @@ class Command(BaseCommand): 'AWS_ENDPOINT': settings.AWS_ENDPOINT, 'AWS_REGION': settings.AWS_REGION } - # Assert s3 informations are passed to tasks + # Assert s3 information are passed to tasks assert env_vars['AWS_ACCESS_KEY'] and env_vars['AWS_SECRET_KEY'], ( 'S3 environment variables could not be found\n' 'Please define AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY before starting import' diff --git a/arkindex/dataimport/models.py b/arkindex/dataimport/models.py index 67b9e439f2..cb57994270 100644 --- a/arkindex/dataimport/models.py +++ b/arkindex/dataimport/models.py @@ -164,7 +164,7 @@ class DataImport(IndexableModel): version_id=run.version_id, parents=run.parents, configuration_id=run.configuration_id) - # Save the correspondance between this process' worker_run and the new one + # Save the correspondence between this process' worker_run and the new one new_runs[run.id] = new_run # Remap parent ids correctly @@ -279,7 +279,7 @@ class DataImport(IndexableModel): } } - # Import entities directy after import step + # Import entities directly after import step if self.build_entities: tasks['build_entities'] = { 'image': settings.ARKINDEX_TASKS_IMAGE, @@ -696,7 +696,7 @@ class WorkerActivityState(Enum): class WorkerActivity(IndexableModel): """ Many-to-many relationship between Element and WorkerVersion - Used to track the activity of a worker version among mutliple elements + Used to track the activity of a worker version among multiple elements """ # Using an UUID helps to execute SQL raw INSERT id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) diff --git a/arkindex/dataimport/providers.py b/arkindex/dataimport/providers.py index 718899a39b..c43d37d8f9 100644 --- a/arkindex/dataimport/providers.py +++ b/arkindex/dataimport/providers.py @@ -211,7 +211,7 @@ class GitLabProvider(GitProvider): raise ValidationError("A repository with this URL already exists") # Determine the user's access level on this project - # When it is inherited from the group and not overriden in the project, project_access is not defined. + # When it is inherited from the group and not overridden in the project, project_access is not defined. # When the project isn't in a group, or the user is added to a specific project in a group, # group_access is not defined. project_access overrides group_access. access_level = 0 @@ -233,7 +233,7 @@ class GitLabProvider(GitProvider): provider_name=self.__class__.__name__, ) - # Create a webhook using informations from the HTTP request + # Create a webhook using information from the HTTP request self.create_hook(repo, project_id=int(id), request=request) return repo diff --git a/arkindex/dataimport/serializers/imports.py b/arkindex/dataimport/serializers/imports.py index cadeb7f46a..e9a3f06c43 100644 --- a/arkindex/dataimport/serializers/imports.py +++ b/arkindex/dataimport/serializers/imports.py @@ -386,7 +386,7 @@ class WorkerRunSerializer(serializers.ModelSerializer): """ parents = serializers.ListField(child=serializers.UUIDField()) worker_version_id = serializers.UUIDField(source='version_id') - # Serialize worker with its basic informations + # Serialize worker with its basic information worker = WorkerLightSerializer(source='version.worker', read_only=True) configuration_id = serializers.PrimaryKeyRelatedField(queryset=WorkerConfiguration.objects.all(), required=False, allow_null=True) @@ -454,7 +454,7 @@ class ImportTranskribusSerializer(serializers.Serializer): class CreateImportTranskribusErrorResponseSerializer(serializers.Serializer): - collection_id = serializers.CharField(required=False, help_text="Errors that occured during collection ID field validation.") + collection_id = serializers.CharField(required=False, help_text="Errors that occurred during collection ID field validation.") class ProcessElementLightSerializer(serializers.ModelSerializer): diff --git a/arkindex/dataimport/serializers/workers.py b/arkindex/dataimport/serializers/workers.py index dc62c7bb6e..ef337a8beb 100644 --- a/arkindex/dataimport/serializers/workers.py +++ b/arkindex/dataimport/serializers/workers.py @@ -46,14 +46,14 @@ class WorkerVersionSerializer(serializers.ModelSerializer): """ Serialize a worker version """ - # State defaults to created when instanciating a WorkerVersion + # State defaults to created when instantiating a WorkerVersion state = EnumField(WorkerVersionState, required=False) worker = WorkerLightSerializer(read_only=True) revision = serializers.UUIDField() element_count = serializers.IntegerField(read_only=True) gpu_usage = EnumField(WorkerVersionGPUUsage, required=False, default=WorkerVersionGPUUsage.Disabled) - # Serialize worker with its basic informations + # Serialize worker with its basic information class Meta: model = WorkerVersion fields = ( diff --git a/arkindex/dataimport/tests/test_imports.py b/arkindex/dataimport/tests/test_imports.py index bc45e9793e..638a6e92a6 100644 --- a/arkindex/dataimport/tests/test_imports.py +++ b/arkindex/dataimport/tests/test_imports.py @@ -428,7 +428,7 @@ class TestImports(FixtureAPITestCase): def test_delete_running(self): """ - It is not possible to delete a runnin import + It is not possible to delete a running import """ self.client.force_login(self.user) self.elts_process.start() @@ -1116,7 +1116,7 @@ class TestImports(FixtureAPITestCase): def test_start_process(self): """ A user can start a process with no parameters. - Defaut chunks, thumbnails and farm are used. Nor cache or workers activity is set. + Default chunks, thumbnails and farm are used. Nor cache or workers activity is set. """ dataimport2 = self.corpus.imports.create(creator=self.user, mode=DataImportMode.Workers) self.assertIsNone(dataimport2.workflow) @@ -1237,7 +1237,7 @@ class TestImports(FixtureAPITestCase): @patch('arkindex.project.triggers.dataimport_tasks.initialize_activity.delay') def test_start_process_options_requires_workers(self, activities_delay_mock, worker_runs_mock): """ - Cache and worker activity options can be trigerred when starting a process + Cache and worker activity options can be triggered when starting a process """ process = self.corpus.imports.create( creator=self.user, diff --git a/arkindex/dataimport/tests/test_workeractivity.py b/arkindex/dataimport/tests/test_workeractivity.py index 5616ef68ef..9a0377a7e6 100644 --- a/arkindex/dataimport/tests/test_workeractivity.py +++ b/arkindex/dataimport/tests/test_workeractivity.py @@ -238,7 +238,7 @@ class TestWorkerActivity(FixtureTestCase): def test_put_activity_forbidden_states(self): """ - Check state update is forbidden for some non consistant cases + Check state update is forbidden for some non consistent cases The response is a HTTP_409_CONFLICT """ queued, started, error, processed = ( diff --git a/arkindex/dataimport/tests/test_workerruns.py b/arkindex/dataimport/tests/test_workerruns.py index b1a0081695..860c549564 100644 --- a/arkindex/dataimport/tests/test_workerruns.py +++ b/arkindex/dataimport/tests/test_workerruns.py @@ -49,7 +49,7 @@ class TestWorkerRuns(FixtureAPITestCase): def test_runs_list_no_execution_right(self): """ - Worker runs attached to a process can be listed even if the user has no execution rigths to workers + Worker runs attached to a process can be listed even if the user has no execution rights to workers This is due to the fact a user can see a process running on a corpus they have access """ self.worker_1.memberships.all().delete() diff --git a/arkindex/dataimport/tests/test_workers.py b/arkindex/dataimport/tests/test_workers.py index 27f46f4eb9..ca3d81fb3c 100644 --- a/arkindex/dataimport/tests/test_workers.py +++ b/arkindex/dataimport/tests/test_workers.py @@ -612,7 +612,7 @@ class TestWorkersWorkerVersions(FixtureAPITestCase): def test_retrieve_version_no_login(self): """ Worker versions may be retrieved with no authentication in order - to see the version on public ressources + to see the version on public resources """ with self.assertNumQueries(5): response = self.client.get(reverse('api:version-retrieve', kwargs={'pk': str(self.version_1.id)})) diff --git a/arkindex/documents/api/elements.py b/arkindex/documents/api/elements.py index a3852e76c7..b93ab14ab7 100644 --- a/arkindex/documents/api/elements.py +++ b/arkindex/documents/api/elements.py @@ -254,7 +254,7 @@ class ElementsListAutoSchema(AutoSchema): * `lt`: Elements having a classification with a confidence strictly lower than the filter. * `lte`: Elements having a classification with a confidence lower than or equal to the filter. * `lt`: Elements having a classification with a confidence strictly greater than the filter. - * `gte`: Elements having a classification with a confidence greather than or equal to the filter. + * `gte`: Elements having a classification with a confidence greater than or equal to the filter. This requires `classification_confidence` to be set. """), @@ -870,7 +870,7 @@ class ElementChildren(ElementsListBase): @extend_schema(tags=['elements']) @extend_schema_view( - get=extend_schema(description="Retrieve a single element's informations and metadata"), + get=extend_schema(description="Retrieve a single element's information and metadata"), patch=extend_schema(description='Rename an element'), put=extend_schema(description="Edit an element's attributes. Requires a write access on the corpus."), delete=extend_schema(description='Delete an element. Requires either an admin access on the corpus, ' @@ -1130,7 +1130,7 @@ class CorpusList(ListCreateAPIView): permission_classes = (IsVerifiedOrReadOnly, ) def get_queryset(self): - # We need to prefetch the acces rights on each corpora + # We need to prefetch the access rights on each corpora accessible_corpora = filter_rights(self.request.user, Corpus, Role.Guest.value) # Keep non duplicated corpora with the max access level diff --git a/arkindex/documents/date_parser.py b/arkindex/documents/date_parser.py index 2f5635eca1..35fe026f50 100644 --- a/arkindex/documents/date_parser.py +++ b/arkindex/documents/date_parser.py @@ -138,7 +138,7 @@ def instanciate_date(date_elt): Returns an unsaved interpreted date from a dictionary containing at least a type (documents.models.DateType) and a year (int) """ - assert isinstance(date_elt, dict), 'A dictionnary is required to instanciate InterpretedDate' + assert isinstance(date_elt, dict), 'A dictionary is required to instantiate InterpretedDate' date = InterpretedDate(**date_elt) try: date.validate() diff --git a/arkindex/documents/deletion.py b/arkindex/documents/deletion.py index 560215e720..ab33ba26ff 100644 --- a/arkindex/documents/deletion.py +++ b/arkindex/documents/deletion.py @@ -11,7 +11,7 @@ def delete_element(element_id: UUID) -> None: with connections['default'].cursor() as cursor: # Remove transcription-entity links cursor.execute(""" - DELETE FROM documents_transcriptionentity te WHERE transcription_id IN ( + DELETE FROM documents_transcriptionentity WHERE transcription_id IN ( SELECT t.id FROM documents_transcription t LEFT JOIN documents_elementpath elementpath USING (element_id) WHERE t.element_id = %(id)s OR elementpath.path && ARRAY[%(id)s] diff --git a/arkindex/documents/migrations/0006_preflight.py b/arkindex/documents/migrations/0006_preflight.py index 9690eeca21..8266824a19 100644 --- a/arkindex/documents/migrations/0006_preflight.py +++ b/arkindex/documents/migrations/0006_preflight.py @@ -9,7 +9,7 @@ class Migration(migrations.Migration): operations = [ # Remove extra regions tied to several elements - # We cant to keep the first region element item to preserve the link + # We can't to keep the first region element item to preserve the link # for the followup migration migrations.RunSQL( """ diff --git a/arkindex/documents/migrations/0034_transcriptionentity_worker_version.py b/arkindex/documents/migrations/0034_transcriptionentity_worker_version.py index 3c163537ad..bf3edc6a04 100644 --- a/arkindex/documents/migrations/0034_transcriptionentity_worker_version.py +++ b/arkindex/documents/migrations/0034_transcriptionentity_worker_version.py @@ -33,10 +33,10 @@ class Migration(migrations.Migration): ), migrations.RunSQL( """ - UPDATE documents_transcriptionentity te + UPDATE documents_transcriptionentity tr_entity SET worker_version_id = entity.worker_version_id FROM documents_entity entity - WHERE te.entity_id = entity.id; + WHERE tr_entity.entity_id = entity.id; """, reverse_sql=migrations.RunSQL.noop, elidable=True, diff --git a/arkindex/documents/serializers/entities.py b/arkindex/documents/serializers/entities.py index 7513b47010..37253b639b 100644 --- a/arkindex/documents/serializers/entities.py +++ b/arkindex/documents/serializers/entities.py @@ -66,7 +66,7 @@ class EntityRoleSerializer(serializers.ModelSerializer): class CreateEntityRoleErrorResponseSerializer(serializers.Serializer): id = serializers.UUIDField(required=False, help_text="The corpus ID.") - corpus = serializers.ListField(child=serializers.CharField(), required=False, help_text="Errors that occured during corpus ID field validation.") + corpus = serializers.ListField(child=serializers.CharField(), required=False, help_text="Errors that occurred during corpus ID field validation.") class EntityLinkSerializer(serializers.ModelSerializer): @@ -252,7 +252,7 @@ class TranscriptionEntitySerializer(serializers.ModelSerializer): class TranscriptionEntityDetailsSerializer(TranscriptionEntitySerializer): """ - Serialize the link between a transcription and a detailled entity + Serialize the link between a transcription and a detailed entity """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/arkindex/documents/serializers/ml.py b/arkindex/documents/serializers/ml.py index a5e6593a78..e93aa75c35 100644 --- a/arkindex/documents/serializers/ml.py +++ b/arkindex/documents/serializers/ml.py @@ -236,7 +236,7 @@ class TranscriptionSerializer(serializers.ModelSerializer): class ElementTranscriptionSerializer(TranscriptionSerializer): """ - Serialises a transcription with its element basic informations (e.g. image zone) + Serialises a transcription with its element basic information (e.g. image zone) """ element = ElementZoneSerializer(allow_null=True) @@ -294,7 +294,7 @@ class TranscriptionCreateSerializer(serializers.ModelSerializer): user = self.context['request'].user if (not user or not user.is_internal): errors['worker_version'] = [ - 'An internal user is required to create a transcription refering to a worker_version' + 'An internal user is required to create a transcription referring to a worker_version' ] if not ('score' in data) ^ ('confidence' in data): @@ -362,7 +362,7 @@ class ElementTranscriptionsBulkSerializer(serializers.Serializer): return_elements = serializers.BooleanField( default=False, help_text=( - 'Return a list of annotations containing an `element` field with basic element informations ' + 'Return a list of annotations containing an `element` field with basic element information ' 'and a `created` field specifying if the element has been created for the annotation. ' 'Elements are ordered corresponding to the `transcriptions` field and may be duplicated.' ) diff --git a/arkindex/documents/tests/test_corpus_elements.py b/arkindex/documents/tests/test_corpus_elements.py index db9c723371..f4f19c6ba9 100644 --- a/arkindex/documents/tests/test_corpus_elements.py +++ b/arkindex/documents/tests/test_corpus_elements.py @@ -141,7 +141,7 @@ class TestListElements(FixtureAPITestCase): """ Ensure the corpus filter allows any UUID, not just version 4 UUIDs. Using the version=x argument on uuid.UUID causes the version and variant bits - of a UUID to be changed on instanciation; since we generate v4 RFC 4122-compliant UUIDs, + of a UUID to be changed on instantiation; since we generate v4 RFC 4122-compliant UUIDs, this would work in most cases - but we could have any UUID version or variant, generated by some other tool, which would cause strange 404 errors. """ diff --git a/arkindex/documents/tests/test_create_transcriptions.py b/arkindex/documents/tests/test_create_transcriptions.py index 5e21010034..339842949e 100644 --- a/arkindex/documents/tests/test_create_transcriptions.py +++ b/arkindex/documents/tests/test_create_transcriptions.py @@ -164,7 +164,7 @@ class TestTranscriptionCreate(FixtureAPITestCase): self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertDictEqual(response.json(), { 'worker_version': [ - 'An internal user is required to create a transcription refering to a worker_version' + 'An internal user is required to create a transcription referring to a worker_version' ] }) diff --git a/arkindex/images/serializers.py b/arkindex/images/serializers.py index 6e01e9e839..52b088d160 100644 --- a/arkindex/images/serializers.py +++ b/arkindex/images/serializers.py @@ -262,7 +262,7 @@ class ZoneLightSerializer(serializers.ModelSerializer): class ZoneSerializer(ZoneLightSerializer): """ - Serialize a complete zone with its computed center, url and image informations + Serialize a complete zone with its computed center, url and image information """ # Override the field to fully serialize the image image = ImageSerializer() diff --git a/arkindex/project/mixins.py b/arkindex/project/mixins.py index 0c35e92498..1f6be3eaa6 100644 --- a/arkindex/project/mixins.py +++ b/arkindex/project/mixins.py @@ -45,7 +45,7 @@ class ACLMixin(object): return instance.memberships.filter( Q( - # Right direcly owned by this user + # Right directly owned by this user Q(user=self.user) & Q(level__gte=level) ) diff --git a/arkindex/project/pagination.py b/arkindex/project/pagination.py index 3e184300ab..c0e1d35943 100644 --- a/arkindex/project/pagination.py +++ b/arkindex/project/pagination.py @@ -40,7 +40,7 @@ class LargePageNumberPagination(PageNumberPagination): class CustomCursorPagination(pagination.CursorPagination): """ A custom cursor pagination class - Count attribute and ordering may be updated when instanciating the class + Count attribute and ordering may be updated when instantiating the class """ count = None page_size = 20 diff --git a/arkindex/project/tests/test_acl_mixin.py b/arkindex/project/tests/test_acl_mixin.py index 388b6cfb33..87e69d31bc 100644 --- a/arkindex/project/tests/test_acl_mixin.py +++ b/arkindex/project/tests/test_acl_mixin.py @@ -234,7 +234,7 @@ class TestACLMixin(FixtureTestCase): ) def test_super_admin_readable_corpora(self): - # A super admin should retrieve all existing corpora with Admin rigths + # A super admin should retrieve all existing corpora with Admin rights corpus_acl_mixin = CorpusACLMixin(user=self.superuser) with self.assertNumQueries(1): corpora = list(corpus_acl_mixin.readable_corpora) @@ -254,7 +254,7 @@ class TestACLMixin(FixtureTestCase): ) def test_corpus_right_and_public(self): - # User specific rigths should be returned instead of the the defaults access for public rigths + # User specific rights should be returned instead of the the defaults access for public rights Right.objects.create(user=self.user3, content_object=self.corpus, level=42) corpus_acl_mixin = CorpusACLMixin(user=self.user3) with self.assertNumQueries(2): diff --git a/arkindex/sql_validation/element_dot_delete.sql b/arkindex/sql_validation/element_dot_delete.sql index 32a41d51ec..adda6939a2 100644 --- a/arkindex/sql_validation/element_dot_delete.sql +++ b/arkindex/sql_validation/element_dot_delete.sql @@ -1,4 +1,4 @@ -DELETE FROM documents_transcriptionentity te WHERE transcription_id IN ( +DELETE FROM documents_transcriptionentity WHERE transcription_id IN ( SELECT t.id FROM documents_transcription t LEFT JOIN documents_elementpath elementpath USING (element_id) WHERE t.element_id = '{id}'::uuid OR elementpath.path && ARRAY['{id}'::uuid] diff --git a/arkindex/users/api.py b/arkindex/users/api.py index f52fef7a6e..f64a62f200 100644 --- a/arkindex/users/api.py +++ b/arkindex/users/api.py @@ -673,7 +673,7 @@ class MembershipDetails(ACLMixin, RetrieveUpdateDestroyAPIView): if not access_level or access_level < Role.Guest.value: raise NotFound - # Allow any guest to retrieve informations + # Allow any guest to retrieve information if self.request.method in SAFE_METHODS: return diff --git a/arkindex/users/models.py b/arkindex/users/models.py index aad579d8b1..cd4707ebd1 100644 --- a/arkindex/users/models.py +++ b/arkindex/users/models.py @@ -21,7 +21,7 @@ class Role(Enum): class Right(models.Model): """ - Defines an access right for users and groups to a generic targed. + Defines an access right for users and groups to a generic target. """ id = models.UUIDField(default=uuid.uuid4, primary_key=True, editable=False) diff --git a/arkindex/users/serializers.py b/arkindex/users/serializers.py index 613d53fca1..0df1bfb172 100644 --- a/arkindex/users/serializers.py +++ b/arkindex/users/serializers.py @@ -141,7 +141,7 @@ class NewUserSerializer(serializers.ModelSerializer): def validate(self, data): data = super().validate(data) - # Instanciate user to validate password + # Instantiate user to validate password user = User(**data) return validate_user_password(user, data) @@ -415,7 +415,7 @@ class MembershipCreateSerializer(MembershipSerializer): if not access_level or access_level < Role.Admin.value: raise ValidationError({'content_id': ['Only members with an admin privilege are allowed to add other members.']}) - # Special restriction for group memerships + # Special restriction for group memberships if content_model is Group and group_id is not None: raise ValidationError({'group_id': ['It is not possible to create a membership between two groups.']}) diff --git a/arkindex/users/tests/test_generic_memberships.py b/arkindex/users/tests/test_generic_memberships.py index 6df7da6fdc..59eb38910b 100644 --- a/arkindex/users/tests/test_generic_memberships.py +++ b/arkindex/users/tests/test_generic_memberships.py @@ -307,7 +307,7 @@ class TestMembership(FixtureAPITestCase): def test_retrieve_group_no_member(self): """ - A non memeber of a group may not retrieve its details, even if it is public + A non member of a group may not retrieve its details, even if it is public """ self.client.force_login(self.user) with self.assertNumQueries(5): @@ -773,7 +773,7 @@ class TestMembership(FixtureAPITestCase): def test_retrieve_membership_not_found(self): """ - Only memberships on groups the user has a read acces can be retrieved + Only memberships on groups the user has a read access can be retrieved """ hidden_group = Group.objects.create(name='Hidden group', public=False) hidden_member = hidden_group.add_member(user=self.admin, level=Role.Guest.value) -- GitLab