
    ?d                         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                          yy)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!jD                  e#jH                   d      d        Z%d  Z& e!jD                  e#jN                  d!      d"        Z( e!jD                  e#jN                  d!      d#        Z)y$)%TestsForPEP8Stylec                 R    t        j                  t        j                                y )N)r   SetGlobalStyleCreatePEP8Style)clss    A/usr/lib/python3/dist-packages/yapftests/reformatter_pep8_test.py
setUpClasszTestsForPEP8Style.setUpClass   s    	..01    c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )Nz'        if a+b:
          pass
        z+        if a + b:
            pass
        textwrapdedentr   ParseAndUnwrapassertCodeEqualr   Reformatselfunformatted_codeexpected_formatted_codelliness       r   testIndent4zTestsForPEP8Style.testIndent4    [     (  'oo /  ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )NzP        if True: a = 42
        elif False: b = 42
        else: c = 42
        r   r   coder   s      r   testSingleLineIfStatementsz,TestsForPEP8Style.testSingleLineIfStatements,   B    ??  D
 ,,T2F{33F;<r   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )NzA        class Foo:
          def joe():
            pass
        zH        class Foo:

            def joe():
                pass
        r   r   s       r   testBlankBetweenClassAndDefz-TestsForPEP8Style.testBlankBetweenClassAndDef5   [     ( 
 'oo /  ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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   testBlankBetweenDefsInClassz-TestsForPEP8Style.testBlankBetweenDefsInClassD   s[     (  'oo /  ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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                  |      }| j	                  |t        j                  |             y )Nz/        a = (
            1,
        )
        z        a = (1, )
        r   r   s       r   .testSpaceBetweenEndingCommandAndClosingBracketz@TestsForPEP8Style.testSpaceBetweenEndingCommandAndClosingBracketi   s[     ( 
 'oo /  ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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.testContinuedNonOutdentedLineu   sB    ??  D ,,T2F{33F;<r   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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   s[     (  'oo /  ,,-=>F0+2F2Fv2NOr   c                    t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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     ( 
 'oo /  ,,-=>F0+2F2Fv2NO (  'oo /  ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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   [     (  'oo / 
 ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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   s[     (  'oo / * ,,-=>F0+2F2Fv2NOr   c                    	 t        j                  t        j                  d             t        j                  d      }t        j                  d      }t        j                  |      }| j                  |t        j                  |             t        j                  t        j                                y # 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N " *  !) 1 !  ../?@f
2&//79 50023e50023   BB6 6)Cc                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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  r%   r   c                    	 t        j                  t        j                  d             t        j                  d      }t        j                  d      }t        j                  |      }| j                  |t        j                  |             t        j                  t        j                                y # 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)
          r8   r   s       r    testSplittingBeforeFirstArgumentz2TestsForPEP8Style.testSplittingBeforeFirstArgument   s    4

%
%IKL " *  !) 1 !  ../?@f
2&//79 50023e50023r;   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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.testSplittingExpressionsInsideSubscripts6  r4   r   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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.testSplitListsAndDictSetMakersIfCommaTerminatedC  s[     (  'oo 	/ 	 ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )Nz        class a():

            def a(): return a(
             aaaaaaaaaa=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
        z        class a():

            def a():
                return a(
                    aaaaaaaaaa=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                )
        r   r   s       r   testSplitAroundNamedAssignsz-TestsForPEP8Style.testSplitAroundNamedAssignsW  s[     (  'oo /  ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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.testUnaryOperatori  s[     (  'oo /  ,,-=>F0+2F2Fv2NOr   c                    	 t        j                  t        j                  d             t        j                  d      }t        j                  d      }t        j                  |      }| j                  |t        j                  |             t        j                  d      }t        j                  d      }t        j                  |      }| j                  |t        j                  |             t        j                  d      }t        j                  d      }t        j                  |      }| j                  |t        j                  |             t        j                  d      }t        j                  d	      }t        j                  |      }| j                  |t        j                  |             t        j                  t        j                                y # 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."
              ),
          )
          r8   r   s       r   testNoSplitBeforeDictValuez,TestsForPEP8Style.testNoSplitBeforeDictValuey  s   U4

%
% 'M NO " *  !) 1 !  ../?@f
2&//79 " *  !) 1 !  ../?@f
2&//79 " *  !) 1 !  ../?@f
2&//79 " *  !) 1 !  ../?@f
2&//79 50023e50023s   F8G" ")Hc                     d}d}t        j                  |      }| j                  |t        j                  |             y )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  s?    	M ,,-=>F]K$8$8$@Ar   c                     d}d}t        j                  |      }| j                  |t        j                  |             y )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
        """
rK   rM   s       r   (testNoBlankLinesOnlyForFirstNestedObjectz:TestsForPEP8Style.testNoBlankLinesOnlyForFirstNestedObject  s?    M  ,,-=>F]K$8$8$@Ar   c                 x   	 t        j                  t        j                  d             d}d}t        j                  |      }| j                  |t        j                  |             t        j                  t        j                                y # 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
   r9   r   r   r   r   r   r   r   s       r   "testSplitBeforeArithmeticOperatorsz4TestsForPEP8Style.testSplitBeforeArithmeticOperators
  s    4

%
%NPQ!
  ../?@f
2&//79 50023e50023   A&B )B9c                     d}d}t        j                  |      }| j                  |t        j                  |             y )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   rM   s       r   testListSplittingz#TestsForPEP8Style.testListSplitting  s?    
M
 ,,-=>F(<(<V(DEr   c                 x   	 t        j                  t        j                  d             d}d}t        j                  |      }| j                  |t        j                  |             t        j                  t        j                                y # 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
rS   r   s       r   &testNoBlankLineBeforeNestedFuncOrClassz8TestsForPEP8Style.testNoBlankLineBeforeNestedFuncOrClass-  s    &4

%
%>?@
!  ../?@f
2&//79 50023e50023rU   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )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.testParamListIndentationCollision1V  s[     (  'oo /  ,,-=>F0+2F2Fv2NOr   c                     t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )Nz        def simple_pass_function_with_an_extremely_long_name_and_some_arguments(
                argument0, argument1):
            pass
        r   r   s      r   "testParamListIndentationCollision2z4TestsForPEP8Style.testParamListIndentationCollision2r  r"   r   c                     t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )Nz        def func1(
            arg1,
            arg2,
        ) -> None:
            pass


        def func2(
            arg1,
            arg2,
        ):
            pass
        r   r   s      r   "testParamListIndentationCollision3z4TestsForPEP8Style.testParamListIndentationCollision3{  sB    ??  D ,,T2F{33F;<r   c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |             y )Nz        _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl is not ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj)
        _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl not in {ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj})
        z        _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl
             is not ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj)
        _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl
             not in {ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj})
        r   r   s       r   testTwoWordComparisonOperatorsz0TestsForPEP8Style.testTwoWordComparisonOperators  s[     (  'oo /  ,,-=>F0+2F2Fv2NOr   zRequires Python 2.7c                     t        j                  d      }t        j                  |      }| j	                  |t        j                  |d             y )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  sF     ??  D ,,T2F{33F5IJr   c                 H   t        j                  d      }t        j                  d      }t        j                  |      }t	        j
                  |      }| j                  ||       t        j                  |      }t	        j
                  |      }| j                  ||       y )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     ( 
 'oo /  ,,-=>F"++F302BC,,-=>F"++F302BCr   Requires Python 3.6c                     t        j                  t        j                                t        j                  d      }t        j                  |      }| j                  |t        j                  |d             y )Nz4      class MyClass(ABC):

          place: ...
    Frc   
r   r
   r   r   r   r   r   r   r   r   r   s      r   testSpaceBetweenColonAndElipsesz1TestsForPEP8Style.testSpaceBetweenColonAndElipses  s[    	..01??  	D
 ,,T2F{33F5IJr   c                    t        j                  t        j                                t        j                  d      }t        j                  d      }t        j                  |      }| j                  |t        j                  |             y )Nz      {0:"...", 1:...}
    z      {0: "...", 1: ...}
    rk   r   s       r   #testSpaceBetweenDictColonAndElipsesz5TestsForPEP8Style.testSpaceBetweenDictColonAndElipses  sr    	..01 ( 	 'oo / 	 ,,-=>F0+2F2Fv2NOr   N)*__name__
__module____qualname__classmethodr   r   r!   r$   r'   r)   r+   r-   r/   r1   r3   r6   r:   r=   r?   rA   rC   rE   rG   rI   rO   rQ   rT   rW   rY   r[   r]   r_   ra   unittest
skipUnlessr   PY3re   rh   PY36rl   rn    r   r   r   r      sB   2 2
P=PP2
P
P=P0#PJP%PN4BP4,PP(P$P V4pB. BD4*F'4RP8==$P 89==(*?@K AK"D. 8y~~'<=K >K 8y~~'<=
P >
Pr   r   c                       e Zd ZdZ ej
                  d      Zd Zd Z e	j                  ej                  d      d        Zy)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                        }| j                  |t        j                  |             y )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
   r9   r   r   r   r   r   r   r   r   r   r   r   s      r   testEnabledz(TestsForSpacesInsideBrackets.testEnabled  sk    	##$CDF 'oo /
 @ ,,T-B-BCF0+2F2Fv2NOr   c                    t        j                  t        j                                t        j                  d      }t        j                  | j                        }| j                  |t        j                  |             y )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   r}   s      r   testDefaultz(TestsForSpacesInsideBrackets.testDefault#  sb    	..01&oo /
 @ ,,T-B-BCF0+2F2Fv2NOr   ri   c                    t        j                  t        j                  d             t        j                  d      }t        j                  d      }t        j                  |      }| j                  |t        j                  |             y )Nr{   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
   r9   r   r   r   r   r   r   r   r   s       r   	testAwaitz&TestsForSpacesInsideBrackets.testAwaitI  sy    	##$CDF (
  'oo /
  ,,-=>F0+2F2Fv2NOr   N)ro   rp   rq   __doc__r   r   r   r~   r   rs   rt   r   rv   r   rw   r   r   ry   ry     sS    4$X__ & 	:%PN$PL 8y~~'<= P > Pr   ry   c                   F    e Zd ZdZ ej
                  d      Zd Zd Zd Z	y)"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                        }| j                  |t        j                  |             y )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]
    r|   r}   s      r   r~   z.TestsForSpacesAroundSubscriptColon.testEnabled|  sh    	##$KLN&oo / 	 ,,T-B-BCF0+2F2Fv2NOr   c                    t        j                  t        j                  d             t        j                  d      }t        j                  | j                        }| j                  |t        j                  |             y )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 ]
    r|   r}   s      r   testWithSpaceInsideBracketsz>TestsForSpacesAroundSubscriptColon.testWithSpaceInsideBrackets  sm    	## %( 	)*
 'oo / 	 ,,T-B-BCF0+2F2Fv2NOr   c                    t        j                  t        j                                t        j                  d      }t        j                  | j                        }| j                  |t        j                  |             y )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]
    r   r}   s      r   r   z.TestsForSpacesAroundSubscriptColon.testDefault  sa    	..01&oo / 	 ,,T-B-BCF0+2F2Fv2NOr   N)
ro   rp   rq   r   r   r   r   r~   r   r   rw   r   r   r   r   m  s-    <$X__ & P$P*Pr   r   __main__)r   r   rs   yapf.yapflibr   r   r   	yapftestsr   YAPFTestr   ry   r   ro   mainrw   r   r   <module>r      s~    '   " $  &@P(11 @PFMP#3#<#< MP`EP)9)B)B EPP z(--/ r   