@enjoys/context-engine 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/data/commands/adb.json +322 -0
  2. package/data/commands/alembic.json +301 -0
  3. package/data/commands/artisan.json +277 -0
  4. package/data/commands/atlas.json +426 -0
  5. package/data/commands/auth0.json +648 -0
  6. package/data/commands/bat.json +84 -0
  7. package/data/commands/bundle.json +321 -0
  8. package/data/commands/composer.json +507 -0
  9. package/data/commands/dart.json +216 -0
  10. package/data/commands/dbmate.json +257 -0
  11. package/data/commands/docker-compose.json +384 -0
  12. package/data/commands/drizzle-kit.json +217 -0
  13. package/data/commands/expo.json +65 -0
  14. package/data/commands/fastlane.json +243 -0
  15. package/data/commands/fd.json +86 -0
  16. package/data/commands/flutter.json +298 -0
  17. package/data/commands/flyway.json +261 -0
  18. package/data/commands/fzf.json +103 -0
  19. package/data/commands/gem.json +267 -0
  20. package/data/commands/jq.json +100 -0
  21. package/data/commands/k9s.json +62 -0
  22. package/data/commands/liquibase.json +399 -0
  23. package/data/commands/manifest.json +619 -0
  24. package/data/commands/minikube.json +60 -0
  25. package/data/commands/ng.json +64 -0
  26. package/data/commands/nuxt.json +60 -0
  27. package/data/commands/php.json +157 -0
  28. package/data/commands/pm2.json +259 -0
  29. package/data/commands/pod.json +175 -0
  30. package/data/commands/prisma.json +257 -0
  31. package/data/commands/rails.json +372 -0
  32. package/data/commands/rake.json +360 -0
  33. package/data/commands/react-native.json +57 -0
  34. package/data/commands/rg.json +103 -0
  35. package/data/commands/rspec.json +257 -0
  36. package/data/commands/ruby.json +108 -0
  37. package/data/commands/sequelize.json +342 -0
  38. package/data/commands/snyk.json +442 -0
  39. package/data/commands/sonar-scanner.json +219 -0
  40. package/data/commands/stripe.json +314 -0
  41. package/data/commands/symfony.json +449 -0
  42. package/data/commands/tmux.json +197 -0
  43. package/data/commands/trivy.json +367 -0
  44. package/data/commands/twilio.json +382 -0
  45. package/data/commands/typeorm.json +262 -0
  46. package/data/commands/vue.json +60 -0
  47. package/data/commands/wp.json +857 -0
  48. package/data/commands/xcodebuild.json +141 -0
  49. package/data/commands/yq.json +57 -0
  50. package/data/completion/bash.json +1184 -0
  51. package/data/completion/c.json +1067 -0
  52. package/data/completion/cpp.json +824 -0
  53. package/data/completion/csharp.json +860 -0
  54. package/data/completion/dockerfile.json +536 -0
  55. package/data/completion/go.json +1346 -0
  56. package/data/completion/html.json +806 -0
  57. package/data/completion/java.json +1112 -0
  58. package/data/completion/javascript.json +914 -0
  59. package/data/completion/lua.json +968 -0
  60. package/data/completion/php.json +1535 -0
  61. package/data/completion/python.json +1427 -0
  62. package/data/completion/ruby.json +1531 -0
  63. package/data/completion/rust.json +698 -0
  64. package/data/completion/sql.json +887 -0
  65. package/data/completion/toml.json +428 -0
  66. package/data/completion/typescript.json +338 -0
  67. package/data/completion/yaml.json +563 -0
  68. package/data/defination/bash.json +565 -0
  69. package/data/defination/c.json +865 -0
  70. package/data/defination/cpp.json +348 -0
  71. package/data/defination/csharp.json +144 -0
  72. package/data/defination/dockerfile.json +113 -0
  73. package/data/defination/go.json +561 -0
  74. package/data/defination/html.json +559 -0
  75. package/data/defination/java.json +184 -0
  76. package/data/defination/javascript.json +265 -0
  77. package/data/defination/lua.json +181 -0
  78. package/data/defination/php.json +726 -0
  79. package/data/defination/python.json +717 -0
  80. package/data/defination/ruby.json +670 -0
  81. package/data/defination/rust.json +207 -0
  82. package/data/defination/sql.json +473 -0
  83. package/data/defination/toml.json +251 -0
  84. package/data/defination/typescript.json +29 -0
  85. package/data/defination/yaml.json +197 -0
  86. package/data/hover/bash.json +245 -0
  87. package/data/hover/c.json +265 -0
  88. package/data/hover/cpp.json +210 -0
  89. package/data/hover/csharp.json +290 -0
  90. package/data/hover/dockerfile.json +145 -0
  91. package/data/hover/go.json +580 -0
  92. package/data/hover/html.json +250 -0
  93. package/data/hover/java.json +395 -0
  94. package/data/hover/javascript.json +330 -0
  95. package/data/hover/lua.json +265 -0
  96. package/data/hover/php.json +300 -0
  97. package/data/hover/python.json +380 -0
  98. package/data/hover/ruby.json +265 -0
  99. package/data/hover/rust.json +275 -0
  100. package/data/hover/sql.json +230 -0
  101. package/data/hover/toml.json +145 -0
  102. package/data/hover/typescript.json +120 -0
  103. package/data/hover/yaml.json +165 -0
  104. package/data/manifest.json +242 -0
  105. package/package.json +1 -1
