Skip to content

Commit

Permalink
Misc: Remove object inheritance
Browse files Browse the repository at this point in the history
It is not needed with Python 3.

Issue #2201
  • Loading branch information
nijel committed Feb 20, 2020
1 parent 491df0a commit 154f76c
Show file tree
Hide file tree
Showing 69 changed files with 126 additions and 126 deletions.
2 changes: 1 addition & 1 deletion weblate/accounts/captcha.py
Expand Up @@ -33,7 +33,7 @@
OPERATORS = {ast.Add: operator.add, ast.Sub: operator.sub, ast.Mult: operator.mul}


class MathCaptcha(object):
class MathCaptcha:
"""Simple match captcha object."""

operators = ('+', '-', '*')
Expand Down
12 changes: 6 additions & 6 deletions weblate/accounts/forms.py
Expand Up @@ -66,7 +66,7 @@
)


class UniqueEmailMixin(object):
class UniqueEmailMixin:
validate_unique_mail = False

def clean_email(self):
Expand Down Expand Up @@ -162,7 +162,7 @@ def from_request(cls, request):
class ProfileForm(ProfileBaseForm):
"""User profile editing."""

class Meta(object):
class Meta:
model = Profile
fields = ('language', 'languages', 'secondary_languages')
widgets = {
Expand All @@ -185,7 +185,7 @@ def __init__(self, *args, **kwargs):
class SubscriptionForm(ProfileBaseForm):
"""User watched projects management."""

class Meta(object):
class Meta:
model = Profile
fields = ('watched',)
widgets = {'watched': forms.SelectMultiple}
Expand All @@ -204,7 +204,7 @@ def __init__(self, *args, **kwargs):
class UserSettingsForm(ProfileBaseForm):
"""User settings form."""

class Meta(object):
class Meta:
model = Profile
fields = (
'hide_completed',
Expand All @@ -226,7 +226,7 @@ def __init__(self, *args, **kwargs):
class DashboardSettingsForm(ProfileBaseForm):
"""Dashboard settings form."""

class Meta(object):
class Meta:
model = Profile
fields = ('dashboard_view', 'dashboard_component_list')
widgets = {'dashboard_view': forms.RadioSelect}
Expand All @@ -250,7 +250,7 @@ class UserForm(forms.ModelForm):
)
full_name = FullNameField()

class Meta(object):
class Meta:
model = User
fields = ('username', 'full_name', 'email')

Expand Down
4 changes: 2 additions & 2 deletions weblate/accounts/middleware.py
Expand Up @@ -48,7 +48,7 @@ def get_user(request):
return request._cached_user


class AuthenticationMiddleware(object):
class AuthenticationMiddleware:
"""Copy of django.contrib.auth.middleware.AuthenticationMiddleware."""

def __init__(self, get_response=None):
Expand All @@ -59,7 +59,7 @@ def __call__(self, request):
return self.get_response(request)


class RequireLoginMiddleware(object):
class RequireLoginMiddleware:
"""Middleware that applies the login_required decorator to matching URL patterns.
To use, add the class to MIDDLEWARE and
Expand Down
4 changes: 2 additions & 2 deletions weblate/accounts/models.py
Expand Up @@ -63,7 +63,7 @@ class Subscription(models.Model):
'trans.Component', on_delete=models.deletion.CASCADE, null=True
)

class Meta(object):
class Meta:
unique_together = [('notification', 'scope', 'project', 'component', 'user')]

def __str__(self):
Expand Down Expand Up @@ -593,5 +593,5 @@ class WeblateAccountsConf(AppConf):
r'/legal/(.*)$', # Optional for legal app
)

class Meta(object):
class Meta:
prefix = ''
2 changes: 1 addition & 1 deletion weblate/accounts/notifications.py
Expand Up @@ -84,7 +84,7 @@ def register_notification(handler):
return handler


class Notification(object):
class Notification:
actions = ()
verbose = ''
template_name = None
Expand Down
4 changes: 2 additions & 2 deletions weblate/accounts/password_validation.py
Expand Up @@ -26,7 +26,7 @@
from weblate.accounts.models import AuditLog


class CharsPasswordValidator(object):
class CharsPasswordValidator:
"""Validate whether the password is not only whitespace or single char."""

def validate(self, password, user=None):
Expand All @@ -50,7 +50,7 @@ def get_help_text(self):
)


class PastPasswordsValidator(object):
class PastPasswordsValidator:
"""Validate whether the password was not used before."""

def validate(self, password, user=None):
Expand Down
2 changes: 1 addition & 1 deletion weblate/addons/base.py
Expand Up @@ -44,7 +44,7 @@
from weblate.utils.validators import validate_filename


class BaseAddon(object):
class BaseAddon:
events = ()
settings_form = None
name = None
Expand Down
2 changes: 1 addition & 1 deletion weblate/addons/forms.py
Expand Up @@ -34,7 +34,7 @@
from weblate.utils.validators import validate_filename, validate_re


class AddonFormMixin(object):
class AddonFormMixin:
def serialize_form(self):
return self.cleaned_data

Expand Down
4 changes: 2 additions & 2 deletions weblate/addons/models.py
Expand Up @@ -125,7 +125,7 @@ class Event(models.Model):
addon = models.ForeignKey(Addon, on_delete=models.deletion.CASCADE)
event = models.IntegerField(choices=EVENT_CHOICES)

class Meta(object):
class Meta:
unique_together = ('addon', 'event')

def __str__(self):
Expand Down Expand Up @@ -158,7 +158,7 @@ class AddonsConf(AppConf):
'weblate.addons.yaml.YAMLCustomizeAddon',
)

class Meta(object):
class Meta:
prefix = 'WEBLATE'


Expand Down
18 changes: 9 additions & 9 deletions weblate/api/serializers.py
Expand Up @@ -82,7 +82,7 @@ def __init__(self, *args, **kwargs):
class LanguageSerializer(serializers.ModelSerializer):
web_url = AbsoluteURLField(source='get_absolute_url', read_only=True)

class Meta(object):
class Meta:
model = Language
fields = ('code', 'name', 'direction', 'web_url', 'url')
extra_kwargs = {
Expand All @@ -109,7 +109,7 @@ class ProjectSerializer(serializers.ModelSerializer):
view_name='api:project-languages', lookup_field='slug'
)

class Meta(object):
class Meta:
model = Project
fields = (
'name',
Expand Down Expand Up @@ -165,7 +165,7 @@ class ComponentSerializer(RemovableSerializer):

serializer_url_field = MultiFieldHyperlinkedIdentityField

class Meta(object):
class Meta:
model = Component
fields = (
'name',
Expand Down Expand Up @@ -269,7 +269,7 @@ class TranslationSerializer(RemovableSerializer):

serializer_url_field = MultiFieldHyperlinkedIdentityField

class Meta(object):
class Meta:
model = Translation
fields = (
'language',
Expand Down Expand Up @@ -325,7 +325,7 @@ def create(self, validated_data):


class LockSerializer(serializers.ModelSerializer):
class Meta(object):
class Meta:
model = Component
fields = ('locked',)

Expand Down Expand Up @@ -389,7 +389,7 @@ class UnitSerializer(RemovableSerializer):
strip_parts=1,
)

class Meta(object):
class Meta:
model = Unit
fields = (
'translation',
Expand Down Expand Up @@ -430,7 +430,7 @@ class ScreenshotSerializer(RemovableSerializer):
many=True, read_only=True, view_name='api:unit-detail'
)

class Meta(object):
class Meta:
model = Screenshot
fields = ('name', 'component', 'file_url', 'units', 'url')
extra_kwargs = {'url': {'view_name': 'api:screenshot-detail'}}
Expand All @@ -439,7 +439,7 @@ class Meta(object):
class ScreenshotFileSerializer(serializers.ModelSerializer):
image = serializers.ImageField(validators=[validate_bitmap])

class Meta(object):
class Meta:
model = Screenshot
fields = ('image',)
extra_kwargs = {'url': {'view_name': 'api:screenshot-file'}}
Expand All @@ -465,7 +465,7 @@ class ChangeSerializer(RemovableSerializer):
read_only=True, view_name='api:unit-detail'
)

class Meta(object):
class Meta:
model = Change
fields = (
'unit',
Expand Down
2 changes: 1 addition & 1 deletion weblate/api/views.py
Expand Up @@ -112,7 +112,7 @@ def get_view_description(view_cls, html=False):
return description


class MultipleFieldMixin(object):
class MultipleFieldMixin:
"""Multiple field filtering mixin.
Apply this mixin to any view or viewset to get multiple field filtering based on a
Expand Down
2 changes: 1 addition & 1 deletion weblate/auth/admin.py
Expand Up @@ -79,7 +79,7 @@ def __init__(self, *args, **kwargs):
class WeblateUserCreationForm(UserCreationForm, UniqueEmailMixin):
validate_unique_mail = True

class Meta(object):
class Meta:
model = User
fields = ('username', 'email', 'full_name')
field_classes = {'username': UsernameField, 'full_name': FullNameField}
Expand Down
6 changes: 3 additions & 3 deletions weblate/auth/models.py
Expand Up @@ -67,7 +67,7 @@ class Permission(models.Model):
codename = models.CharField(max_length=100, unique=True)
name = models.CharField(max_length=200)

class Meta(object):
class Meta:
verbose_name = _('Permission')
verbose_name_plural = _('Permissions')

Expand Down Expand Up @@ -494,7 +494,7 @@ class AutoGroup(models.Model):
Group, verbose_name=_('Group to assign'), on_delete=models.deletion.CASCADE
)

