localstack-core 4.9.3.dev26__py3-none-any.whl → 4.9.3.dev28__py3-none-any.whl

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.

Potentially problematic release.


This version of localstack-core might be problematic. Click here for more details.

Files changed (70) hide show
  1. localstack/cli/exceptions.py +1 -1
  2. localstack/cli/localstack.py +4 -4
  3. localstack/cli/lpm.py +3 -4
  4. localstack/cli/profiles.py +1 -2
  5. localstack/config.py +12 -12
  6. localstack/packages/api.py +9 -8
  7. localstack/packages/core.py +2 -2
  8. localstack/services/dynamodb/provider.py +24 -0
  9. localstack/services/dynamodb/v2/provider.py +24 -0
  10. localstack/testing/pytest/cloudformation/fixtures.py +3 -3
  11. localstack/testing/pytest/container.py +4 -5
  12. localstack/testing/pytest/fixtures.py +20 -19
  13. localstack/testing/pytest/marking.py +5 -4
  14. localstack/testing/pytest/stepfunctions/utils.py +4 -3
  15. localstack/testing/pytest/util.py +1 -1
  16. localstack/testing/pytest/validation_tracking.py +1 -2
  17. localstack/utils/analytics/events.py +2 -2
  18. localstack/utils/analytics/metadata.py +1 -2
  19. localstack/utils/analytics/metrics/counter.py +6 -8
  20. localstack/utils/analytics/publisher.py +1 -2
  21. localstack/utils/analytics/service_request_aggregator.py +2 -2
  22. localstack/utils/archives.py +11 -11
  23. localstack/utils/aws/arns.py +7 -7
  24. localstack/utils/aws/aws_responses.py +7 -7
  25. localstack/utils/aws/aws_stack.py +2 -3
  26. localstack/utils/aws/message_forwarding.py +1 -2
  27. localstack/utils/aws/request_context.py +4 -5
  28. localstack/utils/batch_policy.py +3 -3
  29. localstack/utils/bootstrap.py +7 -7
  30. localstack/utils/cloudwatch/cloudwatch_util.py +5 -5
  31. localstack/utils/collections.py +7 -8
  32. localstack/utils/config_listener.py +1 -1
  33. localstack/utils/container_networking.py +2 -3
  34. localstack/utils/container_utils/container_client.py +115 -131
  35. localstack/utils/container_utils/docker_cmd_client.py +42 -42
  36. localstack/utils/container_utils/docker_sdk_client.py +63 -62
  37. localstack/utils/diagnose.py +2 -3
  38. localstack/utils/docker_utils.py +3 -4
  39. localstack/utils/functions.py +3 -2
  40. localstack/utils/http.py +4 -5
  41. localstack/utils/json.py +3 -3
  42. localstack/utils/kinesis/kinesis_connector.py +2 -1
  43. localstack/utils/net.py +6 -6
  44. localstack/utils/no_exit_argument_parser.py +2 -2
  45. localstack/utils/numbers.py +2 -2
  46. localstack/utils/objects.py +6 -5
  47. localstack/utils/patch.py +2 -1
  48. localstack/utils/run.py +10 -9
  49. localstack/utils/scheduler.py +11 -11
  50. localstack/utils/server/tcp_proxy.py +2 -2
  51. localstack/utils/serving.py +2 -3
  52. localstack/utils/strings.py +10 -11
  53. localstack/utils/sync.py +2 -1
  54. localstack/utils/tagging.py +1 -4
  55. localstack/utils/testutil.py +5 -4
  56. localstack/utils/threads.py +2 -2
  57. localstack/utils/time.py +1 -2
  58. localstack/utils/urls.py +1 -3
  59. localstack/version.py +2 -2
  60. {localstack_core-4.9.3.dev26.dist-info → localstack_core-4.9.3.dev28.dist-info}/METADATA +2 -2
  61. {localstack_core-4.9.3.dev26.dist-info → localstack_core-4.9.3.dev28.dist-info}/RECORD +69 -69
  62. localstack_core-4.9.3.dev28.dist-info/plux.json +1 -0
  63. localstack_core-4.9.3.dev26.dist-info/plux.json +0 -1
  64. {localstack_core-4.9.3.dev26.data → localstack_core-4.9.3.dev28.data}/scripts/localstack +0 -0
  65. {localstack_core-4.9.3.dev26.data → localstack_core-4.9.3.dev28.data}/scripts/localstack-supervisor +0 -0
  66. {localstack_core-4.9.3.dev26.data → localstack_core-4.9.3.dev28.data}/scripts/localstack.bat +0 -0
  67. {localstack_core-4.9.3.dev26.dist-info → localstack_core-4.9.3.dev28.dist-info}/WHEEL +0 -0
  68. {localstack_core-4.9.3.dev26.dist-info → localstack_core-4.9.3.dev28.dist-info}/entry_points.txt +0 -0
  69. {localstack_core-4.9.3.dev26.dist-info → localstack_core-4.9.3.dev28.dist-info}/licenses/LICENSE.txt +0 -0
  70. {localstack_core-4.9.3.dev26.dist-info → localstack_core-4.9.3.dev28.dist-info}/top_level.txt +0 -0
