Skip to content

Commit b718bdb

Browse files
committed
Whitespace nitpicks
1 parent e9f7d9d commit b718bdb

File tree

9 files changed

+26
-13
lines changed

9 files changed

+26
-13
lines changed

naucse/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def convert_url(url):
201201
@staticmethod
202202
def limit_css_to_lesson_content(css):
203203
""" Returns ``css`` limited just to the ``.lesson-content`` element.
204-
204+
205205
This doesn't protect against malicious input.
206206
"""
207207
parser = cssutils.CSSParser(raiseExceptions=True)
@@ -476,7 +476,7 @@ def slug(self):
476476
directory = self.path.parts[-1]
477477
parent_directory = self.path.parts[-2]
478478
if parent_directory == "courses":
479-
parent_directory = "course" # legacy URL
479+
parent_directory = "course" # legacy URL
480480
return parent_directory + "/" + directory
481481

482482
def is_link(self):

naucse/templates.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def format_date_range(start_and_end):
189189
parts += [format_date(end)]
190190
return ''.join(parts).format(start=start, end=end)
191191

192+
192193
@template_filter()
193194
def monthname(number):
194195
return ('Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec',

naucse/utils/forks.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ def render(page_type: str, slug: str, *args, **kwargs) -> Dict[str, Any]:
125125
# if content isn't cached or the version was refused, let's render
126126
# the content here (but just the content and not the whole page with headers, menus etc)
127127
if content is not_processed:
128-
content = views.page_content(lesson, page, solution, course,
129-
lesson_url=lesson_url, subpage_url=subpage_url, static_url=static_url,
130-
without_cache=True)
128+
content = views.page_content(
129+
lesson, page, solution, course,
130+
lesson_url=lesson_url,
131+
subpage_url=subpage_url,
132+
static_url=static_url,
133+
without_cache=True,
134+
)
131135

132136
if content is None:
133137
info["content"] = None

naucse/utils/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def __get__(self, instance, cls):
157157

158158
class DirProperty(LazyProperty):
159159
"""Ordered dict of models from a subdirectory
160-
160+
161161
If ``info.yml`` is present in the subdirectory, use it for the order
162162
of the models. The rest is appended alphabetically.
163163
"""

naucse/views.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
_cached_model = None
4646

47+
4748
@LocalProxy
4849
def model():
4950
"""Return the root of the naucse model
@@ -62,6 +63,7 @@ def model():
6263
_cached_model = model
6364
return model
6465

66+
6567
register_url_converters(app, model)
6668

6769
app.jinja_env.undefined = StrictUndefined
@@ -659,14 +661,14 @@ def lesson(lesson, page, solution=None):
659661
**kwargs
660662
)
661663

664+
662665
def session_coverpage_content(course, session, coverpage):
663666
def lesson_url(lesson, *args, **kwargs):
664667
if kwargs.get("page") == "index":
665668
kwargs.pop("page")
666669

667670
return url_for('course_page', course=course, lesson=lesson, *args, **kwargs)
668671

669-
670672
content = session.get_coverpage_content(course, coverpage, app)
671673

672674
homework_section = False
@@ -693,7 +695,6 @@ def lesson_url(lesson, *args, **kwargs):
693695
)
694696

695697

696-
697698
@app.route('/<course:course>/sessions/<session>/', defaults={'coverpage': 'front'})
698699
@app.route('/<course:course>/sessions/<session>/<coverpage>/')
699700
def session_coverpage(course, session, coverpage):
@@ -764,7 +765,6 @@ def course_calendar_content(course):
764765
)
765766

766767

767-
768768
@app.route('/<course:course>/calendar/')
769769
def course_calendar(course):
770770
if course.is_link():
@@ -825,9 +825,9 @@ def generate_calendar_ics(course):
825825
begin=start_time,
826826
end=end_time,
827827
uid=url_for("session_coverpage",
828-
course=course,
829-
session=session.slug,
830-
_external=True),
828+
course=course,
829+
session=session.slug,
830+
_external=True),
831831
)
832832
calendar.events.append(cal_event)
833833

test_naucse/test_filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
def test_format_date_range(start, end, result):
2121
assert naucse.templates.format_date_range((start, end)) == result
2222

23+
2324
@pytest.mark.parametrize(
2425
('time', 'result'),
2526
(
@@ -33,4 +34,3 @@ def test_format_date_range(start, end, result):
3334
)
3435
def test_format_time(time, result):
3536
assert naucse.templates.format_time(time) == result
36-

test_naucse/test_markdown.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ def test_convert_with_dosvenv_prompt(pre_prompt, space, command):
263263
""").strip().replace('\n', '').format(pre_prompt, space, html.escape(command))
264264
assert convert_markdown(src).replace('\n', '') == expected
265265

266+
266267
def test_convert_full_dosvenv_prompt():
267268
src = dedent(r"""
268269
```dosvenv

test_naucse/test_merge_dict.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,43 @@
22

33
from naucse.models import merge_dict
44

5+
56
def test_scalars():
67
assert merge_dict(
78
{'a': 1, 'b': 2},
89
{'b': 5, 'c': 6},
910
) == {'a': 1, 'b': 5, 'c': 6}
1011

12+
1113
def test_subdict():
1214
assert merge_dict(
1315
{'subdict': {'a': 1, 'b': 2}},
1416
{'subdict': {'b': 5, 'c': 6}},
1517
) == {'subdict': {'a': 1, 'b': 5, 'c': 6}}
1618

19+
1720
def test_sublist_merge():
1821
assert merge_dict(
1922
{'sublist': [1, 2, 3]},
2023
{'sublist': [4, 5, 6]},
2124
) == {'sublist': [4, 5, 6]}
2225

26+
2327
def test_sublist_with_merge():
2428
assert merge_dict(
2529
{'sublist': [1, 2, 3]},
2630
{'sublist': [0, '+merge', 4]},
2731
) == {'sublist': [0, 1, 2, 3, 4]}
2832

33+
2934
def test_not_incompatible_types_dict():
3035
with pytest.raises(TypeError):
3136
assert merge_dict(
3237
{'item': 123},
3338
{'item': {'b': 5, 'c': 6}},
3439
)
3540

41+
3642
def test_not_incompatible_types_list():
3743
with pytest.raises(TypeError):
3844
assert merge_dict(

test_naucse/test_session_times.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
TZINFO = dateutil.tz.gettz('Europe/Prague')
1111

12+
1213
@pytest.fixture
1314
def model():
1415
path = Path(__file__).parent / 'fixtures/test_content'

0 commit comments

Comments
 (0)