@@ -0,0 +1,1427 @@
1
+ {
2
+ "language": "python",
3
+ "completions": [
4
+ {
5
+ "label": "print",
6
+ "kind": 1,
7
+ "detail": "Print objects to the text stream",
8
+ "documentation": { "value": "Prints the given objects to `sys.stdout` (or another stream).\n\n```python\nprint('Hello, world!')\nprint('x =', x, sep='', end='\\n')\nprint(*items, sep=', ', file=sys.stderr)\n```" },
9
+ "insertText": "print(${1:object})",
10
+ "insertTextRules": 4,
11
+ "sortText": "00_print"
12
+ },
13
+ {
14
+ "label": "len",
15
+ "kind": 1,
16
+ "detail": "Return the length of an object",
17
+ "documentation": { "value": "Return the number of items in a container.\n\n```python\nlen([1, 2, 3]) # 3\nlen('hello') # 5\nlen({'a': 1}) # 1\n```" },
18
+ "insertText": "len(${1:obj})",
19
+ "insertTextRules": 4,
20
+ "sortText": "00_len"
21
+ },
22
+ {
23
+ "label": "range",
24
+ "kind": 1,
25
+ "detail": "Generate a sequence of numbers",
26
+ "documentation": { "value": "Returns an immutable sequence of numbers.\n\n```python\nrange(10) # 0..9\nrange(1, 11) # 1..10\nrange(0, 20, 2) # 0, 2, 4, …, 18\nlist(range(5)) # [0, 1, 2, 3, 4]\n```" },
27
+ "insertText": "range(${1:stop})",
28
+ "insertTextRules": 4,
29
+ "sortText": "00_range"
30
+ },
31
+ {
32
+ "label": "enumerate",
33
+ "kind": 1,
34
+ "detail": "Return an enumerate object",
35
+ "documentation": { "value": "Yields pairs of `(index, element)` from an iterable.\n\n```python\nfor i, val in enumerate(['a', 'b', 'c']):\n print(i, val)\n\nfor i, val in enumerate(items, start=1):\n print(i, val)\n```" },
36
+ "insertText": "enumerate(${1:iterable})",
37
+ "insertTextRules": 4,
38
+ "sortText": "00_enumerate"
39
+ },
40
+ {
41
+ "label": "zip",
42
+ "kind": 1,
43
+ "detail": "Iterate over several iterables in parallel",
44
+ "documentation": { "value": "Yields tuples pairing elements from each iterable.\n\n```python\nfor a, b in zip([1, 2], ['x', 'y']):\n print(a, b)\n\ndict(zip(keys, values))\nlist(zip(a, b, strict=True)) # 3.10+\n```" },
45
+ "insertText": "zip(${1:iter1}, ${2:iter2})",
46
+ "insertTextRules": 4,
47
+ "sortText": "00_zip"
48
+ },
49
+ {
50
+ "label": "map",
51
+ "kind": 1,
52
+ "detail": "Apply function to every item of iterable",
53
+ "documentation": { "value": "Returns an iterator that applies *function* to every item of *iterable*.\n\n```python\nlist(map(str.upper, ['hello', 'world']))\nlist(map(lambda x: x ** 2, [1, 2, 3]))\n```" },
54
+ "insertText": "map(${1:function}, ${2:iterable})",
55
+ "insertTextRules": 4,
56
+ "sortText": "00_map"
57
+ },
58
+ {
59
+ "label": "filter",
60
+ "kind": 1,
61
+ "detail": "Filter elements from iterable",
62
+ "documentation": { "value": "Return an iterator yielding items for which `function(item)` is true.\n\n```python\nlist(filter(lambda x: x > 0, [-1, 0, 2, 5]))\nlist(filter(None, [0, '', 'a', 1])) # truthy values\n```" },
63
+ "insertText": "filter(${1:function}, ${2:iterable})",
64
+ "insertTextRules": 4,
65
+ "sortText": "00_filter"
66
+ },
67
+ {
68
+ "label": "sorted",
69
+ "kind": 1,
70
+ "detail": "Return a new sorted list",
71
+ "documentation": { "value": "Return a new list containing all items from the iterable in ascending order.\n\n```python\nsorted([3, 1, 2]) # [1, 2, 3]\nsorted(words, key=str.lower) # case-insensitive\nsorted(data, key=lambda x: x['age'], reverse=True)\n```" },
72
+ "insertText": "sorted(${1:iterable})",
73
+ "insertTextRules": 4,
74
+ "sortText": "00_sorted"
75
+ },
76
+ {
77
+ "label": "reversed",
78
+ "kind": 1,
79
+ "detail": "Return a reverse iterator",
80
+ "documentation": { "value": "Return a reverse iterator over the sequence.\n\n```python\nlist(reversed([1, 2, 3])) # [3, 2, 1]\nfor ch in reversed('abc'):\n print(ch)\n```" },
81
+ "insertText": "reversed(${1:sequence})",
82
+ "insertTextRules": 4,
83
+ "sortText": "00_reversed"
84
+ },
85
+ {
86
+ "label": "any",
87
+ "kind": 1,
88
+ "detail": "Return True if any element is true",
89
+ "documentation": { "value": "Return `True` if any element of the iterable is true.\n\n```python\nany([False, False, True]) # True\nany(x > 0 for x in nums) # generator expression\n```" },
90
+ "insertText": "any(${1:iterable})",
91
+ "insertTextRules": 4,
92
+ "sortText": "00_any"
93
+ },
94
+ {
95
+ "label": "all",
96
+ "kind": 1,
97
+ "detail": "Return True if all elements are true",
98
+ "documentation": { "value": "Return `True` if all elements of the iterable are true (or iterable is empty).\n\n```python\nall([True, True, True]) # True\nall(x > 0 for x in nums) # generator expression\n```" },
99
+ "insertText": "all(${1:iterable})",
100
+ "insertTextRules": 4,
101
+ "sortText": "00_all"
102
+ },
103
+ {
104
+ "label": "isinstance",
105
+ "kind": 1,
106
+ "detail": "Check if object is an instance of a class",
107
+ "documentation": { "value": "Return `True` if the object is an instance of the classinfo argument.\n\n```python\nisinstance(42, int) # True\nisinstance('hi', (str, bytes)) # True (tuple of types)\nisinstance(obj, MyProtocol) # runtime-checkable protocol\n```" },
108
+ "insertText": "isinstance(${1:obj}, ${2:classinfo})",
109
+ "insertTextRules": 4,
110
+ "sortText": "00_isinstance"
111
+ },
112
+ {
113
+ "label": "issubclass",
114
+ "kind": 1,
115
+ "detail": "Check if a class is a subclass of another",
116
+ "documentation": { "value": "Return `True` if *class* is a subclass of *classinfo*.\n\n```python\nissubclass(bool, int) # True\nissubclass(str, (int, float)) # False\n```" },
117
+ "insertText": "issubclass(${1:cls}, ${2:classinfo})",
118
+ "insertTextRules": 4,
119
+ "sortText": "00_issubclass"
120
+ },
121
+ {
122
+ "label": "type",
123
+ "kind": 1,
124
+ "detail": "Return the type of an object",
125
+ "documentation": { "value": "With one argument, return the type of an object. With three arguments, create a new type.\n\n```python\ntype(42) # <class 'int'>\ntype('hello') # <class 'str'>\nMyClass = type('MyClass', (Base,), {'x': 10})\n```" },
126
+ "insertText": "type(${1:object})",
127
+ "insertTextRules": 4,
128
+ "sortText": "00_type"
129
+ },
130
+ {
131
+ "label": "id",
132
+ "kind": 1,
133
+ "detail": "Return the identity of an object",
134
+ "documentation": { "value": "Return the identity of an object — guaranteed unique integer for its lifetime.\n\n```python\nid(obj)\na is b # equivalent to id(a) == id(b)\n```" },
135
+ "insertText": "id(${1:object})",
136
+ "insertTextRules": 4,
137
+ "sortText": "00_id"
138
+ },
139
+ {
140
+ "label": "hash",
141
+ "kind": 1,
142
+ "detail": "Return the hash value of an object",
143
+ "documentation": { "value": "Return the hash value of the object (if it has one).\n\n```python\nhash('hello') # deterministic within a process\nhash((1, 2, 3)) # tuples are hashable\n```" },
144
+ "insertText": "hash(${1:object})",
145
+ "insertTextRules": 4,
146
+ "sortText": "00_hash"
147
+ },
148
+ {
149
+ "label": "dir",
150
+ "kind": 1,
151
+ "detail": "List names in the current scope or object attributes",
152
+ "documentation": { "value": "Without arguments, return names in the current scope. With an argument, return a list of valid attributes for that object.\n\n```python\ndir() # current scope names\ndir([]) # list attributes\ndir(str) # string class attributes\n```" },
153
+ "insertText": "dir(${1:object})",
154
+ "insertTextRules": 4,
155
+ "sortText": "00_dir"
156
+ },
157
+ {
158
+ "label": "vars",
159
+ "kind": 1,
160
+ "detail": "Return __dict__ of an object",
161
+ "documentation": { "value": "Return the `__dict__` attribute for a module, class, instance, or any other object.\n\n```python\nvars() # same as locals()\nvars(obj) # obj.__dict__\n```" },
162
+ "insertText": "vars(${1:object})",
163
+ "insertTextRules": 4,
164
+ "sortText": "00_vars"
165
+ },
166
+ {
167
+ "label": "getattr",
168
+ "kind": 1,
169
+ "detail": "Get a named attribute from an object",
170
+ "documentation": { "value": "Return the value of the named attribute of object. An optional default is returned if the attribute doesn't exist.\n\n```python\ngetattr(obj, 'name')\ngetattr(obj, 'name', 'default_value')\n```" },
171
+ "insertText": "getattr(${1:object}, ${2:'attribute'})",
172
+ "insertTextRules": 4,
173
+ "sortText": "00_getattr"
174
+ },
175
+ {
176
+ "label": "setattr",
177
+ "kind": 1,
178
+ "detail": "Set a named attribute on an object",
179
+ "documentation": { "value": "Set the named attribute on the given object to the specified value.\n\n```python\nsetattr(obj, 'name', value)\n# equivalent to: obj.name = value\n```" },
180
+ "insertText": "setattr(${1:object}, ${2:'attribute'}, ${3:value})",
181
+ "insertTextRules": 4,
182
+ "sortText": "00_setattr"
183
+ },
184
+ {
185
+ "label": "hasattr",
186
+ "kind": 1,
187
+ "detail": "Check if an object has an attribute",
188
+ "documentation": { "value": "Return `True` if the string is the name of one of the object's attributes.\n\n```python\nhasattr(obj, 'name') # True or False\n```" },
189
+ "insertText": "hasattr(${1:object}, ${2:'attribute'})",
190
+ "insertTextRules": 4,
191
+ "sortText": "00_hasattr"
192
+ },
193
+ {
194
+ "label": "delattr",
195
+ "kind": 1,
196
+ "detail": "Delete a named attribute from an object",
197
+ "documentation": { "value": "Delete the named attribute from the object (if the object allows it).\n\n```python\ndelattr(obj, 'name')\n# equivalent to: del obj.name\n```" },
198
+ "insertText": "delattr(${1:object}, ${2:'attribute'})",
199
+ "insertTextRules": 4,
200
+ "sortText": "00_delattr"
201
+ },
202
+ {
203
+ "label": "property",
204
+ "kind": 5,
205
+ "detail": "Built-in property descriptor",
206
+ "documentation": { "value": "Return a property attribute. Typically used as a decorator.\n\n```python\nclass C:\n @property\n def x(self) -> int:\n return self._x\n\n @x.setter\n def x(self, value: int) -> None:\n self._x = value\n```" },
207
+ "insertText": "@property\ndef ${1:name}(self) -> ${2:type}:\n return self._${1:name}",
208
+ "insertTextRules": 4,
209
+ "sortText": "00_property"
210
+ },
211
+ {
212
+ "label": "classmethod",
213
+ "kind": 14,
214
+ "detail": "Declare a class method",
215
+ "documentation": { "value": "Transform a method into a class method. Receives the class as the first argument instead of an instance.\n\n```python\nclass MyClass:\n @classmethod\n def from_string(cls, s: str) -> 'MyClass':\n return cls(s)\n```" },
216
+ "insertText": "@classmethod\ndef ${1:name}(cls${2:, args}) -> ${3:type}:\n ${0:pass}",
217
+ "insertTextRules": 4,
218
+ "sortText": "00_classmethod"
219
+ },
220
+ {
221
+ "label": "staticmethod",
222
+ "kind": 14,
223
+ "detail": "Declare a static method",
224
+ "documentation": { "value": "Transform a method into a static method. Does not receive an implicit first argument.\n\n```python\nclass Math:\n @staticmethod\n def add(a: int, b: int) -> int:\n return a + b\n```" },
225
+ "insertText": "@staticmethod\ndef ${1:name}(${2:args}) -> ${3:type}:\n ${0:pass}",
226
+ "insertTextRules": 4,
227
+ "sortText": "00_staticmethod"
228
+ },
229
+ {
230
+ "label": "super",
231
+ "kind": 1,
232
+ "detail": "Return a proxy object for parent class",
233
+ "documentation": { "value": "Return a proxy object that delegates method calls to a parent or sibling class.\n\n```python\nclass Child(Parent):\n def __init__(self):\n super().__init__()\n```" },
234
+ "insertText": "super()",
235
+ "insertTextRules": 4,
236
+ "sortText": "00_super"
237
+ },
238
+ {
239
+ "label": "abs",
240
+ "kind": 1,
241
+ "detail": "Return absolute value",
242
+ "documentation": { "value": "Return the absolute value of a number.\n\n```python\nabs(-5) # 5\nabs(3.14) # 3.14\nabs(-2+3j) # 3.605551275…\n```" },
243
+ "insertText": "abs(${1:x})",
244
+ "insertTextRules": 4,
245
+ "sortText": "00_abs"
246
+ },
247
+ {
248
+ "label": "min",
249
+ "kind": 1,
250
+ "detail": "Return the smallest item",
251
+ "documentation": { "value": "Return the smallest item in an iterable or the smallest of two or more arguments.\n\n```python\nmin([3, 1, 2]) # 1\nmin('hello', key=ord) # 'e'\nmin(a, b, default=0)\n```" },
252
+ "insertText": "min(${1:iterable})",
253
+ "insertTextRules": 4,
254
+ "sortText": "00_min"
255
+ },
256
+ {
257
+ "label": "max",
258
+ "kind": 1,
259
+ "detail": "Return the largest item",
260
+ "documentation": { "value": "Return the largest item in an iterable or the largest of two or more arguments.\n\n```python\nmax([3, 1, 2]) # 3\nmax(words, key=len) # longest word\nmax(a, b, default=0)\n```" },
261
+ "insertText": "max(${1:iterable})",
262
+ "insertTextRules": 4,
263
+ "sortText": "00_max"
264
+ },
265
+ {
266
+ "label": "sum",
267
+ "kind": 1,
268
+ "detail": "Sum items of an iterable",
269
+ "documentation": { "value": "Sums *start* and the items of an iterable from left to right.\n\n```python\nsum([1, 2, 3]) # 6\nsum(range(100)) # 4950\nsum(prices, start=0.0)\n```" },
270
+ "insertText": "sum(${1:iterable})",
271
+ "insertTextRules": 4,
272
+ "sortText": "00_sum"
273
+ },
274
+ {
275
+ "label": "round",
276
+ "kind": 1,
277
+ "detail": "Round a number to a given precision",
278
+ "documentation": { "value": "Round a number to a given precision in decimal digits.\n\n```python\nround(3.14159, 2) # 3.14\nround(2.5) # 2 (banker's rounding)\nround(1234, -2) # 1200\n```" },
279
+ "insertText": "round(${1:number}, ${2:ndigits})",
280
+ "insertTextRules": 4,
281
+ "sortText": "00_round"
282
+ },
283
+ {
284
+ "label": "pow",
285
+ "kind": 1,
286
+ "detail": "Return base to the power exp",
287
+ "documentation": { "value": "Return `base ** exp`; if `mod` is present, return `base ** exp % mod`.\n\n```python\npow(2, 10) # 1024\npow(2, 10, 1000) # 24 (modular exponentiation)\n```" },
288
+ "insertText": "pow(${1:base}, ${2:exp})",
289
+ "insertTextRules": 4,
290
+ "sortText": "00_pow"
291
+ },
292
+ {
293
+ "label": "divmod",
294
+ "kind": 1,
295
+ "detail": "Return quotient and remainder",
296
+ "documentation": { "value": "Return a pair `(quotient, remainder)` of the division.\n\n```python\ndivmod(17, 5) # (3, 2)\nq, r = divmod(a, b)\n```" },
297
+ "insertText": "divmod(${1:a}, ${2:b})",
298
+ "insertTextRules": 4,
299
+ "sortText": "00_divmod"
300
+ },
301
+ {
302
+ "label": "int",
303
+ "kind": 5,
304
+ "detail": "Integer type / convert to integer",
305
+ "documentation": { "value": "Return an integer from a number or string.\n\n```python\nint('42') # 42\nint(3.9) # 3 (truncates)\nint('ff', 16) # 255\n```" },
306
+ "insertText": "int(${1:x})",
307
+ "insertTextRules": 4,
308
+ "sortText": "00_int"
309
+ },
310
+ {
311
+ "label": "float",
312
+ "kind": 5,
313
+ "detail": "Floating point type / convert to float",
314
+ "documentation": { "value": "Return a floating point number from a number or string.\n\n```python\nfloat('3.14') # 3.14\nfloat('inf') # inf\nfloat.fromhex('0x1.0p10') # 1024.0\n```" },
315
+ "insertText": "float(${1:x})",
316
+ "insertTextRules": 4,
317
+ "sortText": "00_float"
318
+ },
319
+ {
320
+ "label": "str",
321
+ "kind": 5,
322
+ "detail": "String type / convert to string",
323
+ "documentation": { "value": "Return a string version of the object.\n\n```python\nstr(42) # '42'\nstr(b'hi', 'utf-8') # 'hi'\n```" },
324
+ "insertText": "str(${1:object})",
325
+ "insertTextRules": 4,
326
+ "sortText": "00_str"
327
+ },
328
+ {
329
+ "label": "bool",
330
+ "kind": 5,
331
+ "detail": "Boolean type / convert to boolean",
332
+ "documentation": { "value": "Return a Boolean value. Falsy values: `None`, `False`, `0`, `''`, `[]`, `{}`, etc.\n\n```python\nbool(0) # False\nbool([1]) # True\nbool('') # False\n```" },
333
+ "insertText": "bool(${1:x})",
334
+ "insertTextRules": 4,
335
+ "sortText": "00_bool"
336
+ },
337
+ {
338
+ "label": "list",
339
+ "kind": 5,
340
+ "detail": "List type / convert to list",
341
+ "documentation": { "value": "Return a list. With no argument returns an empty list. With an iterable argument returns a list of its items.\n\n```python\nlist() # []\nlist(range(5)) # [0, 1, 2, 3, 4]\nlist('abc') # ['a', 'b', 'c']\n```" },
342
+ "insertText": "list(${1:iterable})",
343
+ "insertTextRules": 4,
344
+ "sortText": "00_list"
345
+ },
346
+ {
347
+ "label": "dict",
348
+ "kind": 5,
349
+ "detail": "Dictionary type / create a dict",
350
+ "documentation": { "value": "Create a new dictionary.\n\n```python\ndict() # {}\ndict(a=1, b=2) # {'a': 1, 'b': 2}\ndict(zip(keys, values))\ndict.fromkeys(['a', 'b'], 0) # {'a': 0, 'b': 0}\n```" },
351
+ "insertText": "dict(${1:})",
352
+ "insertTextRules": 4,
353
+ "sortText": "00_dict"
354
+ },
355
+ {
356
+ "label": "set",
357
+ "kind": 5,
358
+ "detail": "Set type / create a set",
359
+ "documentation": { "value": "Return a new set object. Supports union `|`, intersection `&`, difference `-`, symmetric difference `^`.\n\n```python\nset() # set()\nset([1, 2, 2, 3]) # {1, 2, 3}\n{1, 2} | {3} # {1, 2, 3}\n```" },
360
+ "insertText": "set(${1:iterable})",
361
+ "insertTextRules": 4,
362
+ "sortText": "00_set"
363
+ },
364
+ {
365
+ "label": "tuple",
366
+ "kind": 5,
367
+ "detail": "Tuple type / create a tuple",
368
+ "documentation": { "value": "Return an immutable sequence.\n\n```python\ntuple() # ()\ntuple([1, 2, 3]) # (1, 2, 3)\na, b = (1, 2) # unpacking\n```" },
369
+ "insertText": "tuple(${1:iterable})",
370
+ "insertTextRules": 4,
371
+ "sortText": "00_tuple"
372
+ },
373
+ {
374
+ "label": "frozenset",
375
+ "kind": 5,
376
+ "detail": "Immutable set type",
377
+ "documentation": { "value": "Return a new frozenset object — an immutable version of a set.\n\n```python\nfrozenset([1, 2, 3])\nfrozenset('abc') # frozenset({'a', 'b', 'c'})\n```" },
378
+ "insertText": "frozenset(${1:iterable})",
379
+ "insertTextRules": 4,
380
+ "sortText": "00_frozenset"
381
+ },
382
+ {
383
+ "label": "bytes",
384
+ "kind": 5,
385
+ "detail": "Immutable bytes sequence",
386
+ "documentation": { "value": "Return a new bytes object.\n\n```python\nbytes(5) # b'\\x00\\x00\\x00\\x00\\x00'\nbytes([72, 101, 108]) # b'Hel'\n'hello'.encode('utf-8') # b'hello'\n```" },
387
+ "insertText": "bytes(${1:source})",
388
+ "insertTextRules": 4,
389
+ "sortText": "00_bytes"
390
+ },
391
+ {
392
+ "label": "bytearray",
393
+ "kind": 5,
394
+ "detail": "Mutable bytes sequence",
395
+ "documentation": { "value": "Return a new array of bytes. Unlike `bytes`, `bytearray` is mutable.\n\n```python\nba = bytearray(b'hello')\nba[0] = 72\nba.extend(b' world')\n```" },
396
+ "insertText": "bytearray(${1:source})",
397
+ "insertTextRules": 4,
398
+ "sortText": "00_bytearray"
399
+ },
400
+ {
401
+ "label": "memoryview",
402
+ "kind": 5,
403
+ "detail": "Memory view object",
404
+ "documentation": { "value": "Create a memoryview that references a buffer without copying.\n\n```python\nmv = memoryview(b'hello')\nmv[1:3] # memory view of b'el'\nbytes(mv) # b'hello'\n```" },
405
+ "insertText": "memoryview(${1:obj})",
406
+ "insertTextRules": 4,
407
+ "sortText": "00_memoryview"
408
+ },
409
+ {
410
+ "label": "complex",
411
+ "kind": 5,
412
+ "detail": "Complex number type",
413
+ "documentation": { "value": "Return a complex number.\n\n```python\ncomplex(1, 2) # (1+2j)\ncomplex('1+2j') # (1+2j)\n(3+4j).conjugate() # (3-4j)\n```" },
414
+ "insertText": "complex(${1:real}, ${2:imag})",
415
+ "insertTextRules": 4,
416
+ "sortText": "00_complex"
417
+ },
418
+ {
419
+ "label": "hex",
420
+ "kind": 1,
421
+ "detail": "Convert integer to hexadecimal string",
422
+ "documentation": { "value": "Convert an integer to a lowercase hexadecimal string prefixed with `0x`.\n\n```python\nhex(255) # '0xff'\nhex(42) # '0x2a'\n```" },
423
+ "insertText": "hex(${1:x})",
424
+ "insertTextRules": 4,
425
+ "sortText": "00_hex"
426
+ },
427
+ {
428
+ "label": "oct",
429
+ "kind": 1,
430
+ "detail": "Convert integer to octal string",
431
+ "documentation": { "value": "Convert an integer to an octal string prefixed with `0o`.\n\n```python\noct(8) # '0o10'\noct(255) # '0o377'\n```" },
432
+ "insertText": "oct(${1:x})",
433
+ "insertTextRules": 4,
434
+ "sortText": "00_oct"
435
+ },
436
+ {
437
+ "label": "bin",
438
+ "kind": 1,
439
+ "detail": "Convert integer to binary string",
440
+ "documentation": { "value": "Convert an integer to a binary string prefixed with `0b`.\n\n```python\nbin(10) # '0b1010'\nbin(255) # '0b11111111'\n```" },
441
+ "insertText": "bin(${1:x})",
442
+ "insertTextRules": 4,
443
+ "sortText": "00_bin"
444
+ },
445
+ {
446
+ "label": "ord",
447
+ "kind": 1,
448
+ "detail": "Return Unicode code point for a character",
449
+ "documentation": { "value": "Return the Unicode code point for a one-character string.\n\n```python\nord('A') # 65\nord('€') # 8364\n```" },
450
+ "insertText": "ord(${1:c})",
451
+ "insertTextRules": 4,
452
+ "sortText": "00_ord"
453
+ },
454
+ {
455
+ "label": "chr",
456
+ "kind": 1,
457
+ "detail": "Return character from Unicode code point",
458
+ "documentation": { "value": "Return the string of one character whose Unicode code point is the integer.\n\n```python\nchr(65) # 'A'\nchr(8364) # '€'\n```" },
459
+ "insertText": "chr(${1:i})",
460
+ "insertTextRules": 4,
461
+ "sortText": "00_chr"
462
+ },
463
+ {
464
+ "label": "repr",
465
+ "kind": 1,
466
+ "detail": "Return printable representation of an object",
467
+ "documentation": { "value": "Return a string containing a printable representation of an object.\n\n```python\nrepr('hello') # \"'hello'\"\nrepr([1, 2]) # '[1, 2]'\n```" },
468
+ "insertText": "repr(${1:object})",
469
+ "insertTextRules": 4,
470
+ "sortText": "00_repr"
471
+ },
472
+ {
473
+ "label": "format",
474
+ "kind": 1,
475
+ "detail": "Format a value using a format spec",
476
+ "documentation": { "value": "Convert a value to a formatted representation controlled by *format_spec*.\n\n```python\nformat(3.14159, '.2f') # '3.14'\nformat(42, '08b') # '00101010'\nformat(1000000, ',') # '1,000,000'\n```" },
477
+ "insertText": "format(${1:value}, ${2:format_spec})",
478
+ "insertTextRules": 4,
479
+ "sortText": "00_format"
480
+ },
481
+ {
482
+ "label": "input",
483
+ "kind": 1,
484
+ "detail": "Read a line from input",
485
+ "documentation": { "value": "Read a line from input, optionally printing a prompt.\n\n```python\nname = input('Enter your name: ')\nage = int(input('Enter your age: '))\n```" },
486
+ "insertText": "input(${1:'prompt'})",
487
+ "insertTextRules": 4,
488
+ "sortText": "00_input"
489
+ },
490
+ {
491
+ "label": "open",
492
+ "kind": 1,
493
+ "detail": "Open a file and return a file object",
494
+ "documentation": { "value": "Open file and return a corresponding file object.\n\n```python\nwith open('file.txt') as f:\n content = f.read()\n\nwith open('out.txt', 'w', encoding='utf-8') as f:\n f.write('hello')\n\nwith open('data.bin', 'rb') as f:\n data = f.read()\n```" },
495
+ "insertText": "open(${1:'filename'}, ${2:'r'}, encoding=${3:'utf-8'})",
496
+ "insertTextRules": 4,
497
+ "sortText": "00_open"
498
+ },
499
+ {
500
+ "label": "iter",
501
+ "kind": 1,
502
+ "detail": "Return an iterator object",
503
+ "documentation": { "value": "Return an iterator object. With two arguments, call `callable` until `sentinel` is returned.\n\n```python\nit = iter([1, 2, 3])\nnext(it) # 1\n\n# sentinel form\nfor chunk in iter(lambda: f.read(8192), b''):\n process(chunk)\n```" },
504
+ "insertText": "iter(${1:object})",
505
+ "insertTextRules": 4,
506
+ "sortText": "00_iter"
507
+ },
508
+ {
509
+ "label": "next",
510
+ "kind": 1,
511
+ "detail": "Retrieve the next item from an iterator",
512
+ "documentation": { "value": "Retrieve the next item from the iterator by calling its `__next__()` method.\n\n```python\nit = iter([1, 2, 3])\nnext(it) # 1\nnext(it, 'default') # with default value\n```" },
513
+ "insertText": "next(${1:iterator})",
514
+ "insertTextRules": 4,
515
+ "sortText": "00_next"
516
+ },
517
+ {
518
+ "label": "callable",
519
+ "kind": 1,
520
+ "detail": "Check if an object is callable",
521
+ "documentation": { "value": "Return `True` if the object appears callable.\n\n```python\ncallable(print) # True\ncallable(42) # False\ncallable(lambda: 0) # True\n```" },
522
+ "insertText": "callable(${1:object})",
523
+ "insertTextRules": 4,
524
+ "sortText": "00_callable"
525
+ },
526
+ {
527
+ "label": "eval",
528
+ "kind": 1,
529
+ "detail": "Evaluate a Python expression",
530
+ "documentation": { "value": "Evaluate a Python expression string and return the result.\n\n```python\neval('2 + 3') # 5\neval('len(x)', {'x': [1, 2]})\n```\n\n⚠️ Avoid with untrusted input." },
531
+ "insertText": "eval(${1:expression})",
532
+ "insertTextRules": 4,
533
+ "sortText": "00_eval"
534
+ },
535
+ {
536
+ "label": "exec",
537
+ "kind": 1,
538
+ "detail": "Execute Python code dynamically",
539
+ "documentation": { "value": "Execute dynamically created Python code.\n\n```python\nexec('x = 10')\nexec(open('script.py').read())\n```\n\n⚠️ Avoid with untrusted input." },
540
+ "insertText": "exec(${1:code})",
541
+ "insertTextRules": 4,
542
+ "sortText": "00_exec"
543
+ },
544
+ {
545
+ "label": "compile",
546
+ "kind": 1,
547
+ "detail": "Compile source into a code object",
548
+ "documentation": { "value": "Compile the source into a code or AST object.\n\n```python\ncode = compile('x + 1', '<string>', 'eval')\nresult = eval(code, {'x': 5}) # 6\n```" },
549
+ "insertText": "compile(${1:source}, ${2:filename}, ${3:mode})",
550
+ "insertTextRules": 4,
551
+ "sortText": "00_compile"
552
+ },
553
+ {
554
+ "label": "globals",
555
+ "kind": 1,
556
+ "detail": "Return dictionary of global symbol table",
557
+ "documentation": { "value": "Return the dictionary implementing the current module namespace.\n\n```python\nglobals()['my_var'] = 42\n```" },
558
+ "insertText": "globals()",
559
+ "insertTextRules": 4,
560
+ "sortText": "00_globals"
561
+ },
562
+ {
563
+ "label": "locals",
564
+ "kind": 1,
565
+ "detail": "Return dictionary of local symbol table",
566
+ "documentation": { "value": "Return a mapping of the current local symbol table.\n\n```python\ndef f():\n x = 10\n print(locals()) # {'x': 10}\n```" },
567
+ "insertText": "locals()",
568
+ "insertTextRules": 4,
569
+ "sortText": "00_locals"
570
+ },
571
+ {
572
+ "label": "breakpoint",
573
+ "kind": 1,
574
+ "detail": "Drop into the debugger",
575
+ "documentation": { "value": "Call `sys.breakpointhook()`, dropping into the debugger (pdb by default).\n\n```python\ndef buggy():\n x = compute()\n breakpoint() # opens pdb here\n return x\n```" },
576
+ "insertText": "breakpoint()",
577
+ "insertTextRules": 4,
578
+ "sortText": "00_breakpoint"
579
+ },
580
+ {
581
+ "label": ".format",
582
+ "kind": 0,
583
+ "detail": "str.format — Format string with positional/keyword args",
584
+ "documentation": { "value": "Perform a string formatting operation.\n\n```python\n'{} is {}'.format('Python', 'great')\n'{name} is {age}'.format(name='Alice', age=30)\n'{0:.2f}'.format(3.14159) # '3.14'\n```" },
585
+ "insertText": ".format(${1:args})",
586
+ "insertTextRules": 4,
587
+ "sortText": "01_str_format"
588
+ },
589
+ {
590
+ "label": ".join",
591
+ "kind": 0,
592
+ "detail": "str.join — Concatenate strings from an iterable",
593
+ "documentation": { "value": "Return a string which is the concatenation of the strings in *iterable*, separated by the string providing this method.\n\n```python\n', '.join(['a', 'b', 'c']) # 'a, b, c'\n'\\n'.join(lines)\n```" },
594
+ "insertText": ".join(${1:iterable})",
595
+ "insertTextRules": 4,
596
+ "sortText": "01_str_join"
597
+ },
598
+ {
599
+ "label": ".split",
600
+ "kind": 0,
601
+ "detail": "str.split — Split string into a list",
602
+ "documentation": { "value": "Return a list of the words in the string, using *sep* as the delimiter.\n\n```python\n'a,b,c'.split(',') # ['a', 'b', 'c']\n'hello world'.split() # ['hello', 'world']\n'a::b::c'.split('::', 1) # ['a', 'b::c']\n```" },
603
+ "insertText": ".split(${1:sep})",
604
+ "insertTextRules": 4,
605
+ "sortText": "01_str_split"
606
+ },
607
+ {
608
+ "label": ".strip",
609
+ "kind": 0,
610
+ "detail": "str.strip — Remove leading/trailing characters",
611
+ "documentation": { "value": "Return a copy with leading and trailing characters removed.\n\n```python\n' hello '.strip() # 'hello'\n'xxhelloxx'.strip('x') # 'hello'\n```" },
612
+ "insertText": ".strip(${1:chars})",
613
+ "insertTextRules": 4,
614
+ "sortText": "01_str_strip"
615
+ },
616
+ {
617
+ "label": ".replace",
618
+ "kind": 0,
619
+ "detail": "str.replace — Replace occurrences of a substring",
620
+ "documentation": { "value": "Return a copy with all occurrences of *old* replaced by *new*.\n\n```python\n'hello world'.replace('world', 'Python') # 'hello Python'\n'aaa'.replace('a', 'b', 2) # 'bba'\n```" },
621
+ "insertText": ".replace(${1:old}, ${2:new})",
622
+ "insertTextRules": 4,
623
+ "sortText": "01_str_replace"
624
+ },
625
+ {
626
+ "label": ".startswith",
627
+ "kind": 0,
628
+ "detail": "str.startswith — Test string prefix",
629
+ "documentation": { "value": "Return `True` if the string starts with the prefix.\n\n```python\n'hello'.startswith('hel') # True\n'hello'.startswith(('he', 'Hi')) # True (tuple of prefixes)\n```" },
630
+ "insertText": ".startswith(${1:prefix})",
631
+ "insertTextRules": 4,
632
+ "sortText": "01_str_startswith"
633
+ },
634
+ {
635
+ "label": ".endswith",
636
+ "kind": 0,
637
+ "detail": "str.endswith — Test string suffix",
638
+ "documentation": { "value": "Return `True` if the string ends with the suffix.\n\n```python\n'hello.py'.endswith('.py') # True\n'file.tar.gz'.endswith(('.gz', '.bz2')) # True\n```" },
639
+ "insertText": ".endswith(${1:suffix})",
640
+ "insertTextRules": 4,
641
+ "sortText": "01_str_endswith"
642
+ },
643
+ {
644
+ "label": ".find",
645
+ "kind": 0,
646
+ "detail": "str.find — Find the lowest index of a substring",
647
+ "documentation": { "value": "Return the lowest index where substring is found, or -1 if not found.\n\n```python\n'hello world'.find('world') # 6\n'hello'.find('xyz') # -1\n```" },
648
+ "insertText": ".find(${1:sub})",
649
+ "insertTextRules": 4,
650
+ "sortText": "01_str_find"
651
+ },
652
+ {
653
+ "label": ".upper",
654
+ "kind": 0,
655
+ "detail": "str.upper — Return uppercased string",
656
+ "documentation": { "value": "Return a copy of the string with all cased characters converted to uppercase.\n\n```python\n'hello'.upper() # 'HELLO'\n```" },
657
+ "insertText": ".upper()",
658
+ "insertTextRules": 4,
659
+ "sortText": "01_str_upper"
660
+ },
661
+ {
662
+ "label": ".lower",
663
+ "kind": 0,
664
+ "detail": "str.lower — Return lowercased string",
665
+ "documentation": { "value": "Return a copy of the string with all cased characters converted to lowercase.\n\n```python\n'HELLO'.lower() # 'hello'\n```" },
666
+ "insertText": ".lower()",
667
+ "insertTextRules": 4,
668
+ "sortText": "01_str_lower"
669
+ },
670
+ {
671
+ "label": ".title",
672
+ "kind": 0,
673
+ "detail": "str.title — Return titlecased string",
674
+ "documentation": { "value": "Return a titlecased version: words start with uppercase, remaining lowercase.\n\n```python\n'hello world'.title() # 'Hello World'\n```" },
675
+ "insertText": ".title()",
676
+ "insertTextRules": 4,
677
+ "sortText": "01_str_title"
678
+ },
679
+ {
680
+ "label": ".encode",
681
+ "kind": 0,
682
+ "detail": "str.encode — Encode string to bytes",
683
+ "documentation": { "value": "Return the string encoded to bytes.\n\n```python\n'hello'.encode('utf-8') # b'hello'\n'€'.encode('utf-8') # b'\\xe2\\x82\\xac'\n```" },
684
+ "insertText": ".encode(${1:'utf-8'})",
685
+ "insertTextRules": 4,
686
+ "sortText": "01_str_encode"
687
+ },
688
+ {
689
+ "label": ".decode",
690
+ "kind": 0,
691
+ "detail": "bytes.decode — Decode bytes to string",
692
+ "documentation": { "value": "Decode the bytes to a string.\n\n```python\nb'hello'.decode('utf-8') # 'hello'\nb'\\xc3\\xa9'.decode() # 'é'\n```" },
693
+ "insertText": ".decode(${1:'utf-8'})",
694
+ "insertTextRules": 4,
695
+ "sortText": "01_bytes_decode"
696
+ },
697
+ {
698
+ "label": "f-string",
699
+ "kind": 15,
700
+ "detail": "Formatted string literal (f-string)",
701
+ "documentation": { "value": "Create a formatted string literal using `f'...'` syntax.\n\n```python\nname = 'World'\nf'Hello, {name}!'\nf'{value:.2f}'\nf'{items!r}'\nf'{x + 1 = }' # 3.8+ debug format\n```" },
702
+ "insertText": "f'${1:text {${2:expr}}}$0'",
703
+ "insertTextRules": 4,
704
+ "sortText": "01_fstring"
705
+ },
706
+ {
707
+ "label": ".append",
708
+ "kind": 0,
709
+ "detail": "list.append — Add item to end of list",
710
+ "documentation": { "value": "Append object to the end of the list.\n\n```python\nitems = [1, 2]\nitems.append(3) # [1, 2, 3]\n```" },
711
+ "insertText": ".append(${1:item})",
712
+ "insertTextRules": 4,
713
+ "sortText": "01_list_append"
714
+ },
715
+ {
716
+ "label": ".extend",
717
+ "kind": 0,
718
+ "detail": "list.extend — Extend list with items from iterable",
719
+ "documentation": { "value": "Extend list by appending elements from the iterable.\n\n```python\na = [1, 2]\na.extend([3, 4]) # [1, 2, 3, 4]\n```" },
720
+ "insertText": ".extend(${1:iterable})",
721
+ "insertTextRules": 4,
722
+ "sortText": "01_list_extend"
723
+ },
724
+ {
725
+ "label": ".pop",
726
+ "kind": 0,
727
+ "detail": "list.pop — Remove and return item at index",
728
+ "documentation": { "value": "Remove and return item at index (default last).\n\n```python\nitems = [1, 2, 3]\nitems.pop() # 3, items = [1, 2]\nitems.pop(0) # 1, items = [2]\n```" },
729
+ "insertText": ".pop(${1:index})",
730
+ "insertTextRules": 4,
731
+ "sortText": "01_list_pop"
732
+ },
733
+ {
734
+ "label": ".insert",
735
+ "kind": 0,
736
+ "detail": "list.insert — Insert item at index",
737
+ "documentation": { "value": "Insert object before index.\n\n```python\nitems = [1, 3]\nitems.insert(1, 2) # [1, 2, 3]\n```" },
738
+ "insertText": ".insert(${1:index}, ${2:item})",
739
+ "insertTextRules": 4,
740
+ "sortText": "01_list_insert"
741
+ },
742
+ {
743
+ "label": ".remove",
744
+ "kind": 0,
745
+ "detail": "list.remove — Remove first occurrence of value",
746
+ "documentation": { "value": "Remove first occurrence of value. Raises `ValueError` if not found.\n\n```python\nitems = [1, 2, 3, 2]\nitems.remove(2) # [1, 3, 2]\n```" },
747
+ "insertText": ".remove(${1:value})",
748
+ "insertTextRules": 4,
749
+ "sortText": "01_list_remove"
750
+ },
751
+ {
752
+ "label": ".sort",
753
+ "kind": 0,
754
+ "detail": "list.sort — Sort list in place",
755
+ "documentation": { "value": "Sort the list in place.\n\n```python\nitems = [3, 1, 2]\nitems.sort() # [1, 2, 3]\nitems.sort(reverse=True) # [3, 2, 1]\nitems.sort(key=len)\n```" },
756
+ "insertText": ".sort(${1:key=${2:None}, reverse=${3:False}})",
757
+ "insertTextRules": 4,
758
+ "sortText": "01_list_sort"
759
+ },
760
+ {
761
+ "label": ".reverse",
762
+ "kind": 0,
763
+ "detail": "list.reverse — Reverse list in place",
764
+ "documentation": { "value": "Reverse the elements of the list in place.\n\n```python\nitems = [1, 2, 3]\nitems.reverse() # [3, 2, 1]\n```" },
765
+ "insertText": ".reverse()",
766
+ "insertTextRules": 4,
767
+ "sortText": "01_list_reverse"
768
+ },
769
+ {
770
+ "label": ".copy",
771
+ "kind": 0,
772
+ "detail": "list.copy / dict.copy — Return a shallow copy",
773
+ "documentation": { "value": "Return a shallow copy of the list or dict.\n\n```python\noriginal = [1, 2, 3]\nclone = original.copy()\n\nd = {'a': 1}\nd2 = d.copy()\n```" },
774
+ "insertText": ".copy()",
775
+ "insertTextRules": 4,
776
+ "sortText": "01_copy"
777
+ },
778
+ {
779
+ "label": ".update",
780
+ "kind": 0,
781
+ "detail": "dict.update / set.update — Update with items",
782
+ "documentation": { "value": "For dict: update with key/value pairs. For set: update with elements.\n\n```python\nd = {'a': 1}\nd.update({'b': 2, 'c': 3})\nd.update(x=10)\n\ns = {1, 2}\ns.update([3, 4])\n```" },
783
+ "insertText": ".update(${1:other})",
784
+ "insertTextRules": 4,
785
+ "sortText": "01_update"
786
+ },
787
+ {
788
+ "label": ".get",
789
+ "kind": 0,
790
+ "detail": "dict.get — Get item with default",
791
+ "documentation": { "value": "Return the value for key if key is in the dictionary, else default.\n\n```python\nd = {'a': 1, 'b': 2}\nd.get('a') # 1\nd.get('z', 'N/A') # 'N/A'\n```" },
792
+ "insertText": ".get(${1:key}, ${2:default})",
793
+ "insertTextRules": 4,
794
+ "sortText": "01_dict_get"
795
+ },
796
+ {
797
+ "label": ".items",
798
+ "kind": 0,
799
+ "detail": "dict.items — Return view of (key, value) pairs",
800
+ "documentation": { "value": "Return a view object that displays dict's (key, value) tuple pairs.\n\n```python\nfor key, value in d.items():\n print(key, value)\n```" },
801
+ "insertText": ".items()",
802
+ "insertTextRules": 4,
803
+ "sortText": "01_dict_items"
804
+ },
805
+ {
806
+ "label": ".keys",
807
+ "kind": 0,
808
+ "detail": "dict.keys — Return view of dictionary keys",
809
+ "documentation": { "value": "Return a view object of the dictionary's keys.\n\n```python\nfor key in d.keys():\n print(key)\n\nif 'name' in d.keys():\n ...\n```" },
810
+ "insertText": ".keys()",
811
+ "insertTextRules": 4,
812
+ "sortText": "01_dict_keys"
813
+ },
814
+ {
815
+ "label": ".values",
816
+ "kind": 0,
817
+ "detail": "dict.values — Return view of dictionary values",
818
+ "documentation": { "value": "Return a view object of the dictionary's values.\n\n```python\nfor val in d.values():\n print(val)\n\ntotal = sum(d.values())\n```" },
819
+ "insertText": ".values()",
820
+ "insertTextRules": 4,
821
+ "sortText": "01_dict_values"
822
+ },
823
+ {
824
+ "label": ".add",
825
+ "kind": 0,
826
+ "detail": "set.add — Add an element to the set",
827
+ "documentation": { "value": "Add an element to the set.\n\n```python\ns = {1, 2}\ns.add(3) # {1, 2, 3}\ns.add(2) # {1, 2, 3} (no duplicate)\n```" },
828
+ "insertText": ".add(${1:elem})",
829
+ "insertTextRules": 4,
830
+ "sortText": "01_set_add"
831
+ },
832
+ {
833
+ "label": ".discard",
834
+ "kind": 0,
835
+ "detail": "set.discard — Remove element if present",
836
+ "documentation": { "value": "Remove an element from the set if it is present. Does NOT raise an error if absent.\n\n```python\ns = {1, 2, 3}\ns.discard(2) # {1, 3}\ns.discard(99) # no error\n```" },
837
+ "insertText": ".discard(${1:elem})",
838
+ "insertTextRules": 4,
839
+ "sortText": "01_set_discard"
840
+ },
841
+ {
842
+ "label": "if",
843
+ "kind": 15,
844
+ "detail": "if / elif / else statement",
845
+ "documentation": { "value": "Conditional branching.\n\n```python\nif condition:\n ...\nelif other:\n ...\nelse:\n ...\n```" },
846
+ "insertText": "if ${1:condition}:\n ${2:pass}\nelif ${3:condition}:\n ${4:pass}\nelse:\n ${0:pass}",
847
+ "insertTextRules": 4,
848
+ "sortText": "02_if"
849
+ },
850
+ {
851
+ "label": "if (simple)",
852
+ "kind": 15,
853
+ "detail": "Simple if statement",
854
+ "documentation": { "value": "```python\nif condition:\n do_something()\n```" },
855
+ "insertText": "if ${1:condition}:\n ${0:pass}",
856
+ "insertTextRules": 4,
857
+ "sortText": "02_if_simple"
858
+ },
859
+ {
860
+ "label": "for",
861
+ "kind": 15,
862
+ "detail": "for loop",
863
+ "documentation": { "value": "Iterate over an iterable.\n\n```python\nfor item in iterable:\n print(item)\n\nfor i, val in enumerate(items):\n print(i, val)\n```" },
864
+ "insertText": "for ${1:item} in ${2:iterable}:\n ${0:pass}",
865
+ "insertTextRules": 4,
866
+ "sortText": "02_for"
867
+ },
868
+ {
869
+ "label": "for enumerate",
870
+ "kind": 15,
871
+ "detail": "for loop with enumerate",
872
+ "documentation": { "value": "```python\nfor i, item in enumerate(items):\n print(i, item)\n```" },
873
+ "insertText": "for ${1:i}, ${2:item} in enumerate(${3:iterable}):\n ${0:pass}",
874
+ "insertTextRules": 4,
875
+ "sortText": "02_for_enum"
876
+ },
877
+ {
878
+ "label": "while",
879
+ "kind": 15,
880
+ "detail": "while loop",
881
+ "documentation": { "value": "```python\nwhile condition:\n do_something()\n```" },
882
+ "insertText": "while ${1:condition}:\n ${0:pass}",
883
+ "insertTextRules": 4,
884
+ "sortText": "02_while"
885
+ },
886
+ {
887
+ "label": "try/except",
888
+ "kind": 15,
889
+ "detail": "try / except / finally block",
890
+ "documentation": { "value": "Exception handling.\n\n```python\ntry:\n risky()\nexcept ValueError as e:\n handle(e)\nexcept (TypeError, KeyError):\n ...\nfinally:\n cleanup()\n```" },
891
+ "insertText": "try:\n ${1:pass}\nexcept ${2:Exception} as ${3:e}:\n ${4:raise}\nfinally:\n ${0:pass}",
892
+ "insertTextRules": 4,
893
+ "sortText": "02_try"
894
+ },
895
+ {
896
+ "label": "try/except (simple)",
897
+ "kind": 15,
898
+ "detail": "Simple try / except block",
899
+ "documentation": { "value": "```python\ntry:\n ...\nexcept Exception as e:\n ...\n```" },
900
+ "insertText": "try:\n ${1:pass}\nexcept ${2:Exception} as ${3:e}:\n ${0:raise}",
901
+ "insertTextRules": 4,
902
+ "sortText": "02_try_simple"
903
+ },
904
+ {
905
+ "label": "with",
906
+ "kind": 15,
907
+ "detail": "with (context manager) statement",
908
+ "documentation": { "value": "Context manager — ensures cleanup.\n\n```python\nwith open('file.txt') as f:\n data = f.read()\n\nwith lock:\n shared_resource.update()\n```" },
909
+ "insertText": "with ${1:expression} as ${2:var}:\n ${0:pass}",
910
+ "insertTextRules": 4,
911
+ "sortText": "02_with"
912
+ },
913
+ {
914
+ "label": "class",
915
+ "kind": 15,
916
+ "detail": "Class definition",
917
+ "documentation": { "value": "Define a class.\n\n```python\nclass MyClass:\n def __init__(self, name: str) -> None:\n self.name = name\n\n def greet(self) -> str:\n return f'Hello, {self.name}'\n```" },
918
+ "insertText": "class ${1:ClassName}${2:(${3:BaseClass})}:\n def __init__(self${4:, args}) -> None:\n ${0:pass}",
919
+ "insertTextRules": 4,
920
+ "sortText": "02_class"
921
+ },
922
+ {
923
+ "label": "def",
924
+ "kind": 15,
925
+ "detail": "Function definition",
926
+ "documentation": { "value": "Define a function.\n\n```python\ndef greet(name: str) -> str:\n \"\"\"Return a greeting.\"\"\"\n return f'Hello, {name}'\n```" },
927
+ "insertText": "def ${1:function_name}(${2:params}) -> ${3:None}:\n ${0:pass}",
928
+ "insertTextRules": 4,
929
+ "sortText": "02_def"
930
+ },
931
+ {
932
+ "label": "async def",
933
+ "kind": 15,
934
+ "detail": "Async function definition",
935
+ "documentation": { "value": "Define an asynchronous coroutine.\n\n```python\nasync def fetch(url: str) -> bytes:\n async with aiohttp.ClientSession() as session:\n async with session.get(url) as resp:\n return await resp.read()\n```" },
936
+ "insertText": "async def ${1:function_name}(${2:params}) -> ${3:None}:\n ${0:pass}",
937
+ "insertTextRules": 4,
938
+ "sortText": "02_async_def"
939
+ },
940
+ {
941
+ "label": "list comprehension",
942
+ "kind": 15,
943
+ "detail": "List comprehension",
944
+ "documentation": { "value": "Create a list from an expression applied to each item.\n\n```python\nsquares = [x ** 2 for x in range(10)]\nevens = [x for x in range(20) if x % 2 == 0]\npairs = [(x, y) for x in a for y in b]\n```" },
945
+ "insertText": "[${1:expr} for ${2:item} in ${3:iterable}${4: if ${5:condition}}]",
946
+ "insertTextRules": 4,
947
+ "sortText": "02_listcomp"
948
+ },
949
+ {
950
+ "label": "dict comprehension",
951
+ "kind": 15,
952
+ "detail": "Dictionary comprehension",
953
+ "documentation": { "value": "Create a dict from key-value expressions.\n\n```python\n{k: v for k, v in pairs}\n{x: x**2 for x in range(5)}\n{k: v for k, v in d.items() if v > 0}\n```" },
954
+ "insertText": "{${1:key}: ${2:value} for ${3:item} in ${4:iterable}}",
955
+ "insertTextRules": 4,
956
+ "sortText": "02_dictcomp"
957
+ },
958
+ {
959
+ "label": "set comprehension",
960
+ "kind": 15,
961
+ "detail": "Set comprehension",
962
+ "documentation": { "value": "Create a set from an expression.\n\n```python\n{x % 3 for x in range(10)} # {0, 1, 2}\n```" },
963
+ "insertText": "{${1:expr} for ${2:item} in ${3:iterable}}",
964
+ "insertTextRules": 4,
965
+ "sortText": "02_setcomp"
966
+ },
967
+ {
968
+ "label": "lambda",
969
+ "kind": 15,
970
+ "detail": "Lambda (anonymous function)",
971
+ "documentation": { "value": "Create a small anonymous function.\n\n```python\nsquare = lambda x: x ** 2\nsorted(data, key=lambda item: item['name'])\n```" },
972
+ "insertText": "lambda ${1:params}: ${0:expression}",
973
+ "insertTextRules": 4,
974
+ "sortText": "02_lambda"
975
+ },
976
+ {
977
+ "label": "decorator",
978
+ "kind": 15,
979
+ "detail": "Decorator function definition",
980
+ "documentation": { "value": "Define a decorator that wraps a function.\n\n```python\nimport functools\n\ndef my_decorator(func):\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n # before\n result = func(*args, **kwargs)\n # after\n return result\n return wrapper\n```" },
981
+ "insertText": "import functools\n\ndef ${1:decorator}(func):\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n ${2:# before}\n result = func(*args, **kwargs)\n ${3:# after}\n return result\n return wrapper",
982
+ "insertTextRules": 4,
983
+ "sortText": "02_decorator"
984
+ },
985
+ {
986
+ "label": "@dataclass",
987
+ "kind": 15,
988
+ "detail": "Dataclass definition",
989
+ "documentation": { "value": "Generate special methods automatically (3.7+).\n\n```python\nfrom dataclasses import dataclass, field\n\n@dataclass\nclass Point:\n x: float\n y: float\n label: str = 'origin'\n tags: list[str] = field(default_factory=list)\n```" },
990
+ "insertText": "from dataclasses import dataclass\n\n@dataclass\nclass ${1:ClassName}:\n ${2:name}: ${3:str}\n ${0:}",
991
+ "insertTextRules": 4,
992
+ "sortText": "02_dataclass"
993
+ },
994
+ {
995
+ "label": "match/case",
996
+ "kind": 15,
997
+ "detail": "Structural pattern matching (3.10+)",
998
+ "documentation": { "value": "Pattern matching with `match`/`case` (Python 3.10+).\n\n```python\nmatch command:\n case 'quit':\n quit()\n case 'go' | 'move':\n move()\n case ['go', direction]:\n go(direction)\n case {'action': action, **rest}:\n do(action, rest)\n case _:\n unknown()\n```" },
999
+ "insertText": "match ${1:subject}:\n case ${2:pattern}:\n ${3:pass}\n case _:\n ${0:pass}",
1000
+ "insertTextRules": 4,
1001
+ "sortText": "02_match"
1002
+ },
1003
+ {
1004
+ "label": "type alias (3.12+)",
1005
+ "kind": 15,
1006
+ "detail": "Type alias statement (3.12+)",
1007
+ "documentation": { "value": "Explicit type alias using the `type` statement (Python 3.12+).\n\n```python\ntype Vector = list[float]\ntype Matrix[T] = list[list[T]]\n```" },
1008
+ "insertText": "type ${1:Name} = ${0:type}",
1009
+ "insertTextRules": 4,
1010
+ "sortText": "02_type_alias"
1011
+ },
1012
+ {
1013
+ "label": "type hints (variable)",
1014
+ "kind": 15,
1015
+ "detail": "Variable annotation with type hint",
1016
+ "documentation": { "value": "```python\nname: str = 'Alice'\ncount: int = 0\nitems: list[str] = []\ndata: dict[str, Any] = {}\n```" },
1017
+ "insertText": "${1:name}: ${2:type} = ${0:value}",
1018
+ "insertTextRules": 4,
1019
+ "sortText": "02_type_var"
1020
+ },
1021
+ {
1022
+ "label": "from typing import",
1023
+ "kind": 15,
1024
+ "detail": "Import from typing module",
1025
+ "documentation": { "value": "Import commonly used typing constructs.\n\n```python\nfrom typing import Optional, Union, Any, TypeVar\nfrom typing import Protocol, TypeAlias, Self\nfrom typing import Final, Literal, TypeGuard\n```" },
1026
+ "insertText": "from typing import ${0:Any}",
1027
+ "insertTextRules": 4,
1028
+ "sortText": "03_import_typing"
1029
+ },
1030
+ {
1031
+ "label": "import json",
1032
+ "kind": 9,
1033
+ "detail": "Import json module",
1034
+ "documentation": { "value": "JSON encoder and decoder.\n\n```python\nimport json\n\ndata = json.loads('{\"key\": \"value\"}')\ntext = json.dumps(data, indent=2)\n\nwith open('data.json') as f:\n data = json.load(f)\n```" },
1035
+ "insertText": "import json",
1036
+ "insertTextRules": 1,
1037
+ "sortText": "03_import_json"
1038
+ },
1039
+ {
1040
+ "label": "import os",
1041
+ "kind": 9,
1042
+ "detail": "Import os module",
1043
+ "documentation": { "value": "Miscellaneous operating system interfaces.\n\n```python\nimport os\n\nos.path.join('dir', 'file.txt')\nos.environ.get('HOME')\nos.listdir('.')\nos.makedirs('path/to/dir', exist_ok=True)\n```" },
1044
+ "insertText": "import os",
1045
+ "insertTextRules": 1,
1046
+ "sortText": "03_import_os"
1047
+ },
1048
+ {
1049
+ "label": "import sys",
1050
+ "kind": 9,
1051
+ "detail": "Import sys module",
1052
+ "documentation": { "value": "System-specific parameters and functions.\n\n```python\nimport sys\n\nsys.argv # command-line arguments\nsys.path # module search path\nsys.exit(0) # exit the program\nsys.version_info # Python version\n```" },
1053
+ "insertText": "import sys",
1054
+ "insertTextRules": 1,
1055
+ "sortText": "03_import_sys"
1056
+ },
1057
+ {
1058
+ "label": "from pathlib import Path",
1059
+ "kind": 9,
1060
+ "detail": "Import pathlib.Path",
1061
+ "documentation": { "value": "Object-oriented filesystem paths.\n\n```python\nfrom pathlib import Path\n\np = Path('data') / 'file.txt'\np.read_text(encoding='utf-8')\np.exists()\np.mkdir(parents=True, exist_ok=True)\nlist(Path('.').glob('**/*.py'))\n```" },
1062
+ "insertText": "from pathlib import Path",
1063
+ "insertTextRules": 1,
1064
+ "sortText": "03_import_pathlib"
1065
+ },
1066
+ {
1067
+ "label": "import asyncio",
1068
+ "kind": 9,
1069
+ "detail": "Import asyncio module",
1070
+ "documentation": { "value": "Asynchronous I/O framework.\n\n```python\nimport asyncio\n\nasync def main():\n await asyncio.sleep(1)\n tasks = [asyncio.create_task(coro()) for coro in coros]\n results = await asyncio.gather(*tasks)\n\nasyncio.run(main())\n```" },
1071
+ "insertText": "import asyncio",
1072
+ "insertTextRules": 1,
1073
+ "sortText": "03_import_asyncio"
1074
+ },
1075
+ {
1076
+ "label": "from dataclasses import dataclass",
1077
+ "kind": 9,
1078
+ "detail": "Import dataclass decorator",
1079
+ "documentation": { "value": "```python\nfrom dataclasses import dataclass, field\n```" },
1080
+ "insertText": "from dataclasses import dataclass",
1081
+ "insertTextRules": 1,
1082
+ "sortText": "03_import_dataclasses"
1083
+ },
1084
+ {
1085
+ "label": "import collections",
1086
+ "kind": 9,
1087
+ "detail": "Import collections module",
1088
+ "documentation": { "value": "High-performance container datatypes.\n\n```python\nimport collections\n\ncollections.Counter('abracadabra')\ncollections.defaultdict(list)\ncollections.OrderedDict()\ncollections.deque([1, 2, 3])\ncollections.namedtuple('Point', ['x', 'y'])\n```" },
1089
+ "insertText": "import collections",
1090
+ "insertTextRules": 1,
1091
+ "sortText": "03_import_collections"
1092
+ },
1093
+ {
1094
+ "label": "import itertools",
1095
+ "kind": 9,
1096
+ "detail": "Import itertools module",
1097
+ "documentation": { "value": "Functions creating iterators for efficient looping.\n\n```python\nimport itertools\n\nitertools.chain([1, 2], [3, 4])\nitertools.product('AB', '12')\nitertools.combinations([1, 2, 3], 2)\nitertools.islice(range(100), 5)\n```" },
1098
+ "insertText": "import itertools",
1099
+ "insertTextRules": 1,
1100
+ "sortText": "03_import_itertools"
1101
+ },
1102
+ {
1103
+ "label": "import functools",
1104
+ "kind": 9,
1105
+ "detail": "Import functools module",
1106
+ "documentation": { "value": "Higher-order functions and operations on callable objects.\n\n```python\nimport functools\n\n@functools.lru_cache(maxsize=128)\ndef fib(n): ...\n\nfunctools.reduce(lambda a, b: a + b, [1, 2, 3])\nfunctools.partial(func, arg1)\n```" },
1107
+ "insertText": "import functools",
1108
+ "insertTextRules": 1,
1109
+ "sortText": "03_import_functools"
1110
+ },
1111
+ {
1112
+ "label": "import re",
1113
+ "kind": 9,
1114
+ "detail": "Import re (regular expressions) module",
1115
+ "documentation": { "value": "Regular expression operations.\n\n```python\nimport re\n\nre.search(r'\\d+', 'abc123') # Match object\nre.findall(r'\\w+', 'hello world') # ['hello', 'world']\nre.sub(r'\\s+', ' ', text)\npattern = re.compile(r'^\\d{3}-\\d{4}$')\n```" },
1116
+ "insertText": "import re",
1117
+ "insertTextRules": 1,
1118
+ "sortText": "03_import_re"
1119
+ },
1120
+ {
1121
+ "label": "Optional",
1122
+ "kind": 5,
1123
+ "detail": "typing.Optional — Optional type hint",
1124
+ "documentation": { "value": "Equivalent to `Union[X, None]`. Prefer `X | None` in 3.10+.\n\n```python\nfrom typing import Optional\n\ndef find(name: str) -> Optional[int]:\n ... # returns int or None\n\n# 3.10+ equivalent:\ndef find(name: str) -> int | None: ...\n```" },
1125
+ "insertText": "Optional[${1:type}]",
1126
+ "insertTextRules": 4,
1127
+ "sortText": "04_Optional"
1128
+ },
1129
+ {
1130
+ "label": "Union",
1131
+ "kind": 5,
1132
+ "detail": "typing.Union — Union type hint",
1133
+ "documentation": { "value": "Union of several types. Prefer `X | Y` in 3.10+.\n\n```python\nfrom typing import Union\n\ndef process(value: Union[str, int]) -> None: ...\n\n# 3.10+ equivalent:\ndef process(value: str | int) -> None: ...\n```" },
1134
+ "insertText": "Union[${1:type1}, ${2:type2}]",
1135
+ "insertTextRules": 4,
1136
+ "sortText": "04_Union"
1137
+ },
1138
+ {
1139
+ "label": "List (typing)",
1140
+ "kind": 5,
1141
+ "detail": "typing.List — Generic list type",
1142
+ "documentation": { "value": "Generic version of `list`. Prefer `list[X]` in 3.9+.\n\n```python\nfrom typing import List\n\ndef get_names() -> List[str]: ...\n\n# 3.9+ equivalent:\ndef get_names() -> list[str]: ...\n```" },
1143
+ "insertText": "List[${1:type}]",
1144
+ "insertTextRules": 4,
1145
+ "sortText": "04_List"
1146
+ },
1147
+ {
1148
+ "label": "Dict (typing)",
1149
+ "kind": 5,
1150
+ "detail": "typing.Dict — Generic dict type",
1151
+ "documentation": { "value": "Generic version of `dict`. Prefer `dict[K, V]` in 3.9+.\n\n```python\nfrom typing import Dict\n\ndef get_config() -> Dict[str, Any]: ...\n\n# 3.9+ equivalent:\ndef get_config() -> dict[str, Any]: ...\n```" },
1152
+ "insertText": "Dict[${1:key_type}, ${2:value_type}]",
1153
+ "insertTextRules": 4,
1154
+ "sortText": "04_Dict"
1155
+ },
1156
+ {
1157
+ "label": "Set (typing)",
1158
+ "kind": 5,
1159
+ "detail": "typing.Set — Generic set type",
1160
+ "documentation": { "value": "Generic version of `set`. Prefer `set[X]` in 3.9+.\n\n```python\nfrom typing import Set\ndef unique(items: list[str]) -> Set[str]: ...\n```" },
1161
+ "insertText": "Set[${1:type}]",
1162
+ "insertTextRules": 4,
1163
+ "sortText": "04_Set"
1164
+ },
1165
+ {
1166
+ "label": "Tuple (typing)",
1167
+ "kind": 5,
1168
+ "detail": "typing.Tuple — Generic tuple type",
1169
+ "documentation": { "value": "Generic version of `tuple`. Prefer `tuple[X, Y]` in 3.9+.\n\n```python\nfrom typing import Tuple\ndef get_pair() -> Tuple[str, int]: ...\nTuple[int, ...] # variable length\n```" },
1170
+ "insertText": "Tuple[${1:types}]",
1171
+ "insertTextRules": 4,
1172
+ "sortText": "04_Tuple"
1173
+ },
1174
+ {
1175
+ "label": "Any",
1176
+ "kind": 5,
1177
+ "detail": "typing.Any — Unconstrained type",
1178
+ "documentation": { "value": "Special form indicating an unconstrained type.\n\n```python\nfrom typing import Any\n\ndef process(data: Any) -> Any: ...\n```" },
1179
+ "insertText": "Any",
1180
+ "insertTextRules": 1,
1181
+ "sortText": "04_Any"
1182
+ },
1183
+ {
1184
+ "label": "TypeVar",
1185
+ "kind": 5,
1186
+ "detail": "typing.TypeVar — Type variable",
1187
+ "documentation": { "value": "Create a type variable for generics.\n\n```python\nfrom typing import TypeVar\n\nT = TypeVar('T')\nT = TypeVar('T', bound=Comparable)\n\ndef first(items: list[T]) -> T:\n return items[0]\n```\n\nPython 3.12+ syntax:\n```python\ndef first[T](items: list[T]) -> T:\n return items[0]\n```" },
1188
+ "insertText": "${1:T} = TypeVar('${1:T}')",
1189
+ "insertTextRules": 4,
1190
+ "sortText": "04_TypeVar"
1191
+ },
1192
+ {
1193
+ "label": "Generic",
1194
+ "kind": 5,
1195
+ "detail": "typing.Generic — Base class for generics",
1196
+ "documentation": { "value": "Abstract base class for generic types.\n\n```python\nfrom typing import TypeVar, Generic\n\nT = TypeVar('T')\n\nclass Stack(Generic[T]):\n def push(self, item: T) -> None: ...\n def pop(self) -> T: ...\n```" },
1197
+ "insertText": "Generic[${1:T}]",
1198
+ "insertTextRules": 4,
1199
+ "sortText": "04_Generic"
1200
+ },
1201
+ {
1202
+ "label": "Protocol",
1203
+ "kind": 5,
1204
+ "detail": "typing.Protocol — Structural subtyping",
1205
+ "documentation": { "value": "Define structural (duck-typing) interfaces.\n\n```python\nfrom typing import Protocol\n\nclass Readable(Protocol):\n def read(self) -> str: ...\n\ndef process(src: Readable) -> None:\n data = src.read() # works for any object with .read()\n```" },
1206
+ "insertText": "class ${1:Name}(Protocol):\n def ${2:method}(self${3:, args}) -> ${4:type}: ...",
1207
+ "insertTextRules": 4,
1208
+ "sortText": "04_Protocol"
1209
+ },
1210
+ {
1211
+ "label": "TypeAlias",
1212
+ "kind": 5,
1213
+ "detail": "typing.TypeAlias — Explicit type alias",
1214
+ "documentation": { "value": "Mark a variable as a type alias (3.10+).\n\n```python\nfrom typing import TypeAlias\n\nVector: TypeAlias = list[float]\nJSON: TypeAlias = dict[str, 'JSON'] | list['JSON'] | str | int | float | bool | None\n```" },
1215
+ "insertText": "${1:Name}: TypeAlias = ${0:type}",
1216
+ "insertTextRules": 4,
1217
+ "sortText": "04_TypeAlias"
1218
+ },
1219
+ {
1220
+ "label": "Literal",
1221
+ "kind": 5,
1222
+ "detail": "typing.Literal — Literal type",
1223
+ "documentation": { "value": "Restrict a value to specific literal values.\n\n```python\nfrom typing import Literal\n\ndef set_mode(mode: Literal['r', 'w', 'a']) -> None: ...\nDirection = Literal['north', 'south', 'east', 'west']\n```" },
1224
+ "insertText": "Literal[${1:values}]",
1225
+ "insertTextRules": 4,
1226
+ "sortText": "04_Literal"
1227
+ },
1228
+ {
1229
+ "label": "Final",
1230
+ "kind": 5,
1231
+ "detail": "typing.Final — Constant declaration",
1232
+ "documentation": { "value": "Declare that a name cannot be reassigned.\n\n```python\nfrom typing import Final\n\nMAX_SIZE: Final = 100\nMAX_SIZE: Final[int] = 100\n```" },
1233
+ "insertText": "Final[${1:type}]",
1234
+ "insertTextRules": 4,
1235
+ "sortText": "04_Final"
1236
+ },
1237
+ {
1238
+ "label": "TypeGuard",
1239
+ "kind": 5,
1240
+ "detail": "typing.TypeGuard — Type narrowing",
1241
+ "documentation": { "value": "Use in return type of user-defined type guards (3.10+).\n\n```python\nfrom typing import TypeGuard\n\ndef is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n return all(isinstance(x, str) for x in val)\n```" },
1242
+ "insertText": "TypeGuard[${1:type}]",
1243
+ "insertTextRules": 4,
1244
+ "sortText": "04_TypeGuard"
1245
+ },
1246
+ {
1247
+ "label": "Self",
1248
+ "kind": 5,
1249
+ "detail": "typing.Self — Self type (3.11+)",
1250
+ "documentation": { "value": "Refer to the enclosing class in return annotations.\n\n```python\nfrom typing import Self\n\nclass Builder:\n def set_name(self, name: str) -> Self:\n self.name = name\n return self\n```" },
1251
+ "insertText": "Self",
1252
+ "insertTextRules": 1,
1253
+ "sortText": "04_Self"
1254
+ },
1255
+ {
1256
+ "label": "Never",
1257
+ "kind": 5,
1258
+ "detail": "typing.Never — Bottom type (3.11+)",
1259
+ "documentation": { "value": "The bottom type — a function returning `Never` never returns normally.\n\n```python\nfrom typing import Never\n\ndef fail(msg: str) -> Never:\n raise RuntimeError(msg)\n```" },
1260
+ "insertText": "Never",
1261
+ "insertTextRules": 1,
1262
+ "sortText": "04_Never"
1263
+ },
1264
+ {
1265
+ "label": "Unpack",
1266
+ "kind": 5,
1267
+ "detail": "typing.Unpack — Unpack type (3.11+)",
1268
+ "documentation": { "value": "Unpack a TypedDict for `**kwargs` typing.\n\n```python\nfrom typing import TypedDict, Unpack\n\nclass Options(TypedDict):\n timeout: int\n retries: int\n\ndef request(url: str, **kwargs: Unpack[Options]) -> None: ...\n```" },
1269
+ "insertText": "Unpack[${1:TypedDict}]",
1270
+ "insertTextRules": 4,
1271
+ "sortText": "04_Unpack"
1272
+ },
1273
+ {
1274
+ "label": "TypeVarTuple",
1275
+ "kind": 5,
1276
+ "detail": "typing.TypeVarTuple — Variadic type variable (3.11+)",
1277
+ "documentation": { "value": "Type variable tuple for variadic generics.\n\n```python\nfrom typing import TypeVarTuple\n\nTs = TypeVarTuple('Ts')\n\ndef compose(*funcs: *Ts) -> None: ...\n```" },
1278
+ "insertText": "${1:Ts} = TypeVarTuple('${1:Ts}')",
1279
+ "insertTextRules": 4,
1280
+ "sortText": "04_TypeVarTuple"
1281
+ },
1282
+ {
1283
+ "label": "ExceptionGroup",
1284
+ "kind": 5,
1285
+ "detail": "ExceptionGroup (3.11+)",
1286
+ "documentation": { "value": "Group multiple exceptions together for concurrent error handling.\n\n```python\ntry:\n async with asyncio.TaskGroup() as tg:\n tg.create_task(task1())\n tg.create_task(task2())\nexcept* ValueError as eg:\n for e in eg.exceptions:\n print(e)\nexcept* TypeError as eg:\n ...\n```" },
1287
+ "insertText": "ExceptionGroup('${1:message}', [${2:exceptions}])",
1288
+ "insertTextRules": 4,
1289
+ "sortText": "04_ExceptionGroup"
1290
+ },
1291
+ {
1292
+ "label": "__init__",
1293
+ "kind": 0,
1294
+ "detail": "Constructor method",
1295
+ "documentation": { "value": "Instance initializer.\n\n```python\ndef __init__(self, name: str, value: int = 0) -> None:\n self.name = name\n self.value = value\n```" },
1296
+ "insertText": "def __init__(self, ${1:params}) -> None:\n ${0:pass}",
1297
+ "insertTextRules": 4,
1298
+ "sortText": "02___init__"
1299
+ },
1300
+ {
1301
+ "label": "__repr__",
1302
+ "kind": 0,
1303
+ "detail": "Official string representation",
1304
+ "documentation": { "value": "Return a developer-friendly string representation.\n\n```python\ndef __repr__(self) -> str:\n return f'{type(self).__name__}({self.name!r})'\n```" },
1305
+ "insertText": "def __repr__(self) -> str:\n return f'${1:{type(self).__name__}(${2:})}'",
1306
+ "insertTextRules": 4,
1307
+ "sortText": "02___repr__"
1308
+ },
1309
+ {
1310
+ "label": "__str__",
1311
+ "kind": 0,
1312
+ "detail": "Informal string representation",
1313
+ "documentation": { "value": "Return a user-friendly string representation.\n\n```python\ndef __str__(self) -> str:\n return self.name\n```" },
1314
+ "insertText": "def __str__(self) -> str:\n return ${0:self.name}",
1315
+ "insertTextRules": 4,
1316
+ "sortText": "02___str__"
1317
+ },
1318
+ {
1319
+ "label": "__enter__ / __exit__",
1320
+ "kind": 15,
1321
+ "detail": "Context manager protocol",
1322
+ "documentation": { "value": "Implement the context manager protocol.\n\n```python\nclass MyContext:\n def __enter__(self) -> 'MyContext':\n return self\n\n def __exit__(self, exc_type, exc_val, exc_tb) -> bool:\n # cleanup\n return False # don't suppress exceptions\n```" },
1323
+ "insertText": "def __enter__(self) -> '${1:Self}':\n return self\n\ndef __exit__(self, exc_type, exc_val, exc_tb) -> bool:\n ${0:return False}",
1324
+ "insertTextRules": 4,
1325
+ "sortText": "02___enter__"
1326
+ },
1327
+ {
1328
+ "label": "if __name__ == '__main__'",
1329
+ "kind": 15,
1330
+ "detail": "Main entry point guard",
1331
+ "documentation": { "value": "Guard for code that should only run when the module is executed directly.\n\n```python\nif __name__ == '__main__':\n main()\n```" },
1332
+ "insertText": "if __name__ == '__main__':\n ${0:main()}",
1333
+ "insertTextRules": 4,
1334
+ "sortText": "02_main_guard"
1335
+ },
1336
+ {
1337
+ "label": "async for",
1338
+ "kind": 15,
1339
+ "detail": "Async for loop",
1340
+ "documentation": { "value": "Iterate over an asynchronous iterable.\n\n```python\nasync for item in aiter:\n await process(item)\n```" },
1341
+ "insertText": "async for ${1:item} in ${2:aiter}:\n ${0:await process(item)}",
1342
+ "insertTextRules": 4,
1343
+ "sortText": "02_async_for"
1344
+ },
1345
+ {
1346
+ "label": "async with",
1347
+ "kind": 15,
1348
+ "detail": "Async context manager",
1349
+ "documentation": { "value": "Use an asynchronous context manager.\n\n```python\nasync with aiohttp.ClientSession() as session:\n async with session.get(url) as resp:\n data = await resp.json()\n```" },
1350
+ "insertText": "async with ${1:expression} as ${2:var}:\n ${0:pass}",
1351
+ "insertTextRules": 4,
1352
+ "sortText": "02_async_with"
1353
+ },
1354
+ {
1355
+ "label": "yield",
1356
+ "kind": 14,
1357
+ "detail": "Yield a value from a generator",
1358
+ "documentation": { "value": "Produce a value in a generator function.\n\n```python\ndef count_up(n):\n for i in range(n):\n yield i\n\ndef delegator():\n yield from sub_generator()\n```" },
1359
+ "insertText": "yield ${0:value}",
1360
+ "insertTextRules": 4,
1361
+ "sortText": "02_yield"
1362
+ },
1363
+ {
1364
+ "label": "raise",
1365
+ "kind": 14,
1366
+ "detail": "Raise an exception",
1367
+ "documentation": { "value": "Raise an exception.\n\n```python\nraise ValueError('invalid input')\nraise TypeError(f'expected str, got {type(x).__name__}')\nraise # re-raise current exception\nraise NewError() from original_error\n```" },
1368
+ "insertText": "raise ${1:ValueError}(${2:'message'})",
1369
+ "insertTextRules": 4,
1370
+ "sortText": "02_raise"
1371
+ },
1372
+ {
1373
+ "label": "assert",
1374
+ "kind": 14,
1375
+ "detail": "Assert a condition",
1376
+ "documentation": { "value": "Debug assertion — removed when running with `-O`.\n\n```python\nassert x > 0, f'x must be positive, got {x}'\nassert isinstance(obj, MyClass)\n```" },
1377
+ "insertText": "assert ${1:condition}, ${2:'message'}",
1378
+ "insertTextRules": 4,
1379
+ "sortText": "02_assert"
1380
+ },
1381
+ {
1382
+ "label": ".setdefault",
1383
+ "kind": 0,
1384
+ "detail": "dict.setdefault — Get or set default value for key",
1385
+ "documentation": { "value": "If key is in the dictionary, return its value. If not, insert key with a value of default and return default.\n\n```python\nd = {'a': 1}\nd.setdefault('b', 0) # 0, d = {'a': 1, 'b': 0}\nd.setdefault('a', 99) # 1 (unchanged)\n```" },
1386
+ "insertText": ".setdefault(${1:key}, ${2:default})",
1387
+ "insertTextRules": 4,
1388
+ "sortText": "01_dict_setdefault"
1389
+ },
1390
+ {
1391
+ "label": ".pop (dict)",
1392
+ "kind": 0,
1393
+ "detail": "dict.pop — Remove and return value for key",
1394
+ "documentation": { "value": "Remove specified key and return its value. If key is not found, return default or raise KeyError.\n\n```python\nd = {'a': 1, 'b': 2}\nd.pop('a') # 1\nd.pop('z', None) # None\n```" },
1395
+ "insertText": ".pop(${1:key}, ${2:default})",
1396
+ "insertTextRules": 4,
1397
+ "sortText": "01_dict_pop"
1398
+ },
1399
+ {
1400
+ "label": ".intersection",
1401
+ "kind": 0,
1402
+ "detail": "set.intersection — Return common elements",
1403
+ "documentation": { "value": "Return a new set with elements common to the set and all others.\n\n```python\n{1, 2, 3}.intersection({2, 3, 4}) # {2, 3}\n# equivalent: {1, 2, 3} & {2, 3, 4}\n```" },
1404
+ "insertText": ".intersection(${1:other})",
1405
+ "insertTextRules": 4,
1406
+ "sortText": "01_set_intersection"
1407
+ },
1408
+ {
1409
+ "label": ".union",
1410
+ "kind": 0,
1411
+ "detail": "set.union — Return all elements from both sets",
1412
+ "documentation": { "value": "Return a new set with elements from the set and all others.\n\n```python\n{1, 2}.union({2, 3}) # {1, 2, 3}\n# equivalent: {1, 2} | {2, 3}\n```" },
1413
+ "insertText": ".union(${1:other})",
1414
+ "insertTextRules": 4,
1415
+ "sortText": "01_set_union"
1416
+ },
1417
+ {
1418
+ "label": ".difference",
1419
+ "kind": 0,
1420
+ "detail": "set.difference — Return elements not in other set",
1421
+ "documentation": { "value": "Return a new set with elements in the set that are not in the others.\n\n```python\n{1, 2, 3}.difference({2, 3, 4}) # {1}\n# equivalent: {1, 2, 3} - {2, 3, 4}\n```" },
1422
+ "insertText": ".difference(${1:other})",
1423
+ "insertTextRules": 4,
1424
+ "sortText": "01_set_difference"
1425
+ }
1426
+ ]
1427
+ }