Skip to content

Commit ecd975c

Browse files
PhilipGutberletmegalinter-botlars-reimannzzril
authored
docs: Sort __all__ list guideline instruction (#433)
Closes #370 ### Summary of Changes Sorted the entries in `__all__` list in `__init__.py` files and added an instruction to the guidelines. --------- Co-authored-by: megalinter-bot <[email protected]> Co-authored-by: Lars Reimann <[email protected]> Co-authored-by: Severin Paul Höfer <[email protected]>
1 parent 2cbee36 commit ecd975c

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

docs/development/guidelines.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,27 @@ The user should not have to deal with exceptions that are defined in the wrapper
205205
return pd.read_csv(path) # May raise a pd.ParserError
206206
```
207207

208+
### Sort entries in `__all__` lists alphabetically
209+
The entries in the `__all__` list in `__init__.py` files should be sorted alphabetically. This helps reduce the likelihood of merge conflicts when new entries are introduced on different branches.
210+
!!! success "**DO** (library code):"
211+
212+
```py
213+
__all__ = [
214+
"ColumnSizeError",
215+
"DuplicateColumnNameError",
216+
"MissingValuesColumnError"
217+
]
218+
```
219+
!!! failure "**DON'T** (library code):"
220+
221+
```py
222+
__all__ = [
223+
"MissingValuesColumnError",
224+
"ColumnSizeError",
225+
"DuplicateColumnNameError"
226+
]
227+
```
228+
208229
### Group API elements by task
209230

210231
Packages should correspond to a specific task like classification or imputation. This eases discovery and makes it easy to switch between different solutions for the same task.

src/safeds/data/tabular/transformation/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
from ._table_transformer import InvertibleTableTransformer, TableTransformer
1010

1111
__all__ = [
12+
"Discretizer",
1213
"Imputer",
14+
"InvertibleTableTransformer",
1315
"LabelEncoder",
1416
"OneHotEncoder",
15-
"InvertibleTableTransformer",
16-
"TableTransformer",
1717
"RangeScaler",
18-
"Discretizer",
1918
"StandardScaler",
19+
"TableTransformer",
2020
]

src/safeds/exceptions/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@
2929
"ColumnSizeError",
3030
"DuplicateColumnNameError",
3131
"IndexOutOfBoundsError",
32+
"MissingValuesColumnError",
3233
"NonNumericColumnError",
3334
"SchemaMismatchError",
3435
"TransformerNotFittedError",
3536
"UnknownColumnNameError",
3637
"ValueNotPresentWhenFittedError",
3738
"WrongFileExtensionError",
38-
"MissingValuesColumnError",
3939
# ML exceptions
4040
"DatasetContainsTargetError",
41+
"DatasetMissesDataError",
4142
"DatasetMissesFeaturesError",
4243
"LearningError",
4344
"ModelNotFittedError",
4445
"PredictionError",
4546
"UntaggedTableError",
46-
"DatasetMissesDataError",
4747
]

0 commit comments

Comments
 (0)