No project description provided
Project description
Water
Like fire
This python library parses classes so that they can be executed as commands.
In contrast with fire, there is no "automatic" type casting -- the type casting is 100% based on type hints.
Examples
Type casting
class Math1:
def add_list(self, items: Optional[List[int]] = None):
if not items:
return 0
return sum(items)
# `items` casted to a list of `int`
res = execute_command(Math1, 'add_list --items 1,2,3')
assert res == 6
# `items` casted to a list of `int`, even though there is only one entry
res = execute_command(Math1, 'add_list --items 1')
assert res == 1
Nested commands
class NestedObj:
class Inside1:
def fn1(self, number: int):
return number
res = execute_command(NestedObj, 'Inside1 fn1 --number 1')
assert res == 1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
water_cli-0.1.3.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for water_cli-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2f79420757f712f05b86648d2163b1299597d035bd165adeac978f87aea8f18 |
|
MD5 | 5f5d40810593abe226d2c129311f6bd4 |
|
BLAKE2b-256 | 285c92b678dcb124d0fa76bfb4aba6f2a6124d188f4923836bb033280f07d364 |