prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Allow `compatibility` attribute to be passed through to generated python targets
  To do this:
  
  - Override ` _copy_target_attributes` in `ApacheThriftPyGen`  to include 'compatibility', so it looks like this:
  
  ```
    @property
    def _copy_target_attributes(self):
      """Propagate these attributes to the synthetic python_library() target."""
      return ['provides', 'tags', 'scope', 'compatibility']
  ```
  
  - See https://github.com/pantsbuild/pants/blob/039051735542d29ae02f4faa09c0c51c47292bf0/contrib/jax_ws/src/python/pants/contrib/jax_ws/tasks/jax_ws_gen.py#L90 as an example
  
  
  
  </issue>
  <code>
  [start of src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py]
  1 # coding=utf-8
  2 # Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
  3 # Licensed under the Apache License, Version 2.0 (see LICENSE).
  4 
  5 from __future__ import absolute_import, division, print_function, unicode_literals
  6 
  7 import os
  8 from builtins import open
  9 
  10 from pants.backend.codegen.thrift.lib.apache_thrift_gen_base import ApacheThriftGenBase
  11 from pants.backend.codegen.thrift.python.python_thrift_library import PythonThriftLibrary
  12 from pants.backend.python.targets.python_library import PythonLibrary
  13 from pants.util.dirutil import safe_delete, safe_walk
  14 
  15 
  16 class ApacheThriftPyGen(ApacheThriftGenBase):
  17   """Generate Python source files from thrift IDL files."""
  18   gentarget_type = PythonThriftLibrary
  19   thrift_generator = 'py'
  20   default_gen_options_map = {
  21     'new_style': None
  22   }
  23 
  24   sources_globs = ('**/*',)
  25 
  26   def synthetic_target_type(self, target):
  27     return PythonLibrary
  28 
  29   def execute_codegen(self, target, target_workdir):
  30     super(ApacheThriftPyGen, self).execute_codegen(target, target_workdir)
  31 
  32     # Thrift generates code with all parent namespaces with empty __init__.py's. Since pants allows
  33     # splitting a thrift namespace hierarchy across multiple packages, we explicitly insert
  34     # namespace packages to allow for consumption of 2 or more of these packages in the same
  35     # PYTHONPATH.
  36     for root, _, files in safe_walk(target_workdir):
  37       if '__init__.py' not in files:  # skip non-packages
  38         continue
  39 
  40       init_py_abspath = os.path.join(root, '__init__.py')
  41 
  42       # Thrift puts an __init__.py file at the root, and we don't want one there (it's not needed,
  43       # and it confuses some import mechanisms).
  44       if root == target_workdir:
  45         safe_delete(init_py_abspath)
  46       elif os.path.getsize(init_py_abspath) == 0:  # empty __init__, translate to namespace package
  47         with open(init_py_abspath, 'wb') as f:
  48           f.write(b"__import__('pkg_resources').declare_namespace(__name__)")
  49       else:
  50         # A non-empty __init__, this is a leaf package, usually with ttypes and constants; so we
  51         # leave as-is.
  52         pass
  53 
  54   def ignore_dup(self, tgt1, tgt2, rel_src):
  55     # Thrift generates all the intermediate __init__.py files, and they shouldn't
  56     # count as dups.
  57     return os.path.basename(rel_src) == '__init__.py'
  58
  [end of src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.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/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py b/src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py
  --- a/src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py
  +++ b/src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py
  @@ -51,6 +51,10 @@
           # leave as-is.
           pass
   
  +  @property
  +  def _copy_target_attributes(self):
  +    return super(ApacheThriftPyGen, self)._copy_target_attributes + ['compatibility']
  +
     def ignore_dup(self, tgt1, tgt2, rel_src):
       # Thrift generates all the intermediate __init__.py files, and they shouldn't
       # count as dups.
  
verification_info: {"golden_diff": "diff --git a/src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py b/src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py\n--- a/src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py\n+++ b/src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py\n@@ -51,6 +51,10 @@\n         # leave as-is.\n         pass\n \n+  @property\n+  def _copy_target_attributes(self):\n+    return super(ApacheThriftPyGen, self)._copy_target_attributes + ['compatibility']\n+\n   def ignore_dup(self, tgt1, tgt2, rel_src):\n     # Thrift generates all the intermediate __init__.py files, and they shouldn't\n     # count as dups.\n", "issue": "Allow `compatibility` attribute to be passed through to generated python targets\nTo do this:\r\n\r\n- Override ` _copy_target_attributes` in `ApacheThriftPyGen`  to include 'compatibility', so it looks like this:\r\n\r\n```\r\n  @property\r\n  def _copy_target_attributes(self):\r\n    \"\"\"Propagate these attributes to the synthetic python_library() target.\"\"\"\r\n    return ['provides', 'tags', 'scope', 'compatibility']\r\n```\r\n\r\n- See https://github.com/pantsbuild/pants/blob/039051735542d29ae02f4faa09c0c51c47292bf0/contrib/jax_ws/src/python/pants/contrib/jax_ws/tasks/jax_ws_gen.py#L90 as an example\r\n\r\n\n", "before_files": [{"content": "# coding=utf-8\n# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport os\nfrom builtins import open\n\nfrom pants.backend.codegen.thrift.lib.apache_thrift_gen_base import ApacheThriftGenBase\nfrom pants.backend.codegen.thrift.python.python_thrift_library import PythonThriftLibrary\nfrom pants.backend.python.targets.python_library import PythonLibrary\nfrom pants.util.dirutil import safe_delete, safe_walk\n\n\nclass ApacheThriftPyGen(ApacheThriftGenBase):\n  \"\"\"Generate Python source files from thrift IDL files.\"\"\"\n  gentarget_type = PythonThriftLibrary\n  thrift_generator = 'py'\n  default_gen_options_map = {\n    'new_style': None\n  }\n\n  sources_globs = ('**/*',)\n\n  def synthetic_target_type(self, target):\n    return PythonLibrary\n\n  def execute_codegen(self, target, target_workdir):\n    super(ApacheThriftPyGen, self).execute_codegen(target, target_workdir)\n\n    # Thrift generates code with all parent namespaces with empty __init__.py's. Since pants allows\n    # splitting a thrift namespace hierarchy across multiple packages, we explicitly insert\n    # namespace packages to allow for consumption of 2 or more of these packages in the same\n    # PYTHONPATH.\n    for root, _, files in safe_walk(target_workdir):\n      if '__init__.py' not in files:  # skip non-packages\n        continue\n\n      init_py_abspath = os.path.join(root, '__init__.py')\n\n      # Thrift puts an __init__.py file at the root, and we don't want one there (it's not needed,\n      # and it confuses some import mechanisms).\n      if root == target_workdir:\n        safe_delete(init_py_abspath)\n      elif os.path.getsize(init_py_abspath) == 0:  # empty __init__, translate to namespace package\n        with open(init_py_abspath, 'wb') as f:\n          f.write(b\"__import__('pkg_resources').declare_namespace(__name__)\")\n      else:\n        # A non-empty __init__, this is a leaf package, usually with ttypes and constants; so we\n        # leave as-is.\n        pass\n\n  def ignore_dup(self, tgt1, tgt2, rel_src):\n    # Thrift generates all the intermediate __init__.py files, and they shouldn't\n    # count as dups.\n    return os.path.basename(rel_src) == '__init__.py'\n", "path": "src/python/pants/backend/codegen/thrift/python/apache_thrift_py_gen.py"}]}