
    `N`l                         d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ  G d dej	                  Z
 G d	 d
ej	                  Z G d dej	                  Zedk    r ej                     dS dS )z PEP8 tests for yapf.reformatter.    N)	py3compat)reformatter)style)yapf_test_helperc                      e Zd Zed             Zd Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z  e!j"        e#j$         d          d             Z%d  Z&d!S )"TestsForPEP8Stylec                 P    t          j        t          j                               d S )N)r   SetGlobalStyleCreatePEP8Style)clss    ?lib/python3.11/site-packages/yapftests/reformatter_pep8_test.py
setUpClasszTestsForPEP8Style.setUpClass   s"    	.0011111    c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz'        if a+b:
          pass
        z+        if a + b:
            pass
        textwrapdedentr   ParseAndUnwrapassertCodeEqualr   Reformatselfunformatted_codeexpected_formatted_codeuwliness       r   testIndent4zTestsForPEP8Style.testIndent4    m     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzP        if True: a = 42
        elif False: b = 42
        else: c = 42
        r   r   coder   s      r   testSingleLineIfStatementsz,TestsForPEP8Style.testSingleLineIfStatements,   Q    ?   D
 -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzB        class Foo:

          def joe():
            pass
        zG        class Foo:
            def joe():
                pass
        r   r   s       r   testNoBlankBetweenClassAndDefz/TestsForPEP8Style.testNoBlankBetweenClassAndDef5   sm     (   'o /  
 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        class TestClass:
            def __init__(self):
                self.running = False
            def run(self):
                """Override in subclass"""
            def is_running(self):
                return self.running
        z        class TestClass:
            def __init__(self):
                self.running = False

            def run(self):
                """Override in subclass"""

            def is_running(self):
                return self.running
        r   r   s       r   testNoBlankBetweenDefsInClassz/TestsForPEP8Style.testNoBlankBetweenDefsInClassD   sm     (   'o 
/ 
 
 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz1        if a+b: # comment
          pass
        z6        if a + b:  # comment
            pass
        r   r   s       r   $testSingleWhiteBeforeTrailingCommentz6TestsForPEP8Style.testSingleWhiteBeforeTrailingComment\   r   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz/        a = (
            1,
        )
        z        a = (1, )
        r   r   s       r   .testSpaceBetweenEndingCommandAndClosingBracketz@TestsForPEP8Style.testSpaceBetweenEndingCommandAndClosingBracketh   sm     (  
 'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        class eld(d):
            if str(geom.geom_type).upper(
            ) != self.geom_type and not self.geom_type == 'GEOMETRY':
                ror(code='om_type')
        r   r   s      r   testContinuedNonOutdentedLinez/TestsForPEP8Style.testContinuedNonOutdentedLinet   sQ    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          def f():
            if True:
                zzzzz = '%s-%s' % (xxxxxxxxxxxxxxxxxxxxxxxxxx + 1, xxxxxxxxxxxxxxxxx.yyy + 1)
                zzzzz = '%s-%s'.ww(xxxxxxxxxxxxxxxxxxxxxxxxxx + 1, xxxxxxxxxxxxxxxxx.yyy + 1)
                zzzzz = '%s-%s' % (xxxxxxxxxxxxxxxxxxxxxxx + 1, xxxxxxxxxxxxxxxxxxxxx + 1)
                zzzzz = '%s-%s'.ww(xxxxxxxxxxxxxxxxxxxxxxx + 1, xxxxxxxxxxxxxxxxxxxxx + 1)
        a,          def f():
            if True:
                zzzzz = '%s-%s' % (xxxxxxxxxxxxxxxxxxxxxxxxxx + 1,
                                   xxxxxxxxxxxxxxxxx.yyy + 1)
                zzzzz = '%s-%s'.ww(xxxxxxxxxxxxxxxxxxxxxxxxxx + 1,
                                   xxxxxxxxxxxxxxxxx.yyy + 1)
                zzzzz = '%s-%s' % (xxxxxxxxxxxxxxxxxxxxxxx + 1,
                                   xxxxxxxxxxxxxxxxxxxxx + 1)
                zzzzz = '%s-%s'.ww(xxxxxxxxxxxxxxxxxxxxxxx + 1,
                                   xxxxxxxxxxxxxxxxxxxxx + 1)
        r   r   s       r   testWrappingPercentExpressionsz0TestsForPEP8Style.testWrappingPercentExpressions~   sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                    t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        TEST_LIST = ('foo', 'bar',  # first comment
                     'baz'  # second comment
                    )
        z        TEST_LIST = (
            'foo',
            'bar',  # first comment
            'baz'  # second comment
        )
        z        def f():

          def g():
            while (xxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa' and
                   xxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == 'bbbbbbb'
                  ):
              pass
        a          def f():
            def g():
                while (xxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa'
                       and xxxxxxxxxxxxxxxxxxxx(
                           yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == 'bbbbbbb'):
                    pass
        r   r   s       r   ,testAlignClosingBracketWithVisualIndentationz>TestsForPEP8Style.testAlignClosingBracketWithVisualIndentation   s     (  
 'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nzq        if True:
          runtime_mins = (program_end_time - program_start_time).total_seconds() / 60.0
        z        if True:
            runtime_mins = (program_end_time -
                            program_start_time).total_seconds() / 60.0
        r   r   s       r   testIndentSizeChangingz(TestsForPEP8Style.testIndentSizeChanging   m     (   'o /  
 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nae          if (aaaaaaaaaaaaaa + bbbbbbbbbbbbbbbb == ccccccccccccccccc and xxxxxxxxxxxxx or yyyyyyyyyyyyyyyyy):
            pass
        elif (xxxxxxxxxxxxxxx(aaaaaaaaaaa, bbbbbbbbbbbbbb, cccccccccccc, dddddddddd=None)):
            pass


        def h():
            if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'):
                pass

            for connection in itertools.chain(branch.contact, branch.address, morestuff.andmore.andmore.andmore.andmore.andmore.andmore.andmore):
                dosomething(connection)
        a          if (aaaaaaaaaaaaaa + bbbbbbbbbbbbbbbb == ccccccccccccccccc and xxxxxxxxxxxxx
                or yyyyyyyyyyyyyyyyy):
            pass
        elif (xxxxxxxxxxxxxxx(aaaaaaaaaaa,
                              bbbbbbbbbbbbbb,
                              cccccccccccc,
                              dddddddddd=None)):
            pass


        def h():
            if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and
                    xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'):
                pass

            for connection in itertools.chain(
                    branch.contact, branch.address,
                    morestuff.andmore.andmore.andmore.andmore.andmore.andmore.andmore):
                dosomething(connection)
        r   r   s       r   testHangingIndentCollisionz,TestsForPEP8Style.testHangingIndentCollision   sm     (   'o /  * -.>??G0+2Fw2O2OPPPPPr   c                    	 t          j        t          j        d                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz;{based_on_style: pep8, split_before_logical_operator: True}aG            def foo():
              return bool(update.message.new_chat_member or update.message.left_chat_member or
                          update.message.new_chat_title or update.message.new_chat_photo or
                          update.message.delete_chat_photo or update.message.group_chat_created or
                          update.message.supergroup_chat_created or update.message.channel_chat_created
                          or update.message.migrate_to_chat_id or update.message.migrate_from_chat_id or
                          update.message.pinned_message)
          ah            def foo():
              return bool(
                  update.message.new_chat_member or update.message.left_chat_member
                  or update.message.new_chat_title or update.message.new_chat_photo
                  or update.message.delete_chat_photo
                  or update.message.group_chat_created
                  or update.message.supergroup_chat_created
                  or update.message.channel_chat_created
                  or update.message.migrate_to_chat_id
                  or update.message.migrate_from_chat_id
                  or update.message.pinned_message)
          r   r
   CreateStyleFromConfigr   r   r   r   r   r   r   r   r   s       r   "testSplittingBeforeLogicalOperatorz4TestsForPEP8Style.testSplittingBeforeLogicalOperator   s    4

%KM MN N N " *   !) 1 ! ! !/0@AAg
2&/88: : : 502233333e50223333   B
B3 3'Cc                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        if True:
            if True:
                keys.append(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)  # may be unassigned.
        z        if True:
            if True:
                keys.append(
                    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)  # may be unassigned.
        r   r   s       r   #testContiguousListEndingWithCommentz5TestsForPEP8Style.testContiguousListEndingWithComment  sm     (  
 'o /   -.>??G0+2Fw2O2OPPPPPr   c                    	 t          j        t          j        d                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz9{based_on_style: pep8, split_before_first_argument: True}z          a_very_long_function_name(long_argument_name_1=1, long_argument_name_2=2,
                                    long_argument_name_3=3, long_argument_name_4=4)
          z          a_very_long_function_name(
              long_argument_name_1=1,
              long_argument_name_2=2,
              long_argument_name_3=3,
              long_argument_name_4=4)
          r7   r   s       r    testSplittingBeforeFirstArgumentz2TestsForPEP8Style.testSplittingBeforeFirstArgument  s    4

%IK KL L L " *   !) 1 ! ! !/0@AAg
2&/88: : : 502233333e50223333r:   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nzt        def foo():
            df = df[(df['campaign_status'] == 'LIVE') & (df['action_status'] == 'LIVE')]
        z        def foo():
            df = df[(df['campaign_status'] == 'LIVE')
                    & (df['action_status'] == 'LIVE')]
        r   r   s       r   (testSplittingExpressionsInsideSubscriptsz:TestsForPEP8Style.testSplittingExpressionsInsideSubscripts4  r3   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        DJANGO_TEMPLATES_OPTIONS = {"context_processors": []}
        DJANGO_TEMPLATES_OPTIONS = {"context_processors": [],}
        x = ["context_processors"]
        x = ["context_processors",]
        z        DJANGO_TEMPLATES_OPTIONS = {"context_processors": []}
        DJANGO_TEMPLATES_OPTIONS = {
            "context_processors": [],
        }
        x = ["context_processors"]
        x = [
            "context_processors",
        ]
        r   r   s       r   /testSplitListsAndDictSetMakersIfCommaTerminatedzATestsForPEP8Style.testSplitListsAndDictSetMakersIfCommaTerminatedA  sm     (   'o 	/ 	 	 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        class a():
            def a(): return a(
             aaaaaaaaaa=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
        z        class a():
            def a():
                return a(
                    aaaaaaaaaa=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                )
        r   r   s       r   testSplitAroundNamedAssignsz-TestsForPEP8Style.testSplitAroundNamedAssignsU  sm     (  
 'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzX        if not -3 < x < 3:
          pass
        if -3 < x < 3:
          pass
        z\        if not -3 < x < 3:
            pass
        if -3 < x < 3:
            pass
        r   r   s       r   testUnaryOperatorz#TestsForPEP8Style.testUnaryOperatore  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                    	 t          j        t          j        d                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d	          }t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)
Nz{based_on_style: pep8, allow_split_before_dict_value: false, coalesce_brackets: true, dedent_closing_brackets: true, each_dict_entry_on_separate_line: true, split_before_logical_operator: true}z          some_dict = {
              'title': _("I am example data"),
              'description': _("Lorem ipsum dolor met sit amet elit, si vis pacem para bellum "
                               "elites nihi very long string."),
          }
          a            some_dict = {
              'title': _("I am example data"),
              'description': _(
                  "Lorem ipsum dolor met sit amet elit, si vis pacem para bellum "
                  "elites nihi very long string."
              ),
          }
          zz          X = {'a': 1, 'b': 2, 'key': this_is_a_function_call_that_goes_over_the_column_limit_im_pretty_sure()}
          z          X = {
              'a': 1,
              'b': 2,
              'key': this_is_a_function_call_that_goes_over_the_column_limit_im_pretty_sure()
          }
          z          attrs = {
              'category': category,
              'role': forms.ModelChoiceField(label=_("Role"), required=False, queryset=category_roles, initial=selected_role, empty_label=_("No access"),),
          }
          aT            attrs = {
              'category': category,
              'role': forms.ModelChoiceField(
                  label=_("Role"),
                  required=False,
                  queryset=category_roles,
                  initial=selected_role,
                  empty_label=_("No access"),
              ),
          }
          z          css_class = forms.CharField(
              label=_("CSS class"),
              required=False,
              help_text=_("Optional CSS class used to customize this category appearance from templates."),
          )
          a            css_class = forms.CharField(
              label=_("CSS class"),
              required=False,
              help_text=_(
                  "Optional CSS class used to customize this category appearance from templates."
              ),
          )
          r7   r   s       r   testNoSplitBeforeDictValuez,TestsForPEP8Style.testNoSplitBeforeDictValueu  s2   U4

% 'M N NO O O " *   !) 1 ! ! !/0@AAg
2&/88: : : " *   !) 1 ! ! !/0@AAg
2&/88: : : " *   !) 1 ! ! !/0@AAg
2&/88: : : " *   !) 1 ! ! !/0@AAg
2&/88: : : 502233333e50223333s   F6G 'Hc                     d}d}t          j        |          }|                     |t          j        |                     d S )Na  def _():
    include_values = np.where(
                (cdffile['Quality_Flag'][:] >= 5) & (
                cdffile['Day_Night_Flag'][:] == 1) & (
                cdffile['Longitude'][:] >= select_lon - radius) & (
                cdffile['Longitude'][:] <= select_lon + radius) & (
                cdffile['Latitude'][:] >= select_lat - radius) & (
                cdffile['Latitude'][:] <= select_lat + radius))
ac  def _():
    include_values = np.where(
        (cdffile['Quality_Flag'][:] >= 5) & (cdffile['Day_Night_Flag'][:] == 1)
        & (cdffile['Longitude'][:] >= select_lon - radius)
        & (cdffile['Longitude'][:] <= select_lon + radius)
        & (cdffile['Latitude'][:] >= select_lat - radius)
        & (cdffile['Latitude'][:] <= select_lat + radius))
r   r   assertEqualr   r   r   r   expected_coder   s       r   testBitwiseOperandSplittingz-TestsForPEP8Style.testBitwiseOperandSplitting  sK    	M -.>??G]K$8$A$ABBBBBr   c                     d}d}t          j        |          }|                     |t          j        |                     d S )Nzclass Demo:
    """
    Demo docs
    """
    def foo(self):
        """
        foo docs
        """
    def bar(self):
        """
        bar docs
        """
zclass Demo:
    """
    Demo docs
    """
    def foo(self):
        """
        foo docs
        """

    def bar(self):
        """
        bar docs
        """
rJ   rL   s       r   (testNoBlankLinesOnlyForFirstNestedObjectz:TestsForPEP8Style.testNoBlankLinesOnlyForFirstNestedObject  sK    M -.>??G]K$8$A$ABBBBBr   c                 r   	 t          j        t          j        d                     d}d}t          j        |          }|                     |t          j        |                     t          j        t          j                               d S # t          j        t          j                               w xY w)Nz>{based_on_style: pep8, split_before_arithmetic_operator: true}z_def _():
    raise ValueError('This is a long message that ends with an argument: ' + str(42))
ztdef _():
    raise ValueError('This is a long message that ends with an argument: '
                     + str(42))
	r   r
   r8   r   r   r   r   r   r   r   s       r   "testSplitBeforeArithmeticOperatorsz4TestsForPEP8Style.testSplitBeforeArithmeticOperators  s    4

%NP PQ Q Q!
 !/0@AAg
2&/88: : : 502233333e50223333   A&B 'B6c                     d}d}t          j        |          }|                     |t          j        |                     d S )Nzfoo([(1,1), (1,1), (1,1), (1,1), (1,1), (1,1), (1,1),
     (1,1), (1,1), (1,1), (1,1), (1,1), (1,1), (1,1),
     (1,10), (1,11), (1, 10), (1,11), (10,11)])
zfoo([(1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1),
     (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 10), (1, 11), (1, 10),
     (1, 11), (10, 11)])
)r   r   r   r   r   rL   s       r   testListSplittingz#TestsForPEP8Style.testListSplitting  sK    
M
 -.>??G(<W(E(EFFFFFr   c                 r   	 t          j        t          j        d                     d}d}t          j        |          }|                     |t          j        |                     t          j        t          j                               d S # t          j        t          j                               w xY w)NzD{based_on_style: pep8, blank_line_before_nested_class_or_def: false}zdef normal_function():
    """Return the nested function."""

    def nested_function():
        """Do nothing just nest within."""

        @nested(klass)
        class nested_class():
            pass

        pass

    return nested_function
