Skip to content

Commit 93b1cdc

Browse files
committed
Add type annotations
1 parent dac3dd7 commit 93b1cdc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bpython/config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,35 @@ class Struct:
4747
to and use for various arbitrary things."""
4848

4949

50-
def getpreferredencoding():
50+
def getpreferredencoding() -> str:
5151
"""Get the user's preferred encoding."""
5252
return locale.getpreferredencoding() or sys.getdefaultencoding()
5353

5454

55-
def can_encode(c):
55+
def can_encode(c: str) -> bool:
5656
try:
5757
c.encode(getpreferredencoding())
5858
return True
5959
except UnicodeEncodeError:
6060
return False
6161

6262

63-
def supports_box_chars():
63+
def supports_box_chars() -> bool:
6464
"""Check if the encoding supports Unicode box characters."""
6565
return all(map(can_encode, "│─└┘┌┐"))
6666

6767

68-
def get_config_home():
68+
def get_config_home() -> Path:
6969
"""Returns the base directory for bpython's configuration files."""
7070
return Path(BaseDirectory.xdg_config_home) / "bpython"
7171

7272

73-
def default_config_path():
73+
def default_config_path() -> Path:
7474
"""Returns bpython's default configuration file path."""
7575
return get_config_home() / "config"
7676

7777

78-
def default_editor():
78+
def default_editor() -> str:
7979
"""Returns the default editor."""
8080
return os.environ.get("VISUAL", os.environ.get("EDITOR", "vi"))
8181

0 commit comments

Comments
 (0)