Skip to content

Commit

Permalink
Merge branch 'dev' into feat/move-area-command-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoPascoli authored Feb 6, 2025
2 parents 08a8a0d + 3efcfff commit d6b94a6
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: psf/black@stable
with:
# Version of Black should match the versions set in `requirements-dev.txt`
version: "~=23.7.0"
version: "~=25.1.0"
options: --check --diff
- name: Check Typing (mypy)
#continue-on-error: true
Expand Down
32 changes: 20 additions & 12 deletions antarest/core/filetransfer/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ def request_download(
Event(
type=EventType.DOWNLOAD_CREATED,
payload=download.to_dto(),
permissions=PermissionInfo(owner=owner.impersonator)
if owner
else PermissionInfo(public_mode=PublicMode.READ),
permissions=(
PermissionInfo(owner=owner.impersonator)
if owner
else PermissionInfo(public_mode=PublicMode.READ)
),
)
)
return download
Expand All @@ -98,9 +100,11 @@ def set_ready(self, download_id: str, use_notification: bool = True) -> None:
Event(
type=EventType.DOWNLOAD_READY,
payload=download.to_dto(),
permissions=PermissionInfo(owner=download.owner)
if download.owner
else PermissionInfo(public_mode=PublicMode.READ),
permissions=(
PermissionInfo(owner=download.owner)
if download.owner
else PermissionInfo(public_mode=PublicMode.READ)
),
)
)

Expand All @@ -116,9 +120,11 @@ def fail(self, download_id: str, reason: str = "") -> None:
Event(
type=EventType.DOWNLOAD_FAILED,
payload=download.to_dto(),
permissions=PermissionInfo(owner=download.owner)
if download.owner
else PermissionInfo(public_mode=PublicMode.READ),
permissions=(
PermissionInfo(owner=download.owner)
if download.owner
else PermissionInfo(public_mode=PublicMode.READ)
),
)
)

Expand Down Expand Up @@ -185,9 +191,11 @@ def _clean_up_expired_downloads(self, file_downloads: List[FileDownload]) -> Non
Event(
type=EventType.DOWNLOAD_EXPIRED,
payload=download_id,
permissions=PermissionInfo(owner=download_owner)
if download_owner
else PermissionInfo(public_mode=PublicMode.READ),
permissions=(
PermissionInfo(owner=download_owner)
if download_owner
else PermissionInfo(public_mode=PublicMode.READ)
),
)
)

Expand Down
12 changes: 9 additions & 3 deletions antarest/service_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,15 @@ def create_event_bus(app_ctxt: t.Optional[AppBuildContext], config: Config) -> t
)


def create_core_services(
app_ctxt: t.Optional[AppBuildContext], config: Config
) -> t.Tuple[ICache, IEventBus, ITaskService, FileTransferManager, LoginService, MatrixService, StudyService,]:
def create_core_services(app_ctxt: t.Optional[AppBuildContext], config: Config) -> t.Tuple[
ICache,
IEventBus,
ITaskService,
FileTransferManager,
LoginService,
MatrixService,
StudyService,
]:
event_bus, redis_client = create_event_bus(app_ctxt, config)
cache = build_cache(config=config, redis_client=redis_client)
filetransfer_service = build_filetransfer_service(app_ctxt, event_bus, config)
Expand Down
8 changes: 5 additions & 3 deletions antarest/study/business/general_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,11 @@ def __get_building_mode_update_cmds(

return [
UpdateConfig(
target=f"{GENERAL_PATH}/custom-scenario"
if study_version >= STUDY_VERSION_8
else f"{GENERAL_PATH}/custom-ts-numbers",
target=(
f"{GENERAL_PATH}/custom-scenario"
if study_version >= STUDY_VERSION_8
else f"{GENERAL_PATH}/custom-ts-numbers"
),
data=new_value == BuildingMode.CUSTOM,
command_context=cmd_context,
study_version=study_version,
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-r requirements-test.txt
-r requirements-desktop.txt
# Version of Black should match the versions set in `.github/workflows/main.yml`
black~=23.7.0
isort~=5.12.0
mypy~=1.11.1
black~=25.1.0
isort~=6.0.0
mypy~=1.15.0
pyinstaller==6.10.0
pyinstaller-hooks-contrib==2024.8

Expand Down
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ antares-timeseries-generation==0.1.7
# and **manage their versions** for better control and to avoid unnecessary dependencies.
fastapi~=0.110.3
uvicorn[standard]~=0.30.6
pydantic~=2.8.2
pydantic~=2.10.0
httpx~=0.27.0
python-multipart~=0.0.9

Expand All @@ -28,8 +28,7 @@ click~=8.0.3
contextvars~=2.4
filelock~=3.4.2
gunicorn~=20.1.0
humanize~=4.10.0; python_version <= '3.8'
humanize~=4.11.0; python_version > '3.8'
humanize~=4.11.0
jsonref~=0.2
PyJWT~=2.9.0
MarkupSafe~=2.0.1
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/studies_blueprint/test_get_studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,9 +1404,11 @@ def test_get_studies__access_permissions(self, client: TestClient, admin_access_
res = client.get(
STUDIES_URL,
headers={"Authorization": f"Bearer {users_tokens['user_1']}"},
params={"groups": ",".join(request_groups_ids), "pageNb": 1, "pageSize": 2}
if request_groups_ids
else {"pageNb": 1, "pageSize": 2},
params=(
{"groups": ",".join(request_groups_ids), "pageNb": 1, "pageSize": 2}
if request_groups_ids
else {"pageNb": 1, "pageSize": 2}
),
)
assert res.status_code == LIST_STATUS_CODE, res.json()
assert len(res.json()) == max(0, min(2, len(expected_studies) - 2))
Expand Down
2 changes: 1 addition & 1 deletion tests/variantstudy/model/command/test_remove_st_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_init__invalid_storage_id(self, recent_study: FileStudy, command_context
"loc": ("storage_id",),
"msg": "String should match pattern '[a-z0-9_(),& -]+'",
"type": "string_pattern_mismatch",
"url": "https://errors.pydantic.dev/2.8/v/string_pattern_mismatch",
"url": "https://errors.pydantic.dev/2.10/v/string_pattern_mismatch",
}
]

Expand Down

0 comments on commit d6b94a6

Please sign in to comment.