Skip to content

Commit efb3e26

Browse files
committed
Black reformatting
1 parent 4d14893 commit efb3e26

File tree

5 files changed

+29
-27
lines changed

5 files changed

+29
-27
lines changed

src/sasctl/pzmm/writeScoreCode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ def score{modelPrefix}({inputVarList}):
600600
model["scoreCodeType"] = "ds2MultiType"
601601
modelRepo.update_model(model)
602602

603+
@classmethod
603604
def splitStringColumn(cls, inputSeries, otherVariable):
604605
"""
605606
Splits a column of string values into a number of new variables equal

tests/integration/test_model_parameters.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import warnings
33
from sasctl.pzmm.modelParameters import ModelParameters as mp
44

5-
pytestmark = pytest.mark.usefixtures('session')
5+
pytestmark = pytest.mark.usefixtures("session")
66

77

88
@pytest.fixture
@@ -12,20 +12,20 @@ def train_data():
1212
try:
1313
import pandas as pd
1414
except ImportError:
15-
pytest.skip('Package `pandas` not found.')
15+
pytest.skip("Package `pandas` not found.")
1616

1717
try:
1818
from sklearn import datasets
1919
except ImportError:
20-
pytest.skip('Package `sklearn` not found.')
20+
pytest.skip("Package `sklearn` not found.")
2121

2222
raw = datasets.load_iris()
2323
iris = pd.DataFrame(raw.data, columns=raw.feature_names)
2424
iris = iris.join(pd.DataFrame(raw.target))
25-
iris.columns = ['SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth', 'Species']
26-
iris['Species'] = iris['Species'].astype('category')
25+
iris.columns = ["SepalLength", "SepalWidth", "PetalLength", "PetalWidth", "Species"]
26+
iris["Species"] = iris["Species"].astype("category")
2727
iris.Species.cat.categories = raw.target_names
28-
return iris.iloc[:, 0:4], iris['Species']
28+
return iris.iloc[:, 0:4], iris["Species"]
2929

3030

3131
@pytest.fixture
@@ -35,21 +35,18 @@ def sklearn_model(train_data):
3535
try:
3636
from sklearn.linear_model import LogisticRegression
3737
except ImportError:
38-
pytest.skip('Package `sklearn` not found.')
38+
pytest.skip("Package `sklearn` not found.")
3939

4040
X, y = train_data
4141
with warnings.catch_warnings():
42-
warnings.simplefilter('ignore')
43-
model = LogisticRegression(multi_class='multinomial', solver='lbfgs')
42+
warnings.simplefilter("ignore")
43+
model = LogisticRegression(multi_class="multinomial", solver="lbfgs")
4444
model.fit(X, y)
4545
return model
4646

47+
4748
@pytest.mark.incremental
4849
class TestSklearnModel:
49-
PROJECT_NAME="Test SKLearn Model"
50-
MODEL_NAME="SKLearnModel"
51-
PATH="."
52-
53-
54-
55-
50+
PROJECT_NAME = "Test SKLearn Model"
51+
MODEL_NAME = "SKLearnModel"
52+
PATH = "."

tests/integration/test_text_categorization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_from_table():
4545

4646
def test_service_removed_error():
4747
if current_session().version_info() < 4:
48-
pytest.skip('Text Categorization service was not removed until Viya 4.')
48+
pytest.skip("Text Categorization service was not removed until Viya 4.")
4949

5050
with pytest.raises(RuntimeError):
51-
tc.categorize('', None, id_column='', text_column='')
51+
tc.categorize("", None, id_column="", text_column="")

tests/unit/test_model_parameters.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,34 @@ def train_data():
2424
raw = datasets.load_iris()
2525
iris = pd.DataFrame(raw.data, columns=raw.feature_names)
2626
iris = iris.join(pd.DataFrame(raw.target))
27-
iris.columns = ['SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth', 'Species']
28-
iris['Species'] = iris['Species'].astype('category')
27+
iris.columns = ["SepalLength", "SepalWidth", "PetalLength", "PetalWidth", "Species"]
28+
iris["Species"] = iris["Species"].astype("category")
2929
iris.Species.cat.categories = raw.target_names
30-
return iris.iloc[:, 0:4], iris['Species']
30+
return iris.iloc[:, 0:4], iris["Species"]
3131

3232

3333
@pytest.fixture
3434
def sklearn_model(train_data):
3535
"""Returns a simple Scikit-Learn model"""
3636
X, y = train_data
3737
with warnings.catch_warnings():
38-
warnings.simplefilter('ignore')
39-
model = LogisticRegression(multi_class='multinomial', solver='lbfgs')
38+
warnings.simplefilter("ignore")
39+
model = LogisticRegression(multi_class="multinomial", solver="lbfgs")
4040
model.fit(X, y)
4141
return model
4242

4343

4444
@pytest.mark.incremental
4545
class TestSKLearnModel:
46-
PROJECT_NAME = 'PZMM SKLearn Test Project'
47-
MODEL_NAME = 'SKLearnModel'
46+
PROJECT_NAME = "PZMM SKLearn Test Project"
47+
MODEL_NAME = "SKLearnModel"
4848

4949
def test_generate_hyperparameters(self, sklearn_model):
5050
tmp_dir = tempfile.TemporaryDirectory()
5151
mp.generate_hyperparameters(sklearn_model, self.MODEL_NAME, Path(tmp_dir.name))
52-
assert Path(Path(tmp_dir.name) / f'./{self.MODEL_NAME}Hyperparameters.json').exists()
52+
assert Path(
53+
Path(tmp_dir.name) / f"./{self.MODEL_NAME}Hyperparameters.json"
54+
).exists()
5355

5456
def test_bad_model_hyperparameters(self, bad_model):
5557
tmp_dir = tempfile.TemporaryDirectory()

tests/unit/test_pageiterator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def test_no_paging_required():
7171
try:
7272
request.assert_not_called()
7373
except AssertionError as e:
74-
raise AssertionError(f'method_calls={request.mock_calls} call_args={request.call_args_list}')
74+
raise AssertionError(
75+
f"method_calls={request.mock_calls} call_args={request.call_args_list}"
76+
)
7577

7678

7779
def test_paging_required(paging):

0 commit comments

Comments
 (0)