Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Add descriptions for comprehension.json and base.json 😄 #10

Merged
cstrap merged 1 commit into cstrap:master from h3ct0rjs:master
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 44 additions & 22 deletions snippets/base.json
View file Open in desktop
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
View file Open in desktop
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."
}
}

AltStyle によって変換されたページ (->オリジナル) /