Skip to content

Commit f1d73d0

Browse files
committed
style: fix ruff errors
1 parent d53ad0c commit f1d73d0

File tree

270 files changed

+858
-682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+858
-682
lines changed

benchmarks/metrics/classification.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from timeit import timeit
44

55
import polars as pl
6-
from safeds.data.tabular.containers import Table
7-
from safeds.ml.metrics import ClassificationMetrics
86

97
from benchmarks.table.utils import create_synthetic_table
8+
from safeds.data.tabular.containers import Table
9+
from safeds.ml.metrics import ClassificationMetrics
1010

1111
REPETITIONS = 10
1212

benchmarks/table/column_operations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from timeit import timeit
22

3-
from safeds.data.tabular.containers import Table
4-
53
from benchmarks.table.utils import create_synthetic_table
4+
from safeds.data.tabular.containers import Table
65

76
REPETITIONS = 10
87

benchmarks/table/row_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from timeit import timeit
22

33
import polars as pl
4-
from safeds.data.tabular.containers import Table
54

65
from benchmarks.table.utils import create_synthetic_table
6+
from safeds.data.tabular.containers import Table
77

88
REPETITIONS = 10
99

docs/tutorials/classification.ipynb

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"from safeds.data.tabular.containers import Table\n",
8585
"\n",
8686
"raw_data = Table.from_csv_file(\"data/titanic.csv\")\n",
87-
"#For visualisation purposes we only print out the first 15 rows.\n",
87+
"# For visualisation purposes we only print out the first 15 rows.\n",
8888
"raw_data.slice_rows(length=15)"
8989
]
9090
},
@@ -178,18 +178,18 @@
178178
"source": [
179179
"We remove certain columns for the following reasons:\n",
180180
"1. **high idness**: `id` , `ticket`\n",
181-
"2. **high stability**: `parents_children` \n",
181+
"2. **high stability**: `parents_children`\n",
182182
"3. **high missing value ratio**: `cabin`"
183183
]
184184
},
185185
{
186186
"cell_type": "code",
187-
"execution_count": 4,
187+
"execution_count": null,
188188
"metadata": {},
189189
"outputs": [],
190190
"source": [
191-
"train_table = train_table.remove_columns([\"id\",\"ticket\", \"parents_children\", \"cabin\"])\n",
192-
"test_table = test_table.remove_columns([\"id\",\"ticket\", \"parents_children\", \"cabin\"])"
191+
"train_table = train_table.remove_columns([\"id\", \"ticket\", \"parents_children\", \"cabin\"])\n",
192+
"test_table = test_table.remove_columns([\"id\", \"ticket\", \"parents_children\", \"cabin\"])"
193193
]
194194
},
195195
{
@@ -208,7 +208,7 @@
208208
"source": [
209209
"from safeds.data.tabular.transformation import SimpleImputer\n",
210210
"\n",
211-
"simple_imputer = SimpleImputer(column_names=[\"age\",\"fare\"],strategy=SimpleImputer.Strategy.mean())\n",
211+
"simple_imputer = SimpleImputer(column_names=[\"age\", \"fare\"], strategy=SimpleImputer.Strategy.mean())\n",
212212
"fitted_simple_imputer_train, transformed_train_data = simple_imputer.fit_and_transform(train_table)\n",
213213
"transformed_test_data = fitted_simple_imputer_train.transform(test_table)"
214214
]
@@ -240,7 +240,9 @@
240240
"source": [
241241
"from safeds.data.tabular.transformation import OneHotEncoder\n",
242242
"\n",
243-
"fitted_one_hot_encoder_train, transformed_train_data = OneHotEncoder(column_names=[\"sex\", \"port_embarked\"]).fit_and_transform(transformed_train_data)\n",
243+
"fitted_one_hot_encoder_train, transformed_train_data = OneHotEncoder(\n",
244+
" column_names=[\"sex\", \"port_embarked\"],\n",
245+
").fit_and_transform(transformed_train_data)\n",
244246
"transformed_test_data = fitted_one_hot_encoder_train.transform(transformed_test_data)"
245247
]
246248
},
@@ -339,7 +341,7 @@
339341
},
340342
"outputs": [],
341343
"source": [
342-
"tagged_train_table = transformed_train_data.to_tabular_dataset(\"survived\",extra_names=[\"name\"])"
344+
"tagged_train_table = transformed_train_data.to_tabular_dataset(\"survived\", extra_names=[\"name\"])"
343345
]
344346
},
345347
{
@@ -466,7 +468,7 @@
466468
],
467469
"source": [
468470
"reverse_transformed_prediction = prediction.to_table().inverse_transform_table(fitted_one_hot_encoder_train)\n",
469-
"#For visualisation purposes we only print out the first 15 rows.\n",
471+
"# For visualisation purposes we only print out the first 15 rows.\n",
470472
"reverse_transformed_prediction.slice_rows(length=15)"
471473
]
472474
},
@@ -485,25 +487,12 @@
485487
},
486488
{
487489
"cell_type": "code",
488-
"execution_count": 12,
489-
"metadata": {
490-
"collapsed": false,
491-
"jupyter": {
492-
"outputs_hidden": false
493-
}
494-
},
495-
"outputs": [
496-
{
497-
"name": "stdout",
498-
"output_type": "stream",
499-
"text": [
500-
"Accuracy on test data: 79.3893%\n"
501-
]
502-
}
503-
],
490+
"execution_count": null,
491+
"metadata": {},
492+
"outputs": [],
504493
"source": [
505494
"accuracy = fitted_classifier.accuracy(transformed_test_data) * 100\n",
506-
"print(f'Accuracy on test data: {accuracy:.4f}%')"
495+
"f\"Accuracy on test data: {accuracy:.4f}%\""
507496
]
508497
}
509498
],

0 commit comments

Comments
 (0)