flpit 0.4.2.dev6__tar.gz → 0.4.2.dev7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/PKG-INFO +1 -1
  2. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/pyproject.toml +1 -1
  3. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/task.py +19 -46
  4. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/.gitignore +0 -0
  5. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/LICENSE +0 -0
  6. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/README.md +0 -0
  7. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flp/__init__.py +0 -0
  8. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/__init__.py +0 -0
  9. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/channels.py +0 -0
  10. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/concurrent.py +0 -0
  11. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/__init__.py +0 -0
  12. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/_grouping.py +0 -0
  13. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/_index.py +0 -0
  14. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/_join.py +0 -0
  15. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/_lookup.py +0 -0
  16. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/_zip.py +0 -0
  17. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/async_linq.py +0 -0
  18. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/comparers.py +0 -0
  19. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/core/linq.py +0 -0
  20. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/csv.py +0 -0
  21. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/flp.py +0 -0
  22. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/json/__init__.py +0 -0
  23. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/json/_core.py +0 -0
  24. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/json/_msgspec.py +0 -0
  25. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/json/_native.py +0 -0
  26. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/py.typed +0 -0
  27. {flpit-0.4.2.dev6 → flpit-0.4.2.dev7}/src/flpit/threading.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: flpit
3
- Version: 0.4.2.dev6
3
+ Version: 0.4.2.dev7
4
4
  Summary: Fluent LINQ for Python — flip your iterables
5
5
  Project-URL: Homepage, https://github.com/riemar/flpit
6
6
  Project-URL: Documentation, https://riemar.github.io/flpit/
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flpit"
3
- version = "0.4.2.dev6"
3
+ version = "0.4.2.dev7"
4
4
  description = "Fluent LINQ for Python — flip your iterables"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -253,23 +253,19 @@ class _TaskMeta(type):
253
253
 
254
254
  @property
255
255
  def asyncio_interop(cls: "_TaskMeta") -> bool:
256
- return (
257
- getattr(cls, "__await__")
258
- is getattr(cls, "_await_asyncio_interop")
259
- )
256
+ """Deprecated, always True: a Task can always be awaited inside asyncio coroutines."""
257
+ warnings.warn(_ASYNCIO_INTEROP_DEPRECATED, DeprecationWarning, stacklevel=2)
258
+ return True
260
259
 
261
260
  @asyncio_interop.setter
262
- def asyncio_interop(
263
- cls: "_TaskMeta",
264
- enabled: bool,
265
- ) -> None:
266
- implementation = getattr(
267
- cls,
268
- "_await_asyncio_interop"
269
- if enabled
270
- else "_await_pure_flpit_task",
271
- )
272
- setattr(cls, "__await__", implementation)
261
+ def asyncio_interop(cls: "_TaskMeta", enabled: bool) -> None:
262
+ warnings.warn(_ASYNCIO_INTEROP_DEPRECATED + " Setting it has no effect.", DeprecationWarning, stacklevel=2)
263
+
264
+
265
+ _ASYNCIO_INTEROP_DEPRECATED: Final = (
266
+ "Task.asyncio_interop is deprecated and will be removed in 0.5: awaiting a Task inside "
267
+ "asyncio coroutines always works, at no measurable cost to flpit awaits."
268
+ )
273
269
 
274
270
 
275
271
  @dataclass(frozen=True)
@@ -763,9 +759,8 @@ class _WaitTask(_Operation):
763
759
 
764
760
  def __repr__(self) -> str:
765
761
  return (
766
- "<flpit _WaitTask: this await operation requires the "
767
- "flpit scheduler; enable Task.asyncio_interop to await "
768
- "flpit Task from asyncio>"
762
+ "<flpit _WaitTask: awaiting a flpit Task needs the flpit scheduler "
763
+ "or an asyncio event loop running on this thread>"
769
764
  )
770
765
 
771
766
 
@@ -1791,32 +1786,13 @@ class Task(Generic[T], metaclass=_TaskMeta):
1791
1786
  return self._exception
1792
1787
  return OperationCanceledError(f"{self.name} was cancelled")
1793
1788
 
1794
- def _await_pure_flpit_task(self) -> Generator[Any, T, T]:
1795
- if self._state is not _PENDING:
1796
- error = self._error_to_raise()
1797
- if error is None:
1798
- return cast(T, self._result)
1799
- del self # see _release_frame
1800
- try:
1801
- raise error
1802
- finally:
1803
- del error
1804
- operation = _WaitTask(self._runtime, self)
1805
- del self # see _release_frame
1806
- try:
1807
- return (yield operation)
1808
- finally:
1809
- del operation
1810
-
1811
- __await__ = _await_pure_flpit_task
1812
-
1813
- def _await_asyncio_interop(self) -> Generator[Any, T, T]:
1814
- """``__await__`` that also works inside asyncio coroutines (``Task.asyncio_interop``).
1789
+ def __await__(self) -> Generator[Any, T, T]:
1790
+ """Await the task from flpit code or from an asyncio coroutine.
1815
1791
 
1816
- Awaited by flpit, it is the pure path plus one question, asked only while the task is
1817
- still pending: is an asyncio loop running on this thread? That is one C call (asyncio's
1818
- ``_get_running_loop``, which returns None instead of raising), or a dict lookup while
1819
- asyncio isn't imported at all (see _asyncio_running_loop).
1792
+ Awaited by flpit, a pending task asks one question: is an asyncio loop running on this
1793
+ thread? That is one C call (asyncio's ``_get_running_loop``, which returns None instead of
1794
+ raising), or a dict lookup while asyncio isn't imported at all (see _asyncio_running_loop);
1795
+ about 15 ns, within measurement noise of an await.
1820
1796
 
1821
1797
  Inside asyncio, the task's completion resolves an asyncio future on that loop. Neither the
1822
1798
  frame nor the callbacks keep the task (see _release_frame): a failed task awaited from
@@ -1851,9 +1827,6 @@ class Task(Generic[T], metaclass=_TaskMeta):
1851
1827
  finally:
1852
1828
  del future
1853
1829
 
1854
- # On by default: awaited by flpit code it costs about 0.1 µs (see _await_asyncio_interop).
1855
- __await__ = _await_asyncio_interop
1856
-
1857
1830
  def _error_to_raise(self) -> BaseException | None:
1858
1831
  """The exception that awaiting this completed task raises; None if it succeeded.
1859
1832
 
File without changes
File without changes
File without changes
File without changes
File without changes