Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
Add default option to runway.file data type. (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
agermanidis committed Nov 2, 2019
1 parent 29bab43 commit 0e10014
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The Runway Model SDK follows [semantic versioning](https://semver.org/). Be awar
Until version 1.0.0, expect that minor version changes may introduce breaking changes. We will take care not to introduce new behavior, features, or breaking changes in patch releases. If you require stability and reproducible behavior you *may* pin to a version or version range of the model SDK like `runway-python>=0.2.0` or `runway-python>=0.2,<0.3`.

## v.0.5.1

- Added `default` option to the `runway.file` data type.

## v.0.5.0

- Added support for streaming inference via WebSockets.
Expand Down
2 changes: 1 addition & 1 deletion runway/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.5.0'
__version__ = '0.5.1'
10 changes: 7 additions & 3 deletions runway/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,15 @@ def setup(opts):
:type is_directory: bool, optional
:param extension: Accept only files of this extension.
:type extension: string, optional
:param default: Use this path if no input file or directory is provided.
:type default: string, optional
"""

def __init__(self, description=None, is_directory=False, extension=None):
def __init__(self, description=None, is_directory=False, extension=None, default=None):
super(file, self).__init__('file', description=description)
self.is_directory = is_directory
self.extension = extension
self.default = default

def deserialize(self, path_or_url):
if is_url(path_or_url):
Expand All @@ -508,6 +511,7 @@ def to_dict(self):
ret = super(file, self).to_dict()
if self.is_directory: ret['isDirectory'] = self.is_directory
if self.extension: ret['extension'] = self.extension
if self.default: ret['default'] = self.default
return ret


Expand All @@ -530,8 +534,8 @@ def setup(opts):
:type description: string, optional
"""

def __init__(self, description=None):
super(directory, self).__init__(description=description, is_directory=True)
def __init__(self, description=None, default=None):
super(directory, self).__init__(description=description, is_directory=True, default=default)

class segmentation(BaseType):
"""A datatype that represents a pixel-level segmentation of an image.
Expand Down

0 comments on commit 0e10014

Please sign in to comment.