question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add knob to never ever break line after "'dictkey':"

See original GitHub issue

Currently if one or more of dict’s entries are longer than column_limit (or simply contain multiline string), yapf will break line after all dict’s keys in dict.

I’ve tried disabling indent_dictionary_value but this makes yapf just align value right under key, which is something I dislike more than breaking line and inlining value 😉

Eventually, I’ve developed custom utility for my project that performs my way cleanup after yapf, but after 12h of programmering I can’t help but feel that its hacky and fragile, which is why I’m opening ticket here.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:20 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
Daenythcommented, Mar 18, 2017

Yes, I’d want that to not split, or if it does, it should be the only key that splits. The problem is right now you go from this:

X = {
    'a': 1,
    'b': 2,
    'key': this_is_a_function_call_that_goes_over_the_column_limit_im_pretty_sure()
}

to this:

X = {
    'a': 
        1,
    'b': 
        2,
    'key': 
        this_is_a_function_call_that_goes_over_the_column_limit_im_pretty_sure()
}

Where I’d prefer either not splitting that line at all, or

X = {
    'a': 1,
    'b': 2,
    'key': 
        this_is_a_function_call_that_goes_over_the_column_limit_im_pretty_sure()
}
3reactions
mikelambertcommented, Jun 11, 2017

@gwelymernans , any plans to integrate https://github.com/google/yapf/commit/848efddd27a8547ecce0876eeed12c197a3d4234 -et-al? Or should I not expect that to reach master?

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Proper way of breaking line accessing dictionary
I am try to conform to pep8 directives and therefore to break the following line: config_data_dict[ ...
Read more >
Python Add to Dictionary [Easy Step-By-Step] - DigitalOcean
Since Python dictionaries are mutable, when you use the assignment operator, you're simply adding new keys to the datastructure. dict[key] = ...
Read more >
Dictionaries in Python - Real Python
In this Python dictionaries tutorial, you'll cover the basic characteristics and learn how to access and manage dictionary data. Once you have finished...
Read more >
sec_E_SB_ELA_G8.pdf - TN.gov
45 But if he beat a sure, steady, ever faster rhythm, then, then their knees would come up in a long line down...
Read more >
Anagram Solver - Decode & Find All Solutions | WordFinder®
Our free anagram solver is exactly what you need to unscramble letters and form new words. This easy-to-use tool will work its magic...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found