Skip to content

Remove stringify_path function in SLI-free NEST #2927

@nicolossus

Description

@nicolossus

#2920 introduced the stringify_path function in order to support os.PathLike objects, such as pathlib.Path, to be passed as filenames:

def stringify_path(filepath):
"""
Convert path-like object to string form.
Attempt to convert path-like object to a string by coercing objects
supporting the fspath protocol to its ``__fspath__`` method. Anything that
is not path-like, which includes bytes and strings, is passed through
unchanged.
Parameters
----------
filepath : object
Object representing file system path.
Returns
-------
filepath : str
Stringified filepath.
"""
if isinstance(filepath, os.PathLike):
filepath = filepath.__fspath__() # should return str or bytes object
return filepath

This function is only necessary because of the SLI layer between PyNEST and the NEST kernel, and should be removed once NEST is free of SLI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I: No breaking changePreviously written code will work as before, no one should note anything changing (aside the fix)S: NormalHandle this with default priorityT: MaintenanceWork to keep up the quality of the code and documentation.

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions