-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement from_object/from_string method in Metadata class #1336
Comments
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 |
Yes, exactly.
You don't like a function signature with the vague definition of a file object? :) Now that a separate serialisation was implemented, all we need is basically a method that calls deserialize. |
Something like the existing @classmethod
def from_string/from_bytes/from_raw(
cls,
raw_data: str/bytes,
deserializer: Optional[MetadataDeserializer] = None
) -> "Metadata":
if deserializer is None:
deserializer = JSONDeserializer()
return deserializer.deserialize(raw_data) |
looks good to me -- |
Description of feature request:
Implement a class method in
Metadata
class, similar to the existingfrom_file
method but taking a file object as an argument.See #1304 for context.
The text was updated successfully, but these errors were encountered: