prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Unable to see any CKV2 checks in the list
  **Describe the bug**
  I posted this on Slack first and was confirmed it's a bug. I can't see any of the CKV2 checks when running `checkov -l`
  
  **Expected behavior**
  CKV2 / graph checks should be present working.
  
  **Screenshots**
  ![image](https://user-images.githubusercontent.com/42545485/116978125-369c3200-acbb-11eb-9c7e-f9b7bea1118c.png)
  
  
  **Desktop (please complete the following information):**
   - OS: os X
   - Checkov Version 2.0.107
  
  
  </issue>
  <code>
  [start of setup.py]
  1 #!/usr/bin/env python
  2 import logging
  3 import os
  4 from importlib import util
  5 from os import path
  6 
  7 import setuptools
  8 from setuptools import setup
  9 
  10 # read the contents of your README file
  11 this_directory = path.abspath(path.dirname(__file__))
  12 with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
  13     long_description = f.read()
  14 
  15 logger = logging.getLogger(__name__)
  16 spec = util.spec_from_file_location(
  17     "checkov.version", os.path.join("checkov", "version.py")
  18 )
  19 # noinspection PyUnresolvedReferences
  20 mod = util.module_from_spec(spec)
  21 spec.loader.exec_module(mod)  # type: ignore
  22 version = mod.version  # type: ignore
  23 
  24 setup(
  25     extras_require={
  26         "dev": [
  27             "pytest==5.3.1",
  28             "coverage",
  29             "coverage-badge",
  30             "GitPython==3.1.7",
  31             "bandit"
  32         ]
  33     },
  34     install_requires=[
  35         "bc-python-hcl2>=0.3.18",
  36         "cloudsplaining>=0.4.1",
  37         "deep_merge",
  38         "tabulate",
  39         "colorama",
  40         "termcolor",
  41         "junit-xml",
  42         "dpath>=1.5.0,<2",
  43         "pyyaml>=5.4.1",
  44         "boto3==1.17.27",
  45         "GitPython",
  46         "six==1.15.0",
  47         "jmespath",
  48         "tqdm",
  49         "update_checker",
  50         "semantic_version",
  51         "packaging",
  52         "networkx",
  53         "dockerfile-parse",
  54         "docker"
  55     ],
  56     license="Apache License 2.0",
  57     name="checkov",
  58     version=version,
  59     python_requires=">=3.7",
  60     description="Infrastructure as code static analysis",
  61     author="bridgecrew",
  62     author_email="meet@bridgecrew.io",
  63     url="https://github.com/nimrodkor/checkov",
  64     packages=setuptools.find_packages(exclude=["tests*","integration_tests*"]),
  65     scripts=["bin/checkov", "bin/checkov.cmd"],
  66     long_description=long_description,
  67     long_description_content_type="text/markdown",
  68     classifiers=[
  69         'Environment :: Console',
  70         'Intended Audience :: Developers',
  71         'Intended Audience :: System Administrators',
  72         'Programming Language :: Python :: 3.7',
  73         'Programming Language :: Python :: 3.8',
  74         'Programming Language :: Python :: 3.9',
  75         'Topic :: Security',
  76         'Topic :: Software Development :: Build Tools'
  77     ]
  78 )
  79
  [end of setup.py]
  [start of checkov/terraform/checks_infra/registry.py]
  1 import json
  2 import logging
  3 import os
  4 
  5 import yaml
  6 
  7 from checkov.common.graph.checks_infra.base_parser import BaseGraphCheckParser
  8 from checkov.common.graph.checks_infra.registry import BaseRegistry
  9 from checkov.terraform.checks_infra.resources_types import resources_types
  10 
  11 CHECKS_POSSIBLE_ENDING = [".yaml", ".yml"]
  12 
  13 
  14 class Registry(BaseRegistry):
  15     def __init__(self, parser=BaseGraphCheckParser(), checks_dir=None):
  16         super().__init__(parser)
  17         self.checks = []
  18         self.parser = parser
  19         self.checks_dir = checks_dir if checks_dir else \
  20             os.path.join(os.path.dirname(os.path.dirname(__file__)), "checks", "graph_checks")
  21         self.logger = logging.getLogger(__name__)
  22 
  23     def load_checks(self):
  24         self._load_checks_from_dir(self.checks_dir)
  25 
  26     def _load_checks_from_dir(self, directory: str):
  27         dir = os.path.expanduser(directory)
  28         self.logger.debug("Loading external checks from {}".format(dir))
  29         for root, d_names, f_names in os.walk(dir):
  30             for file in f_names:
  31                 file_ending = os.path.splitext(file)[1]
  32                 if file_ending in CHECKS_POSSIBLE_ENDING:
  33                     with open(f'{root}/{file}', "r") as f:
  34                         if dir != self.checks_dir:
  35                             # This is a custom check, log its loading
  36                             logging.info(f"loading {file}")
  37                         check_yaml = yaml.safe_load(f)
  38                         check_json = json.loads(json.dumps(check_yaml))
  39                         check = self.parser.parse_raw_check(check_json, resources_types=self._get_resource_types(check_json))
  40                         if not any([c for c in self.checks if check.id == c.id]):
  41                             self.checks.append(check)
  42 
  43     def load_external_checks(self, dir: str):
  44         self._load_checks_from_dir(dir)
  45 
  46     @staticmethod
  47     def _get_resource_types(check_json):
  48         provider = check_json.get("scope", {}).get("provider", "").lower()
  49         return resources_types.get(provider)
  50
  [end of checkov/terraform/checks_infra/registry.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/checkov/terraform/checks_infra/registry.py b/checkov/terraform/checks_infra/registry.py
  --- a/checkov/terraform/checks_infra/registry.py
  +++ b/checkov/terraform/checks_infra/registry.py
  @@ -25,15 +25,20 @@
   
       def _load_checks_from_dir(self, directory: str):
           dir = os.path.expanduser(directory)
  -        self.logger.debug("Loading external checks from {}".format(dir))
  +
  +        checks_dir_content = os.listdir(os.path.dirname(dir))
  +        self.logger.info(f'Checks dir contents: {checks_dir_content}')
  +
  +        self.logger.info("Loading external checks from {}".format(dir))
           for root, d_names, f_names in os.walk(dir):
  +            self.logger.info(f'Searching through {d_names} and {f_names}')
               for file in f_names:
                   file_ending = os.path.splitext(file)[1]
                   if file_ending in CHECKS_POSSIBLE_ENDING:
                       with open(f'{root}/{file}', "r") as f:
  -                        if dir != self.checks_dir:
  +                        # if dir != self.checks_dir:
                               # This is a custom check, log its loading
  -                            logging.info(f"loading {file}")
  +                        self.logger.info(f"loading {file}")
                           check_yaml = yaml.safe_load(f)
                           check_json = json.loads(json.dumps(check_yaml))
                           check = self.parser.parse_raw_check(check_json, resources_types=self._get_resource_types(check_json))
  diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -62,6 +62,8 @@
       author_email="meet@bridgecrew.io",
       url="https://github.com/nimrodkor/checkov",
       packages=setuptools.find_packages(exclude=["tests*","integration_tests*"]),
  +    include_package_data=True,
  +    package_data = {'': ['*.yaml', '*.yml']},
       scripts=["bin/checkov", "bin/checkov.cmd"],
       long_description=long_description,
       long_description_content_type="text/markdown",
  
verification_info: {"golden_diff": "diff --git a/checkov/terraform/checks_infra/registry.py b/checkov/terraform/checks_infra/registry.py\n--- a/checkov/terraform/checks_infra/registry.py\n+++ b/checkov/terraform/checks_infra/registry.py\n@@ -25,15 +25,20 @@\n \n     def _load_checks_from_dir(self, directory: str):\n         dir = os.path.expanduser(directory)\n-        self.logger.debug(\"Loading external checks from {}\".format(dir))\n+\n+        checks_dir_content = os.listdir(os.path.dirname(dir))\n+        self.logger.info(f'Checks dir contents: {checks_dir_content}')\n+\n+        self.logger.info(\"Loading external checks from {}\".format(dir))\n         for root, d_names, f_names in os.walk(dir):\n+            self.logger.info(f'Searching through {d_names} and {f_names}')\n             for file in f_names:\n                 file_ending = os.path.splitext(file)[1]\n                 if file_ending in CHECKS_POSSIBLE_ENDING:\n                     with open(f'{root}/{file}', \"r\") as f:\n-                        if dir != self.checks_dir:\n+                        # if dir != self.checks_dir:\n                             # This is a custom check, log its loading\n-                            logging.info(f\"loading {file}\")\n+                        self.logger.info(f\"loading {file}\")\n                         check_yaml = yaml.safe_load(f)\n                         check_json = json.loads(json.dumps(check_yaml))\n                         check = self.parser.parse_raw_check(check_json, resources_types=self._get_resource_types(check_json))\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -62,6 +62,8 @@\n     author_email=\"meet@bridgecrew.io\",\n     url=\"https://github.com/nimrodkor/checkov\",\n     packages=setuptools.find_packages(exclude=[\"tests*\",\"integration_tests*\"]),\n+    include_package_data=True,\n+    package_data = {'': ['*.yaml', '*.yml']},\n     scripts=[\"bin/checkov\", \"bin/checkov.cmd\"],\n     long_description=long_description,\n     long_description_content_type=\"text/markdown\",\n", "issue": "Unable to see any CKV2 checks in the list\n**Describe the bug**\r\nI posted this on Slack first and was confirmed it's a bug. I can't see any of the CKV2 checks when running `checkov -l`\r\n\r\n**Expected behavior**\r\nCKV2 / graph checks should be present working.\r\n\r\n**Screenshots**\r\n![image](https://user-images.githubusercontent.com/42545485/116978125-369c3200-acbb-11eb-9c7e-f9b7bea1118c.png)\r\n\r\n\r\n**Desktop (please complete the following information):**\r\n - OS: os X\r\n - Checkov Version 2.0.107\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\nimport logging\nimport os\nfrom importlib import util\nfrom os import path\n\nimport setuptools\nfrom setuptools import setup\n\n# read the contents of your README file\nthis_directory = path.abspath(path.dirname(__file__))\nwith open(path.join(this_directory, \"README.md\"), encoding=\"utf-8\") as f:\n    long_description = f.read()\n\nlogger = logging.getLogger(__name__)\nspec = util.spec_from_file_location(\n    \"checkov.version\", os.path.join(\"checkov\", \"version.py\")\n)\n# noinspection PyUnresolvedReferences\nmod = util.module_from_spec(spec)\nspec.loader.exec_module(mod)  # type: ignore\nversion = mod.version  # type: ignore\n\nsetup(\n    extras_require={\n        \"dev\": [\n            \"pytest==5.3.1\",\n            \"coverage\",\n            \"coverage-badge\",\n            \"GitPython==3.1.7\",\n            \"bandit\"\n        ]\n    },\n    install_requires=[\n        \"bc-python-hcl2>=0.3.18\",\n        \"cloudsplaining>=0.4.1\",\n        \"deep_merge\",\n        \"tabulate\",\n        \"colorama\",\n        \"termcolor\",\n        \"junit-xml\",\n        \"dpath>=1.5.0,<2\",\n        \"pyyaml>=5.4.1\",\n        \"boto3==1.17.27\",\n        \"GitPython\",\n        \"six==1.15.0\",\n        \"jmespath\",\n        \"tqdm\",\n        \"update_checker\",\n        \"semantic_version\",\n        \"packaging\",\n        \"networkx\",\n        \"dockerfile-parse\",\n        \"docker\"\n    ],\n    license=\"Apache License 2.0\",\n    name=\"checkov\",\n    version=version,\n    python_requires=\">=3.7\",\n    description=\"Infrastructure as code static analysis\",\n    author=\"bridgecrew\",\n    author_email=\"meet@bridgecrew.io\",\n    url=\"https://github.com/nimrodkor/checkov\",\n    packages=setuptools.find_packages(exclude=[\"tests*\",\"integration_tests*\"]),\n    scripts=[\"bin/checkov\", \"bin/checkov.cmd\"],\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    classifiers=[\n        'Environment :: Console',\n        'Intended Audience :: Developers',\n        'Intended Audience :: System Administrators',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: 3.8',\n        'Programming Language :: Python :: 3.9',\n        'Topic :: Security',\n        'Topic :: Software Development :: Build Tools'\n    ]\n)\n", "path": "setup.py"}, {"content": "import json\nimport logging\nimport os\n\nimport yaml\n\nfrom checkov.common.graph.checks_infra.base_parser import BaseGraphCheckParser\nfrom checkov.common.graph.checks_infra.registry import BaseRegistry\nfrom checkov.terraform.checks_infra.resources_types import resources_types\n\nCHECKS_POSSIBLE_ENDING = [\".yaml\", \".yml\"]\n\n\nclass Registry(BaseRegistry):\n    def __init__(self, parser=BaseGraphCheckParser(), checks_dir=None):\n        super().__init__(parser)\n        self.checks = []\n        self.parser = parser\n        self.checks_dir = checks_dir if checks_dir else \\\n            os.path.join(os.path.dirname(os.path.dirname(__file__)), \"checks\", \"graph_checks\")\n        self.logger = logging.getLogger(__name__)\n\n    def load_checks(self):\n        self._load_checks_from_dir(self.checks_dir)\n\n    def _load_checks_from_dir(self, directory: str):\n        dir = os.path.expanduser(directory)\n        self.logger.debug(\"Loading external checks from {}\".format(dir))\n        for root, d_names, f_names in os.walk(dir):\n            for file in f_names:\n                file_ending = os.path.splitext(file)[1]\n                if file_ending in CHECKS_POSSIBLE_ENDING:\n                    with open(f'{root}/{file}', \"r\") as f:\n                        if dir != self.checks_dir:\n                            # This is a custom check, log its loading\n                            logging.info(f\"loading {file}\")\n                        check_yaml = yaml.safe_load(f)\n                        check_json = json.loads(json.dumps(check_yaml))\n                        check = self.parser.parse_raw_check(check_json, resources_types=self._get_resource_types(check_json))\n                        if not any([c for c in self.checks if check.id == c.id]):\n                            self.checks.append(check)\n\n    def load_external_checks(self, dir: str):\n        self._load_checks_from_dir(dir)\n\n    @staticmethod\n    def _get_resource_types(check_json):\n        provider = check_json.get(\"scope\", {}).get(\"provider\", \"\").lower()\n        return resources_types.get(provider)\n", "path": "checkov/terraform/checks_infra/registry.py"}]}