Commit 3e8d67ff authored by Flavio TARSETTI's avatar Flavio TARSETTI

Merge branch 'pyproject_toml' into 'master'

Add pyproject.toml

See merge request !150
parents 0585882c a5aa31fc
Pipeline #49907 passed with stages
in 15 minutes and 25 seconds
......@@ -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.6.4
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
......@@ -21,12 +21,13 @@ repos:
- id: check-added-large-files
- id: check-docstring-first
- 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
exclude: beat/editor/test
......
......@@ -37,8 +37,7 @@ from .asset import AssetType
def enumerate_assets(prefix_path, asset_type, latest_only=False):
"""Enumerate the assets available in the given prefix for the given type
"""
"""Enumerate the assets available in the given prefix for the given type"""
def _find_json_files(path):
"""Return all json files from folder sorted"""
......
......@@ -32,9 +32,9 @@ from PyQt5.QtWidgets import QComboBox
class MouseWheelFilter(QObject):
"""Event filter to avoid spin boxes and combo boxes to get triggered
when scrolling the mouse in for example a QScrollArea
when scrolling the mouse in for example a QScrollArea
Based on https://stackoverflow.com/a/5821874/5843716
Based on https://stackoverflow.com/a/5821874/5843716
"""
def eventFilter(self, obj, event):
......
......@@ -89,8 +89,7 @@ class ExperimentBlock:
class AlgorithmData:
"""Class containing the information related to the endpoints of an algorithm
"""
"""Class containing the information related to the endpoints of an algorithm"""
def __init__(self) -> None:
self.input_type_map: typing.Mapping[str, str] = {}
......@@ -257,7 +256,7 @@ class ExperimentModel:
def _load_toolchain_info(self) -> None:
"""Load the needed information from the toolchain
Currently only the connections are of interest.
Currently only the connections are of interest.
"""
toolchain = Asset(
......
{
"schema_version": 1,
"description": "Version 1 of the protocol template",
"sets": [
{
"name": "set",
"outputs": {
"out": "user/single_integer/1"
}
},
{
"name": "set2",
"outputs": {
"out": "user/single_integer/1"
}
}
]
}
{
"schema_version": 1,
"description": "Version 2 of the protocol template",
"sets": [
{
"name": "set",
"outputs": {
"out": "user/single_integer/1"
}
},
{
"name": "set2",
"outputs": {
"out": "user/single_integer/1"
}
}
]
}
......@@ -127,7 +127,7 @@ class TestAssetModel:
def test_unexpected_files(self, asset_model):
"""This test ensures that unexpected files in the prefix don't break
the AssetModel class loading code.
the AssetModel class loading code.
"""
def __create_file(path):
......@@ -210,7 +210,7 @@ class TestDataFormatModel:
def test_unexpected_files(self, df_model):
"""This test ensures that unexpected files in the prefix don't break
the AssetModel class loading code.
the AssetModel class loading code.
"""
def __create_file(path):
......
......@@ -620,7 +620,7 @@ class ParameterTestMixin:
class PropertiesEditorTestMixin:
"""Mixin that provides the common tests to execute for editors related to
block properties
block properties
"""
editor_klass = None
......
......@@ -456,7 +456,7 @@ class AssetWidget(QWidget):
@pyqtSlot(Asset)
def loadAsset(self, asset):
""" Load the content of the file given in parameter
"""Load the content of the file given in parameter
:param asset Asset: asset to edit
"""
......
......@@ -77,7 +77,7 @@ class InputType(Enum):
info = None
if self is InputType.UNKNOWN:
raise RuntimeError(f"Invalid type")
raise RuntimeError("Invalid type")
elif np.issubdtype(self.np_type, np.floating):
info = np.finfo(self.np_type)
elif np.issubdtype(self.np_type, np.integer):
......
......@@ -126,17 +126,29 @@ class RestrictedParameterWidget(QWidget):
super().__init__(parent)
self._type = data.get("type", None)
default = data.get("default", "" if self._type == "string" else 0)
# cast the default value to the required type
cast_fn = np.cast[self._type] if self._type != "string" else str
if self._type == "string":
cast_fn = str
default = data.get("default", "")
self.default = ""
elif self._type == "bool":
cast_fn = bool
default = data.get("default", False)
self.default = False
else:
cast_fn = np.cast[self._type]
default = data.get("default", 0)
self.default = 0
try:
default = cast_fn(default)
except ValueError:
logger.exception(
f"Failed to convert the default value: {default} to type {self._type}",
)
default = cast_fn("" if self._type == "string" else 0)
self.default = default
else:
self.default = default
self.current_type = InputType[self._type.upper()]
self.modality = "single"
......
......@@ -39,13 +39,13 @@ from ..decorators import frozen
class NumpySpinBox(QAbstractSpinBox):
"""Generic spinbox base class using numpy types
Requires initialization with the numpy
type that will be used.
Requires initialization with the numpy
type that will be used.
The three following signals are provided:
- valueChanged
- minimumChanged
- maximumChanged
The three following signals are provided:
- valueChanged
- minimumChanged
- maximumChanged
"""
numpyTypeChanged = pyqtSignal()
......
......@@ -241,8 +241,7 @@ class OutputPin(BasePin):
super().__init__(parent, pin, block, pin_brush, pin_pen)
def boundingRect(self):
""" bounding rect width by height.
"""
"""bounding rect width by height."""
height = self.block_object.height / 2.0
width = height
......
......@@ -50,7 +50,7 @@ class NameLineEdit(QLineEdit):
class NameItemDelegate(QStyledItemDelegate):
"""Item delegate providing a NameLineEdit so add new entries follows the rules
set in the schema
set in the schema
"""
def createEditor(self, parent, options, index):
......
......@@ -29,7 +29,7 @@ requirements:
- click
- click-plugins
- docopt
- beat.cmdline >=1.5.1b0
- beat.cmdline >=1.10.2
test:
requires:
......
......@@ -4,14 +4,12 @@
import os
import time
import pkg_resources
import sphinx_rtd_theme
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.
......@@ -237,10 +235,12 @@ autodoc_default_options = {
"show-inheritance": True,
}
if not 'BOB_DOCUMENTATION_SERVER' in os.environ:
# notice we need to overwrite this for BEAT projects - defaults from Bob are
# not OK
os.environ['BOB_DOCUMENTATION_SERVER'] = "https://www.idiap.ch/software/beat/docs/beat/%(name)s/%(version)s/|https://www.idiap.ch/software/beat/docs/beat/%(name)s/master/"
if "BOB_DOCUMENTATION_SERVER" not in os.environ:
# notice we need to overwrite this for BEAT projects - defaults from Bob are
# not OK
os.environ[
"BOB_DOCUMENTATION_SERVER"
] = "https://www.idiap.ch/software/beat/docs/beat/%(name)s/%(version)s/|https://www.idiap.ch/software/beat/docs/beat/%(name)s/master/"
# For inter-documentation mapping:
......
......@@ -59,9 +59,9 @@ def _run_cmd(cmd_list):
def _call_conda(extra_args):
""" call conda with the list of extra arguments, and return the tuple
stdout, stderr
"""
"""call conda with the list of extra arguments, and return the tuple
stdout, stderr
"""
cmd_list = [os.environ.get("CONDA_EXE")]
......@@ -77,9 +77,9 @@ def _get_pip_info():
def _clean_pkg_name(name):
""" Cleanup package name:
- lower case
- replace minus and underscore by only minus
"""Cleanup package name:
- lower case
- replace minus and underscore by only minus
"""
return re.sub(r"[_-]", "-", name.lower())
......
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
2.0.4b0
\ No newline at end of file
2.0.4b0
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