Skip to content

Commit 645b489

Browse files
committed
Revert "Lint entire repo"
This reverts commit 8dc9f53.
1 parent d5ca08d commit 645b489

File tree

8 files changed

+217
-202
lines changed

8 files changed

+217
-202
lines changed

docs/conf.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,41 @@
1717

1818
# -- Project information -----------------------------------------------------
1919

20-
project = "Flask-Babel"
21-
copyright = "2020, Armin Ronacher"
22-
author = "Armin Ronacher"
20+
project = 'Flask-Babel'
21+
copyright = '2020, Armin Ronacher'
22+
author = 'Armin Ronacher'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = "4.0.0"
25+
release = '4.0.0'
2626

2727

2828
# -- General configuration ---------------------------------------------------
2929

3030
# Add any Sphinx extension module names here, as strings. They can be
3131
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3232
# ones.
33-
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
33+
extensions = [
34+
'sphinx.ext.autodoc',
35+
'sphinx.ext.viewcode'
36+
]
3437

3538
# Add any paths that contain templates here, relative to this directory.
36-
templates_path = ["_templates"]
39+
templates_path = ['_templates']
3740

3841
# List of patterns, relative to source directory, that match files and
3942
# directories to ignore when looking for source files.
4043
# This pattern also affects html_static_path and html_extra_path.
41-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
44+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
4245

4346

4447
# -- Options for HTML output -------------------------------------------------
4548

4649
# The theme to use for HTML and HTML Help pages. See the documentation for
4750
# a list of builtin themes.
4851
#
49-
html_theme = "furo"
52+
html_theme = 'furo'
5053

5154
# Add any paths that contain custom static files (such as style sheets) here,
5255
# relative to this directory. They are copied after the builtin static files,
5356
# so a file named "default.css" will overwrite the builtin "default.css".
54-
html_static_path = ["_static"]
57+
html_static_path = ['_static']

tests/test_app_factory.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ def test_app_factory():
66
b = babel.Babel()
77

88
def locale_selector():
9-
return "de_DE"
9+
return 'de_DE'
1010

1111
def create_app():
1212
app_ = flask.Flask(__name__)
13-
b.init_app(app_, default_locale="en_US", locale_selector=locale_selector)
13+
b.init_app(
14+
app_,
15+
default_locale='en_US',
16+
locale_selector=locale_selector
17+
)
1418
return app_
1519

1620
app = create_app()
1721
with app.test_request_context():
18-
assert str(babel.get_locale()) == "de_DE"
19-
assert babel.gettext("Hello %(name)s!", name="Peter") == "Hallo Peter!"
22+
assert str(babel.get_locale()) == 'de_DE'
23+
assert babel.gettext(u'Hello %(name)s!', name='Peter') == \
24+
'Hallo Peter!'

tests/test_date_formatting.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,46 @@ def test_basics():
1313
delta = timedelta(days=6)
1414

1515
with app.test_request_context():
16-
assert babel.format_datetime(d) == "Apr 12, 2010, 1:46:00\u202fPM"
17-
assert babel.format_date(d) == "Apr 12, 2010"
18-
assert babel.format_time(d) == "1:46:00\u202fPM"
19-
assert babel.format_timedelta(delta) == "1 week"
20-
assert babel.format_timedelta(delta, threshold=1) == "6 days"
16+
assert babel.format_datetime(d) == 'Apr 12, 2010, 1:46:00\u202fPM'
17+
assert babel.format_date(d) == 'Apr 12, 2010'
18+
assert babel.format_time(d) == '1:46:00\u202fPM'
19+
assert babel.format_timedelta(delta) == '1 week'
20+
assert babel.format_timedelta(delta, threshold=1) == '6 days'
2121

2222
with app.test_request_context():
23-
get_babel(app).default_timezone = "Europe/Vienna"
24-
assert babel.format_datetime(d) == "Apr 12, 2010, 3:46:00\u202fPM"
25-
assert babel.format_date(d) == "Apr 12, 2010"
26-
assert babel.format_time(d) == "3:46:00\u202fPM"
23+
get_babel(app).default_timezone = 'Europe/Vienna'
24+
assert babel.format_datetime(d) == 'Apr 12, 2010, 3:46:00\u202fPM'
25+
assert babel.format_date(d) == 'Apr 12, 2010'
26+
assert babel.format_time(d) == '3:46:00\u202fPM'
2727

2828
with app.test_request_context():
29-
get_babel(app).default_locale = "de_DE"
30-
assert babel.format_datetime(d, "long") == "12. April 2010, 15:46:00 MESZ"
29+
get_babel(app).default_locale = 'de_DE'
30+
assert babel.format_datetime(d, 'long') == \
31+
'12. April 2010, 15:46:00 MESZ'
3132

3233

3334
def test_custom_formats():
3435
app = flask.Flask(__name__)
3536
app.config.update(
36-
BABEL_DEFAULT_LOCALE="en_US", BABEL_DEFAULT_TIMEZONE="Pacific/Johnston"
37+
BABEL_DEFAULT_LOCALE='en_US',
38+
BABEL_DEFAULT_TIMEZONE='Pacific/Johnston'
3739
)
3840
b = babel.Babel(app)
39-
b.date_formats["datetime"] = "long"
40-
b.date_formats["datetime.long"] = "MMMM d, yyyy h:mm:ss a"
41+
b.date_formats['datetime'] = 'long'
42+
b.date_formats['datetime.long'] = 'MMMM d, yyyy h:mm:ss a'
4143
d = datetime(2010, 4, 12, 13, 46)
4244

4345
with app.test_request_context():
44-
assert babel.format_datetime(d) == "April 12, 2010 3:46:00 AM"
46+
assert babel.format_datetime(d) == 'April 12, 2010 3:46:00 AM'
4547

4648

4749
def test_custom_locale_selector():
4850
app = flask.Flask(__name__)
4951
b = babel.Babel(app)
5052
d = datetime(2010, 4, 12, 13, 46)
5153

52-
the_timezone = "UTC"
53-
the_locale = "en_US"
54+
the_timezone = 'UTC'
55+
the_locale = 'en_US'
5456

5557
def select_locale():
5658
return the_locale
@@ -62,21 +64,21 @@ def select_timezone():
6264
get_babel(app).timezone_selector = select_timezone
6365

6466
with app.test_request_context():
65-
assert babel.format_datetime(d) == "Apr 12, 2010, 1:46:00\u202fPM"
67+
assert babel.format_datetime(d) == 'Apr 12, 2010, 1:46:00\u202fPM'
6668

67-
the_locale = "de_DE"
68-
the_timezone = "Europe/Vienna"
69+
the_locale = 'de_DE'
70+
the_timezone = 'Europe/Vienna'
6971

7072
with app.test_request_context():
71-
assert babel.format_datetime(d) == "12.04.2010, 15:46:00"
73+
assert babel.format_datetime(d) == '12.04.2010, 15:46:00'
7274

7375

7476
def test_refreshing():
7577
app = flask.Flask(__name__)
7678
babel.Babel(app)
7779
d = datetime(2010, 4, 12, 13, 46)
7880
with app.test_request_context():
79-
assert babel.format_datetime(d) == "Apr 12, 2010, 1:46:00\u202fPM"
80-
get_babel(app).default_timezone = "Europe/Vienna"
81+
assert babel.format_datetime(d) == 'Apr 12, 2010, 1:46:00\u202fPM'
82+
get_babel(app).default_timezone = 'Europe/Vienna'
8183
babel.refresh()
82-
assert babel.format_datetime(d) == "Apr 12, 2010, 3:46:00\u202fPM"
84+
assert babel.format_datetime(d) == 'Apr 12, 2010, 3:46:00\u202fPM'

tests/test_force_locale.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,67 @@
77

88
def test_force_locale():
99
app = flask.Flask(__name__)
10-
babel.Babel(app, locale_selector=lambda: "de_DE")
10+
babel.Babel(app, locale_selector=lambda: 'de_DE')
1111

1212
with app.test_request_context():
13-
assert str(babel.get_locale()) == "de_DE"
14-
with babel.force_locale("en_US"):
15-
assert str(babel.get_locale()) == "en_US"
16-
assert str(babel.get_locale()) == "de_DE"
13+
assert str(babel.get_locale()) == 'de_DE'
14+
with babel.force_locale('en_US'):
15+
assert str(babel.get_locale()) == 'en_US'
16+
assert str(babel.get_locale()) == 'de_DE'
1717

1818

1919
def test_force_locale_with_threading():
2020
app = flask.Flask(__name__)
21-
babel.Babel(app, locale_selector=lambda: "de_DE")
21+
babel.Babel(app, locale_selector=lambda: 'de_DE')
2222

2323
semaphore = Semaphore(value=0)
2424

2525
def first_request():
2626
with app.test_request_context():
27-
with babel.force_locale("en_US"):
28-
assert str(babel.get_locale()) == "en_US"
27+
with babel.force_locale('en_US'):
28+
assert str(babel.get_locale()) == 'en_US'
2929
semaphore.acquire()
3030

3131
thread = Thread(target=first_request)
3232
thread.start()
3333

3434
try:
3535
with app.test_request_context():
36-
assert str(babel.get_locale()) == "de_DE"
36+
assert str(babel.get_locale()) == 'de_DE'
3737
finally:
3838
semaphore.release()
3939
thread.join()
4040

4141

4242
def test_force_locale_with_threading_and_app_context():
4343
app = flask.Flask(__name__)
44-
babel.Babel(app, locale_selector=lambda: "de_DE")
44+
babel.Babel(app, locale_selector=lambda: 'de_DE')
4545

4646
semaphore = Semaphore(value=0)
4747

4848
def first_app_context():
4949
with app.app_context():
50-
with babel.force_locale("en_US"):
51-
assert str(babel.get_locale()) == "en_US"
50+
with babel.force_locale('en_US'):
51+
assert str(babel.get_locale()) == 'en_US'
5252
semaphore.acquire()
5353

5454
thread = Thread(target=first_app_context)
5555
thread.start()
5656

5757
try:
5858
with app.app_context():
59-
assert str(babel.get_locale()) == "de_DE"
59+
assert str(babel.get_locale()) == 'de_DE'
6060
finally:
6161
semaphore.release()
6262
thread.join()
6363

6464

6565
def test_refresh_during_force_locale():
6666
app = flask.Flask(__name__)
67-
babel.Babel(app, locale_selector=lambda: "de_DE")
67+
babel.Babel(app, locale_selector=lambda: 'de_DE')
6868

6969
with app.test_request_context():
70-
with babel.force_locale("en_US"):
71-
assert str(babel.get_locale()) == "en_US"
70+
with babel.force_locale('en_US'):
71+
assert str(babel.get_locale()) == 'en_US'
7272
babel.refresh()
73-
assert str(babel.get_locale()) == "en_US"
73+
assert str(babel.get_locale()) == 'en_US'

0 commit comments

Comments
 (0)