-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* elpy-initialize-variables: Add the Elpy snippet directory. Elpy now ships with a few YASnippet snippets for Python. Fixes #43. * Small rework of the snippets. The enter and exit snippets now conform to the yasnippet-snippets repository (mostly), while super now makes use of the .yas-setup.el mechanism and is seriously improved. There's a new snippet for __init__ methods, too, which automatically assigns arguments to instance variables. * Rework and expand the snippet collection. * Add __bool__ snippet. * updated yasnippet variable 'text' to 'yas-text' * Return correct form of "super" depending on Python version Previously when using the yasnippet "super", it will always return "(class, arg).method" which was the Py2 way of doing it. In Py3, you could simply do "().method" and Python will understand. * Move yasnippet-snippets onto their own branch * PR #259 Change keys for __foo__ from "foo" to "_foo" Thanks to galaunay for the idea to use this to "avoid unnecessary keyspace pollution." * Fix bug due to passage from elpy to yasnippet * Use snippet expansion for foo -> __foo__ * Fix bug when specifying arguments on several lines * Allow detection of Python 3 on PEP 394-compliant systems. Please note that python-interpreter must be set to "python3" for this to function correctly. As a side-effect it also allows the use of Python 2 on systems that install version 3 to /usr/bin/python and version 2 to /usr/bin/python2. * Change elpy prefixes to yas-snips Thanks to Andrea Crotti for the review and suggestion. * Add newline at end of file for all files that were missing one. * Make python snippets able to handle arguments with type annotations. * Use start-point from yas--apply-transform in snippet-init-assignment yas-snips-snippet-init-assignments should use values provided by yas--apply-transform instead of grabbing them itself. Thanks to npostavs for finding this issue. See review discussion at PR #278 for more info (search for "yas--apply-transform"). * Removing Python 2 snippets, it's EOL since 2020-01-01. * Some consistenty in group names. * Removing a duplicate. * Owner is documented as optional. cf. https://docs.python.org/3/reference/datamodel.html#object.__get__ * Resolve a conflict between _getattr and _getattribute * Deduplicate: it already exists in master (named pdb). * Dedup: already exists as __repr__ * Dedup: already exists as __str__ * fix: try is already used by ./try * fix misleading key. * Consistency with other dunders. * Consistency with other naming. * Removing super, we don't have all needed elisp yet. * Deduplicate two keys. * s not needed. * The hook does not works for me. * Add few missing newlines at end of file. --------- Co-authored-by: Jorgen Schaefer <[email protected]> Co-authored-by: Jorgen Schaefer <[email protected]> Co-authored-by: Daniel Wu <[email protected]> Co-authored-by: Daniel Gopar <[email protected]> Co-authored-by: Nicholas D Steeves <[email protected]> Co-authored-by: galaunay <[email protected]>
- Loading branch information
1 parent
12103bb
commit 9f67370
Showing
152 changed files
with
654 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __abs__ | ||
# key: _abs | ||
# group: Special methods | ||
# -- | ||
def __abs__(self): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __add__ | ||
# key: _add | ||
# group: Special methods | ||
# -- | ||
def __add__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __and__ | ||
# key: _and | ||
# group: Special methods | ||
# -- | ||
def __and__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __bool__ | ||
# key: _bool | ||
# group: Special methods | ||
# -- | ||
def __bool__(self): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __call__ | ||
# key: _call | ||
# group: Special methods | ||
# -- | ||
def __call__(self, ${1:*args}): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __cmp__ | ||
# key: _cmp | ||
# group: Special methods | ||
# -- | ||
def __cmp__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __complex__ | ||
# key: _complex | ||
# group: Special methods | ||
# -- | ||
def __complex__(self): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __contains__ | ||
# key: cont | ||
# group: dunder methods | ||
# key: _contains | ||
# group: Special methods | ||
# -- | ||
def __contains__(self, el): | ||
$0 | ||
def __contains__(self, item): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __del__ | ||
# key: _del | ||
# group: Special methods | ||
# -- | ||
def __del__(self): | ||
$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __delattr__ | ||
# key: _delattr | ||
# group: Special methods | ||
# -- | ||
def __delattr__(self, name): | ||
$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __delete__ | ||
# key: _delete | ||
# group: Special methods | ||
# -- | ||
def __delete__(self, instance): | ||
$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __delitem__ | ||
# key: _delitem | ||
# group: Special methods | ||
# -- | ||
def __delitem__(self, key): | ||
$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __div__ | ||
# key: _div | ||
# group: Special methods | ||
# -- | ||
def __div__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __divmod__ | ||
# key: _divmod | ||
# group: Special methods | ||
# -- | ||
def __divmod__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# -*- mode: snippet -*- | ||
# name: __enter__ | ||
# key: ent | ||
# group: dunder methods | ||
# key: _enter | ||
# group: Special methods | ||
# -- | ||
def __enter__(self): | ||
$0 | ||
|
||
return self | ||
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __eq__ | ||
# key: eq | ||
# group: dunder methods | ||
# key: _eq | ||
# group: Special methods | ||
# -- | ||
def __eq__(self, other): | ||
return self.$1 == other.$1 | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __exit__ | ||
# key: ex | ||
# group: dunder methods | ||
# key: _exit | ||
# group: Special methods | ||
# -- | ||
def __exit__(self, type, value, traceback): | ||
$0 | ||
def __exit__(self, exc_type, exc_value, traceback): | ||
$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __float__ | ||
# key: _float | ||
# group: Special methods | ||
# -- | ||
def __float__(self): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __floordiv__ | ||
# key: _floordiv | ||
# group: Special methods | ||
# -- | ||
def __floordiv__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __ge__ | ||
# key: _ge | ||
# group: Special methods | ||
# -- | ||
def __ge__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __get__ | ||
# key: _get | ||
# group: Special methods | ||
# -- | ||
def __get__(self, instance, owner=None): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __getattr__ | ||
# key: _getattr | ||
# group: Special methods | ||
# -- | ||
def __getattr__(self, name): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __getattribute__ | ||
# key: _getattribute | ||
# group: Special methods | ||
# -- | ||
def __getattribute__(self, name): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __getitem__ | ||
# key: getit | ||
# group: dunder methods | ||
# key: _getitem | ||
# group: Special methods | ||
# -- | ||
def __getitem__(self, ${1:key}): | ||
$0 | ||
def __getitem__(self, key): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __gt__ | ||
# key: _gt | ||
# group: Special methods | ||
# -- | ||
def __gt__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __hash__ | ||
# key: _hash | ||
# group: Special methods | ||
# -- | ||
def __hash__(self): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __iadd__ | ||
# key: _iadd | ||
# group: Special methods | ||
# -- | ||
def __iadd__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __iand__ | ||
# key: _iand | ||
# group: Special methods | ||
# -- | ||
def __iand__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __idiv__ | ||
# key: _idiv | ||
# group: Special methods | ||
# -- | ||
def __idiv__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __ifloordiv__ | ||
# key: _ifloordiv | ||
# group: Special methods | ||
# -- | ||
def __ifloordiv__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __ilshift__ | ||
# key: _ilshift | ||
# group: Special methods | ||
# -- | ||
def __ilshift__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __imod__ | ||
# key: _imod | ||
# group: Special methods | ||
# -- | ||
def __imod__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __imul__ | ||
# key: _imul | ||
# group: Special methods | ||
# -- | ||
def __imul__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __index__ | ||
# key: _index | ||
# group: Special methods | ||
# -- | ||
def __index__(self): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# -*- mode: snippet -*- | ||
# name: init | ||
# key: init | ||
# name: __init__ | ||
# key: _init | ||
# group : definitions | ||
# -- | ||
def __init__(self${1:, args}): | ||
${2:"${3:docstring}" | ||
}$0 | ||
}$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __instancecheck__ | ||
# key: _instancecheck | ||
# group: Special methods | ||
# -- | ||
def __instancecheck__(self, instance): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __int__ | ||
# key: _int | ||
# group: Special methods | ||
# -- | ||
def __int__(self): | ||
$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __invert__ | ||
# key: _invert | ||
# group: Special methods | ||
# -- | ||
def __invert__(self): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __ior__ | ||
# key: _ior | ||
# group: Special methods | ||
# -- | ||
def __ior__(self, other): | ||
return $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: __ipow__ | ||
# key: _ipow | ||
# group: Special methods | ||
# -- | ||
def __ipow__(self, other): | ||
return $0 |
Oops, something went wrong.