Skip to content

Commit 2072bb3

Browse files
committed
SDK-350: Run code formatter
1 parent a276995 commit 2072bb3

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
lines changed

yoti_python_sdk/activity_details.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import collections
33
import json
44

5-
from yoti_python_sdk.anchor import Anchor
65
from yoti_python_sdk import config, attribute
6+
from yoti_python_sdk.anchor import Anchor
77
from yoti_python_sdk.protobuf.v1.protobuf import Protobuf
88

99

@@ -75,12 +75,14 @@ def try_convert_structured_postal_address_to_dict(self, field, anchors):
7575
def set_address_to_be_formatted_address_if_null(self, anchors):
7676
if config.ATTRIBUTE_POSTAL_ADDRESS not in self.user_profile and config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS in self.user_profile:
7777
if config.KEY_FORMATTED_ADDRESS in self.user_profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]:
78-
self.user_profile[config.ATTRIBUTE_POSTAL_ADDRESS] = self.user_profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS][
78+
self.user_profile[config.ATTRIBUTE_POSTAL_ADDRESS] = \
79+
self.user_profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS][
7980
config.KEY_FORMATTED_ADDRESS]
8081

8182
if config.ATTRIBUTE_POSTAL_ADDRESS not in self.profile and config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS in self.profile:
8283
if config.KEY_FORMATTED_ADDRESS in self.profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value():
83-
formatted_address = self.profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()[config.KEY_FORMATTED_ADDRESS]
84+
formatted_address = self.profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()[
85+
config.KEY_FORMATTED_ADDRESS]
8486
self.profile[config.ATTRIBUTE_POSTAL_ADDRESS] = attribute.attribute(
8587
config.ATTRIBUTE_POSTAL_ADDRESS,
8688
formatted_address,

yoti_python_sdk/anchor.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import asn1
21
import datetime
3-
import OpenSSL
4-
import yoti_python_sdk.protobuf.v1.common_public_api.signed_timestamp_pb2 as compubapi
52

3+
import OpenSSL
4+
import asn1
65
from OpenSSL import crypto
6+
7+
import yoti_python_sdk.protobuf.v1.common_public_api.signed_timestamp_pb2 as compubapi
78
from yoti_python_sdk import config
89

910
UNKNOWN_EXTENSION = ""
@@ -80,7 +81,7 @@ def decode_asn1_value(value_to_decode):
8081

8182
decoder.start(once_decoded_value)
8283
tag, twice_decoded_value = decoder.read()
83-
84+
8485
utf8_value = twice_decoded_value.decode('utf-8')
8586
return utf8_value
8687

@@ -98,7 +99,8 @@ def get_signed_timestamp(anchor):
9899
signed_timestamp_object.MergeFromString(anchor.signed_time_stamp)
99100

100101
try:
101-
signed_timestamp_parsed = datetime.datetime.fromtimestamp(signed_timestamp_object.timestamp / float(1000000))
102+
signed_timestamp_parsed = datetime.datetime.fromtimestamp(
103+
signed_timestamp_object.timestamp / float(1000000))
102104
except OSError:
103105
print("Unable to parse timestamp from integer: '{0}'".format(signed_timestamp_object.timestamp))
104106
return ""

yoti_python_sdk/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
import json
55
from os import environ
6+
from os.path import isfile, expanduser
67

78
import requests
89
from cryptography.fernet import base64
9-
from os.path import isfile, expanduser
1010
from past.builtins import basestring
1111

1212
import yoti_python_sdk

yoti_python_sdk/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
22
import io
3+
from os.path import dirname, join, abspath
34

45
import pytest
5-
from os.path import dirname, join, abspath
66

77
from yoti_python_sdk import Client
88
from yoti_python_sdk.crypto import Crypto

yoti_python_sdk/tests/test_activity_details.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
2+
import collections
23
import json
34

4-
import collections
55
import pytest
66

77
from yoti_python_sdk import config
@@ -146,7 +146,8 @@ def test_try_parse_structured_postal_address_uk():
146146

147147
ActivityDetails.try_convert_structured_postal_address_to_dict(activity_details, activity_details.field, None)
148148

149-
actual_structured_postal_address_user_profile = activity_details.user_profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
149+
actual_structured_postal_address_user_profile = activity_details.user_profile[
150+
config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
150151

151152
assert type(actual_structured_postal_address_user_profile) is collections.OrderedDict
152153
assert actual_structured_postal_address_user_profile[ADDRESS_FORMAT_KEY] == ADDRESS_FORMAT_VALUE
@@ -158,7 +159,8 @@ def test_try_parse_structured_postal_address_uk():
158159
assert actual_structured_postal_address_user_profile[COUNTRY_KEY] == COUNTRY_VALUE
159160
assert actual_structured_postal_address_user_profile[FORMATTED_ADDRESS_KEY] == FORMATTED_ADDRESS_VALUE
160161

161-
actual_structured_postal_address_profile = activity_details.profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()
162+
actual_structured_postal_address_profile = activity_details.profile[
163+
config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()
162164

163165
assert type(actual_structured_postal_address_profile) is collections.OrderedDict
164166
assert actual_structured_postal_address_profile[ADDRESS_FORMAT_KEY] == ADDRESS_FORMAT_VALUE
@@ -193,7 +195,8 @@ def test_try_parse_structured_postal_address_india():
193195

194196
ActivityDetails.try_convert_structured_postal_address_to_dict(activity_details, activity_details.field, None)
195197

196-
actual_structured_postal_address_user_profile = activity_details.user_profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
198+
actual_structured_postal_address_user_profile = activity_details.user_profile[
199+
config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
197200

198201
assert type(actual_structured_postal_address_user_profile) is collections.OrderedDict
199202
assert actual_structured_postal_address_user_profile[ADDRESS_FORMAT_KEY] == INDIA_FORMAT_VALUE
@@ -210,7 +213,8 @@ def test_try_parse_structured_postal_address_india():
210213
assert actual_structured_postal_address_user_profile[COUNTRY_KEY] == INDIA_COUNTRY_VALUE
211214
assert actual_structured_postal_address_user_profile[FORMATTED_ADDRESS_KEY] == INDIA_FORMATTED_ADDRESS_VALUE
212215

213-
actual_structured_postal_address_profile = activity_details.profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()
216+
actual_structured_postal_address_profile = activity_details.profile[
217+
config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()
214218

215219
assert type(actual_structured_postal_address_profile) is collections.OrderedDict
216220
assert actual_structured_postal_address_profile[ADDRESS_FORMAT_KEY] == INDIA_FORMAT_VALUE
@@ -245,7 +249,8 @@ def test_try_parse_structured_postal_address_usa():
245249

246250
ActivityDetails.try_convert_structured_postal_address_to_dict(activity_details, activity_details.field, None)
247251

248-
actual_structured_postal_address_user_profile = activity_details.user_profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
252+
actual_structured_postal_address_user_profile = activity_details.user_profile[
253+
config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
249254

250255
assert type(actual_structured_postal_address_user_profile) is collections.OrderedDict
251256
assert actual_structured_postal_address_user_profile[ADDRESS_FORMAT_KEY] == USA_FORMAT_VALUE
@@ -257,7 +262,8 @@ def test_try_parse_structured_postal_address_usa():
257262
assert actual_structured_postal_address_user_profile[COUNTRY_KEY] == USA_COUNTRY_VALUE
258263
assert actual_structured_postal_address_user_profile[FORMATTED_ADDRESS_KEY] == USA_FORMATTED_ADDRESS_VALUE
259264

260-
actual_structured_postal_address_profile = activity_details.profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()
265+
actual_structured_postal_address_profile = activity_details.profile[
266+
config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()
261267

262268
assert type(actual_structured_postal_address_profile) is collections.OrderedDict
263269
assert actual_structured_postal_address_profile[ADDRESS_FORMAT_KEY] == USA_FORMAT_VALUE
@@ -298,7 +304,8 @@ def test_try_parse_structured_postal_address_nested_json():
298304

299305
ActivityDetails.try_convert_structured_postal_address_to_dict(activity_details, activity_details.field, None)
300306

301-
actual_structured_postal_address_user_profile = activity_details.user_profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
307+
actual_structured_postal_address_user_profile = activity_details.user_profile[
308+
config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
302309

303310
assert type(actual_structured_postal_address_user_profile) is collections.OrderedDict
304311
assert actual_structured_postal_address_user_profile[ADDRESS_FORMAT_KEY] == ADDRESS_FORMAT_VALUE
@@ -311,7 +318,8 @@ def test_try_parse_structured_postal_address_nested_json():
311318

312319
assert actual_structured_postal_address_user_profile[FORMATTED_ADDRESS_KEY] == formatted_address_json
313320

314-
actual_structured_postal_address_profile = activity_details.profile[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()
321+
actual_structured_postal_address_profile = activity_details.profile[
322+
config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].get_value()
315323

316324
assert type(actual_structured_postal_address_profile) is collections.OrderedDict
317325
assert actual_structured_postal_address_profile[ADDRESS_FORMAT_KEY] == ADDRESS_FORMAT_VALUE

yoti_python_sdk/tests/test_anchor.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# -*- coding: utf-8 -*-
2+
import binascii
23
import datetime
34
import io
4-
import pytest
5-
import binascii
6-
import struct
7-
85
from os.path import abspath, dirname, join
96

107
from yoti_python_sdk import anchor, config

0 commit comments

Comments
 (0)