Skip to content

Commit b5f9af5

Browse files
dangillethugovk
andauthored
Apply suggestions from code review
Improve import times Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 9627694 commit b5f9af5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/humanize/i18n.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
from __future__ import annotations
44

55
import gettext as gettext_module
6-
import importlib.resources
7-
import os
8-
import pathlib
96
from threading import local
7+
from typing import TYPE_CHECKING
8+
9+
if TYPE_CHECKING:
10+
import os
11+
import pathlib
1012

1113
__all__ = ["activate", "deactivate", "decimal_separator", "thousands_separator"]
1214

@@ -39,6 +41,8 @@ def _get_default_locale_path() -> pathlib.Path | None:
3941
if not package:
4042
return None
4143

44+
import importlib.resources
45+
4246
with importlib.resources.as_file(importlib.resources.files(package)) as pkg:
4347
return pkg / "locale"
4448

0 commit comments

Comments
 (0)