Skip to content

Commit 75719df

Browse files
committed
shell: Note pydocstyle updates
1 parent a641f20 commit 75719df

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/tmuxp/shell.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@
2525
]
2626

2727
class LaunchOptionalImports(TypedDict):
28+
"""tmuxp shell optional imports."""
29+
2830
server: NotRequired["Server"]
2931
session: NotRequired["Session"]
3032
window: NotRequired["Window"]
3133
pane: NotRequired["Pane"]
3234

3335
class LaunchImports(t.TypedDict):
36+
"""tmuxp shell launch import mapping."""
37+
3438
libtmux: ModuleType
3539
Server: t.Type[Server]
3640
Session: t.Type[Session]
@@ -43,6 +47,7 @@ class LaunchImports(t.TypedDict):
4347

4448

4549
def has_ipython() -> bool:
50+
"""Return True if ipython is installed."""
4651
try:
4752
from IPython import start_ipython # NOQA F841
4853
except ImportError:
@@ -55,6 +60,7 @@ def has_ipython() -> bool:
5560

5661

5762
def has_ptpython() -> bool:
63+
"""Return True if ptpython is installed."""
5864
try:
5965
from ptpython.repl import embed, run_config # F841
6066
except ImportError:
@@ -67,6 +73,7 @@ def has_ptpython() -> bool:
6773

6874

6975
def has_ptipython() -> bool:
76+
"""Return True if ptpython + ipython are both installed."""
7077
try:
7178
from ptpython.ipython import embed # F841
7279
from ptpython.repl import run_config # F841
@@ -81,6 +88,7 @@ def has_ptipython() -> bool:
8188

8289

8390
def has_bpython() -> bool:
91+
"""Return True if bpython is installed."""
8492
try:
8593
from bpython import embed # NOQA F841
8694
except ImportError:
@@ -89,6 +97,7 @@ def has_bpython() -> bool:
8997

9098

9199
def detect_best_shell() -> "CLIShellLiteral":
100+
"""Return the best, most feature-rich shell available."""
92101
if has_ptipython():
93102
return "ptipython"
94103
elif has_ptpython():
@@ -103,6 +112,7 @@ def detect_best_shell() -> "CLIShellLiteral":
103112
def get_bpython(
104113
options: "LaunchOptionalImports", extra_args: t.Optional[t.Dict[str, t.Any]] = None
105114
) -> t.Callable[[], None]:
115+
"""Return bpython shell."""
106116
if extra_args is None:
107117
extra_args = {}
108118

@@ -119,13 +129,15 @@ def launch_bpython() -> None:
119129

120130

121131
def get_ipython_arguments() -> t.List[str]:
132+
"""Return ipython shell args via ``IPYTHON_ARGUMENTS`` environment variables."""
122133
ipython_args = "IPYTHON_ARGUMENTS"
123134
return os.environ.get(ipython_args, "").split()
124135

125136

126137
def get_ipython(
127138
options: "LaunchOptionalImports", **extra_args: t.Dict[str, t.Any]
128139
) -> t.Any:
140+
"""Return ipython shell."""
129141
try:
130142
from IPython import start_ipython
131143

@@ -151,6 +163,7 @@ def launch_ipython() -> None:
151163

152164

153165
def get_ptpython(options: "LaunchOptionalImports", vi_mode: bool = False) -> t.Any:
166+
"""Return ptpython shell."""
154167
try:
155168
from ptpython.repl import embed, run_config
156169
except ImportError:
@@ -196,6 +209,7 @@ def launch_ptipython() -> None:
196209

197210

198211
def get_launch_args(**kwargs: "Unpack[LaunchOptionalImports]") -> "LaunchImports":
212+
"""Return tmuxp shell launch arguments, counting for overrides."""
199213
import libtmux
200214
from libtmux.pane import Pane
201215
from libtmux.server import Server
@@ -216,6 +230,7 @@ def get_launch_args(**kwargs: "Unpack[LaunchOptionalImports]") -> "LaunchImports
216230

217231

218232
def get_code(use_pythonrc: bool, imported_objects: "LaunchImports") -> t.Any:
233+
"""Launch basic python shell via :mod:`code`."""
219234
import code
220235

221236
try:
@@ -274,6 +289,7 @@ def launch(
274289
use_vi_mode: bool = False,
275290
**kwargs: "Unpack[LaunchOptionalImports]",
276291
) -> None:
292+
"""Launch interactive libtmux shell for tmuxp shell."""
277293
# Also allowing passing shell='code' to force using code.interact
278294
imported_objects = get_launch_args(**kwargs)
279295

0 commit comments

Comments
 (0)