Uv - #188
Open
KotlinIsland wants to merge 4 commits into
Open
Conversation
Contributor
ecosystem checkLinter (stable)✅ ecosystem check detected no linter changes. Linter (preview)✅ ecosystem check detected no linter changes. Formatter (stable)✅ ecosystem check detected no format changes. Formatter (preview)✅ ecosystem check detected no format changes. |
Contributor
by ecosystem round-tripbase: regressions: 0, changed: 2958, improvements: 0, error changes: 0 (across 25945 files in 148 projects) ℹ️ changed round-trip outputPyWinCtl — _by_sourcemap.py--- base/_by_sourcemap.py
+++ head/_by_sourcemap.py
@@ -8,15 +8,15 @@
... 21976 characters elided ...
+ "/tmp/tmpoa6lj7we/PyWinCtl/out/typings/Quartz/__init__.pyi": {"by": "sha256:9074b929caabccf48f8d62eb1cf393d40afd0fa9affb0b87eea35d85c024cea6", "py": "sha256:11fa88b01c5efc156ac94490a64ad6b3723df24dd05ff9ccddbdce6146b30824"},
}PyWinCtl — typings/AppKit.py(only produced on base)PyWinCtl — typings/Quartz/CoreGraphics/__init__.py(only produced on base)PyWinCtl — typings/Quartz/CoreVideo/__init__.py(only produced on base)PyWinCtl — typings/Quartz/ImageIO/__init__.py(only produced on base)PyWinCtl — typings/Quartz/ImageKit/__init__.py(only produced on base)PyWinCtl — typings/Quartz/PDFKit/__init__.py(only produced on base)PyWinCtl — typings/Quartz/QuartzComposer/__init__.py(only produced on base)PyWinCtl — typings/Quartz/QuartzCore/__init__.py(only produced on base)PyWinCtl — typings/Quartz/QuartzFilters/__init__.py(only produced on base)PyWinCtl — typings/Quartz/QuickLookUI/__init__.py(only produced on base)PyWinCtl — typings/Quartz/__init__.py(only produced on base)artigraph — stubs/box.py(only produced on base)artigraph — stubs/parse.py(only produced on base)asynq — _by_sourcemap.py--- base/_by_sourcemap.py
+++ head/_by_sourcemap.py
@@ -3,30 +3,30 @@
SOURCEMAP = {
"/tmp/tmpoa6lj7we/asynq/out/asynq/__init__.py": ("/tmp/tmpoa6lj7we/asynq/asynq/__init__.by", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70]),
- "/tmp/tmpoa6lj7we/asynq/out/asynq/__init__.py": ("/tmp/tmpoa6lj7we/asynq/asynq/__init__.byi", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]),
... 41641 characters elided ...
"/tmp/tmpoa6lj7we/asynq/out/examples/batching.py": {"by": "sha256:459b5e576ee03cb2cd3f7d410b89fca08ff918d969d1c6aba9b43543bce383c9", "py": "sha256:4538e902222621bd540f192d9b136ac828971ad6d9687544ff142902d223b2ae"},asynq — asynq/__init__.py--- base/asynq/__init__.py
+++ head/asynq/__init__.py
@@ -1,2 +1,24 @@
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+
+Asynq is a framework for asynchronous programming in Python.
+
+It supports futures, batching, and asynchronous contexts.
+
+"""
+
lazy from . import debug
lazy from . import futures
@@ -11,51 +33,39 @@
lazy from . import profiler
lazy from .futures import (
- FutureBase as FutureBase,
- Future as Future,
- FutureIsAlreadyComputed as FutureIsAlreadyComputed,
- none_future as none_future,
- ConstFuture as ConstFuture,
... 2088 characters elided ...
- list_of_generator as list_of_generator,
- take_first as take_first,
- Value as Value,
+ END_OF_GENERATOR,
+ async_generator,
+ list_of_generator,
+ take_first,
+ Value,
)
+lazy from .asynq_to_async import is_asyncio_mode
+
+debug.sync = batching.sync
+debug.attach_exception_hook()asynq — asynq/_debug.py--- base/asynq/_debug.py
+++ head/asynq/_debug.py
@@ -1,33 +1,60 @@
-lazy from typing import overload
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+lazy from qcore.debug import get_bool_by_mask, set_by_mask
+
class DebugOptions(object):
- DUMP_PRE_ERROR_STATE: bool
- DUMP_EXCEPTIONS: bool
- DUMP_SCHEDULE_TASK: bool
- DUMP_CONTINUE_TASK: bool
- DUMP_SCHEDULE_BATCH: bool
- DUMP_FLUSH_BATCH: bool
- DUMP_DEPENDENCIES: bool
- DUMP_COMPUTED: bool
- DUMP_NEW_TASKS: bool
- DUMP_YIELD_RESULTS: bool
- DUMP_QUEUED_RESULTS: bool
... 1694 characters elided ...
+ self.KEEP_DEPENDENCIES = False # don't clear dependencies between yields
+
+ def DUMP_ALL(self, value=None):
+ if value is None:
+ return get_bool_by_mask(self, "DUMP_")
+ set_by_mask(self, "DUMP_", value)
+
+
+options = DebugOptions()
+globals()["options"] = optionsasynq — asynq/async_task.py--- base/asynq/async_task.py
+++ head/asynq/async_task.py
@@ -1,28 +1,511 @@
-lazy from typing import Any, Callable
-lazy import types
-lazy from typing import Iterable, List, Mapping, TypeVar
-
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+lazy import inspect
+lazy import sys
+
+lazy import qcore.helpers as core_helpers
... 18703 characters elided ...
+ i = len(value) - 1
+ while i >= 0:
+ extract_futures(value[i], result)
+ i -= 1
+ elif type(value) is dict:
+ for item in value.values():
+ extract_futures(item, result)
+ return resultasynq — asynq/batching.py--- base/asynq/batching.py
+++ head/asynq/batching.py
@@ -1,36 +1,290 @@
-lazy from typing import Any
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
lazy import threading
-lazy from typing import Generic, List, Optional, Tuple, TypeVar
-
+lazy import qcore.inspection as core_inspection
+
+lazy from . import debug
lazy from . import futures
-
-_T = TypeVar("_T", bound=BatchItemBase)
-
-class BatchingError(Exception): ...
-class BatchCancelledError(BatchingError): ...
-
-class BatchBase(futures.FutureBase, Generic[_T]):
- items: List[_T]
- def __init__(self) -> None: ...
... 9207 characters elided ...
+ super(LocalDebugBatchState.__mro__[LocalDebugBatchState.__mro__.index(LocalDebugBatchState) - 1], self).__init__()
+ self.batches = {}
+
+
+_debug_batch_state = LocalDebugBatchState()
+globals()["_debug_batch_state"] = _debug_batch_state
+
+
+def sync(tag="default"):
+ return DebugBatchItem("sync-" + tag)asynq — asynq/contexts.py--- base/asynq/contexts.py
+++ head/asynq/contexts.py
@@ -1,29 +1,104 @@
-lazy from abc import abstractmethod
-lazy from typing import Type, Optional, TypeVar
-lazy from types import TracebackType
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
-_T = TypeVar("_T", bound=AsyncContext)
+lazy import asynq
+
+lazy from .asynq_to_async import is_asyncio_mode
+lazy from . import debug
+lazy from ._debug import options as _debug_options
+
class NonAsyncContext(object):
- def __enter__(self) -> None: ...
- def __exit__(
- self,
... 2777 characters elided ...
+ if is_asyncio_mode():
+ self.pause()
+ else:
+ leave_context(self, self._active_task)
+ self.pause()
+ del self._active_task
+
+ def resume(self):
+ raise NotImplementedError()
+
+ def pause(self):
+ raise NotImplementedError()asynq — asynq/debug.py--- base/asynq/debug.py
+++ head/asynq/debug.py
@@ -1,158 +1,450 @@
-lazy from types import CellType, FunctionType
-lazy from typing import Any, ParamSpec, TypeVarTuple, overload
-class generic:
- def __init__(self, fn, args=None, instance=None, fields=None):
- self.fn = fn
- self.args = args
- self.instance = instance
- self.fields = fields
-
- def __repr__(self):
- return f"<generic {self.fn!r}>"
-
- def __getattr__(self, name):
- if name == "fn":
- raise AttributeError(name)
- return getattr(self.fn, name)
-
- def __get__(self, obj, objtype=None):
- if obj is None:
- return self
- return generic(self.fn, self.args, obj, self.fields)
-
- def _bind(self, supplied, fields):
- params = self.fn.__type_params__
- pack = next((p for p in params if isinstance(p, ParamSpec)), None)
- if pack is None and fields:
- raise TypeError(
- f"{self.fn.__name__} has no keyword-variadic type parameter for "
- f"{', '.join(fields)}"
+# Copyright 2016 Quora, Inc.
+#
... 20493 characters elided ...
+ output.append(tb_list[i])
+ i += 1
+ return output
+
+
+def syntax_highlight_tb(tb_text):
+ """Syntax highlights the traceback so that's a little easier to parse."""
+ lexer = lexers.get_lexer_by_name("pytb", stripall=True)
+ return highlight(tb_text, lexer, formatters.TerminalFormatter())asynq — asynq/decorators.py--- base/asynq/decorators.py
+++ head/asynq/decorators.py
@@ -1,176 +1,461 @@
-lazy from typing import Callable, overload
-lazy from typing import Any, Callable, Coroutine, Generator, Generic, Mapping, Optional, TypeVar, Union
+lazy from typing import Any
+_MISSING = object()
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+lazy import asyncio
+lazy import inspect
+lazy import logging
+lazy from collections.abc import Coroutine
lazy import qcore.decorators
-lazy from typing_extensions import Concatenate, Literal, ParamSpec
+lazy import qcore.helpers as core_helpers
... 21334 characters elided ...
+
+ Arguments:
+ - fn: the function to be wrapped
+ - wrapper_fn: function used to implement the decorator. Must return a Future.
+ - name: name of the decorator (used for introspection)
+
+ """
+ return qcore.decorators.decorate(AsyncWrapper, wrapper_fn, name)(fn)asynq — asynq/futures.py--- base/asynq/futures.py
+++ head/asynq/futures.py
@@ -1,29 +1,234 @@
-lazy from typing import Callable
-lazy from typing import Generic, NoReturn, Optional, TypeVar
-
-_T = TypeVar("_T")
-
-class FutureIsAlreadyComputed(Exception): ...
-
-class FutureBase(Generic[_T]):
- def __init__(self) -> None: ...
- def value(self) -> _T: ...
- def set_value(self, value: _T) -> None: ...
- def reset_unsafe(self) -> None: ...
- def error(self) -> Optional[BaseException]: ...
- def set_error(self, error: BaseException) -> None: ...
- def is_computed(self) -> bool: ...
- def raise_if_error(self) -> None: ...
- def __call__(self) -> _T: ...
- def dump(self, indent: int = ...) -> None: ...
-
-class Future(FutureBase[_T]):
- def __init__(self, value_provider: Callable[..., _T]) -> None: ...
-
-class ConstFuture(FutureBase[_T]):
- def __init__(self, value: _T) -> None: ...
-
-none_future: ConstFuture[None]
-
-class ErrorFuture(FutureBase[NoReturn]):
- def __init__(self, error: BaseException) -> None: ...
+# Copyright 2016 Quora, Inc.
+#
... 6920 characters elided ...
+
+ def __init__(self, error):
+ self._value = _none
+ self._error = None
+ self.on_computed = (
+ core_events.sinking_event_hook
+ ) # Simple performance optimization
+ self.set_error(error)
+ self._in_repr = False # since we don't call super.__init__asynq — asynq/generator.py--- base/asynq/generator.py
+++ head/asynq/generator.py
@@ -1,28 +1,185 @@
-lazy from typing import Any, Callable
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+
+Async generators.
+
+"""
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
lazy import qcore
-lazy from typing import Callable, Generic, List, TypeVar
+lazy import functools
... 5314 characters elided ...
+ try:
+ return self.generator.send(value)
+ except StopIteration:
+ self.is_stopped = True
+ raise
+
+ def __repr__(self):
+ return "<@async_generator() %s %s>" % (
+ self.generator,
+ "stopped" if self.stopped else "",
+ )asynq — asynq/mock_.py--- base/asynq/mock_.py
+++ head/asynq/mock_.py
@@ -1,3 +1,285 @@
-lazy from typing import Any
-
-patch: Any
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+
+Easy mocking for async functions.
+
+This module provides a patch() function that is based on the standard library's mock.patch but
+supports mocking async functions.
+
+This file is named mock_ instead of mock so that it can import the standard mock module.
+
+"""
+_MISSING = object()
+
+lazy import inspect
+lazy from unittest import mock
+
+lazy from .decorators import asynq
+lazy from .futures import ConstFuture
... 6575 characters elided ...
+ # don't want, so we make a wrapper class that overrides __call__
+ class Wrapper(object):
+ def __call__(self, *args, **kwargs):
+ return new(*args, **kwargs)
+
+ return Wrapper()
+ else:
+ return newasynq — asynq/profiler.py--- base/asynq/profiler.py
+++ head/asynq/profiler.py
@@ -1,10 +1,40 @@
-lazy from typing import Any
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
lazy import threading
-lazy from typing import List
-class LocalProfileState(threading.local): ...
-def flush() -> List[Any]: ...
-def append(stats: Any) -> None: ...
-def reset() -> None: ...
-def incr_counter() -> int: ...
+class LocalProfileState(threading.local):
+ def __init__(self):
+ super(LocalProfileState.__mro__[LocalProfileState.__mro__.index(LocalProfileState) - 1], self).__init__()
+ self.stats = []
+ self.counter = 0
+
+
+_state = LocalProfileState()
+globals()["_state"] = _state
+
+
+def flush():
+ out = _soundness_check(_state.stats[:], list)
+ reset()
+ return out
+
+
+def append(stats):
+ _state.stats.append(stats)
+
+
+def reset():
+ _state.stats[:] = []
+ _state.counter = 0
+
+
+def incr_counter():
+ _state.counter = _state.counter + 1
+ return _state.counterasynq — asynq/scheduler.py--- base/asynq/scheduler.py
+++ head/asynq/scheduler.py
@@ -1,20 +1,326 @@
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+lazy from sys import stderr, stdout
+lazy import time
lazy import threading
-lazy from typing import Any, Optional
-
+
+lazy from qcore import utime
+lazy import qcore.events as core_events
+
+
+lazy from . import debug
lazy from . import futures
-
-class AsyncTaskError(Exception): ...
+lazy from . import batching
+lazy from . import _debug
+lazy from .async_task import AsyncTask
+
... 10857 characters elided ...
+
+
+_state = LocalTaskSchedulerState()
+globals()["_state"] = _state
+
+
+def get_scheduler():
+ global _state
+ return _state.current
+
+
+def reset():
+ _state.reset()
+
+
+def get_active_task():
+ global _state
+ s = _state.current
+ return (None if s is None else s.active_task)asynq — asynq/scoped_value.py--- base/asynq/scoped_value.py
+++ head/asynq/scoped_value.py
@@ -1,25 +1,101 @@
-lazy from typing import Any
-lazy from typing import Generic, TypeVar
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+
+Helpers to use scoped values within async functions.
+
+Similar to AsyncContext in that the scope "pauses" and "resumes"
+as the scheduler pauses and resumes the execution of the function
+the scoped values are defined/overridden within.
+
+See tests/test_scoped_value.py for examples.
+
+"""
+
+lazy import qcore
lazy from . import contexts
-_T = TypeVar("_T")
... 2300 characters elided ...
+
+ def __repr__(self):
+ return (
+ "_AsyncPropertyOverrideContext(target=%r, property_name=%r, value=%r)"
+ % (self._target, self._property_name, self._value)
+ )
+
async_override = _AsyncPropertyOverrideContext
+globals()["async_override"] = async_overrideasynq — asynq/tools.py--- base/asynq/tools.py
+++ head/asynq/tools.py
@@ -1,81 +1,517 @@
-lazy from ty_extensions import JustFloat
-lazy from typing import Any, Callable, overload
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+
+Helper functions for use with asynq (similar to itertools).
+
+"""
+lazy from typing import Any
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
+def _soundness_iter(_it, _t):
... 18110 characters elided ...
+ @asynq()
+ def wrapped(*args):
+ error = None
+ try:
+ yield async_call.asynq(handler, *args)
+ except BaseException as e:
+ prepare_for_reraise(e)
+ error = e
+ return error
+
+ return wrappedasynq — asynq/utils.py--- base/asynq/utils.py
+++ head/asynq/utils.py
@@ -1,3 +1,25 @@
-lazy from typing import NoReturn
+# Copyright 2016 Quora, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
-def result(value: object) -> NoReturn: ...
+lazy from .futures import FutureBase
+lazy from . import async_task
+lazy from . import _debug
+
+_debug_options = _debug.options
+
+
+def result(value):
+ """An async equivalent for return for async methods: result(x); return."""
+ assert not isinstance(value, FutureBase), "You probably forgot to yield this value before returning"
+ raise async_task.AsyncTaskResult(value)attrs — attr/__init__.py--- base/attr/__init__.py
+++ head/attr/__init__.py
@@ -1,377 +1,128 @@
-lazy from typing import overload
-lazy import enum
+# SPDX-License-Identifier: MIT
+
+"""
+Classes Without Boilerplate
+"""
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
+
lazy import sys
-lazy from typing import Any, Callable, Generic, Literal, Mapping, Protocol, Sequence, TypeVar
+lazy from functools import partial
+lazy from typing import Callable, Literal, Protocol
-# `import X as X` is required to make these public
-lazy from . import converters as converters
-lazy from . import exceptions as exceptions
-lazy from . import filters as filters
-lazy from . import setters as setters
-lazy from . import validators as validators
-lazy from ._cmp import cmp_using as cmp_using
-lazy from ._typing_compat import AttrsInstance_
+lazy from . import exceptions, setters
+lazy from ._cmp import cmp_using
... 13327 characters elided ...
+
+ if name == "__version_info__":
+ return VersionInfo._from_version_string(meta["version"])
+
+ return meta["version"]
+
+ return __getattr__
+
+
+__getattr__ = _make_getattr(__name__)
+
+
+def __dir__() -> list[str]:
+ return _soundness_check(sorted(set[str](globals()) | set[str](__all__)), list)attrs — attr/_cmp.py--- base/attr/_cmp.py
+++ head/attr/_cmp.py
@@ -1,13 +1,168 @@
-lazy from typing import Any, Callable
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
-_CompareWithType = Callable[[Any, Any], bool]
+# SPDX-License-Identifier: MIT
+
+
+lazy import functools
+lazy import types
+
+lazy from ._make import __ne__
+
+
+_operation_names = {"eq": "==", "lt": "<", "le": "<=", "gt": ">", "ge": ">="}
+
def cmp_using(
- eq: _CompareWithType | None = ...,
- lt: _CompareWithType | None = ...,
- le: _CompareWithType | None = ...,
- gt: _CompareWithType | None = ...,
- ge: _CompareWithType | None = ...,
- require_same_type: bool = ...,
- class_name: str = ...,
-) -> type: ...
+ eq=None,
+ lt=None,
+ le=None,
+ gt=None,
+ ge=None,
+ require_same_type=True,
+ class_name="Comparable",
+):
+ """\
+Create a class that can be passed into `attrs.field`'s ``eq``, ``order``,
... 3449 characters elided ...
+ """\
+Check whether `other` is comparable to `self`.\
+"""
+ return all(func(self, other) for func in self._requirements)
+
+
+def _check_same_type(self, other):
+ """\
+Return True if *self* and *other* are of the same type, False otherwise.\
+"""
+ return other.value.__class__ is self.value.__class__attrs — attr/_typing_compat.py(only produced on base)attrs — attr/_version_info.py--- base/attr/_version_info.py
+++ head/attr/_version_info.py
@@ -1,9 +1,97 @@
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
+# SPDX-License-Identifier: MIT
+
+
+lazy from functools import total_ordering
+
+lazy from ._funcs import astuple
+lazy from ._make import attrib, attrs
+
+
+@total_ordering
+@attrs(eq=False, order=False, slots=True, frozen=True)
class VersionInfo:
- @property
- def year(self) -> int: ...
- @property
- def minor(self) -> int: ...
- @property
- def micro(self) -> int: ...
- @property
- def releaselevel(self) -> str: ...
+ """\
+A version object that can be compared to tuple of length 1--4:
+
+>>> attr.VersionInfo(19, 1, 0, "final") <= (19, 2)
+True
+>>> attr.VersionInfo(19, 1, 0, "final") < (19, 1, 1)
+True
+>>> vi = attr.VersionInfo(19, 2, 0, "final")
+>>> vi < (19, 1, 1)
+False
+>>> vi < (19,)
+False
+>>> vi == (19, 2,)
+True
+>>> vi == (19, 2, 1)
+False
+
... 1384 characters elided ...
+ return NotImplemented
+
+ # Since alphabetically "dev0" < "final" < "post1" < "post2", we don't
+ # have to do anything special with releaselevel for now.
+ return us < them
+
+ def __hash__(self):
+ return hash((self.year, self.minor, self.micro, self.releaselevel))attrs — attr/converters.py--- base/attr/converters.py
+++ head/attr/converters.py
@@ -1,20 +1,163 @@
-lazy from typing import Any, overload
-lazy from typing import Callable
+# SPDX-License-Identifier: MIT
-lazy from attrs import _ConverterType, _CallableConverterType
+"""
+Commonly useful converters.
+"""
+_MISSING = object()
-@overload
-def pipe(*validators: _CallableConverterType) -> _CallableConverterType: ...
-@overload
-def pipe(*validators: _ConverterType) -> _ConverterType: ...
-@overload
-def optional(converter: _CallableConverterType) -> _CallableConverterType: ...
-@overload
-def optional(converter: _ConverterType) -> _ConverterType: ...
-@overload
-def default_if_none(default: Any) -> _CallableConverterType: ...
-@overload
-def default_if_none(
- *, factory: Callable[[], Any]
-) -> _CallableConverterType: ...
-def to_bool(val: str | int | bool) -> bool: ...
+lazy from ._compat import _AnnotationExtractor
+lazy from ._make import NOTHING, Converter, Factory, pipe
+
+
+__all__ = [
+ "default_if_none",
+ "optional",
+ "pipe",
+ "to_bool",
+]
+
+
+def optional(converter):
+ """\
... 3246 characters elided ...
+"""
+ if isinstance(val, str):
+ val = val.lower()
+
+ if val in (True, "true", "t", "yes", "y", "on", "1", 1):
+ return True
+ if val in (False, "false", "f", "no", "n", "off", "0", 0):
+ return False
+
+ msg = f"Cannot convert value to bool: {val!r}"
+ raise ValueError(msg)attrs — attr/exceptions.py--- base/attr/exceptions.py
+++ head/attr/exceptions.py
@@ -1,17 +1,94 @@
-lazy from typing import Any
+# SPDX-License-Identifier: MIT
+
+
class FrozenError(AttributeError):
- msg: str = ...
+ """\
+A frozen/immutable instance or attribute have been attempted to be
+modified.
-class FrozenInstanceError(FrozenError): ...
-class FrozenAttributeError(FrozenError): ...
-class AttrsAttributeNotFoundError(ValueError): ...
-class NotAnAttrsClassError(ValueError): ...
-class DefaultAlreadySetError(RuntimeError): ...
-class UnannotatedAttributeError(RuntimeError): ...
-class PythonTooOldError(RuntimeError): ...
+It mirrors the behavior of ``namedtuples`` by using the same error message
+and subclassing `AttributeError`.
+
+.. versionadded:: 20.1.0\
+"""
+
+ def __init__(self):
+ msg = "can't set attribute"
+ super().__init__(msg)
+ self.msg = msg
+
+
+class FrozenInstanceError(FrozenError):
+ """\
+A frozen instance has been attempted to be modified.
+
+.. versionadded:: 16.1.0\
+"""
+
+
+class FrozenAttributeError(FrozenError):
+ """\
... 1164 characters elided ...
+callable.
+
+.. versionadded:: 19.2.0\
+"""
+
+ def __init__(self, msg, value):
+ super(NotCallableError.__mro__[NotCallableError.__mro__.index(TypeError) - 1], self).__init__(msg, value)
+ self.msg = msg
+ self.value = value
+
+ def __str__(self):
+ return str(self.msg)attrs — attr/filters.py--- base/attr/filters.py
+++ head/attr/filters.py
@@ -1,6 +1,72 @@
-lazy from typing import Any
+# SPDX-License-Identifier: MIT
-lazy from . import Attribute, _FilterType
+"""
+Commonly useful filters for `attrs.asdict` and `attrs.astuple`.
+"""
-def include(*what: type | str | Attribute[Any]) -> _FilterType[Any]: ...
-def exclude(*what: type | str | Attribute[Any]) -> _FilterType[Any]: ...
+lazy from ._make import Attribute
+
+
+def _split_what(what):
+ """\
+Returns a tuple of `frozenset`s of classes and attributes.\
+"""
+ return (
+ frozenset(cls for cls in what if isinstance(cls, type)),
+ frozenset(cls for cls in what if isinstance(cls, str)),
+ frozenset(cls for cls in what if isinstance(cls, Attribute)),
+ )
+
+
+def include(*what):
+ """\
+Create a filter that only allows *what*.
+
+Args:
+ what (list[type, str, attrs.Attribute]):
+ What to include. Can be a type, a name, or an attribute.
+
+Returns:
+ Callable:
+ A callable that can be passed to `attrs.asdict`'s and
+ `attrs.astuple`'s *filter* argument.
+
... 654 characters elided ...
+
+.. versionchanged:: 23.3.0 Accept field name string as input argument\
+"""
+ cls, names, attrs = _split_what(what)
+
+ def exclude_(attribute, value):
+ return not (
+ value.__class__ in cls
+ or attribute.name in names
+ or attribute in attrs
+ )
+
+ return exclude_attrs — attr/setters.py--- base/attr/setters.py
+++ head/attr/setters.py
@@ -1,20 +1,82 @@
-lazy from typing import Any, NewType, NoReturn, TypeVar
+# SPDX-License-Identifier: MIT
-lazy from . import Attribute
-lazy from attrs import _OnSetAttrType
+"""
+Commonly used hooks for on_setattr.
+"""
-_T = TypeVar("_T")
+lazy from . import _config
+lazy from .exceptions import FrozenAttributeError
-def frozen(
- instance: Any, attribute: Attribute[Any], new_value: Any
-) -> NoReturn: ...
-def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
-def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
-# convert is allowed to return Any, because they can be chained using pipe.
-def convert(
- instance: Any, attribute: Attribute[Any], new_value: Any
-) -> Any: ...
+def pipe(*setters):
+ """\
+Run all *setters* and return the return value of the last one.
-_NoOpType = NewType("_NoOpType", object)
-NO_OP: _NoOpType
+.. warning::
+ Generators are not allowed in ``pipe()``.
+
+.. versionadded:: 20.1.0\
+"""
+
+ def wrapped_pipe(instance, attrib, new_value):
+ rv = new_value
+
... 994 characters elided ...
+ return c(new_value)
+
+ return c(new_value, instance, attrib)
+
+ return new_value
+
+
+# Sentinel for disabling class-wide *on_setattr* hooks for certain attributes.
+# Sphinx's autodata stopped working, so the docstring is inlined in the API
+# docs.
+NO_OP = object()attrs — attr/validators.py--- base/attr/validators.py
+++ head/attr/validators.py
@@ -1,129 +1,777 @@
-lazy from typing import overload
-lazy from types import UnionType
-lazy from typing import Any, AnyStr, Callable, Container, ContextManager, Iterable, Mapping, Match, Pattern, TypeVar
-
-lazy from attrs import _ValidatorType
-lazy from attrs import _ValidatorArgType
-
-_T = TypeVar("_T")
-_T1 = TypeVar("_T1")
-_T2 = TypeVar("_T2")
-_T3 = TypeVar("_T3")
-_T4 = TypeVar("_T4")
-_T5 = TypeVar("_T5")
-_T6 = TypeVar("_T6")
-_I = TypeVar("_I", bound=Iterable)
-_K = TypeVar("_K")
-_V = TypeVar("_V")
-_M = TypeVar("_M", bound=Mapping)
-
-def set_disabled(run: bool) -> None: ...
-def get_disabled() -> bool: ...
-def disabled() -> ContextManager[None]: ...
-
-# To be more precise on instance_of use some overloads.
-# If there are more than 3 items in the tuple then we fall back to Any
-@overload
-def instance_of(type: type[_T]) -> _ValidatorType[_T]: ...
-@overload
-def instance_of(type: tuple[type[_T]]) -> _ValidatorType[_T]: ...
-@overload
-def instance_of(
- type: tuple[type[_T1], type[_T2]],
-) -> _ValidatorType[_T1 | _T2]: ...
... 25069 characters elided ...
+ message listing all the wrapped validators and the value that
+ failed all of them.
+
+.. versionadded:: 24.1.0\
+"""
+ vals = []
+ for v in validators:
+ vals.extend(v.validators if isinstance(v, _OrValidator) else [v])
+
+ return _OrValidator(tuple(vals))attrs — attrs/__init__.py--- base/attrs/__init__.py
+++ head/attrs/__init__.py
@@ -1,305 +1,84 @@
-lazy from typing import overload
-lazy import sys
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
-lazy from typing import Any, Callable, Mapping, Sequence, TypeVar, Generator
+# SPDX-License-Identifier: MIT
-# Because we need to type our own stuff, we have to make everything from
-# attr explicitly public too.
-lazy from attr import __author__ as __author__
-lazy from attr import __copyright__ as __copyright__
-lazy from attr import __description__ as __description__
-lazy from attr import __email__ as __email__
-lazy from attr import __license__ as __license__
-lazy from attr import __title__ as __title__
-lazy from attr import __url__ as __url__
-lazy from attr import __version__ as __version__
-lazy from attr import __version_info__ as __version_info__
-lazy from attr import assoc as assoc
-lazy from attr import Attribute as Attribute
... 10180 characters elided ...
- field_transformer: Callable[[Attribute[Any]], Attribute[Any]],
- ) -> None: ...
- @property
- def is_hashable(self) -> bool: ...
-
-def inspect(cls: type) -> ClassProps: ...
+def __dir__() -> list[str]:
+ return _soundness_check(sorted(set[str](globals()) | set[str](__all__)), list)black — _black_version.py(only produced on base)bokeh — bokeh/_specs.py(only produced on base)bokeh — bokeh/_types.py(only produced on base)bokeh — bokeh/core/has_props.py--- base/bokeh/core/has_props.py
+++ head/bokeh/core/has_props.py
@@ -1,3 +1,2 @@
-lazy from typing import overload
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,14 +5,54 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+''' Provide a base class for objects that can have declarative, typed,
+serializable properties.
+
+.. note::
+ These classes form part of the very low-level machinery that implements
+ the Bokeh model and property system. It is unlikely that any of these
+ classes or their methods will be applicable to any standard usage or to
+ anyone who is not directly developing on Bokeh's own infrastructure.
+
+'''
+lazy from typing import Callable, Literal, overload
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
... 34389 characters elided ...
+ This is an abstract base class used to help organize the hierarchy of Bokeh
+ model types. **It is not useful to instantiate on its own.**
+'''
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/core/property/visual.py--- base/bokeh/core/property/visual.py
+++ head/bokeh/core/property/visual.py
@@ -1,3 +1,2 @@
-lazy from ty_extensions import JustFloat
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,46 +5,292 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+""" Provide properties for various visual attributes.
+
+"""
+lazy from typing import Any, Literal
+_MISSING = object()
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
... 10469 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/core/property_aliases.py--- base/bokeh/core/property_aliases.py
+++ head/bokeh/core/property_aliases.py
@@ -1,3 +1,2 @@
-lazy from ty_extensions import JustFloat
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,93 +5,135 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+""" Reusable common property type aliases.
-# Standard library imports
-lazy from typing import Literal, NotRequired, TypedDict
+"""
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
# Bokeh imports
-lazy from .._types import NonNegative
-lazy from ..core.enums import (
... 5813 characters elided ...
-
-type TracksSizingType = TrackSizingType | list[TrackSizingType] | dict[int, TrackSizingType]
-class TracksSizing(Property[TracksSizingType]): ...
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/core/property_mixins.py--- base/bokeh/core/property_mixins.py
+++ head/bokeh/core/property_mixins.py
@@ -1,3 +1,2 @@
-lazy from ty_extensions import JustFloat
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,10 +5,94 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
-
-# Standard library imports
-lazy from typing import TypedDict
+''' Mix-in classes that bulk add groups of properties to Bokeh models.
+
+Some groups of properties often show up in Bokeh models together. For
+instance, any model that exposes a fill color property for use when
+rendering will almost always want to expose a fill alpha as well. To
+reduce boilerplate code and simplify defining models with these sets
+of properties, use the mix-in classes in this module:
+
+* |FillProps| --- properties for fill color and alpha
+
+* |HatchProps| --- properties for hatching pattern, color, alpha, etc.
+
+* |ImageProps| --- properties for global alpha on images
+
... 37707 characters elided ...
+# Dev API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/document/config.py--- base/bokeh/document/config.py
+++ head/bokeh/document/config.py
@@ -5,16 +5,82 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+""" """
+lazy from typing import Any
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+# pyright: reportArgumentType=false
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+# Standard library imports
+
# Bokeh imports
-lazy from ..core.enums import ColorSchemeType
+lazy from ..core.enums import ColorScheme
+lazy from ..core.property.enum import Enum
+lazy from ..core.property.instance import Instance, InstanceDefault
+lazy from ..core.property.nullable import Nullable
+lazy from ..core.property.primitive import Bool
... 2252 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/model/model.py--- base/bokeh/model/model.py
+++ head/bokeh/model/model.py
@@ -1,3 +1,2 @@
-lazy from typing import Any
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,90 +5,644 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+''' Provide a base class for all objects (called Bokeh Models) that can go in
+a Bokeh |Document|.
+
+'''
+lazy from typing import Any
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
+def _soundness_iter(_it, _t):
+ for _x in _it:
+ yield _soundness_check(_x, _t)
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
... 24646 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/models/annotations/annotation.py--- base/bokeh/models/annotations/annotation.py
+++ head/bokeh/models/annotations/annotation.py
@@ -1,3 +1,2 @@
-lazy from abc import abstractmethod
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,24 +5,78 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+'''
+
+'''
+lazy from typing import Any
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+# pyright: reportAbstractUsage=false, reportArgumentType=false, reportAssignmentType=false
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
# Standard library imports
-lazy from typing import Unpack
# Bokeh imports
... 2297 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/models/annotations/arrows.py--- base/bokeh/models/annotations/arrows.py
+++ head/bokeh/models/annotations/arrows.py
@@ -1,3 +1,2 @@
-lazy from abc import abstractmethod
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,67 +5,202 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+'''
+
+'''
+lazy from typing import Any
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+# pyright: reportAbstractUsage=false, reportArgumentType=false
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
# Standard library imports
-lazy from typing import Unpack
# Bokeh imports
-lazy from ..._specs import NumberSpec
... 7172 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/models/annotations/dimensional.py--- base/bokeh/models/annotations/dimensional.py
+++ head/bokeh/models/annotations/dimensional.py
@@ -1,4 +1,2 @@
-lazy from abc import abstractmethod
-lazy from ty_extensions import JustFloat
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -7,66 +5,216 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+'''
+
+'''
+lazy from abc import abstractmethod
+lazy from typing import Any
+def _soundness_check(_v, _t):
+ if not isinstance(_v, _t):
+ raise TypeError(
+ f"type soundness violation: expected {getattr(_t, '__name__', _t)}, "
+ f"got {type(_v).__name__}"
+ )
+ return _v
+
+def _soundness_iter(_it, _t):
+ for _x in _it:
+ yield _soundness_check(_x, _t)
+
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
... 8144 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/models/annotations/geometry.py--- base/bokeh/models/annotations/geometry.py
+++ head/bokeh/models/annotations/geometry.py
@@ -1,3 +1,2 @@
-lazy from ty_extensions import JustFloat
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,246 +5,596 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+'''
+
+'''
+from typing import Any, TYPE_CHECKING
+if TYPE_CHECKING:
+ import types
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+# pyright: reportAbstractUsage=false, reportArgumentType=false, reportAssignmentType=false
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
# Standard library imports
... 28051 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/models/annotations/html/html_annotation.py--- base/bokeh/models/annotations/html/html_annotation.py
+++ head/bokeh/models/annotations/html/html_annotation.py
@@ -1,3 +1,2 @@
-lazy from abc import abstractmethod
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,14 +5,63 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+'''
+
+'''
+lazy from typing import Any
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+# pyright: reportAbstractUsage=false
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
# Standard library imports
-lazy from typing import Unpack
# Bokeh imports
-lazy from ..annotation import Annotation, _AnnotationInit
... 1446 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/models/annotations/html/labels.py--- base/bokeh/models/annotations/html/labels.py
+++ head/bokeh/models/annotations/html/labels.py
@@ -1,3 +1,2 @@
-lazy from ty_extensions import JustFloat
#-----------------------------------------------------------------------------
# Copyright (c) Anaconda, Inc., and Bokeh Contributors.
@@ -6,126 +5,355 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+'''
+
+'''
+from typing import Any, TYPE_CHECKING
+if TYPE_CHECKING:
+ import types
+
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+# pyright: reportAbstractUsage=false, reportArgumentType=false
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
# Standard library imports
-lazy from typing import Unpack
... 14609 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — bokeh/models/annotations/html/toolbars.py--- base/bokeh/models/annotations/html/toolbars.py
+++ head/bokeh/models/annotations/html/toolbars.py
@@ -5,17 +5,58 @@
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
+'''
+
+'''
+lazy from typing import Any
+#-----------------------------------------------------------------------------
+# Boilerplate
+#-----------------------------------------------------------------------------
+
+# pyright: reportAbstractUsage=false
+
+lazy import logging # isort:skip
+log = logging.getLogger(__name__)
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
# Standard library imports
-lazy from typing import Unpack
# Bokeh imports
-lazy from ...tools import Toolbar
-lazy from .html_annotation import HTMLAnnotation, _HTMLAnnotationInit
+lazy from ....core.property.instance import Instance
+lazy from .html_annotation import HTMLAnnotation
... 1205 characters elided ...
+# Private API
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------bokeh — typings/IPython/__init__.py(only produced on base)bokeh — typings/IPython/core/__init__.py(only produced on base)bokeh — typings/IPython/core/getipython.py(only produced on base)bokeh — typings/IPython/core/history.py(only produced on base)2928 finding(s) omitted to fit GitHub's 65536-character comment limit. The full report is the |
`by build` and `by run` wrote only the transpiled `.by` files, so a project's hand-written `.py` modules and its data never reached the output. under `run` that was fatal: it executes out of the tree it stages, so a `.py` sibling could not be imported at all. both now stage the whole project, deleting what the previous build wrote and this one did not. `basedpython.build` is a PEP 517 backend, so `uv build` produces a wheel and an sdist end to end. it stages with `by build` and hands the result to `uv_build`. the wheel carries the transpiled python, the `.by` sources, and a `by.typed` marker; a package with that marker resolves to its `.by` rather than its `.py`, so a basedpython consumer keeps the declarations python cannot spell. `by run` also takes the project environment rather than whatever `python3` is on `PATH`, and `by init` writes a project already shaped to build. a source directory that is itself a package ships under its own name
lowering for an older python can put a name in the output that only `typing_extensions` has there — `Self` on 3.9. the project never asked for it, so it cannot have declared it, and the wheel shipped without it: it installed cleanly and failed on the first import of the module that borrowed the name. the transpile is what knows, so the transpile is what reports it, and only when it actually reached for it — the same project built for a python that has the name in its own `typing` gets no such dependency. a project that already names the distribution keeps its own constraint.
a project builds into one wheel lowered to the oldest python it supports. that wheel runs everywhere, which is the point — but a reader on 3.13 gets code written around 3.9's limits and a `typing_extensions` dependency they have no use for. `python-version` as a build config setting lowers a wheel to one python and tags it accordingly, so an installer hands every interpreter the best wheel it can use and a python with no wheel of its own falls back to the newest one below it. the tag is rewritten after the fact — in `WHEEL`, in the `RECORD` line carrying that file's hash, and in the name — because the backend that builds it has none. `by build --wheels` drives `uv` once per version. it is not a loop for its own sake: a release is only useful if the set is complete, so nothing reaches `dist/` unless every version built, a version with no wheel is refused, and an untagged wheel left beside the others is refused outright — an installer would prefer it to every one of them, and none would ever be chosen. the versions come from `requires-python`, so most projects configure nothing.
it looked for `.venv` beside the working directory and never read the `environment.python` the project configures — so `by run` in a subdirectory, or in a project whose environment is anywhere but `./.venv`, silently fell through to whatever `python3` `PATH` turned up. `by check` had resolved the environment correctly all along, which is what makes it a discrepancy rather than a gap: two commands disagreeing about what environment this project is. the order now mirrors the checker's — `--python`, then `environment.python`, then an activated venv, conda, or a `.venv` beside the project's `pyproject.toml` — with `$PYTHON` below discovery, since it names an interpreter rather than an environment, and above only the bare `python3` that discovery falls back to. rooting the search at the project rather than the caller turned up the same mistake one layer down: `build_project_db` took the working directory for the project root, so `by run` inside `tests/` transpiled `tests/` alone and could not find the module it was asked to run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.