Commit 3cb60f43 authored by Samuel GAIST's avatar Samuel GAIST

Merge branch 'pyproject_toml' into 'master'

Add pyproject.toml

See merge request !108
parents 0e982371 373aeb49
Pipeline #49866 passed with stages
in 6 minutes and 34 seconds
......@@ -6,3 +6,5 @@ use_parentheses=true
ensure_newline_before_comments=true
line_length=88
force_single_line=true
order_by_type=true
lines_between_types=1
......@@ -2,16 +2,16 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/timothycrosley/isort
rev: 5.0.5
rev: 5.8.0
hooks:
- id: isort
args: [-sl]
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: v3.4.0
hooks:
- id: check-ast
- id: check-case-conflict
......@@ -24,11 +24,11 @@ repos:
- id: check-yaml
exclude: conda/meta.yaml
- repo: https://github.com/PyCQA/flake8/
rev: 3.8.3
rev: 3.9.0
hooks:
- id: flake8
- repo: https://github.com/PyCQA/bandit
rev: 1.6.2
rev: 1.7.0
hooks:
- id: bandit
args: [-c, .bandit.yml]
......
......@@ -59,41 +59,41 @@ logger = logging.getLogger(__name__)
def pull_impl(webapi, prefix, names, force, indentation, format_cache, lib_cache):
"""Copies algorithms (and required libraries/dataformats) from the server.
Parameters:
Parameters:
webapi (object): An instance of our WebAPI class, prepared to access the
BEAT server of interest
webapi (object): An instance of our WebAPI class, prepared to access the
BEAT server of interest
prefix (str): A string representing the root of the path in which the user
objects are stored
prefix (str): A string representing the root of the path in which the user
objects are stored
names (:py:class:`list`): A list of strings, each representing the unique
relative path of the objects to retrieve or a list of usernames from
which to retrieve objects. If the list is empty, then we pull all
available objects of a given type. If no user is set, then pull all
public objects of a given type.
names (:py:class:`list`): A list of strings, each representing the unique
relative path of the objects to retrieve or a list of usernames from
which to retrieve objects. If the list is empty, then we pull all
available objects of a given type. If no user is set, then pull all
public objects of a given type.
force (bool): If set to ``True``, then overwrites local changes with the
remotely retrieved copies.
force (bool): If set to ``True``, then overwrites local changes with the
remotely retrieved copies.
indentation (int): The indentation level, useful if this function is called
recursively while downloading different object types. This is normally
set to ``0`` (zero).
indentation (int): The indentation level, useful if this function is called
recursively while downloading different object types. This is normally
set to ``0`` (zero).
format_cache (dict): A dictionary containing all dataformats already
downloaded.
format_cache (dict): A dictionary containing all dataformats already
downloaded.
lib_cache (dict): A dictionary containing all libraries already
downloaded.
lib_cache (dict): A dictionary containing all libraries already
downloaded.
Returns:
Returns:
int: Indicating the exit status of the command, to be reported back to the
calling process. This value should be zero if everything works OK,
otherwise, different than zero (POSIX compliance).
int: Indicating the exit status of the command, to be reported back to the
calling process. This value should be zero if everything works OK,
otherwise, different than zero (POSIX compliance).
"""
"""
from .dataformats import pull_impl as dataformats_pull
from .libraries import pull_impl as libraries_pull
......@@ -384,9 +384,9 @@ commands.initialise_asset_commands(algorithms, CMD_LIST, AlgorithmCommand)
def pull(ctx, name, force):
"""Downloads the specified algorithms from the server
Example:
$ beat algorithms pull --force yyy
"""
Example:
$ beat algorithms pull --force yyy
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
return pull_impl(webapi, ctx.meta["config"].path, name, force, 0, {}, {})
......@@ -401,10 +401,10 @@ def pull(ctx, name, force):
def execute(ctx, instructions, example):
"""Execute an algorithm following instructions in a JSON file
Example:
$ beat algorithms execute <instructions>
$ beat algorithms execute --examples
"""
Example:
$ beat algorithms execute <instructions>
$ beat algorithms execute --examples
"""
if example:
print_examples()
return 0
......
......@@ -89,8 +89,8 @@ class MutuallyExclusiveOption(click.Option):
class AssetInfo:
""" Information needed by the command to properly call local and remote
commands
"""Information needed by the command to properly call local and remote
commands
"""
def __init__(
......@@ -108,8 +108,8 @@ class AssetInfo:
class AssetCommand(click.Command):
""" Custom click command that will update the context with asset information
related to the command called.
"""Custom click command that will update the context with asset information
related to the command called.
"""
asset_info = AssetInfo()
......
......@@ -88,9 +88,9 @@ def list_impl(ctx, remote):
def path_impl(ctx, names):
"""Displays local path of asset files
Example:
$ beat <asset_type> path xxx
"""
Example:
$ beat <asset_type> path xxx
"""
config = ctx.meta["config"]
asset_info = ctx.meta["asset_info"]
......@@ -104,9 +104,9 @@ def path_impl(ctx, names):
def edit_impl(ctx, name):
"""Edit local asset file
Example:
$ beat <asset_type> edit xxx
"""
Example:
$ beat <asset_type> edit xxx
"""
config = ctx.meta["config"]
asset_info = ctx.meta["asset_info"]
......@@ -135,9 +135,9 @@ def check_impl(ctx, names):
def status_impl(ctx):
"""Shows (editing) status for all available items of asset type
Example:
$ beat <asset_type> status
"""
Example:
$ beat <asset_type> status
"""
config = ctx.meta["config"]
asset_info = ctx.meta["asset_info"]
......
This diff is collapsed.
......@@ -53,42 +53,42 @@ logger = logging.getLogger(__name__)
def pull_impl(webapi, prefix, names, force, indentation, cache):
"""Copies dataformats (recursively) from the server.
Data formats are particularly tricky to download because of their recursive
nature. This requires a specialized recursive technique to download base and
referenced dataformats.
Data formats are particularly tricky to download because of their recursive
nature. This requires a specialized recursive technique to download base and
referenced dataformats.
Parameters:
Parameters:
webapi (object): An instance of our WebAPI class, prepared to access the
BEAT server of interest
webapi (object): An instance of our WebAPI class, prepared to access the
BEAT server of interest
prefix (str): A string representing the root of the path in which the user
objects are stored
prefix (str): A string representing the root of the path in which the user
objects are stored
names (:py:class:`list`): A list of strings, each representing the unique
relative path of the objects to retrieve or a list of usernames from
which to retrieve objects. If the list is empty, then we pull all
available objects of a given type. If no user is set, then pull all
public objects of a given type.
names (:py:class:`list`): A list of strings, each representing the unique
relative path of the objects to retrieve or a list of usernames from
which to retrieve objects. If the list is empty, then we pull all
available objects of a given type. If no user is set, then pull all
public objects of a given type.
force (bool): If set to ``True``, then overwrites local changes with the
remotely retrieved copies.
force (bool): If set to ``True``, then overwrites local changes with the
remotely retrieved copies.
indentation (int): The indentation level, useful if this function is called
recursively while downloading different object types. This is normally
set to ``0`` (zero).
indentation (int): The indentation level, useful if this function is called
recursively while downloading different object types. This is normally
set to ``0`` (zero).
cache (dict): A dictionary containing all dataformats already downloaded.
cache (dict): A dictionary containing all dataformats already downloaded.
Returns:
Returns:
int: Indicating the exit status of the command, to be reported back to the
calling process. This value should be zero if everything works OK,
otherwise, different than zero (POSIX compliance).
int: Indicating the exit status of the command, to be reported back to the
calling process. This value should be zero if everything works OK,
otherwise, different than zero (POSIX compliance).
"""
"""
dataformats = set(names) # what is being request
download = dataformats - set(cache.keys()) # what we actually need
......@@ -187,9 +187,9 @@ commands.initialise_asset_commands(dataformats, CMD_LIST, DataformatCommand)
def pull(ctx, name, force):
"""Downloads the specified dataformats from the server
Example:
$ beat dataformats pull --force yyy
"""
Example:
$ beat dataformats pull --force yyy
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
name = common.make_up_remote_list(webapi, "dataformat", name)
if name is None:
......
......@@ -44,6 +44,7 @@ import signal
import textwrap
import threading
import traceback
from datetime import timedelta
import click
......@@ -602,7 +603,7 @@ def plot_impl(configuration, names, remote, show, output_folder, plotterparamete
data_to_plot[name] = cleaned_data
def _get_plotter_for(dataformat):
""" Returns the first plotter that matches the dataformat given in
"""Returns the first plotter that matches the dataformat given in
parameter.
"""
......@@ -812,7 +813,7 @@ def caches(ctx, name, list, delete, checksum):
def pull(ctx, names, force):
"""Downloads the specified experiments from the server.
$ beat experiments pull xxx.
$ beat experiments pull xxx.
"""
config = ctx.meta.get("config")
with common.make_webapi(config) as webapi:
......
......@@ -92,37 +92,37 @@ logger = logging.getLogger(__name__)
def pull_impl(webapi, prefix, names, force, indentation, cache):
"""Copies libraries (and dependent libraries) from the server.
Parameters:
Parameters:
webapi (object): An instance of our WebAPI class, prepared to access the
BEAT server of interest
webapi (object): An instance of our WebAPI class, prepared to access the
BEAT server of interest
prefix (str): A string representing the root of the path in which the user
objects are stored
prefix (str): A string representing the root of the path in which the user
objects are stored
names (:py:class:`list`): A list of strings, each representing the unique
relative path of the objects to retrieve or a list of usernames from
which to retrieve objects. If the list is empty, then we pull all
available objects of a given type. If no user is set, then pull all
public objects of a given type.
names (:py:class:`list`): A list of strings, each representing the unique
relative path of the objects to retrieve or a list of usernames from
which to retrieve objects. If the list is empty, then we pull all
available objects of a given type. If no user is set, then pull all
public objects of a given type.
force (bool): If set to ``True``, then overwrites local changes with the
remotely retrieved copies.
force (bool): If set to ``True``, then overwrites local changes with the
remotely retrieved copies.
indentation (int): The indentation level, useful if this function is called
recursively while downloading different object types. This is normally
set to ``0`` (zero).
indentation (int): The indentation level, useful if this function is called
recursively while downloading different object types. This is normally
set to ``0`` (zero).
cache (dict): A dictionary containing all libraries already downloaded.
cache (dict): A dictionary containing all libraries already downloaded.
Returns:
Returns:
int: Indicating the exit status of the command, to be reported back to the
calling process. This value should be zero if everything works OK,
otherwise, different than zero (POSIX compliance).
int: Indicating the exit status of the command, to be reported back to the
calling process. This value should be zero if everything works OK,
otherwise, different than zero (POSIX compliance).
"""
"""
libraries = set(names) # what is being request
download = libraries - set(cache.keys()) # what we actually need
......@@ -220,8 +220,8 @@ commands.initialise_asset_commands(libraries, CMD_LIST, LibraryCommand)
def pull(ctx, names, force):
"""Downloads the specified libraries from the server
Example:
$ beat libraries pull --force yyy
"""
Example:
$ beat libraries pull --force yyy
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
return pull_impl(webapi, ctx.meta["config"].path, names, force, 0, {})
......@@ -126,7 +126,7 @@ commands.initialise_asset_commands(
def pull(ctx, names, force):
"""Downloads the specified plotterparameters from the server.
$ beat plotterparameters pull xxx.
$ beat plotterparameters pull xxx.
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
name = common.make_up_remote_list(webapi, "plotterparameter", names)
......
......@@ -346,7 +346,7 @@ commands.initialise_asset_commands(plotters, CMD_LIST, PlotterCommand)
def pull(ctx, names, force):
"""Downloads the specified plotters from the server.
$ beat plotters pull xxx.
$ beat plotters pull xxx.
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
name = common.make_up_remote_list(webapi, "plotter", names)
......@@ -372,9 +372,9 @@ def plot(
):
"""Plots an image.
$ beat plotters plot [--show] [--force] [--sample_data]
[--input-data=<filename.json>] [--output-image=<filename.png>]
[--plotter-parameter=<plotterparameter>] [<name>]...
$ beat plotters plot [--show] [--force] [--sample_data]
[--input-data=<filename.json>] [--output-image=<filename.png>]
[--plotter-parameter=<plotterparameter>] [<name>]...
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
return plot_impl(
......
......@@ -114,7 +114,8 @@ def setup_package():
]
sync_prefixes(
prefixes, prefix_folder,
prefixes,
prefix_folder,
)
initialize_db_root_folder(
......
......@@ -85,7 +85,7 @@ commands.initialise_asset_commands(toolchains, CMD_LIST, ToolchainCommand)
def pull(ctx, names, force):
"""Downloads the specified toolchains from the server.
$ beat toolchains pull xxx.
$ beat toolchains pull xxx.
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
status, downloaded = common.pull(
......
......@@ -39,14 +39,14 @@ import time
import pkg_resources
# For inter-documentation mapping:
from bob.extension.utils import link_documentation
from bob.extension.utils import load_requirements
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
import sphinx_rtd_theme
# For inter-documentation mapping:
from bob.extension.utils import link_documentation
from bob.extension.utils import load_requirements
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
......@@ -268,9 +268,9 @@ rst_epilog = """
autoclass_content = "class"
autodoc_member_order = "bysource"
autodoc_default_options = {
"members": True,
"undoc-members": True,
"show-inheritance": True,
"members": True,
"undoc-members": True,
"show-inheritance": True,
}
if "BOB_DOCUMENTATION_SERVER" not in os.environ:
......
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
1.10.2b0
\ No newline at end of file
1.10.2b0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment