Skip to content

Commit 09d80be

Browse files
committed
Run code-quality tools
1 parent 7ee698b commit 09d80be

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

project/creditor/management/commands/update_membershipfees.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import datetime
3-
import dateutil.parser
43

4+
import dateutil.parser
55
from creditor.models import RecurringTransaction, TransactionTag
66
from creditor.tests.fixtures.recurring import MembershipfeeFactory
77
from django.core.management.base import BaseCommand, CommandError
@@ -26,7 +26,7 @@ def handle(self, *args, **options):
2626
end=None,
2727
start__lt=cutoff_dt,
2828
amount=options['oldamount']
29-
):
29+
):
3030
rt.end = end_dt
3131
rt.save()
3232
newrt = MembershipfeeFactory.create(amount=options['newamount'], start=cutoff_dt, end=None, owner=rt.owner)

project/creditor/tests/fixtures/recurring.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
from .tags import TransactionTagFactory
1111

12+
1213
def get_tag():
1314
if TransactionTag.objects.count():
1415
return factory.fuzzy.FuzzyChoice(TransactionTag.objects.all())
1516
return factory.SubFactory(TransactionTagFactory, label='Membership fee', tmatch='1')
1617

18+
1719
class RecurringTransactionFactory(factory.django.DjangoModelFactory):
1820

1921
class Meta:

project/examples/handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ def import_generic_transaction(self, at, lt):
166166
return lt
167167

168168
def import_tmatch_transaction(self, at, lt):
169-
if len(at.reference) < 2: # To avoid indexerrors
169+
if len(at.reference) < 2: # To avoid indexerrors
170170
return None
171-
if at.reference[0:2] == "RF": # ISO references, our lookup won't work with them, even worse: there will be exceptions
171+
if at.reference[0:2] == "RF": # ISO references, our lookup won't work with them, even worse: there will be exceptions
172172
return None
173173
# In this example the last meaningful number (last number is checksum) of the reference is used to recognize the TransactionTag
174174
try:

project/ndaparser/models.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
# -*- coding: utf-8 -*-
22
import datetime
3-
import slugify as unicodeslugify
43

5-
from django.db import models, transaction
4+
import slugify as unicodeslugify
65
from django.conf import settings
76
from django.contrib.auth import get_user_model
7+
from django.db import models, transaction
88
from django.utils.translation import ugettext_lazy as _
99

10-
1110
from asylum.models import AsylumModel
1211

1312

14-
1513
def get_sentinel_user():
1614
"""Gets a "sentinel" user ("deleted") and for assigning as uploader"""
1715
return get_user_model().objects.get_or_create(username='deleted')[0]
1816

1917

20-
2118
def datestamped_and_normalized(instance, filename):
2219
"""Normalized filename and places in datestamped path"""
2320
file_parts = filename.split('.')
@@ -34,7 +31,6 @@ def datestamped_and_normalized(instance, filename):
3431
return datetime.datetime.now().strftime("ndaparser/%Y/%m/%d/{}").format(filename_normalized)
3532

3633

37-
3834
class UploadedTransaction(AsylumModel):
3935
"""Track uploaded transaction files"""
4036
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_sentinel_user))
@@ -45,4 +41,4 @@ class UploadedTransaction(AsylumModel):
4541
class Meta:
4642
verbose_name = _('Uploaded transaction')
4743
verbose_name_plural = _('Uploaded transaction')
48-
ordering = [ '-stamp' ]
44+
ordering = ['-stamp']

project/ndaparser/views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
from .forms import UploadForm
99
from .importer import NDAImporter
10-
from .parser import parseLine
1110
from .models import UploadedTransaction
11+
from .parser import parseLine
1212

1313

1414
class NordeaUploadView(FormView):
@@ -38,7 +38,7 @@ def form_valid(self, form):
3838
last_stamp = None
3939
with open(tmp.name) as fp:
4040
for line in fp:
41-
nt = parseLine(line)
41+
nt = parseLine(line)
4242
if not nt:
4343
continue
4444
if not last_stamp:
@@ -47,9 +47,9 @@ def form_valid(self, form):
4747
last_stamp = nt.timestamp
4848

4949
UploadedTransaction(
50-
last_transaction = last_stamp,
51-
file = self.request.FILES['ndafile'],
52-
user = self.request.user
50+
last_transaction=last_stamp,
51+
file=self.request.FILES['ndafile'],
52+
user=self.request.user
5353
).save()
5454

5555
# Done with the temp file, get rid of it

0 commit comments

Comments
 (0)