FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-148991: Add colour to `tokenize` CLI output by hugovk · Pull Request #148992 · python/cpython · GitHub

Repository navigation

gh-148991: Add colour to tokenize CLI output - #148992

Merged
hugovk merged 5 commits into
python:mainfrom
hugovk:3.15-tokenize-colour
Apr 26, 2026
Merged

hugovk merged 5 commits into
python:mainfrom
hugovk:3.15-tokenize-colour

Conversation

hugovk commented Apr 25, 2026 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

For example, given this script which has a bit of everything:

Details
# A comment

x = 42
y = 3.14
z = 2 + 3j
name = "hello"
raw = b"bytes"
f_str = f"value: {x}"
t_str = t"template: {x}"

match x:
    case 1:
        pass

for i in range(10):
    if i % 2 == 0:
        print(i)

def greet(name: str = "world") -> None:
    ...

class Foo:
    @staticmethod
    def bar(a, b=True, *args, **kwargs):
        return a + b

lambda x: x * 2

result = [i**2 for i in range(5)]
mapping = {"key": "value", 1: None}
s = {1, 2, 3}
t = (1,)

try:
    1 / 0
except ZeroDivisionError as e:
    raise ValueError("oops") from e

async def main():
    await something()
    async for item in aiter():
        yield item

a = x if x > 0 else -x
b = x | y & z ^ ~x
c = x << 1 >> 2
d: int
e += 1  # type: ignore

📚 Documentation preview 📚: https://cpython-previews--148992.org.readthedocs.build/

Comment thread Lib/tokenize.py Outdated
Co-authored-by: Stan Ulbrych <stan@python.org>

StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

hugovk merged commit 1e7dfbc into python:main Apr 26, 2026
150 of 152 checks passed
hugovk deleted the 3.15-tokenize-colour branch April 26, 2026 19:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL