Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f410ce8c
Kaydet (Commit)
f410ce8c
authored
Agu 10, 2012
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #15502: Refactor some code.
üst
e9175bd0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
15 deletions
+17
-15
_bootstrap.py
Lib/importlib/_bootstrap.py
+16
-11
abc.py
Lib/importlib/abc.py
+1
-4
importlib.h
Python/importlib.h
+0
-0
No files found.
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
f410ce8c
...
@@ -607,6 +607,21 @@ def _requires_frozen(fxn):
...
@@ -607,6 +607,21 @@ def _requires_frozen(fxn):
return
_requires_frozen_wrapper
return
_requires_frozen_wrapper
def
_find_module_shim
(
self
,
fullname
):
"""Try to find a loader for the specified module by delegating to
self.find_loader()."""
# Call find_loader(). If it returns a string (indicating this
# is a namespace package portion), generate a warning and
# return None.
loader
,
portions
=
self
.
find_loader
(
fullname
)
if
loader
is
None
and
len
(
portions
):
msg
=
"Not importing directory {}: missing __init__"
_warnings
.
warn
(
msg
.
format
(
portions
[
0
]),
ImportWarning
)
return
loader
# Loaders #####################################################################
# Loaders #####################################################################
class
BuiltinImporter
:
class
BuiltinImporter
:
...
@@ -1305,17 +1320,7 @@ class FileFinder:
...
@@ -1305,17 +1320,7 @@ class FileFinder:
"""Invalidate the directory mtime."""
"""Invalidate the directory mtime."""
self
.
_path_mtime
=
-
1
self
.
_path_mtime
=
-
1
def
find_module
(
self
,
fullname
):
find_module
=
_find_module_shim
"""Try to find a loader for the specified module."""
# Call find_loader(). If it returns a string (indicating this
# is a namespace package portion), generate a warning and
# return None.
loader
,
portions
=
self
.
find_loader
(
fullname
)
assert
len
(
portions
)
in
[
0
,
1
]
if
loader
is
None
and
len
(
portions
):
msg
=
"Not importing directory {}: missing __init__"
_warnings
.
warn
(
msg
.
format
(
portions
[
0
]),
ImportWarning
)
return
loader
def
find_loader
(
self
,
fullname
):
def
find_loader
(
self
,
fullname
):
"""Try to find a loader for the specified module, or the namespace
"""Try to find a loader for the specified module, or the namespace
...
...
Lib/importlib/abc.py
Dosyayı görüntüle @
f410ce8c
...
@@ -78,10 +78,7 @@ class PathEntryFinder(Finder):
...
@@ -78,10 +78,7 @@ class PathEntryFinder(Finder):
"""
"""
raise
NotImplementedError
raise
NotImplementedError
def
find_module
(
self
,
fullname
):
find_module
=
_bootstrap
.
_find_module_shim
"""Compatibility function which is the equivalent of
self.find_loader(fullname)[0]."""
return
self
.
find_loader
(
fullname
)[
0
]
def
invalidate_caches
(
self
):
def
invalidate_caches
(
self
):
"""An optional method for clearing the finder's cache, if any.
"""An optional method for clearing the finder's cache, if any.
...
...
Python/importlib.h
Dosyayı görüntüle @
f410ce8c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment