Skip to content

[FEATURE] Data loading functions should be able to handle pathlib.Path #77

@timoklein

Description

@timoklein

Current Behavior

When trying to load a dataset, e.g. the CIFAR-10 dataset, passing a pathlib.Path as argument throws.

Expected Behavior

pathlib.Path is widely used and ClustPy should be able to handle it as argument in all calls where a path is expected. Libraries like torch, numpy etc. (which are way bigger of course) are all able to do so.

Possible Solution

a) Check whether a Path object is passed and convert to string before path manipulation.
b) Just use pathlib internally, it's way smoother than os anyway :)

Steps to Reproduce

from pathlib import Path
from clustpy.data import load_cifar10

data_path = Path('.') / "data"
data, labels = load_cifar10(flatten=False, downloads_path=data_path) # throws because 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions