Skip to content

Commit

Permalink
Implement missing python special methods. (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPalard authored Jan 5, 2024
1 parent 9857135 commit b00a7c9
Show file tree
Hide file tree
Showing 21 changed files with 149 additions and 0 deletions.
8 changes: 8 additions & 0 deletions snippets/python-mode/__aenter__
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: __aenter__
# key: _aenter
# group: Special methods
# --
async def __aenter__(self):
$0
return self
7 changes: 7 additions & 0 deletions snippets/python-mode/__aexit__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __aexit__
# key: _aexit
# group: Special methods
# --
async def __aexit__(self, exc_type, exc_value, traceback):
$0
7 changes: 7 additions & 0 deletions snippets/python-mode/__aiter__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __aiter__
# key: _aiter
# group: Special methods
# --
def __aiter__(self):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__anext__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __anext__
# key: _anext
# group: Special methods
# --
async def __anext__(self):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__await__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __await__
# key: _await
# group: Special methods
# --
def __await__(self):
$0
7 changes: 7 additions & 0 deletions snippets/python-mode/__bytes__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __bytes__
# key: _bytes
# group: Special methods
# --
def __bytes__(self):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__ceil__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __ceil__
# key: _ceil
# group: Special methods
# --
def __ceil__(self):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__class_getitem__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __class_getitem__
# key: _class_getitem
# group: Special methods
# --
def __class_getitem__(cls, key):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__dir__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __dir__
# key: _dir
# group: Special methods
# --
def __dir__(self):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__floor__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __floor__
# key: _floor
# group: Special methods
# --
def __floor__(self):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__format__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __format__
# key: _format
# group: Special methods
# --
def __format__(self, format_spec):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__imatmul__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __imatmul__
# key: _imatmul
# group: Special methods
# --
def __imatmul__(self, other):
return $0
8 changes: 8 additions & 0 deletions snippets/python-mode/__init_subclass__
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: __init_subclass__
# key: _init_subclass
# group: Special methods
# --
def __init_subclass__(cls, /${1:, param}, **kwargs):
super().__init_subclass__(**kwargs)
$0
7 changes: 7 additions & 0 deletions snippets/python-mode/__length_hint__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __length_hint__
# key: _length_hint
# group: Special methods
# --
def __length_hint__(self):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__matmul__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __matmul__
# key: _matmul
# group: Special methods
# --
def __matmul__(self, other):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__missing__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __missing__
# key: _missing
# group: Special methods
# --
def __missing__(self):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__prepare__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __prepare__
# key: _prepare
# group: Special methods
# --
def __prepare__(name, bases, **kwds):
return ${0:\{\}}
7 changes: 7 additions & 0 deletions snippets/python-mode/__rmatmul__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __rmatmul__
# key: _rmatmul
# group: Special methods
# --
def __rmatmul__(self, other):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__round__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __round__
# key: _round
# group: Special methods
# --
def __round__(self, ndigits=None):
return $0
7 changes: 7 additions & 0 deletions snippets/python-mode/__set_name__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __set_name__
# key: _set_name
# group: Special methods
# --
def __set_name__(self, owner, name):
$0
7 changes: 7 additions & 0 deletions snippets/python-mode/__trunc__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: __trunc__
# key: _trunc
# group: Special methods
# --
def __trunc__(self):
return $0

0 comments on commit b00a7c9

Please sign in to comment.