Skip to content

Instantly share code, notes, and snippets.

@alexboche
Last active May 2, 2019 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexboche/8b1432f4d89ecb34f217713183f212f4 to your computer and use it in GitHub Desktop.
Save alexboche/8b1432f4d89ecb34f217713183f212f4 to your computer and use it in GitHub Desktop.
# Python vocabulary
"[key] word <python_keyword>":
R(Text(" %(python_keyword)s "), rdescript="Python: keyword"),
"builtin <python_builtin>":
R(Text(" %(python_builtin)s "), rdescript="Python: builtin"),
"standard <python_standard_library_module>":
R(Text(" %(python_standard_library_module)s "), rdescript="type name of Python standard library module"),
"lib <python_library>":
R(Text(" %(python_library)s "), rdescript="type name of Python nonstandard library"),
"import <python_standard_library_module>":
R(Text("import %(python_standard_library_module)s "), rdescript="import module from Python standard library"),
"import <python_library>":
R(Text("import %(python_library)s "), rdescript="important nonstandard library"),
}
extras = [
Dictation("text"),
Choice(
"python_keyword",
{
"and": "and",
"as": "as",
"assert": "assert",
"async": "async",
"await": "await",
"break": "break",
"class": "class",
"continue": "continue",
"def": "def",
"del": "del",
"else if": "elif",
"else": "else",
"except": "except",
"finally": "finally",
"for": "for",
"from": "from",
"global": "global",
"if": "if",
"import": "import",
"in": "in",
"is": "is",
"lambda": "lambda",
"non local": "nonlocal",
"not": "not",
"or": "or",
"pass": "pass",
"raise": "raise",
"return": "return",
"try": "try",
"while": "while",
"with": "with",
"yield": "yield",
},
),
Choice(
"unary_meth", {"reper": "repr", "stir": "str", "len": "len", "name": "name",
"Unicode": "unicode", "size of": "sizeof", "dir": "dir", "int": "int"}
),
Choice("binary_meth", {"add": "add", "subtract": "sub", "equal": "eq",
"strict less": "lt", "strict greater": "gt", "less equal": "le", "greater equal": "ge" }),
Choice(
"exception",
{
"exception": "Exception",
"stop iteration": "StopIteration",
"system exit": "SystemExit",
"standard": "StandardError",
"arithmetic": "ArithmeticError",
"overflow": "OverflowError",
"floating-point": "FloatingPointError",
"zero division": "ZeroDivisionError",
"assertion": "AssertionError",
"EOF": "EOFError",
"import": "ImportError",
"keyboard interrupt": "KeyboardInterrupt",
"lookup": "LookupError",
"index": "IndexError",
"key": "KeyError",
"name": "NameError",
"unbound local": "UnboundLocalError",
"environment": "EnvironmentError",
"IO": "IOError",
"OS": "OSError",
"syntax": "SyntaxError",
"system exit": "SystemExit",
"type": "TypeError",
"value": "ValueError",
"runtime": "RuntimeError",
"not implemented": "NotImplementedError",
"tab error": "TabError",
},
),
Choice(
"python_builtin",
{
"I PYTHON": "__IPYTHON__",
"build class": "__build_class__",
"debug": "__debug__",
"doc": "__doc__",
"import": "__import__",
"loader": "__loader__",
"name": "__name__",
"package": "__package__",
"spec": "__spec__",
"abs": "abs",
"all": "all",
"any": "any",
"ascii": "ascii",
"bin": "bin",
"bool": "bool",
"breakpoint": "breakpoint",
"bytearray": "bytearray",
"bytes": "bytes",
"callable": "callable",
"chr": "chr",
"classmethod": "classmethod",
"compile": "compile",
"complex": "complex",
"copyright": "copyright",
"credits": "credits",
"del atter": "delattr",
"dict": "dict",
"dir": "dir",
"display": "display",
"divmod": "divmod",
"enumerate": "enumerate",
"eval": "eval",
"exec": "exec",
"filter": "filter",
"float": "float",
"format": "format",
"frozen set": "frozenset",
"get ipython": "get_ipython",
"get atter": "getattr",
"globals": "globals",
"has atter": "hasattr",
"hash": "hash",
"help": "help",
"hex": "hex",
"id": "id",
"input": "input",
"int": "int",
"is instance": "isinstance",
"is subclass": "issubclass",
"iter": "iter",
"len": "len",
"license": "license",
"list": "list",
"locals": "locals",
"map": "map",
"max": "max",
"memory view": "memoryview",
"min": "min",
"next": "next",
"object": "object",
"oct": "oct",
"open": "open",
"ord": "ord",
"pow": "pow",
"print": "print",
"property": "property",
"range": "range",
"repr": "repr",
"reversed": "reversed",
"round": "round",
"set": "set",
"set atter": "setattr",
"slice": "slice",
"sorted": "sorted",
"static method": "staticmethod",
"stir": "str",
"sum": "sum",
"super": "super",
"tuple": "tuple",
"type": "type",
"vars": "vars",
"zip": "zip",
},
),
Choice(
"python_standard_library_module",
{
"string": "string",
"regex": "re",
"diff lib": "difflib",
"text wrap": "textwrap",
"unicode data": "unicodedata",
"struct": "struct",
"codecs": "codecs",
"date time": "datetime",
"collections": "collections",
"heap que": "heapq",
"bisect": "bisect",
"weak ref": "weakref",
"types": "types",
"copy": "copy",
"pretty print": "pprint",
"enum": "enum",
"numbers": "numbers",
"math": "math",
"decimal": "decimal",
"fractions": "fractions",
"itertools": "itertools",
"function tools": "functools",
"operator": "operator",
"path lib": "pathlib",
"temp file": "tempfile",
"glob": "glob",
"line cache": "linecache",
"shutil": "shutil",
"pickle": "pickle",
"sqlite 3": "sqlite3",
"zip file": "zipfile",
"tar file": "tarfile",
"CSV": "csv",
"config parser": "configparser",
"hash lib": "hashlib",
"secrets": "secrets",
"OS": "os",
"IO": "io",
"time": "time",
"arg parse": "argparse",
"logging": "logging",
"get pass": "getpass",
"platform": "platform",
"C types": "ctypes",
"threading": "threading",
"multiprocessing": "multiprocessing",
"concurrent": "concurrent",
"concurrent futures": "concurrent.futures",
"subprocess": "subprocess",
"queue": "queue",
"context vars": "contextvars",
"asyncio": "asyncio",
"json": "json",
"base64": "base64",
"bin ascky": "binascii",
"url lib parse": "urllib.parse",
"get text": "gettext",
"locale": "locale",
"shlex": "shlex",
"typing": "typing",
"unit test": "unittest",
"time it": "timeit",
"trace": "trace",
"dist utils": "distutils",
"zip app": "zipapp",
"sys": "sys",
"builtins": "builtins",
"warnings": "warnings",
"data classes": "dataclasses",
"context lib": "contextlib",
"ABC": "abc",
"atexit": "atexit",
"traceback": "traceback",
"future": "__future__",
"GC": "gc",
"inspect": "inspect",
"site": "site",
"import lib": "importlib",
"ast": "ast",
"token": "token",
"tokenize": "tokenize",
"dis": "dis",
},
),
Choice("python_library", {
"Requests": "Requests",
"skappy": "Scapy",
"w x Python": "wxPython",
"Pillow": "Pillow",
"SQL Alchemy": "SQLAlchemy",
"beautiful soup": "BeautifulSoup",
"Twisted": "Twisted",
"num pie": "NumPy",
"sigh pie": "SciPy",
"mat plot lib": "matplotlib",
"pie game": "Pygame",
"Piglet": "Pyglet",
"pie QT": "pyQT",
"pandas": "pandas",
"kivy": "kivy",
"jango": "Django",
"click": "click"
}),
]
defaults = {"unary_meth": "", "binary_meth": "", "exception": ""}
control.nexus().merger.add_global_rule(Python(ID=100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment