- Download Custom Postfix Templates plugin in https://plugins.jetbrains.com/plugin/9862-custom-postfix-templates
- Navigate to Settings -> Custom Postfix Templates
- Add in Template files
- Copy the URL and paste
Last active
December 2, 2021 03:28
-
-
Save aquastripe/6cee14d1f67d14ce3f19bd19544d3deb to your computer and use it in GitHub Desktop.
My Python template for Custom Postfix Templates plugin
This file contains hidden or 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
.enumerate : Enumerate value | |
ANY → enumerate($expr$) | |
.reversed : Reverse iterable | |
ANY → reversed($expr$) | |
.sort : Sort iterable | |
ANY → sort($expr$)$END$ | |
.sortk : Sort iterable with key | |
ANY → sort($expr$, key=$key$)$END$ | |
.sortl : Sort iterable with lambda key | |
ANY → sort($expr$, key=lambda o: $key$)$END$ | |
.filter : Filter iterable | |
ANY → filter($first$, $expr$)$END$ | |
.filterl : Filter iterable with lambda | |
ANY → filter(lambda o: $first$, $expr$)$END$ | |
.map : Map iterable | |
ANY → map($first$, $expr$)$END$ | |
.mapl : Map iterable with lambda | |
ANY → map(lambda o: $first$, $expr$)$END$ | |
.open : Open a path | |
ANY → with open($expr$) as $file_name$:\ | |
$END$ | |
.openm : Open a path with mode | |
ANY → with open($expr$, mode='$mode$') as $file_name$:\ | |
$END$ | |
.openp : Open a Path object | |
ANY → with closing($expr$.open()) as $file_name$:\ | |
$END$ | |
.for : Iterate through an object | |
ANY → for $var$ in $expr$:\ | |
$END$ | |
.fore : Iterate through an object | |
ANY → for i, $var$ in enumerate($expr$):\ | |
$END$ | |
.try : Wrap with try except | |
ANY → try:\ | |
$expr$\ | |
except $error$ as $error_var$:\ | |
$END$ | |
.tryf : Wrap with try except and finally | |
ANY → try:\ | |
$expr$\ | |
except $error$ as $error_var$:\ | |
$except$\ | |
finally:\ | |
$END$ | |
.bytes : Cast to bytes | |
ANY → bytes($expr$)$END$ | |
.str : Cast to str | |
ANY → str($expr$)$END$ | |
.float : Cast to float | |
ANY → float($expr$)$END$ | |
.int : Cast to int | |
ANY → int($expr$)$END$ | |
.set : Wrap with set | |
ANY → set($expr$)$END$ | |
.frozenset : Wrap with frozenset | |
ANY → frozenset($expr$)$END$ | |
.list : Wrap with list | |
ANY → list($expr$)$END$ | |
.dict : Wrap with dict | |
ANY → dict($expr$)$END$ | |
.tuple : Wrap with tuple | |
ANY → tuple($expr$)$END$ | |
.next : Retrieve the next item from the iterator | |
ANY → next($expr$)$END$ | |
.iter : Return an iterator object | |
ANY → iter($expr$)$END$ | |
.min : Return the minimal | |
ANY → min($expr$)$END$ | |
.max : Return the maximal | |
ANY → max($expr$)$END$ | |
.abs : Return the absolute value | |
ANY → abs($expr$)$END$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment