Skip to content

Commit

Permalink
CI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oremanj committed Jun 5, 2023
1 parent 7df361b commit 951716c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
20 changes: 11 additions & 9 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# https://docs.readthedocs.io/en/latest/yaml-config.html
# https://docs.readthedocs.io/en/latest/config-file/index.html
version: 2

formats:
- htmlzip
- epub

requirements_file: docs-requirements.txt

# Currently RTD's default image only has 3.5
# This gets us 3.6 (and hopefully 3.7 in the future)
# https://docs.readthedocs.io/en/latest/yaml-config.html#build-image
build:
image: latest
os: "ubuntu-22.04"
tools:
python: "3.11"

python:
version: 3.6
pip_install: True
install:
- requirements: docs-requirements.txt

sphinx:
fail_on_warning: true
6 changes: 5 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@
("py:obj", "bytes-like"),
("py:class", "None"),
("py:exc", "Anything else"),
("py:class", "tricycle._rwlock._RWLockStatistics"),
("py:class", "tricycle._tree_var.T"),
("py:class", "tricycle._tree_var.U"),
]
default_role = "obj"

# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -104,7 +108,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
6 changes: 3 additions & 3 deletions tricycle/_tests/test_tree_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def trivial_abort(_: object) -> trio.lowlevel.Abort:
return trio.lowlevel.Abort.SUCCEEDED # pragma: no cover


async def test_treevar_follows_eventual_parent():
async def test_treevar_follows_eventual_parent() -> None:
tv1 = TreeVar[str]("tv1")

async def manage_target(task_status: TaskStatus[trio.Nursery]) -> None:
Expand Down Expand Up @@ -106,7 +106,7 @@ async def test_treevar_token_bound_to_task_that_obtained_it() -> None:
tv1 = TreeVar[int]("tv1")
token: Optional[TreeVarToken[int]] = None

async def get_token():
async def get_token() -> None:
nonlocal token
token = tv1.set(10)
try:
Expand Down Expand Up @@ -141,4 +141,4 @@ async def run_sync(fn: Any, *args: Any) -> Any:
tv1.being(40).__enter__,
):
with pytest.raises(RuntimeError, match="must be called from async context"):
operation()
operation() # type: ignore
19 changes: 14 additions & 5 deletions tricycle/_tree_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@
import trio
import weakref
from contextlib import contextmanager
from typing import TypeVar, Generic, Any, MutableMapping, cast, overload
from typing import (
TypeVar,
Generic,
Any,
Iterator,
MutableMapping,
Optional,
Union,
cast,
overload,
)

T = TypeVar("T")
U = TypeVar("U")
Expand Down Expand Up @@ -106,7 +116,7 @@ def _fetch(
self,
for_task: trio.lowlevel.Task,
current_task: Optional[trio.lowlevel.Task],
) -> None:
) -> _TreeVarState[T]:
"""Return the _TreeVarState associated with *for_task*, inheriting
it from a parent nursery if necessary.
"""
Expand Down Expand Up @@ -190,9 +200,7 @@ def being(self, value: T) -> Iterator[None]:
self.reset(token)

@overload
def get_in(
self, task_or_nursery: Union[trio.lowlevel.Task, trio.Nursery]
) -> T:
def get_in(self, task_or_nursery: Union[trio.lowlevel.Task, trio.Nursery]) -> T:
...

@overload
Expand Down Expand Up @@ -224,6 +232,7 @@ def get_in(
if task is task_or_nursery:
result = state.value_for_task
else:
assert isinstance(task_or_nursery, trio.Nursery)
result = state.value_for_children.get(task_or_nursery, state.value_for_task)
if result is not MISSING:
return result
Expand Down

0 comments on commit 951716c

Please sign in to comment.