Skip to content

Commit

Permalink
test: Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisjared committed Dec 3, 2024
1 parent 922c91a commit 0c405ee
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/ref-core/src/ref_core/datasets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import enum
import hashlib
from typing import Any

import pandas as pd
from attrs import field, frozen
Expand Down Expand Up @@ -61,17 +62,17 @@ class DatasetCollection:
datasets: pd.DataFrame
slug_column: str

def __getattr__(self, item):
def __getattr__(self, item: str) -> Any:
return getattr(self.datasets, item)

def __getitem__(self, item):
def __getitem__(self, item: str) -> Any:
return self.datasets[item]

def __hash__(self) -> int:
# This hashes each item individually and sums them so order doesn't matter
return int(pd.util.hash_pandas_object(self.datasets[self.slug_column]).sum())

def __eq__(self, other):
def __eq__(self, other: object) -> bool:
return self.__hash__() == other.__hash__()


Expand All @@ -90,7 +91,7 @@ def __getitem__(self, key: SourceDatasetType | str) -> DatasetCollection:
key = SourceDatasetType(key)
return self._collection[key]

def __hash__(self):
def __hash__(self) -> int:
return hash(self.slug)

@property
Expand Down

0 comments on commit 0c405ee

Please sign in to comment.