Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infra: Add tests for python 3.11/3.12, remove tests for python 3.7 #439

Merged
merged 2 commits into from
Feb 22, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.12

- name: Install Python dependencies
run: pip install flake8
Expand Down
2 changes: 1 addition & 1 deletion dagshub/common/api/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def list_path(self, path: str, revision: Optional[str] = None, include_size: boo
raise RuntimeError(error_msg)

content = res.json()
if type(content) == dict:
if type(content) is dict:
content = [content]
return [dacite.from_dict(ContentAPIEntry, entry) for entry in content]

Expand Down
6 changes: 3 additions & 3 deletions dagshub/data_engine/client/loaders/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(

self.tensorizers = (
self._get_tensorizers(tensorizers)
if type(tensorizers) == str or type(tensorizers[0]) == str
if type(tensorizers) is str or type(tensorizers[0]) is str
else tensorizers
)

Expand Down Expand Up @@ -192,8 +192,8 @@ def _get_tensorizers(self, datatypes: Union[str, List[Union[str, FunctionType]]]
return [
getattr(self.tensorlib, datatypes),
] * (len(self.metadata_columns) + 1)
elif type(datatypes) == list and len(datatypes) == len(self.metadata_columns) + 1:
return [getattr(self.tensorlib, datatype) if type(datatype) == str else datatype for datatype in datatypes]
elif type(datatypes) is list and len(datatypes) == len(self.metadata_columns) + 1:
return [getattr(self.tensorlib, datatype) if type(datatype) is str else datatype for datatype in datatypes]
else:
raise ValueError(
"Unable to set tensorizers. "
Expand Down
2 changes: 1 addition & 1 deletion dagshub/data_engine/model/metadata_field_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _get_backing_type(t: Union[Type, DagshubDataType]) -> MetadataFieldType:
if issubclass(t, DagshubDataType):
return t.backing_field_type

if type(t) == type:
if type(t) is type:
if t not in metadataTypeLookup.keys():
raise ValueError(f"Primitive type {type(t)} is not supported")
return metadataTypeLookup[t]
Expand Down
4 changes: 2 additions & 2 deletions dagshub/data_engine/model/query_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def as_ml_dataloader(self, flavor, **kwargs):
def keypairs(keys):
return {key: kwargs[key] for key in keys}

if type(flavor) != str:
if type(flavor) is not str:
if flavor.type == "torch":
from dagshub.data_engine.client.loaders.torch import PyTorchDataLoader

Expand All @@ -205,7 +205,7 @@ def keypairs(keys):
kwargs["for_dataloader"] = True
dataset_kwargs = set(list(inspect.signature(DagsHubDataset).parameters.keys())[1:])
global_kwargs = set(kwargs.keys())
flavor = flavor.lower() if type(flavor) == str else flavor
flavor = flavor.lower() if type(flavor) is str else flavor
if flavor == "torch":
from dagshub.data_engine.client.loaders.torch import PyTorchDataLoader

Expand Down
2 changes: 1 addition & 1 deletion tests/data_engine/test_queryresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_getitem_index(query_result):

def test_getitem_slice_returns_query_result(query_result):
qr = query_result[0:len(query_result):2]
assert type(qr) == QueryResult
assert type(qr) is QueryResult
assert len(qr) == math.ceil(len(query_result) / 2)
for i in range(len(qr)):
assert qr[i].datapoint_id is query_result[i * 2].datapoint_id
Loading