I updated Manager.get to be a bit more flexible. It now allows only the arguments which are required for path construction, i.e., those which appear in the pattern, to be passed either as args or kwargs. Previously, passing as kwargs only when multiple non-default fields existed would fail as in the example below, and there may have been other bugs with the previous implementation that I didn't discover.
@datafiles.datafile('{self.a}.toml', manual=True)
class T2:
a: int
b: int
T2.objects.get(a=5)
# Results in the following in main, works in PR
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# File "/path/to/repo/datafiles/manager.py", line 43, in get
# instance = self.model(*args, **kwargs)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
# File "/path/to/repo/datafiles/model.py", line 82, in modified_init
# init(self, *args, **kwargs)
# TypeError: T2.__init__() got multiple values for argument 'a'
I updated
Manager.get
to be a bit more flexible. It now allows only the arguments which are required for path construction, i.e., those which appear in the pattern, to be passed either as args or kwargs. Previously, passing as kwargs only when multiple non-default fields existed would fail as in the example below, and there may have been other bugs with the previous implementation that I didn't discover.