You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement from_object/from_string method in Metadata class #1336
Description of feature request:
Implement a class method in Metadata class, similar to the existing from_file method but taking a file object as an argument.
I assume this is useful because client does not write new metadata to disk before it's verified so at that point there's only a file-like object but we want to instantiate the Metadata to verify it is correct?
I guess the other alternative to from_object() is from_string() (and client would then call from_string(tmp_file.read())). I don't think it's clearly better just thinking out loud.
I assume this is useful because client does not write new metadata to disk before it's verified so at that point there's only a file-like object but we want to instantiate the Metadata to verify it is correct?
Yes, exactly.
I guess the other alternative to from_object() is from_string() (and client would then call from_string(tmp_file.read())). I don't think it's clearly better just thinking out loud.
You don't like a function signature with the vague definition of a file object? :)
String would be ok, raw bytes too, no need to be a file object with its associated methods.
Now that a separate serialisation was implemented, all we need is basically a method that calls deserialize.
changed the title [-]Implement from_object method in Metadata class[/-][+]Implement from_object/from_string method in Metadata class[/+]on Apr 16, 2021
Activity
jku commentedon Apr 7, 2021
I assume this is useful because client does not write new metadata to disk before it's verified so at that point there's only a file-like object but we want to instantiate the Metadata to verify it is correct?
I guess the other alternative to
from_object()isfrom_string()(and client would then callfrom_string(tmp_file.read())). I don't think it's clearly better just thinking out loud.sechkova commentedon Apr 7, 2021
Yes, exactly.
You don't like a function signature with the vague definition of a file object? :)
String would be ok, raw bytes too, no need to be a file object with its associated methods.
Now that a separate serialisation was implemented, all we need is basically a method that calls deserialize.
sechkova commentedon Apr 7, 2021
Something like the existing
from_filebut without the actual file read from the file system:jku commentedon Apr 16, 2021
looks good to me --
strseems to make sense as type to me[-]Implement from_object method in Metadata class[/-][+]Implement from_object/from_string method in Metadata class[/+]