
    `N`T                     >    d Z ddlmZ  eddh          Zd	dZd ZdS )
aD  Join unwrapped lines together.

Determine how many lines can be joined into one line. For instance, we could
join these statements into one line:

  if a == 42:
    continue

like this:

  if a == 42: continue

There are a few restrictions:

  1. The lines should have been joined in the original source.
  2. The joined lines must not go over the column boundary if placed on the same
     line.
  3. They need to be very simple statements.

Note: Because we don't allow the use of a semicolon to separate statements, it
follows that there can only be at most two lines to join.
    )styledefclassFc                    | d         j         t          j        d          z  }t          |           dk    s|t          j        d          k    rdS t          |           dk    r:| d         j         | d         j         k    r| d         j         | d         j         k    rdS | d         j        j        t          v rdS t          j        d          |z
  }| d         j        j        |k     ra|| d         j        j        z  }| d         j        j        dk    rt          | |          S |r$| d         j        j        d	v rt          | |          S dS )
a  Determine if multiple lines can be joined into one.

  Arguments:
    lines: (list of UnwrappedLine) This is a splice of UnwrappedLines from the
      full code base.
    last_was_merged: (bool) The last line was merged.

  Returns:
    True if two consecutive lines can be joined together. In reality, this will
    only happen if two consecutive lines can be joined, due to the style guide.
  r   INDENT_WIDTH   COLUMN_LIMITF      if>   elifelse)
depthr   Getlenfirstvalue_CLASS_OR_FUNClasttotal_length_CanMergeLineIntoIfStatement)lineslast_was_merged
indent_amtlimits       8lib/python3.11/site-packages/yapf/yapflib/line_joiner.pyCanMergeMultipleLinesr   *   s4    Qx~	. 9 99*ZZ1__
UY~%>%>>>5	%jjAoo%(.E!HN::Ahna&&
 5
1X^^++5
)N
#
#j
0%
1X]%''	U1X]''EQx~t##)%777 858>/3CCC)%777 
    c                     t          | d         j                  dk    r| d         j        j        rdS | d         j        | d         j        k    rdS | d         j        j        |k    rdS t          j        d          S )a  Determine if we can merge a short if-then statement into one line.

  Two lines of an if-then statement can be merged if they were that way in the
  original source, fit on the line without going over the column limit, and are
  considered "simple" statements --- typically statements like 'pass',
  'continue', and 'break'.

  Arguments:
    lines: (list of UnwrappedLine) The lines we are wanting to merge.
    limit: (int) The amount of space remaining on the line.

  Returns:
    True if the lines can be merged, False otherwise.
  r   Tr   FJOIN_MULTIPLE_LINES)r   tokensr   is_multiline_stringlinenor   r   r   )r   r   s     r   r   r   U   sv     	qQ58=#D4
1X_a''5
1X]5((5	(	)	))r   N)F)__doc__yapf.yapflibr   	frozensetr   r   r    r   r   <module>r(      se    .      E7+,,( ( ( (V* * * * *r   