Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ 🐛 pylint upgrade and fixes #2524

Merged
Merged
7 changes: 6 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,13 @@ disable=print-statement,
C,
fixme,
import-error,
unspecified-encoding


# DISABLED unspecified-encoding (W1514):
# explanation: Using the system default implicitly can create problems on other operating systems. See https://www.python.org/dev/peps/pep-0597/.
# disabled: because we use always the same OS in dev-machines or docker

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
Expand Down Expand Up @@ -515,7 +520,7 @@ known-third-party=enchant
max-args=10

# Maximum number of attributes for a class (see R0902).
max-attributes=7
max-attributes=9
pcrespov marked this conversation as resolved.
Show resolved Hide resolved

# Maximum number of boolean expressions in a if statement
max-bool-expr=5
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ pylint: ## Runs python linter framework's wide
@/bin/bash -c "pylint --version"
# Running linter
@/bin/bash -c "pylint --jobs=0 --rcfile=.pylintrc $(strip $(shell find services packages -iname '*.py' \
-not -path "*ignore*" \
-not -path "*.venv*" \
-not -path "*/client/*" \
-not -path "*egg*" \
Expand Down
2 changes: 1 addition & 1 deletion ci/helpers/install_pylint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PYLINT_VERSION="$(grep pylint== $REQUIREMENTS | awk '{print $1}')"
pip3 install "$PYLINT_VERSION"

# Minimal packages to pass linter
pip install -r $CURDIR/requirements.txt
pip install -r "$CURDIR/requirements.txt"


echo "INFO:" "$(pylint --version)" "@" "$(command -v pylint)"
6 changes: 4 additions & 2 deletions packages/models-library/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ aiohttp==3.7.4.post0
# -c requirements/../../../packages/postgres-database/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# pytest-aiohttp
astroid==2.6.6
astroid==2.7.3
# via pylint
async-timeout==3.0.1
# via aiohttp
Expand Down Expand Up @@ -61,6 +61,8 @@ packaging==21.0
# pytest-sugar
pint==0.17
# via -r requirements/_test.in
platformdirs==2.3.0
# via pylint
pluggy==0.13.1
# via pytest
pprintpp==0.4.0
Expand All @@ -69,7 +71,7 @@ psycopg2-binary==2.9.1
# via sqlalchemy
py==1.10.0
# via pytest
pylint==2.9.6
pylint==2.10.2
# via -r requirements/_test.in
pyparsing==2.4.7
# via packaging
Expand Down
6 changes: 4 additions & 2 deletions packages/models-library/requirements/_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ pep517==0.11.0
# via pip-tools
pip-tools==6.2.0
# via -r requirements/../../../requirements/devenv.txt
platformdirs==2.2.0
# via virtualenv
platformdirs==2.3.0
# via
# -c requirements/_test.txt
# virtualenv
pre-commit==2.14.0
# via -r requirements/../../../requirements/devenv.txt
pyyaml==5.4.1
Expand Down
6 changes: 4 additions & 2 deletions packages/postgres-database/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ aiohttp==3.7.4.post0
# pytest-aiohttp
aiopg==1.3.1
# via -r requirements/_test.in
astroid==2.6.6
astroid==2.7.3
# via pylint
async-timeout==3.0.1
# via
Expand Down Expand Up @@ -93,6 +93,8 @@ packaging==21.0
# via pytest
paramiko==2.7.2
# via docker
platformdirs==2.3.0
# via pylint
pluggy==0.13.1
# via pytest
psycopg2-binary==2.9.1
Expand All @@ -105,7 +107,7 @@ py==1.10.0
# via pytest
pycparser==2.20
# via cffi
pylint==2.9.6
pylint==2.10.2
# via -r requirements/_test.in
pynacl==1.4.0
# via paramiko
Expand Down
6 changes: 4 additions & 2 deletions packages/postgres-database/requirements/_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ pep517==0.11.0
# via pip-tools
pip-tools==6.2.0
# via -r requirements/../../../requirements/devenv.txt
platformdirs==2.2.0
# via virtualenv
platformdirs==2.3.0
# via
# -c requirements/_test.txt
# virtualenv
pre-commit==2.14.0
# via -r requirements/../../../requirements/devenv.txt
pyyaml==5.4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def replace_environs_in_docker_compose_service(
service_environ = {}

# environment defined in env_file
env_files: List[str] = service_section.pop("env_file", list())
env_files: List[str] = service_section.pop("env_file", [])
for env_file in env_files:
if env_file.endswith(".env") and use_env_devel:
env_file += "-devel"
Expand All @@ -78,7 +78,7 @@ def replace_environs_in_docker_compose_service(
service_environ.update(file_environ)

# explicit environment [overrides env_file]
environ_items = service_section.get("environment", list())
environ_items = service_section.get("environment", [])
if environ_items and isinstance(environ_items, list):
for item in environ_items:
key, value = item.split("=")
Expand Down
6 changes: 4 additions & 2 deletions packages/service-integration/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile --output-file=requirements/_test.txt --strip-extras requirements/_test.in
#
astroid==2.6.6
astroid==2.7.3
# via pylint
attrs==21.2.0
# via
Expand Down Expand Up @@ -46,6 +46,8 @@ packaging==21.0
# -c requirements/_base.txt
# pytest
# pytest-sugar
platformdirs==2.3.0
# via pylint
pluggy==0.13.1
# via
# -c requirements/_base.txt
Expand All @@ -54,7 +56,7 @@ py==1.10.0
# via
# -c requirements/_base.txt
# pytest
pylint==2.9.6
pylint==2.10.2
# via -r requirements/_test.in
pyparsing==2.4.7
# via
Expand Down
6 changes: 4 additions & 2 deletions packages/service-integration/requirements/_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ pep517==0.11.0
# via pip-tools
pip-tools==6.2.0
# via -r requirements/../../../requirements/devenv.txt
platformdirs==2.2.0
# via virtualenv
platformdirs==2.3.0
# via
# -c requirements/_test.txt
# virtualenv
pre-commit==2.14.0
# via -r requirements/../../../requirements/devenv.txt
pyyaml==5.4.1
Expand Down
6 changes: 4 additions & 2 deletions packages/service-library/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ aiohttp==3.7.4.post0
# -c requirements/../../../requirements/constraints.txt
# -c requirements/_base.txt
# pytest-aiohttp
astroid==2.6.6
astroid==2.7.3
# via pylint
async-timeout==3.0.1
# via
Expand Down Expand Up @@ -92,13 +92,15 @@ packaging==21.0
# pytest-sugar
paramiko==2.7.2
# via docker
platformdirs==2.3.0
# via pylint
pluggy==0.13.1
# via pytest
py==1.10.0
# via pytest
pycparser==2.20
# via cffi
pylint==2.9.6
pylint==2.10.2
# via -r requirements/_test.in
pynacl==1.4.0
# via paramiko
Expand Down
6 changes: 4 additions & 2 deletions packages/service-library/requirements/_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ pep517==0.11.0
# via pip-tools
pip-tools==6.2.0
# via -r requirements/../../../requirements/devenv.txt
platformdirs==2.2.0
# via virtualenv
platformdirs==2.3.0
# via
# -c requirements/_test.txt
# virtualenv
pre-commit==2.14.0
# via -r requirements/../../../requirements/devenv.txt
pyyaml==5.4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class PageResponseLimitOffset(BaseModel):
@classmethod
def convert_none_to_empty_list(cls, v):
if v is None:
v = list()
v = []
return v

@validator("data")
Expand Down
6 changes: 4 additions & 2 deletions packages/settings-library/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile --output-file=requirements/_test.txt --strip-extras requirements/_test.in
#
astroid==2.6.6
astroid==2.7.3
# via pylint
attrs==21.2.0
# via pytest
Expand Down Expand Up @@ -35,11 +35,13 @@ packaging==21.0
# via
# pytest
# pytest-sugar
platformdirs==2.3.0
# via pylint
pluggy==0.13.1
# via pytest
py==1.10.0
# via pytest
pylint==2.9.6
pylint==2.10.2
# via -r requirements/_test.in
pyparsing==2.4.7
# via packaging
Expand Down
6 changes: 4 additions & 2 deletions packages/settings-library/requirements/_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ pep517==0.11.0
# via pip-tools
pip-tools==6.2.0
# via -r requirements/../../../requirements/devenv.txt
platformdirs==2.2.0
# via virtualenv
platformdirs==2.3.0
# via
# -c requirements/_test.txt
# virtualenv
pre-commit==2.14.0
# via -r requirements/../../../requirements/devenv.txt
pyyaml==5.4.1
Expand Down
6 changes: 4 additions & 2 deletions packages/simcore-sdk/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ alembic==1.6.5
# via
# -c requirements/_base.txt
# -r requirements/_test.in
astroid==2.6.6
astroid==2.7.3
# via pylint
async-timeout==3.0.1
# via
Expand Down Expand Up @@ -96,6 +96,8 @@ packaging==21.0
# -c requirements/_base.txt
# pytest
# pytest-sugar
platformdirs==2.3.0
# via pylint
pluggy==0.13.1
# via pytest
pprintpp==0.4.0
Expand All @@ -108,7 +110,7 @@ py==1.10.0
# via
# pytest
# pytest-forked
pylint==2.9.6
pylint==2.10.2
# via -r requirements/_test.in
pyparsing==2.4.7
# via
Expand Down
6 changes: 4 additions & 2 deletions packages/simcore-sdk/requirements/_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ pep517==0.11.0
# via pip-tools
pip-tools==6.2.0
# via -r requirements/../../../requirements/devenv.txt
platformdirs==2.2.0
# via virtualenv
platformdirs==2.3.0
# via
# -c requirements/_test.txt
# virtualenv
pre-commit==2.14.0
# via -r requirements/../../../requirements/devenv.txt
pyyaml==5.4.1
Expand Down
20 changes: 10 additions & 10 deletions packages/simcore-sdk/src/simcore_sdk/node_ports/_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def _check_type(item_type: str, value: DataItemValue):
class Item:
"""An item contains data (DataItem) and an schema (SchemaItem)

:raises exceptions.InvalidProtocolError: [description]
:raises AttributeError: [description]
:raises exceptions.InvalidProtocolError: [description]
:raises exceptions.InvalidItemTypeError: [description]
:raises exceptions.NodeportsException: [description]
raises exceptions.InvalidProtocolError
raises AttributeError
raises exceptions.InvalidProtocolError
raises exceptions.InvalidItemTypeError
raises exceptions.NodeportsException
"""

def __init__(
Expand Down Expand Up @@ -96,8 +96,8 @@ def __getattr__(self, name: str):
async def get(self) -> Optional[ItemConcreteValue]:
"""gets data converted to the underlying type

:raises exceptions.InvalidProtocolError: if the underlying type is unknown
:return: the converted value or None if no value is defined
raises exceptions.InvalidProtocolError: if the underlying type is unknown
return the converted value or None if no value is defined
"""
log.debug("Getting item %s", self.key)
if (
Expand Down Expand Up @@ -147,9 +147,9 @@ async def set(self, value: ItemConcreteValue):
"""sets the data to the underlying port

:param value: must be convertible to a string, or an exception will be thrown.
:type value: [type]
:raises exceptions.InvalidItemTypeError: [description]
:raises exceptions.InvalidItemTypeError: [description]
:type value:
raises exceptions.InvalidItemTypeError
raises exceptions.InvalidItemTypeError
"""

log.info("Setting data item with value %s", value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def __init__(

def __getitem__(self, key) -> Item:
schema = self._schemas[key]
payload = None
try:
payload = self._payloads[schema.key]
except exceptions.InvalidKeyError:
except (exceptions.InvalidKeyError, exceptions.UnboundPortError):
# there is no payload
payload = None
except exceptions.UnboundPortError:
payload = None

item = Item(self._user_id, self._project_id, self._node_uuid, schema, payload)
item.new_data_cb = self._item_value_updated_cb
item.get_node_from_uuid_cb = self.get_node_from_node_uuid_cb
Expand Down
4 changes: 2 additions & 2 deletions packages/simcore-sdk/tests/helpers/utils_environs.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def replace_environs_in_docker_compose_service(
service_environ = {}

# environment defined in env_file
env_files = service_section.pop("env_file", list())
env_files = service_section.pop("env_file", [])
for env_file in env_files:
if env_file == "../.env" and use_env_devel:
env_file += "-devel"
Expand All @@ -78,7 +78,7 @@ def replace_environs_in_docker_compose_service(
service_environ.update(file_environ)

# explicit environment [overrides env_file]
environ_items = service_section.get("environment", list())
environ_items = service_section.get("environment", [])
if environ_items and isinstance(environ_items, list):
# TODO: use docker-compose config first
for item in environ_items:
Expand Down
Loading