e7299b17e9
Stack installed: - netfox v1.35.3 (core + extras + noray + internals) - godot-jolt v0.16.0-stable Architecture: - Server: ENet transport (works headless, no netfox deps) - Client/Editor: netfox rollback (RollbackSynchronizer, TickInterpolator) New/modified: - docs/migration-netfox-plan.md — migration architecture - scripts/network/network_manager.gd — netfox-aware ENet fallback - scripts/network/player.gd — clean base player - client/characters/player_netfox.gd — rollback player w/ WeaponManager - client/characters/input/player_net_input.gd — BaseNetInput subclass - client/characters/character/fps_character_controller.gd — netfox input feed - client/weapons/ — weapon data, registry, TacticalWeaponHitscan, WeaponManager - client/scripts/round_replicator.gd — client-side round state bridge - server/scripts/round_manager.gd — improved state machine - server/scripts/plugin_api/plugin_manager.gd — refined plugin system - config: enemy_tag, ally_tag for meatball targeting Removed: old C++ SimulationServer GDExtension (replaced by netfox rollback)
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Iterable, Iterator
|
|
from functools import lru_cache
|
|
from typing import TYPE_CHECKING, Callable, TypeVar, Union, overload
|
|
|
|
import jaraco.text as text
|
|
from packaging.requirements import Requirement
|
|
|
|
if TYPE_CHECKING:
|
|
from typing_extensions import TypeAlias
|
|
|
|
_T = TypeVar("_T")
|
|
_StrOrIter: TypeAlias = Union[str, Iterable[str]]
|
|
|
|
|
|
parse_req: Callable[[str], Requirement] = lru_cache()(Requirement)
|
|
# Setuptools parses the same requirement many times
|
|
# (e.g. first for validation than for normalisation),
|
|
# so it might be worth to cache.
|
|
|
|
|
|
def parse_strings(strs: _StrOrIter) -> Iterator[str]:
|
|
"""
|
|
Yield requirement strings for each specification in `strs`.
|
|
|
|
`strs` must be a string, or a (possibly-nested) iterable thereof.
|
|
"""
|
|
return text.join_continuation(map(text.drop_comment, text.yield_lines(strs)))
|
|
|
|
|
|
# These overloads are only needed because of a mypy false-positive, pyright gets it right
|
|
# https://github.com/python/mypy/issues/3737
|
|
@overload
|
|
def parse(strs: _StrOrIter) -> Iterator[Requirement]: ...
|
|
@overload
|
|
def parse(strs: _StrOrIter, parser: Callable[[str], _T]) -> Iterator[_T]: ...
|
|
def parse(strs: _StrOrIter, parser: Callable[[str], _T] = parse_req) -> Iterator[_T]: # type: ignore[assignment]
|
|
"""
|
|
Replacement for ``pkg_resources.parse_requirements`` that uses ``packaging``.
|
|
"""
|
|
return map(parser, parse_strings(strs))
|