Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: GitHub noreply@github.com Date: Sun, 22 May 2022 14:40:12 UTC Commit: 6c0b48c809bd91fa0ea3cc5062feb3b78b1ad624 https://github.com/geany/geany/commit/6c0b48c809bd91fa0ea3cc5062feb3b78b1ad6...
Log Message: ----------- Merge pull request #2924 from eht16/update_python_identifiers_py3_only
Generate Python identifiers only for Python 3
Modified Paths: -------------- data/filedefs/filetypes.python.in scripts/update-python-identifiers.sh
Modified: data/filedefs/filetypes.python.in 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -25,11 +25,11 @@ ftripledouble=string_2 [keywords] # all items must be in one line # both primary and identifiers are auto-generated by scripts/update-python-identifiers.sh -# Python 2&3 keywords -primary=False None True and as assert async await break class continue def del elif else except exec finally for from global if import in is lambda nonlocal not or pass print raise return try while with yield +# Python 3 keywords +primary=False None True __peg_parser__ and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield # additional keywords, will be highlighted with style "word2" -# Python 2&3 builtins (minus ones in primary) -identifiers=ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError DeprecationWarning EOFError Ellipsis EnvironmentError Exception FileExistsError FileNotFoundError FloatingPointError FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError NotADirectoryError NotImplemented NotImplementedError OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning StandardError StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__ abs all any apply ascii basestring bin bool breakpoint buffer bytearray bytes callable chr classmethod cmp coerce compile complex copyright credits delattr dict dir divmod enumerate eval execfile exit file filter float format frozenset getattr globals hasattr hash help hex id input int intern isinstance issubclass iter len license list locals long map max memoryview min next object oct open ord pow property quit range raw_input reduce reload repr reversed round set setattr slice sorted staticmethod str sum super tuple type unichr unicode vars xrange zip +# Python 3 builtins (minus ones in primary) +identifiers=ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError DeprecationWarning EOFError Ellipsis EnvironmentError Exception FileExistsError FileNotFoundError FloatingPointError FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError NotADirectoryError NotImplemented NotImplementedError OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__ abs all any ascii bin bool breakpoint bytearray bytes callable chr classmethod compile complex copyright credits delattr dict dir divmod enumerate eval exec exit filter float format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len license list locals map max memoryview min next object oct open ord pow print property quit range repr reversed round set setattr slice sorted staticmethod str sum super tuple type vars zip
[lexer_properties] fold.quotes.python=1
Modified: scripts/update-python-identifiers.sh 16 lines changed, 6 insertions(+), 10 deletions(-) =================================================================== @@ -3,31 +3,27 @@ # Author: Colomban Wendling colomban@geany.org # License: GPL v2 or later # -# Updates the `identifiers` entry in data/filetypes.python. -# Requires both Python 2 and 3. +# Updates the `identifiers` entry in data/filetypes.python.in. +# Requires Python 3.
set -e
-file=data/filedefs/filetypes.python +file=data/filedefs/filetypes.python.in
[ -f "$file" ]
-py_2_and_3() { - python2 "$@" && python3 "$@" -} - # sort_filter [exclude...] sort_filter() { - python -c '\ + python3 -c '\ from sys import stdin; \ items=set(stdin.read().strip().split("\n")); \ exclude=['"$(for a in "$@"; do printf "'%s', " "$a"; done)"']; \ print(" ".join(sorted([i for i in items if i not in exclude]))) ' }
-keywords=$(py_2_and_3 -c 'from keyword import kwlist; print("\n".join(kwlist))') -builtins=$(py_2_and_3 -c 'print("\n".join(dir(__builtins__)))') +keywords=$(python3 -c 'from keyword import kwlist; print("\n".join(kwlist))') +builtins=$(python3 -c 'print("\n".join(dir(__builtins__)))')
primary=$(echo "$keywords" | sort_filter) # builtins, but excluding keywords that are already listed in primary=
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).