3636from .._async_compat .util import AsyncUtil
3737from .._conf import (
3838 Config ,
39+ ConfigurationError ,
3940 PoolConfig ,
4041 SessionConfig ,
4142 TrustAll ,
@@ -125,11 +126,9 @@ def driver(
125126 cls ,
126127 uri : str ,
127128 * ,
128- auth : t .Union [
129- _TAuth ,
130- AsyncAuthManager ,
131- ] = ...,
129+ auth : t .Union [_TAuth , AsyncAuthManager ] = ...,
132130 max_connection_lifetime : float = ...,
131+ liveness_check_timeout : t .Optional [float ] = ...,
133132 max_connection_pool_size : int = ...,
134133 connection_timeout : float = ...,
135134 trust : t .Union [
@@ -151,9 +150,10 @@ def driver(
151150 notifications_disabled_categories : t .Optional [
152151 t .Iterable [T_NotificationDisabledCategory ]
153152 ] = ...,
153+ telemetry_disabled : bool = ...,
154154
155155 # undocumented/unsupported options
156- # they may be change or removed any time without prior notice
156+ # they may be changed or removed any time without prior notice
157157 connection_acquisition_timeout : float = ...,
158158 max_transaction_retry_time : float = ...,
159159 initial_retry_delay : float = ...,
@@ -164,19 +164,17 @@ def driver(
164164 impersonated_user : t .Optional [str ] = ...,
165165 bookmark_manager : t .Union [AsyncBookmarkManager ,
166166 BookmarkManager , None ] = ...,
167- telemetry_disabled : bool = ...,
168167 ) -> AsyncDriver :
169168 ...
170169
171170 else :
172171
173172 @classmethod
174173 def driver (
175- cls , uri : str , * ,
176- auth : t .Union [
177- _TAuth ,
178- AsyncAuthManager ,
179- ] = None ,
174+ cls ,
175+ uri : str ,
176+ * ,
177+ auth : t .Union [_TAuth , AsyncAuthManager ] = None ,
180178 ** config
181179 ) -> AsyncDriver :
182180 """Create a driver.
@@ -202,7 +200,6 @@ def driver(
202200 TRUST_ALL_CERTIFICATES ,
203201 TRUST_SYSTEM_CA_SIGNED_CERTIFICATES
204202 ):
205- from ..exceptions import ConfigurationError
206203 raise ConfigurationError (
207204 "The config setting `trust` values are {!r}"
208205 .format (
@@ -216,8 +213,8 @@ def driver(
216213 if ("trusted_certificates" in config .keys ()
217214 and not isinstance (config ["trusted_certificates" ],
218215 TrustStore )):
219- raise ConnectionError (
220- " The config setting ` trusted_certificates` must be of "
216+ raise ConfigurationError (
217+ ' The config setting " trusted_certificates" must be of '
221218 "type neo4j.TrustAll, neo4j.TrustCustomCAs, or"
222219 "neo4j.TrustSystemCAs but was {}" .format (
223220 type (config ["trusted_certificates" ])
@@ -229,7 +226,6 @@ def driver(
229226 or "trust" in config .keys ()
230227 or "trusted_certificates" in config .keys ()
231228 or "ssl_context" in config .keys ())):
232- from ..exceptions import ConfigurationError
233229
234230 # TODO: 6.0 - remove "trust" from error message
235231 raise ConfigurationError (
@@ -257,12 +253,22 @@ def driver(
257253 config ["encrypted" ] = True
258254 config ["trusted_certificates" ] = TrustAll ()
259255 _normalize_notifications_config (config )
256+ liveness_check_timeout = config .get ("liveness_check_timeout" )
257+ if (
258+ liveness_check_timeout is not None
259+ and liveness_check_timeout < 0
260+ ):
261+ raise ConfigurationError (
262+ 'The config setting "liveness_check_timeout" must be '
263+ "greater than or equal to 0 but was "
264+ f"{ liveness_check_timeout } ."
265+ )
260266
261267 assert driver_type in (DRIVER_BOLT , DRIVER_NEO4J )
262268 if driver_type == DRIVER_BOLT :
263269 if parse_routing_context (parsed .query ):
264270 deprecation_warn (
265- " Creating a direct driver (` bolt://` scheme) with "
271+ ' Creating a direct driver (" bolt://" scheme) with '
266272 "routing context (URI parameters) is deprecated. They "
267273 "will be ignored. This will raise an error in a "
268274 'future release. Given URI "{}"' .format (uri ),
0 commit comments