class Meta(object):
class Meta:
verbose_name = _('Automatic group assignment')
verbose_name_plural = _('Automatic group assignments')

Expand Down Expand Up @@ -659,5 +659,5 @@ class WeblateAuthConf(AppConf):
# Anonymous user name
ANONYMOUS_USER_NAME = 'anonymous'

class Meta(object):
class Meta:
prefix = ''
2 changes: 1 addition & 1 deletion weblate/checks/base.py
Expand Up @@ -23,7 +23,7 @@
from weblate.utils.docs import get_doc_url


class Check(object):
class Check:
"""Basic class for checks."""

check_id = ''
Expand Down
2 changes: 1 addition & 1 deletion weblate/checks/flags.py
Expand Up @@ -61,7 +61,7 @@
IGNORE_CHECK_FLAGS = {CHECKS[x].ignore_string for x in CHECKS}


class Flags(object):
class Flags:
def __init__(self, *args):
self._items = {}
self._values = {}
Expand Down
4 changes: 2 additions & 2 deletions weblate/checks/models.py
Expand Up @@ -85,7 +85,7 @@ class WeblateChecksConf(AppConf):
'weblate.checks.source.MultipleFailingCheck',
)

class Meta(object):
class Meta:
prefix = ''


Expand All @@ -101,7 +101,7 @@ def check_obj(self):
except KeyError:
return None

