1
+ {
2
+ "ML docstring" : {
3
+ "prefix" : " \"\"\" " ,
4
+ "body" : " \\\"\\\"\\\" ${1:sumary_line}\n\n Keyword arguments:\n ${2:argument} -- ${3:description}\n Return: ${4:return_description}\n\\\"\\\"\\\"\n 0ドル"
5
+ },
6
+ "SL docstring" : {
7
+ "prefix" : " \"\" " ,
8
+ "body" : " \"\"\" ${1:sumary_line}\"\"\"\n 0ドル"
9
+ },
10
+ "Flask App" : {
11
+ "prefix" : " fapp" ,
12
+ "body" : " from flask import Flask, render_template\n app = Flask(__name__)\n\n\n @app.route('${1:/}')\n def ${2:index}():\n return render_template('${3:index}.html')\n\n if __name__ == '__main__':\n app.run(host:'${4:127.0.0.1}', port=${5:8000}, debug=${6:True})\n 0ドル 0ドル"
13
+ },
14
+ "Flask Route" : {
15
+ "prefix" : " froute" ,
16
+ "body" : " @app.route('${1:path}')\n def ${2:func_name}(${3:foo}):\n return render_template('${4:expression}')0ドル"
17
+ },
18
+ "URL Generator" : {
19
+ "prefix" : " furl" ,
20
+ "body" : " url_for('${1:foo}'2ドル)0ドル"
21
+ },
22
+ "URL Methods" : {
23
+ "prefix" : " fmeth" ,
24
+ "body" : " methods=['GET', 'POST']0ドル"
25
+ },
26
+ "Render Template" : {
27
+ "prefix" : " frt" ,
28
+ "body" : " render_template('${1:page}.html', ${2:foo}=${3:bar})0ドル"
29
+ },
30
+ "Test Request" : {
31
+ "prefix" : " ftreq" ,
32
+ "body" : " with app.test_request_context('${1:path}', method='${2:POST}'):\n\t\t assert request.path == '${1:path}'\n\t\t assert.method == '${2:POST}'\n 0ドル"
33
+ },
34
+ "Flask Upload" : {
35
+ "prefix" : " fup" ,
36
+ "body" : " @app.route('${1:/upload}', methods=['GET', 'POST'])\n def ${2:upload_file}():\n if request.method == 'POST':\n ${3:f} = request.files['${4:the_file}']\n ${3:f}.save('${6:/path/to/save/}${4:the_file}.${5:txt}')\n 0ドル"
37
+ },
38
+ "Secure Upload" : {
39
+ "prefix" : " fsup" ,
40
+ "body" : " from werkzeug.utils import secure_filename\n\n @app.route('${1:/upload}', methods=['GET', 'POST'])\n def ${2:upload_file}():\n if request.method == 'POST':\n ${3:f} = request.files['${4:the_file}']\n ${3:f}.save('${5:/path/to/save/}' + secure_filename(${3:f}.filename))0ドル"
41
+ },
42
+ "Read cookie" : {
43
+ "prefix" : " frc" ,
44
+ "body" : " ${1:foo} = request.cookies.get$('${2:key}')\n 0ドル"
45
+ },
46
+ "Set cookie" : {
47
+ "prefix" : " fsc" ,
48
+ "body" : " ${1:foo} = make_response(${2:expression})\n ${1:foo}.set_cookie('${3:key}', '${4:value}')\n return ${1:foo}\n 0ドル"
49
+ },
50
+ "Error Handler" : {
51
+ "prefix" : " feh" ,
52
+ "body" : " @app.errorhandler(${1:404})\n def ${2:bar}(error):\n\t\t return render_template('${3:error.html}'), ${1:404}\n 0ドル"
53
+ },
54
+ "Flask logging" : {
55
+ "prefix" : " flog" ,
56
+ "body" : " app.logger.${1:debug}(\" ${2:A message}\" )\n 0ドル"
57
+ }
58
+ }
0 commit comments