File tree 2 files changed +23
-2
lines changed 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change
1
+ """Internal type annotations.
2
+
3
+ Notes
4
+ -----
5
+ :class:`StrPath` and :class:`StrOrBytesPath` is based on `typeshed's`_.
6
+
7
+ .. _typeshed's: https://github.com/python/typeshed/blob/5ff32f3/stdlib/_typeshed/__init__.pyi#L176-L179
8
+ """ # E501
9
+
10
+ from __future__ import annotations
11
+
12
+ import typing as t
13
+
14
+ if t .TYPE_CHECKING :
15
+ from os import PathLike
16
+
17
+ from typing_extensions import TypeAlias
18
+
19
+ StrPath : TypeAlias = "str | PathLike[str]"
Original file line number Diff line number Diff line change 34
34
import sys
35
35
import types
36
36
37
+ from libtmux ._internal .types import StrPath
37
38
from libtmux .common import tmux_cmd
38
39
39
40
if sys .version_info >= (3 , 11 ):
@@ -587,7 +588,7 @@ def new_window(
587
588
self ,
588
589
window_name : str | None = None ,
589
590
* ,
590
- start_directory : str | None = None ,
591
+ start_directory : StrPath | None = None ,
591
592
attach : bool = False ,
592
593
window_index : str = "" ,
593
594
window_shell : str | None = None ,
@@ -677,7 +678,8 @@ def new_window(
677
678
678
679
window_args += ("-P" ,)
679
680
680
- if start_directory is not None :
681
+ # Catch empty string and default (`None`)
682
+ if start_directory and isinstance (start_directory , str ):
681
683
# as of 2014-02-08 tmux 1.9-dev doesn't expand ~ in new-window -c.
682
684
start_directory = pathlib .Path (start_directory ).expanduser ()
683
685
window_args += (f"-c{ start_directory } " ,)
You can’t perform that action at this time.
0 commit comments