prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Security Group filter "default-vpc" does not function correctly.
  Using the following policy:
  
  ```
  policies:
    - name: default-sg-allows-all-traffic
      description: |
        Find whether the default security group allows all traffic.
      resource: security-group
      filters:
         - type: default-vpc
  ```
  
  Comes up with no results, even when I have confirmed that my account has a default vpc and a default security group associated with it.
  
  
  </issue>
  <code>
  [start of c7n/filters/vpc.py]
  1 # Copyright 2016 Capital One Services, LLC
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 # http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 from c7n.utils import local_session, type_schema
  16 
  17 from .core import Filter, ValueFilter
  18 from .related import RelatedResourceFilter
  19 
  20 
  21 class SecurityGroupFilter(RelatedResourceFilter):
  22 
  23     schema = type_schema(
  24         'security-group', rinherit=ValueFilter.schema,
  25         match_resource={'type': 'boolean'},
  26         operator={'enum': ['and', 'or']})
  27 
  28     RelatedResource = "c7n.resources.vpc.SecurityGroup"
  29     AnnotationKey = "matched-security-groups"
  30 
  31 
  32 class SubnetFilter(RelatedResourceFilter):
  33 
  34     schema = type_schema(
  35         'subnet', rinherit=ValueFilter.schema,
  36         match_resource={'type': 'boolean'},
  37         operator={'enum': ['and', 'or']})
  38 
  39     RelatedResource = "c7n.resources.vpc.Subnet"
  40     AnnotationKey = "matched-subnets"    
  41 
  42 
  43 class DefaultVpcBase(Filter):
  44 
  45     vpcs = None
  46     default_vpc = None
  47 
  48     def match(self, vpc_id):
  49         if self.default_vpc is None:
  50             self.log.debug("querying default vpc %s" % vpc_id)
  51             client = local_session(self.manager.session_factory).client('ec2')
  52             vpcs = [v['VpcId'] for v
  53                     in client.describe_vpcs(VpcIds=[vpc_id])['Vpcs']
  54                     if v['IsDefault']]
  55             if not vpcs:
  56                 self.default_vpc = ""
  57             else:
  58                 self.default_vpc = vpcs.pop()
  59         return vpc_id == self.default_vpc and True or False
  60
  [end of c7n/filters/vpc.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/c7n/filters/vpc.py b/c7n/filters/vpc.py
  --- a/c7n/filters/vpc.py
  +++ b/c7n/filters/vpc.py
  @@ -52,8 +52,6 @@
               vpcs = [v['VpcId'] for v
                       in client.describe_vpcs(VpcIds=[vpc_id])['Vpcs']
                       if v['IsDefault']]
  -            if not vpcs:
  -                self.default_vpc = ""
  -            else:
  +            if vpcs:
                   self.default_vpc = vpcs.pop()
           return vpc_id == self.default_vpc and True or False
  
verification_info: {"golden_diff": "diff --git a/c7n/filters/vpc.py b/c7n/filters/vpc.py\n--- a/c7n/filters/vpc.py\n+++ b/c7n/filters/vpc.py\n@@ -52,8 +52,6 @@\n             vpcs = [v['VpcId'] for v\n                     in client.describe_vpcs(VpcIds=[vpc_id])['Vpcs']\n                     if v['IsDefault']]\n-            if not vpcs:\n-                self.default_vpc = \"\"\n-            else:\n+            if vpcs:\n                 self.default_vpc = vpcs.pop()\n         return vpc_id == self.default_vpc and True or False\n", "issue": "Security Group filter \"default-vpc\" does not function correctly.\nUsing the following policy:\n\n```\npolicies:\n  - name: default-sg-allows-all-traffic\n    description: |\n      Find whether the default security group allows all traffic.\n    resource: security-group\n    filters:\n       - type: default-vpc\n```\n\nComes up with no results, even when I have confirmed that my account has a default vpc and a default security group associated with it.\n\n", "before_files": [{"content": "# Copyright 2016 Capital One Services, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom c7n.utils import local_session, type_schema\n\nfrom .core import Filter, ValueFilter\nfrom .related import RelatedResourceFilter\n\n\nclass SecurityGroupFilter(RelatedResourceFilter):\n\n    schema = type_schema(\n        'security-group', rinherit=ValueFilter.schema,\n        match_resource={'type': 'boolean'},\n        operator={'enum': ['and', 'or']})\n\n    RelatedResource = \"c7n.resources.vpc.SecurityGroup\"\n    AnnotationKey = \"matched-security-groups\"\n\n\nclass SubnetFilter(RelatedResourceFilter):\n\n    schema = type_schema(\n        'subnet', rinherit=ValueFilter.schema,\n        match_resource={'type': 'boolean'},\n        operator={'enum': ['and', 'or']})\n\n    RelatedResource = \"c7n.resources.vpc.Subnet\"\n    AnnotationKey = \"matched-subnets\"    \n\n\nclass DefaultVpcBase(Filter):\n\n    vpcs = None\n    default_vpc = None\n\n    def match(self, vpc_id):\n        if self.default_vpc is None:\n            self.log.debug(\"querying default vpc %s\" % vpc_id)\n            client = local_session(self.manager.session_factory).client('ec2')\n            vpcs = [v['VpcId'] for v\n                    in client.describe_vpcs(VpcIds=[vpc_id])['Vpcs']\n                    if v['IsDefault']]\n            if not vpcs:\n                self.default_vpc = \"\"\n            else:\n                self.default_vpc = vpcs.pop()\n        return vpc_id == self.default_vpc and True or False\n", "path": "c7n/filters/vpc.py"}]}