Skip to content

Commit

Permalink
Merge pull request #2046 from Ayrx/style-nits
Browse files Browse the repository at this point in the history
Change ' to ".
  • Loading branch information
alex committed Jun 19, 2015
2 parents 77e4739 + 52c416b commit 325453c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/cryptography/hazmat/primitives/twofactor/hotp.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ def _dynamic_truncate(self, counter):
return struct.unpack(">I", p)[0] & 0x7fffffff

def get_provisioning_uri(self, account_name, counter, issuer):
return _generate_uri(self, 'hotp', account_name, issuer, [
('counter', int(counter)),
return _generate_uri(self, "hotp", account_name, issuer, [
("counter", int(counter)),
])
4 changes: 2 additions & 2 deletions src/cryptography/hazmat/primitives/twofactor/totp.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ def verify(self, totp, time):
raise InvalidToken("Supplied TOTP value does not match.")

def get_provisioning_uri(self, account_name, issuer):
return _generate_uri(self._hotp, 'totp', account_name, issuer, [
('period', int(self._time_step)),
return _generate_uri(self._hotp, "totp", account_name, issuer, [
("period", int(self._time_step)),
])
16 changes: 8 additions & 8 deletions src/cryptography/hazmat/primitives/twofactor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@

def _generate_uri(hotp, type_name, account_name, issuer, extra_parameters):
parameters = [
('digits', hotp._length),
('secret', base64.b32encode(hotp._key)),
('algorithm', hotp._algorithm.name.upper()),
("digits", hotp._length),
("secret", base64.b32encode(hotp._key)),
("algorithm", hotp._algorithm.name.upper()),
]

if issuer is not None:
parameters.append(('issuer', issuer))
parameters.append(("issuer", issuer))

parameters.extend(extra_parameters)

uriparts = {
'type': type_name,
'label': ('%s:%s' % (quote(issuer), quote(account_name)) if issuer
"type": type_name,
"label": ("%s:%s" % (quote(issuer), quote(account_name)) if issuer
else quote(account_name)),
'parameters': urlencode(parameters),
"parameters": urlencode(parameters),
}
return 'otpauth://{type}/{label}?{parameters}'.format(**uriparts)
return "otpauth://{type}/{label}?{parameters}".format(**uriparts)

0 comments on commit 325453c

Please sign in to comment.