Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • arkindex/backend
1 result
Show changes
Commits on Source (2)
......@@ -16,7 +16,7 @@ class DatePrecision(Enum):
Day = "d"
class InterpretedDate(object):
class InterpretedDate:
def __init__(self, year, month=None, day=None, type=DateType.Exact):
self.year = int(year)
......@@ -73,7 +73,7 @@ class InterpretedDate(object):
return "-".join("{:02d}".format(e) for e in tuple(self) if e)
class InterpretedDateMixin(object):
class InterpretedDateMixin:
"""
Adds on-demand date parsing from a text field to InterpretedDates.
Requires a `raw_dates` property that returns the date string.
......
......@@ -59,7 +59,7 @@ INNER JOIN documents_elementtype elementtype ON (element.type_id = elementtype.i
"""
class Indexer(object):
class Indexer:
# The query yielding all the elements to run on will look for all the child elements of all indexable elements
# The joins can take a very long time, so the query gets split into one to fetch all the indexable elements,
......
......@@ -358,7 +358,7 @@ class TestEditElementPath(FixtureTestCase):
# B will only have one remaining path: the first path that got picked by remove_child for the update.
# The other path will have been deleted. We can therefore get this remaining path and compare it by its ID
# to the two paths that we had before, and pick the parent that was in the old version of this path.
class FirstParent(object):
class FirstParent:
def __str__(self):
path_id = elements["B"].paths.get().id
if path1.id == path_id:
......
......@@ -56,7 +56,7 @@ class Base64Field(serializers.CharField):
return base64.b64encode(obj)
class CurrentProcessDefault(object):
class CurrentProcessDefault:
"""
Use the process of the currently authenticated task as a default value.
If Ponos task authentication is not in use, returns None.
......
......@@ -270,7 +270,7 @@ class ProcessList(ProcessACLMixin, ListAPIView):
return qs.order_by("-date_order")
class ProcessQuerysetMixin(object):
class ProcessQuerysetMixin:
"""
Optimized queryset for Retrieve/Update/PartialUpdate/Destroy/RetryProcess
"""
......
......@@ -16,7 +16,7 @@ from arkindex.images.models import ImageServer
from arkindex.ponos.models import GPU, Task, task_token_default
class ProcessBuilder(object):
class ProcessBuilder:
def __init__(self, process) -> None:
self.process = process
......
......@@ -7,7 +7,7 @@ from arkindex.process.models import Process, Repository, WorkerVersion
from arkindex.users.models import User
class ModelArgument(object):
class ModelArgument:
model = None
text_search_field = "name"
text_search_lookup = "icontains"
......
......@@ -88,7 +88,7 @@ def _retry_delete_predicate(exception):
)
class S3FileMixin(object):
class S3FileMixin:
def get_s3_object(self):
if not self.s3_bucket or not self.s3_key:
......
......@@ -127,7 +127,7 @@ class LastItemTransform(Transform):
return self.base_field
class LastItemTransformFactory(object):
class LastItemTransformFactory:
"""
Create a LastItemTransform with a given base field
"""
......
......@@ -13,7 +13,7 @@ from arkindex.users.models import Role
from arkindex.users.utils import filter_rights, get_max_level, has_access
class ACLMixin(object):
class ACLMixin:
"""
Access control mixin using the generic Right table.
"""
......@@ -140,7 +140,7 @@ class ProcessACLMixin(ACLMixin):
return get_max_level(self.user, process.corpus)
class SelectionMixin(object):
class SelectionMixin:
def get_selection(self, corpus_id=None):
assert settings.ARKINDEX_FEATURES["selection"], "Selection feature is unavailable"
......@@ -165,7 +165,7 @@ class DeprecatedAPIException(APIException):
default_code = "deprecated"
class DeprecatedMixin(object):
class DeprecatedMixin:
# Add this mixin to an APIView to make it deprecated.
serializer_class = DeprecatedExceptionSerializer
......@@ -196,7 +196,7 @@ class DeprecatedMixin(object):
raise DeprecatedAPIException(detail=getattr(self, "deprecation_message", None))
class CachedViewMixin(object):
class CachedViewMixin:
"""
Add this mixin to any class-based view to cache it.
"""
......
......@@ -96,7 +96,7 @@ class _AssertExactQueriesContext(CaptureQueriesContext):
self.test_case.assertEqual(expected_sql, actual_sql)
class FixtureMixin(object):
class FixtureMixin:
"""
Add the database fixture to a test case
"""
......
......@@ -2,7 +2,7 @@ from django.core import validators
from rest_framework import serializers
class XorValidator(object):
class XorValidator:
"""
A generic validator for when two fields can't be used simultaneously
"""
......@@ -45,7 +45,7 @@ class ConditionalUniqueValidator(serializers.UniqueTogetherValidator):
return super().__call__(attrs, serializer)
class ForbiddenValidator(object):
class ForbiddenValidator:
"""
A validator that will show an error message any time a value is set.
......@@ -65,7 +65,7 @@ class ForbiddenValidator(object):
raise serializers.ValidationError(self.message)
class HiddenCallableValidatorMixin(object):
class HiddenCallableValidatorMixin:
"""
Implements a workaround for some issues with error messages in DRF
and with drf-spectacular OpenAPI schema generation when the `limit_value`
......
......@@ -10,7 +10,7 @@ from rq.job import JobStatus
from arkindex.project.tests import FixtureAPITestCase
class MockedJob(object):
class MockedJob:
def __init__(self, id=None, user_id=None, status=JobStatus.QUEUED, **kwargs):
self.id = id or str(uuid4())
......@@ -32,7 +32,7 @@ class MockedJob(object):
@classmethod
def key_for(cls, id):
return f"rq:job:{id}".encode("utf-8")
return f"rq:job:{id}".encode()
class TestJobs(FixtureAPITestCase):
......
......@@ -25,6 +25,10 @@ select = [
"RET",
# eradicate
"ERA",
# useless-object-inheritance
"UP004",
# unnecessary-encode-utf8
"UP012",
]
ignore = ["E501", "RET502", "RET503"]
......