Skip to content
Permalink
Browse files

Reproducible lint: Invoke `pre-commit run --all-files` on full repo.

  • Loading branch information
benjaoming committed Jan 9, 2020
1 parent eff327f commit 254c4a2658894c8c993a3921bec2580a6138b49b
Showing with 4,607 additions and 3,853 deletions.
  1. +42 −35 docs/conf.py
  2. +39 −39 setup.py
  3. +2 −2 src/wiki/__init__.py
  4. +26 −19 src/wiki/admin.py
  5. +13 −4 src/wiki/apps.py
  6. +35 −23 src/wiki/checks.py
  7. +91 −133 src/wiki/conf/settings.py
  8. +1 −1 src/wiki/core/exceptions.py
  9. +8 −5 src/wiki/core/http.py
  10. +9 −11 src/wiki/core/markdown/__init__.py
  11. +24 −22 src/wiki/core/markdown/mdx/codehilite.py
  12. +4 −5 src/wiki/core/markdown/mdx/previewlinks.py
  13. +7 −7 src/wiki/core/markdown/mdx/responsivetable.py
  14. +4 −3 src/wiki/core/paginator.py
  15. +10 −13 src/wiki/core/permissions.py
  16. +8 −7 src/wiki/core/plugins/base.py
  17. +1 −1 src/wiki/core/plugins/loader.py
  18. +8 −20 src/wiki/core/plugins/registry.py
  19. +1 −1 src/wiki/core/utils.py
  20. +17 −14 src/wiki/core/version.py
  21. +48 −35 src/wiki/decorators.py
  22. +1 −1 src/wiki/editors/base.py
  23. +22 −16 src/wiki/editors/markitup.py
  24. +238 −202 src/wiki/forms.py
  25. +26 −15 src/wiki/forms_account_handling.py
  26. +27 −32 src/wiki/managers.py
  27. +361 −114 src/wiki/migrations/0001_initial.py
  28. +12 −4 src/wiki/migrations/0002_urlpath_moved_to.py
  29. +7 −7 src/wiki/models/__init__.py
  30. +105 −92 src/wiki/models/article.py
  31. +53 −47 src/wiki/models/pluginbase.py
  32. +86 −100 src/wiki/models/urlpath.py
  33. +1 −1 src/wiki/plugins/attachments/__init__.py
  34. +1 −1 src/wiki/plugins/attachments/admin.py
  35. +2 −2 src/wiki/plugins/attachments/apps.py
  36. +46 −36 src/wiki/plugins/attachments/forms.py
  37. +25 −26 src/wiki/plugins/attachments/markdown_extensions.py
  38. +100 −29 src/wiki/plugins/attachments/migrations/0001_initial.py
  39. +3 −5 src/wiki/plugins/attachments/migrations/0002_auto_20151118_1816.py
  40. +56 −47 src/wiki/plugins/attachments/models.py
  41. +14 −20 src/wiki/plugins/attachments/settings.py
  42. +32 −20 src/wiki/plugins/attachments/urls.py
  43. +143 −125 src/wiki/plugins/attachments/views.py
  44. +15 −15 src/wiki/plugins/attachments/wiki_plugin.py
  45. +1 −1 src/wiki/plugins/editsection/__init__.py
  46. +2 −2 src/wiki/plugins/editsection/apps.py
  47. +27 −22 src/wiki/plugins/editsection/markdown_extensions.py
  48. +3 −3 src/wiki/plugins/editsection/settings.py
  49. +48 −41 src/wiki/plugins/editsection/views.py
  50. +9 −5 src/wiki/plugins/editsection/wiki_plugin.py
  51. +1 −1 src/wiki/plugins/globalhistory/__init__.py
  52. +2 −2 src/wiki/plugins/globalhistory/apps.py
  53. +1 −1 src/wiki/plugins/globalhistory/settings.py
  54. +12 −10 src/wiki/plugins/globalhistory/views.py
  55. +10 −4 src/wiki/plugins/globalhistory/wiki_plugin.py
  56. +1 −1 src/wiki/plugins/help/__init__.py
  57. +2 −2 src/wiki/plugins/help/apps.py
  58. +8 −6 src/wiki/plugins/help/wiki_plugin.py
  59. +1 −1 src/wiki/plugins/images/__init__.py
  60. +6 −7 src/wiki/plugins/images/admin.py
  61. +6 −3 src/wiki/plugins/images/apps.py
  62. +3 −1 src/wiki/plugins/images/checks.py
  63. +17 −15 src/wiki/plugins/images/forms.py
  64. +13 −9 src/wiki/plugins/images/markdown_extensions.py
  65. +44 −17 src/wiki/plugins/images/migrations/0001_initial.py
  66. +3 −7 src/wiki/plugins/images/migrations/0002_auto_20151118_1811.py
  67. +28 −21 src/wiki/plugins/images/models.py
  68. +18 −19 src/wiki/plugins/images/settings.py
  69. +2 −2 src/wiki/plugins/images/templatetags/wiki_images_tags.py
  70. +64 −52 src/wiki/plugins/images/views.py
  71. +49 −38 src/wiki/plugins/images/wiki_plugin.py
  72. +1 −1 src/wiki/plugins/links/__init__.py
  73. +2 −2 src/wiki/plugins/links/apps.py
  74. +27 −32 src/wiki/plugins/links/mdx/djangowikilinks.py
  75. +37 −42 src/wiki/plugins/links/mdx/urlize.py
  76. +1 −1 src/wiki/plugins/links/settings.py
  77. +12 −10 src/wiki/plugins/links/views.py
  78. +21 −17 src/wiki/plugins/links/wiki_plugin.py
  79. +1 −1 src/wiki/plugins/macros/__init__.py
  80. +2 −2 src/wiki/plugins/macros/apps.py
  81. +29 −25 src/wiki/plugins/macros/mdx/macro.py
  82. +2 −3 src/wiki/plugins/macros/mdx/toc.py
  83. +14 −16 src/wiki/plugins/macros/mdx/wikilinks.py
  84. +3 −8 src/wiki/plugins/macros/settings.py
  85. +3 −4 src/wiki/plugins/macros/templatetags/wiki_macro_tags.py
  86. +10 −8 src/wiki/plugins/macros/wiki_plugin.py
  87. +1 −1 src/wiki/plugins/notifications/__init__.py
  88. +17 −13 src/wiki/plugins/notifications/apps.py
  89. +63 −75 src/wiki/plugins/notifications/forms.py
  90. +23 −18 src/wiki/plugins/notifications/management/commands/wiki_notifications_create_defaults.py
  91. +24 −10 src/wiki/plugins/notifications/migrations/0001_initial.py
  92. +2 −3 src/wiki/plugins/notifications/migrations/0002_auto_20151118_1811.py
  93. +21 −21 src/wiki/plugins/notifications/models.py
  94. +1 −2 src/wiki/plugins/notifications/settings.py
  95. +25 −19 src/wiki/plugins/notifications/views.py
  96. +10 −4 src/wiki/plugins/notifications/wiki_plugin.py
  97. +1 −1 src/wiki/plugins/redlinks/__init__.py
  98. +2 −2 src/wiki/plugins/redlinks/apps.py
  99. +1 −1 src/wiki/plugins/redlinks/mdx/redlinks.py
  100. +1 −1 src/wiki/plugins/redlinks/wiki_plugin.py
  101. +162 −70 src/wiki/sites.py
  102. +1 −1 src/wiki/static/wiki/bootstrap/css/wiki-bootstrap.min.css
  103. +30 −30 src/wiki/templatetags/wiki_tags.py
  104. +163 −98 src/wiki/urls.py
  105. +20 −17 src/wiki/views/accounts.py
  106. +249 −206 src/wiki/views/article.py
  107. +2 −2 src/wiki/views/deleted_list.py
  108. +14 −13 src/wiki/views/mixins.py
  109. +47 −55 testproject/testproject/settings/base.py
  110. +2 −7 testproject/testproject/settings/codehilite.py
  111. +5 −5 testproject/testproject/settings/customauthuser.py
  112. +7 −6 testproject/testproject/settings/dev.py
  113. +2 −2 testproject/testproject/settings/sendfile.py
  114. +11 −7 testproject/testproject/urls.py
  115. +15 −15 testproject/testproject/views.py
  116. +14 −14 tests/base.py
  117. +37 −38 tests/core/test_accounts.py
  118. +12 −8 tests/core/test_basic.py
  119. +37 −18 tests/core/test_checks.py
  120. +4 −4 tests/core/test_commands.py
  121. +10 −6 tests/core/test_forms.py
  122. +12 −39 tests/core/test_managers.py
  123. +53 −62 tests/core/test_markdown.py
  124. +17 −26 tests/core/test_models.py
  125. +31 −32 tests/core/test_sites.py
  126. +101 −93 tests/core/test_template_filters.py
  127. +78 −79 tests/core/test_template_tags.py
  128. +17 −19 tests/core/test_urls.py
  129. +0 −1 tests/core/test_utils.py
  130. +350 −390 tests/core/test_views.py
  131. +4 −7 tests/plugins/attachments/test_commands.py
  132. +5 −7 tests/plugins/attachments/test_models.py
  133. +43 −50 tests/plugins/attachments/test_views.py
  134. +55 −44 tests/plugins/editsection/test_editsection.py
  135. +41 −39 tests/plugins/globalhistory/test_globalhistory.py
  136. +3 −3 tests/plugins/images/test_forms.py
  137. +81 −61 tests/plugins/images/test_views.py
  138. +15 −16 tests/plugins/links/test_links.py
  139. +118 −154 tests/plugins/links/test_urlize.py
  140. +3 −2 tests/plugins/macros/test_links.py
  141. +8 −10 tests/plugins/macros/test_toc.py
  142. +0 −1 tests/plugins/notifications/test_forms.py
  143. +32 −21 tests/plugins/notifications/test_views.py
  144. +36 −40 tests/settings.py
  145. +137 −32 tests/testdata/migrations/0001_initial.py
  146. +1 −1 tests/testdata/models.py
  147. +10 −9 tests/testdata/urls.py
