(*, dsn, host, port, user, password, passfile,
database, command_timeout,
statement_cache_size,
max_cached_statement_lifetime,
max_cacheable_statement_size,
ssl, direct_tls, server_settings,
target_session_attrs, krbsrvname, gsslib,
service, servicefile)
| 860 | |
| 861 | |
| 862 | def _parse_connect_arguments(*, dsn, host, port, user, password, passfile, |
| 863 | database, command_timeout, |
| 864 | statement_cache_size, |
| 865 | max_cached_statement_lifetime, |
| 866 | max_cacheable_statement_size, |
| 867 | ssl, direct_tls, server_settings, |
| 868 | target_session_attrs, krbsrvname, gsslib, |
| 869 | service, servicefile): |
| 870 | local_vars = locals() |
| 871 | for var_name in {'max_cacheable_statement_size', |
| 872 | 'max_cached_statement_lifetime', |
| 873 | 'statement_cache_size'}: |
| 874 | var_val = local_vars[var_name] |
| 875 | if var_val is None or isinstance(var_val, bool) or var_val < 0: |
| 876 | raise ValueError( |
| 877 | '{} is expected to be greater ' |
| 878 | 'or equal to 0, got {!r}'.format(var_name, var_val)) |
| 879 | |
| 880 | if command_timeout is not None: |
| 881 | try: |
| 882 | if isinstance(command_timeout, bool): |
| 883 | raise ValueError |
| 884 | command_timeout = float(command_timeout) |
| 885 | if command_timeout <= 0: |
| 886 | raise ValueError |
| 887 | except ValueError: |
| 888 | raise ValueError( |
| 889 | 'invalid command_timeout value: ' |
| 890 | 'expected greater than 0 float (got {!r})'.format( |
| 891 | command_timeout)) from None |
| 892 | |
| 893 | addrs, params = _parse_connect_dsn_and_args( |
| 894 | dsn=dsn, host=host, port=port, user=user, |
| 895 | password=password, passfile=passfile, ssl=ssl, |
| 896 | direct_tls=direct_tls, database=database, |
| 897 | server_settings=server_settings, |
| 898 | target_session_attrs=target_session_attrs, |
| 899 | krbsrvname=krbsrvname, gsslib=gsslib, |
| 900 | service=service, servicefile=servicefile) |
| 901 | |
| 902 | config = _ClientConfiguration( |
| 903 | command_timeout=command_timeout, |
| 904 | statement_cache_size=statement_cache_size, |
| 905 | max_cached_statement_lifetime=max_cached_statement_lifetime, |
| 906 | max_cacheable_statement_size=max_cacheable_statement_size,) |
| 907 | |
| 908 | return addrs, params, config |
| 909 | |
| 910 | |
| 911 | class TLSUpgradeProto(asyncio.Protocol): |
no test coverage detected
searching dependent graphs…