Skip to content

Commit 53c2f75

Browse files
committed
black format
1 parent d8887da commit 53c2f75

File tree

5 files changed

+33
-29
lines changed

5 files changed

+33
-29
lines changed

docs/conf.py

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

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

20-
project = 'Dynamic Breadcrumbs'
21-
copyright = '2021, Marcelo Canina'
22-
author = 'Marcelo Canina'
20+
project = "Dynamic Breadcrumbs"
21+
copyright = "2021, Marcelo Canina"
22+
author = "Marcelo Canina"
2323

2424

2525
# -- General configuration ---------------------------------------------------
@@ -30,32 +30,31 @@
3030
extensions = []
3131

3232
# Add any paths that contain templates here, relative to this directory.
33-
templates_path = ['_templates']
33+
templates_path = ["_templates"]
3434

3535
# List of patterns, relative to source directory, that match files and
3636
# directories to ignore when looking for source files.
3737
# This pattern also affects html_static_path and html_extra_path.
38-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
38+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
3939

4040

4141
# -- Options for HTML output -------------------------------------------------
4242

4343
# The theme to use for HTML and HTML Help pages. See the documentation for
4444
# a list of builtin themes.
4545
#
46-
html_theme = 'alabaster'
46+
html_theme = "alabaster"
4747

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

5353
html_theme_options = {
5454
"description": "Generate Breadcrumbs from URLs in Django",
5555
"github_user": "marcanuy",
5656
"github_repo": "django-dynamic-breadcrumbs",
57-
#"fixed_sidebar": True,
57+
# "fixed_sidebar": True,
5858
"github_banner": True,
59-
#"github_button": True,
60-
59+
# "github_button": True,
6160
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
from django.conf import settings
22

33

4-
DYNAMIC_BREADCRUMBS_HOME_LABEL = getattr(settings, "DYNAMIC_BREADCRUMBS_HOME_LABEL", "Home")
5-
DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH = getattr(settings, "DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH", False)
4+
DYNAMIC_BREADCRUMBS_HOME_LABEL = getattr(
5+
settings, "DYNAMIC_BREADCRUMBS_HOME_LABEL", "Home"
6+
)
7+
DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH = getattr(
8+
settings, "DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH", False
9+
)

dynamic_breadcrumbs/utils.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from . import app_settings
55

6+
67
class Breadcrumbs:
78
def __init__(self, base_url="", path=None):
89
self.base_url = base_url
@@ -27,20 +28,20 @@ def _split_path(self, path=None):
2728
path = path[1:]
2829

2930
# avoid splitting and returning a list with an empty string
30-
if path == '':
31+
if path == "":
3132
return list()
3233

3334
result = path.split("/")
3435
return result
3536

3637
def _add_home(self):
3738
b_item = BreadcrumbsItem(
38-
base_url=self.base_url,
39-
name_raw=app_settings.DYNAMIC_BREADCRUMBS_HOME_LABEL,
40-
path="/",
41-
position=1
42-
)
43-
self.items.append(b_item)
39+
base_url=self.base_url,
40+
name_raw=app_settings.DYNAMIC_BREADCRUMBS_HOME_LABEL,
41+
path="/",
42+
position=1,
43+
)
44+
self.items.append(b_item)
4445

4546
def _fill_items(self):
4647
path = "/"
@@ -53,8 +54,8 @@ def _fill_items(self):
5354
# or if location is not home, always shows home in breadcrumbs
5455
if (app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH and not parts) or parts:
5556
self._add_home()
56-
57-
if parts==[]:
57+
58+
if parts == []:
5859
return
5960

6061
for i, item in enumerate(parts):

runtests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
def runtests():
88
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
9-
argv = sys.argv[:1] + ['test'] + sys.argv[1:]
9+
argv = sys.argv[:1] + ["test"] + sys.argv[1:]
1010
execute_from_command_line(argv)
1111

1212

13-
if __name__ == '__main__':
13+
if __name__ == "__main__":
1414
runtests()

tests/tests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_as_list(self):
6969
self.assertEqual(result[2]["resolved"], True)
7070

7171
def test_as_list_only_home(self):
72-
app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH=True
72+
app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH = True
7373
path = "/"
7474
breadcrumbs = Breadcrumbs(path=path)
7575

@@ -78,7 +78,7 @@ def test_as_list_only_home(self):
7878
self.assertEqual(len(result), 1)
7979

8080
def test_as_list_not_showing_at_home(self):
81-
app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH=False
81+
app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH = False
8282
path = "/"
8383
breadcrumbs = Breadcrumbs(path=path)
8484

@@ -87,24 +87,24 @@ def test_as_list_not_showing_at_home(self):
8787
self.assertEqual(len(result), 0)
8888

8989
def test_show_home_at_base_url(self):
90-
app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH=True
90+
app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH = True
9191
path = "/"
9292
breadcrumbs = Breadcrumbs(path=path)
9393
print(app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH)
9494
result = breadcrumbs.as_list()
9595

9696
self.assertEqual(len(result), 1)
97-
97+
9898
def test_hide_home_at_base_url(self):
99-
app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH=False
99+
app_settings.DYNAMIC_BREADCRUMBS_SHOW_AT_BASE_PATH = False
100100
path = "/"
101101
breadcrumbs = Breadcrumbs(path=path)
102102

103103
result = breadcrumbs.as_list()
104104

105105
print(result)
106106
self.assertEqual(len(result), 0)
107-
107+
108108

109109
class BreadcrumbsItemTests(GenericModelTestCase):
110110
def test_get_resolved_url_metadata_resolves_valid_path(self):

0 commit comments

Comments
 (0)