diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 26a95c0..75d6199 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10"] + python-version: ["3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -22,4 +22,4 @@ jobs: python setup.py install - name: Analysing the code with pylint run: | - pylint --rcfile=.pylintrc $(git ls-files '*.py') \ No newline at end of file + pylint --rcfile=.pylintrc $(git ls-files '*.py') diff --git a/.pylintrc b/.pylintrc index 21038f4..bf58994 100644 --- a/.pylintrc +++ b/.pylintrc @@ -447,7 +447,7 @@ max-bool-expr=5 max-branches=12 # Maximum number of locals for function / method body. -max-locals=15 +max-locals=20 # Maximum number of parents for a class (see R0901). max-parents=15 diff --git a/django_walletpass/admin.py b/django_walletpass/admin.py index f9a53e9..fff6cd1 100644 --- a/django_walletpass/admin.py +++ b/django_walletpass/admin.py @@ -34,8 +34,7 @@ class LogAdmin(admin.ModelAdmin): def pass_(self, obj: Log): if obj.pazz_id: url = reverse( - "admin:%s_%s_change" - % (obj.pazz._meta.app_label, obj.pazz._meta.model_name), + f"admin:{obj.pazz._meta.app_label}_{obj.pazz._meta.model_name}_change", args=[obj.pazz_id], ) return format_html( @@ -69,13 +68,16 @@ class PassAdmin(admin.ModelAdmin): def wallet_pass_(self, obj: Pass): if obj.data: return format_html( - Template( - "{% load static %}" - ).render(Context({})), + Template(''' + {% load static %} + + + + ''').render(Context({})), url=obj.data.url, title=obj.data.name, ) - return + return "" wallet_pass_.short_description = "Pass" @@ -90,8 +92,7 @@ class RegistrationAdmin(admin.ModelAdmin): def pass_(self, obj: Registration): if obj.pazz_id: url = reverse( - "admin:%s_%s_change" - % (obj.pazz._meta.app_label, obj.pazz._meta.model_name), + f"admin:{obj.pazz._meta.app_label}_{obj.pazz._meta.model_name}_change", args=[obj.pazz_id], ) return format_html( @@ -99,6 +100,6 @@ def pass_(self, obj: Registration): url=url, title=obj.pazz.serial_number, ) - return + return "" pass_.short_description = "Pass" diff --git a/django_walletpass/models.py b/django_walletpass/models.py index d35a95f..89f9aab 100644 --- a/django_walletpass/models.py +++ b/django_walletpass/models.py @@ -293,7 +293,7 @@ def __unicode__(self): return self.serial_number def __str__(self): - return self.serial_number + return str(self.serial_number) class Meta: verbose_name_plural = "passes" @@ -319,7 +319,7 @@ def __unicode__(self): return self.device_library_identifier def __str__(self): - return self.device_library_identifier + return str(self.device_library_identifier) class Log(models.Model): @@ -345,10 +345,12 @@ def __str__(self): @classmethod def parse_log(cls, log, message): + # pylint: disable=line-too-long pattern_register = r"\[(.*?)\]\s(.*?)\s\(for device (.*?), pass type (.*?), serial number (.*?); with web service url (.*?)\)\s(.*?): (.*$)" pattern_get = r"\[(.*?)\]\s(.*?)\s\(pass type (.*?), serial number (.*?), if-modified-since \(.*?\); with web service url (.*?)\) (.*?): (.*$)" pattern_web_service_error = r"\[(.*?)\]\s(.*?)\sfor (.*?)\s\((.*?)\):\s(.*$)" pattern_get_warning = r"\[(.*?)\]\s(.*?)\s\(pass type (.*?), serial number (.*?), if-modified-since \(.*?\); with web service url (.*?)\) (.*?): (.*\.)\s(.*$)" + # pylint: disable=line-too-long match_register = re.match(pattern_register, message) match_get = re.match(pattern_get, message) diff --git a/django_walletpass/urls.py b/django_walletpass/urls.py index 883bbfa..53028e4 100644 --- a/django_walletpass/urls.py +++ b/django_walletpass/urls.py @@ -1,4 +1,4 @@ -from django.urls import re_path, path +from django.urls import re_path from . import classviews urlpatterns = [