Skip to content

Commit 035a422

Browse files
committed
Code cleanup
1 parent 1c04fc7 commit 035a422

File tree

8 files changed

+17
-13
lines changed

8 files changed

+17
-13
lines changed

examples/yoti_example_django/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ services:
88
YOTI_CLIENT_SDK_ID: "${YOTI_CLIENT_SDK_ID}"
99
YOTI_KEY_FILE_PATH: "${YOTI_KEY_FILE_PATH}"
1010
ports:
11-
- "5000:5000"
11+
- "5000:5000"

examples/yoti_example_flask/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ services:
88
YOTI_CLIENT_SDK_ID: "${YOTI_CLIENT_SDK_ID}"
99
YOTI_KEY_FILE_PATH: "${YOTI_KEY_FILE_PATH}"
1010
ports:
11-
- "5000:5000"
11+
- "5000:5000"

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from setuptools import setup, find_packages
3+
34
from yoti_python_sdk import __version__
45

56
long_description = 'This package contains the tools you need to quickly ' \
@@ -20,7 +21,8 @@
2021
install_requires=['cryptography>=2.2.1', 'protobuf>=3.1.0',
2122
'requests>=2.11.1', 'future>=0.11.0', 'asn1==2.2.0', 'pyopenssl>=18.0.0'],
2223
extras_require={
23-
'examples': ['Django>=1.8', 'Flask>=0.10', 'python-dotenv>=0.7.1', 'django-sslserver>=0.2', 'Werkzeug==0.11.15'],
24+
'examples': ['Django>=1.8', 'Flask>=0.10', 'python-dotenv>=0.7.1', 'django-sslserver>=0.2',
25+
'Werkzeug==0.11.15'],
2426
},
2527
classifiers=[
2628
'Development Status :: 5 - Production/Stable',

yoti_python_sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
2+
from distutils.util import convert_path
23
from os import environ
34

45
from yoti_python_sdk.client import Client
5-
from distutils.util import convert_path
66

77
DEFAULTS = {
88
'YOTI_API_URL': 'https://api.yoti.com',

yoti_python_sdk/attribute.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33

44
class Attribute:
5-
def __init__(self, name="", value="", anchors={}):
5+
def __init__(self, name="", value="", anchors=None):
6+
if anchors is None:
7+
anchors = {}
68
self.__name = name
79
self.__value = value
810
self.__anchors = anchors

yoti_python_sdk/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from yoti_python_sdk.protobuf.v1 import protobuf
1818
from .config import *
1919

20-
2120
NO_KEY_FILE_SPECIFIED_ERROR = 'Please specify the correct private key file ' \
2221
'in Client(pem_file_path=...)\nor by setting ' \
2322
'the "YOTI_KEY_FILE_PATH" environment variable'

yoti_python_sdk/profile.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, profile_attributes):
2626
if field.name == config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS:
2727
self.try_convert_structured_postal_address_to_dict(field, anchors)
2828

29-
self.ensure_postal_address(anchors)
29+
self.ensure_postal_address()
3030

3131
@property
3232
def date_of_birth(self):
@@ -78,7 +78,6 @@ def get_attribute(self, attribute_name):
7878
else:
7979
return None
8080

81-
8281
def try_convert_structured_postal_address_to_dict(self, field, anchors):
8382
decoder = json.JSONDecoder(object_pairs_hook=collections.OrderedDict, strict=False)
8483
value_to_decode = field.value.decode()
@@ -88,12 +87,14 @@ def try_convert_structured_postal_address_to_dict(self, field, anchors):
8887
decoder.decode(value_to_decode),
8988
anchors)
9089

91-
def ensure_postal_address(self, anchors):
90+
def ensure_postal_address(self):
9291
if config.ATTRIBUTE_POSTAL_ADDRESS not in self.attributes and config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS in self.attributes:
93-
if config.KEY_FORMATTED_ADDRESS in self.attributes[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].value:
94-
formatted_address = self.attributes[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS].value[
92+
structured_postal_address = self.attributes[config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS]
93+
94+
if config.KEY_FORMATTED_ADDRESS in structured_postal_address.value:
95+
formatted_address = structured_postal_address.value[
9596
config.KEY_FORMATTED_ADDRESS]
9697
self.attributes[config.ATTRIBUTE_POSTAL_ADDRESS] = Attribute(
9798
config.ATTRIBUTE_POSTAL_ADDRESS,
9899
formatted_address,
99-
anchors)
100+
structured_postal_address.anchors)

yoti_python_sdk/protobuf/v1/protobuf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from __future__ import unicode_literals
33

44
from cryptography.fernet import base64
5-
from yoti_python_sdk.protobuf.v1.attribute_public_api import attribute_pb2, list_pb2
65

76
import yoti_python_sdk.protobuf.v1.common_public_api.encrypted_data_pb2 as compubapi
7+
from yoti_python_sdk.protobuf.v1.attribute_public_api import attribute_pb2, list_pb2
88

99

1010
class Protobuf(object):

0 commit comments

Comments
 (0)