prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Detecting and alerting of duplication keys/components/entries in YAML file
  ### Is your feature request related to a problem? Please describe
  
  it was found in release 1.3.11 , a PR to update [manifest](https://github.com/opensearch-project/opensearch-build/blob/main/manifests/1.3.11/opensearch-1.3.11.yml) has duplicated components name.
  It would cause the resource wasted on CI to rebuild the duplicated components 
  
  ### Describe the solution you'd like
  
  We want to have a check to detect if there is any duplication entries based on keys/components/names and probably fail the GitHub check
  
  ### Describe alternatives you've considered
  
  Manually check for duplicate values
  
  ### Acceptance Criteria
  * The manifest check should fail at CI level for components with duplicate components.name values in opensearch and opensearch-dashboard as well as test manifests. See what are [manifests](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution#what-are-manifests)
  
  </issue>
  <code>
  [start of src/ci_workflow/ci_manifests.py]
  1 # Copyright OpenSearch Contributors
  2 # SPDX-License-Identifier: Apache-2.0
  3 #
  4 # The OpenSearch Contributors require contributions made to
  5 # this file be licensed under the Apache-2.0 license or a
  6 # compatible open source license.
  7 
  8 
  9 import re
  10 from io import TextIOWrapper
  11 from typing import Type, Union
  12 
  13 from ci_workflow.ci_args import CiArgs
  14 from ci_workflow.ci_input_manifest import CiInputManifest
  15 from ci_workflow.ci_test_manifest import CiTestManifest
  16 
  17 
  18 class CiManifests:
  19     @staticmethod
  20     def __klass(filename: str) -> Union[Type[CiTestManifest], Type[CiInputManifest]]:
  21         if re.search("-test.yml$", filename):
  22             return CiTestManifest
  23         else:
  24             return CiInputManifest
  25 
  26     @classmethod
  27     def from_file(cls, file: TextIOWrapper, args: CiArgs) -> Union[CiTestManifest, CiInputManifest]:
  28         return cls.__klass(file.name)(file, args)
  29
  [end of src/ci_workflow/ci_manifests.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/ci_workflow/ci_manifests.py b/src/ci_workflow/ci_manifests.py
  --- a/src/ci_workflow/ci_manifests.py
  +++ b/src/ci_workflow/ci_manifests.py
  @@ -7,9 +7,12 @@
   
   
   import re
  +from collections import Counter
   from io import TextIOWrapper
   from typing import Type, Union
   
  +import yaml
  +
   from ci_workflow.ci_args import CiArgs
   from ci_workflow.ci_input_manifest import CiInputManifest
   from ci_workflow.ci_test_manifest import CiTestManifest
  @@ -23,6 +26,29 @@
           else:
               return CiInputManifest
   
  +    @staticmethod
  +    def __get_duplicate_component_names(count_component_names: Counter) -> list:
  +        duplicate_component_names = []
  +        for component_name, count in count_component_names.items():
  +            if count > 1:
  +                duplicate_component_names.append(component_name)
  +        return duplicate_component_names
  +
  +    @staticmethod
  +    def __check_duplicate_component_names(file: TextIOWrapper) -> None:
  +        yaml_dict = yaml.safe_load(file)
  +        component_names = []
  +        for component in yaml_dict['components']:
  +            component_names.append(component['name'])
  +        count_component_names = Counter(component_names)
  +
  +        if set(count_component_names.values()) != set([1]):
  +            duplicate_component_names = CiManifests.__get_duplicate_component_names(count_component_names)
  +            duplicate_component_names_string = ', '.join(duplicate_component_names)
  +            raise ValueError(f"Found {duplicate_component_names_string} as a duplicate component(s) in manifest {file.name}. ")
  +        file.seek(0)
  +
       @classmethod
       def from_file(cls, file: TextIOWrapper, args: CiArgs) -> Union[CiTestManifest, CiInputManifest]:
  +        cls.__check_duplicate_component_names(file)
           return cls.__klass(file.name)(file, args)
  
verification_info: {"golden_diff": "diff --git a/src/ci_workflow/ci_manifests.py b/src/ci_workflow/ci_manifests.py\n--- a/src/ci_workflow/ci_manifests.py\n+++ b/src/ci_workflow/ci_manifests.py\n@@ -7,9 +7,12 @@\n \n \n import re\n+from collections import Counter\n from io import TextIOWrapper\n from typing import Type, Union\n \n+import yaml\n+\n from ci_workflow.ci_args import CiArgs\n from ci_workflow.ci_input_manifest import CiInputManifest\n from ci_workflow.ci_test_manifest import CiTestManifest\n@@ -23,6 +26,29 @@\n         else:\n             return CiInputManifest\n \n+    @staticmethod\n+    def __get_duplicate_component_names(count_component_names: Counter) -> list:\n+        duplicate_component_names = []\n+        for component_name, count in count_component_names.items():\n+            if count > 1:\n+                duplicate_component_names.append(component_name)\n+        return duplicate_component_names\n+\n+    @staticmethod\n+    def __check_duplicate_component_names(file: TextIOWrapper) -> None:\n+        yaml_dict = yaml.safe_load(file)\n+        component_names = []\n+        for component in yaml_dict['components']:\n+            component_names.append(component['name'])\n+        count_component_names = Counter(component_names)\n+\n+        if set(count_component_names.values()) != set([1]):\n+            duplicate_component_names = CiManifests.__get_duplicate_component_names(count_component_names)\n+            duplicate_component_names_string = ', '.join(duplicate_component_names)\n+            raise ValueError(f\"Found {duplicate_component_names_string} as a duplicate component(s) in manifest {file.name}. \")\n+        file.seek(0)\n+\n     @classmethod\n     def from_file(cls, file: TextIOWrapper, args: CiArgs) -> Union[CiTestManifest, CiInputManifest]:\n+        cls.__check_duplicate_component_names(file)\n         return cls.__klass(file.name)(file, args)\n", "issue": "Detecting and alerting of duplication keys/components/entries in YAML file\n### Is your feature request related to a problem? Please describe\r\n\r\nit was found in release 1.3.11 , a PR to update [manifest](https://github.com/opensearch-project/opensearch-build/blob/main/manifests/1.3.11/opensearch-1.3.11.yml) has duplicated components name.\r\nIt would cause the resource wasted on CI to rebuild the duplicated components \r\n\r\n### Describe the solution you'd like\r\n\r\nWe want to have a check to detect if there is any duplication entries based on keys/components/names and probably fail the GitHub check\r\n\r\n### Describe alternatives you've considered\r\n\r\nManually check for duplicate values\r\n\r\n### Acceptance Criteria\r\n* The manifest check should fail at CI level for components with duplicate components.name values in opensearch and opensearch-dashboard as well as test manifests. See what are [manifests](https://github.com/opensearch-project/opensearch-build/wiki/Building-an-OpenSearch-and-OpenSearch-Dashboards-Distribution#what-are-manifests)\n", "before_files": [{"content": "# Copyright OpenSearch Contributors\n# SPDX-License-Identifier: Apache-2.0\n#\n# The OpenSearch Contributors require contributions made to\n# this file be licensed under the Apache-2.0 license or a\n# compatible open source license.\n\n\nimport re\nfrom io import TextIOWrapper\nfrom typing import Type, Union\n\nfrom ci_workflow.ci_args import CiArgs\nfrom ci_workflow.ci_input_manifest import CiInputManifest\nfrom ci_workflow.ci_test_manifest import CiTestManifest\n\n\nclass CiManifests:\n    @staticmethod\n    def __klass(filename: str) -> Union[Type[CiTestManifest], Type[CiInputManifest]]:\n        if re.search(\"-test.yml$\", filename):\n            return CiTestManifest\n        else:\n            return CiInputManifest\n\n    @classmethod\n    def from_file(cls, file: TextIOWrapper, args: CiArgs) -> Union[CiTestManifest, CiInputManifest]:\n        return cls.__klass(file.name)(file, args)\n", "path": "src/ci_workflow/ci_manifests.py"}]}