@@ -37,8 +37,8 @@
# 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.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('../testproject'))
sys.path.insert(0, os.path.abspath("../src"))
sys.path.insert(0, os.path.abspath("../testproject"))

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

@@ -62,7 +62,7 @@ def process_docstring(app, what, name, obj, options, lines):

for field in fields:
# Skip ManyToOneRel and ManyToManyRel fields which have no 'verbose_name' or 'help_text'
if not hasattr(field, 'verbose_name'):
if not hasattr(field, "verbose_name"):
continue

# Decode and strip any html out of the field's help text
@@ -75,62 +75,65 @@ def process_docstring(app, what, name, obj, options, lines):
if help_text:
# Add the model field to the end of the docstring as a param
# using the help text as the description
lines.append(u':param %s: %s' % (field.attname, help_text))
lines.append(u":param %s: %s" % (field.attname, help_text))
else:
# Add the model field to the end of the docstring as a param
# using the verbose name as the description
lines.append(u':param %s: %s' % (field.attname, verbose_name))
lines.append(u":param %s: %s" % (field.attname, verbose_name))

# Add the field's type to the docstring
if isinstance(field, models.ForeignKey):
for to in field.to_fields:
lines.append(u':type %s: %s to :class:`~%s`' % (field.attname, type(field).__name__, to))
lines.append(
u":type %s: %s to :class:`~%s`"
% (field.attname, type(field).__name__, to)
)
else:
lines.append(u':type %s: %s' % (field.attname, type(field).__name__))
lines.append(u":type %s: %s" % (field.attname, type(field).__name__))

