Skip to content

Instantly share code, notes, and snippets.

@Lawouach
Created January 27, 2017 17:29
Show Gist options
  • Save Lawouach/c58bad934f741e29c9e91d2fe158e9c5 to your computer and use it in GitHub Desktop.
Save Lawouach/c58bad934f741e29c9e91d2fe158e9c5 to your computer and use it in GitHub Desktop.
Import Python code into your Rugs
# -*- 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
}
# -*- 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