Skip to content

Commit 1735b14

Browse files
authored
[fix][chore] Bump Libs (#2199)
1 parent 50ec1d3 commit 1735b14

File tree

10 files changed

+134
-120
lines changed

10 files changed

+134
-120
lines changed

fixcore/fixcore/cli/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4240,7 +4240,7 @@ async def perform_request(e: JsonElement) -> int:
42404240
headers=template.headers,
42414241
params=template.params,
42424242
data=data,
4243-
compress=template.compress,
4243+
compress="deflate" if template.compress else None,
42444244
timeout=template.timeout,
42454245
ssl=False if template.no_ssl_verify else self.dependencies.cert_handler.client_context,
42464246
auth=BasicAuth(login=authuser, password=(authpass if authpass else "")) if authuser else None,

fixcore/fixcore/web/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
from aiohttp.web import Request, StreamResponse
44

55
RequestHandler = Callable[[Request], Awaitable[StreamResponse]]
6-
Middleware = Callable[[Request, RequestHandler], Awaitable[StreamResponse]]

fixcore/fixcore/web/api.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
)
3333
from urllib.parse import urlencode, urlparse, parse_qs, urlunparse
3434

35+
import aiofiles
3536
import aiohttp_jinja2
3637
import jinja2
3738
import prometheus_client
@@ -44,6 +45,7 @@
4445
MultipartReader,
4546
ClientSession,
4647
TCPConnector,
48+
BodyPartReader,
4749
)
4850
from aiohttp.abc import AbstractStreamWriter
4951
from aiohttp.hdrs import METH_ANY
@@ -1380,6 +1382,23 @@ def line_to_js(line: ParsedCommandLine) -> Json:
13801382
@timed("api", "execute")
13811383
async def execute(self, request: Request, deps: TenantDependencies) -> StreamResponse:
13821384
temp_dir: Optional[str] = None
1385+
1386+
async def write_files(mpr: MultipartReader, tmp_dir: str) -> Dict[str, str]:
1387+
files: Dict[str, str] = {}
1388+
async for part in mpr:
1389+
if isinstance(part, MultipartReader):
1390+
files.update(await write_files(part, tmp_dir))
1391+
elif isinstance(part, BodyPartReader):
1392+
name = part.filename
1393+
if not name:
1394+
raise AttributeError("Multipart request: content disposition name is required!")
1395+
path = os.path.join(tmp_dir, rnd_str()) # use random local path to avoid clashes
1396+
files[name] = path
1397+
async with aiofiles.open(path, "wb") as writer:
1398+
while not part.at_eof():
1399+
await writer.write(await part.read_chunk())
1400+
return files
1401+
13831402
try:
13841403
ctx = self.cli_context_from_request(request)
13851404
if request.content_type.startswith("text"):
@@ -1388,18 +1407,9 @@ async def execute(self, request: Request, deps: TenantDependencies) -> StreamRes
13881407
command = request.headers["Fix-Shell-Command"].strip()
13891408
temp = tempfile.mkdtemp()
13901409
temp_dir = temp
1391-
files = {}
13921410
# for now, we assume that all multi-parts are file uploads
1393-
async for part in MultipartReader(request.headers, request.content):
1394-
name = part.name
1395-
if not name:
1396-
raise AttributeError("Multipart request: content disposition name is required!")
1397-
path = os.path.join(temp, rnd_str()) # use random local path to avoid clashes
1398-
files[name] = path
1399-
with open(path, "wb") as writer:
1400-
while not part.at_eof():
1401-
writer.write(await part.read_chunk())
1402-
ctx = evolve(ctx, uploaded_files=files)
1411+
uploaded = await write_files(MultipartReader(request.headers, request.content), temp)
1412+
ctx = evolve(ctx, uploaded_files=uploaded)
14031413
else:
14041414
raise AttributeError(f"Not able to handle: {request.content_type}")
14051415

