Skip to content

Commit 6c2cca8

Browse files
committed
some test
1 parent c9cee0a commit 6c2cca8

File tree

11 files changed

+77
-3
lines changed

11 files changed

+77
-3
lines changed

flask/hello_world.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
5+
@app.route('/hello')
6+
def hello():
7+
return "Hello World , I am Flask! Test me"
8+
9+
'''
10+
How to run:
11+
12+
$ export FLASK_APP=hello_world.py
13+
$ export FLASK_ENV=development
14+
$ flask.run
15+
'''
File renamed without changes.

hello/test_coroutine.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import asyncio
2+
3+
@asyncio.coroutine
4+
def func5():
5+
while True:
6+
print("I am func5")
7+
yield from asyncio.sleep(1)
8+
9+
@asyncio.coroutine
10+
def func6():
11+
while True:
12+
print("I am func6")
13+
yield from asyncio.sleep(1)
14+
15+
16+
if __name__ == "__main__":
17+
loop = asyncio.get_event_loop()
18+
tasks = asyncio.wait([func5(),func6()])
19+
loop.run_until_complete(tasks)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

hello/test_threading.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import time
2+
import threading
3+
4+
def func1():
5+
while True:
6+
print("I am func1!")
7+
time.sleep(1)
8+
9+
def func2():
10+
while True:
11+
print("I am func2!")
12+
time.sleep(1)
13+
14+
if __name__ == "__main__":
15+
thread1 = threading.Thread(target=func1)
16+
thread2 = threading.Thread(target=func2)
17+
thread1.start()
18+
thread2.start()

hello/test_threadpool.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import time
2+
import concurrent.futures
3+
4+
def func3():
5+
while True:
6+
print("I am func3!")
7+
time.sleep(1)
8+
9+
def func4():
10+
while True:
11+
print("I am func4!")
12+
time.sleep(1)
13+
14+
if __name__ == "__main__":
15+
executor = concurrent.futures.ThreadPoolExecutor(max_workers=2)
16+
executor.submit(func3)
17+
executor.submit(func4)

json/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ python json
55
- python io stream
66
- big json -> stream ->ijson
77
- json encode decimal -> simplejson
8-
- memeroy_profiler
9-
8+
- memeroy_profiler
9+
# to be high speed
10+
- brew install yajl
11+
- pip3 install six
12+
- pip3 install yajl-py

0 commit comments

Comments
 (0)