Skip to content

Commit

Permalink
Use black to auto-format all code
Browse files Browse the repository at this point in the history
Update isort configuration to be compatible with black.
  • Loading branch information
jdufresne committed Jan 30, 2019
1 parent 889ec35 commit 0f88f87
Show file tree
Hide file tree
Showing 22 changed files with 1,886 additions and 1,062 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ cache: pip
matrix:
fast_finish: true
include:
- env: TOXENV=flake8
- env: TOXENV=isort
- python: 3.7
env: TOXENV=black
- python: 3.7
env: TOXENV=flake8
- python: 3.7
env: TOXENV=isort
- python: 2.7
env: TOXENV=py27-django111
- python: 3.4
Expand Down
105 changes: 55 additions & 50 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,183 +17,188 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path 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('.'))
# sys.path.append(os.path.abspath('.'))

# -- General configuration -----------------------------------------------------

# 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.intersphinx']
extensions = ["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 = '.txt'
source_suffix = ".txt"

# The encoding of source files.
#source_encoding = 'utf-8'
# source_encoding = 'utf-8'

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

# General information about the project.
project = u'django-taggit'
copyright = u'2010-2014, Alex Gaynor and others.'
project = u"django-taggit"
copyright = u"2010-2014, Alex Gaynor and others."

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.23'
version = "0.23"
# The full version, including alpha/beta/rc tags.
release = '0.23.0'
release = "0.23.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None

# 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 directory, that shouldn't be searched
# for source files.
exclude_trees = ['_build']
exclude_trees = ["_build"]

# 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"

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []


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

# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'
html_theme = "default"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []

# 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 (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# html_logo = None

# 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'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}

# 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, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# html_show_sourcelink = 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 = 'django-taggitdoc'
htmlhelp_basename = "django-taggitdoc"


# -- 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, documentclass [howto/manual]).
latex_documents = [
('index', 'django-taggit.tex', u'django-taggit Documentation',
u'Alex Gaynor', 'manual'),
(
"index",
"django-taggit.tex",
u"django-taggit Documentation",
u"Alex Gaynor",
"manual",
)
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None

# 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


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {"https://docs.python.org/": None}
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ exclude =
docs

[isort]
combine_as_imports = True
force_grid_wrap = 0
forced_separate = taggit
include_trailing_comma = True
line_length = 88
multi_line_output = 3
not_skip = __init__.py
skip =
.tox
62 changes: 29 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,41 @@

import taggit

with open('README.rst') as f:
with open("README.rst") as f:
readme = f.read()

setup(
name='django-taggit',
version='.'.join(str(i) for i in taggit.VERSION),
description='django-taggit is a reusable Django application for simple tagging.',
name="django-taggit",
version=".".join(str(i) for i in taggit.VERSION),
description="django-taggit is a reusable Django application for simple tagging.",
long_description=readme,
author='Alex Gaynor',
author_email='[email protected]',
url='https://github.com/jazzband/django-taggit/tree/master',
packages=find_packages(exclude=('tests*',)),
package_data={
'taggit': [
'locale/*/LC_MESSAGES/*',
],
},
license='BSD',
author="Alex Gaynor",
author_email="[email protected]",
url="https://github.com/jazzband/django-taggit/tree/master",
packages=find_packages(exclude=("tests*",)),
package_data={"taggit": ["locale/*/LC_MESSAGES/*"]},
license="BSD",
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
install_requires=['Django>=1.11'],
install_requires=["Django>=1.11"],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Framework :: Django :: 2.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
include_package_data=True,
zip_safe=False,
Expand Down
2 changes: 1 addition & 1 deletion taggit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION = (0, 23, 0)

default_app_config = 'taggit.apps.TaggitAppConfig'
default_app_config = "taggit.apps.TaggitAppConfig"
4 changes: 2 additions & 2 deletions taggit/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


class TaggitAppConfig(BaseConfig):
name = 'taggit'
verbose_name = _('Taggit')
name = "taggit"
verbose_name = _("Taggit")
6 changes: 3 additions & 3 deletions taggit/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
class TagWidget(forms.TextInput):
def format_value(self, value):
if value is not None and not isinstance(value, six.string_types):
value = edit_string_for_tags([
o.tag for o in value.select_related("tag")])
value = edit_string_for_tags([o.tag for o in value.select_related("tag")])

return super(TagWidget, self).format_value(value)

Expand All @@ -25,4 +24,5 @@ def clean(self, value):
return parse_tags(value)
except ValueError:
raise forms.ValidationError(
_("Please provide a comma-separated list of tags."))
_("Please provide a comma-separated list of tags.")
)
Loading

0 comments on commit 0f88f87

Please sign in to comment.