-
Notifications
You must be signed in to change notification settings - Fork 0
/
python.talon
84 lines (71 loc) · 2.11 KB
/
python.talon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
mode: command
and mode: user.python
mode: command
and mode: user.auto_lang
and code.language: python
os: windows
-
tag(): user.code_imperative
tag(): user.code_object_oriented
tag(): user.code_comment_line
tag(): user.code_comment_documentation
tag(): user.code_data_bool
tag(): user.code_data_null
tag(): user.code_functions
tag(): user.code_functions_gui
tag(): user.code_libraries
tag(): user.code_libraries_gui
tag(): user.code_operators_array
tag(): user.code_operators_assignment
tag(): user.code_operators_bitwise
tag(): user.code_operators_math
settings():
user.code_private_function_formatter = "SNAKE_CASE"
user.code_protected_function_formatter = "SNAKE_CASE"
user.code_public_function_formatter = "SNAKE_CASE"
user.code_private_variable_formatter = "SNAKE_CASE"
user.code_protected_variable_formatter = "SNAKE_CASE"
user.code_public_variable_formatter = "SNAKE_CASE"
#python-specific grammars
dunder in it: "__init__"
state (def | deaf | deft): "def "
state try: "try:\n"
state except: "except "
state raise: "raise "
self taught: "self."
pie test: "pytest"
state past: "pass"
raise {user.python_exception}: user.insert_cursor("raise {python_exception}([|])")
except {user.python_exception}: "except {python_exception}:"
dock string:
user.code_comment_documentation()
dock {user.python_docstring_fields}:
insert("{python_docstring_fields}")
edit.left()
dock type {user.code_type}:
user.insert_cursor(":type [|]: {code_type}")
dock returns type {user.code_type}:
user.insert_cursor(":rtype [|]: {code_type}")
toggle imports: user.code_toggle_libraries()
import <user.code_libraries>:
user.code_insert_library(code_libraries, "")
key(end enter)
from import:
insert('from import ')
key('left')
edit.word_left()
key('space')
edit.left()
# pythons pipe operator
stamp: key("space > > space")
stick: key("end space > > space enter")
# Libraries
punk {user.py_lib_pandas}:
insert("{py_lib_pandas}()")
key(left)
numb pie {user.py_lib_numpy}:
insert("{py_lib_numpy}()")
key(left)
stir {user.py_lib_string}:
insert("{py_lib_string}()")
key(left)