prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  E1017 with nested !Select
  *cfn-lint version: (`cfn-lint --version`)*
  0.46.0
  
  *Description of issue.*
  When linting this CFT YAML:
  ```yaml
  subnet0A:
      DependsOn: ipv6CidrBlock
      Type: 'AWS::EC2::Subnet'
      Properties:
        VpcId: !Ref vpc
        CidrBlock: !Select
          - !Select
            - 1
            - !Split
              - ','
              - !FindInMap
                - subnetMap
                - !Ref numAzs
                - !Ref numSubnets
          - 'Fn::Cidr':
              - !GetAtt
                - vpc
                - CidrBlock
              - !Select
                - 0
                - !Split
                  - ','
                  - !FindInMap
                    - subnetMap
                    - !Ref numAzs
                    - !Ref numSubnets
              - !FindInMap
                - subnetMap
                - maskTocidrBits
                - !Ref subnetMask
  ```
  
  I get this error:
  
  E1017 Select index should be an Integer or a function Ref or FindInMap for Resources/subnet0A/Properties/CidrBlock/Fn::Select
  
  Template works fine.
  thanks
  
  Cfn-lint uses the [CloudFormation Resource Specifications](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html) as the base to do validation. These files are included as part of the application version. Please update to the latest version of `cfn-lint` or update the spec files manually (`cfn-lint -u`)
  
  
  </issue>
  <code>
  [start of src/cfnlint/rules/functions/Select.py]
  1 """
  2 Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3 SPDX-License-Identifier: MIT-0
  4 """
  5 import six
  6 from cfnlint.rules import CloudFormationLintRule
  7 from cfnlint.rules import RuleMatch
  8 
  9 
  10 class Select(CloudFormationLintRule):
  11     """Check if Select values are correct"""
  12     id = 'E1017'
  13     shortdesc = 'Select validation of parameters'
  14     description = 'Making sure the function not is of list'
  15     source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-select.html'
  16     tags = ['functions', 'select']
  17 
  18     def match(self, cfn):
  19         matches = []
  20 
  21         select_objs = cfn.search_deep_keys('Fn::Select')
  22 
  23         supported_functions = [
  24             'Fn::FindInMap',
  25             'Fn::GetAtt',
  26             'Fn::GetAZs',
  27             'Fn::If',
  28             'Fn::Split',
  29             'Fn::Cidr',
  30             'Ref'
  31         ]
  32 
  33         for select_obj in select_objs:
  34             select_value_obj = select_obj[-1]
  35             tree = select_obj[:-1]
  36             if isinstance(select_value_obj, list):
  37                 if len(select_value_obj) == 2:
  38                     index_obj = select_value_obj[0]
  39                     list_of_objs = select_value_obj[1]
  40                     if isinstance(index_obj, dict):
  41                         if len(index_obj) == 1:
  42                             for index_key, _ in index_obj.items():
  43                                 if index_key not in ['Ref', 'Fn::FindInMap']:
  44                                     message = 'Select index should be an Integer or a function Ref or FindInMap for {0}'
  45                                     matches.append(RuleMatch(
  46                                         tree, message.format('/'.join(map(str, tree)))))
  47                     elif not isinstance(index_obj, six.integer_types):
  48                         try:
  49                             int(index_obj)
  50                         except ValueError:
  51                             message = 'Select index should be an Integer or a function of Ref or FindInMap for {0}'
  52                             matches.append(RuleMatch(
  53                                 tree, message.format('/'.join(map(str, tree)))))
  54                     if isinstance(list_of_objs, dict):
  55                         if len(list_of_objs) == 1:
  56                             for key, _ in list_of_objs.items():
  57                                 if key not in supported_functions:
  58                                     message = 'Select should use a supported function of {0}'
  59                                     matches.append(RuleMatch(
  60                                         tree, message.format(', '.join(map(str, supported_functions)))))
  61                         else:
  62                             message = 'Select should use a supported function of {0}'
  63                             matches.append(RuleMatch(
  64                                 tree, message.format(', '.join(map(str, supported_functions)))))
  65                     elif not isinstance(list_of_objs, list):
  66                         message = 'Select should be an array of values for {0}'
  67                         matches.append(RuleMatch(
  68                             tree, message.format('/'.join(map(str, tree)))))
  69                 else:
  70                     message = 'Select should be a list of 2 elements for {0}'
  71                     matches.append(RuleMatch(
  72                         tree, message.format('/'.join(map(str, tree)))))
  73             else:
  74                 message = 'Select should be a list of 2 elements for {0}'
  75                 matches.append(RuleMatch(
  76                     tree, message.format('/'.join(map(str, tree)))))
  77         return matches
  78
  [end of src/cfnlint/rules/functions/Select.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/cfnlint/rules/functions/Select.py b/src/cfnlint/rules/functions/Select.py
  --- a/src/cfnlint/rules/functions/Select.py
  +++ b/src/cfnlint/rules/functions/Select.py
  @@ -40,7 +40,7 @@
                       if isinstance(index_obj, dict):
                           if len(index_obj) == 1:
                               for index_key, _ in index_obj.items():
  -                                if index_key not in ['Ref', 'Fn::FindInMap']:
  +                                if index_key not in ['Ref', 'Fn::FindInMap', 'Fn::Select']:
                                       message = 'Select index should be an Integer or a function Ref or FindInMap for {0}'
                                       matches.append(RuleMatch(
                                           tree, message.format('/'.join(map(str, tree)))))
  
verification_info: {"golden_diff": "diff --git a/src/cfnlint/rules/functions/Select.py b/src/cfnlint/rules/functions/Select.py\n--- a/src/cfnlint/rules/functions/Select.py\n+++ b/src/cfnlint/rules/functions/Select.py\n@@ -40,7 +40,7 @@\n                     if isinstance(index_obj, dict):\n                         if len(index_obj) == 1:\n                             for index_key, _ in index_obj.items():\n-                                if index_key not in ['Ref', 'Fn::FindInMap']:\n+                                if index_key not in ['Ref', 'Fn::FindInMap', 'Fn::Select']:\n                                     message = 'Select index should be an Integer or a function Ref or FindInMap for {0}'\n                                     matches.append(RuleMatch(\n                                         tree, message.format('/'.join(map(str, tree)))))\n", "issue": "E1017 with nested !Select\n*cfn-lint version: (`cfn-lint --version`)*\r\n0.46.0\r\n\r\n*Description of issue.*\r\nWhen linting this CFT YAML:\r\n```yaml\r\nsubnet0A:\r\n    DependsOn: ipv6CidrBlock\r\n    Type: 'AWS::EC2::Subnet'\r\n    Properties:\r\n      VpcId: !Ref vpc\r\n      CidrBlock: !Select\r\n        - !Select\r\n          - 1\r\n          - !Split\r\n            - ','\r\n            - !FindInMap\r\n              - subnetMap\r\n              - !Ref numAzs\r\n              - !Ref numSubnets\r\n        - 'Fn::Cidr':\r\n            - !GetAtt\r\n              - vpc\r\n              - CidrBlock\r\n            - !Select\r\n              - 0\r\n              - !Split\r\n                - ','\r\n                - !FindInMap\r\n                  - subnetMap\r\n                  - !Ref numAzs\r\n                  - !Ref numSubnets\r\n            - !FindInMap\r\n              - subnetMap\r\n              - maskTocidrBits\r\n              - !Ref subnetMask\r\n```\r\n\r\nI get this error:\r\n\r\nE1017 Select index should be an Integer or a function Ref or FindInMap for Resources/subnet0A/Properties/CidrBlock/Fn::Select\r\n\r\nTemplate works fine.\r\nthanks\r\n\r\nCfn-lint uses the [CloudFormation Resource Specifications](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html) as the base to do validation. These files are included as part of the application version. Please update to the latest version of `cfn-lint` or update the spec files manually (`cfn-lint -u`)\r\n\n", "before_files": [{"content": "\"\"\"\nCopyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\nSPDX-License-Identifier: MIT-0\n\"\"\"\nimport six\nfrom cfnlint.rules import CloudFormationLintRule\nfrom cfnlint.rules import RuleMatch\n\n\nclass Select(CloudFormationLintRule):\n    \"\"\"Check if Select values are correct\"\"\"\n    id = 'E1017'\n    shortdesc = 'Select validation of parameters'\n    description = 'Making sure the function not is of list'\n    source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-select.html'\n    tags = ['functions', 'select']\n\n    def match(self, cfn):\n        matches = []\n\n        select_objs = cfn.search_deep_keys('Fn::Select')\n\n        supported_functions = [\n            'Fn::FindInMap',\n            'Fn::GetAtt',\n            'Fn::GetAZs',\n            'Fn::If',\n            'Fn::Split',\n            'Fn::Cidr',\n            'Ref'\n        ]\n\n        for select_obj in select_objs:\n            select_value_obj = select_obj[-1]\n            tree = select_obj[:-1]\n            if isinstance(select_value_obj, list):\n                if len(select_value_obj) == 2:\n                    index_obj = select_value_obj[0]\n                    list_of_objs = select_value_obj[1]\n                    if isinstance(index_obj, dict):\n                        if len(index_obj) == 1:\n                            for index_key, _ in index_obj.items():\n                                if index_key not in ['Ref', 'Fn::FindInMap']:\n                                    message = 'Select index should be an Integer or a function Ref or FindInMap for {0}'\n                                    matches.append(RuleMatch(\n                                        tree, message.format('/'.join(map(str, tree)))))\n                    elif not isinstance(index_obj, six.integer_types):\n                        try:\n                            int(index_obj)\n                        except ValueError:\n                            message = 'Select index should be an Integer or a function of Ref or FindInMap for {0}'\n                            matches.append(RuleMatch(\n                                tree, message.format('/'.join(map(str, tree)))))\n                    if isinstance(list_of_objs, dict):\n                        if len(list_of_objs) == 1:\n                            for key, _ in list_of_objs.items():\n                                if key not in supported_functions:\n                                    message = 'Select should use a supported function of {0}'\n                                    matches.append(RuleMatch(\n                                        tree, message.format(', '.join(map(str, supported_functions)))))\n                        else:\n                            message = 'Select should use a supported function of {0}'\n                            matches.append(RuleMatch(\n                                tree, message.format(', '.join(map(str, supported_functions)))))\n                    elif not isinstance(list_of_objs, list):\n                        message = 'Select should be an array of values for {0}'\n                        matches.append(RuleMatch(\n                            tree, message.format('/'.join(map(str, tree)))))\n                else:\n                    message = 'Select should be a list of 2 elements for {0}'\n                    matches.append(RuleMatch(\n                        tree, message.format('/'.join(map(str, tree)))))\n            else:\n                message = 'Select should be a list of 2 elements for {0}'\n                matches.append(RuleMatch(\n                    tree, message.format('/'.join(map(str, tree)))))\n        return matches\n", "path": "src/cfnlint/rules/functions/Select.py"}]}