Skip to content

Commit

Permalink
Formatted with Python 'Black' (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoldiron authored Feb 24, 2021
1 parent 665ec5f commit 673df09
Show file tree
Hide file tree
Showing 21 changed files with 364 additions and 234 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.{html,css,js,json,xml,yaml,yml}]
indent_size = 2

[*.{md,ps1,sh,py,rst}]
indent_size = 4
3 changes: 3 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ stages:
- script: flake8 .
displayName: 'CR-QC: Static analysis (flake8)'

- script: black --check .
displayName: 'CR-QC: Format check'

- script: mypy ./wagtailcache/
displayName: 'CR-QC: Type check (mypy)'

Expand Down
20 changes: 11 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,23 @@

html_sidebars = {
"**": [
"about.html", # Project name, description, etc.
"searchbox.html", # Search.
"globaltoc.html", # Global table of contents.
"about.html", # Project name, description, etc.
"searchbox.html", # Search.
"globaltoc.html", # Global table of contents.
"readingmodes.html", # Light/sepia/dark color schemes.
"sponsors.html", # Fancy sponsor links.
"sponsors.html", # Fancy sponsor links.
]
}

html_theme_options = {
"description": "A fast and simple page cache for Wagtail.",
"sponsors": [{
"href": "https://github.com/coderedcorp/wagtail-cache",
"image": "https://docs.coderedcorp.com/logo-square-red-128.png",
"note": "This project is comercially supported by CodeRed."
}],
"sponsors": [
{
"href": "https://github.com/coderedcorp/wagtail-cache",
"image": "https://docs.coderedcorp.com/logo-square-red-128.png",
"note": "This project is comercially supported by CodeRed.",
}
],
}

html_last_updated_fmt = ""
2 changes: 1 addition & 1 deletion docs/releases/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Release Notes
v0.3.0
v0.2.1
v0.2.0
v0.1.0
v0.1.0
2 changes: 2 additions & 0 deletions docs/releases/v1.0.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

* Updated unit tests for Wagtail 2.12.

* Apply ``black`` formatting to codebase.


.. note::

Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tool.black]
line-length = 80
target-version = ['py36', 'py37', 'py38']
# Regular expression of files to exclude.
exclude = '''
/(
migrations
)/
'''
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-e ./
alabaster
black
codespell
flake8
mypy
Expand Down
42 changes: 20 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
from setuptools import setup, find_packages
from wagtailcache import __version__

with open('README.md', encoding='utf8') as readme_file:
with open("README.md", encoding="utf8") as readme_file:
readme = readme_file.read()

setup(
name='wagtail-cache',
name="wagtail-cache",
version=__version__,
author="CodeRed LLC",
author_email='[email protected]',
url='https://github.com/coderedcorp/wagtail-cache',
author_email="[email protected]",
url="https://github.com/coderedcorp/wagtail-cache",
description="A simple page cache for Wagtail based on the Django cache middleware.",
long_description=readme,
long_description_content_type='text/markdown',
long_description_content_type="text/markdown",
license="BSD license",
include_package_data=True,
packages=find_packages(),
install_requires=[
'wagtail>=2.0'
],
install_requires=["wagtail>=2.0"],
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Framework :: Django',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Framework :: Wagtail',
'Framework :: Wagtail :: 2',
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Framework :: Django",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
],
)
4 changes: 4 additions & 0 deletions testproject/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ class WagtailPage(Page):
cached due to the middleware, but will not have the ability to provide
custom cache instructions or "smart" caching features.
"""

template = "home/page.html"


class CachedPage(WagtailCacheMixin, Page):
"""
Represents a normal use-case.
"""

template = "home/page.html"


Expand All @@ -23,6 +25,7 @@ class CacheControlPage(WagtailCacheMixin, Page):
Page that should never cache and should generate a custom
cache-control header.
"""

template = "home/page.html"
cache_control = "no-cache"

Expand All @@ -32,6 +35,7 @@ class CallableCacheControlPage(WagtailCacheMixin, Page):
Page that should never cache and should generate a custom
cache-control header via a function call.
"""

template = "home/page.html"

def cache_control(self):
Expand Down
Loading

0 comments on commit 673df09

Please sign in to comment.