Skip to content

Commit

Permalink
chore: run black and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Oct 16, 2024
1 parent 03c1cf7 commit 782afc9
Show file tree
Hide file tree
Showing 79 changed files with 3,026 additions and 2,351 deletions.
2 changes: 1 addition & 1 deletion celeryconfig.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from celery import Celery
from django.conf import settings

app = Celery('event_routing_backends')
app = Celery("event_routing_backends")

app.config_from_object(settings)

Expand Down
121 changes: 65 additions & 56 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def get_version(*file_paths):
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError('Unable to find version string.')
raise RuntimeError("Unable to find version string.")


REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(REPO_ROOT)

VERSION = get_version('../event_routing_backends', '__init__.py')
VERSION = get_version("../event_routing_backends", "__init__.py")

# Configure Django for autodoc usage
settings.configure()
Expand All @@ -62,40 +62,40 @@ def get_version(*file_paths):
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.autosectionlabel'
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.ifconfig",
"sphinx.ext.napoleon",
"sphinx.ext.autosectionlabel",
]

# A list of warning types to suppress arbitrary warning messages.
suppress_warnings = [
'image.nonlocal_uri',
"image.nonlocal_uri",
]

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

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

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

# The top level toctree document.
top_level_doc = 'index'
top_level_doc = "index"

# General information about the project.
project = 'event-routing-backends'
copyright = f'{datetime.now().year}, Axim Collaborative, Inc' # pylint: disable=redefined-builtin
author = 'Axim Collaborative, Inc'
project_title = 'event-routing-backends'
project = "event-routing-backends"
copyright = f"{datetime.now().year}, Axim Collaborative, Inc" # pylint: disable=redefined-builtin
author = "Axim Collaborative, Inc"
project_title = "event-routing-backends"
documentation_title = f"{project_title}"

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -126,7 +126,7 @@ def get_version(*file_paths):
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'changelog.rst']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "changelog.rst"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -148,7 +148,7 @@ def get_version(*file_paths):
# 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 = []
Expand All @@ -165,22 +165,22 @@ def get_version(*file_paths):
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.

html_theme = 'sphinx_book_theme'
html_theme = "sphinx_book_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
# documentation.
#
html_theme_options = {
"repository_url": "https://github.com/openedx/event-routing-backends",
"repository_branch": "master",
"path_to_docs": "docs/",
"home_page_in_toc": True,
"use_repository_button": True,
"use_issues_button": True,
"use_edit_page_button": True,
# Please don't change unless you know what you're doing.
"extra_footer": """
"repository_url": "https://github.com/openedx/event-routing-backends",
"repository_branch": "master",
"path_to_docs": "docs/",
"home_page_in_toc": True,
"use_repository_button": True,
"use_issues_button": True,
"use_edit_page_button": True,
# Please don't change unless you know what you're doing.
"extra_footer": """
<a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">
<img
alt="Creative Commons License"
Expand All @@ -200,7 +200,7 @@ def get_version(*file_paths):
rel="license"
href="https://creativecommons.org/licenses/by-sa/4.0/"
>Creative Commons Attribution-ShareAlike 4.0 International License</a>.
"""
""",
}

# Add any paths that contain custom themes here, relative to this directory.
Expand Down Expand Up @@ -229,10 +229,10 @@ def get_version(*file_paths):
# 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"]

html_css_files = [
'theme_overrides.css',
"theme_overrides.css",
]

