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

Treat functions/classes in blocks as if they're nested #2472

Merged
merged 6 commits into from Dec 1, 2021

Commits on Sep 2, 2021

  1. Treat functions/classes in blocks as if they're nested

    One curveball is that we still want two preceding newlines before blocks
    that are probably logically disconnected. In other words:
    
        if condition:
    
            def foo():
                return "hi"
                                 # <- aside: this is the goal of this commit
        else:
    
            def foo():
                return "cya"
                                 # <- the two newlines spacing here should stay
                                 #    since this probably isn't related
        with open("db.json", encoding="utf-8") as f:
            data = f.read()
    
    Unfortunately that means we have to special case specific clause types
    instead of just being able to just for a colon leaf. The hack used here
    is to check whether we're adding preceding newlines for a standalone or
    dependent clause. "Standalone" being a clause that doesn't need another
    clause to be valid (eg. if) and vice versa.
    ichard26 committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    895695b View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2021

  1. Minor edits to comment

    Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
    ichard26 and JelleZijlstra committed Sep 25, 2021
    Configuration menu
    Copy the full SHA
    fe9d927 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    26d00d4 View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2021

  1. Configuration menu
    Copy the full SHA
    568d9eb View commit details
    Browse the repository at this point in the history
  2. Add match statement

    ichard26 committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    4f81c1d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4253c26 View commit details
    Browse the repository at this point in the history