Created
January 27, 2017 17:29
-
-
Save Lawouach/c58bad934f741e29c9e91d2fe158e9c5 to your computer and use it in GitHub Desktop.
Import Python code into your Rugs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from typing import Dict, Any | |
from .rugpy.stuff import echo | |
__all__ = ["editor"] | |
def edit(project: Any, params: Dict[str, str]) -> Dict[str, str]: | |
""" | |
Add a new method to a Python module. | |
""" | |
print(echo("doing other thing")) | |
return {"status":"OK", "message": "Everything is cool"} | |
editor = { | |
"tags": ["python"], | |
"name": "DoSomethingElse", | |
"description": "Add a method to a Python class", | |
"parameters": [ | |
{ | |
"required": True, | |
"description": "the import path of the python module to load", | |
"displayName": "Python import module", | |
"displayable": True, | |
"validInput": "the Python package import path of a Python module", | |
"pattern": "^\\w[-\\w.]*$", | |
"minLength": 1, | |
"name": "python_mod_import" | |
} | |
], | |
"edit": edit | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
__all__ = ["echo"] | |
def echo(whatever: str) -> str: | |
return whatever |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment