diff --git a/.drone.yml b/.drone.yml index 471e19a..604e20a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,4 +1,6 @@ +--- kind: pipeline +type: docker name: default steps: diff --git a/.gitignore b/.gitignore index 84e7f9d..cac950a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ __pycache__ .mypy_cache **/*.egg-info **/.eggs +venv diff --git a/setup.cfg b/setup.cfg index 2e08178..36ee50d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ ignore_missing_imports = True ignore_missing_imports = True [tox:tox] -envlist = py36,py37,py36-lint +envlist = py{36,37,38},py{36,37,38}-lint [testenv] deps = @@ -24,13 +24,15 @@ deps = commands = pytest tests -[testenv:py36-lint] +[testenv:py{36,37,38}-lint] deps = black flake8 flake8-black mypy + isort commands = black --check --diff setup.py simplex tests flake8 simplex tests - mypy simplex tests \ No newline at end of file + mypy simplex tests + isort -c simplex tests setup.py diff --git a/setup.py b/setup.py index 3cf4150..4e1e7a6 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,6 @@ import setuptools with open("README.md", "r") as fh: long_description = fh.read() -install_requires = [] test_requires = ["pytest", "mypy", "black", "flake8", "flake8-black"] setuptools.setup( @@ -18,7 +17,7 @@ setuptools.setup( long_description_content_type="text/markdown", url="https://gitea.typename.fr/mikael.capelle/simplex", packages=setuptools.find_packages(), - install_requires=install_requires, + install_requires=[], test_requires=test_requires, extras_require={"test": test_requires}, classifiers=[ diff --git a/simplex/__init__.py b/simplex/__init__.py index 07a8177..9fdac14 100644 --- a/simplex/__init__.py +++ b/simplex/__init__.py @@ -1,5 +1,4 @@ # -*- encoding: utf-8 -*- -# flake8: noqa -from .simplex_dictionary import simplex_dictionary +from .simplex_dictionary import simplex_dictionary # noqa: F401 diff --git a/simplex/simplex_dictionary.py b/simplex/simplex_dictionary.py index 8393879..474c7ad 100644 --- a/simplex/simplex_dictionary.py +++ b/simplex/simplex_dictionary.py @@ -1,8 +1,7 @@ # -*- encoding: utf-8 -*- import typing - -from abc import abstractmethod, ABC +from abc import ABC, abstractmethod from fractions import Fraction from .magic_dictionary import magic_dictionary @@ -105,7 +104,8 @@ class simplex_dictionary(typing.Generic[V]): @property def variables(self) -> typing.List[V]: """ - Returns: The list of variables in this dictionary. + Returns: + The list of variables in this dictionary. """ return sorted(self.B + self.N) @@ -119,14 +119,16 @@ class simplex_dictionary(typing.Generic[V]): @property def N(self) -> typing.List[V]: """ - Returns: The list of non-basic variables for this dictionary. + Returns: + The list of non-basic variables for this dictionary. """ return self.__N @property def a(self) -> magic_dictionary[V, magic_dictionary[V, Fraction]]: """ - Returns: The a matrix of this dictionary. + Returns: + The a matrix of this dictionary. """ return self._a @@ -236,7 +238,7 @@ class simplex_dictionary(typing.Generic[V]): Args: name: Name of the dictionary. """ - from IPython.display import display, Math + from IPython.display import Math, display d = ( r"\begin{{array}}{{r||{}}}".format("r|" * (1 + len(self.B))) diff --git a/tests/test_magic_dictionary.py b/tests/test_magic_dictionary.py index 6671867..c0518ff 100644 --- a/tests/test_magic_dictionary.py +++ b/tests/test_magic_dictionary.py @@ -4,8 +4,10 @@ from simplex.magic_dictionary import magic_dictionary def test_basic(): - """Tests that a non-customized magic_dictionary acts - as a standard python dictionary.""" + """ + Tests that a non-customized magic_dictionary acts + as a standard python dictionary. + """ d = magic_dictionary() assert len(d) == 0 @@ -43,7 +45,9 @@ def test_basic(): def test_value_converter(): - """ Tests that conversion is correctly done. """ + """ + Tests that conversion is correctly done. + """ # Convert a value to its string representation: def converter(x):