Skip to content

Commit

Permalink
fix pylint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandernst committed Jul 4, 2024
1 parent bcb99bc commit 5633625
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -22,4 +22,4 @@ jobs:
python setup.py install
- name: Analysing the code with pylint
run: |
pylint --rcfile=.pylintrc $(git ls-files '*.py')
pylint --rcfile=.pylintrc $(git ls-files '*.py')
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions django_walletpass/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -69,13 +68,16 @@ class PassAdmin(admin.ModelAdmin):
def wallet_pass_(self, obj: Pass):
if obj.data:
return format_html(
Template(
"{% load static %}<a href='{url}' alt='{title}'><img src='{% static 'admin/passbook_icon.svg' %}'/></a>"
).render(Context({})),
Template('''
{% load static %}
<a href='{url}' alt='{title}'>
<img src='{% static 'admin/passbook_icon.svg' %}'/>
</a>
''').render(Context({})),
url=obj.data.url,
title=obj.data.name,
)
return
return ""

wallet_pass_.short_description = "Pass"

Expand All @@ -90,15 +92,14 @@ 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(
"<a href='{url}'>{title}</a>",
url=url,
title=obj.pazz.serial_number,
)
return
return ""

pass_.short_description = "Pass"
6 changes: 4 additions & 2 deletions django_walletpass/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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):
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion django_walletpass/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.urls import re_path, path
from django.urls import re_path
from . import classviews

urlpatterns = [
Expand Down

0 comments on commit 5633625

Please sign in to comment.