byceps.cli.commands.shell   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 29
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A shell() 0 10 1
1
"""
2
byceps.cli.command.shell
3
~~~~~~~~~~~~~~~~~~~~~~~~
4
5
Run an interactive Python shell in the context of the BYCEPS application.
6
7
:Copyright: 2014-2024 Jochen Kupperschmidt
8
:License: Revised BSD (see `LICENSE` file for details)
9
"""
10
11
from platform import python_version
12
13
import bpython
14
import click
15
from flask import current_app
16
from flask.cli import with_appcontext
17
18
19
@click.command()
20
@with_appcontext
21
def shell() -> None:
22
    """Run interactive Python shell."""
23
    ctx = current_app.make_shell_context()
24
    banner = (
25
        f'Welcome to the interactive BYCEPS shell on Python {python_version()}!'
26
    )
27
28
    bpython.embed(locals_=ctx, banner=banner)
29