From 2263d167a447bcea1d51773b1ef1d1683da8e3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A8h3ct0rjs=C2=A8?= <¨hfjimenez@utp.edu.co¨> Date: Tue, 26 Mar 2019 08:50:50 -0500 Subject: [PATCH] Add descriptions for comprehension.json and base.json :happy: --- snippets/base.json | 66 ++++++++++++++++++++++++------------- snippets/comprehension.json | 27 ++++++++++----- 2 files changed, 62 insertions(+), 31 deletions(-) diff --git a/snippets/base.json b/snippets/base.json index 2203da3..94ffd8f 100644 --- a/snippets/base.json +++ b/snippets/base.json @@ -1,96 +1,118 @@ { "#!/usr/bin/env python": { "prefix": "env", - "body": "#!/usr/bin/env python\n$0" + "body": "#!/usr/bin/env python\n$0", + "description" : "Adds shebang line for default python interpreter." }, "#!/usr/bin/env python3": { "prefix": "env3", - "body": "#!/usr/bin/env python3\n$0" + "body": "#!/usr/bin/env python3\n$0", + "description" : "Adds shebang line for default python 3 interpreter." }, "# -*- coding=utf-8 -*-": { "prefix": "enc", - "body": "# -*- coding=utf-8 -*-\n$0" + "body": "# -*- coding=utf-8 -*-\n$0", + "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\n$0" + "body": "# coding=utf-8\n$0", + "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\t$0" + "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\t$0", + "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()\n$1 = 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()\n$1 = 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." } } \ No newline at end of file diff --git a/snippets/comprehension.json b/snippets/comprehension.json index 8e4644f..064c5e4 100644 --- a/snippets/comprehension.json +++ b/snippets/comprehension.json @@ -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." } }