# Add any extra paths that contain custom files (such as robots.txt or
Expand Down Expand Up @@ -313,23 +313,20 @@ def get_version(*file_paths):
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = f'{project}doc'
htmlhelp_basename = f"{project}doc"

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

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -338,10 +335,9 @@ def get_version(*file_paths):
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_target = f'{project}.tex'
latex_target = f"{project}.tex"
latex_documents = [
(top_level_doc, latex_target, documentation_title,
author, 'manual'),
(top_level_doc, latex_target, documentation_title, author, "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -381,10 +377,7 @@ def get_version(*file_paths):

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(top_level_doc, project_title, documentation_title,
[author], 1)
]
man_pages = [(top_level_doc, project_title, documentation_title, [author], 1)]

# If true, show URL addresses after external links.
#
Expand All @@ -397,9 +390,15 @@ def get_version(*file_paths):
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(top_level_doc, project_title, documentation_title,
author, project_title, 'Various backends for receiving edX LMS events.',
'Miscellaneous'),
(
top_level_doc,
project_title,
documentation_title,
author,
project_title,
"Various backends for receiving edX LMS events.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand Down Expand Up @@ -473,7 +472,7 @@ def get_version(*file_paths):
# epub_post_files = []

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
epub_exclude_files = ["search.html"]

# The depth of the table of contents in toc.ncx.
#
Expand Down Expand Up @@ -506,9 +505,12 @@ def get_version(*file_paths):

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/3.6', None),
'django': ('https://docs.djangoproject.com/en/1.11/', 'https://docs.djangoproject.com/en/1.11/_objects/'),
'model_utils': ('https://django-model-utils.readthedocs.io/en/latest/', None),
"python": ("https://docs.python.org/3.6", None),
"django": (
"https://docs.djangoproject.com/en/1.11/",
"https://docs.djangoproject.com/en/1.11/_objects/",
),
"model_utils": ("https://django-model-utils.readthedocs.io/en/latest/", None),
}


Expand All @@ -520,17 +522,24 @@ def on_init(app): # pylint: disable=unused-argument
avoid checking in the generated reStructuredText files.
"""
docs_path = os.path.abspath(os.path.dirname(__file__))
root_path = os.path.abspath(os.path.join(docs_path, '..'))
apidoc_path = 'sphinx-apidoc'
if hasattr(sys, 'real_prefix'): # Check to see if we are in a virtualenv
root_path = os.path.abspath(os.path.join(docs_path, ".."))
apidoc_path = "sphinx-apidoc"
if hasattr(sys, "real_prefix"): # Check to see if we are in a virtualenv
# If we are, assemble the path manually
bin_path = os.path.abspath(os.path.join(sys.prefix, 'bin'))
bin_path = os.path.abspath(os.path.join(sys.prefix, "bin"))
apidoc_path = os.path.join(bin_path, apidoc_path)
check_call([apidoc_path, '-o', docs_path, os.path.join(root_path, 'event_routing_backends'),
os.path.join(root_path, 'event_routing_backends/migrations')])
check_call(
[
apidoc_path,
"-o",
docs_path,
os.path.join(root_path, "event_routing_backends"),
os.path.join(root_path, "event_routing_backends/migrations"),
]
)


def setup(app):
"""Sphinx extension: run sphinx-apidoc."""
event = 'builder-inited'
event = "builder-inited"
app.connect(event, on_init)
2 changes: 1 addition & 1 deletion event_routing_backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Various backends for receiving edX LMS events..
"""

__version__ = '9.3.1'
__version__ = "9.3.1"
7 changes: 4 additions & 3 deletions event_routing_backends/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Contains Admin class(es) for the django app.
"""

from config_models.admin import KeyedConfigurationModelAdmin
from django.contrib import admin

Expand All @@ -13,11 +14,11 @@ class RouterConfigurationAdmin(KeyedConfigurationModelAdmin):
Admin model class for RouterConfiguration model.
"""

history_list_display = 'status'
change_form_template = 'admin/router_conf_change_form.html'
history_list_display = "status"
change_form_template = "admin/router_conf_change_form.html"

def get_displayable_field_names(self):
"""
Get the list display.
"""
return ['backend_name', 'enabled', 'route_url', 'configurations']
return ["backend_name", "enabled", "route_url", "configurations"]
28 changes: 16 additions & 12 deletions event_routing_backends/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ class EventRoutingBackendsConfig(AppConfig):
Configuration for the event_routing_backends Django application.
"""

name = 'event_routing_backends'
name = "event_routing_backends"
verbose_name = "Event Routing Backends"

plugin_app = {
PluginSettings.CONFIG: {
'lms.djangoapp': {
'production': {PluginSettings.RELATIVE_PATH: 'settings.production'},
'common': {PluginSettings.RELATIVE_PATH: 'settings.common'},
'devstack': {PluginSettings.RELATIVE_PATH: 'settings.devstack'},
"lms.djangoapp": {
"production": {PluginSettings.RELATIVE_PATH: "settings.production"},
"common": {PluginSettings.RELATIVE_PATH: "settings.common"},
"devstack": {PluginSettings.RELATIVE_PATH: "settings.devstack"},
},
"cms.djangoapp": {
"production": {PluginSettings.RELATIVE_PATH: "settings.production"},
"common": {PluginSettings.RELATIVE_PATH: "settings.common"},
"devstack": {PluginSettings.RELATIVE_PATH: "settings.devstack"},
},
'cms.djangoapp': {
'production': {PluginSettings.RELATIVE_PATH: 'settings.production'},
'common': {PluginSettings.RELATIVE_PATH: 'settings.common'},
'devstack': {PluginSettings.RELATIVE_PATH: 'settings.devstack'},
}
}
}

Expand All @@ -35,5 +35,9 @@ def ready(self):
"""
super().ready()
# pylint: disable=import-outside-toplevel, unused-import
from event_routing_backends.processors.caliper import event_transformers as caliper_event_transformers
from event_routing_backends.processors.xapi import event_transformers as xapi_event_transformers
from event_routing_backends.processors.caliper import (
event_transformers as caliper_event_transformers,
)
from event_routing_backends.processors.xapi import (
event_transformers as xapi_event_transformers,
)
Loading

0 comments on commit 782afc9

Please sign in to comment.