prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Context docs are broken
  For some reason the actual `context` class signature is not being documented.
  
  </issue>
  <code>
  [start of src/prefect/utilities/context.py]
  1 # Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/beta-eula
  2 
  3 """
  4 This module implements the Prefect context that is available when tasks run.
  5 
  6 Tasks can import prefect.context and access attributes that will be overwritten
  7 when the task is run.
  8 
  9 Example:
  10 
  11 ```python
  12 import prefect.context
  13 with prefect.context(a=1, b=2):
  14     print(prefect.context.a) # 1
  15 print (prefect.context.a) # undefined
  16 ```
  17 
  18 Prefect provides various key / value pairs in context that are always available during task runs:
  19 
  20 | Variable | Description |
  21 | :--- | --- |
  22 | `scheduled_start_time` | an actual datetime object representing the scheduled start time for the Flow run; falls back to `now` for unscheduled runs |
  23 | `date` | an actual datetime object representing the current time |
  24 | `today` | the current date formatted as `YYYY-MM-DD`|
  25 | `today_nodash` | the current date formatted as `YYYYMMDD`|
  26 | `yesterday` | yesterday's date formatted as `YYYY-MM-DD`|
  27 | `yesterday_nodash` | yesterday's date formatted as `YYYYMMDD`|
  28 | `tomorrow` | tomorrow's date formatted as `YYYY-MM-DD`|
  29 | `tomorrow_nodash` | tomorrow's date formatted as `YYYYMMDD`|
  30 | `task_name` | the name of the current task |
  31 """
  32 
  33 import contextlib
  34 import threading
  35 from typing import Any, Iterator, MutableMapping
  36 
  37 from prefect.configuration import config
  38 from prefect.utilities.collections import DotDict
  39 
  40 
  41 class Context(DotDict, threading.local):
  42     """
  43     A thread safe context store for Prefect data.
  44 
  45     The `Context` is a `DotDict` subclass, and can be instantiated the same way.
  46 
  47     Args:
  48         - *args (Any): arguments to provide to the `DotDict` constructor (e.g.,
  49             an initial dictionary)
  50         - *kwargs (Any): any key / value pairs to initialize this context with
  51     """
  52 
  53     def __init__(self, *args, **kwargs) -> None:
  54         super().__init__(*args, **kwargs)
  55         if "context" in config:
  56             self.update(config.context)
  57 
  58     def __repr__(self) -> str:
  59         return "<Context>"
  60 
  61     @contextlib.contextmanager
  62     def __call__(self, *args: MutableMapping, **kwargs: Any) -> Iterator["Context"]:
  63         """
  64         A context manager for setting / resetting the Prefect context
  65 
  66         Example:
  67             import prefect.context
  68             with prefect.context(dict(a=1, b=2), c=3):
  69                 print(prefect.context.a) # 1
  70         """
  71         previous_context = self.copy()
  72         try:
  73             self.update(*args, **kwargs)
  74             yield self
  75         finally:
  76             self.clear()
  77             self.update(previous_context)
  78 
  79 
  80 context = Context()
  81
  [end of src/prefect/utilities/context.py]
  [start of src/prefect/tasks/templates/jinja2.py]
  1 # Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/beta-eula
  2 
  3 from typing import Any
  4 
  5 from jinja2 import Template
  6 
  7 import prefect
  8 from prefect import Task
  9 
  10 
  11 class JinjaTemplateTask(Task):
  12     """
  13     This task contains a Jinja template which is formatted with the results of any
  14     upstream tasks and returned.
  15 
  16     Variables from `prefect.context` will also be used for rendering.
  17 
  18     Args:
  19         - template (str, optional): the optional _default_ template string to render at runtime;
  20             can also be provided as a keyword to `run`, which takes precendence over this default.
  21         - **kwargs (optional): additional keyword arguments to pass to the
  22             standard Task constructor
  23     """
  24 
  25     def __init__(self, template: str = None, **kwargs: Any):
  26         self.template = Template(template or "")
  27         super().__init__(**kwargs)
  28 
  29     def run(self, template: str = None, **format_kwargs: Any) -> str:  # type: ignore
  30         """
  31         Formats the Jinja Template with the provided kwargs.
  32 
  33         Args:
  34             - template (str, optional): the template string to render; if not
  35                 provided, `self.template` will be used
  36             - **format_kwargs (optional): keyword arguments to use for
  37                 rendering; note that variables from `prefect.context` will also be used
  38 
  39         Returns:
  40             - str: the rendered string
  41         """
  42         template = self.template if template is None else Template(template)
  43         with prefect.context(**format_kwargs) as data:
  44             return template.render(**data)
  45
  [end of src/prefect/tasks/templates/jinja2.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/prefect/tasks/templates/jinja2.py b/src/prefect/tasks/templates/jinja2.py
  --- a/src/prefect/tasks/templates/jinja2.py
  +++ b/src/prefect/tasks/templates/jinja2.py
  @@ -6,6 +6,7 @@
   
   import prefect
   from prefect import Task
  +from prefect.utilities.tasks import defaults_from_attrs
   
   
   class JinjaTemplateTask(Task):
  @@ -23,9 +24,10 @@
       """
   
       def __init__(self, template: str = None, **kwargs: Any):
  -        self.template = Template(template or "")
  +        self.template = template or ""
           super().__init__(**kwargs)
   
  +    @defaults_from_attrs("template")
       def run(self, template: str = None, **format_kwargs: Any) -> str:  # type: ignore
           """
           Formats the Jinja Template with the provided kwargs.
  @@ -39,6 +41,6 @@
           Returns:
               - str: the rendered string
           """
  -        template = self.template if template is None else Template(template)
  +        template = Template(template)
           with prefect.context(**format_kwargs) as data:
               return template.render(**data)
  diff --git a/src/prefect/utilities/context.py b/src/prefect/utilities/context.py
  --- a/src/prefect/utilities/context.py
  +++ b/src/prefect/utilities/context.py
  @@ -10,9 +10,11 @@
   
   ```python
   import prefect.context
  +
   with prefect.context(a=1, b=2):
       print(prefect.context.a) # 1
  -print (prefect.context.a) # undefined
  +
  +print(prefect.context.a) # undefined
   ```
   
   Prefect provides various key / value pairs in context that are always available during task runs:
  @@ -28,6 +30,8 @@
   | `tomorrow` | tomorrow's date formatted as `YYYY-MM-DD`|
   | `tomorrow_nodash` | tomorrow's date formatted as `YYYYMMDD`|
   | `task_name` | the name of the current task |
  +
  +Users can also provide values to context at runtime.
   """
   
   import contextlib
  
verification_info: {"golden_diff": "diff --git a/src/prefect/tasks/templates/jinja2.py b/src/prefect/tasks/templates/jinja2.py\n--- a/src/prefect/tasks/templates/jinja2.py\n+++ b/src/prefect/tasks/templates/jinja2.py\n@@ -6,6 +6,7 @@\n \n import prefect\n from prefect import Task\n+from prefect.utilities.tasks import defaults_from_attrs\n \n \n class JinjaTemplateTask(Task):\n@@ -23,9 +24,10 @@\n     \"\"\"\n \n     def __init__(self, template: str = None, **kwargs: Any):\n-        self.template = Template(template or \"\")\n+        self.template = template or \"\"\n         super().__init__(**kwargs)\n \n+    @defaults_from_attrs(\"template\")\n     def run(self, template: str = None, **format_kwargs: Any) -> str:  # type: ignore\n         \"\"\"\n         Formats the Jinja Template with the provided kwargs.\n@@ -39,6 +41,6 @@\n         Returns:\n             - str: the rendered string\n         \"\"\"\n-        template = self.template if template is None else Template(template)\n+        template = Template(template)\n         with prefect.context(**format_kwargs) as data:\n             return template.render(**data)\ndiff --git a/src/prefect/utilities/context.py b/src/prefect/utilities/context.py\n--- a/src/prefect/utilities/context.py\n+++ b/src/prefect/utilities/context.py\n@@ -10,9 +10,11 @@\n \n ```python\n import prefect.context\n+\n with prefect.context(a=1, b=2):\n     print(prefect.context.a) # 1\n-print (prefect.context.a) # undefined\n+\n+print(prefect.context.a) # undefined\n ```\n \n Prefect provides various key / value pairs in context that are always available during task runs:\n@@ -28,6 +30,8 @@\n | `tomorrow` | tomorrow's date formatted as `YYYY-MM-DD`|\n | `tomorrow_nodash` | tomorrow's date formatted as `YYYYMMDD`|\n | `task_name` | the name of the current task |\n+\n+Users can also provide values to context at runtime.\n \"\"\"\n \n import contextlib\n", "issue": "Context docs are broken\nFor some reason the actual `context` class signature is not being documented.\n", "before_files": [{"content": "# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/beta-eula\n\n\"\"\"\nThis module implements the Prefect context that is available when tasks run.\n\nTasks can import prefect.context and access attributes that will be overwritten\nwhen the task is run.\n\nExample:\n\n```python\nimport prefect.context\nwith prefect.context(a=1, b=2):\n    print(prefect.context.a) # 1\nprint (prefect.context.a) # undefined\n```\n\nPrefect provides various key / value pairs in context that are always available during task runs:\n\n| Variable | Description |\n| :--- | --- |\n| `scheduled_start_time` | an actual datetime object representing the scheduled start time for the Flow run; falls back to `now` for unscheduled runs |\n| `date` | an actual datetime object representing the current time |\n| `today` | the current date formatted as `YYYY-MM-DD`|\n| `today_nodash` | the current date formatted as `YYYYMMDD`|\n| `yesterday` | yesterday's date formatted as `YYYY-MM-DD`|\n| `yesterday_nodash` | yesterday's date formatted as `YYYYMMDD`|\n| `tomorrow` | tomorrow's date formatted as `YYYY-MM-DD`|\n| `tomorrow_nodash` | tomorrow's date formatted as `YYYYMMDD`|\n| `task_name` | the name of the current task |\n\"\"\"\n\nimport contextlib\nimport threading\nfrom typing import Any, Iterator, MutableMapping\n\nfrom prefect.configuration import config\nfrom prefect.utilities.collections import DotDict\n\n\nclass Context(DotDict, threading.local):\n    \"\"\"\n    A thread safe context store for Prefect data.\n\n    The `Context` is a `DotDict` subclass, and can be instantiated the same way.\n\n    Args:\n        - *args (Any): arguments to provide to the `DotDict` constructor (e.g.,\n            an initial dictionary)\n        - *kwargs (Any): any key / value pairs to initialize this context with\n    \"\"\"\n\n    def __init__(self, *args, **kwargs) -> None:\n        super().__init__(*args, **kwargs)\n        if \"context\" in config:\n            self.update(config.context)\n\n    def __repr__(self) -> str:\n        return \"<Context>\"\n\n    @contextlib.contextmanager\n    def __call__(self, *args: MutableMapping, **kwargs: Any) -> Iterator[\"Context\"]:\n        \"\"\"\n        A context manager for setting / resetting the Prefect context\n\n        Example:\n            import prefect.context\n            with prefect.context(dict(a=1, b=2), c=3):\n                print(prefect.context.a) # 1\n        \"\"\"\n        previous_context = self.copy()\n        try:\n            self.update(*args, **kwargs)\n            yield self\n        finally:\n            self.clear()\n            self.update(previous_context)\n\n\ncontext = Context()\n", "path": "src/prefect/utilities/context.py"}, {"content": "# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/beta-eula\n\nfrom typing import Any\n\nfrom jinja2 import Template\n\nimport prefect\nfrom prefect import Task\n\n\nclass JinjaTemplateTask(Task):\n    \"\"\"\n    This task contains a Jinja template which is formatted with the results of any\n    upstream tasks and returned.\n\n    Variables from `prefect.context` will also be used for rendering.\n\n    Args:\n        - template (str, optional): the optional _default_ template string to render at runtime;\n            can also be provided as a keyword to `run`, which takes precendence over this default.\n        - **kwargs (optional): additional keyword arguments to pass to the\n            standard Task constructor\n    \"\"\"\n\n    def __init__(self, template: str = None, **kwargs: Any):\n        self.template = Template(template or \"\")\n        super().__init__(**kwargs)\n\n    def run(self, template: str = None, **format_kwargs: Any) -> str:  # type: ignore\n        \"\"\"\n        Formats the Jinja Template with the provided kwargs.\n\n        Args:\n            - template (str, optional): the template string to render; if not\n                provided, `self.template` will be used\n            - **format_kwargs (optional): keyword arguments to use for\n                rendering; note that variables from `prefect.context` will also be used\n\n        Returns:\n            - str: the rendered string\n        \"\"\"\n        template = self.template if template is None else Template(template)\n        with prefect.context(**format_kwargs) as data:\n            return template.render(**data)\n", "path": "src/prefect/tasks/templates/jinja2.py"}]}