From efbd706abb7043711d0645dbfe7048961a3ed82e Mon Sep 17 00:00:00 2001 From: Eduardo Blancas Date: Wed, 18 Sep 2024 11:35:56 -0600 Subject: [PATCH] lint --- src/soopervisor/abc.py | 1 + src/soopervisor/airflow/export.py | 1 + src/soopervisor/argo/export.py | 1 + src/soopervisor/assets/aws-lambda/app.py | 40 +++++++++---------- src/soopervisor/aws/batch.py | 1 + src/soopervisor/aws/lambda_.py | 1 + src/soopervisor/commons/dag.py | 1 + src/soopervisor/kubeflow/export.py | 1 + tasks.py | 1 + .../clean_one.py | 1 + .../clean_two.py | 1 + .../multiple_requirements_project/plot.py | 1 + .../multiple_requirements_project/raw.py | 1 + tests/assets/sample_project/clean.py | 1 + tests/assets/sample_project/plot.py | 1 + tests/assets/sample_project/raw.py | 1 + tests/test_abc_config.py | 1 + tests/test_add.py | 1 + tests/test_commons_docker.py | 1 + tests/test_config_classes.py | 1 + tests/test_dist.py | 1 + 21 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/soopervisor/abc.py b/src/soopervisor/abc.py index 2006eacb..2379576b 100644 --- a/src/soopervisor/abc.py +++ b/src/soopervisor/abc.py @@ -1,6 +1,7 @@ """ Abstract classes that define the protocol for all exporters """ + import click import abc from pathlib import Path diff --git a/src/soopervisor/airflow/export.py b/src/soopervisor/airflow/export.py index 0a0519a6..4b4f6cba 100644 --- a/src/soopervisor/airflow/export.py +++ b/src/soopervisor/airflow/export.py @@ -1,6 +1,7 @@ """ Export a Ploomber DAG to Airflow """ + import json import os from pathlib import Path diff --git a/src/soopervisor/argo/export.py b/src/soopervisor/argo/export.py index 4c6cb822..cf4ff33c 100644 --- a/src/soopervisor/argo/export.py +++ b/src/soopervisor/argo/export.py @@ -1,6 +1,7 @@ """ Export to Argo Workflows """ + from pathlib import Path import click diff --git a/src/soopervisor/assets/aws-lambda/app.py b/src/soopervisor/assets/aws-lambda/app.py index 177151ad..67ab4b44 100644 --- a/src/soopervisor/assets/aws-lambda/app.py +++ b/src/soopervisor/assets/aws-lambda/app.py @@ -1,28 +1,28 @@ -import json +# import json -import pandas as pd -from ploomber import OnlineModel +# import pandas as pd +# from ploomber import OnlineModel -import {{package_name}} +# import {{package_name}} -model = OnlineModel({{package_name}}) +# model = OnlineModel({{package_name}}) -def handler(event, context): - body = json.loads(event['body']) +# def handler(event, context): +# body = json.loads(event['body']) - raise NotImplementedError('Missing implementation ' - 'in {{package_name}}/app.py. ' - 'Add input parsing logic.') +# raise NotImplementedError('Missing implementation ' +# 'in {{package_name}}/app.py. ' +# 'Add input parsing logic.') - # NOTE: example implementation for a pipeline that expects a data frame - # in a "get" task input - df = pd.DataFrame(body, index=[0]) - prediction = int(model.predict(get=df)[0]) +# # NOTE: example implementation for a pipeline that expects a data frame +# # in a "get" task input +# df = pd.DataFrame(body, index=[0]) +# prediction = int(model.predict(get=df)[0]) - return { - "statusCode": 200, - "body": json.dumps({ - "prediction": prediction - }), - } +# return { +# "statusCode": 200, +# "body": json.dumps({ +# "prediction": prediction +# }), +# } diff --git a/src/soopervisor/aws/batch.py b/src/soopervisor/aws/batch.py index d6f269b8..4c4a4d2b 100644 --- a/src/soopervisor/aws/batch.py +++ b/src/soopervisor/aws/batch.py @@ -1,6 +1,7 @@ """ Running pipelines on AWS Batch """ + import re from uuid import uuid4 import os diff --git a/src/soopervisor/aws/lambda_.py b/src/soopervisor/aws/lambda_.py index 11e8d105..72fa5aea 100644 --- a/src/soopervisor/aws/lambda_.py +++ b/src/soopervisor/aws/lambda_.py @@ -1,6 +1,7 @@ """ Online DAG deployment using AWS Lambda """ + from pathlib import Path from ploomber.util import default from ploomber.io._commander import Commander diff --git a/src/soopervisor/commons/dag.py b/src/soopervisor/commons/dag.py index 9e6b37f8..efdcefef 100644 --- a/src/soopervisor/commons/dag.py +++ b/src/soopervisor/commons/dag.py @@ -1,6 +1,7 @@ """ Loading dags """ + from pathlib import Path from ploomber.constants import TaskStatus diff --git a/src/soopervisor/kubeflow/export.py b/src/soopervisor/kubeflow/export.py index 018bf708..fa54b350 100644 --- a/src/soopervisor/kubeflow/export.py +++ b/src/soopervisor/kubeflow/export.py @@ -1,6 +1,7 @@ """ Export a Ploomber DAG to Kubeflow """ + import os from pathlib import Path diff --git a/tasks.py b/tasks.py index e5621aaf..7d6ebfc6 100644 --- a/tasks.py +++ b/tasks.py @@ -1,6 +1,7 @@ """ Setup tasks (requires invoke: pip install invoke) """ + import shutil import sys import platform diff --git a/tests/assets/multiple_requirements_project/clean_one.py b/tests/assets/multiple_requirements_project/clean_one.py index 5f2292f1..c10d4983 100644 --- a/tests/assets/multiple_requirements_project/clean_one.py +++ b/tests/assets/multiple_requirements_project/clean_one.py @@ -1,6 +1,7 @@ """ Clean raw data """ + import pandas as pd # + tags=["parameters"] diff --git a/tests/assets/multiple_requirements_project/clean_two.py b/tests/assets/multiple_requirements_project/clean_two.py index 70af4474..5ddf9834 100644 --- a/tests/assets/multiple_requirements_project/clean_two.py +++ b/tests/assets/multiple_requirements_project/clean_two.py @@ -1,6 +1,7 @@ """ Clean raw data """ + import pandas as pd # + tags=["parameters"] diff --git a/tests/assets/multiple_requirements_project/plot.py b/tests/assets/multiple_requirements_project/plot.py index ecf46e2a..30b41ca5 100644 --- a/tests/assets/multiple_requirements_project/plot.py +++ b/tests/assets/multiple_requirements_project/plot.py @@ -1,6 +1,7 @@ """ Generate plot """ + import pandas as pd import seaborn as sns diff --git a/tests/assets/multiple_requirements_project/raw.py b/tests/assets/multiple_requirements_project/raw.py index 6eb8a434..87ce1cca 100644 --- a/tests/assets/multiple_requirements_project/raw.py +++ b/tests/assets/multiple_requirements_project/raw.py @@ -3,6 +3,7 @@ Data reference: https://archive.ics.uci.edu/ml/datasets/Adult """ + import pandas as pd # + tags=["parameters"] diff --git a/tests/assets/sample_project/clean.py b/tests/assets/sample_project/clean.py index 5f2292f1..c10d4983 100644 --- a/tests/assets/sample_project/clean.py +++ b/tests/assets/sample_project/clean.py @@ -1,6 +1,7 @@ """ Clean raw data """ + import pandas as pd # + tags=["parameters"] diff --git a/tests/assets/sample_project/plot.py b/tests/assets/sample_project/plot.py index 560b405a..39d71bd2 100644 --- a/tests/assets/sample_project/plot.py +++ b/tests/assets/sample_project/plot.py @@ -1,6 +1,7 @@ """ Generate plot """ + import pandas as pd # + tags=["parameters"] diff --git a/tests/assets/sample_project/raw.py b/tests/assets/sample_project/raw.py index 6eb8a434..87ce1cca 100644 --- a/tests/assets/sample_project/raw.py +++ b/tests/assets/sample_project/raw.py @@ -3,6 +3,7 @@ Data reference: https://archive.ics.uci.edu/ml/datasets/Adult """ + import pandas as pd # + tags=["parameters"] diff --git a/tests/test_abc_config.py b/tests/test_abc_config.py index 53836440..64d4018b 100644 --- a/tests/test_abc_config.py +++ b/tests/test_abc_config.py @@ -1,6 +1,7 @@ """ Test abstract class implementation """ + from pathlib import Path import pytest diff --git a/tests/test_add.py b/tests/test_add.py index 630373b1..f0495563 100644 --- a/tests/test_add.py +++ b/tests/test_add.py @@ -1,6 +1,7 @@ """ Common tests for all implementations """ + from pathlib import Path import pytest diff --git a/tests/test_commons_docker.py b/tests/test_commons_docker.py index 5bd7fba9..ee2484f3 100644 --- a/tests/test_commons_docker.py +++ b/tests/test_commons_docker.py @@ -2,6 +2,7 @@ Testing docker-related functions. Unlike test_commons.py, this file does not mock docker """ + import subprocess import platform from pathlib import Path diff --git a/tests/test_config_classes.py b/tests/test_config_classes.py index 808a9c04..d6d545fa 100644 --- a/tests/test_config_classes.py +++ b/tests/test_config_classes.py @@ -2,6 +2,7 @@ Here we check the default values for each config object, this should contain the minimum number of keys, and values should contain reasonable hints """ + import pytest from soopervisor.shell.config import SlurmConfig diff --git a/tests/test_dist.py b/tests/test_dist.py index f44cf402..d06d8afe 100644 --- a/tests/test_dist.py +++ b/tests/test_dist.py @@ -1,6 +1,7 @@ """ Test generated wheel """ + import tarfile from glob import iglob from pathlib import Path