Skip to content

Commit c2e1dba

Browse files
committed
Update all the code files to be "ruff format" formatted.
1 parent 1ab7d3b commit c2e1dba

File tree

325 files changed

+1498
-1533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+1498
-1533
lines changed

app/ch04_first_site/first_site_final/first_site/app.py

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

33
app = flask.Flask(__name__)
44

5+
56
@app.route('/')
67
def index():
7-
return "Hello world"
8+
return 'Hello world'
9+
810

911
app.run()

app/ch05_jinja_templates/final/pypi_org/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
import flask
4+
45
folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
56
sys.path.insert(0, folder)
67

app/ch05_jinja_templates/final/pypi_org/infrastructure/view_modifiers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def view_method(*args, **kwargs):
2626

2727
if template_file and not isinstance(response_val, dict):
2828
raise Exception(
29-
"Invalid return type {}, we expected a dict as the return value.".format(type(response_val)))
29+
'Invalid return type {}, we expected a dict as the return value.'.format(type(response_val))
30+
)
3031

3132
if template_file:
3233
response_val = flask.render_template(template_file, **response_val)

app/ch06_routing/final/pypi_org/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
import flask
4+
45
folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
56
sys.path.insert(0, folder)
67

app/ch06_routing/final/pypi_org/infrastructure/view_modifiers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def view_method(*args, **kwargs):
2626

2727
if template_file and not isinstance(response_val, dict):
2828
raise Exception(
29-
"Invalid return type {}, we expected a dict as the return value.".format(type(response_val)))
29+
'Invalid return type {}, we expected a dict as the return value.'.format(type(response_val))
30+
)
3031

3132
if template_file:
3233
response_val = flask.render_template(template_file, **response_val)
@@ -42,6 +43,7 @@ def view_method(*args, **kwargs):
4243

4344
return response_inner
4445

46+
4547
#
4648
# def template(template_file: str = None):
4749
# def template_inner(f):

app/ch06_routing/final/pypi_org/views/account_views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def index():
1616

1717
# ################### REGISTER #################################
1818

19+
1920
@blueprint.route('/account/register', methods=['GET'])
2021
@response(template_file='account/register.html')
2122
def register_get():
@@ -30,6 +31,7 @@ def register_post():
3031

3132
# ################### LOGIN #################################
3233

34+
3335
@blueprint.route('/account/login', methods=['GET'])
3436
@response(template_file='account/login.html')
3537
def login_get():
@@ -44,6 +46,7 @@ def login_post():
4446

4547
# ################### LOGOUT #################################
4648

49+
4750
@blueprint.route('/account/logout')
4851
def logout():
4952
return {}

app/ch06_routing/final/pypi_org/views/cms_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@blueprint.route('/<path:full_url>')
1010
@response(template_file='cms/page.html')
1111
def cms_page(full_url: str):
12-
print("Getting CMS page for {}".format(full_url))
12+
print('Getting CMS page for {}'.format(full_url))
1313

1414
page = cms_service.get_page(full_url)
1515
if not page:

app/ch06_routing/final/pypi_org/views/package_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
@blueprint.route('/project/<package_name>')
1010
# @response(template_file='packages/details.html')
1111
def package_details(package_name: str):
12-
return "Package details for {}".format(package_name)
12+
return 'Package details for {}'.format(package_name)
1313

1414

1515
@blueprint.route('/<int:rank>')
1616
def popular(rank: int):
1717
print(type(rank), rank)
18-
return "The details for the {}th most popular package".format(rank)
18+
return 'The details for the {}th most popular package'.format(rank)

app/ch06_routing/starter/pypi_org/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
import flask
4+
45
folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
56
sys.path.insert(0, folder)
67

app/ch06_routing/starter/pypi_org/infrastructure/view_modifiers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def view_method(*args, **kwargs):
2626

2727
if template_file and not isinstance(response_val, dict):
2828
raise Exception(
29-
"Invalid return type {}, we expected a dict as the return value.".format(type(response_val)))
29+
'Invalid return type {}, we expected a dict as the return value.'.format(type(response_val))
30+
)
3031

3132
if template_file:
3233
response_val = flask.render_template(template_file, **response_val)
@@ -42,6 +43,7 @@ def view_method(*args, **kwargs):
4243

4344
return response_inner
4445

46+
4547
#
4648
# def template(template_file: str = None):
4749
# def template_inner(f):

0 commit comments

Comments
 (0)