fixcore/fixcore/web/auth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import jwt
1212
from aiohttp import web
13+
from aiohttp.typedefs import Middleware
1314
from aiohttp.web import Request, StreamResponse
1415
from aiohttp.web import middleware
1516
from attr import define
@@ -26,7 +27,7 @@
2627
from fixcore.web.certificate_handler import CertificateHandler
2728
from fixcore.web.permission import PermissionChecker
2829
from fixlib import jwt as ck_jwt
29-
from fixlib.asynchronous.web import RequestHandler, Middleware, TenantRequestHandler
30+
from fixlib.asynchronous.web import RequestHandler, TenantRequestHandler
3031
from fixlib.jwt import encode_jwt, create_jwk_dict
3132
from fixlib.types import Json
3233
from fixlib.utils import utc

fixcore/fixcore/web/directives.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import logging
22
from re import RegexFlag, fullmatch
3-
from typing import Optional, Callable, Awaitable, Tuple
3+
from typing import Optional, Tuple
44

55
from aiohttp.hdrs import METH_OPTIONS, METH_GET, METH_HEAD, METH_POST, METH_PUT, METH_DELETE, METH_PATCH
6+
from aiohttp.typedefs import Middleware
67
from aiohttp.web import HTTPRedirection, HTTPNotFound, HTTPBadRequest, HTTPException, HTTPNoContent
78
from aiohttp.web_exceptions import HTTPServiceUnavailable, HTTPError
89
from aiohttp.web_middlewares import middleware
@@ -84,9 +85,7 @@ async def metrics_handler(request: Request, handler: RequestHandler) -> StreamRe
8485
RequestInProgress.labels(request.path, request.method).dec()
8586

8687

87-
def error_handler(
88-
config: CoreConfig, event_sender: AnalyticsEventSender
89-
) -> Callable[[Request, RequestHandler], Awaitable[StreamResponse]]:
88+
def error_handler(config: CoreConfig, event_sender: AnalyticsEventSender) -> Middleware:
9089
is_debug = (logging.root.level < logging.INFO) or config.runtime.debug
9190

9291
def exc_info(ex: Exception) -> Optional[Exception]:
@@ -129,7 +128,7 @@ def message_from_error(e: Exception) -> Tuple[str, str, str]:
129128
return error_handler_middleware
130129

131130

132-
def default_middleware(api_handler: "api.Api") -> Callable[[Request, RequestHandler], Awaitable[StreamResponse]]:
131+
def default_middleware(api_handler: "api.Api") -> Middleware:
133132
@middleware
134133
async def default_handler(request: Request, handler: RequestHandler) -> StreamResponse:
135134
if api_handler.in_shutdown:

fixcore/tests/fixcore/web/api_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import pytest
1010
from _pytest.fixtures import fixture
11-
from aiohttp import ClientSession, MultipartReader
11+
from aiohttp import ClientSession, MultipartReader, BodyPartReader
1212
from networkx import MultiDiGraph
1313
from datetime import timedelta
1414
from fixclient import models as rc
@@ -394,7 +394,7 @@ async def test_cli(core_client: FixInventoryClient) -> None:
394394
# execute multiple commands
395395
response = await core_client.cli_execute_raw("echo foo; echo bar; echo bla")
396396
reader: MultipartReader = MultipartReader.from_response(response.undrelying) # type: ignore
397-
assert [await p.text() async for p in reader] == ['"foo"', '"bar"', '"bla"']
397+
assert [await p.text() async for p in reader if isinstance(p, BodyPartReader)] == ['"foo"', '"bar"', '"bla"']
398398

399399
# list all cli commands
400400
info = AccessJson(await core_client.cli_info())

fixlib/fixlib/asynchronous/web/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55

66
RequestHandler = Callable[[Request], Awaitable[StreamResponse]]
77
TenantRequestHandler = Callable[[Request, TenantDependencies], Awaitable[StreamResponse]]
8-
Middleware = Callable[[Request, RequestHandler], Awaitable[StreamResponse]]

