Skip to content

Commit e18a73e

Browse files
0xDakshVPanjeta
authored andcommitted
Add flask api and UI (#18)
* flask api ready * separate folder for web api * project structure changed to add api * modiscript web ui complete * ready to be pushed * updated credits
1 parent 75bcf63 commit e18a73e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+11987
-61
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
__pycache__/
22
.vscode/
3-
env/
3+
env/
4+
.now

MODI

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import sys
5+
6+
from modiscript.api import ModiScript
7+
from modiscript.utils import ErrorHandler, FNF, usage
8+
9+
DEBUG = False
10+
11+
12+
def main():
13+
if len(sys.argv) < 2 or '-h' in sys.argv or '--help' in sys.argv:
14+
usage()
15+
16+
filename = sys.argv[-1]
17+
# filename = "modi.chai"
18+
if '-d' in sys.argv or '--debug' in sys.argv:
19+
global DEBUG
20+
DEBUG = True
21+
22+
# check existence
23+
if not os.path.isfile(filename):
24+
raise ErrorHandler(FNF, filename)
25+
# execute
26+
ms = ModiScript(DEBUG)
27+
ms.execute(filename)
28+
29+
30+
if __name__ == '__main__':
31+
try:
32+
main()
33+
except ErrorHandler as e:
34+
print(e)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ To install, download the repo using: <br/>
2222
git clone https://github.com/VPanjeta/ModiScript
2323
```
2424
Then add ModiScript to your PATH as:<br/>
25-
1. Temporary: Write `export PATH=$PATH:/path/to/ModiScript/modiscript` to terminal. <br/>
26-
2. Permanent: Append `export PATH=$PATH:/path/to/ModiScript/modiscript` to the end of your `~/.bashrc` file.<br/>
25+
1. Temporary: Write `export PATH=$PATH:/path/to/ModiScript` to terminal. <br/>
26+
2. Permanent: Append `export PATH=$PATH:/path/to/ModiScript` to the end of your `~/.bashrc` file.<br/>
2727
And then type
2828
```bash
2929
source ~/.bashrc

modiscript/MODI

Lines changed: 0 additions & 53 deletions
This file was deleted.

modiscript/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__all__ = ["api","utils"]
1+
__all__ = ["api", "utils"]

modiscript/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from lexer import Lexer
2-
from parser import Parser
1+
from .lexer import Lexer
2+
from .parser import Parser
33

44

55
class ModiScript:

modiscript/lexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from utils import LEX, ErrorHandler, ERROR, CONGRESS_RULE, STARTING_TROUBLE, MISQUOTE, WORDS
1+
from .utils import LEX, ErrorHandler, ERROR, CONGRESS_RULE, STARTING_TROUBLE, MISQUOTE, WORDS
22
import re
33
import sys
44

modiscript/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from ast import *
2-
from utils import LEX, ErrorHandler, ERROR, CONGRESS_RULE
2+
from .utils import LEX, ErrorHandler, ERROR, CONGRESS_RULE
33

44

55
class Parser:

now.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": 2,
3+
"builds": [
4+
{ "src": "website/web.py", "use": "@now/python" }
5+
],
6+
"routes": [
7+
{ "src": "/(.*)", "dest": "website/web.py" }
8+
]
9+
}

website/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flask-cors
2+
flask

0 commit comments

Comments
 (0)