Skip to content

Commit 5aa820b

Browse files
committed
[SDK-165]: Reformatted Python files with options Optimize imports, and Rearrange entries (alphabetically) using PyCharm
1 parent f391457 commit 5aa820b

File tree

17 files changed

+29
-34
lines changed

17 files changed

+29
-34
lines changed

examples/yoti_example_django/yoti_example/settings.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# Build paths inside the project like this: join(BASE_DIR, ...)
1818
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1919

20-
2120
# Quick-start development settings - unsuitable for production
2221
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
2322

@@ -29,7 +28,6 @@
2928

3029
ALLOWED_HOSTS = []
3130

32-
3331
# Application definition
3432

3533
INSTALLED_APPS = [
@@ -71,7 +69,6 @@
7169

7270
WSGI_APPLICATION = 'yoti_example.wsgi.application'
7371

74-
7572
# Database
7673
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
7774

@@ -82,7 +79,6 @@
8279
}
8380
}
8481

85-
8682
# Password validation
8783
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
8884

@@ -101,7 +97,6 @@
10197
},
10298
]
10399

104-
105100
# Internationalization
106101
# https://docs.djangoproject.com/en/1.10/topics/i18n/
107102

@@ -115,7 +110,6 @@
115110

116111
USE_TZ = True
117112

118-
119113
# Static files (CSS, JavaScript, Images)
120114
# https://docs.djangoproject.com/en/1.10/howto/static-files/
121115

examples/yoti_example_django/yoti_example/views.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import os
1+
from binascii import a2b_base64
22

33
from django.views.generic import TemplateView
44

55
from yoti_python_sdk import Client
6-
from binascii import a2b_base64
7-
86
from .app_settings import (
97
YOTI_APPLICATION_ID,
108
YOTI_CLIENT_SDK_ID,
@@ -31,7 +29,7 @@ def get(self, request, *args, **kwargs):
3129

3230
@staticmethod
3331
def save_image(base64_uri):
34-
base64_data_stripped = base64_uri[base64_uri.find(",")+1:]
32+
base64_data_stripped = base64_uri[base64_uri.find(",") + 1:]
3533
binary_data = a2b_base64(base64_data_stripped)
3634
fd = open('yoti_example/static/YotiSelfie.jpg', 'wb')
3735
fd.write(binary_data)

examples/yoti_example_flask/app.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
2-
from os.path import join, dirname
32
from binascii import a2b_base64
3+
from os.path import join, dirname
4+
45
from dotenv import load_dotenv
56
from flask import Flask, render_template, request
7+
68
from yoti_python_sdk import Client
79

810
dotenv_path = join(dirname(__file__), '.env')
@@ -16,14 +18,16 @@
1618

1719
app = Flask(__name__)
1820

21+
1922
def save_image(base64_uri):
20-
base64_data_stripped = base64_uri[base64_uri.find(",")+1:]
23+
base64_data_stripped = base64_uri[base64_uri.find(",") + 1:]
2124
binary_data = a2b_base64(base64_data_stripped)
2225
upload_path = os.path.join(app.root_path, 'static', 'YotiSelfie.jpg')
2326
fd = open(upload_path, 'wb')
2427
fd.write(binary_data)
2528
fd.close()
2629

30+
2731
@app.route('/')
2832
def index():
2933
return render_template('index.html', app_id=YOTI_APPLICATION_ID)
@@ -38,5 +42,6 @@ def auth():
3842
return render_template('profile.html',
3943
**user_profile)
4044

45+
4146
if __name__ == '__main__':
4247
app.run(debug=True)
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
from django.utils.html import format_html
2-
31
from .login_button import get_login_button_html
42
from .settings import YOTI_APPLICATION_ID
53

4+
65
def yoti_context(request=None):
76
context = login_button_context()
87
context.update(application_context())
98
return context
109

10+
1111
def login_button_context():
1212
return {
1313
'yoti_login_button': get_login_button_html,
@@ -16,5 +16,6 @@ def login_button_context():
1616
'yoti_login_button_lg': get_login_button_html('large')
1717
}
1818

19+
1920
def application_context():
2021
return {'yoti_application_id': YOTI_APPLICATION_ID}

plugins/django_yoti/django_yoti/decorators.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from functools import wraps
2+
23
from django.shortcuts import redirect
34
from django.urls import reverse
45

plugins/django_yoti/django_yoti/runtests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
22
import sys
3-
import django
43

4+
import django
55
from django.conf import settings
66
from django.test.utils import get_runner
77

8-
98
# https://docs.djangoproject.com/el/1.10/topics/testing/advanced/
109
if __name__ == '__main__':
1110
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

plugins/django_yoti/django_yoti/tests/test_context_processors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class TestContextProcessors(TestCase):
8-
98
def setUp(self):
109
self.context = yoti_context(request=None)
1110
self.defaults = {

plugins/django_yoti/django_yoti/tests/test_views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from django.test import TestCase, Client, RequestFactory
2-
from django.http.response import HttpResponse, HttpResponseRedirectBase
31
from django.contrib.sessions.middleware import SessionMiddleware
4-
from yoti_python_sdk.activity_details import ActivityDetails
2+
from django.http.response import HttpResponse, HttpResponseRedirectBase
3+
from django.test import TestCase, Client, RequestFactory
54

5+
from yoti_python_sdk.activity_details import ActivityDetails
66
from ..views import profile
77

88

plugins/django_yoti/django_yoti/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from yoti_python_sdk import Client
21
from django.shortcuts import render, redirect
32
from django.urls import reverse
43

4+
from yoti_python_sdk import Client
55
from .decorators import yoti_authenticated
66
from .settings import (
77
YOTI_CLIENT_SDK_ID,
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
from flask import Markup
2-
31
from .login_button import get_login_button_html
42
from .settings import get_config_value
53

4+
65
def yoti_context():
76
context = login_button_context()
87
context.update(application_context())
98
return context
109

10+
1111
def login_button_context():
1212
return {
1313
'yoti_login_button': get_login_button_html,
@@ -16,6 +16,7 @@ def login_button_context():
1616
'yoti_login_button_lg': get_login_button_html('large')
1717
}
1818

19+
1920
def application_context():
2021
yoti_application_id = get_config_value('YOTI_APPLICATION_ID')
2122
return {'yoti_application_id': yoti_application_id}

0 commit comments

Comments
 (0)