Skip to content

Commit

Permalink
Scripted auto-commit on change (2021-09-07 01:18:18) by gitwatch.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
mjobuda committed Sep 6, 2021
1 parent bc5a551 commit 97ea5a6
Show file tree
Hide file tree
Showing 53 changed files with 6,199 additions and 0 deletions.
32 changes: 32 additions & 0 deletions hy/init.hy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
;; Wrapping in an `eval-and-compile` ensures global python packages
;; are available in macros defined in this file as well.
(eval-and-compile
(import sys os)
(sys.path.append "~/<path-to-global-libs>"))

;; These modules, macros, and methods are now available in any Hy repl
(import
re
json
pathlib [Path]
hyrule [pp pformat])

(require
hyrule [%])

(setv
;; Spy and output-fn will be set automatically for all hy repls
repl-spy True
repl-output-fn pformat
;; We can even add colors to the promps. This will set `=>` to green and `...` to red.
sys.ps1 "\x01\x1b[0;32m\x02=> \x01\x1b[0m\x02"
sys.ps2 "\x01\x1b[0;31m\x02... \x01\x1b[0m\x02")

;; Functions and Macros will be available in the repl without qualification
(defn slurp [path]
(setv path (Path path))
(when (path.exists)
(path.read-text)))

(defmacro greet [person]
`(print ~person))
Binary file added hychat/__pycache__/blabla.cpython-38.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions hychat/app.hy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env hy

;; snippet by HN user volent:

(import [flask [Flask]])
(setv app (Flask "Flask test"))
(with-decorator (app.route "/")
(defn index []
"Hello World !"))
15 changes: 15 additions & 0 deletions hychat/blabla.hy
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(import starlette.responses :as RES)
(import starlette.applications :as SA)
(import starlette.routing :as RO)



(defn/a homepage[req] (RES.JSONResponse
{"hello" "world"}))




(setv app (SA.Starlette :debug True :routes
[
(RO.Route "/" homepage)]))
12 changes: 12 additions & 0 deletions hychat/blabla.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import hy
import starlette.responses as Res
import starlette.applications as SA
import starlette.routing as RO


async def homepage(req):
return Res.JSONResponse({'hello': 'world'})


app = SA.Starlette(debug=True, routes=[RO.Route('/', homepage)])

21 changes: 21 additions & 0 deletions hychat/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route


async def homepage(request):
return JSONResponse({'hello': 'world'})

async def hophop(request):
source = request.path_params['source']
destination = request.path_params['destination']
return JSONResponse({source: destination})

app = Starlette(debug=True, routes=[
Route('/', homepage),
Route('/{source}/{destination}', hophop)
])

8 changes: 8 additions & 0 deletions hychat/shim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import hy
from blabla import app

if __name__ == "__main__":
app.run()
3 changes: 3 additions & 0 deletions lily/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .repl import embed

__all__ = ["embed"]
6 changes: 6 additions & 0 deletions lily/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
Make `python -m ptpython` an alias for running `./ptpython`.
"""
from .entry_points.run_ptpython import run

run()
Binary file added lily/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/__main__.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/completer.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/eventloop.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/filters.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/history_browser.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/ipython.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/key_bindings.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/layout.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/lexer.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/prompt_style.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/python_input.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/repl.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/signatures.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/style.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/utils.cpython-38.pyc
Binary file not shown.
Binary file added lily/__pycache__/validator.cpython-38.pyc
Binary file not shown.
Loading

0 comments on commit 97ea5a6

Please sign in to comment.