Skip to content

Commit

Permalink
Run flake8 for all .py files tracked in git (#2394)
Browse files Browse the repository at this point in the history
* Run flake8 for all .py files tracked in git

* Fix flake8 errors
  • Loading branch information
matrss authored May 29, 2024
1 parent bc77fa8 commit 8e673ad
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 flake8-builtins
flake8 --count --statistics mslib tests
git ls-files -z '**.py' | xargs -0 flake8
no-crlf-in-git:
runs-on: ubuntu-latest
Expand Down
9 changes: 3 additions & 6 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import importlib.util
import os
import sys
import logging
import matplotlib
# Disable pyc files
sys.dont_write_bytecode = True

Expand Down Expand Up @@ -188,7 +186,6 @@ def generate_initial_config():
# windows needs \\ or / but mixed is terrible. *nix needs /
mscolab_fs.writetext(constants.MSCOLAB_CONFIG_FILE, config_string.replace('\\', '/'))
path = fs.path.join(constants.ROOT_DIR, 'mscolab', constants.MSCOLAB_CONFIG_FILE)
parent_path = fs.path.join(constants.ROOT_DIR, 'mscolab')

if not constants.SERVER_CONFIG_FS.exists(constants.MSCOLAB_AUTH_FILE):
config_string = '''
Expand All @@ -211,7 +208,6 @@ def _load_module(module_name, path):
sys.modules[module_name] = module
spec.loader.exec_module(module)


_load_module("mswms_settings", constants.SERVER_CONFIG_FILE_PATH)
_load_module("mscolab_settings", path)

Expand All @@ -227,7 +223,8 @@ def _load_module(module_name, path):
def reset_config():
"""Reset the configuration directory used in the tests (tests.constants.ROOT_FS) after every test
"""
# Ideally this would just be constants.ROOT_FS.removetree("/"), but SQLAlchemy complains if the SQLite file is deleted.
# Ideally this would just be constants.ROOT_FS.removetree("/"), but SQLAlchemy complains if the SQLite file is
# deleted.
for e in constants.ROOT_FS.walk.files(exclude=["mscolab.db"]):
constants.ROOT_FS.remove(e)
for e in constants.ROOT_FS.walk.dirs(search="depth"):
Expand All @@ -239,4 +236,4 @@ def reset_config():


# Make fixtures available everywhere
from tests.fixtures import *
from tests.fixtures import * # noqa: F401, F403
127 changes: 65 additions & 62 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
# serve to show the default.
import os
import sys
import logging
import setuptools
import subprocess
import requests
import zipfile
import shutil
import pathlib

from string import Template


def get_tutorial_images():
TUTORIAL_URL = "https://fz-juelich.sciebo.de/s/KcF29hPNRzkxN6q/download"
TUTORIAL_DIR = 'videos/mp4'
Expand Down Expand Up @@ -97,24 +98,21 @@ def get_tutorial_images():
mslib.mswms.wms.server.generate_gallery(sphinx=True, generate_code=True, all_plots=True, levels="3,4,200,300",
vtimes="2012-10-18T00:00:00,2012-10-19T00:00:00")

# readthedocs has no past.builtins
try:
from past.builtins import execfile
except ImportError as ex:
logging.error("%s", ex)
execfile('../mslib/version.py')
version = {}
exec(pathlib.Path("../mslib/version.py").read_text(), version)
__version__ = version["__version__"]

on_rtd = os.environ.get('READTHEDOCS') == 'True'

# 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.insert(0, os.path.abspath('.'))
# sys.path.insert(0, os.path.abspath('.'))

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

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand All @@ -133,14 +131,14 @@ def get_tutorial_images():
source_suffix = '.rst'

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

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'MSS - Mission Support System'
copyright = \
project_copyright = \
'2016-2024 by the MSS team, see AUTHORS, ' \
'2011-2014 Marc Rautenhaus, ' \
'2008-2014 Deutsches Zentrum fuer Luft- und Raumfahrt e.V.'
Expand Down Expand Up @@ -178,9 +176,9 @@ def get_tutorial_images():

# 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'
today_fmt = '%Y-%m-%d'

# List of patterns, relative to source directory, that match files and
Expand All @@ -190,27 +188,27 @@ def get_tutorial_images():

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

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

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# keep_warnings = False

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -230,25 +228,25 @@ def get_tutorial_images():
htmls_static_path = ['_static']
html_css_files = ['mss.css']
html_context = {
'display_github': False, # Add 'Edit on Bitbucket' link instead of 'View page source'
'display_github': False, # Add 'Edit on Bitbucket' link instead of 'View page source'
'last_updated': True,
'commit': False,
}

# 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.
# "<project> v<release> documentation" by default.
#html_title = u'MSS - Mission Support System v1.1'
# html_title = u'MSS - Mission Support System v1.1'

# 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.
Expand All @@ -257,7 +255,7 @@ def get_tutorial_images():
# The name of an image file (relative to this directory) to use as a 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,
Expand All @@ -269,111 +267,116 @@ def get_tutorial_images():
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# html_extra_path = []

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

# 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_domain_indices = True
# html_domain_indices = 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, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# html_show_copyright = 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 = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
#html_search_language = 'en'
# html_search_language = 'en'

# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#html_search_options = {'type': 'default'}
# html_search_options = {'type': 'default'}

# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'MSS-MissionSupportSystemdoc'

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

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

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

# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',

# Latex figure (float) alignment
#'figure_align': 'htbp',
# Latex figure (float) alignment
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'MSS-MissionSupportSystem.tex', 'MSS - Mission Support System Documentation',
u'A.Hilboll, A.Lal, C.Rolf, I.Krisch, J.-U.Grooß, J.Ungermann, M.Rautenhaus, R.Bauer, S.Padhi, T.Breuer', 'manual'),
(
master_doc,
'MSS-MissionSupportSystem.tex',
'MSS - Mission Support System Documentation',
'A.Hilboll, A.Lal, C.Rolf, I.Krisch, J.-U.Grooß, J.Ungermann, M.Rautenhaus, R.Bauer, S.Padhi, T.Breuer',
'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

# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False
# latex_show_urls = False

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

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


# -- Options for manual page output ---------------------------------------
Expand All @@ -386,7 +389,7 @@ def get_tutorial_images():
]

# If true, show URL addresses after external links.
#man_show_urls = False
# man_show_urls = False


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -401,14 +404,14 @@ def get_tutorial_images():
]

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

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

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# texinfo_no_detailmenu = False
suppress_warnings = ['image.nonlocal_uri']

0 comments on commit 8e673ad

Please sign in to comment.