Skip to content

Commit

Permalink
Fix Resource.from_descriptor datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Jul 17, 2023
1 parent 863f70c commit 69284f5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions frictionless/resource/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,23 @@ def open(self):
raise
return self

# Convert

@classmethod
def from_descriptor( # type: ignore
cls,
descriptor: Union[types.IDescriptor, str],
*,
datatype: Optional[str] = None,
**options: Any,
) -> Self:
if datatype:
cls = system.select_resource_class(datatype=datatype)
self = cls.from_descriptor(descriptor, **options)
self.datatype = datatype
return self
return super().from_descriptor(descriptor, **options)

# Read

# TODO: deprecate in favour of fileResource.read_file
Expand Down

0 comments on commit 69284f5

Please sign in to comment.