@@ -5,21 +5,17 @@ import logging
5
5
  import os
6
6
  import re
7
7
  import shlex
8
- import sys
9
8
  import tarfile
10
9
  import tempfile
11
10
  from abc import ABCMeta, abstractmethod
11
+ from collections.abc import Callable
12
12
  from enum import Enum, unique
13
13
  from pathlib import Path
14
14
  from typing import (
15
- Callable,
16
15
  Literal,
17
16
  NamedTuple,
18
- Optional,
19
17
  Protocol,
20
18
  TypedDict,
21
- Union,
22
- get_args,
23
19
  )
24
20
 
25
21
  import dotenv
@@ -57,7 +53,7 @@ class DockerContainerStats(TypedDict):
57
53
  MemUsage: tuple[int, int]
58
54
  NetIO: tuple[int, int]
59
55
  PIDs: int
60
- SDKStats: Optional[dict]
56
+ SDKStats: dict | None
61
57
 
62
58
 
63
59
  class ContainerException(Exception):
@@ -143,7 +139,7 @@ class Ulimit:
143
139
 
144
140
  name: str
145
141
  soft_limit: int
146
- hard_limit: Optional[int] = None
142
+ hard_limit: int | None = None
147
143
 
148
144
  def __repr__(self):
149
145
  """Format: <type>=<soft limit>[:<hard limit>]"""
@@ -154,19 +150,11 @@ class Ulimit:
154
150
 
155
151
 
156
152
  # defines the type for port mappings (source->target port range)
157
- PortRange = Union[list, HashableList]
153
+ PortRange = list | HashableList
158
154
  # defines the protocol for a port range ("tcp" or "udp")
159
155
  PortProtocol = str
160
156
 
161
157
 
162
- def isinstance_union(obj, class_or_tuple):
163
- # that's some dirty hack
164
- if sys.version_info < (3, 10):
165
- return isinstance(obj, get_args(PortRange))
166
- else:
167
- return isinstance(obj, class_or_tuple)
168
-
169
-
170
158
  class PortMappings:
171
159
  """Maps source to target port ranges for Docker port mappings."""
172
160
 
@@ -181,14 +169,14 @@ class PortMappings:
181
169
 
182
170
  def add(
183
171
  self,
184
- port: Union[int, PortRange],
185
- mapped: Union[int, PortRange] = None,
172
+ port: int | PortRange,
173
+ mapped: int | PortRange = None,
186
174
  protocol: PortProtocol = "tcp",
187
175
  ):
188
176
  mapped = mapped or port
189
- if isinstance_union(port, PortRange):
177
+ if isinstance(port, PortRange):
190
178
  for i in range(port[1] - port[0] + 1):
191
- if isinstance_union(mapped, PortRange):
179
+ if isinstance(mapped, PortRange):
192
180
  self.add(port[0] + i, mapped[0] + i, protocol)
193
181
  else:
194
182
  self.add(port[0] + i, mapped, protocol)
@@ -266,7 +254,7 @@ class PortMappings:
266
254
 
267
255
  return [item for k, v in self.mappings.items() for item in entry(k, v)]
268
256
 
269
- def to_dict(self) -> dict[str, Union[tuple[str, Union[int, list[int]]], int]]:
257
+ def to_dict(self) -> dict[str, tuple[str, int | list[int]] | int]:
270
258
  bind_address = self.bind_host or ""
271
259
 
272
260
  def bind_port(bind_address, host_port):
@@ -452,27 +440,23 @@ class VolumeDirMount:
452
440
 
453
441
 
454
442
  class VolumeMappings:
455
- mappings: list[Union[SimpleVolumeBind, BindMount]]
443
+ mappings: list[SimpleVolumeBind | BindMount]
456
444
 
457
- def __init__(self, mappings: list[Union[SimpleVolumeBind, BindMount, VolumeDirMount]] = None):
445
+ def __init__(self, mappings: list[SimpleVolumeBind | BindMount | VolumeDirMount] = None):
458
446
  self.mappings = mappings if mappings is not None else []
459
447
 
460
- def add(self, mapping: Union[SimpleVolumeBind, BindMount, VolumeDirMount]):
448
+ def add(self, mapping: SimpleVolumeBind | BindMount | VolumeDirMount):
461
449
  self.append(mapping)
462
450
 
463
451
  def append(
464
452
  self,
465
- mapping: Union[
466
- SimpleVolumeBind,
467
- BindMount,
468
- VolumeDirMount,
469
- ],
453
+ mapping: SimpleVolumeBind | BindMount | VolumeDirMount,
470
454
  ):
471
455
  self.mappings.append(mapping)
472
456
 
473
457
  def find_target_mapping(
474
458
  self, container_dir: str
475
- ) -> Optional[Union[SimpleVolumeBind, BindMount, VolumeDirMount]]:
459
+ ) -> SimpleVolumeBind | BindMount | VolumeDirMount | None:
476
460
  """
477
461
  Looks through the volumes and returns the one where the container dir matches ``container_dir``.
478
462
  Returns None if there is no volume mapping to the given container directory.
@@ -511,8 +495,8 @@ class VolumeInfo(NamedTuple):
511
495
  mode: str
512
496
  rw: bool
513
497
  propagation: str
514
- name: Optional[str] = None
515
- driver: Optional[str] = None
498
+ name: str | None = None
499
+ driver: str | None = None
516
500
 
517
501
 
518
502
  @dataclasses.dataclass
@@ -524,13 +508,13 @@ class LogConfig:
524
508
  @dataclasses.dataclass
525
509
  class ContainerConfiguration:
526
510
  image_name: str
527
- name: Optional[str] = None
511
+ name: str | None = None
528
512
  volumes: VolumeMappings = dataclasses.field(default_factory=VolumeMappings)
529
513
  ports: PortMappings = dataclasses.field(default_factory=PortMappings)
530
514
  exposed_ports: list[str] = dataclasses.field(default_factory=list)
531
- entrypoint: Optional[Union[list[str], str]] = None
532
- additional_flags: Optional[str] = None
533
- command: Optional[list[str]] = None
515
+ entrypoint: list[str] | str | None = None
516
+ additional_flags: str | None = None
517
+ command: list[str] | None = None
534
518
  env_vars: dict[str, str] = dataclasses.field(default_factory=dict)
535
519
 
536
520
  privileged: bool = False
@@ -539,19 +523,19 @@ class ContainerConfiguration:
539
523
  tty: bool = False
540
524
  detach: bool = False
541
525
 
542
- stdin: Optional[str] = None
543
- user: Optional[str] = None
544
- cap_add: Optional[list[str]] = None
545
- cap_drop: Optional[list[str]] = None
546
- security_opt: Optional[list[str]] = None
547
- network: Optional[str] = None
548
- dns: Optional[str] = None
549
- workdir: Optional[str] = None
550
- platform: Optional[str] = None
551
- ulimits: Optional[list[Ulimit]] = None
552
- labels: Optional[dict[str, str]] = None
553
- init: Optional[bool] = None
554
- log_config: Optional[LogConfig] = None
526
+ stdin: str | None = None
527
+ user: str | None = None
528
+ cap_add: list[str] | None = None
529
+ cap_drop: list[str] | None = None
530
+ security_opt: list[str] | None = None
531
+ network: str | None = None
532
+ dns: str | None = None
533
+ workdir: str | None = None
534
+ platform: str | None = None
535
+ ulimits: list[Ulimit] | None = None
536
+ labels: dict[str, str] | None = None
537
+ init: bool | None = None
538
+ log_config: LogConfig | None = None
555
539
 
556
540
 
557
541
  class ContainerConfigurator(Protocol):
@@ -574,17 +558,17 @@ class DockerRunFlags:
574
558
  create: https://docs.docker.com/engine/reference/commandline/create/
575
559
  """
576
560
 
577
- env_vars: Optional[dict[str, str]]
578
- extra_hosts: Optional[dict[str, str]]
579
- labels: Optional[dict[str, str]]
580
- volumes: Optional[list[SimpleVolumeBind]]
581
- network: Optional[str]
582
- platform: Optional[DockerPlatform]
583
- privileged: Optional[bool]
584
- ports: Optional[PortMappings]
585
- ulimits: Optional[list[Ulimit]]
586
- user: Optional[str]
587
- dns: Optional[list[str]]
561
+ env_vars: dict[str, str] | None
562
+ extra_hosts: dict[str, str] | None
563
+ labels: dict[str, str] | None
564
+ volumes: list[SimpleVolumeBind] | None
565
+ network: str | None
566
+ platform: DockerPlatform | None
567
+ privileged: bool | None
568
+ ports: PortMappings | None
569
+ ulimits: list[Ulimit] | None
570
+ user: str | None
571
+ dns: list[str] | None
588
572
 
589
573
 
590
574
  class RegistryResolverStrategy(Protocol):
@@ -706,7 +690,7 @@ class ContainerClient(metaclass=ABCMeta):
706
690
  """
707
691
 
708
692
  @abstractmethod
709
- def list_containers(self, filter: Union[list[str], str, None] = None, all=True) -> list[dict]:
693
+ def list_containers(self, filter: list[str] | str | None = None, all=True) -> list[dict]:
710
694
  """List all containers matching the given filters
711
695
 
712
696
  :return: A list of dicts with keys id, image, name, labels, status
@@ -729,7 +713,7 @@ class ContainerClient(metaclass=ABCMeta):
729
713
  container_name,
730
714
  file_contents: bytes,
731
715
  container_path: str,
732
- chmod_mode: Optional[int] = None,
716
+ chmod_mode: int | None = None,
733
717
  ) -> None:
734
718
  """
735
719
  Create a file in container with the provided content. Provide the 'chmod_mode' argument if you want the file to have specific permissions.
@@ -761,8 +745,8 @@ class ContainerClient(metaclass=ABCMeta):
761
745
  def pull_image(
762
746
  self,
763
747
  docker_image: str,
764
- platform: Optional[DockerPlatform] = None,
765
- log_handler: Optional[Callable[[str], None]] = None,
748
+ platform: DockerPlatform | None = None,
749
+ log_handler: Callable[[str], None] | None = None,
766
750
  ) -> None:
767
751
  """
768
752
  Pulls an image with a given name from a Docker registry
@@ -780,7 +764,7 @@ class ContainerClient(metaclass=ABCMeta):
780
764
  dockerfile_path: str,
781
765
  image_name: str,
782
766
  context_path: str = None,
783
- platform: Optional[DockerPlatform] = None,
767
+ platform: DockerPlatform | None = None,
784
768
  ) -> str:
785
769
  """Builds an image from the given Dockerfile
786
770
 
@@ -824,7 +808,7 @@ class ContainerClient(metaclass=ABCMeta):
824
808
  """Returns a blocking generator you can iterate over to retrieve log output as it happens."""
825
809
 
826
810
  @abstractmethod
827
- def inspect_container(self, container_name_or_id: str) -> dict[str, Union[dict, str]]:
811
+ def inspect_container(self, container_name_or_id: str) -> dict[str, dict | str]:
828
812
  """Get detailed attributes of a container.
829
813
 
830
814
  :return: Dict containing docker attributes as returned by the daemon
@@ -845,7 +829,7 @@ class ContainerClient(metaclass=ABCMeta):
845
829
  @abstractmethod
846
830
  def inspect_image(
847
831
  self, image_name: str, pull: bool = True, strip_wellknown_repo_prefixes: bool = True
848
- ) -> dict[str, Union[dict, list, str]]:
832
+ ) -> dict[str, dict | list | str]:
849
833
  """Get detailed attributes of an image.
850
834
 
851
835
  :param image_name: Image name to inspect
@@ -871,7 +855,7 @@ class ContainerClient(metaclass=ABCMeta):
871
855
  """
872
856
 
873
857
  @abstractmethod
874
- def inspect_network(self, network_name: str) -> dict[str, Union[dict, str]]:
858
+ def inspect_network(self, network_name: str) -> dict[str, dict | str]:
875
859
  """Get detailed attributes of an network.
876
860
 
877
861
  :return: Dict containing docker attributes as returned by the daemon
@@ -882,7 +866,7 @@ class ContainerClient(metaclass=ABCMeta):
882
866
  self,
883
867
  network_name: str,
884
868
  container_name_or_id: str,
885
- aliases: Optional[list] = None,
869
+ aliases: list | None = None,
886
870
  link_local_ips: list[str] = None,
887
871
  ) -> None:
888
872
  """
@@ -994,31 +978,31 @@ class ContainerClient(metaclass=ABCMeta):
994
978
  self,
995
979
  image_name: str,
996
980
  *,
997
- name: Optional[str] = None,
998
- entrypoint: Optional[Union[list[str], str]] = None,
981
+ name: str | None = None,
982
+ entrypoint: list[str] | str | None = None,
999
983
  remove: bool = False,
1000
984
  interactive: bool = False,
1001
985
  tty: bool = False,
1002
986
  detach: bool = False,
1003
- command: Optional[Union[list[str], str]] = None,
1004
- volumes: Optional[Union[VolumeMappings, list[SimpleVolumeBind]]] = None,
1005
- ports: Optional[PortMappings] = None,
1006
- exposed_ports: Optional[list[str]] = None,
1007
- env_vars: Optional[dict[str, str]] = None,
1008
- user: Optional[str] = None,
1009
- cap_add: Optional[list[str]] = None,
1010
- cap_drop: Optional[list[str]] = None,
1011
- security_opt: Optional[list[str]] = None,
1012
- network: Optional[str] = None,
1013
- dns: Optional[Union[str, list[str]]] = None,
1014
- additional_flags: Optional[str] = None,
1015
- workdir: Optional[str] = None,
1016
- privileged: Optional[bool] = None,
1017
- labels: Optional[dict[str, str]] = None,
1018
- platform: Optional[DockerPlatform] = None,
1019
- ulimits: Optional[list[Ulimit]] = None,
1020
- init: Optional[bool] = None,
1021
- log_config: Optional[LogConfig] = None,
987
+ command: list[str] | str | None = None,
988
+ volumes: VolumeMappings | list[SimpleVolumeBind] | None = None,
989
+ ports: PortMappings | None = None,
990
+ exposed_ports: list[str] | None = None,
991
+ env_vars: dict[str, str] | None = None,
992
+ user: str | None = None,
993
+ cap_add: list[str] | None = None,
994
+ cap_drop: list[str] | None = None,
995
+ security_opt: list[str] | None = None,
996
+ network: str | None = None,
997
+ dns: str | list[str] | None = None,
998
+ additional_flags: str | None = None,
999
+ workdir: str | None = None,
1000
+ privileged: bool | None = None,
1001
+ labels: dict[str, str] | None = None,
1002
+ platform: DockerPlatform | None = None,
1003
+ ulimits: list[Ulimit] | None = None,
1004
+ init: bool | None = None,
1005
+ log_config: LogConfig | None = None,
1022
1006
  ) -> str:
