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

blacken #161

Merged
merged 1 commit into from
Nov 28, 2021
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
24 changes: 12 additions & 12 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ jobs:
architecture: x64
- run: pip install tox
- run: tox -e docs
# lint:
# runs-on: ubuntu-latest
# name: Lint the package
# steps:
# - uses: actions/checkout@v2
# - name: Setup python
# uses: actions/setup-python@v2
# with:
# python-version: "3.10"
# architecture: x64
# - run: pip install tox
# - run: tox -e lint
lint:
runs-on: ubuntu-latest
name: Lint the package
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: "3.10"
architecture: x64
- run: pip install tox
- run: tox -e lint
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ graft demo
graft .github

include README.rst
include CHANGES.txt
include CHANGES.rst
include LICENSE.txt
include CONTRIBUTORS.txt
include COPYRIGHT.txt
Expand All @@ -17,5 +17,6 @@ include tox.ini
include rtd.txt

prune docs/_build
prune docs/_themes

recursive-exclude * __pycache__ *.py[cod]
29 changes: 12 additions & 17 deletions demo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
from pyramid.config import Configurator
from pyramid.i18n import (
get_localizer,
get_locale_name,
TranslationStringFactory
)
from pyramid.i18n import TranslationStringFactory, get_locale_name, get_localizer


_ = TranslationStringFactory('messages')
_ = TranslationStringFactory("messages")


def root_view(request):
request.locale_name = 'fr'
request.locale_name = "fr"
localizer = get_localizer(request)
return {
'pyramid_translated': localizer.translate(_('Hello World')),
'locale_name': get_locale_name(request),
"pyramid_translated": localizer.translate(_("Hello World")),
"locale_name": get_locale_name(request),
}


def app(global_settings, **settings):
config = Configurator(settings=settings)
config.include('pyramid_jinja2')
config.add_route(name='root', pattern='/')
config.add_view(root_view, renderer='helloworld.jinja2')
config.add_translation_dirs('demo:locale/')
config.include("pyramid_jinja2")
config.add_route(name="root", pattern="/")
config.add_view(root_view, renderer="helloworld.jinja2")
config.add_translation_dirs("demo:locale/")
return config.make_wsgi_app()


Expand All @@ -34,14 +29,14 @@ class Mainer(object):

def main(self):
port = 8080
app_config = {'DEBUG': True, 'reload_templates': True}
app_config = {"DEBUG": True, "reload_templates": True}
pyramid_app = app({}, **app_config)
httpd = self.make_server('', port, pyramid_app)
httpd = self.make_server("", port, pyramid_app)
# Serve until process is killed
httpd.serve_forever()


main = Mainer().main

if __name__ == '__main__':
if __name__ == "__main__":
main() # pragma: nocover
12 changes: 7 additions & 5 deletions demo/test_demo.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import unittest

import pyramid.testing


class DemoTests(unittest.TestCase):
def test_root_view(self):
from demo import root_view

m = pyramid.testing.DummyRequest()
root_view(m)
self.assertEqual(m.locale_name, 'fr')
self.assertEqual(m.locale_name, "fr")

def test_app(self):
from demo import app

webapp = app({})
self.assertTrue(callable(webapp))

Expand All @@ -22,13 +25,12 @@ def serve_forever(self):
self.serving = True

def make_server(self, *args, **kwargs):
return Mock(args=args,
kwargs=kwargs,
serve_forever=self.serve_forever)
return Mock(args=args, kwargs=kwargs, serve_forever=self.serve_forever)

mainer = MyMainer()
mainer.main()
self.assertTrue(getattr(mainer, 'serving', False))
self.assertTrue(getattr(mainer, "serving", False))


class Mock(object):
def __init__(self, **kwargs):
Expand Down
119 changes: 65 additions & 54 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# If your extensions are in another directory, add it here. If the
# directory is relative to the documentation root, use os.path.abspath to
# make it absolute, like shown here.
#sys.path.append(os.path.abspath('some/directory'))
# sys.path.append(os.path.abspath('some/directory'))
import datetime
import pylons_sphinx_themes
import sys
Expand All @@ -24,76 +24,77 @@

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['.templates']
templates_path = [".templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General substitutions.
project = 'pyramid_jinja2'
project = "pyramid_jinja2"
thisyear = datetime.datetime.now().year
copyright = '2011-%s, Agendaless Consulting' % thisyear
copyright = "2011-%s, Agendaless Consulting" % thisyear

# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
# The short X.Y version.
import pkg_resources

version = pkg_resources.get_distribution(project).version
# The full version, including alpha/beta/rc tags.
release = version

# There are two options for replacing |today|: either, you set today to
# some non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
today_fmt = "%B %d, %Y"

# List of documents that shouldn't be included in the build.
#unused_docs = []
# unused_docs = []

# List of directories, relative to source directories, that shouldn't be
# searched for source files.
#exclude_dirs = []
# exclude_dirs = []

exclude_patterns = ['_themes/README.rst',]
exclude_patterns = [
"_themes/README.rst",
]

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
#pygments_style = 'sphinx'
# pygments_style = 'sphinx'


# Options for HTML output
# -----------------------

# Add and use Pylons theme
html_theme_path = pylons_sphinx_themes.get_html_themes_path()
html_theme = 'pyramid'
html_theme = "pyramid"


html_theme_options = {
'github_url': 'https://github.com/Pylons/pyramid_jinja2'
}
html_theme_options = {"github_url": "https://github.com/Pylons/pyramid_jinja2"}


# The style sheet to use for HTML and HTML Help pages. A file of that name
Expand All @@ -103,11 +104,11 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None

# A shorter title for the navigation bar. Default is the same as
# html_title.
#html_short_title = None
# html_short_title = None

# The name of an image file (within the static path) to place at the top of
# the sidebar.
Expand All @@ -116,98 +117,108 @@
# The name of an image file (within the static path) to use as favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or
# 32x32 pixels large.
#html_favicon = None
# html_favicon = None

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

# If not '', a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = "%b %d, %Y"

# Do not use smart quotes.
smartquotes = False

# Custom sidebar templates, maps document names to template names.
# Control display of sidebars and include ethical ads from RTD
html_sidebars = {'**': [
'localtoc.html',
'ethicalads.html',
'relations.html',
'sourcelink.html',
'searchbox.html',
]}
html_sidebars = {
"**": [
"localtoc.html",
"ethicalads.html",
"relations.html",
"sourcelink.html",
"searchbox.html",
]
}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}

# If false, no module index is generated.
#html_use_modindex = True
# html_use_modindex = True

# If false, no index is generated.
#html_use_index = True
# html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False

# If true, the reST sources are included in the HTML build as
# _sources/<name>.
#html_copy_source = True
# html_copy_source = True

# If true, an OpenSearch description file will be output, and all pages
# will contain a <link> tag referring to it. The value of this option must
# be the base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''

# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'atemplatedoc'
htmlhelp_basename = "atemplatedoc"

# for cross referencing documentations
intersphinx_mapping = {
'jinja2': ('http://jinja.pocoo.org/docs/', None),
'pyramid': ('https://docs.pylonsproject.org/projects/pyramid/en/latest/', None),
'pyramid_zcml': ('https://docs.pylonsproject.org/projects/pyramid_zcml/en/latest/', None),
'pytest': ('https://docs.pytest.org/en/latest/', None),
"jinja2": ("http://jinja.pocoo.org/docs/", None),
"pyramid": ("https://docs.pylonsproject.org/projects/pyramid/en/latest/", None),
"pyramid_zcml": (
"https://docs.pylonsproject.org/projects/pyramid_zcml/en/latest/",
None,
),
"pytest": ("https://docs.pytest.org/en/latest/", None),
}


# Options for LaTeX output
# ------------------------

# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# latex_paper_size = 'letter'

# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# latex_font_size = '10pt'

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, document class [howto/manual]).
latex_documents = [
('index', 'pyramid_jinja2.tex', 'pyramid_jinja2 Documentation',
'Pylons Project Developers', 'manual'),
(
"index",
"pyramid_jinja2.tex",
"pyramid_jinja2 Documentation",
"Pylons Project Developers",
"manual",
),
]

# The name of an image file (relative to this directory) to place at the
# top of the title page.
#latex_logo = '.static/logo_hi.gif'
# latex_logo = '.static/logo_hi.gif'

# For "manual" documents, if this is true, then toplevel headings are
# parts, not chapters.
#latex_use_parts = False
# latex_use_parts = False

# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# latex_preamble = ''

# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []

# If false, no module index is generated.
#latex_use_modindex = True
# latex_use_modindex = True
Loading