Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ repos:
additional_dependencies:
- types-requests
- types-python-dateutil
- id: mypy
name: mypy type-def-check
files: openml/datasets/.*
additional_dependencies:
- types-requests
- types-python-dateutil
- id: mypy
name: mypy top-level-functions
files: openml/_api_calls.py
additional_dependencies:
- types-requests
- types-python-dateutil
args: [ --disallow-untyped-defs, --disallow-any-generics,
--disallow-any-explicit, --implicit-optional ]
--disallow-any-explicit, --implicit-optional, --allow-redefinition]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, what's the reason for allow-redefinition? And should these more strict checks maybe also be applied to the newly added check for the datasets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow-redefinition allows redefining a variable with a different type within same block and nesting depth, there were a few cases that happened and i didn't want to change the code too much. Agreed with the second part, adding them to datasets part as well.


- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion openml/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _entity_letter(cls) -> str:
return cls.__name__.lower()[len("OpenML") :][0]

@abstractmethod
def _get_repr_body_fields(self) -> List[Tuple[str, Union[str, int, List[str]]]]:
def _get_repr_body_fields(self) -> List[Tuple[str, Union[str, int, List[str], None]]]:
"""Collect all information to display in the __repr__ body.

Returns
Expand Down
8 changes: 4 additions & 4 deletions openml/datasets/data_feature.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# License: BSD 3-Clause

from typing import List
from prettyprinter import PrettyPrinter


class OpenMLDataFeature(object):
Expand Down Expand Up @@ -59,11 +59,11 @@ def __init__(
self.nominal_values = nominal_values
self.number_missing_values = number_missing_values

def __repr__(self):
def __repr__(self) -> str:
return "[%d - %s (%s)]" % (self.index, self.name, self.data_type)

def __eq__(self, other):
def __eq__(self, other: object) -> bool:
return isinstance(other, OpenMLDataFeature) and self.__dict__ == other.__dict__

def _repr_pretty_(self, pp, cycle):
def _repr_pretty_(self, pp: PrettyPrinter, cycle: bool) -> None:
pp.text(str(self))
Loading