Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[resoto][chore] Bump aiostream to latest version #1855

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions requirements-all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ aiohttp[speedups]==3.9.1
aiohttp-jinja2==1.6
aiohttp-swagger3==0.8.0
aiosignal==1.3.1
aiostream==0.4.5
aiostream==0.5.2
annotated-types==0.6.0
apscheduler==3.10.4
asn1crypto==1.5.1
Expand Down Expand Up @@ -41,7 +41,6 @@ defusedxml==0.7.1
deprecated==1.2.14
dill==0.3.7
distlib==0.3.7
docopt==0.6.2
fastjsonschema==2.19.0
filelock==3.13.1
flake8==6.1.0
Expand All @@ -63,7 +62,7 @@ importlib-metadata==7.0.0
inflect==7.0.0
iniconfig==2.0.0
isodate==0.6.1
isort==5.13.0
isort==5.12.0
jaraco-collections==5.0.0
jaraco-context==4.3.0
jaraco-functools==4.0.0
Expand Down Expand Up @@ -94,16 +93,12 @@ packaging==23.2
paramiko==3.3.1
parsy==2.1
pathspec==0.12.1
pep517==0.13.1
pep8-naming==0.13.3
pint==0.23
pip==23.3.1
pip-api==0.0.30
pip-tools==7.3.0
pipreqs==0.4.13
plantuml==0.3.0
platformdirs==3.11.0
plette[validation]==0.4.4
pluggy==1.3.0
portalocker==2.8.2
portend==3.2.0
Expand All @@ -125,7 +120,7 @@ pyflakes==3.1.0
pygithub==2.1.1
pygments==2.17.2
pyjwt[crypto]==2.8.0
pylint==3.0.2
pylint==3.0.3
pymysql==1.1.0
pynacl==1.5.0
pyopenssl==23.3.0
Expand All @@ -144,7 +139,6 @@ pyyaml==6.0.1
requests==2.31.0
requests-oauthlib==1.3.1
requests-toolbelt==1.0.0
requirementslib==3.0.0
resotoclient==1.6.1
resotodata==0.2.2
resotodatalink[extra]==1.2.0
Expand Down Expand Up @@ -189,7 +183,6 @@ wcwidth==0.2.12
websocket-client==1.7.0
wheel==0.42.0
wrapt==1.16.0
yarg==0.1.9
yarl==1.9.4
zc-lockfile==3.0.post1
zipp==3.17.0
2 changes: 1 addition & 1 deletion requirements-extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ aiohttp[speedups]==3.9.1
aiohttp-jinja2==1.6
aiohttp-swagger3==0.8.0
aiosignal==1.3.1
aiostream==0.4.5
aiostream==0.5.2
annotated-types==0.6.0
apscheduler==3.10.4
asn1crypto==1.5.1
Expand Down
13 changes: 3 additions & 10 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ aiohttp[speedups]==3.9.1
aiohttp-jinja2==1.6
aiohttp-swagger3==0.8.0
aiosignal==1.3.1
aiostream==0.4.5
aiostream==0.5.2
annotated-types==0.6.0
apscheduler==3.10.4
astroid==3.0.1
Expand Down Expand Up @@ -40,7 +40,6 @@ defusedxml==0.7.1
deprecated==1.2.14
dill==0.3.7
distlib==0.3.7
docopt==0.6.2
fastjsonschema==2.19.0
filelock==3.13.1
flake8==6.1.0
Expand All @@ -58,7 +57,7 @@ importlib-metadata==7.0.0
inflect==7.0.0
iniconfig==2.0.0
isodate==0.6.1
isort==5.13.0
isort==5.12.0
jaraco-collections==5.0.0
jaraco-context==4.3.0
jaraco-functools==4.0.0
Expand Down Expand Up @@ -88,16 +87,12 @@ packaging==23.2
paramiko==3.3.1
parsy==2.1
pathspec==0.12.1
pep517==0.13.1
pep8-naming==0.13.3
pint==0.23
pip==23.3.1
pip-api==0.0.30
pip-tools==7.3.0
pipreqs==0.4.13
plantuml==0.3.0
platformdirs==3.11.0
plette[validation]==0.4.4
pluggy==1.3.0
portalocker==2.8.2
portend==3.2.0
Expand All @@ -117,7 +112,7 @@ pyflakes==3.1.0
pygithub==2.1.1
pygments==2.17.2
pyjwt[crypto]==2.8.0
pylint==3.0.2
pylint==3.0.3
pynacl==1.5.0
pyparsing==3.1.1
pyproject-api==1.6.1
Expand All @@ -134,7 +129,6 @@ pyyaml==6.0.1
requests==2.31.0
requests-oauthlib==1.3.1
requests-toolbelt==1.0.0
requirementslib==3.0.0
resotoclient==1.6.1
resotodata==0.2.2
resotodatalink==1.2.0
Expand Down Expand Up @@ -176,7 +170,6 @@ wcwidth==0.2.12
websocket-client==1.7.0
wheel==0.42.0
wrapt==1.16.0
yarg==0.1.9
yarl==1.9.4
zc-lockfile==3.0.post1
zipp==3.17.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ aiohttp[speedups]==3.9.1
aiohttp-jinja2==1.6
aiohttp-swagger3==0.8.0
aiosignal==1.3.1
aiostream==0.4.5
aiostream==0.5.2
annotated-types==0.6.0
apscheduler==3.10.4
attrs==23.1.0
Expand Down
1 change: 0 additions & 1 deletion resotocore/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ disable=
cyclic-import,
unnecessary-lambda-assignment


[REPORTS]

# Set the output format. Available formats are text, parseable, colorized, msvs
Expand Down
2 changes: 1 addition & 1 deletion resotocore/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"aiohttp-jinja2",
"aiohttp-swagger3",
"aiohttp[speedups]",
"aiostream < 0.5", # TODO: aiostream 0.5 introduces type parameters - need to be supported by mypy
"aiostream",
"cryptography",
"deepdiff",
"frozendict",
Expand Down
31 changes: 23 additions & 8 deletions resotocore/resotocore/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
from argparse import ArgumentParser
from datetime import datetime
from functools import lru_cache
from typing import TypeVar, Union, Any, Callable, AsyncIterator, NoReturn, Optional, Awaitable, Tuple, List
from typing_extensions import TypeAlias
from typing import (
TypeVar,
Union,
Any,
Callable,
NoReturn,
Optional,
Awaitable,
Tuple,
List,
AsyncIterable,
)

from aiostream import stream
from aiostream.core import Stream
from parsy import Parser, regex, string

from resotocore.model.graph_access import Section
from resotocore.types import JsonElement
from resotocore.types import JsonElement, Json
from resotocore.util import utc, parse_utc, AnyT
from resotolib.durations import parse_duration, DurationRe
from resotolib.parse_util import (
Expand All @@ -31,12 +42,12 @@
)

T = TypeVar("T")
# Allow the function to return either a coroutine or the result directly
Result = Union[T, Awaitable[T]]
JsStream: TypeAlias = Stream
JsGen = Union[JsStream, AsyncIterator[JsonElement]]
JsStream = Stream[JsonElement]
JsGen = AsyncIterable[JsonElement]
# A sink function takes a stream and creates a result
Sink = Callable[[JsGen], Awaitable[T]]
Sink = Callable[[JsStream], Awaitable[T]]

list_sink: Callable[[JsGen], Awaitable[Any]] = stream.list # type: ignore


@make_parser
Expand Down Expand Up @@ -117,6 +128,10 @@ def strip_quotes(maybe_quoted: str) -> str:


# check if a is a json node element
def get_node(a: Any) -> Optional[Json]:
return a if isinstance(a, dict) and "id" in a and Section.reported in a else None


def is_node(a: Any) -> bool:
return "id" in a and Section.reported in a if isinstance(a, dict) else False

Expand Down
5 changes: 2 additions & 3 deletions resotocore/resotocore/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
from typing import Optional, Any, TYPE_CHECKING

from aiostream import stream
from aiostream.core import Stream
from attrs import evolve
from parsy import Parser
from rich.padding import Padding

from resotocore import version
from resotocore.analytics import CoreEvent
from resotocore.cli import cmd_with_args_parser, key_values_parser, T, Sink, args_values_parser
from resotocore.cli import cmd_with_args_parser, key_values_parser, T, Sink, args_values_parser, JsGen
from resotocore.cli.command import (
SearchPart,
PredecessorsPart,
Expand Down Expand Up @@ -188,7 +187,7 @@ def overview() -> str:
logo = ctx.render_console(Padding(WelcomeCommand.ck, pad=(0, 0, 0, middle))) if ctx.supports_color() else ""
return headline + logo + ctx.render_console(result)

def help_command() -> Stream:
def help_command() -> JsGen:
if not arg:
result = overview()
elif arg == "placeholders":
Expand Down
Loading
Loading