prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Python 3.12 has deprecation warnings
  Ariadne produces few warnings when ran on Py3.12. Most of those are out of our hands as they are coming from dependencies, but there are some we should fix:
  
  ```
  
    /ariadne/ariadne/contrib/tracing/apollotracing.py:36: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
      self.start_date = datetime.utcnow()
  
    /ariadne/ariadne/contrib/tracing/apollotracing.py:96: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
      "end": datetime.utcnow(),
  ```
  
  </issue>
  <code>
  [start of ariadne/contrib/tracing/apollotracing.py]
  1 from datetime import datetime
  2 from inspect import iscoroutinefunction
  3 from typing import Any, List, Optional, cast
  4 
  5 from graphql import GraphQLResolveInfo
  6 from graphql.pyutils import is_awaitable
  7 
  8 from ...types import ContextValue, Extension, Resolver
  9 from .utils import format_path, should_trace
  10 
  11 try:
  12     from time import perf_counter_ns
  13 except ImportError:
  14     # Py 3.6 fallback
  15     from time import perf_counter
  16 
  17     NS_IN_SECOND = 1000000000
  18 
  19     def perf_counter_ns() -> int:
  20         return int(perf_counter() * NS_IN_SECOND)
  21 
  22 
  23 TIMESTAMP_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
  24 
  25 
  26 class ApolloTracingExtension(Extension):
  27     def __init__(self, trace_default_resolver: bool = False) -> None:
  28         self.trace_default_resolver = trace_default_resolver
  29         self.start_date: Optional[datetime] = None
  30         self.start_timestamp: int = 0
  31         self.resolvers: List[dict] = []
  32 
  33         self._totals = None
  34 
  35     def request_started(self, context: ContextValue):
  36         self.start_date = datetime.utcnow()
  37         self.start_timestamp = perf_counter_ns()
  38 
  39     def resolve(self, next_: Resolver, obj: Any, info: GraphQLResolveInfo, **kwargs):
  40         if not should_trace(info, self.trace_default_resolver):
  41             return next_(obj, info, **kwargs)
  42 
  43         if iscoroutinefunction(next_):
  44             return self.resolve_async(next_, obj, info, **kwargs)
  45 
  46         return self.resolve_sync(next_, obj, info, **kwargs)
  47 
  48     async def resolve_async(
  49         self, next_: Resolver, obj: Any, info: GraphQLResolveInfo, **kwargs
  50     ):
  51         start_timestamp = perf_counter_ns()
  52         record = {
  53             "path": format_path(info.path),
  54             "parentType": str(info.parent_type),
  55             "fieldName": info.field_name,
  56             "returnType": str(info.return_type),
  57             "startOffset": start_timestamp - cast(int, self.start_timestamp),
  58         }
  59         self.resolvers.append(record)
  60         try:
  61             result = next_(obj, info, **kwargs)
  62             if is_awaitable(result):
  63                 result = await result
  64             return result
  65         finally:
  66             end_timestamp = perf_counter_ns()
  67             record["duration"] = end_timestamp - start_timestamp
  68 
  69     def resolve_sync(
  70         self, next_: Resolver, obj: Any, info: GraphQLResolveInfo, **kwargs
  71     ):
  72         start_timestamp = perf_counter_ns()
  73         record = {
  74             "path": format_path(info.path),
  75             "parentType": str(info.parent_type),
  76             "fieldName": info.field_name,
  77             "returnType": str(info.return_type),
  78             "startOffset": start_timestamp - cast(int, self.start_timestamp),
  79         }
  80         self.resolvers.append(record)
  81         try:
  82             result = next_(obj, info, **kwargs)
  83             return result
  84         finally:
  85             end_timestamp = perf_counter_ns()
  86             record["duration"] = end_timestamp - start_timestamp
  87 
  88     def get_totals(self):
  89         if self._totals is None:
  90             self._totals = self._get_totals()
  91         return self._totals
  92 
  93     def _get_totals(self):
  94         return {
  95             "start": self.start_date,
  96             "end": datetime.utcnow(),
  97             "duration": perf_counter_ns() - self.start_timestamp,
  98             "resolvers": self.resolvers,
  99         }
  100 
  101     def format(self, context: ContextValue):
  102         totals = self.get_totals()
  103 
  104         return {
  105             "tracing": {
  106                 "version": 1,
  107                 "startTime": totals["start"].strftime(TIMESTAMP_FORMAT),
  108                 "endTime": totals["end"].strftime(TIMESTAMP_FORMAT),
  109                 "duration": totals["duration"],
  110                 "execution": {"resolvers": totals["resolvers"]},
  111             }
  112         }
  113
  [end of ariadne/contrib/tracing/apollotracing.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/ariadne/contrib/tracing/apollotracing.py b/ariadne/contrib/tracing/apollotracing.py
  --- a/ariadne/contrib/tracing/apollotracing.py
  +++ b/ariadne/contrib/tracing/apollotracing.py
  @@ -1,4 +1,3 @@
  -from datetime import datetime
   from inspect import iscoroutinefunction
   from typing import Any, List, Optional, cast
   
  @@ -20,6 +19,19 @@
           return int(perf_counter() * NS_IN_SECOND)
   
   
  +try:
  +    from datetime import UTC, datetime  # type: ignore[attr-defined]
  +
  +    def utc_now():
  +        return datetime.now(UTC)
  +
  +except ImportError:
  +    from datetime import datetime
  +
  +    def utc_now():
  +        return datetime.utcnow()
  +
  +
   TIMESTAMP_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
   
   
  @@ -33,7 +45,7 @@
           self._totals = None
   
       def request_started(self, context: ContextValue):
  -        self.start_date = datetime.utcnow()
  +        self.start_date = utc_now()
           self.start_timestamp = perf_counter_ns()
   
       def resolve(self, next_: Resolver, obj: Any, info: GraphQLResolveInfo, **kwargs):
  @@ -93,7 +105,7 @@
       def _get_totals(self):
           return {
               "start": self.start_date,
  -            "end": datetime.utcnow(),
  +            "end": utc_now(),
               "duration": perf_counter_ns() - self.start_timestamp,
               "resolvers": self.resolvers,
           }
  
verification_info: {"golden_diff": "diff --git a/ariadne/contrib/tracing/apollotracing.py b/ariadne/contrib/tracing/apollotracing.py\n--- a/ariadne/contrib/tracing/apollotracing.py\n+++ b/ariadne/contrib/tracing/apollotracing.py\n@@ -1,4 +1,3 @@\n-from datetime import datetime\n from inspect import iscoroutinefunction\n from typing import Any, List, Optional, cast\n \n@@ -20,6 +19,19 @@\n         return int(perf_counter() * NS_IN_SECOND)\n \n \n+try:\n+    from datetime import UTC, datetime  # type: ignore[attr-defined]\n+\n+    def utc_now():\n+        return datetime.now(UTC)\n+\n+except ImportError:\n+    from datetime import datetime\n+\n+    def utc_now():\n+        return datetime.utcnow()\n+\n+\n TIMESTAMP_FORMAT = \"%Y-%m-%dT%H:%M:%S.%fZ\"\n \n \n@@ -33,7 +45,7 @@\n         self._totals = None\n \n     def request_started(self, context: ContextValue):\n-        self.start_date = datetime.utcnow()\n+        self.start_date = utc_now()\n         self.start_timestamp = perf_counter_ns()\n \n     def resolve(self, next_: Resolver, obj: Any, info: GraphQLResolveInfo, **kwargs):\n@@ -93,7 +105,7 @@\n     def _get_totals(self):\n         return {\n             \"start\": self.start_date,\n-            \"end\": datetime.utcnow(),\n+            \"end\": utc_now(),\n             \"duration\": perf_counter_ns() - self.start_timestamp,\n             \"resolvers\": self.resolvers,\n         }\n", "issue": "Python 3.12 has deprecation warnings\nAriadne produces few warnings when ran on Py3.12. Most of those are out of our hands as they are coming from dependencies, but there are some we should fix:\r\n\r\n```\r\n\r\n  /ariadne/ariadne/contrib/tracing/apollotracing.py:36: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).\r\n    self.start_date = datetime.utcnow()\r\n\r\n  /ariadne/ariadne/contrib/tracing/apollotracing.py:96: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).\r\n    \"end\": datetime.utcnow(),\r\n```\n", "before_files": [{"content": "from datetime import datetime\nfrom inspect import iscoroutinefunction\nfrom typing import Any, List, Optional, cast\n\nfrom graphql import GraphQLResolveInfo\nfrom graphql.pyutils import is_awaitable\n\nfrom ...types import ContextValue, Extension, Resolver\nfrom .utils import format_path, should_trace\n\ntry:\n    from time import perf_counter_ns\nexcept ImportError:\n    # Py 3.6 fallback\n    from time import perf_counter\n\n    NS_IN_SECOND = 1000000000\n\n    def perf_counter_ns() -> int:\n        return int(perf_counter() * NS_IN_SECOND)\n\n\nTIMESTAMP_FORMAT = \"%Y-%m-%dT%H:%M:%S.%fZ\"\n\n\nclass ApolloTracingExtension(Extension):\n    def __init__(self, trace_default_resolver: bool = False) -> None:\n        self.trace_default_resolver = trace_default_resolver\n        self.start_date: Optional[datetime] = None\n        self.start_timestamp: int = 0\n        self.resolvers: List[dict] = []\n\n        self._totals = None\n\n    def request_started(self, context: ContextValue):\n        self.start_date = datetime.utcnow()\n        self.start_timestamp = perf_counter_ns()\n\n    def resolve(self, next_: Resolver, obj: Any, info: GraphQLResolveInfo, **kwargs):\n        if not should_trace(info, self.trace_default_resolver):\n            return next_(obj, info, **kwargs)\n\n        if iscoroutinefunction(next_):\n            return self.resolve_async(next_, obj, info, **kwargs)\n\n        return self.resolve_sync(next_, obj, info, **kwargs)\n\n    async def resolve_async(\n        self, next_: Resolver, obj: Any, info: GraphQLResolveInfo, **kwargs\n    ):\n        start_timestamp = perf_counter_ns()\n        record = {\n            \"path\": format_path(info.path),\n            \"parentType\": str(info.parent_type),\n            \"fieldName\": info.field_name,\n            \"returnType\": str(info.return_type),\n            \"startOffset\": start_timestamp - cast(int, self.start_timestamp),\n        }\n        self.resolvers.append(record)\n        try:\n            result = next_(obj, info, **kwargs)\n            if is_awaitable(result):\n                result = await result\n            return result\n        finally:\n            end_timestamp = perf_counter_ns()\n            record[\"duration\"] = end_timestamp - start_timestamp\n\n    def resolve_sync(\n        self, next_: Resolver, obj: Any, info: GraphQLResolveInfo, **kwargs\n    ):\n        start_timestamp = perf_counter_ns()\n        record = {\n            \"path\": format_path(info.path),\n            \"parentType\": str(info.parent_type),\n            \"fieldName\": info.field_name,\n            \"returnType\": str(info.return_type),\n            \"startOffset\": start_timestamp - cast(int, self.start_timestamp),\n        }\n        self.resolvers.append(record)\n        try:\n            result = next_(obj, info, **kwargs)\n            return result\n        finally:\n            end_timestamp = perf_counter_ns()\n            record[\"duration\"] = end_timestamp - start_timestamp\n\n    def get_totals(self):\n        if self._totals is None:\n            self._totals = self._get_totals()\n        return self._totals\n\n    def _get_totals(self):\n        return {\n            \"start\": self.start_date,\n            \"end\": datetime.utcnow(),\n            \"duration\": perf_counter_ns() - self.start_timestamp,\n            \"resolvers\": self.resolvers,\n        }\n\n    def format(self, context: ContextValue):\n        totals = self.get_totals()\n\n        return {\n            \"tracing\": {\n                \"version\": 1,\n                \"startTime\": totals[\"start\"].strftime(TIMESTAMP_FORMAT),\n                \"endTime\": totals[\"end\"].strftime(TIMESTAMP_FORMAT),\n                \"duration\": totals[\"duration\"],\n                \"execution\": {\"resolvers\": totals[\"resolvers\"]},\n            }\n        }\n", "path": "ariadne/contrib/tracing/apollotracing.py"}]}