File tree 2 files changed +7
-9
lines changed
Filter options
2 files changed +7
-9
lines changed
Original file line number Diff line number Diff line change @@ -27,10 +27,10 @@ def _object_name(obj):
27
27
return type (obj ).__qualname__
28
28
29
29
def _normalize (name ):
30
- """ Normalize 'name' in NKFC form """
30
+ """Normalize 'name' to NKFC form. """
31
31
global _unicodedata_normalize
32
32
if _unicodedata_normalize is None :
33
- from unicodedata import _normalize
33
+ from unicodedata import normalize as _unicodedata_normalize
34
34
return _unicodedata_normalize ('NFKC' , name )
35
35
36
36
# Bootstrap-related code ######################################################
@@ -43,7 +43,7 @@ def _normalize(name):
43
43
# Import done by _install_external_importers()
44
44
_bootstrap_external = None
45
45
46
- # Import done as needed by _normalize
46
+ # Import done lazily as needed by _normalize as unicodedata is not built-in.
47
47
_unicodedata_normalize = None
48
48
49
49
def _wrap (new , old ):
Original file line number Diff line number Diff line change @@ -1591,8 +1591,8 @@ def __init__(self, path, *loader_details):
1591
1591
else :
1592
1592
self .path = _path_abspath (path )
1593
1593
self ._path_mtime = - 1
1594
- self ._path_cache = dict ()
1595
- self ._relaxed_path_cache = dict ()
1594
+ self ._path_cache = {}
1595
+ self ._relaxed_path_cache = {}
1596
1596
self ._cache_is_normalized = False
1597
1597
1598
1598
def invalidate_caches (self ):
@@ -1686,7 +1686,7 @@ def _fill_cache(self):
1686
1686
# so it's done once instead of for every import. This is safe as
1687
1687
# the specified suffixes to check against are always specified in a
1688
1688
# case-sensitive manner.
1689
- lower_suffix_contents = dict ()
1689
+ lower_suffix_contents = {}
1690
1690
for item in contents :
1691
1691
name , dot , suffix = item .partition ('.' )
1692
1692
if dot :
@@ -1701,9 +1701,7 @@ def _fill_cache(self):
1701
1701
self ._cache_is_normalized = False
1702
1702
1703
1703
def _normalize_cache (self ):
1704
- """
1705
- Normalize all entries in the caches to NFKC.
1706
- """
1704
+ """Normalize all entries in the caches to NFKC."""
1707
1705
from unicodedata import normalize
1708
1706
1709
1707
self ._path_cache = { normalize ('NFKC' , p ): p for p in self ._path_cache }
You can’t perform that action at this time.
0 commit comments