Closed bdragon300 closed 3 years ago
@bdragon300 I tried fixing this in #36.
The only thing is if the user also wants to use parameters
as key, then it should be given in {key: value}
format.
Otherwise, it will raise a SyntaxError: keyword argument repeated
.
Please have a look.
EDIT: After looking at the build fail, I realized that for this to work, few things need to be changed.
@vmdhhh Yes, I've inserted lines smth like del ...['parameters']
to unit tests as temp workaround for this problem. Now they may be removed then, most of errors in build are tied up with this.
@vmdhhh parameters
should be passed as keyword arg, other Schema.Document contents may be passed as dict or keyword args. It's behavior should be similar to built-in dict, except for parameters
arg. For example:
print(Schema.Document(a=1, b=2, parameters={5: 6}))
Document({'a': 1, 'b': 2}, parameters={5: 6})
or
print(Schema.Document({'a': 1, 'b': 2}, parameters={5: 6}))
Document({'a': 1, 'b': 2}, parameters={5: 6}) #The same
or even
print(Schema.Document((('a', 1), ('b': 2)), parameters={5: 6}))
Document({'a': 1, 'b': 2}, parameters={5: 6}) #The same
but
print(Schema.Document({'a': 1, 'b': 2, 'parameters': {'key1', 'value1'}}, parameters={5: 6}))
Document({'a': 1, 'b': 2, 'parameters': {'key1', 'value1'}}, parameters={5: 6})
Just doing kwargs.pop
before __init__
is sufficient, but it's needed to fix unit tests
@vmdhhh Yes, I've inserted lines smth like
del ...['parameters']
to unit tests as temp workaround for this problem. Now they may be removed then, most of errors in build are tied up with this.
I removed the "deletes". Seems that was only the problem.
Now
parameters
arg inSchema.Document
constructor also adds schema key with given value along with.parameters
attribute:Should be: