prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  lint takes a long time
  Fix that.
  
  </issue>
  <code>
  [start of exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py]
  1 # Copyright The OpenTelemetry Authors
  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 os import getpid
  16 from socket import gethostname
  17 from time import time
  18 
  19 # pylint: disable=wrong-import-position
  20 from google.protobuf.timestamp_pb2 import Timestamp
  21 from opencensus.proto.agent.common.v1 import common_pb2
  22 from opencensus.proto.trace.v1 import trace_pb2
  23 
  24 from opentelemetry.exporter.opencensus.version import (
  25     __version__ as opencensusexporter_exporter_version,
  26 )
  27 from opentelemetry.trace import SpanKind
  28 from opentelemetry.util._importlib_metadata import version
  29 
  30 OPENTELEMETRY_VERSION = version("opentelemetry-api")
  31 
  32 
  33 def proto_timestamp_from_time_ns(time_ns):
  34     """Converts datetime to protobuf timestamp.
  35 
  36     Args:
  37         time_ns: Time in nanoseconds
  38 
  39     Returns:
  40         Returns protobuf timestamp.
  41     """
  42     ts = Timestamp()
  43     if time_ns is not None:
  44         # pylint: disable=no-member
  45         ts.FromNanoseconds(time_ns)
  46     return ts
  47 
  48 
  49 # pylint: disable=no-member
  50 def get_collector_span_kind(kind: SpanKind):
  51     if kind is SpanKind.SERVER:
  52         return trace_pb2.Span.SpanKind.SERVER
  53     if kind is SpanKind.CLIENT:
  54         return trace_pb2.Span.SpanKind.CLIENT
  55     return trace_pb2.Span.SpanKind.SPAN_KIND_UNSPECIFIED
  56 
  57 
  58 def add_proto_attribute_value(pb_attributes, key, value):
  59     """Sets string, int, boolean or float value on protobuf
  60         span, link or annotation attributes.
  61 
  62     Args:
  63         pb_attributes: protobuf Span's attributes property.
  64         key: attribute key to set.
  65         value: attribute value
  66     """
  67 
  68     if isinstance(value, bool):
  69         pb_attributes.attribute_map[key].bool_value = value
  70     elif isinstance(value, int):
  71         pb_attributes.attribute_map[key].int_value = value
  72     elif isinstance(value, str):
  73         pb_attributes.attribute_map[key].string_value.value = value
  74     elif isinstance(value, float):
  75         pb_attributes.attribute_map[key].double_value = value
  76     else:
  77         pb_attributes.attribute_map[key].string_value.value = str(value)
  78 
  79 
  80 # pylint: disable=no-member
  81 def get_node(service_name, host_name):
  82     """Generates Node message from params and system information.
  83 
  84     Args:
  85        service_name: Name of Collector service.
  86        host_name: Host name.
  87     """
  88     return common_pb2.Node(
  89         identifier=common_pb2.ProcessIdentifier(
  90             host_name=gethostname() if host_name is None else host_name,
  91             pid=getpid(),
  92             start_timestamp=proto_timestamp_from_time_ns(int(time() * 1e9)),
  93         ),
  94         library_info=common_pb2.LibraryInfo(
  95             language=common_pb2.LibraryInfo.Language.Value("PYTHON"),
  96             exporter_version=opencensusexporter_exporter_version,
  97             core_library_version=OPENTELEMETRY_VERSION,
  98         ),
  99         service_info=common_pb2.ServiceInfo(name=service_name),
  100     )
  101
  [end of exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.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/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py
  --- a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py
  +++ b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py
  @@ -17,7 +17,9 @@
   from time import time
   
   # pylint: disable=wrong-import-position
  -from google.protobuf.timestamp_pb2 import Timestamp
  +from google.protobuf.timestamp_pb2 import (  # pylint: disable=no-name-in-module
  +    Timestamp,
  +)
   from opencensus.proto.agent.common.v1 import common_pb2
   from opencensus.proto.trace.v1 import trace_pb2
  
verification_info: {"golden_diff": "diff --git a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py\n--- a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py\n+++ b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py\n@@ -17,7 +17,9 @@\n from time import time\n \n # pylint: disable=wrong-import-position\n-from google.protobuf.timestamp_pb2 import Timestamp\n+from google.protobuf.timestamp_pb2 import (  # pylint: disable=no-name-in-module\n+    Timestamp,\n+)\n from opencensus.proto.agent.common.v1 import common_pb2\n from opencensus.proto.trace.v1 import trace_pb2\n", "issue": "lint takes a long time\nFix that.\n", "before_files": [{"content": "# Copyright The OpenTelemetry Authors\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 os import getpid\nfrom socket import gethostname\nfrom time import time\n\n# pylint: disable=wrong-import-position\nfrom google.protobuf.timestamp_pb2 import Timestamp\nfrom opencensus.proto.agent.common.v1 import common_pb2\nfrom opencensus.proto.trace.v1 import trace_pb2\n\nfrom opentelemetry.exporter.opencensus.version import (\n    __version__ as opencensusexporter_exporter_version,\n)\nfrom opentelemetry.trace import SpanKind\nfrom opentelemetry.util._importlib_metadata import version\n\nOPENTELEMETRY_VERSION = version(\"opentelemetry-api\")\n\n\ndef proto_timestamp_from_time_ns(time_ns):\n    \"\"\"Converts datetime to protobuf timestamp.\n\n    Args:\n        time_ns: Time in nanoseconds\n\n    Returns:\n        Returns protobuf timestamp.\n    \"\"\"\n    ts = Timestamp()\n    if time_ns is not None:\n        # pylint: disable=no-member\n        ts.FromNanoseconds(time_ns)\n    return ts\n\n\n# pylint: disable=no-member\ndef get_collector_span_kind(kind: SpanKind):\n    if kind is SpanKind.SERVER:\n        return trace_pb2.Span.SpanKind.SERVER\n    if kind is SpanKind.CLIENT:\n        return trace_pb2.Span.SpanKind.CLIENT\n    return trace_pb2.Span.SpanKind.SPAN_KIND_UNSPECIFIED\n\n\ndef add_proto_attribute_value(pb_attributes, key, value):\n    \"\"\"Sets string, int, boolean or float value on protobuf\n        span, link or annotation attributes.\n\n    Args:\n        pb_attributes: protobuf Span's attributes property.\n        key: attribute key to set.\n        value: attribute value\n    \"\"\"\n\n    if isinstance(value, bool):\n        pb_attributes.attribute_map[key].bool_value = value\n    elif isinstance(value, int):\n        pb_attributes.attribute_map[key].int_value = value\n    elif isinstance(value, str):\n        pb_attributes.attribute_map[key].string_value.value = value\n    elif isinstance(value, float):\n        pb_attributes.attribute_map[key].double_value = value\n    else:\n        pb_attributes.attribute_map[key].string_value.value = str(value)\n\n\n# pylint: disable=no-member\ndef get_node(service_name, host_name):\n    \"\"\"Generates Node message from params and system information.\n\n    Args:\n       service_name: Name of Collector service.\n       host_name: Host name.\n    \"\"\"\n    return common_pb2.Node(\n        identifier=common_pb2.ProcessIdentifier(\n            host_name=gethostname() if host_name is None else host_name,\n            pid=getpid(),\n            start_timestamp=proto_timestamp_from_time_ns(int(time() * 1e9)),\n        ),\n        library_info=common_pb2.LibraryInfo(\n            language=common_pb2.LibraryInfo.Language.Value(\"PYTHON\"),\n            exporter_version=opencensusexporter_exporter_version,\n            core_library_version=OPENTELEMETRY_VERSION,\n        ),\n        service_info=common_pb2.ServiceInfo(name=service_name),\n    )\n", "path": "exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py"}]}