Skip to content

use format specifiers to create names #91

@mathause

Description

@mathause

Format specifiers are not taken into account when creating names:

import filefinder

f = filefinder.FileFinder(
    path_pattern="",
    file_pattern="domain_{domain:02d}.nc",
)

domain = 1

print(f.create_full_name(domain=domain))
print(f"domain_{domain:02d}.nc")
domain_1.nc
domain_01.nc

Because the _pattern_no_fmt_spec is used:

https://github.com/mathause/filefinder/blob/729c8eeddab6f37c989f5af3d2750f64b4638b65/filefinder/_filefinder.py#L52

In this case it would be good if the fmt spec was used. But does that hold in general?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions