Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation Bug: constant dictionary #144

Open
Wsine opened this issue Jul 12, 2022 · 1 comment
Open

Indentation Bug: constant dictionary #144

Wsine opened this issue Jul 12, 2022 · 1 comment

Comments

@Wsine
Copy link

Wsine commented Jul 12, 2022

A minimal example is as below. every step I only type o to trigger to indentation.

Animation

import logging

# from: https://stackoverflow.com/a/56944256
class CustomFormatter(logging.Formatter):
    GREY = "\x1b[38;20m"
    YELLOW = "\x1b[33;20m"
    BLUE = "\x1b[34;20m"
    RED = "\x1b[31;20m"
    BOLD_RED = "\x1b[31;1m"
    RESET = "\x1b[0m"
    CONTENT = "%(levelname)s - %(message)s (%(filename)s:%(lineno)d)"

    FORMATS = {
        logging.DEBUG: BLUE + CONTENT + RESET,
        logging.INFO: GREY + CONTENT + RESET,
        logging.WARNING: YELLOW + CONTENT + RESET,
        logging.ERROR: RED + CONTENT + RESET,
        logging.CRITICAL: BOLD_RED + CONTENT + RESET
    }

    def format(self, record):
        log_fmt = self.FORMATS.get(record.levelno)
        formatter = logging.Formatter(log_fmt)
        return formatter.format(record)
@vilari-mickopf
Copy link

"\x1b[38;20m" line is enough actually to recreate this issue.
I think there is a problem with parsing brackets inside of strings (regardless of escape chars). Another issue that I have is with curly brackets:

var = 0
f'{var} {{'

Or even this

asd = '{'

This will also create the same issue and it's really annoying.

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

No branches or pull requests

2 participants