Skip to content

Commit

Permalink
Solved rules (#518)
Browse files Browse the repository at this point in the history
* fix ruff rule I001

* fix ruff rule E501

* fix ruff rule C408

* removed extend-ignore list from pyproject.toml

* chore: ruff reformatted

* chore: trim trailing whitespace

* chore: create extend-exclude section

* Add SVG to ruff exclude

---------

Co-authored-by: Mark Walker <[email protected]>
  • Loading branch information
raffaellasuardini and marksweb committed Feb 20, 2024
1 parent e1a55f8 commit 7b7e5e5
Show file tree
Hide file tree
Showing 18 changed files with 175 additions and 175 deletions.
5 changes: 3 additions & 2 deletions djangocms_admin_style/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Release logic:
1. Increase version number (change __version__ below).
2. Ensure the static bundle is upto date with ``nvm use && gulp icons && gulp sass bundle``
2. Ensure the static bundle is upto date with
``nvm use && gulp icons && gulp sass bundle``
3. Assure that all changes have been documented in CHANGELOG.rst.
4. In setup.py check that
- versions from all third party packages are pinned in ``REQUIREMENTS``.
Expand All @@ -16,4 +17,4 @@
10. Publish the release when ready
11. Github actions will publish the new package to pypi
"""
__version__ = '3.3.0'
__version__ = "3.3.0"
2 changes: 1 addition & 1 deletion djangocms_admin_style/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Translators:
# Angelo Dini <[email protected]>, 2016
Expand Down
2 changes: 1 addition & 1 deletion djangocms_admin_style/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Translators:
# Paulo <[email protected]>, 2015
Expand Down
2 changes: 1 addition & 1 deletion djangocms_admin_style/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Translators:
# Frigory33 <[email protected]>, 2016
Expand Down
2 changes: 1 addition & 1 deletion djangocms_admin_style/locale/it/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Translators:
# yakky <[email protected]>, 2015
Expand Down
2 changes: 1 addition & 1 deletion djangocms_admin_style/locale/lt/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Translators:
# Matas Dailyda <[email protected]>, 2015
Expand Down
2 changes: 1 addition & 1 deletion djangocms_admin_style/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Translators:
# Mikhail Kolesnik <[email protected]>, 2015
Expand Down
2 changes: 1 addition & 1 deletion djangocms_admin_style/locale/uk/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Translators:
# Mikhail Kolesnik <[email protected]>, 2015
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@

mark {
color: $black;
font-weight: bold;
font-weight: bold;
font-style: italic;
background-color: #ff9;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion djangocms_admin_style/templates/admin/inc/branding.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1>{{ site_header|default:_('Django Administration') }}</h1>
{% endif %}
{% if user.is_authenticated %}
<li>
<form method="POST" action="{% url 'admin:logout' %}">
<form method="POST" action="{% url 'admin:logout' %}">
{% csrf_token %}
<button type="submit">
<b>{% trans 'Log out' %} {% firstof user.get_short_name user.get_username %}</b>
Expand Down
23 changes: 11 additions & 12 deletions djangocms_admin_style/templatetags/admin_style_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,24 @@
from django.template.loader import render_to_string
from django.utils.translation import gettext


# We follow the Semantic versioning convention
# minor - Refers to the minor release track (3.x.1)
# patch - Refers to the patch release track (3.4.x)
VALID_VERSION_CHECK_TYPES = ('minor', 'patch')
VALID_VERSION_CHECK_TYPES = ("minor", "patch")

register = template.Library()


@register.simple_tag(takes_context=True)
def current_site_name(context):
request = context.get('request')
request = context.get("request")

try:
site_name = get_current_site(request).name
except AttributeError:
# This happens if request is None
# and sites framework is not in INSTALLED_APPS
site_name = gettext('my site')
site_name = gettext("my site")
return conditional_escape(site_name)


Expand All @@ -35,22 +34,22 @@ def render_update_notification(context):
check_type = None
notifications_enabled = False
else:
check_type = getattr(settings, 'CMS_UPDATE_CHECK_TYPE', 'patch')
notifications_enabled = getattr(settings, 'CMS_ENABLE_UPDATE_CHECK', True)
check_type = getattr(settings, "CMS_UPDATE_CHECK_TYPE", "patch")
notifications_enabled = getattr(settings, "CMS_ENABLE_UPDATE_CHECK", True)

request = context.get('request')
request = context.get("request")

try:
index_page = request.resolver_match.url_name == 'index'
index_page = request.resolver_match.url_name == "index"
except AttributeError:
notifications_enabled = False
else:
notifications_enabled = index_page and notifications_enabled

if notifications_enabled and check_type in VALID_VERSION_CHECK_TYPES:
context = {
'cms_version': cms.__version__,
'cms_version_check_type': check_type,
"cms_version": cms.__version__,
"cms_version_check_type": check_type,
}
return render_to_string('admin/inc/cms_upgrade_notification.html', context)
return ''
return render_to_string("admin/inc/cms_upgrade_notification.html", context)
return ""
18 changes: 11 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
[tool.ruff]
line-length = 119

extend-exclude = [
".ruff_cache",
".env",
".venv",
".po",
".svg",
]

[tool.ruff.lint]
select=[
"E", # pycodestyle errors
"W", # pycodestyle warnings
Expand All @@ -11,10 +22,3 @@ select=[
"PLW", # pylint warning
"UP", # pyupgrade
]

extend-ignore = [
# TODO fix separately
"E501", # line too long
"I001", # import block unsorted
"C408", # unnecessary dict call
]
91 changes: 45 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,67 @@

from djangocms_admin_style import __version__


REQUIREMENTS = [
"Django",
]


CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.1',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Django CMS',
'Framework :: Django CMS :: 3.6',
'Framework :: Django CMS :: 3.7',
'Framework :: Django CMS :: 3.8',
'Framework :: Django CMS :: 3.8',
'Framework :: Django CMS :: 3.9',
'Framework :: Django CMS :: 3.10',
'Framework :: Django CMS :: 3.11',
'Framework :: Django CMS :: 4.0',
'Framework :: Django CMS :: 4.1',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django CMS",
"Framework :: Django CMS :: 3.6",
"Framework :: Django CMS :: 3.7",
"Framework :: Django CMS :: 3.8",
"Framework :: Django CMS :: 3.8",
"Framework :: Django CMS :: 3.9",
"Framework :: Django CMS :: 3.10",
"Framework :: Django CMS :: 3.11",
"Framework :: Django CMS :: 4.0",
"Framework :: Django CMS :: 4.1",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
]

this_directory = Path(__file__).parent
long_description = (this_directory / "README.rst").read_text()

setup(
name='djangocms-admin-style',
name="djangocms-admin-style",
version=__version__,
author='Divio AG',
author_email='[email protected]',
maintainer='Django CMS Association and contributors',
maintainer_email='[email protected]',
url='https://github.com/django-cms/djangocms-admin-style',
license='BSD-3-Clause',
description='Adds pretty CSS styles for the django CMS admin interface.',
author="Divio AG",
author_email="[email protected]",
maintainer="Django CMS Association and contributors",
maintainer_email="[email protected]",
url="https://github.com/django-cms/djangocms-admin-style",
license="BSD-3-Clause",
description="Adds pretty CSS styles for the django CMS admin interface.",
long_description=long_description,
packages=find_packages(exclude=['preview', 'tests']),
python_requires='>=3.7',
packages=find_packages(exclude=["preview", "tests"]),
python_requires=">=3.7",
include_package_data=True,
zip_safe=False,
install_requires=REQUIREMENTS,
classifiers=CLASSIFIERS,
test_suite='tests.settings.run',
test_suite="tests.settings.run",
)
Loading

0 comments on commit 7b7e5e5

Please sign in to comment.