diff --git a/.editorconfig b/.editorconfig index 99538b9..3545973 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,15 +15,6 @@ insert_final_newline = true trim_trailing_whitespace = true charset = utf-8 -# Python files -[*.py] -indent_size = 4 -# isort plugin configuration -known_first_party = invenio_theme_tugraz -multi_line_output = 2 -default_section = THIRDPARTY -skip = .eggs - # RST files (used by sphinx) [*.rst] indent_size = 4 diff --git a/docs/conf.py b/docs/conf.py index 78d92d3..640f403 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -44,9 +44,9 @@ source_suffix = ".rst" master_doc = "index" # General information about the project. -project = u"invenio-theme-tugraz" -copyright = u"2020, Graz University of Technology" -author = u"Graz University of Technology" +project = "invenio-theme-tugraz" +copyright = "2020, Graz University of Technology" +author = "Graz University of Technology" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -241,8 +241,8 @@ latex_documents = [ ( master_doc, "invenio-theme-tugraz.tex", - u"invenio-theme-tugraz Documentation", - u"Graz University of Technology", + "invenio-theme-tugraz Documentation", + "Graz University of Technology", "manual", ), ] @@ -276,7 +276,7 @@ man_pages = [ ( master_doc, "invenio-theme-tugraz", - u"invenio-theme-tugraz Documentation", + "invenio-theme-tugraz Documentation", [author], 1, ) @@ -295,7 +295,7 @@ texinfo_documents = [ ( master_doc, "invenio-theme-tugraz", - u"invenio-theme-tugraz Documentation", + "invenio-theme-tugraz Documentation", author, "invenio-theme-tugraz", "invenio module for TUGRAZ theme.", diff --git a/invenio_theme_tugraz/config.py b/invenio_theme_tugraz/config.py index 32c4264..52e141f 100644 --- a/invenio_theme_tugraz/config.py +++ b/invenio_theme_tugraz/config.py @@ -16,9 +16,7 @@ INVENIO_THEME_TUGRAZ_DEFAULT_VALUE = _("TU Graz Repository") INVENIO_THEME_TUGRAZ_BASE_TEMPLATE = "invenio_theme_tugraz/base.html" """TU Graz Default base template""" -INVENIO_THEME_TUGRAZ_ACCOUNT_BASE = ( - "invenio_theme_tugraz/accounts/accounts_base.html" -) +INVENIO_THEME_TUGRAZ_ACCOUNT_BASE = "invenio_theme_tugraz/accounts/accounts_base.html" """TU Graz Default account base template""" INVENIO_THEME_TUGRAZ_ICON = "images/icon_use.png" @@ -75,9 +73,7 @@ THEME_SITENAME = _("Repository") SECURITY_LOGIN_USER_TEMPLATE = "invenio_theme_tugraz/accounts/login_user.html" """Login template""" -SECURITY_REGISTER_USER_TEMPLATE = ( - "invenio_theme_tugraz/accounts/register_user.html" -) +SECURITY_REGISTER_USER_TEMPLATE = "invenio_theme_tugraz/accounts/register_user.html" """Sigup template""" # Invenio-app-rdm diff --git a/invenio_theme_tugraz/search.py b/invenio_theme_tugraz/search.py index bf170db..30ffd6b 100644 --- a/invenio_theme_tugraz/search.py +++ b/invenio_theme_tugraz/search.py @@ -20,5 +20,6 @@ class FrontpageRecordsSearch(RecordsSearch): index = "rdmrecords-records" default_filter = Q( - "query_string", query=( - "access.record:public " "AND versions.is_latest:true")) + "query_string", + query=("access.record:public " "AND versions.is_latest:true"), + ) diff --git a/invenio_theme_tugraz/views.py b/invenio_theme_tugraz/views.py index a0f3db0..664b62e 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -51,7 +51,9 @@ def records_serializer(records=None): """Serialize list of records.""" record_list = [] for record in records: - record_list.append(UIJSONSerializer().serialize_object_to_dict(record.to_dict())) + record_list.append( + UIJSONSerializer().serialize_object_to_dict(record.to_dict()) + ) return record_list @@ -60,8 +62,7 @@ def index(): records = FrontpageRecordsSearch()[:5].sort("-created").execute() return render_template( - "invenio_theme_tugraz/index.html", - records=records_serializer(records) + "invenio_theme_tugraz/index.html", records=records_serializer(records) ) diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 166d588..0000000 --- a/pytest.ini +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2020-2021 Graz University of Technology. -# -# invenio-theme-tugraz is free software; you can redistribute it and/or -# modify it under the terms of the MIT License; see LICENSE file for more -# details. - -[pytest] -addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_theme_tugraz --cov-report=term-missing tests invenio_theme_tugraz -testpaths = tests invenio_theme_tugraz -live_server_scope = module diff --git a/setup.cfg b/setup.cfg index 6be352f..2b24a22 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,6 +44,7 @@ install_requires = [options.extras_require] tests = + pytest-black>=0.3.0,<0.3.10 sphinx>=4.2.0,<5 pytest-invenio>=1.4.7 invenio-app>=1.3.0,<2.0.0 @@ -94,20 +95,10 @@ output-dir = invenio_theme_tugraz/translations/ [update_catalog] input-file = invenio_theme_tugraz/translations/messages.pot output-dir = invenio_theme_tugraz/translations/ - -[flake8] -max-line-length = 88 -extend-ignore = E203 -select = C,E,F,W,B,B950 -ignore = E501 - [isort] -multi_line_output = 3 -include_trailing_comma = True -force_grid_wrap = 0 -use_parentheses = True -ensure_newline_before_comments = True -line_length = 88 +profile=black -[pycodestyle] -ignore = E203,E501 +[tool:pytest] +addopts = --black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_theme_tugraz --cov-report=term-missing tests invenio_theme_tugraz +testpaths = tests invenio_theme_tugraz +live_server_scope = module