Skip to content

Commit

Permalink
Feature/SK-839 | Remove ruff ignores that can be autofixed (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorvaladi authored May 13, 2024
1 parent fb76c47 commit 0281ad7
Show file tree
Hide file tree
Showing 65 changed files with 260 additions and 473 deletions.
66 changes: 33 additions & 33 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
import sphinx_rtd_theme # noqa: F401

# Insert path
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))

# Project info
project = 'FEDn'
copyright = '2021, Scaleout Systems AB'
author = 'Scaleout Systems AB'
project = "FEDn"
copyright = "2021, Scaleout Systems AB"
author = "Scaleout Systems AB"

# The full version, including alpha/beta/rc tags
release = '0.9.2'
release = "0.9.2"

# Add any Sphinx extension module names here, as strings
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx_rtd_theme',
'sphinx_code_tabs'
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"sphinx_rtd_theme",
"sphinx_code_tabs"
]

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

# Add any paths that contain templates here, relative to this directory.
templates_path = []
Expand All @@ -39,31 +39,31 @@
exclude_patterns = []

# The theme to use for HTML and HTML Help pages.
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

html_theme_options = {
'logo_only': True,
"logo_only": True,
}

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

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

# If defined shows an image instead of project name on page top-left (link to index page)
html_logo = '_static/images/scaleout_logo_flat_dark.svg'
html_logo = "_static/images/scaleout_logo_flat_dark.svg"
# FEDn logo looks ugly on rtd theme

html_favicon = 'favicon.png'
html_favicon = "favicon.png"

# Here we assume that the file is at _static/custom.css
html_css_files = [
'css/elements.css',
'css/text.css',
'css/utilities.css',
"css/elements.css",
"css/text.css",
"css/utilities.css",
]

# LaTeX elements
Expand All @@ -89,32 +89,32 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'fedn.tex', 'FEDn Documentation',
'Scaleout Systems AB', 'manual'),
(master_doc, "fedn.tex", "FEDn Documentation",
"Scaleout Systems AB", "manual"),
]

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'fedn', 'FEDn Documentation',
(master_doc, "fedn", "FEDn Documentation",
[author], 1)
]

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'fedn', 'FEDn Documentation',
author, 'fedn', 'One line description of project.',
'Miscellaneous'),
(master_doc, "fedn", "FEDn Documentation",
author, "fedn", "One line description of project.",
"Miscellaneous"),
]

# Bibliographic Dublin Core info.
epub_title = project

epub_exclude_files = ['search.html']
epub_exclude_files = ["search.html"]

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {"https://docs.python.org/": None}

pygments_style = 'sphinx'
pygments_style = "sphinx"
1 change: 0 additions & 1 deletion examples/async-clients/client/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def make_data(n_min=50, n_max=100):

def train(in_model_path, out_model_path):
"""Train model."""

# Load model
parameters = load_parameters(in_model_path)
model = compile_model()
Expand Down
1 change: 0 additions & 1 deletion examples/async-clients/run_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def run_client(online_for=120, name="client"):
This is repeated for N_CYCLES.
"""

conf = copy.deepcopy(client_config)
conf["name"] = name

Expand Down
1 change: 0 additions & 1 deletion examples/flower-client/client/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

def _get_node_id():
"""Get client number from environment variable."""

number = os.environ.get("CLIENT_NUMBER", "0")
return int(number)

Expand Down
1 change: 0 additions & 1 deletion examples/mnist-keras/client/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def validate(in_model_path, out_json_path, data_path=None):
:param data_path: The path to the data file.
:type data_path: str
"""

# Load data
x_train, y_train = load_data(data_path)
x_test, y_test = load_data(data_path, is_train=False)
Expand Down
12 changes: 3 additions & 9 deletions fedn/cli/client_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def validate_client_config(config):
:param config: Client config (dict).
"""

try:
if config["discover_host"] is None or config["discover_host"] == "":
raise InvalidClientConfig("Missing required configuration: discover_host")
Expand All @@ -28,9 +27,7 @@ def validate_client_config(config):
@main.group("client")
@click.pass_context
def client_cmd(ctx):
"""
:param ctx:
""":param ctx:
"""
pass

Expand All @@ -43,8 +40,7 @@ def client_cmd(ctx):
@client_cmd.command("list")
@click.pass_context
def list_clients(ctx, protocol: str, host: str, port: str, token: str = None, n_max: int = None):
"""
Return:
"""Return:
------
- count: number of clients
- result: list of clients
Expand Down Expand Up @@ -114,9 +110,7 @@ def client_cmd(
reconnect_after_missed_heartbeat,
verbosity,
):
"""
:param ctx:
""":param ctx:
:param discoverhost:
:param discoverport:
:param token:
Expand Down
11 changes: 3 additions & 8 deletions fedn/cli/combiner_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
@main.group("combiner")
@click.pass_context
def combiner_cmd(ctx):
"""
:param ctx:
""":param ctx:
"""
pass

Expand All @@ -33,9 +31,7 @@ def combiner_cmd(ctx):
@click.option("-in", "--init", required=False, default=None, help="Path to configuration file to (re)init combiner.")
@click.pass_context
def start_cmd(ctx, discoverhost, discoverport, token, name, host, port, fqdn, secure, verify, max_clients, init):
"""
:param ctx:
""":param ctx:
:param discoverhost:
:param discoverport:
:param token:
Expand Down Expand Up @@ -76,8 +72,7 @@ def start_cmd(ctx, discoverhost, discoverport, token, name, host, port, fqdn, se
@combiner_cmd.command("list")
@click.pass_context
def list_combiners(ctx, protocol: str, host: str, port: str, token: str = None, n_max: int = None):
"""
Return:
"""Return:
------
- count: number of combiners
- result: list of combiners
Expand Down
3 changes: 1 addition & 2 deletions fedn/cli/config_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
@main.group("config", invoke_without_command=True)
@click.pass_context
def config_cmd(ctx):
"""
- Configuration commands for the FEDn CLI.
"""- Configuration commands for the FEDn CLI.
"""
if ctx.invoked_subcommand is None:
click.echo("\n--- FEDn Cli Configuration ---\n")
Expand Down
4 changes: 1 addition & 3 deletions fedn/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
@click.group(context_settings=CONTEXT_SETTINGS)
@click.pass_context
def main(ctx):
"""
:param ctx:
""":param ctx:
"""
ctx.obj = dict()
7 changes: 2 additions & 5 deletions fedn/cli/model_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
@main.group("model")
@click.pass_context
def model_cmd(ctx):
"""
:param ctx:
""":param ctx:
"""
pass

Expand All @@ -23,8 +21,7 @@ def model_cmd(ctx):
@model_cmd.command("list")
@click.pass_context
def list_models(ctx, protocol: str, host: str, port: str, token: str = None, n_max: int = None):
"""
Return:
"""Return:
------
- count: number of models
- result: list of models
Expand Down
7 changes: 2 additions & 5 deletions fedn/cli/package_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
@main.group("package")
@click.pass_context
def package_cmd(ctx):
"""
:param ctx:
""":param ctx:
"""
pass

Expand Down Expand Up @@ -51,8 +49,7 @@ def create_cmd(ctx, path, name):
@package_cmd.command("list")
@click.pass_context
def list_packages(ctx, protocol: str, host: str, port: str, token: str = None, n_max: int = None):
"""
Return:
"""Return:
------
- count: number of packages
- result: list of packages
Expand Down
7 changes: 2 additions & 5 deletions fedn/cli/round_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
@main.group("round")
@click.pass_context
def round_cmd(ctx):
"""
:param ctx:
""":param ctx:
"""
pass

Expand All @@ -23,8 +21,7 @@ def round_cmd(ctx):
@round_cmd.command("list")
@click.pass_context
def list_rounds(ctx, protocol: str, host: str, port: str, token: str = None, n_max: int = None):
"""
Return:
"""Return:
------
- count: number of rounds
- result: list of rounds
Expand Down
16 changes: 4 additions & 12 deletions fedn/cli/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@


def get_statestore_config_from_file(init):
"""
:param init:
""":param init:
:return:
"""
with open(init, "r") as file:
Expand All @@ -43,9 +41,7 @@ def check_helper_config_file(config):
@main.group("run")
@click.pass_context
def run_cmd(ctx):
"""
:param ctx:
""":param ctx:
"""
pass

Expand Down Expand Up @@ -125,9 +121,7 @@ def client_cmd(
reconnect_after_missed_heartbeat,
verbosity,
):
"""
:param ctx:
""":param ctx:
:param discoverhost:
:param discoverport:
:param token:
Expand Down Expand Up @@ -201,9 +195,7 @@ def client_cmd(
@click.option("-in", "--init", required=False, default=None, help="Path to configuration file to (re)init combiner.")
@click.pass_context
def combiner_cmd(ctx, discoverhost, discoverport, token, name, host, port, fqdn, secure, verify, max_clients, init):
"""
:param ctx:
""":param ctx:
:param discoverhost:
:param discoverport:
:param token:
Expand Down
7 changes: 2 additions & 5 deletions fedn/cli/session_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
@main.group("session")
@click.pass_context
def session_cmd(ctx):
"""
:param ctx:
""":param ctx:
"""
pass

Expand All @@ -23,8 +21,7 @@ def session_cmd(ctx):
@session_cmd.command("list")
@click.pass_context
def list_sessions(ctx, protocol: str, host: str, port: str, token: str = None, n_max: int = None):
"""
Return:
"""Return:
------
- count: number of sessions
- result: list of sessions
Expand Down
3 changes: 1 addition & 2 deletions fedn/cli/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ def get_client_package_dir(path: str) -> str:

# Print response from api (list of entities)
def print_response(response, entity_name: str):
"""
Prints the api response to the cli.
"""Prints the api response to the cli.
:param response:
type: array
description: list of entities
Expand Down
Loading

0 comments on commit 0281ad7

Please sign in to comment.