[geany/geany] 36f751: Generate Python identifiers only for Python 3

Enrico Tröger git-noreply at geany.org
Sun May 22 14:42:32 UTC 2022


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 10 Oct 2021 14:42:15 UTC
Commit:      36f7511173c251db14615a17af464cd63a75e98d
             https://github.com/geany/geany/commit/36f7511173c251db14615a17af464cd63a75e98d

Log Message:
-----------
Generate Python identifiers only for Python 3

Python 2 is EOL since almost two years now, so remove Python2 keywords
and simplify the script to generate them.


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
14 lines changed, 5 insertions(+), 9 deletions(-)
===================================================================
@@ -3,31 +3,27 @@
 # Author:  Colomban Wendling <colomban at 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.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).


More information about the Commits mailing list