Method: flask.cli.CertParamType.convert
Calls: 11, Exceptions: 8, Paths: 6Back
Path 1: 3 calls (0.27)
'/Users/andrehora/Documents/git/projects-pathspotter/flask/tests/test_cli.py' (3)
Option (3)
Context (3)
'/Users/andrehora/Documents/git/projects-pathspotter/flask/tests/test_cli.py' (3)
1def convert(self, value, param, ctx):
2 try:
3 import ssl
4 except ImportError:
5 raise click.BadParameter(
6 'Using "--cert" requires Python to be compiled with SSL support.',
7 ctx,
8 param,
9 ) from None
10
11 try:
12 return self.path_type(value, param, ctx)
13 except click.BadParameter:
14 value = click.STRING(value, param, ctx).lower()
15
16 if value == "adhoc":
17 try:
18 import cryptography # noqa: F401
19 except ImportError:
20 raise click.BadParameter(
21 "Using ad-hoc certificates requires the cryptography library.",
22 ctx,
23 param,
24 ) from None
25
26 return value
27
28 obj = import_string(value, silent=True)
29
30 if isinstance(obj, ssl.SSLContext):
31 return obj
32
33 raise
Path 2: 2 calls (0.18)
'adhoc' (2)
Option (2)
Context (2)
'adhoc' (2)
BadParameter (2)
1def convert(self, value, param, ctx):
2 try:
3 import ssl
4 except ImportError:
5 raise click.BadParameter(
6 'Using "--cert" requires Python to be compiled with SSL support.',
7 ctx,
8 param,
9 ) from None
10
11 try:
12 return self.path_type(value, param, ctx)
13 except click.BadParameter:
14 value = click.STRING(value, param, ctx).lower()
15
16 if value == "adhoc":
17 try:
18 import cryptography # noqa: F401
19 except ImportError:
20 raise click.BadParameter(
21 "Using ad-hoc certificates requires the cryptography library.",
22 ctx,
23 param,
24 ) from None
25
26 return value
27
28 obj = import_string(value, silent=True)
29
30 if isinstance(obj, ssl.SSLContext):
31 return obj
32
33 raise
Path 3: 2 calls (0.18)
'not_here' (1) 'flask' (1)
Option (2)
Context (2)
BadParameter (2)
1def convert(self, value, param, ctx):
2 try:
3 import ssl
4 except ImportError:
5 raise click.BadParameter(
6 'Using "--cert" requires Python to be compiled with SSL support.',
7 ctx,
8 param,
9 ) from None
10
11 try:
12 return self.path_type(value, param, ctx)
13 except click.BadParameter:
14 value = click.STRING(value, param, ctx).lower()
15
16 if value == "adhoc":
17 try:
18 import cryptography # noqa: F401
19 except ImportError:
20 raise click.BadParameter(
21 "Using ad-hoc certificates requires the cryptography library.",
22 ctx,
23 param,
24 ) from None
25
26 return value
27
28 obj = import_string(value, silent=True)
29
30 if isinstance(obj, ssl.SSLContext):
31 return obj
32
33 raise
Path 4: 2 calls (0.18)
'ssl_context' (2)
Option (2)
Context (2)
SSLContext (2)
BadParameter (2)
1def convert(self, value, param, ctx):
2 try:
3 import ssl
4 except ImportError:
5 raise click.BadParameter(
6 'Using "--cert" requires Python to be compiled with SSL support.',
7 ctx,
8 param,
9 ) from None
10
11 try:
12 return self.path_type(value, param, ctx)
13 except click.BadParameter:
14 value = click.STRING(value, param, ctx).lower()
15
16 if value == "adhoc":
17 try:
18 import cryptography # noqa: F401
19 except ImportError:
20 raise click.BadParameter(
21 "Using ad-hoc certificates requires the cryptography library.",
22 ctx,
23 param,
24 ) from None
25
26 return value
27
28 obj = import_string(value, silent=True)
29
30 if isinstance(obj, ssl.SSLContext):
31 return obj
32
33 raise
Path 5: 1 calls (0.09)
'adhoc' (1)
Option (1)
Context (1)
BadParameter (1)
1def convert(self, value, param, ctx):
2 try:
3 import ssl
4 except ImportError:
5 raise click.BadParameter(
6 'Using "--cert" requires Python to be compiled with SSL support.',
7 ctx,
8 param,
9 ) from None
10
11 try:
12 return self.path_type(value, param, ctx)
13 except click.BadParameter:
14 value = click.STRING(value, param, ctx).lower()
15
16 if value == "adhoc":
17 try:
18 import cryptography # noqa: F401
19 except ImportError:
20 raise click.BadParameter(
21 "Using ad-hoc certificates requires the cryptography library.",
22 ctx,
23 param,
24 ) from None
25
26 return value
27
28 obj = import_string(value, silent=True)
29
30 if isinstance(obj, ssl.SSLContext):
31 return obj
32
33 raise
Path 6: 1 calls (0.09)
'not_here' (1)
Option (1)
Context (1)
BadParameter (1)
1def convert(self, value, param, ctx):
2 try:
3 import ssl
4 except ImportError:
5 raise click.BadParameter(
6 'Using "--cert" requires Python to be compiled with SSL support.',
7 ctx,
8 param,
9 ) from None
10
11 try:
12 return self.path_type(value, param, ctx)
13 except click.BadParameter:
14 value = click.STRING(value, param, ctx).lower()
15
16 if value == "adhoc":
17 try:
18 import cryptography # noqa: F401
19 except ImportError:
20 raise click.BadParameter(
21 "Using ad-hoc certificates requires the cryptography library.",
22 ctx,
23 param,
24 ) from None
25
26 return value
27
28 obj = import_string(value, silent=True)
29
30 if isinstance(obj, ssl.SSLContext):
31 return obj
32
33 raise