zdef normal_function():
    """Return the nested function."""
    def nested_function():
        """Do nothing just nest within."""
        @nested(klass)
        class nested_class():
            pass

        pass

    return nested_function
rR   r   s       r   &testNoBlankLineBeforeNestedFuncOrClassz8TestsForPEP8Style.testNoBlankLineBeforeNestedFuncOrClass(  s    &4

%>? ?@ @ @
! !/0@AAg
2&/88: : : 502233333e50223333rT   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nav  class _():

    def __init__(self, title: Optional[str], diffs: Collection[BinaryDiff] = (), charset: Union[Type[AsciiCharset], Type[LineCharset]] = AsciiCharset, preprocess: Callable[[str], str] = identity,
            # TODO(somebody): Make this a Literal type.
            justify: str = 'rjust'):
        self._cs = charset
        self._preprocess = preprocess
        a  class _():
    def __init__(
            self,
            title: Optional[str],
            diffs: Collection[BinaryDiff] = (),
            charset: Union[Type[AsciiCharset],
                           Type[LineCharset]] = AsciiCharset,
            preprocess: Callable[[str], str] = identity,
            # TODO(somebody): Make this a Literal type.
            justify: str = 'rjust'):
        self._cs = charset
        self._preprocess = preprocess
        r   r   s       r   "testParamListIndentationCollision1z4TestsForPEP8Style.testParamListIndentationCollision1Q  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def simple_pass_function_with_an_extremely_long_name_and_some_arguments(
                argument0, argument1):
            pass
        r   r   s      r   "testParamListIndentationCollision2z4TestsForPEP8Style.testParamListIndentationCollision2l  r"   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def func1(
            arg1,
            arg2,
        ) -> None:
            pass


        def func2(
            arg1,
            arg2,
        ):
            pass
        r   r   s      r   "testParamListIndentationCollision3z4TestsForPEP8Style.testParamListIndentationCollision3u  sQ    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl is not ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj)
        _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl not in {ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj})
        z        _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl
             is not ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj)
        _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl
             not in {ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj})
        r   r   s       r   testTwoWordComparisonOperatorsz0TestsForPEP8Style.testTwoWordComparisonOperators  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   zRequires Python 2.7c                     t          j        d          }t          j        |          }|                     |t          j        |d                     d S )Nz        from util import async


        class A(object):
            def foo(self):
                async.run()

            def bar(self):
                pass
        F)verifyr   r   s      r   testAsyncAsNonKeywordz'TestsForPEP8Style.testAsyncAsNonKeyword  sX     ? 
 
 
D -d33G{3GEJJJKKKKKr   c                 N   t          j        d          }t          j        d          }t          j        |          }t	          j        |          }|                     ||           t          j        |          }t	          j        |          }|                     ||           d S )Nz        def _():
            url = "http://{0}/axis-cgi/admin/param.cgi?{1}".format(
                value, urllib.urlencode({'action': 'update', 'parameter': value}))
        z        def _():
            url = "http://{0}/axis-cgi/admin/param.cgi?{1}".format(
                value, urllib.urlencode({
                    'action': 'update',
                    'parameter': value
                }))
        )r   r   r   r   r   r   r   )r   r   r   r   reformatted_codes        r   %testStableInlinedDictionaryFormattingz7TestsForPEP8Style.testStableInlinedDictionaryFormatting  s     (  
 'o /   -.>??G"+G4402BCCC-.>??G"+G4402BCCCCCr   N)'__name__
__module____qualname__classmethodr   r   r!   r$   r&   r(   r*   r,   r.   r0   r2   r5   r9   r<   r>   r@   rB   rD   rF   rH   rN   rP   rS   rV   rX   rZ   r\   r^   r`   unittest
skipUnlessr   PY3rc   rf    r   r   r   r      s\       2 2 ;2
Q 
Q 
Q> > >Q Q QQ Q Q0
Q 
Q 
Q
Q 
Q 
Q> > >Q Q Q0"Q "Q "QHQ Q Q%Q %Q %QN4 4 4BQ Q Q4 4 4,Q Q QQ Q Q(Q Q Q Q Q Q V4 V4 V4pC C C.C C CB4 4 4*G G G'4 '4 '4RQ Q Q6> > >> > >$Q Q Q 89=(*?@@L L A@L D D D D Dr   r   c                   |    e Zd ZdZ ej        d          Zd Zd Z e	j
        ej        d          d             ZdS )TestsForSpacesInsideBracketsz,Test the SPACE_INSIDE_BRACKETS style option.aq      foo()
    foo(1)
    foo(1,2)
    foo((1,))
    foo((1, 2))
    foo((1, 2,))
    foo(bar['baz'][0])
    set1 = {1, 2, 3}
    dict1 = {1: 1, foo: 2, 3: bar}
    dict2 = {
        1: 1,
        foo: 2,
        3: bar,
    }
    dict3[3][1][get_index(*args,**kwargs)]
    dict4[3][1][get_index(**kwargs)]
    x = dict5[4](foo(*args))
    a = list1[:]
    b = list2[slice_start:]
    c = list3[slice_start:slice_end]
    d = list4[slice_start:slice_end:]
    e = list5[slice_start:slice_end:slice_step]
    # Print gets special handling
    print(set2)
    compound = ((10+3)/(5-2**(6+x)))
    string_idx = "mystring"[3]
    c                     t          j        t          j        d                     t          j        d          }t          j        | j                  }|                     |t          j
        |                     d S )N{space_inside_brackets: True}a        foo()
      foo( 1 )
      foo( 1, 2 )
      foo( ( 1, ) )
      foo( ( 1, 2 ) )
      foo( (
          1,
          2,
      ) )
      foo( bar[ 'baz' ][ 0 ] )
      set1 = { 1, 2, 3 }
      dict1 = { 1: 1, foo: 2, 3: bar }
      dict2 = {
          1: 1,
          foo: 2,
          3: bar,
      }
      dict3[ 3 ][ 1 ][ get_index( *args, **kwargs ) ]
      dict4[ 3 ][ 1 ][ get_index( **kwargs ) ]
      x = dict5[ 4 ]( foo( *args ) )
      a = list1[ : ]
      b = list2[ slice_start: ]
      c = list3[ slice_start:slice_end ]
      d = list4[ slice_start:slice_end: ]
      e = list5[ slice_start:slice_end:slice_step ]
      # Print gets special handling
      print( set2 )
      compound = ( ( 10 + 3 ) / ( 5 - 2**( 6 + x ) ) )
      string_idx = "mystring"[ 3 ]
      r   r
   r8   r   r   r   r   r   r   r   r   r   r   r   s      r   testEnabledz(TestsForSpacesInsideBrackets.testEnabled  s    	#$CDDF F F 'o /
  @ -d.CDDG0+2Fw2O2OPPPPPr   c                     t          j        t          j                               t          j        d          }t          j        | j                  }|                     |t          j
        |                     d S )Na        foo()
      foo(1)
      foo(1, 2)
      foo((1, ))
      foo((1, 2))
      foo((
          1,
          2,
      ))
      foo(bar['baz'][0])
      set1 = {1, 2, 3}
      dict1 = {1: 1, foo: 2, 3: bar}
      dict2 = {
          1: 1,
          foo: 2,
          3: bar,
      }
      dict3[3][1][get_index(*args, **kwargs)]
      dict4[3][1][get_index(**kwargs)]
      x = dict5[4](foo(*args))
      a = list1[:]
      b = list2[slice_start:]
      c = list3[slice_start:slice_end]
      d = list4[slice_start:slice_end:]
      e = list5[slice_start:slice_end:slice_step]
      # Print gets special handling
      print(set2)
      compound = ((10 + 3) / (5 - 2**(6 + x)))
      string_idx = "mystring"[3]
      r   r
   r   r   r   r   r   r   r   r   r   rt   s      r   testDefaultz(TestsForSpacesInsideBrackets.testDefault  sq    	.00111&o /
  @ -d.CDDG0+2Fw2O2OPPPPPr   zRequires Python 3.6c                    t          j        t          j        d                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     d S )Nrr   a#        import asyncio
      import time

      @print_args
      async def slow_operation():
        await asyncio.sleep(1)
        # print("Slow operation {} complete".format(n))
        async def main():
          start = time.time()
          if (await get_html()):
            pass
      a=        import asyncio
      import time


      @print_args
      async def slow_operation():
          await asyncio.sleep( 1 )

          # print("Slow operation {} complete".format(n))
          async def main():
              start = time.time()
              if ( await get_html() ):
                  pass
      )
r   r
   r8   r   r   r   r   r   r   r   r   s       r   	testAwaitz&TestsForSpacesInsideBrackets.testAwait*  s    	#$CDDF F F (
   'o /
   -.>??G0+2Fw2O2OPPPPPr   N)rg   rh   ri   __doc__r   r   r   ru   rx   rk   rl   r   PY36rz   rn   r   r   rp   rp     s        44$X_ & 	 	:%Q %Q %QN$Q $Q $QL 8y~'<== Q  Q >= Q  Q  Qr   rp   c                   D    e Zd ZdZ ej        d          Zd Zd Zd Z	dS )"TestsForSpacesAroundSubscriptColonz4Test the SPACES_AROUND_SUBSCRIPT_COLON style option.a%      a = list1[ : ]
    b = list2[ slice_start: ]
    c = list3[ slice_start:slice_end ]
    d = list4[ slice_start:slice_end: ]
    e = list5[ slice_start:slice_end:slice_step ]
    a1 = list1[ : ]
    b1 = list2[ 1: ]
    c1 = list3[ 1:20 ]
    d1 = list4[ 1:20: ]
    e1 = list5[ 1:20:3 ]
  c                     t          j        t          j        d                     t          j        d          }t          j        | j                  }|                     |t          j
        |                     d S )Nz%{spaces_around_subscript_colon: True}a;        a = list1[:]
      b = list2[slice_start :]
      c = list3[slice_start : slice_end]
      d = list4[slice_start : slice_end :]
      e = list5[slice_start : slice_end : slice_step]
      a1 = list1[:]
      b1 = list2[1 :]
      c1 = list3[1 : 20]
      d1 = list4[1 : 20 :]
      e1 = list5[1 : 20 : 3]
    rs   rt   s      r   ru   z.TestsForSpacesAroundSubscriptColon.testEnabled]  s}    	#$KLLN N N&o / 	 	 -d.CDDG0+2Fw2O2OPPPPPr   c                     t          j        t          j        d                     t          j        d          }t          j        | j                  }|                     |t          j
        |                     d S )NzC{spaces_around_subscript_colon: true, space_inside_brackets: true,}aO        a = list1[ : ]
      b = list2[ slice_start : ]
      c = list3[ slice_start : slice_end ]
      d = list4[ slice_start : slice_end : ]
      e = list5[ slice_start : slice_end : slice_step ]
      a1 = list1[ : ]
      b1 = list2[ 1 : ]
      c1 = list3[ 1 : 20 ]
      d1 = list4[ 1 : 20 : ]
      e1 = list5[ 1 : 20 : 3 ]
    rs   rt   s      r   testWithSpaceInsideBracketsz>TestsForSpacesAroundSubscriptColon.testWithSpaceInsideBracketso  s    	# %( 	) 	)* * *
 'o / 	 	 -d.CDDG0+2Fw2O2OPPPPPr   c                     t          j        t          j                               t          j        d          }t          j        | j                  }|                     |t          j
        |                     d S )Na'        a = list1[:]
      b = list2[slice_start:]
      c = list3[slice_start:slice_end]
      d = list4[slice_start:slice_end:]
      e = list5[slice_start:slice_end:slice_step]
      a1 = list1[:]
      b1 = list2[1:]
      c1 = list3[1:20]
      d1 = list4[1:20:]
      e1 = list5[1:20:3]
    rw   rt   s      r   rx   z.TestsForSpacesAroundSubscriptColon.testDefault  sp    	.00111&o / 	 	 -d.CDDG0+2Fw2O2OPPPPPr   N)
rg   rh   ri   r{   r   r   r   ru   r   rx   rn   r   r   r~   r~   N  sk        <<$X_ &  Q Q Q$Q Q Q*Q Q Q Q Qr   r~   __main__)r{   r   rk   yapf.yapflibr   r   r   	yapftestsr   YAPFTestr   rp   r~   rg   mainrn   r   r   <module>r      sJ   ' &   " " " " " " $ $ $ $ $ $       & & & & & &a
D a
D a
D a
D a
D(1 a
D a
D a
DHMQ MQ MQ MQ MQ#3#< MQ MQ MQ`EQ EQ EQ EQ EQ)9)B EQ EQ EQP z(-///// r   