summaryrefslogtreecommitdiffstats
path: root/ptpython/entry_points
diff options
context:
space:
mode:
Diffstat (limited to 'ptpython/entry_points')
-rw-r--r--ptpython/entry_points/run_ptipython.py4
-rw-r--r--ptpython/entry_points/run_ptpython.py6
2 files changed, 7 insertions, 3 deletions
diff --git a/ptpython/entry_points/run_ptipython.py b/ptpython/entry_points/run_ptipython.py
index 21d7063..b660a0a 100644
--- a/ptpython/entry_points/run_ptipython.py
+++ b/ptpython/entry_points/run_ptipython.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python
+from __future__ import annotations
+
import os
import sys
@@ -58,7 +60,7 @@ def run(user_ns=None):
code = compile(f.read(), path, "exec")
exec(code, user_ns, user_ns)
else:
- print("File not found: {}\n\n".format(path))
+ print(f"File not found: {path}\n\n")
sys.exit(1)
# Apply config file
diff --git a/ptpython/entry_points/run_ptpython.py b/ptpython/entry_points/run_ptpython.py
index edffa44..1b4074d 100644
--- a/ptpython/entry_points/run_ptpython.py
+++ b/ptpython/entry_points/run_ptpython.py
@@ -21,6 +21,8 @@ environment variables:
PTPYTHON_CONFIG_HOME: a configuration directory to use
PYTHONSTARTUP: file executed on interactive startup (no default)
"""
+from __future__ import annotations
+
import argparse
import os
import pathlib
@@ -44,7 +46,7 @@ __all__ = ["create_parser", "get_config_and_history_file", "run"]
class _Parser(argparse.ArgumentParser):
- def print_help(self, file: Optional[IO[str]] = None) -> None:
+ def print_help(self, file: IO[str] | None = None) -> None:
super().print_help()
print(
dedent(
@@ -90,7 +92,7 @@ def create_parser() -> _Parser:
return parser
-def get_config_and_history_file(namespace: argparse.Namespace) -> Tuple[str, str]:
+def get_config_and_history_file(namespace: argparse.Namespace) -> tuple[str, str]:
"""
Check which config/history files to use, ensure that the directories for
these files exist, and return the config and history path.