1

I am trying to configure yapf so that arguments and the like are all in the same line but I am not sure how to get that effect, so far all I see are the arguments of functions on the same line but it doesn't work for everything.

This is what I have, for example:

    def __enter__(self,
                  myfunc=123,
                  func2=LA.DS
        ):

        self.a_d = hash(
            '{}{}'.format(
                self.123, self.name
            )
        )
        self.pub_id = myfunc(
                                    str(self.id23).\
                                    encode('utf8')).\
            dosmth()

        self.acquired = self._acquire( )

    return Info1(self,
                        self.3,
                        self.2,
                        self.1,
                        self.4,
                        self.ttl,
                        self.acquired, self.type, self.block, self.b_interval)

This is how I want it to look:

    def __enter__(self, myfunc=123, func2=LA.DS):

        self.a_d = hash('{}{}'.format(self.123, self.name))
        self.pub_id = myfunc(str(self.id23).encode('utf8')).dosmth()

        self.acquired = self._acquire()

        return Info(self, self.1, self.2, self.3, self.4, self.5, self.acquired, self.type, self.2, self.interval)

I tried these so far but they don't work for my case:

yapf --in-place --recursive --style="{ SPLIT_BEFORE_FIRST_ARGUMENT: False}" 3.py

yapf --in-place --recursive --style="{based_on_style: pep8; SPLIT_ALL_COMMA_SEPARATED_VALUES: False, SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED: False}" 2.py

I am not sure yapf can do what I want so if anyone knows what knob to use and the like, it'd be a huge help.

dazai
  • 766
  • 4
  • 25

1 Answers1

0

have you tried the column_limit option? for example in your .style.yapf file, put

[style]
column_limit=180

then rerun the yapf command

Yanwt
  • 27
  • 1
  • 6