From 56e93a228de4337483d30ee181f721d874b3b60b Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 17:42:40 +0900 Subject: [PATCH 01/14] fix F401 imported but unused --- gokart/__init__.py | 20 ++++---- gokart/build.py | 1 - gokart/info.py | 3 +- gokart/object_storage.py | 3 +- gokart/slack/__init__.py | 6 +-- gokart/testing/__init__.py | 4 +- gokart/tree/task_info.py | 5 +- gokart/tree/task_info_formatter.py | 2 +- poetry.lock | 71 ++++++++++++++++++++++++++- pyproject.toml | 7 +++ test/test_run.py | 1 - test/test_s3_config.py | 2 - test/tree/test_task_info_formatter.py | 2 - tox.ini | 5 ++ 14 files changed, 102 insertions(+), 30 deletions(-) diff --git a/gokart/__init__.py b/gokart/__init__.py index c0700a7b..2fe85da3 100644 --- a/gokart/__init__.py +++ b/gokart/__init__.py @@ -1,10 +1,10 @@ -from gokart.build import build -from gokart.info import make_tree_info, tree_info -from gokart.pandas_type_config import PandasTypeConfig -from gokart.parameter import ExplicitBoolParameter, ListTaskInstanceParameter, TaskInstanceParameter -from gokart.run import run -from gokart.task import TaskOnKart -from gokart.testing import test_run -from gokart.tree.task_info import make_task_info_as_tree_str -from gokart.utils import add_config -from gokart.workspace_management import delete_local_unnecessary_outputs +from gokart.build import build # noqa:F401 +from gokart.info import make_tree_info, tree_info # noqa:F401 +from gokart.pandas_type_config import PandasTypeConfig # noqa:F401 +from gokart.parameter import ExplicitBoolParameter, ListTaskInstanceParameter, TaskInstanceParameter # noqa:F401 +from gokart.run import run # noqa:F401 +from gokart.task import TaskOnKart # noqa:F401 +from gokart.testing import test_run # noqa:F401 +from gokart.tree.task_info import make_task_info_as_tree_str # noqa:F401 +from gokart.utils import add_config # noqa:F401 +from gokart.workspace_management import delete_local_unnecessary_outputs # noqa:F401 diff --git a/gokart/build.py b/gokart/build.py index 4875f04f..7662cfa5 100644 --- a/gokart/build.py +++ b/gokart/build.py @@ -1,5 +1,4 @@ import logging -import sys from logging import getLogger from typing import Any, Optional diff --git a/gokart/info.py b/gokart/info.py index 47449861..8c42d0fa 100644 --- a/gokart/info.py +++ b/gokart/info.py @@ -1,6 +1,5 @@ -import warnings from logging import getLogger -from typing import List, NamedTuple, Optional, Set, Tuple +from typing import List, Optional, Set import luigi diff --git a/gokart/object_storage.py b/gokart/object_storage.py index 462d701a..e1e07406 100644 --- a/gokart/object_storage.py +++ b/gokart/object_storage.py @@ -1,9 +1,10 @@ + from datetime import datetime import luigi import luigi.contrib.gcs import luigi.contrib.s3 -from luigi.format import FileWrapper, Format +from luigi.format import Format from gokart.gcs_config import GCSConfig from gokart.gcs_zip_client import GCSZipClient diff --git a/gokart/slack/__init__.py b/gokart/slack/__init__.py index 6c84daea..b916bcf5 100644 --- a/gokart/slack/__init__.py +++ b/gokart/slack/__init__.py @@ -1,3 +1,3 @@ -from gokart.slack.event_aggregator import EventAggregator -from gokart.slack.slack_api import SlackAPI -from gokart.slack.slack_config import SlackConfig +from gokart.slack.event_aggregator import EventAggregator # noqa:F401 +from gokart.slack.slack_api import SlackAPI # noqa:F401 +from gokart.slack.slack_config import SlackConfig # noqa:F401 diff --git a/gokart/testing/__init__.py b/gokart/testing/__init__.py index 38a7f226..c7359e97 100644 --- a/gokart/testing/__init__.py +++ b/gokart/testing/__init__.py @@ -1,2 +1,2 @@ -from gokart.testing.check_if_run_with_empty_data_frame import test_run, try_to_run_test_for_empty_data_frame -from gokart.testing.pandas_assert import assert_frame_contents_equal +from gokart.testing.check_if_run_with_empty_data_frame import test_run, try_to_run_test_for_empty_data_frame # noqa:F401 +from gokart.testing.pandas_assert import assert_frame_contents_equal # noqa:F401 diff --git a/gokart/tree/task_info.py b/gokart/tree/task_info.py index bb9c3e20..0c183d0d 100644 --- a/gokart/tree/task_info.py +++ b/gokart/tree/task_info.py @@ -1,9 +1,6 @@ import os -import warnings -from dataclasses import dataclass -from typing import List, Optional, Set +from typing import List, Optional -import luigi import pandas as pd from gokart.target import make_target diff --git a/gokart/tree/task_info_formatter.py b/gokart/tree/task_info_formatter.py index 924f431e..30bb9ed9 100644 --- a/gokart/tree/task_info_formatter.py +++ b/gokart/tree/task_info_formatter.py @@ -1,7 +1,7 @@ import typing import warnings from dataclasses import dataclass -from typing import Dict, Iterable, List, NamedTuple, Optional, Set, Union +from typing import Dict, List, NamedTuple, Optional, Set, Union import luigi diff --git a/poetry.lock b/poetry.lock index 6c77d8d6..a15157a0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -521,6 +521,23 @@ files = [ docs = ["furo (>=2022.12.7)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.5)"] testing = ["covdefaults (>=2.2.2)", "coverage (>=7.0.1)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-timeout (>=2.1)"] +[[package]] +name = "flake8" +version = "5.0.4" +description = "the modular source code checker: pep8 pyflakes and co" +category = "dev" +optional = false +python-versions = ">=3.6.1" +files = [ + {file = "flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248"}, + {file = "flake8-5.0.4.tar.gz", hash = "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db"}, +] + +[package.dependencies] +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.9.0,<2.10.0" +pyflakes = ">=2.5.0,<2.6.0" + [[package]] name = "fonttools" version = "4.38.0" @@ -1032,6 +1049,18 @@ pyparsing = ">=2.2.1" python-dateutil = ">=2.7" setuptools_scm = ">=7" +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + [[package]] name = "moto" version = "4.0.12" @@ -1376,6 +1405,18 @@ files = [ [package.dependencies] pyasn1 = ">=0.4.6,<0.5.0" +[[package]] +name = "pycodestyle" +version = "2.9.1" +description = "Python style guide checker" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"}, + {file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"}, +] + [[package]] name = "pycparser" version = "2.21" @@ -1388,6 +1429,18 @@ files = [ {file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"}, ] +[[package]] +name = "pyflakes" +version = "2.5.0" +description = "passive checker of Python programs" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pyflakes-2.5.0-py2.py3-none-any.whl", hash = "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2"}, + {file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"}, +] + [[package]] name = "pyparsing" version = "3.0.9" @@ -1423,6 +1476,22 @@ tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} docs = ["furo (>=2022.9.29)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.5)"] testing = ["covdefaults (>=2.2.2)", "importlib-metadata (>=5.1)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "virtualenv (>=20.17)", "wheel (>=0.38.4)"] +[[package]] +name = "pyproject-flake8" +version = "5.0.4" +description = "pyproject-flake8 (`pflake8`), a monkey patching wrapper to connect flake8 with pyproject.toml configuration" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "pyproject-flake8-5.0.4.tar.gz", hash = "sha256:cb69b064b39bb588b5c45a7b16c158f013dddb2ce41cf1896f4b8bc7839bd2ce"}, + {file = "pyproject_flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:b41bf2a8f8590220ae067ba4f1c4ab43b4efc65bb76fac18aa982dadea223c08"}, +] + +[package.dependencies] +flake8 = "5.0.4" +tomli = {version = "*", markers = "python_version < \"3.11\""} + [[package]] name = "python-daemon" version = "2.3.2" @@ -1939,4 +2008,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.11" -content-hash = "64bf4bfc6362a59ee2844bd4520d87a8a973e0caecd07ebcf09c0cf6aae438dc" +content-hash = "5fec5478cb463fa20ceb50b2923b2a595c65b212b2dbb14df3736a132095b27b" diff --git a/pyproject.toml b/pyproject.toml index 5b0f28fd..b3aacede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,9 @@ readme = "README.md" homepage = "https://github.com/m3dev/gokart" repository = "https://github.com/m3dev/gokart" documentation = "https://gokart.readthedocs.io/en/latest/" +[tool.poetry.group.dev.dependencies] +pyproject-flake8 = "5.0.4" + [tool.poetry-dynamic-versioning] enable = true @@ -41,6 +44,10 @@ toml = "*" lupa = "*" fakeredis = "*" +[tool.flake8] +max-line-length = 160 +exclude = "venv/*,tox/*" + [tool.yapf] based_on_style = "pep8" column_limit = 160 diff --git a/test/test_run.py b/test/test_run.py index 5e573d42..ee0df739 100644 --- a/test/test_run.py +++ b/test/test_run.py @@ -7,7 +7,6 @@ import gokart from gokart.run import _try_to_send_event_summary_to_slack -from gokart.slack import SlackConfig class _DummyTask(gokart.TaskOnKart): diff --git a/test/test_s3_config.py b/test/test_s3_config.py index c4c42bbf..dd74b911 100644 --- a/test/test_s3_config.py +++ b/test/test_s3_config.py @@ -1,6 +1,4 @@ -import os import unittest -from unittest.mock import MagicMock, mock_open, patch from gokart.s3_config import S3Config diff --git a/test/tree/test_task_info_formatter.py b/test/tree/test_task_info_formatter.py index fb45d444..2d341cba 100644 --- a/test/tree/test_task_info_formatter.py +++ b/test/tree/test_task_info_formatter.py @@ -1,7 +1,5 @@ import unittest -import pandas as pd - import gokart from gokart.tree.task_info_formatter import RequiredTask, _make_requires_info diff --git a/tox.ini b/tox.ini index 86e92a50..a5b50942 100644 --- a/tox.ini +++ b/tox.ini @@ -17,6 +17,11 @@ allowlist_externals = isort skip_install = true commands = isort -c gokart test {posargs} +[testenv:flake8] +allowlist_externals = pflake8 +skip_install = true +commands = pflake8 gokart test {posargs} + [gh-actions] python = 3.8: py38 From 032f586b78c27b272b765349009b2116a743e699 Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 17:43:55 +0900 Subject: [PATCH 02/14] fix F541 f-string is missing placeholders --- gokart/workspace_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gokart/workspace_management.py b/gokart/workspace_management.py index 3a0d3dcd..d9d57624 100644 --- a/gokart/workspace_management.py +++ b/gokart/workspace_management.py @@ -24,7 +24,7 @@ def delete_local_unnecessary_outputs(task: gokart.TaskOnKart): necessary_files = set(_get_all_output_file_paths(task)) unnecessary_files = all_files - necessary_files - log_files if len(unnecessary_files) == 0: - logger.info(f'all files are necessary for this task.') + logger.info('all files are necessary for this task.') else: logger.info(f'remove following files: {os.linesep} {os.linesep.join(unnecessary_files)}') for file in unnecessary_files: From fddb4496b62ea16f967966ed2225550b6427820d Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 17:45:30 +0900 Subject: [PATCH 03/14] fix W291 trailing whitespace --- gokart/tree/task_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gokart/tree/task_info.py b/gokart/tree/task_info.py index 0c183d0d..97cfde57 100644 --- a/gokart/tree/task_info.py +++ b/gokart/tree/task_info.py @@ -43,7 +43,7 @@ def make_task_info_as_table(task: TaskOnKart, ignore_task_names: Optional[List[s List of task names to ignore. Returns ------- - - task_info_table : pandas.DataFrame + - task_info_table : pandas.DataFrame Formatted task dependency table. """ From 82d0b92a0a4834bf77f87120c4a482d6b38ab8fa Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 17:47:15 +0900 Subject: [PATCH 04/14] fix E741 ambiguous variable name --- test/slack/test_slack_api.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/slack/test_slack_api.py b/test/slack/test_slack_api.py index 9205f812..984604c6 100644 --- a/test/slack/test_slack_api.py +++ b/test/slack/test_slack_api.py @@ -34,9 +34,9 @@ def _conversations_list(params={}): mock_client.conversations_list = MagicMock(side_effect=_conversations_list) patch.return_value = mock_client - with LogCapture() as l: + with LogCapture() as log: gokart.slack.SlackAPI(token='invalid', channel='test', to_user='test user') - l.check(('gokart.slack.slack_api', 'WARNING', 'The job will start without slack notification: Channel test is not found in public channels.')) + log.check(('gokart.slack.slack_api', 'WARNING', 'The job will start without slack notification: Channel test is not found in public channels.')) @mock.patch('gokart.slack.slack_api.slack_sdk.WebClient') def test_invalid_channel(self, patch): @@ -58,9 +58,9 @@ def _conversations_list(params={}): mock_client.conversations_list = MagicMock(side_effect=_conversations_list) patch.return_value = mock_client - with LogCapture() as l: + with LogCapture() as log: gokart.slack.SlackAPI(token='valid', channel='invalid_channel', to_user='test user') - l.check(('gokart.slack.slack_api', 'WARNING', + log.check(('gokart.slack.slack_api', 'WARNING', 'The job will start without slack notification: Channel invalid_channel is not found in public channels.')) @mock.patch('gokart.slack.slack_api.slack_sdk.WebClient') @@ -88,10 +88,10 @@ def _api_call(method, data={}): mock_client.api_call = MagicMock(side_effect=_api_call) patch.return_value = mock_client - with LogCapture() as l: + with LogCapture() as log: api = gokart.slack.SlackAPI(token='valid', channel='valid', to_user='test user') api.send_snippet(comment='test', title='title', content='content') - l.check(('gokart.slack.slack_api', 'WARNING', 'Failed to send slack notification: Error while uploading file. The error reason is "error_reason".')) + log.check(('gokart.slack.slack_api', 'WARNING', 'Failed to send slack notification: Error while uploading file. The error reason is "error_reason".')) @mock.patch('gokart.slack.slack_api.slack_sdk.WebClient') def test_send(self, patch): From 4e6d9d30b6295c0baacfde1c0e4b815466a2c07a Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 17:49:36 +0900 Subject: [PATCH 05/14] fix F841 local variable is assigned to but never used --- test/test_run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_run.py b/test/test_run.py index ee0df739..cd640c60 100644 --- a/test/test_run.py +++ b/test/test_run.py @@ -34,7 +34,7 @@ def test_run(self): def test_run_with_undefined_environ(self): config_file_path = os.path.join(os.path.dirname(__name__), 'config', 'test_config.ini') luigi.configuration.LuigiConfigParser.add_config_path(config_file_path) - with self.assertRaises(luigi.parameter.MissingParameterException) as missing_parameter: + with self.assertRaises(luigi.parameter.MissingParameterException): gokart.run() @patch('sys.argv', From 46783ce812ca15075a6dce027707798850c3e7eb Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 17:50:58 +0900 Subject: [PATCH 06/14] fix W391 blank line at end of file --- test/__init__.py | 1 - test/slack/__init__.py | 1 - test/testing/__init__.py | 1 - 3 files changed, 3 deletions(-) diff --git a/test/__init__.py b/test/__init__.py index 8b137891..e69de29b 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1 +0,0 @@ - diff --git a/test/slack/__init__.py b/test/slack/__init__.py index 8b137891..e69de29b 100644 --- a/test/slack/__init__.py +++ b/test/slack/__init__.py @@ -1 +0,0 @@ - diff --git a/test/testing/__init__.py b/test/testing/__init__.py index 8b137891..e69de29b 100644 --- a/test/testing/__init__.py +++ b/test/testing/__init__.py @@ -1 +0,0 @@ - From 68a9620833ca79bc76f0e2f244277cd641b534a2 Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 17:59:03 +0900 Subject: [PATCH 07/14] fix F811 redefinition of unused --- test/test_task_on_kart.py | 2 +- test/tree/test_task_info_formatter.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/test_task_on_kart.py b/test/test_task_on_kart.py index 02b09e07..503d0ccf 100644 --- a/test/test_task_on_kart.py +++ b/test/test_task_on_kart.py @@ -335,7 +335,7 @@ def test_load_generator_with_single_target(self): data = [x for x in task.load_generator()] self.assertEqual(data, [[1, 2]]) - def test_load_with_keyword(self): + def test_load_generator_with_keyword(self): task = _DummyTask() target = MagicMock(spec=TargetOnKart) target.load.return_value = [1, 2] diff --git a/test/tree/test_task_info_formatter.py b/test/tree/test_task_info_formatter.py index 2d341cba..339db559 100644 --- a/test/tree/test_task_info_formatter.py +++ b/test/tree/test_task_info_formatter.py @@ -23,9 +23,10 @@ def test_make_requires_info_with_list(self): self.assertEqual(resulted, expected) def test_make_requires_info_with_generator(self): - requires_gen = lambda: (_RequiredTaskExampleTaskA() for _ in range(2)) - resulted = _make_requires_info(requires=requires_gen()) - expected = [RequiredTask(name=require.__class__.__name__, unique_id=require.make_unique_id()) for require in requires_gen()] + def _requires_gen(): + return (_RequiredTaskExampleTaskA() for _ in range(2)) + resulted = _make_requires_info(requires=_requires_gen()) + expected = [RequiredTask(name=require.__class__.__name__, unique_id=require.make_unique_id()) for require in _requires_gen()] self.assertEqual(resulted, expected) def test_make_requires_info_with_dict(self): From d133b39d2f0e47e38ccb063684d02cd2de565281 Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 18:09:04 +0900 Subject: [PATCH 08/14] E501 line too long --- test/slack/test_slack_api.py | 4 ++-- test/test_task_on_kart.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/slack/test_slack_api.py b/test/slack/test_slack_api.py index 984604c6..00fa65ed 100644 --- a/test/slack/test_slack_api.py +++ b/test/slack/test_slack_api.py @@ -61,7 +61,7 @@ def _conversations_list(params={}): with LogCapture() as log: gokart.slack.SlackAPI(token='valid', channel='invalid_channel', to_user='test user') log.check(('gokart.slack.slack_api', 'WARNING', - 'The job will start without slack notification: Channel invalid_channel is not found in public channels.')) + 'The job will start without slack notification: Channel invalid_channel is not found in public channels.')) @mock.patch('gokart.slack.slack_api.slack_sdk.WebClient') def test_send_snippet_with_invalid_token(self, patch): @@ -91,7 +91,7 @@ def _api_call(method, data={}): with LogCapture() as log: api = gokart.slack.SlackAPI(token='valid', channel='valid', to_user='test user') api.send_snippet(comment='test', title='title', content='content') - log.check(('gokart.slack.slack_api', 'WARNING', 'Failed to send slack notification: Error while uploading file. The error reason is "error_reason".')) + log.check(('gokart.slack.slack_api', 'WARNING', 'Failed to send slack notification: Error while uploading file. The error reason is "error_reason".')) # noqa:E501 @mock.patch('gokart.slack.slack_api.slack_sdk.WebClient') def test_send(self, patch): diff --git a/test/test_task_on_kart.py b/test/test_task_on_kart.py index 503d0ccf..66e3c49b 100644 --- a/test/test_task_on_kart.py +++ b/test/test_task_on_kart.py @@ -501,7 +501,7 @@ def test_repr(self): _DummySubTaskWithPrivateParameter()]) sub_task_id = _DummySubTaskWithPrivateParameter().make_unique_id() expected = f'{__name__}._DummyTaskWithPrivateParameter(int_param=1, private_int_param=1, task_param={__name__}._DummySubTaskWithPrivateParameter({sub_task_id}), ' \ - f'list_task_param=[{__name__}._DummySubTaskWithPrivateParameter({sub_task_id}), {__name__}._DummySubTaskWithPrivateParameter({sub_task_id})])' + f'list_task_param=[{__name__}._DummySubTaskWithPrivateParameter({sub_task_id}), {__name__}._DummySubTaskWithPrivateParameter({sub_task_id})])' # noqa:E501 self.assertEqual(expected, repr(task)) def test_str(self): From 7c2ecdaa6f8dd949f9b5dfc407373361e725488a Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 18:16:12 +0900 Subject: [PATCH 09/14] fix B007 Loop control variable not used within the loop body. If this is intended, start the name with an underscore. --- gokart/task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gokart/task.py b/gokart/task.py index 0760113f..53547cef 100644 --- a/gokart/task.py +++ b/gokart/task.py @@ -150,7 +150,7 @@ def clone(self, cls=None, **kwargs): cls = self.__class__ new_k = {} - for param_name, param_class in cls.get_params(): + for param_name, _ in cls.get_params(): if param_name in kwargs: new_k[param_name] = kwargs[param_name] elif hasattr(self, param_name) and (param_name not in _SPECIAL_PARAMS): From ddcdebcdb31f74a6c26f2ae997859acc79b57ac5 Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 18:20:33 +0900 Subject: [PATCH 10/14] add flake8 config and ignore B006 and B008 currently --- pyproject.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b3aacede..0e97a027 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,8 +8,6 @@ readme = "README.md" homepage = "https://github.com/m3dev/gokart" repository = "https://github.com/m3dev/gokart" documentation = "https://gokart.readthedocs.io/en/latest/" -[tool.poetry.group.dev.dependencies] -pyproject-flake8 = "5.0.4" [tool.poetry-dynamic-versioning] @@ -33,7 +31,8 @@ APScheduler = "*" redis = "*" matplotlib = "*" -[tool.poetry.dev-dependencies] +[tool.poetry.group.dev.dependencies] +pyproject-flake8 = "5.0.4" tox = "*" moto = "*" testfixtures = "*" @@ -45,6 +44,9 @@ lupa = "*" fakeredis = "*" [tool.flake8] +# B006: Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them. +# B008 Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value. +ignore = "B006,B007" max-line-length = 160 exclude = "venv/*,tox/*" From a9f79e5612c62d456fc3698b2011ec4a74d3f365 Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 18:21:12 +0900 Subject: [PATCH 11/14] add flake8 to CI settings --- .github/workflows/format.yml | 2 +- poetry.lock | 150 +++++++++++++++++------------------ tox.ini | 2 +- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 3c1ef571..10c50399 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -24,4 +24,4 @@ jobs: poetry install - name: Run yapf and isort run: | - poetry run tox -e yapf,isort + poetry run tox -e yapf,isort,flake8 diff --git a/poetry.lock b/poetry.lock index a15157a0..cfe7368d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -74,18 +74,18 @@ tzdata = ["tzdata"] [[package]] name = "boto3" -version = "1.26.42" +version = "1.26.45" description = "The AWS SDK for Python" category = "main" optional = false python-versions = ">= 3.7" files = [ - {file = "boto3-1.26.42-py3-none-any.whl", hash = "sha256:75c995a04723f23e35e16ea491ed91a1345e2fa6492678a216488512308dada1"}, - {file = "boto3-1.26.42.tar.gz", hash = "sha256:4cfd7e05e4033dbca2cc59bcfdafbdaef9d83dc3c0448917569b301d85766d9d"}, + {file = "boto3-1.26.45-py3-none-any.whl", hash = "sha256:b1bc7db503dc49bdccf5dada080077056a32af9982afdde84578a109cd741d05"}, + {file = "boto3-1.26.45.tar.gz", hash = "sha256:cc7f652df93e1ce818413fd82ffd645d4f92a64fec67c72946212d3750eaa80f"}, ] [package.dependencies] -botocore = ">=1.29.42,<1.30.0" +botocore = ">=1.29.45,<1.30.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.6.0,<0.7.0" @@ -94,14 +94,14 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.29.42" +version = "1.29.45" description = "Low-level, data-driven core of boto 3." category = "main" optional = false python-versions = ">= 3.7" files = [ - {file = "botocore-1.29.42-py3-none-any.whl", hash = "sha256:f52f9dbd7ad42b3528c1052086c1a7b6122a018f919afdb604f2889caefe8092"}, - {file = "botocore-1.29.42.tar.gz", hash = "sha256:d05c62f64e76194c40f598f5f7c804ec50d9820e9f03f6e0198558e4ace167c4"}, + {file = "botocore-1.29.45-py3-none-any.whl", hash = "sha256:a5c0e13f266ee9a74335a1e5d3e377f2baae27226ae23d78f023bae0d18f3161"}, + {file = "botocore-1.29.45.tar.gz", hash = "sha256:62ae03e591ff25555854aa338da35190ffe18c0b1be2ebf5cfb277164233691f"}, ] [package.dependencies] @@ -343,63 +343,63 @@ test-no-codebase = ["Pillow", "matplotlib", "pytest"] [[package]] name = "coverage" -version = "7.0.2" +version = "7.0.4" description = "Code coverage measurement for Python" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "coverage-7.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c1f02d016b9b6b5ad21949a21646714bfa7b32d6041a30f97674f05d6d6996e3"}, - {file = "coverage-7.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a2d4f68e4fa286fb6b00d58a1e87c79840e289d3f6e5dcb912ad7b0fbd9629fb"}, - {file = "coverage-7.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:426895ac9f2938bec193aa998e7a77a3e65d3e46903f348e794b4192b9a5b61e"}, - {file = "coverage-7.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dcb708ab06f3f4dfc99e9f84821c9120e5f12113b90fad132311a2cb97525379"}, - {file = "coverage-7.0.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8217f73faf08623acb25fb2affd5d20cbcd8185213db308e46a37e6fd6a56a49"}, - {file = "coverage-7.0.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:bcb57d175ff0cb4ff97fc547c74c1cb8d4c9612003f6d267ee78dad8f23d8b30"}, - {file = "coverage-7.0.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:7d47d666e17e57ef65fefc87229fde262bd5c9039ae8424bc53aa2d8f07dc178"}, - {file = "coverage-7.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:321316a7b979892a13c148a9d37852b5a76f26717e4b911b606a649394629532"}, - {file = "coverage-7.0.2-cp310-cp310-win32.whl", hash = "sha256:420f10c852b9a489cf5a764534669a19f49732a0576c76d9489ebf287f81af6d"}, - {file = "coverage-7.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:a27a8dca0dc6f0944ed9fd83c556d862e227a5cd4220e62af5d4c750389938f0"}, - {file = "coverage-7.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ac1033942851bf01f28c76318155ea92d6648aecb924cab81fa23781d095e9ab"}, - {file = "coverage-7.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:36c1a1b6d38ebf8a4335f65226ec36b5d6fd67743fdcbad5c52bdcd46c4f5842"}, - {file = "coverage-7.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c5e1874c601128cf54c1d4b471e915658a334fbc56d7b3c324ddc7511597ea82"}, - {file = "coverage-7.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8e133ca2f8141b415ff396ba789bdeffdea8ff9a5c7fc9996ccf591d7d40ee93"}, - {file = "coverage-7.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4e97b21482aa5c21e049e4755c95955ad71fb54c9488969e2f17cf30922aa5f6"}, - {file = "coverage-7.0.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:8bd466135fb07f693dbdd999a5569ffbc0590e9c64df859243162f0ebee950c8"}, - {file = "coverage-7.0.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:38f281bb9bdd4269c451fed9451203512dadefd64676f14ed1e82c77eb5644fc"}, - {file = "coverage-7.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7c669be1b01e4b2bf23aa49e987d9bedde0234a7da374a9b77ca5416d7c57002"}, - {file = "coverage-7.0.2-cp311-cp311-win32.whl", hash = "sha256:80583c536e7e010e301002088919d4ea90566d1789ee02551574fdf3faa275ae"}, - {file = "coverage-7.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:a7b018811a0e1d3869d8d0600849953acd355a3a29c6bee0fbd24d7772bcc0a2"}, - {file = "coverage-7.0.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e8931af864bd599c6af626575a02103ae626f57b34e3af5537d40b040d33d2ad"}, - {file = "coverage-7.0.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a613d60be1a02c7a5184ea5c4227f48c08e0635608b9c17ae2b17efef8f2501"}, - {file = "coverage-7.0.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3fbb59f84c8549113dcdce7c6d16c5731fe53651d0b46c0a25a5ebc7bb655869"}, - {file = "coverage-7.0.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d40ad86a348c79c614e2b90566267dd6d45f2e6b4d2bfb794d78ea4a4b60b63"}, - {file = "coverage-7.0.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7e184aa18f921b612ea08666c25dd92a71241c8ed40917f2824219c92289b8c7"}, - {file = "coverage-7.0.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:fd22ee7bff4b5c37bb6385efee1c501b75e29ca40286f037cb91c2182d1348ce"}, - {file = "coverage-7.0.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:3d72e3d20b03e63bd27b1c4d6b754cd93eca82ecc5dd77b99262d5f64862ca35"}, - {file = "coverage-7.0.2-cp37-cp37m-win32.whl", hash = "sha256:5f44ba7c07e0aa4a7a2723b426c254e952da82a33d65b4a52afae4bef74a4203"}, - {file = "coverage-7.0.2-cp37-cp37m-win_amd64.whl", hash = "sha256:efa9d943189321f67f71070c309aa6f6130fa1ec35c9dfd0da0ed238938ce573"}, - {file = "coverage-7.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:da458bdc9b0bcd9b8ca85bc73148631b18cc8ba03c47f29f4c017809990351aa"}, - {file = "coverage-7.0.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:87d95eea58fb71f69b4f1c761099a19e0e9cb27d45dc1cc7042523128ee56337"}, - {file = "coverage-7.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfafc350f43fd7dc67df18c940c3b7ed208ebb797abe9fb3047f0c65be8e4c0f"}, - {file = "coverage-7.0.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:46db409fc0c3ee5c859b84c7de9cb507166287d588390889fdf06a1afe452e16"}, - {file = "coverage-7.0.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c8805673b1953313adfc487d5323b4c87864e77057944a0888c98dd2f7a6052f"}, - {file = "coverage-7.0.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:62e5b942378d5f0b87caace567a70dc634ddd4d219a236fa221dc97d2fc412c8"}, - {file = "coverage-7.0.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a99b2f2dd1236e8d9dc35974a3dc298a408cdfd512b0bb2451798cff1ce63408"}, - {file = "coverage-7.0.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:04691b8e832a900ed15f5bcccc2008fc2d1c8e7411251fd7d1422a84e1d72841"}, - {file = "coverage-7.0.2-cp38-cp38-win32.whl", hash = "sha256:b6936cd38757dd323fefc157823e46436610328f0feb1419a412316f24b77f36"}, - {file = "coverage-7.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:483e120ea324c7fced6126bb9bf0535c71e9233d29cbc7e2fc4560311a5f8a32"}, - {file = "coverage-7.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4438ba539bef21e288092b30ea2fc30e883d9af5b66ebeaf2fd7c25e2f074e39"}, - {file = "coverage-7.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3a2d81c95d3b02638ee6ae647edc79769fd29bf5e9e5b6b0c29040579f33c260"}, - {file = "coverage-7.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c40aaf7930680e0e5f3bd6d3d3dc97a7897f53bdce925545c4b241e0c5c3ca6a"}, - {file = "coverage-7.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2b31f7f246dbff339b3b76ee81329e3eca5022ce270c831c65e841dbbb40115f"}, - {file = "coverage-7.0.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6e1c77ff6f10eab496fbbcdaa7dfae84968928a0aadc43ce3c3453cec29bd79"}, - {file = "coverage-7.0.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:8e6c0ca447b557a32642f22d0987be37950eda51c4f19fc788cebc99426284b6"}, - {file = "coverage-7.0.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9de96025ce25b9f4e744fbe558a003e673004af255da9b1f6ec243720ac5deeb"}, - {file = "coverage-7.0.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:312fd77258bf1044ef4faa82091f2e88216e4b62dcf1a461d3e917144c8b09b7"}, - {file = "coverage-7.0.2-cp39-cp39-win32.whl", hash = "sha256:4d7be755d7544dac2b9814e98366a065d15a16e13847eb1f5473bb714483391e"}, - {file = "coverage-7.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:b6eab230b18458707b5c501548e997e42934b1c189fb4d1b78bf5aacc1c6a137"}, - {file = "coverage-7.0.2-pp37.pp38.pp39-none-any.whl", hash = "sha256:1d732b5dcafed67d81c5b5a0c404c31a61e13148946a3b910a340f72fdd1ec95"}, - {file = "coverage-7.0.2.tar.gz", hash = "sha256:405d8528a0ea07ca516d9007ecad4e1bd10e2eeef27411c6188d78c4e2dfcddc"}, + {file = "coverage-7.0.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:daf91db39324e9939a9db919ee4fb42a1a23634a056616dae891a030e89f87ba"}, + {file = "coverage-7.0.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:55121fe140d7e42cb970999b93cf1c2b24484ce028b32bbd00238bb25c13e34a"}, + {file = "coverage-7.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c027fbb83a8c78a6e06a0302ea1799fdb70e5cda9845a5e000545b8e2b47ea39"}, + {file = "coverage-7.0.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:caf82db5b7f16b51ec32fe0bd2da0805b177c807aa8bfb478c7e6f893418c284"}, + {file = "coverage-7.0.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ba5cc54baf3c322c4388de2a43cc95f7809366f0600e743e5aae8ea9d1038b2"}, + {file = "coverage-7.0.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:260854160083f8275a9d9d49a05ab0ffc7a1f08f2ccccbfaec94a18aae9f407c"}, + {file = "coverage-7.0.4-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ea45f0dba5a993e93b158f1a9dcfff2770e3bcabf2b80dbe7aa15dce0bcb3bf3"}, + {file = "coverage-7.0.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6abc91f6f8b3cc0ae1034e2c03f38769fba1952ab70d0b26953aa01691265c39"}, + {file = "coverage-7.0.4-cp310-cp310-win32.whl", hash = "sha256:053cdc47cae08257051d7e934a0de4d095b60eb8a3024fa9f1b2322fa1547137"}, + {file = "coverage-7.0.4-cp310-cp310-win_amd64.whl", hash = "sha256:1e9e94f2612ee549a4b3ee79cbc61bceed77e69cf38cfa05858bae939a886d16"}, + {file = "coverage-7.0.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5caa9dd91dcc5f054350dc57a02e053d79633907b9ccffff999568d13dcd19f8"}, + {file = "coverage-7.0.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:efc200fa75d9634525b40babc7a16342bd21c101db1a58ef84dc14f4bf6ac0fd"}, + {file = "coverage-7.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1791e5f74c5b52f76e83fe9f4bb9571cf76d40ee0c51952ee1e4ee935b7e98b9"}, + {file = "coverage-7.0.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3d9201cfa5a98652b9cef36ab202f17fe3ea83f497b4ba2a8ed39399dfb8fcd4"}, + {file = "coverage-7.0.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22d8ef6865cb6834cab2b72fff20747a55c714b57b675f7e11c9624fe4f7cb45"}, + {file = "coverage-7.0.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b84076e3de192fba0f95e279ac017b64c7c6ecd4f09f36f13420f5bed898a9c7"}, + {file = "coverage-7.0.4-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:dcfbf8ffc046f20d75fd775a92c378f6fc7b9bded6c6f2ab88b6b9cb5805a184"}, + {file = "coverage-7.0.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:4665a714af31f160403c2e448fb2fef330719d2e04e836b08d60d612707c1041"}, + {file = "coverage-7.0.4-cp311-cp311-win32.whl", hash = "sha256:2e59aef3fba5758059208c9eff10ae7ded3629e797972746ec33b56844f69411"}, + {file = "coverage-7.0.4-cp311-cp311-win_amd64.whl", hash = "sha256:2b854f7985b48122b6fe346631e86d67b63293f8255cb59a93d79e3d9f1574e3"}, + {file = "coverage-7.0.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e44b60b0b49aa85d548d392a2dca2c6a581cd4084e72e9e16bd58bd86ec20816"}, + {file = "coverage-7.0.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2904d7a0388911c61e7e3beefe48c29dfccaba938fc1158f63190101a21e04c2"}, + {file = "coverage-7.0.4-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bc74b64bfa89e2f862ea45dd6ac1def371d7cc883b76680d20bdd61a6f3daa20"}, + {file = "coverage-7.0.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c06046f54e719da21c79f98ecc0962581d1aee0b3798dc6b12b1217da8bf93f4"}, + {file = "coverage-7.0.4-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:bc9c77004970a364a1e5454cf7cb884e4277592b959c287689b2a0fd027ef552"}, + {file = "coverage-7.0.4-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:0815a09b32384e8ff00a5939ec9cd10efce8742347e019c2daca1a32f5ac2aae"}, + {file = "coverage-7.0.4-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:a78a80d131c067d67d8a6f9bd3d3f7ea7eac82c1c7259f97d7ab73f723da9d55"}, + {file = "coverage-7.0.4-cp37-cp37m-win32.whl", hash = "sha256:2b5936b624fbe711ed02dfd86edd678822e5ee68da02b6d231e5c01090b64590"}, + {file = "coverage-7.0.4-cp37-cp37m-win_amd64.whl", hash = "sha256:a63922765ee49d5b4c32afb2cd5516812c8665f3b78e64a0dd005bdfabf991b1"}, + {file = "coverage-7.0.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d68f2f7bddb3acdd3b36ef7f334b9d14f30b93e094f808fbbd8d288b8f9e2f9b"}, + {file = "coverage-7.0.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9dafdba3b2b9010abab08cb8c0dc6549bfca6e1630fe14d47b01dca00d39e694"}, + {file = "coverage-7.0.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0322354757b47640535daabd2d56384ff3cad2896248fc84d328c5fad4922d5c"}, + {file = "coverage-7.0.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4e8267466662aff93d66fa72b9591d02122dfc8a729b0a43dd70e0fb07ed9b37"}, + {file = "coverage-7.0.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f684d88eb4924ed0630cf488fd5606e334c6835594bb5fe36b50a509b10383ed"}, + {file = "coverage-7.0.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:70c294bb15ba576fb96b580db35895bf03749d683df044212b74e938a7f6821f"}, + {file = "coverage-7.0.4-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:34c0457e1ba450ae8b22dc8ea2fd36ada1010af61291e4c96963cd9d9633366f"}, + {file = "coverage-7.0.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:b75aff2c35ceaa299691e772f7bf7c8aeab25f46acea2be3dd04cccb914a9860"}, + {file = "coverage-7.0.4-cp38-cp38-win32.whl", hash = "sha256:6c5554d55668381e131577f20e8f620d4882b04ad558f7e7f3f1f55b3124c379"}, + {file = "coverage-7.0.4-cp38-cp38-win_amd64.whl", hash = "sha256:c82f34fafaf5bc05d222fcf84423d6e156432ca35ca78672d4affd0c09c6ef6c"}, + {file = "coverage-7.0.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b8dfb5fed540f77e814bf4ec79619c241af6b4578fa1093c5e3389bbb7beab3f"}, + {file = "coverage-7.0.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ee32a080bab779b71c4d09a3eb5254bfca43ee88828a683dab27dfe8f582516e"}, + {file = "coverage-7.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2dfbee0bf0d633be3a2ab068f5a5731a70adf147d0ba17d9f9932b46c7c5782b"}, + {file = "coverage-7.0.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:32dc010713455ac0fe2fddb0e48aa43875cc7eb7b09768df10bad8ce45f9c430"}, + {file = "coverage-7.0.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9cb88a3019ad042eaa69fc7639ef077793fedbf313e89207aa82fefe92c97ebd"}, + {file = "coverage-7.0.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:73bc6114aab7753ca784f87bcd3b7613bc797aa255b5bca45e5654070ae9acfb"}, + {file = "coverage-7.0.4-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:92f135d370fcd7a6fb9659fa2eb716dd2ca364719cbb1756f74d90a221bca1a7"}, + {file = "coverage-7.0.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f3d485e6ec6e09857bf2115ece572d666b7c498377d4c70e66bb06c63ed177c2"}, + {file = "coverage-7.0.4-cp39-cp39-win32.whl", hash = "sha256:c58921fcd9914b56444292e7546fe183d079db99528142c809549ddeaeacd8e9"}, + {file = "coverage-7.0.4-cp39-cp39-win_amd64.whl", hash = "sha256:f092d9f2ddaa30235d33335fbdb61eb8f3657af519ef5f9dd6bdae65272def11"}, + {file = "coverage-7.0.4-pp37.pp38.pp39-none-any.whl", hash = "sha256:cb8cfa3bf3a9f18211279458917fef5edeb5e1fdebe2ea8b11969ec2ebe48884"}, + {file = "coverage-7.0.4.tar.gz", hash = "sha256:f6c4ad409a0caf7e2e12e203348b1a9b19c514e7d078520973147bf2d3dcbc6f"}, ] [package.extras] @@ -589,14 +589,14 @@ grpcio-gcp = ["grpcio-gcp (>=0.2.2,<1.0dev)"] [[package]] name = "google-api-python-client" -version = "2.70.0" +version = "2.71.0" description = "Google API Client Library for Python" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "google-api-python-client-2.70.0.tar.gz", hash = "sha256:262de094d5a30d337f59e66581019fed45b698c078397ac48dd323c0968236e7"}, - {file = "google_api_python_client-2.70.0-py2.py3-none-any.whl", hash = "sha256:67da78956f2bf4b763305cd791aeab250878c1f88f1422aaba4682a608b8e5a4"}, + {file = "google-api-python-client-2.71.0.tar.gz", hash = "sha256:9412ad3445518fa9d24d02c673a70b07c9d124990f44763cdf4f5304ca5b4d08"}, + {file = "google_api_python_client-2.71.0-py2.py3-none-any.whl", hash = "sha256:a4ea351db2bb2a9b1a7e96d8fa8de0fcbc31d9e237b724f4a07b243c2d63e9a4"}, ] [package.dependencies] @@ -649,14 +649,14 @@ six = "*" [[package]] name = "googleapis-common-protos" -version = "1.57.0" +version = "1.57.1" description = "Common protobufs used in Google APIs" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "googleapis-common-protos-1.57.0.tar.gz", hash = "sha256:27a849d6205838fb6cc3c1c21cb9800707a661bb21c6ce7fb13e99eb1f8a0c46"}, - {file = "googleapis_common_protos-1.57.0-py2.py3-none-any.whl", hash = "sha256:a9f4a1d7f6d9809657b7f1316a1aa527f6664891531bcfcc13b6696e685f443c"}, + {file = "googleapis-common-protos-1.57.1.tar.gz", hash = "sha256:e877f2f041b640b4888b6917dde4f44515ab938bf744c4dbc06f11f0e8ed56b5"}, + {file = "googleapis_common_protos-1.57.1-py2.py3-none-any.whl", hash = "sha256:2672d6b3a7b6188b70a5a4c70def7ddbb9000852dfbf49daf52fc7306c09db0c"}, ] [package.dependencies] @@ -1063,14 +1063,14 @@ files = [ [[package]] name = "moto" -version = "4.0.12" +version = "4.0.13" description = "A library that allows your python tests to easily mock out the boto library" category = "dev" optional = false python-versions = ">=3.6" files = [ - {file = "moto-4.0.12-py3-none-any.whl", hash = "sha256:e6592727d90a2dc82ca7c7fa61b224e2b195cc0dcdac2f46ccbf0cd8efde1459"}, - {file = "moto-4.0.12.tar.gz", hash = "sha256:30f8f31658f18cdb15eb626c8cb3a07520f0d8c2193226fbcb3326ae12fba246"}, + {file = "moto-4.0.13-py3-none-any.whl", hash = "sha256:e73400c6d3fe06028aa7f07bb6f276f14260d289b70f38928a98e3d3d968352d"}, + {file = "moto-4.0.13.tar.gz", hash = "sha256:baf7d6969cf837990c730e6e648315bebc2e1c0038d9d8fc4f59d03561484469"}, ] [package.dependencies] @@ -1458,14 +1458,14 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pyproject-api" -version = "1.3.0" +version = "1.4.0" description = "API to interact with the python pyproject.toml based projects" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyproject_api-1.3.0-py3-none-any.whl", hash = "sha256:90d8ce5f7231dce7cdeedbda1568e3cd427ca0cb4cf56f3d936f61d7eca9cde0"}, - {file = "pyproject_api-1.3.0.tar.gz", hash = "sha256:6da9b5fcad6f6bdcf88ee0dbc6cc41783e377ceb6767b5004881ecb50ae6d6e7"}, + {file = "pyproject_api-1.4.0-py3-none-any.whl", hash = "sha256:c34226297781efdd1ba4dfb74ce21076d9a8360e2125ea31803c1a02c76b2460"}, + {file = "pyproject_api-1.4.0.tar.gz", hash = "sha256:ac85c1f82e0291dbae5a7739dbb9a990e11ee4034c9b5599ea714f07a24ecd71"}, ] [package.dependencies] @@ -1809,14 +1809,14 @@ files = [ [[package]] name = "tox" -version = "4.1.3" +version = "4.2.6" description = "tox is a generic virtualenv management and test command line tool" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tox-4.1.3-py3-none-any.whl", hash = "sha256:f1840b1698e5187d4c3bae4fe41332c2f3fedde3b6773474899f9e0b329a41dd"}, - {file = "tox-4.1.3.tar.gz", hash = "sha256:9976b41def48a5a2dce477de2c90c8231a5166829aaca916d0952ec4d7429f43"}, + {file = "tox-4.2.6-py3-none-any.whl", hash = "sha256:fb79b3e4b788491949576a9c80c2d56419eac994567c3591e24bb2788b5901d0"}, + {file = "tox-4.2.6.tar.gz", hash = "sha256:ecf224a4f3a318adcdd71aa8fe15ffd31f14afd6a9845a43ffd63950a7325538"}, ] [package.dependencies] @@ -2008,4 +2008,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.11" -content-hash = "5fec5478cb463fa20ceb50b2923b2a595c65b212b2dbb14df3736a132095b27b" +content-hash = "4b68f87b2b8e92de5680588303fe390ee58bfdb9736bfa45797f2f2fadaa6628" diff --git a/tox.ini b/tox.ini index a5b50942..84485d2a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311,yapf,isort} +envlist = py{38,39,310,311,yapf,isort,flake8} isolated_build = true [testenv] From 96c9cb3ad227121a149b039b5bd6107bd5076c36 Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 18:24:45 +0900 Subject: [PATCH 12/14] fix typoe --- gokart/file_processor.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gokart/file_processor.py b/gokart/file_processor.py index b23855aa..90f8d96f 100644 --- a/gokart/file_processor.py +++ b/gokart/file_processor.py @@ -168,7 +168,7 @@ def load(self, file): def dump(self, obj, file): assert isinstance(obj, pd.DataFrame) or isinstance(obj, pd.Series) or isinstance(obj, dict), \ - f'requires pd.DataFrame or pd.Series or dict, but {type(obj)} is passed.' + f'requires pd.DataFrame or pd.Series or dict, but {type(obj)} is passed.' if isinstance(obj, dict): obj = pd.DataFrame.from_dict(obj) obj.to_json(file) diff --git a/pyproject.toml b/pyproject.toml index 0e97a027..3f776426 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ fakeredis = "*" [tool.flake8] # B006: Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them. # B008 Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value. -ignore = "B006,B007" +ignore = "B006,B008" max-line-length = 160 exclude = "venv/*,tox/*" From 30ac71b212d5917d6b99d367eee8ca35c90715d4 Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 18:36:08 +0900 Subject: [PATCH 13/14] fix format --- gokart/object_storage.py | 1 - test/slack/test_slack_api.py | 3 ++- test/tree/test_task_info_formatter.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gokart/object_storage.py b/gokart/object_storage.py index e1e07406..f867c82e 100644 --- a/gokart/object_storage.py +++ b/gokart/object_storage.py @@ -1,4 +1,3 @@ - from datetime import datetime import luigi diff --git a/test/slack/test_slack_api.py b/test/slack/test_slack_api.py index 00fa65ed..2700567b 100644 --- a/test/slack/test_slack_api.py +++ b/test/slack/test_slack_api.py @@ -91,7 +91,8 @@ def _api_call(method, data={}): with LogCapture() as log: api = gokart.slack.SlackAPI(token='valid', channel='valid', to_user='test user') api.send_snippet(comment='test', title='title', content='content') - log.check(('gokart.slack.slack_api', 'WARNING', 'Failed to send slack notification: Error while uploading file. The error reason is "error_reason".')) # noqa:E501 + log.check( + ('gokart.slack.slack_api', 'WARNING', 'Failed to send slack notification: Error while uploading file. The error reason is "error_reason".')) @mock.patch('gokart.slack.slack_api.slack_sdk.WebClient') def test_send(self, patch): diff --git a/test/tree/test_task_info_formatter.py b/test/tree/test_task_info_formatter.py index 339db559..2fa9ddf2 100644 --- a/test/tree/test_task_info_formatter.py +++ b/test/tree/test_task_info_formatter.py @@ -23,8 +23,10 @@ def test_make_requires_info_with_list(self): self.assertEqual(resulted, expected) def test_make_requires_info_with_generator(self): + def _requires_gen(): return (_RequiredTaskExampleTaskA() for _ in range(2)) + resulted = _make_requires_info(requires=_requires_gen()) expected = [RequiredTask(name=require.__class__.__name__, unique_id=require.make_unique_id()) for require in _requires_gen()] self.assertEqual(resulted, expected) From 8f60826930f331c22c9cad62d378b2fa7fe5f4b4 Mon Sep 17 00:00:00 2001 From: hirosassa Date: Sun, 8 Jan 2023 18:42:51 +0900 Subject: [PATCH 14/14] fix stage name --- .github/workflows/format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 10c50399..139d0134 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -22,6 +22,6 @@ jobs: python -m pip install --upgrade pip python -m pip install poetry poetry install - - name: Run yapf and isort + - name: Run yapf, isort, and flake8 run: | poetry run tox -e yapf,isort,flake8