return lines


extlinks = {
'url-issue': ('https://github.com/django-wiki/django-wiki/issues/%s', '#'),
"url-issue": ("https://github.com/django-wiki/django-wiki/issues/%s", "#"),
}


def setup(app):
# Register the docstring processor with sphinx
app.connect('autodoc-process-docstring', process_docstring)
app.connect("autodoc-process-docstring", process_docstring)


# 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.extlinks',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.extlinks",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
]

# 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 encoding of source files.
# source_encoding = 'utf-8-sig'

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

# General information about the project.
project = 'django-wiki'
copyright = '{}, Benjamin Bach'.format(datetime.now().year) # noqa
project = "django-wiki"
copyright = "{}, Benjamin Bach".format(datetime.now().year) # noqa


path = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

sys.path = [path] + sys.path
sys.path = [os.path.join(path, 'wiki')] + sys.path
sys.path = [os.path.join(path, "wiki")] + sys.path


import wiki # noqa
@@ -157,7 +160,7 @@ def setup(app):

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]

# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
@@ -174,25 +177,25 @@ def setup(app):
# 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 = []

linkcheck_ignore = [
r'wiki.+',
r"wiki.+",
]


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

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if on_rtd:
os.system("sphinx-apidoc --doc-project='Python Reference' -f -o . ../wiki")
if on_rtd:
html_theme = 'default'
html_theme = "default"
else:
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# 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
@@ -265,18 +268,16 @@ def setup(app):
# html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'django-wikidoc'
htmlhelp_basename = "django-wikidoc"


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

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}
@@ -285,8 +286,11 @@ def setup(app):
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
(
'index', 'django-wiki.tex', 'django-wiki Documentation',
'Benjamin Bach', 'manual'
"index",
"django-wiki.tex",
"django-wiki Documentation",
"Benjamin Bach",
"manual",
),
]

