This repository was archived by the owner on Jun 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Add descriptions for comprehension.json and base.json 😄 #10
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
66 changes: 44 additions & 22 deletions
snippets/base.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,118 @@ | ||
{ | ||
"#!/usr/bin/env python": { | ||
"prefix": "env", | ||
"body": "#!/usr/bin/env python\n0ドル" | ||
"body": "#!/usr/bin/env python\n0ドル", | ||
"description" : "Adds shebang line for default python interpreter." | ||
}, | ||
"#!/usr/bin/env python3": { | ||
"prefix": "env3", | ||
"body": "#!/usr/bin/env python3\n0ドル" | ||
"body": "#!/usr/bin/env python3\n0ドル", | ||
"description" : "Adds shebang line for default python 3 interpreter." | ||
}, | ||
"# -*- coding=utf-8 -*-": { | ||
"prefix": "enc", | ||
"body": "# -*- coding=utf-8 -*-\n0ドル" | ||
"body": "# -*- coding=utf-8 -*-\n0ドル", | ||
"description" : "set default python2.x encoding specification to utf-8 as it is mentioned in pep-0263." | ||
}, | ||
"# coding=utf-8": { | ||
"prefix": "enco", | ||
"body": "# coding=utf-8\n0ドル" | ||
"body": "# coding=utf-8\n0ドル", | ||
"description" : "set default python3 encoding specification to utf-8, by default this is the encoding for python3.x as it is mentioned in pep-3120." | ||
}, | ||
"from future import ...": { | ||
"prefix": "fenc", | ||
"body": [ | ||
"# -*- coding: utf-8 -*-", | ||
"from __future__ import absolute_import, division, print_function, unicode_literals" | ||
] | ||
], | ||
"description" : "Import future statement definitions for python2.x scripts using utf-8 as encoding." | ||
}, | ||
"from future import ... v1": { | ||
"prefix": "fenco", | ||
"body": [ | ||
"# coding: utf-8", | ||
"from __future__ import absolute_import, division, print_function, unicode_literals" | ||
] | ||
], | ||
"description" : "Import future statement definitions for python3.x scripts using utf-8 as encoding." | ||
}, | ||
"import": { | ||
"prefix": "im", | ||
"body": "import ${1:package/module}0ドル" | ||
"body": "import ${1:package/module}0ドル", | ||
"description" : "Import a package or module" | ||
}, | ||
"from ... import ...": { | ||
"prefix": "fim", | ||
"body": "from ${1:package/module} import ${2:names}0ドル" | ||
"body": "from ${1:package/module} import ${2:names}0ドル", | ||
"description" : "Import statement that allows individual objects from the module to be imported directly into the caller’s symbol table." | ||
}, | ||
"New class": { | ||
"prefix": "class", | ||
"body": "class ${1:ClassName}(${2:object}):\n\t\"\"\"${3:docstring for 1ドル.}\"\"\"\n\tdef __init__(self, ${4:arg}):\n\t\t${5:super(1,ドル self).__init__()}\n\t\tself.arg = arg\n\t\t0ドル" | ||
"body": "class ${1:ClassName}(${2:object}):\n\t\"\"\"${3:docstring for 1ドル.}\"\"\"\n\tdef __init__(self, ${4:arg}):\n\t\t${5:super(1,ドル self).__init__()}\n\t\tself.arg = arg\n\t\t0ドル", | ||
"description" : "Code snippet for a class definition." | ||
}, | ||
"New method": { | ||
"prefix": "defs", | ||
"body": "def ${1:mname}(self, ${2:arg}):\n\t${3:pass}0ドル" | ||
"body": "def ${1:mname}(self, ${2:arg}):\n\t${3:pass}0ドル", | ||
"description" : "Code snippet for a class method definition." | ||
}, | ||
"New function": { | ||
"prefix": "def", | ||
"body": "def ${1:fname}(${2:arg}):\n\t${3:pass}0ドル" | ||
"body": "def ${1:fname}(${2:arg}):\n\t${3:pass}0ドル", | ||
"description" : "Code snippet for function definition." | ||
}, | ||
"New froperty": { | ||
"prefix": "property", | ||
"body": "def ${1:foo}():\n doc = \"${2:The 1ドル property.}\"\n def fget(self):\n ${3:return self._1ドル}\n def fset(self, value):\n ${4:self._1ドル = value}\n def fdel(self):\n ${5:del self._1ドル}\n return locals()\n1ドル = property(**1ドル())0ドル" | ||
"body": "def ${1:foo}():\n doc = \"${2:The 1ドル property.}\"\n def fget(self):\n ${3:return self._1ドル}\n def fset(self, value):\n ${4:self._1ドル = value}\n def fdel(self):\n ${5:del self._1ドル}\n return locals()\n1ドル = property(**1ドル())0ドル", | ||
"description" : "" | ||
}, | ||
"if": { | ||
"prefix": "if", | ||
"body": "if ${1:condition}:\n\t${2:pass}0ドル" | ||
"body": "if ${1:condition}:\n\t${2:pass}0ドル", | ||
"description" : "Code snippet for the if statement." | ||
}, | ||
"for": { | ||
"prefix": "for", | ||
"body": "for ${1:value} in ${2:iterable}:\n\t${3:pass}0ドル" | ||
"body": "for ${1:value} in ${2:iterable}:\n\t${3:pass}0ドル", | ||
"description" : "Code snippet to create a for loop structure." | ||
}, | ||
"while": { | ||
"prefix": "while", | ||
"body": "while ${1:condition}:\n\t${2:pass}0ドル" | ||
"body": "while ${1:condition}:\n\t${2:pass}0ドル", | ||
"description" : "Code snippet to create a while loop structure." | ||
}, | ||
"try:except:": { | ||
"prefix": "try", | ||
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise 3ドル}0ドル" | ||
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise 3ドル}0ドル", | ||
"description" : "Code Snippet for a try and except blocks." | ||
}, | ||
"try:except:else:finally": { | ||
"prefix": "tryef", | ||
"body": "try:\n\t${1:pass}\nexcept${2: ${3:Exception} as ${4:e}}:\n\t${5:raise}\nelse:\n\t${6:pass}\nfinally:\n\t${7:pass}0ドル" | ||
"body": "try:\n\t${1:pass}\nexcept${2: ${3:Exception} as ${4:e}}:\n\t${5:raise}\nelse:\n\t${6:pass}\nfinally:\n\t${7:pass}0ドル", | ||
"description" : "Code Snippet for a try/except/finally with else statement." | ||
}, | ||
"try:except:else": { | ||
"prefix": "trye", | ||
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise 3ドル}\nelse:\n\t${5:pass}0ドル" | ||
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise 3ドル}\nelse:\n\t${5:pass}0ドル", | ||
"description" : "Code Snippet for a try/except with else statement." | ||
}, | ||
"try:except:finally": { | ||
"prefix": "tryf", | ||
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise 3ドル}\nfinally:\n\t${5:pass}0ドル" | ||
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise 3ドル}\nfinally:\n\t${5:pass}0ドル", | ||
"description" : "Code Snippet for a try/except/finally." | ||
}, | ||
"self": { | ||
"prefix": ".", | ||
"body": "self.0ドル" | ||
"body": "self.0ドル", | ||
"description" : "shortend snippet to reference the self property in an object." | ||
}, | ||
"__magic__": { | ||
"prefix": "__", | ||
"body": "__${1:init}__0ドル" | ||
"body": "__${1:init}__0ドル", | ||
"description" : "Code snippet to create magic methods." | ||
}, | ||
"if __name__ == \"__main__\"": { | ||
"prefix": "ifmain", | ||
"body": "if __name__ == \"__main__\":\n\t${1:main()}0ドル" | ||
"body": "if __name__ == \"__main__\":\n\t${1:main()}0ドル", | ||
"description" : "Create implicitly all the code at the top level using the __name__ special variable." | ||
} | ||
} |
27 changes: 18 additions & 9 deletions
snippets/comprehension.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,47 @@ | ||
{ | ||
"List comprehension": { | ||
"prefix": "lc", | ||
"body": "[${1:value} for ${2:value} in ${3:iterable}]0ドル" | ||
"body": "[${1:value} for ${2:value} in ${3:iterable}]0ドル", | ||
"description" : "list comprehension for creating a list based on existing lists." | ||
}, | ||
"List comprehension if else": { | ||
"prefix": "lcie", | ||
"body": "[${1:value} if ${2:condition} else ${3:condition} for ${4:value} in ${5:iterable}]0ドル" | ||
"body": "[${1:value} if ${2:condition} else ${3:condition} for ${4:value} in ${5:iterable}]0ドル", | ||
"description" : "list comprehension for creating a list based on existing lists, with conditional if-else statement." | ||
}, | ||
"List comprehension if filter": { | ||
"prefix": "lci", | ||
"body": "[${1:value} for ${2:value} in ${3:iterable} if ${4:condition}0ドル]" | ||
"body": "[${1:value} for ${2:value} in ${3:iterable} if ${4:condition}0ドル]", | ||
"description" : "list comprehension for creating a list based on existing lists, with conditional if statement." | ||
}, | ||
"Dictionary comprehension": { | ||
"prefix": "dc", | ||
"body": "{${1:key}: ${2:value} for ${3:key}, ${4:value} in ${5:iterable}}0ドル" | ||
"body": "{${1:key}: ${2:value} for ${3:key}, ${4:value} in ${5:iterable}}0ドル", | ||
"description" : "Handy and faster way to create dictories based on existing dictionaries." | ||
}, | ||
"Dictionary comprehension if filter": { | ||
"prefix": "dci", | ||
"body": "{${1:key}: ${2:value} for ${3:key}, ${4:value} in ${5:iterable} if ${6:condition}}0ドル" | ||
"body": "{${1:key}: ${2:value} for ${3:key}, ${4:value} in ${5:iterable} if ${6:condition}}0ドル", | ||
"description" : "Handy and faster way to create dictories based on existing dictionaries, with conditional if statement." | ||
}, | ||
"Set comprehension": { | ||
"prefix": "sc", | ||
"body": "{${1:value} for ${2:value} in ${3:iterable}}0ドル" | ||
"body": "{${1:value} for ${2:value} in ${3:iterable}}0ドル", | ||
"description" : "Create a set based on existing iterables." | ||
}, | ||
"Set Comprehension if filter": { | ||
"prefix": "sci", | ||
"body": "{${1:value} for ${2:value} in ${3:iterable} if ${4:condition}}0ドル" | ||
"body": "{${1:value} for ${2:value} in ${3:iterable} if ${4:condition}}0ドル", | ||
"description" : "Create a set based on existing iterables, with condition if statement." | ||
}, | ||
"Generator comprehension": { | ||
"prefix": "gc", | ||
"body": "(${1:key} for ${2:value} in ${3:iterable})0ドル" | ||
"body": "(${1:key} for ${2:value} in ${3:iterable})0ドル", | ||
"description" : "Create a generator based on existing iterables." | ||
}, | ||
"Generator comprehension if filter": { | ||
"prefix": "gci", | ||
"body": "(${1:key} for ${2:value} in ${3:iterable} if ${4:condition})0ドル" | ||
"body": "(${1:key} for ${2:value} in ${3:iterable} if ${4:condition})0ドル", | ||
"description" : "Create a generator based on existing iterables, with condition if statement." | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.