1023
1007
  """Creates a container with the given image
1024
1008
 
@@ -1031,31 +1015,31 @@ class ContainerClient(metaclass=ABCMeta):
1031
1015
  image_name: str,
1032
1016
  stdin: bytes = None,
1033
1017
  *,
1034
- name: Optional[str] = None,
1035
- entrypoint: Optional[str] = None,
1018
+ name: str | None = None,
1019
+ entrypoint: str | None = None,
1036
1020
  remove: bool = False,
1037
1021
  interactive: bool = False,
1038
1022
  tty: bool = False,
1039
1023
  detach: bool = False,
1040
- command: Optional[Union[list[str], str]] = None,
1041
- volumes: Optional[Union[VolumeMappings, list[SimpleVolumeBind]]] = None,
1042
- ports: Optional[PortMappings] = None,
1043
- exposed_ports: Optional[list[str]] = None,
1044
- env_vars: Optional[dict[str, str]] = None,
1045
- user: Optional[str] = None,
1046
- cap_add: Optional[list[str]] = None,
1047
- cap_drop: Optional[list[str]] = None,
1048
- security_opt: Optional[list[str]] = None,
1049
- network: Optional[str] = None,
1050
- dns: Optional[str] = None,
1051
- additional_flags: Optional[str] = None,
1052
- workdir: Optional[str] = None,
1053
- labels: Optional[dict[str, str]] = None,
1054
- platform: Optional[DockerPlatform] = None,
1055
- privileged: Optional[bool] = None,
1056
- ulimits: Optional[list[Ulimit]] = None,
1057
- init: Optional[bool] = None,
1058
- log_config: Optional[LogConfig] = None,
1024
+ command: list[str] | str | None = None,
1025
+ volumes: VolumeMappings | list[SimpleVolumeBind] | None = None,
1026
+ ports: PortMappings | None = None,
1027
+ exposed_ports: list[str] | None = None,
1028
+ env_vars: dict[str, str] | None = None,
1029
+ user: str | None = None,
1030
+ cap_add: list[str] | None = None,
1031
+ cap_drop: list[str] | None = None,
1032
+ security_opt: list[str] | None = None,
1033
+ network: str | None = None,
1034
+ dns: str | None = None,
1035
+ additional_flags: str | None = None,
1036
+ workdir: str | None = None,
1037
+ labels: dict[str, str] | None = None,
1038
+ platform: DockerPlatform | None = None,
1039
+ privileged: bool | None = None,
1040
+ ulimits: list[Ulimit] | None = None,
1041
+ init: bool | None = None,
1042
+ log_config: LogConfig | None = None,
1059
1043
  ) -> tuple[bytes, bytes]:
1060
1044
  """Creates and runs a given docker container
1061
1045
 
@@ -1100,13 +1084,13 @@ class ContainerClient(metaclass=ABCMeta):
1100
1084
  def exec_in_container(
1101
1085
  self,
1102
1086
  container_name_or_id: str,
1103
- command: Union[list[str], str],
1087
+ command: list[str] | str,
1104
1088
  interactive: bool = False,
1105
1089
  detach: bool = False,
1106
- env_vars: Optional[dict[str, Optional[str]]] = None,
1107
- stdin: Optional[bytes] = None,
1108
- user: Optional[str] = None,
1109
- workdir: Optional[str] = None,
1090
+ env_vars: dict[str, str | None] | None = None,
1091
+ stdin: bytes | None = None,
1092
+ user: str | None = None,
1093
+ workdir: str | None = None,
1110
1094
  ) -> tuple[bytes, bytes]:
1111
1095
  """Execute a given command in a container
1112
1096
 
@@ -1120,7 +1104,7 @@ class ContainerClient(metaclass=ABCMeta):
1120
1104
  stdin: bytes = None,
1121
1105
  interactive: bool = False,
1122
1106
  attach: bool = False,
1123
- flags: Optional[str] = None,
1107
+ flags: str | None = None,
1124
1108
  ) -> tuple[bytes, bytes]:
1125
1109
  """Start a given, already created container
1126
1110
 
@@ -1134,7 +1118,7 @@ class ContainerClient(metaclass=ABCMeta):
1134
1118
  """
1135
1119
 
1136
1120
  @abstractmethod
1137
- def login(self, username: str, password: str, registry: Optional[str] = None) -> None:
1121
+ def login(self, username: str, password: str, registry: str | None = None) -> None:
1138
1122
  """
1139
1123
  Login into an OCI registry
1140
1124
 
@@ -1153,13 +1137,13 @@ class Util:
1153
1137
  MAX_ENV_ARGS_LENGTH = 20000
1154
1138
 
1155
1139
  @staticmethod
1156
- def format_env_vars(key: str, value: Optional[str]):
1140
+ def format_env_vars(key: str, value: str | None):
1157
1141
  if value is None:
1158
1142
  return key
1159
1143
  return f"{key}={value}"
1160
1144
 
1161
1145
  @classmethod
1162
- def create_env_vars_file_flag(cls, env_vars: dict) -> tuple[list[str], Optional[str]]:
1146
+ def create_env_vars_file_flag(cls, env_vars: dict) -> tuple[list[str], str | None]:
1163
1147
  if not env_vars:
1164
1148
  return [], None
1165
1149
  result = []
@@ -1292,16 +1276,16 @@ class Util:
1292
1276
  @staticmethod
1293
1277
  def parse_additional_flags(
1294
1278
  additional_flags: str,
1295
- env_vars: Optional[dict[str, str]] = None,
1296
- labels: Optional[dict[str, str]] = None,
1297
- volumes: Optional[list[SimpleVolumeBind]] = None,
1298
- network: Optional[str] = None,
1299
- platform: Optional[DockerPlatform] = None,
1300
- ports: Optional[PortMappings] = None,
1301
- privileged: Optional[bool] = None,
1302
- user: Optional[str] = None,
1303
- ulimits: Optional[list[Ulimit]] = None,
1304
- dns: Optional[Union[str, list[str]]] = None,
1279
+ env_vars: dict[str, str] | None = None,
1280
+ labels: dict[str, str] | None = None,
1281
+ volumes: list[SimpleVolumeBind] | None = None,
1282
+ network: str | None = None,
1283
+ platform: DockerPlatform | None = None,
1284
+ ports: PortMappings | None = None,
1285
+ privileged: bool | None = None,
1286
+ user: str | None = None,
1287
+ ulimits: list[Ulimit] | None = None,
1288
+ dns: str | list[str] | None = None,
1305
1289
  ) -> DockerRunFlags:
1306
1290
  """Parses additional CLI-formatted Docker flags, which could overwrite provided defaults.
1307
1291
  :param additional_flags: String which contains the flag definitions inspired by the Docker CLI reference:
@@ -1522,7 +1506,7 @@ class Util:
1522
1506
 
1523
1507
  @staticmethod
1524
1508
  def convert_mount_list_to_dict(
1525
- volumes: Union[list[SimpleVolumeBind], VolumeMappings],
1509
+ volumes: list[SimpleVolumeBind] | VolumeMappings,
1526
1510
  ) -> dict[str, dict[str, str]]:
1527
1511
  """Converts a List of (host_path, container_path) tuples to a Dict suitable as volume argument for docker sdk"""
1528
1512