Skip to content

dedent is not working properly with tab indent #4869

@felixxm

Description

@felixxm

utils.formatting.dedent is not working properly with tab indent. whitespace_counts contains number of spaces from the beginning of each line (see formatting.py#L35), if string doesn't contain spaces then it is equal to [0,0,0,...,0] which is always true (see formatting.py#L45), hence it will never go to tab stripping.

Steps to reproduce

>>> dedent("first string\n\n\tsecond string")

Expected behavior

>>> "first string\n\nsecond string"

Actual behavior

>>> "first string\n\n\tsecond string"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy