Closed AstraLuma closed 7 years ago
So it turns out, this quickly explodes in complexity.
The huge problem is what to do with __init__()
, since different classes will have different calling conventions. And if any user created a class that doesn't save information necessary to construct it, we're SoL.
It crossed my mind to manually call __new__()
and __init__()
, but 1. That feels like asking for trouble, and 2. We still don't know how to call either if they got overridden.
since different classes will have different calling conventions. And if any user created a class that doesn't save information necessary to construct it
Yeah, one of the goals of YORM (which I think makes it appealing) is that it should work on any class without modification.
Perhaps match()
needs to take some sort of factory object that know how to construct the type of object the user is looking for (including knowing which arguments do not influence the resulting file path)?
Is there a preferred place to keep the path_format
?
Is there a preferred place to keep the
path_format
?
Currently nothing is stored on the class objects. The attribute mappings are stored in yorm.common.attrs[cls]
. Perhaps there could be yorm.common.path_formats[cls]
? If path_format
is to be saved, I'd rather see these combined into a "mappings" dictionary containing all of the class's metadata.
I would much rather save the path_format
and give users convenient DRY options.
I didn't want to have to refactor a bunch of unrelated code in order to implement this. Unless you feel strongly about having them in the same mapping.
How should I handle the pylint errors? I want to ignore a bunch of them, and there's a bunch in code i didn't touch.
I'll add Python 3.6 support and pin pylint in another PR.
I think this is ready for review.
... I have no idea what to do with the E1101 since I'm pretty sure it's full of it. (parse leaves compile()
out of __all__
on purpose.)
Weird that it's only breaking on Python 3.5. We can just add no-member
to the list of disabled rules. That rule is unlikely to catch anything that wouldn't be caught by reasonable test coverage.
Add the ability to search for objects, given filename-keyed values.
Implements #123.