requirements-all.txt

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
aiodns==3.2.0
22
aiofiles==24.1.0
3-
aiohttp[speedups]==3.9.5
3+
aiohappyeyeballs==2.4.0
4+
aiohttp[speedups]==3.10.5
45
aiohttp-jinja2==1.6
5-
aiohttp-swagger3==0.8.0
6+
aiohttp-swagger3==0.9.0
67
aiosignal==1.3.1
78
aiostream==0.6.2
89
appdirs==1.4.4
@@ -12,39 +13,39 @@ astroid==3.2.4
1213
attrs==24.2.0
1314
autocommand==2.2.2
1415
azure-common==1.1.28
15-
azure-core==1.30.2
16+
azure-core==1.31.0
1617
azure-identity==1.17.1
1718
azure-mgmt-core==1.4.0
1819
azure-mgmt-resource==23.1.1
1920
backoff==2.2.1
2021
backports-tarfile==1.2.0
2122
bcrypt==4.2.0
2223
black==24.8.0
23-
boto3==1.35.10
24-
botocore==1.35.10
24+
boto3==1.35.22
25+
botocore==1.35.22
2526
brotli==1.1.0
26-
build==1.2.1
27+
build==1.2.2
2728
cachetools==5.5.0
28-
cattrs==24.1.0
29+
cattrs==24.1.1
2930
cerberus==1.3.5
3031
certifi==2024.8.30
31-
cffi==1.17.0
32+
cffi==1.17.1
3233
chardet==5.2.0
3334
charset-normalizer==3.3.2
3435
cheroot==10.0.1
3536
cherrypy==18.10.0
3637
click==8.1.7
3738
colorama==0.4.6
3839
coverage[toml]==7.6.1
39-
cryptography==43.0.0
40+
cryptography==43.0.1
4041
deepdiff==8.0.1
4142
defusedxml==0.7.1
4243
deprecated==1.2.14
4344
detect-secrets==1.5.0
4445
dill==0.3.8
4546
distlib==0.3.8
4647
fastjsonschema==2.19.1
47-
filelock==3.15.4
48+
filelock==3.16.1
4849
fixcompliance==0.4.34
4950
fixdatalink[extra]==2.0.2
5051
fixinventoryclient==2.0.1
@@ -55,18 +56,19 @@ flexparser==0.3.1
5556
frozendict==2.4.4
5657
frozenlist==1.4.1
5758
google-api-core==2.19.2
58-
google-api-python-client==2.143.0
59+
google-api-python-client==2.146.0
5960
google-auth==2.34.0
6061
google-auth-httplib2==0.2.0
6162
google-cloud-core==2.4.1
6263
google-cloud-storage==2.18.2
63-
google-crc32c==1.5.0
64+
google-crc32c==1.6.0
6465
google-resumable-media==2.7.2
6566
googleapis-common-protos==1.65.0
67+
hcloud==2.2.0
6668
httplib2==0.22.0
67-
hypothesis==6.111.2
68-
idna==3.8
69-
importlib-metadata==8.4.0
69+
hypothesis==6.112.1
70+
idna==3.10
71+
importlib-metadata==8.5.0
7072
iniconfig==2.0.0
7173
isodate==0.6.1
7274
isort==5.13.2
@@ -84,41 +86,41 @@ markupsafe==2.1.5
8486
mccabe==0.7.0
8587
mdurl==0.1.2
8688
monotonic==1.6
87-
more-itertools==10.4.0
88-
msal==1.30.0
89+
more-itertools==10.5.0
90+
msal==1.31.0
8991
msal-extensions==1.2.0
90-
multidict==6.0.5
92+
multidict==6.1.0
9193
mypy==1.11.2
9294
mypy-extensions==1.0.0
9395
networkx==3.3
94-
numpy==2.1.0
96+
numpy==2.1.1
9597
oauth2client==4.1.3
9698
oauthlib==3.2.2
9799
onelogin==2.0.4
98100
orderly-set==5.2.2
99101
packaging==24.1
100-
paramiko==3.4.1
102+
paramiko==3.5.0
101103
parsy==2.1
102104
pathspec==0.12.1
103105
pep8-naming==0.14.1
104106
pint==0.24.3
105107
pip==24.2
106108
pip-tools==7.4.1
107109
plantuml==0.3.0
108-
platformdirs==4.2.2
110+
platformdirs==4.3.6
109111
pluggy==1.5.0
110112
portalocker==2.10.1
111113
portend==3.2.0
112-
posthog==3.6.0
114+
posthog==3.6.6
113115
prometheus-client==0.20.0
114116
prompt-toolkit==3.0.47
115117
proto-plus==1.24.0
116-
protobuf==5.28.0
118+
protobuf==5.28.2
117119
psutil==6.0.0
118120
psycopg2-binary==2.9.9
119121
pyarrow==17.0.0
120-
pyasn1==0.6.0
121-
pyasn1-modules==0.4.0
122+
pyasn1==0.6.1
123+
pyasn1-modules==0.4.1
122124
pycares==4.4.0
123125
pycodestyle==2.12.1
124126
pycparser==2.22
@@ -131,13 +133,13 @@ pymysql==1.1.1
131133
pynacl==1.5.0
132134
pyopenssl==24.2.1
133135
pyparsing==3.1.4
134-
pyproject-api==1.7.1
136+
pyproject-api==1.8.0
135137
pyproject-hooks==1.1.0
136-
pytest==8.3.2
138+
pytest==8.3.3
137139
pytest-asyncio==0.24.0
138140
pytest-cov==5.0.0
139141
pytest-runner==6.0.1
140-
python-arango==8.1.0
142+
python-arango==8.1.1
141143
python-dateutil==2.9.0.post0
142144
pytz==2024.1
143145
pyvmomi==8.0.3.0.1
@@ -147,30 +149,30 @@ requests-oauthlib==2.0.0
147149
requests-toolbelt==1.0.0
148150
retrying==1.3.4
149151
rfc3339-validator==0.1.4
150-
rich==13.8.0
152+
rich==13.8.1
151153
rsa==4.9
152154
s3transfer==0.10.2
153-
setuptools==74.0.0
155+
setuptools==75.1.0
154156
six==1.16.0
155-
slack-sdk==3.31.0
156-
snowflake-connector-python==3.12.1
157+
slack-sdk==3.33.0
158+
snowflake-connector-python==3.12.2
157159
snowflake-sqlalchemy==1.6.1
158160
sortedcontainers==2.4.0
159-
sqlalchemy==1.4.53
161+
sqlalchemy==1.4.54
160162
tempora==5.7.0
161163
tenacity==9.0.0
162164
toml==0.10.2
163165
tomlkit==0.13.2
164166
toolz==0.12.1
165-
tox==4.18.0
167+
tox==4.20.0
166168
transitions==0.9.2
167169
typeguard==4.3.0
168170
types-aiofiles==24.1.0.20240626
169-
types-python-dateutil==2.9.0.20240821
170-
types-pytz==2024.1.0.20240417
171-
types-pyyaml==6.0.12.20240808
171+
types-python-dateutil==2.9.0.20240906
172+
types-pytz==2024.2.0.20240913
173+
types-pyyaml==6.0.12.20240917
172174
types-requests==2.31.0.6
173-
types-setuptools==74.0.0.20240831
175+
types-setuptools==75.1.0.20240917
174176
types-six==1.16.21.20240513
175177
types-tzlocal==5.1.0.1
176178
types-urllib3==1.26.25.14
@@ -181,11 +183,11 @@ tzlocal==5.2
181183
uritemplate==4.1.1
182184
urllib3==1.26.20
183185
ustache==0.1.5
184-
virtualenv==20.26.3
186+
virtualenv==20.26.5
185187
wcwidth==0.2.13
186188
websocket-client==1.8.0
187189
wheel==0.44.0
188190
wrapt==1.16.0
189-
yarl==1.9.7
191+
yarl==1.11.1
190192
zc-lockfile==3.0.post1
191-
zipp==3.20.1
193+
zipp==3.20.2

0 commit comments

Comments
 (0)