class Meta(object):
class Meta:
unique_together = ('unit', 'check')

def __str__(self):
Expand Down
10 changes: 5 additions & 5 deletions weblate/checks/tests/test_checks.py
Expand Up @@ -31,15 +31,15 @@
class MockLanguage(Language):
"""Mock language object."""

class Meta(object):
class Meta:
proxy = True

def __init__(self, code='cs'):
super(MockLanguage, self).__init__(code=code)
self.plural = Plural(language=self)


class MockProject(object):
class MockProject:
"""Mock project object."""

def __init__(self):
Expand All @@ -48,15 +48,15 @@ def __init__(self):
self.use_shared_tm = True


class MockComponent(object):
class MockComponent:
"""Mock component object."""

def __init__(self):
self.id = 1
self.project = MockProject()


class MockTranslation(object):
class MockTranslation:
"""Mock translation object."""

def __init__(self, code='cs'):
Expand All @@ -66,7 +66,7 @@ def __init__(self, code='cs'):
self.is_source = False


class MockUnit(object):
class MockUnit:
"""Mock unit object."""

def __init__(self, id_hash=None, flags='', code='cs', source='', note=''):
Expand Down
6 changes: 3 additions & 3 deletions weblate/fonts/forms.py
Expand Up @@ -25,13 +25,13 @@


class FontForm(forms.ModelForm):
class Meta(object):
class Meta:
model = Font
fields = ("font",)


class FontGroupForm(forms.ModelForm):
class Meta(object):
class Meta:
model = FontGroup
fields = ("name", "font")

Expand All @@ -43,6 +43,6 @@ def __init__(self, data=None, project=None, **kwargs):


class FontOverrideForm(forms.ModelForm):
class Meta(object):
class Meta:
model = FontOverride
fields = ("language", "font")

0 comments on commit 154f76c

Please sign in to comment.