Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Improve import times

Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
dangillet and hugovk authored Oct 2, 2024
1 parent 9627694 commit b5f9af5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/humanize/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
from __future__ import annotations

import gettext as gettext_module
import importlib.resources
import os
import pathlib
from threading import local
from typing import TYPE_CHECKING

if TYPE_CHECKING:
import os
import pathlib

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

Expand Down Expand Up @@ -39,6 +41,8 @@ def _get_default_locale_path() -> pathlib.Path | None:
if not package:
return None

import importlib.resources

with importlib.resources.as_file(importlib.resources.files(package)) as pkg:
return pkg / "locale"

Expand Down

0 comments on commit b5f9af5

Please sign in to comment.