[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] 04/04: linting
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] 04/04: linting |
Date: |
Fri, 03 Nov 2017 17:53:41 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
commit c685201ae74d0bb65e1e9c98deaf21da49d0dd7a
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Nov 3 17:53:26 2017 +0100
linting
---
talerbank/app/amount.py | 44 ++++++++++++++++++++++----------------------
talerbank/app/urls.py | 4 +++-
2 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/talerbank/app/amount.py b/talerbank/app/amount.py
index 9a6318a..6c17610 100644
--- a/talerbank/app/amount.py
+++ b/talerbank/app/amount.py
@@ -42,12 +42,12 @@ class Amount:
def __init__(self, currency, value=0, fraction=0):
# type: (str, int, int) -> Amount
- assert(value >= 0 and fraction >= 0)
+ assert value >= 0 and fraction >= 0
self.value = value
self.fraction = fraction
self.currency = currency
self.__normalize()
- assert(self.value <= Amount.MAX_VALUE())
+ assert self.value <= Amount.MAX_VALUE()
# Normalize amount
def __normalize(self):
@@ -59,7 +59,7 @@ class Amount:
# instantiating an amount object.
@classmethod
def parse(cls, amount_str):
- exp = '^\s*([-_*A-Za-z0-9]+):([0-9]+)\.([0-9]+)\s*$'
+ exp = r'^\s*([-_*A-Za-z0-9]+):([0-9]+)\.([0-9]+)\s*$'
import re
parsed = re.search(exp, amount_str)
if not parsed:
@@ -75,16 +75,16 @@ class Amount:
# 0 if a == b
# 1 if a > b
@staticmethod
- def cmp(a, b):
- if a.currency != b.currency:
+ def cmp(am1, am2):
+ if am1.currency != am2.currency:
raise CurrencyMismatch()
- if a.value == b.value:
- if a.fraction < b.fraction:
+ if am1.value == am2.value:
+ if am1.fraction < am2.fraction:
return -1
- if a.fraction > b.fraction:
+ if am1.fraction > am2.fraction:
return 1
return 0
- if a.value < b.value:
+ if am1.value < am2.value:
return -1
return 1
@@ -94,34 +94,34 @@ class Amount:
self.fraction = fraction
# Add the given amount to this one
- def add(self, a):
- if self.currency != a.currency:
+ def add(self, amount):
+ if self.currency != amount.currency:
raise CurrencyMismatch()
- self.value += a.value
- self.fraction += a.fraction
+ self.value += amount.value
+ self.fraction += amount.fraction
self.__normalize()
# Subtract passed amount from this one
- def subtract(self, a):
- if self.currency != a.currency:
+ def subtract(self, amount):
+ if self.currency != amount.currency:
raise CurrencyMismatch()
- if self.fraction < a.fraction:
+ if self.fraction < amount.fraction:
self.fraction += Amount.FRACTION()
self.value -= 1
- if self.value < a.value:
+ if self.value < amount.value:
raise ValueError('self is lesser than amount to be subtracted')
- self.value -= a.value
- self.fraction -= a.fraction
+ self.value -= amount.value
+ self.fraction -= amount.fraction
# Dump string from this amount, will put 'ndigits' numbers
# after the dot.
def stringify(self, ndigits):
assert ndigits > 0
ret = '%s:%s.' % (self.currency, str(self.value))
- f = self.fraction
+ fraction = self.fraction
for i in range(0, ndigits):
- ret += str(int(f / (Amount.FRACTION() / 10)))
- f = (f * 10) % (Amount.FRACTION())
+ ret += str(int(fraction / (Amount.FRACTION() / 10)))
+ fraction = (fraction * 10) % (Amount.FRACTION())
return ret
# Dump the Taler-compliant 'dict' amount
diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index 667366c..7578d81 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -31,7 +31,9 @@ urlpatterns = [
url(r'^history$', views.history, name="history"),
url(r'^withdraw$', views.withdraw_nojs, name="withdraw-nojs"),
url(r'^public-accounts$', views.public_accounts, name="public-accounts"),
- url(r'^public-accounts/(?P<name>[a-zA-Z0-9 ]+)$', views.public_accounts,
name="public-accounts"),
+ url(r'^public-accounts/(?P<name>[a-zA-Z0-9 ]+)$',
+ views.public_accounts,
+ name="public-accounts"),
url(r'^pin/question$', views.pin_tan_question, name="pin-question"),
url(r'^pin/verify$', views.pin_tan_verify, name="pin-verify"),
url(r'^javascript$', views.javascript_licensing)
--
To stop receiving notification emails like this one, please contact
address@hidden