@@ -316,8 +320,7 @@ def setup(app):
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'django-wiki', 'django-wiki Documentation',
['Benjamin Bach'], 1)
("index", "django-wiki", "django-wiki Documentation", ["Benjamin Bach"], 1)
]

# If true, show URL addresses after external links.
@@ -331,9 +334,13 @@ def setup(app):
# dir menu entry, description, category)
texinfo_documents = [
(
'index', 'django-wiki', 'django-wiki Documentation',
'Benjamin Bach', 'django-wiki', 'Wiki engine for Django - with real data models!',
'Miscellaneous'
"index",
"django-wiki",
"django-wiki Documentation",
"Benjamin Bach",
"django-wiki",
"Wiki engine for Django - with real data models!",
"Miscellaneous",
),
]

@@ -7,9 +7,7 @@

from setuptools import find_packages, setup

sys.path.append(
os.path.join(os.path.dirname(__file__), 'src')
)
sys.path.append(os.path.join(os.path.dirname(__file__), "src"))

# noqa
from wiki import __version__ # isort:skip # noqa
@@ -31,34 +29,34 @@ def get_path(fname):
"django-mptt>=0.9,<0.10",
"django-sekizai>=0.10",
"sorl-thumbnail>=12,<13",
"Markdown>=3.1,<3.2.0"
"Markdown>=3.1,<3.2.0",
]

test_requirements = [
'django-functest>=1.0.3,<1.1',
'pytest>=5.3,<5.4',
'pytest-django',
'pytest-cov',
'pytest-pythonpath',
"django-functest>=1.0.3,<1.1",
"pytest>=5.3,<5.4",
"pytest-django",
"pytest-cov",
"pytest-pythonpath",
]

test_lint_requirements = [
'flake8>=3.7,<3.8',
'flake8-isort',
"flake8>=3.7,<3.8",
"flake8-isort",
]

setup_requirements = [
'pytest-runner',
"pytest-runner",
]

development_requirements = test_requirements + test_lint_requirements + [
'pre-commit',
]
development_requirements = (
test_requirements + test_lint_requirements + ["pre-commit",]
)

extras_requirements = {
'devel': development_requirements,
'test': test_requirements,
'testlint': test_lint_requirements,
"devel": development_requirements,
"test": test_requirements,
"testlint": test_lint_requirements,
}

setup(
@@ -70,30 +68,32 @@ def get_path(fname):
description="A wiki system written for the Django framework.",
license="GPLv3",
keywords=["django", "wiki", "markdown"],
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[os.path.splitext(os.path.basename(path))[0] for path in glob('src/*.py')],
long_description=open('README.rst').read(),
packages=find_packages("src"),
package_dir={"": "src"},
py_modules=[
os.path.splitext(os.path.basename(path))[0] for path in glob("src/*.py")
],
long_description=open("README.rst").read(),
zip_safe=False,
install_requires=install_requirements,
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries :: Application Frameworks',
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Application Frameworks",
],
include_package_data=True,
setup_requires=setup_requirements,
@@ -17,7 +17,7 @@

from wiki.core.version import get_version

default_app_config = 'wiki.apps.WikiConfig'
default_app_config = "wiki.apps.WikiConfig"

VERSION = (0, 6, 0, 'alpha', 0)
VERSION = (0, 6, 0, "alpha", 0)
__version__ = get_version(VERSION)

0 comments on commit 254c4a2

Please sign in to comment.
You can’t perform that action at this time.