Skip to content

Commit 31d3c99

Browse files
committed
add some type annotations
1 parent 595aa6d commit 31d3c99

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

babelizer/errors.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
"""Exceptions raised by the *babelizer*."""
22

3+
from __future__ import annotations
4+
35

46
class BabelizeError(Exception):
57
"""An exception that the babelizer can handle and show to the user."""
68

7-
def __init__(self, message):
9+
def __init__(self, message: str):
810
self._message = message
911

10-
def __str__(self):
12+
def __str__(self) -> str:
1113
"""Render a user-readable error message."""
1214
return self._message
1315

babelizer/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"""Utility functions used by the babelizer."""
22

3+
from __future__ import annotations
4+
35
import pathlib
46
import subprocess
57
import sys
8+
from collections.abc import Iterator
69
from contextlib import contextmanager
710
from contextlib import suppress
811

@@ -36,7 +39,7 @@ def setup_py(*args):
3639
return [sys.executable, "setup.py"] + list(args)
3740

3841

39-
def get_setup_py_version():
42+
def get_setup_py_version() -> str | None:
4043
"""Get babelized package version.
4144
4245
Returns
@@ -64,7 +67,7 @@ def get_setup_py_version():
6467

6568

6669
@contextmanager
67-
def save_files(files):
70+
def save_files(files: Iterator[str]):
6871
"""Generate repository files through a context.
6972
7073
Parameters

0 commit comments

Comments
 (0)