(*, 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)
| 877 | |
| 878 | |
| 879 | def _parse_connect_arguments(*, dsn, host, port, user, password, passfile, |
| 880 | database, command_timeout, |
| 881 | statement_cache_size, |
| 882 | max_cached_statement_lifetime, |
| 883 | max_cacheable_statement_size, |
| 884 | ssl, direct_tls, server_settings, |
| 885 | target_session_attrs, krbsrvname, gsslib, |
| 886 | service, servicefile): |
| 887 | local_vars = locals() |
| 888 | for var_name in {'max_cacheable_statement_size', |
| 889 | 'max_cached_statement_lifetime', |
| 890 | 'statement_cache_size'}: |
| 891 | var_val = local_vars[var_name] |
| 892 | if var_val is None or isinstance(var_val, bool) or var_val < 0: |
| 893 | raise ValueError( |
| 894 | '{} is expected to be greater ' |
| 895 | 'or equal to 0, got {!r}'.format(var_name, var_val)) |
| 896 | |
| 897 | if command_timeout is not None: |
| 898 | try: |
| 899 | if isinstance(command_timeout, bool): |
| 900 | raise ValueError |
| 901 | command_timeout = float(command_timeout) |
| 902 | if command_timeout <= 0: |
| 903 | raise ValueError |
| 904 | except ValueError: |
| 905 | raise ValueError( |
| 906 | 'invalid command_timeout value: ' |
| 907 | 'expected greater than 0 float (got {!r})'.format( |
| 908 | command_timeout)) from None |
| 909 | |
| 910 | addrs, params = _parse_connect_dsn_and_args( |
| 911 | dsn=dsn, host=host, port=port, user=user, |
| 912 | password=password, passfile=passfile, ssl=ssl, |
| 913 | direct_tls=direct_tls, database=database, |
| 914 | server_settings=server_settings, |
| 915 | target_session_attrs=target_session_attrs, |
| 916 | krbsrvname=krbsrvname, gsslib=gsslib, |
| 917 | service=service, servicefile=servicefile) |
| 918 | |
| 919 | config = _ClientConfiguration( |
| 920 | command_timeout=command_timeout, |
| 921 | statement_cache_size=statement_cache_size, |
| 922 | max_cached_statement_lifetime=max_cached_statement_lifetime, |
| 923 | max_cacheable_statement_size=max_cacheable_statement_size,) |
| 924 | |
| 925 | return addrs, params, config |
| 926 | |
| 927 | |
| 928 | class TLSUpgradeProto(asyncio.Protocol): |
no test coverage detected