Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve ruff config #64

Merged
merged 9 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Use 'x' to check each item: [x] I have ...
* [ ] I have opened this pull request against ``master``
* [ ] I have added or modified the tests when changing logic
* [ ] I have followed [the conventional commits guidelines](https://www.conventionalcommits.org/) to add meaningful information into the changelog
* [ ] I have read the [contribution guidelines ](https://github.com/django-cms/django-cms/blob/develop/CONTRIBUTING.rst) and I have joined #workgroup-pr-review on
* [ ] I have read the [contribution guidelines ](https://github.com/django-cms/django-cms/blob/develop/CONTRIBUTING.rst) and I have joined #workgroup-pr-review on
[Slack](https://www.django-cms.org/slack) to find a “pr review buddy” who is going to review my pull request.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*.log
*.pot
.DS_Store
.coverage
.coverage*
.coverage/
.eggs/
.idea/
Expand Down
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ that allows you to create a HTML container containing classes, styles, ids
and other attributes definable through the plugins settings.


.. note::
.. note::

This project is considered 3rd party (no supervision by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_). Join us on `Slack <https://www.django-cms.org/slack/>`_ for more information.

Expand All @@ -22,8 +22,8 @@ Contribute to this project and win rewards

Because this is a an open-source project, we welcome everyone to
`get involved in the project <https://www.django-cms.org/en/contribute/>`_ and
`receive a reward <https://www.django-cms.org/en/bounty-program/>`_ for their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.
`receive a reward <https://www.django-cms.org/en/bounty-program/>`_ for their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.

We'll be delighted to receive your
feedback in the form of issues and pull requests. Before submitting your
Expand Down
30 changes: 15 additions & 15 deletions aldryn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@


def split_and_strip(string):
return [item.strip() for item in string.split(',') if item]
return [item.strip() for item in string.split(",") if item]


class Form(forms.BaseForm):
templates = forms.CharField(
'List of additional templates (comma separated)',
"List of additional templates (comma separated)",
required=False,
)
class_names = forms.CharField(
'List of classes (comma separated)',
"List of classes (comma separated)",
required=False,
)
tag_types = forms.CharField(
'List of HTML tags (comma separated)',
"List of HTML tags (comma separated)",
required=False,
)

def clean(self):
data = super(Form, self).clean()
data = super().clean()

# prettify
data['templates'] = ', '.join(split_and_strip(data['templates']))
data['class_names'] = ', '.join(split_and_strip(data['class_names']))
data['tag_types'] = ', '.join(split_and_strip(data['tag_types']))
data["templates"] = ", ".join(split_and_strip(data["templates"]))
data["class_names"] = ", ".join(split_and_strip(data["class_names"]))
data["tag_types"] = ", ".join(split_and_strip(data["tag_types"]))
return data

def to_settings(self, data, settings):
if data['templates']:
settings['DJANGOCMS_STYLE_TEMPLATES'] = [
if data["templates"]:
settings["DJANGOCMS_STYLE_TEMPLATES"] = [
(item, item)
for item in split_and_strip(data['templates'])
for item in split_and_strip(data["templates"])
]
if data['class_names']:
settings['DJANGOCMS_STYLE_CHOICES'] = split_and_strip(data['class_names'])
if data['tag_types']:
settings['DJANGOCMS_STYLE_TAGS'] = split_and_strip(data['tag_types'])
if data["class_names"]:
settings["DJANGOCMS_STYLE_CHOICES"] = split_and_strip(data["class_names"])
if data["tag_types"]:
settings["DJANGOCMS_STYLE_TAGS"] = split_and_strip(data["tag_types"])

return settings
2 changes: 1 addition & 1 deletion djangocms_style/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.0'
__version__ = "3.0.0"
42 changes: 21 additions & 21 deletions djangocms_style/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@

class StylePlugin(CMSPluginBase):
model = Style
name = _('Style')
render_template = 'djangocms_style/style.html'
name = _("Style")
render_template = "djangocms_style/style.html"
allow_children = True

fieldsets = (
(None, {
'fields': (
'label',
('class_name', 'tag_type'),
"fields": (
"label",
("class_name", "tag_type"),
)
}),
(_('Advanced settings'), {
'classes': ('collapse',),
'fields': (
'additional_classes',
'id_name',
'template',
'attributes',
(_("Advanced settings"), {
"classes": ("collapse",),
"fields": (
"additional_classes",
"id_name",
"template",
"attributes",
),
}),
(_('Inline style settings'), {
'classes': ('collapse',),
'fields': (
('padding_top', 'padding_right',
'padding_bottom', 'padding_left'),
('margin_top', 'margin_right',
'margin_bottom', 'margin_left'),
(_("Inline style settings"), {
"classes": ("collapse",),
"fields": (
("padding_top", "padding_right",
"padding_bottom", "padding_left"),
("margin_top", "margin_right",
"margin_bottom", "margin_left"),
),
}),
)

def get_render_template(self, context, instance, placeholder):
return 'djangocms_style/{}/style.html'.format(instance.template)
return f"djangocms_style/{instance.template}/style.html"

def render(self, context, instance, placeholder):
context['inline_styles'] = instance.get_styles()
context["inline_styles"] = instance.get_styles()
return super().render(context, instance, placeholder)


Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/af/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/ar/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/be/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/bg/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/ca/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/cmn/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/cs/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/da/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/el/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/es_AR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/es_BO/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/et/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/eu/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/fa/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/ga/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/gl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/gu/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/he/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/hi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_style/locale/hr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
Loading
Loading