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.

Force function arguments on their own lines when splitting anway

See original GitHub issue
def _sync_class_booking(raw_class: Dict,
                        fitness_person: FitnessPerson,
                        booking_provider: BookingProvider,
                        payment_provider: PaymentProvider):

went to this:

def _sync_class_booking(raw_class: Dict, fitness_person: FitnessPerson, booking_provider: BookingProvider,
                        payment_provider: PaymentProvider):

when running yapf -i --style='{based_on_style: pep8, column_limit: 120}'. It’s desirable to leave this unchanged. The rule would be, in plain English, “put function arguments on their own lines if they won’t all fit on one line”. I’ve attempted to get this working with the current settings but did not find a solution.

yapf verison: 0.7.0

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
leandrotoledocommented, May 23, 2016
diff --git a/telegram/bot.py b/telegram/bot.py
index 3147f2e..ae9a8ad 100644
--- a/telegram/bot.py
+++ b/telegram/bot.py
@@ -606,13 +606,14 @@ class Bot(TelegramObject):

     @log
     @message
-    def sendVenue(
-            self, chat_id,
-            latitude,
-            longitude,
-            title, address,
-            foursquare_id=None,
-            **kwargs):
+    def sendVenue(self,
+                  chat_id,
+                  latitude,
+                  longitude,
+                  title,
+                  address,
+                  foursquare_id=None,
+                  **kwargs):

Awesome! Thank you very much @gwelymernans!

4reactions
bwendlingcommented, May 15, 2016

@lexicalunit If you add a comma at the end of the list, then it remains the same. Otherwise, I don’t know if we can do much here.

$ python -m yapf --style='{base_on_style: pep8, column_limit: 120}' < /tmp/x.py
def _sync_class_booking(raw_class: Dict,
                        fitness_person: FitnessPerson,
                        booking_provider: BookingProvider,
                        payment_provider: PaymentProvider,):
  pass
Read more comments on GitHub >

github_iconTop Results From Across the Web

Define functions with too many arguments to abide by PEP8 ...
Having each argument on one line makes it very simple to use git diff s, since changing one variable will only show that...
Read more >
function-call-argument-newline - Pluggable JavaScript Linter
This rule enforces line breaks between arguments of a function call. Options. This rule has a string option: "always" (default) requires line breaks...
Read more >
What is the reason for splitting a C function's return type and ...
Two decent reasons people will break the return type from the function name in a declaration or definition. · 1. They like being...
Read more >
The Black code style - Black 22.12.0 documentation
Black will add trailing commas to expressions that are split by comma where each element is on its own line. This includes function...
Read more >
How can I split an equation over two (or more) lines - TeX
Use either breqn to break lines automatically or use amsmath and its many environments exactly for this purpose. For example, with breqn:
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