Open mathause opened 1 day ago
we could use a positional-only argument for keys
def test(keys, /, **kwargs):
print(keys, kwargs)
test({"a": 5}, keys=7) # works
# {'a': 5} {'keys': 7}
def test(keys, **kwargs):
print(keys, kwargs)
test({"a": 5}, keys=7) # fails
# TypeError: test() got multiple values for argument 'keys'
I don't think on_parse_error
and _allow_empty
are ever going to be used, but still good to have them error. We could also rename _allow_empty
to allow_empty
(but that't a separate issue & PR).
Currently we don't have any sanity checks on the file pattern and path pattern. But I think there are some names that should be reserved - e.g. when they are used as keywords for methods, e.g.
keys
,on_parse_error
,_allow_empty
, we could either warn or raise if these are detected. We could also generally disallow anything with a leading underscore (but then I am not the biggest fan of keywords with underscores).https://github.com/mathause/filefinder/blob/dc449bd57d0d2ad084ac42f37830a0dabeedd65d/filefinder/_filefinder.py#L336-L338
Example 1
Example 2