Skip to content

Commit e4b7362

Browse files
committed
style: fix code-style
1 parent 60902f4 commit e4b7362

37 files changed

+277
-244
lines changed

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "pyEchoNext"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = "0.6.9"
51+
PROJECT_NUMBER = "0.6.10"
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Welcome to **EchoNext**, where innovation meets simplicity! Are you tired of the
4141

4242
**Imagine** a lightweight framework that empowers you to create modern web applications with lightning speed and flexibility. With EchoNext, you're not just coding; you're building a masterpiece!
4343

44-
> Last stable version: 0.6.9 alpha
44+
> Last stable version: 0.6.10 alpha
4545
4646
> Next Big Update: ASYNC & unicorn support
4747

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ currently being supported with security updates.
77

88
| Version | Supported |
99
| ------- | ------------------ |
10+
| 0.6.10 | :white_check_mark: |
1011
| 0.6.9 | :white_check_mark: |
1112
| 0.5.9 | :white_check_mark: |
1213
| 0.5.8 | :white_check_mark: |

examples/advanced_app.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
import os
2+
23
from pyechonext.app import ApplicationType, EchoNext
3-
from pyechonext.views import View
4-
from pyechonext.urls import URL, IndexView
54
from pyechonext.config import Settings
65
from pyechonext.middleware import middlewares
6+
from pyechonext.urls import URL, IndexView
7+
from pyechonext.views import View
78

89

910
class UsersView(View):
10-
def get(self, request, response, **kwargs):
11-
return "users get"
11+
def get(self, request, response, **kwargs):
12+
return "users get"
1213

13-
def post(self, request, response, **kwargs):
14-
return "users post"
14+
def post(self, request, response, **kwargs):
15+
return "users post"
1516

1617

1718
url_patterns = [URL(url="/", view=IndexView), URL(url="/users", view=UsersView)]
1819
settings = Settings(
19-
BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
20+
BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
2021
)
2122
echonext = EchoNext(
22-
__name__,
23-
settings,
24-
middlewares,
25-
urls=url_patterns,
26-
application_type=ApplicationType.HTML,
23+
__name__,
24+
settings,
25+
middlewares,
26+
urls=url_patterns,
27+
application_type=ApplicationType.HTML,
2728
)
2829

2930

3031
@echonext.route_page("/book")
3132
class BooksResource(View):
32-
def get(self, request, response, **kwargs):
33-
return f"Books Page: {request.GET}"
33+
def get(self, request, response, **kwargs):
34+
return f"Books Page: {request.GET}"
3435

35-
def post(self, request, response, **kwargs):
36-
return "Endpoint to create a book"
36+
def post(self, request, response, **kwargs):
37+
return "Endpoint to create a book"

examples/el_config.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
22

33
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
4-
TEMPLATES_DIR = 'templates'
5-
SECRET_KEY = 'secret-key'
6-
LOCALE = 'RU_RU'
7-
LOCALE_DIR = 'locales'
4+
TEMPLATES_DIR = "templates"
5+
SECRET_KEY = "secret-key"
6+
LOCALE = "RU_RU"
7+
LOCALE_DIR = "locales"
88
VERSION = "0.1.0"
9-
DESCRIPTION = 'Example echonext webapp'
10-
STATIC_DIR = 'static'
11-
9+
DESCRIPTION = "Example echonext webapp"
10+
STATIC_DIR = "static"

examples/example_locale.py

Lines changed: 64 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,86 @@
11
import os
2-
from pyechonext.utils.exceptions import MethodNotAllow
2+
3+
from pyechonext.apidoc_ui import APIDocUI, APIDocumentation
34
from pyechonext.app import ApplicationType, EchoNext
4-
from pyechonext.views import View
5-
from pyechonext.urls import URL, IndexView
6-
from pyechonext.config import SettingsLoader, SettingsConfigType
7-
from pyechonext.response import Response
8-
from pyechonext.template_engine.jinja import render_template
5+
from pyechonext.config import SettingsConfigType, SettingsLoader
96
from pyechonext.middleware import middlewares
10-
from pyechonext.apidoc_ui import APIDocumentation, APIDocUI
7+
from pyechonext.response import Response
118
from pyechonext.static import StaticFile
9+
from pyechonext.template_engine.jinja import render_template
10+
from pyechonext.urls import URL, IndexView
11+
from pyechonext.utils.exceptions import MethodNotAllow
12+
from pyechonext.views import View
1213

1314

1415
class UsersView(View):
15-
def get(self, request, response, **kwargs):
16-
return render_template(
17-
request,
18-
"index.html",
19-
user_name="User",
20-
session_id=request.session_id,
21-
friends=["Bob", "Anna", "John"],
22-
)
16+
def get(self, request, response, **kwargs):
17+
return render_template(
18+
request,
19+
"index.html",
20+
user_name="User",
21+
session_id=request.session_id,
22+
friends=["Bob", "Anna", "John"],
23+
)
2324

24-
def post(self, request, response, **kwargs):
25-
raise MethodNotAllow(f"Request {request.path}: method not allow")
25+
def post(self, request, response, **kwargs):
26+
raise MethodNotAllow(f"Request {request.path}: method not allow")
2627

2728

2829
url_patterns = [URL(url="/", view=IndexView), URL(url="/users", view=UsersView)]
29-
config_loader = SettingsLoader(SettingsConfigType.PYMODULE, 'el_config.py')
30+
config_loader = SettingsLoader(SettingsConfigType.PYMODULE, "el_config.py")
3031
settings = config_loader.get_settings()
31-
static_files = [StaticFile(settings, 'styles.css')]
32+
static_files = [StaticFile(settings, "styles.css")]
3233
echonext = EchoNext(
33-
__name__,
34-
settings,
35-
middlewares,
36-
urls=url_patterns,
37-
application_type=ApplicationType.HTML,
38-
static_files=static_files
34+
__name__,
35+
settings,
36+
middlewares,
37+
urls=url_patterns,
38+
application_type=ApplicationType.HTML,
39+
static_files=static_files,
3940
)
4041
apidoc = APIDocumentation(echonext)
4142

4243

43-
@echonext.route_page('/api-docs')
44+
@echonext.route_page("/api-docs")
4445
def api_docs(request, response):
45-
ui = APIDocUI(apidoc.generate_spec())
46-
return ui.generate_html_page()
46+
ui = APIDocUI(apidoc.generate_spec())
47+
return ui.generate_html_page()
4748

4849

4950
@echonext.route_page("/book")
5051
class BooksResource(View):
51-
"""
52-
This class describes a books resource.
53-
"""
54-
55-
def get(self, request, response, **kwargs):
56-
"""
57-
get queries
58-
59-
:param request: The request
60-
:type request: Request
61-
:param response: The response
62-
:type response: Response
63-
:param kwargs: The keywords arguments
64-
:type kwargs: dictionary
65-
66-
:returns: result
67-
:rtype: str
68-
"""
69-
return echonext.i18n_loader.get_string('title %{name}', name=str(request.GET))
70-
71-
def post(self, request, response, **kwargs):
72-
"""
73-
post queries
74-
75-
:param request: The request
76-
:type request: Request
77-
:param response: The response
78-
:type response: Response
79-
:param kwargs: The keywords arguments
80-
:type kwargs: dictionary
81-
82-
:returns: result
83-
:rtype: str
84-
"""
85-
return echonext.l10n_loader.format_currency(1305.50)
52+
"""
53+
This class describes a books resource.
54+
"""
55+
56+
def get(self, request, response, **kwargs):
57+
"""
58+
get queries
59+
60+
:param request: The request
61+
:type request: Request
62+
:param response: The response
63+
:type response: Response
64+
:param kwargs: The keywords arguments
65+
:type kwargs: dictionary
66+
67+
:returns: result
68+
:rtype: str
69+
"""
70+
return echonext.i18n_loader.get_string("title %{name}", name=str(request.GET))
71+
72+
def post(self, request, response, **kwargs):
73+
"""
74+
post queries
75+
76+
:param request: The request
77+
:type request: Request
78+
:param response: The response
79+
:type response: Response
80+
:param kwargs: The keywords arguments
81+
:type kwargs: dictionary
82+
83+
:returns: result
84+
:rtype: str
85+
"""
86+
return echonext.l10n_loader.format_currency(1305.50)

examples/example_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
SECRET_KEY = 'secret-key'
66
LOCALE = 'DEFAULT'
77
LOCALE_DIR = None
8-
VERSION = 0.1.0
8+
VERSION = '0.1.0'
99
DESCRIPTION = 'Example echonext webapp'
1010
STATIC_DIR = 'static'

examples/security.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from pyechonext.security.crypts import PSPCAlgorithm
22

3-
43
pspc = PSPCAlgorithm()
54

6-
passwords = ['AngryPassword', 'S0mesd7623tds@&6^@_', 'PassWord', 'Pass']
5+
passwords = ["AngryPassword", "S0mesd7623tds@&6^@_", "PassWord", "Pass"]
76

87
for password in passwords:
9-
print('Base:', password)
10-
print('Crypted:', pspc.crypt(password))
11-
print('Decrypted:', pspc.decrypt(pspc.crypt(password)))
12-
print()
8+
print("Base:", password)
9+
print("Crypted:", pspc.crypt(password))
10+
print("Decrypted:", pspc.decrypt(pspc.crypt(password)))
11+
print()

examples/simple_api.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
import os
2+
23
from pyechonext.app import ApplicationType, EchoNext
3-
from pyechonext.views import View
4-
from pyechonext.urls import URL, IndexView
5-
from pyechonext.response import Response
64
from pyechonext.config import Settings
75
from pyechonext.middleware import middlewares
6+
from pyechonext.response import Response
7+
from pyechonext.urls import URL, IndexView
8+
from pyechonext.views import View
89

910

1011
class UsersView(View):
11-
def get(self, request, response, **kwargs):
12-
return Response(request, body={"users": "get"})
12+
def get(self, request, response, **kwargs):
13+
return Response(request, body={"users": "get"})
1314

14-
def post(self, request, response, **kwargs):
15-
return {"users": "post"}
15+
def post(self, request, response, **kwargs):
16+
return {"users": "post"}
1617

1718

1819
url_patterns = [URL(url="/", view=IndexView), URL(url="/users", view=UsersView)]
1920

2021
settings = Settings(
21-
BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
22+
BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
2223
)
2324

2425
echonext = EchoNext(
25-
__name__,
26-
settings,
27-
middlewares,
28-
urls=url_patterns,
29-
application_type=ApplicationType.JSON,
26+
__name__,
27+
settings,
28+
middlewares,
29+
urls=url_patterns,
30+
application_type=ApplicationType.JSON,
3031
)
3132

3233

3334
@echonext.route_page("/book")
3435
class BooksResource(View):
35-
def get(self, request, response, **kwargs):
36-
return {"params": {request.GET}, "page": "books"}
36+
def get(self, request, response, **kwargs):
37+
return {"params": {request.GET}, "page": "books"}
3738

38-
def post(self, request, response, **kwargs):
39-
return {"params": {request.POST}, "page": "books"}
39+
def post(self, request, response, **kwargs):
40+
return {"params": {request.POST}, "page": "books"}

examples/simple_app.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
import os
2+
3+
from sqlsymphony_orm.datatypes.fields import IntegerField, RealField, TextField
4+
from sqlsymphony_orm.models.session_models import SessionModel, SQLiteSession
5+
26
from pyechonext.app import ApplicationType, EchoNext
37
from pyechonext.config import Settings
4-
from sqlsymphony_orm.datatypes.fields import IntegerField, RealField, TextField
5-
from sqlsymphony_orm.models.session_models import SessionModel
6-
from sqlsymphony_orm.models.session_models import SQLiteSession
78
from pyechonext.middleware import middlewares
89

9-
1010
settings = Settings(
11-
BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
11+
BASE_DIR=os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIR="templates"
1212
)
1313
echonext = EchoNext(
14-
__name__, settings, middlewares, application_type=ApplicationType.HTML
14+
__name__, settings, middlewares, application_type=ApplicationType.HTML
1515
)
1616
session = SQLiteSession("echonext.db")
1717

1818

1919
class User(SessionModel):
20-
__tablename__ = "Users"
20+
__tablename__ = "Users"
2121

22-
id = IntegerField(primary_key=True)
23-
name = TextField(null=False)
24-
cash = RealField(null=False, default=0.0)
22+
id = IntegerField(primary_key=True)
23+
name = TextField(null=False)
24+
cash = RealField(null=False, default=0.0)
2525

26-
def __repr__(self):
27-
return f"<User {self.pk}>"
26+
def __repr__(self):
27+
return f"<User {self.pk}>"
2828

2929

3030
@echonext.route_page("/")
3131
def home(request, response):
32-
user = User(name="John", cash=100.0)
33-
session.add(user)
34-
session.commit()
35-
return "Hello from the HOME page"
32+
user = User(name="John", cash=100.0)
33+
session.add(user)
34+
session.commit()
35+
return "Hello from the HOME page"
3636

3737

3838
@echonext.route_page("/users")
3939
def about(request, response):
40-
users = session.get_all_by_model(User)
40+
users = session.get_all_by_model(User)
4141

42-
return f"Users: {[f'{user.name}: {user.cash}$' for user in users]}"
42+
return f"Users: {[f'{user.name}: {user.cash}$' for user in users]}"

0 commit comments

Comments
 (0)