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
d958ea70
Kaydet (Commit)
d958ea70
authored
Ock 13, 2011
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 10899: Remove function type annotations from the stdlib
üst
cbb80896
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
_bootstrap.py
Lib/importlib/_bootstrap.py
+3
-3
abc.py
Lib/importlib/abc.py
+21
-15
No files found.
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
d958ea70
...
...
@@ -346,8 +346,8 @@ class _LoaderBasics:
class
SourceLoader
(
_LoaderBasics
):
def
path_mtime
(
self
,
path
):
"""Optional method that returns the modification time
for the specified
path
.
"""Optional method that returns the modification time
(an int) for the
specified path, where path is a str
.
Implementing this method allows the loader to read bytecode files.
...
...
@@ -355,7 +355,7 @@ class SourceLoader(_LoaderBasics):
raise
NotImplementedError
def
set_data
(
self
,
path
,
data
):
"""Optional method which writes data
to a file path
.
"""Optional method which writes data
(bytes) to a file path (a str)
.
Implementing this method allows for the writing of bytecode files.
...
...
Lib/importlib/abc.py
Dosyayı görüntüle @
d958ea70
...
...
@@ -19,7 +19,8 @@ class Loader(metaclass=abc.ABCMeta):
@abc.abstractmethod
def
load_module
(
self
,
fullname
):
"""Abstract method which when implemented should load a module."""
"""Abstract method which when implemented should load a module.
The fullname is a str."""
raise
NotImplementedError
...
...
@@ -29,7 +30,10 @@ class Finder(metaclass=abc.ABCMeta):
@abc.abstractmethod
def
find_module
(
self
,
fullname
,
path
=
None
):
"""Abstract method which when implemented should find a module."""
"""Abstract method which when implemented should find a module.
The fullname is a str and the optional path is a str or None.
Returns a Loader object.
"""
raise
NotImplementedError
Finder
.
register
(
machinery
.
BuiltinImporter
)
...
...
@@ -49,7 +53,7 @@ class ResourceLoader(Loader):
@abc.abstractmethod
def
get_data
(
self
,
path
):
"""Abstract method which when implemented should return the bytes for
the specified path."""
the specified path.
The path must be a str.
"""
raise
NotImplementedError
...
...
@@ -65,19 +69,19 @@ class InspectLoader(Loader):
@abc.abstractmethod
def
is_package
(
self
,
fullname
):
"""Abstract method which when implemented should return whether the
module is a package."""
module is a package.
The fullname is a str. Returns a bool.
"""
raise
NotImplementedError
@abc.abstractmethod
def
get_code
(
self
,
fullname
):
"""Abstract method which when implemented should return the code object
for the module"""
for the module
. The fullname is a str. Returns a types.CodeType.
"""
raise
NotImplementedError
@abc.abstractmethod
def
get_source
(
self
,
fullname
):
"""Abstract method which should return the source code for the
module."""
module.
The fullname is a str. Returns a str.
"""
raise
NotImplementedError
InspectLoader
.
register
(
machinery
.
BuiltinImporter
)
...
...
@@ -118,12 +122,14 @@ class SourceLoader(_bootstrap.SourceLoader, ResourceLoader, ExecutionLoader):
"""
def
path_mtime
(
self
,
path
):
"""Return the
modification time for the path
."""
"""Return the
(int) modification time for the path (str)
."""
raise
NotImplementedError
def
set_data
(
self
,
path
,
data
):
"""Write the bytes to the path (if possible).
Accepts a str path and data as bytes.
Any needed intermediary directories are to be created. If for some
reason the file cannot be written because of permissions, fail
silently.
...
...
@@ -171,8 +177,8 @@ class PyLoader(SourceLoader):
@abc.abstractmethod
def
source_path
(
self
,
fullname
):
"""Abstract method
which when implemented should return the path to the
source code for the module."""
"""Abstract method
. Accepts a str module name and returns the path to
the
source code for the module."""
raise
NotImplementedError
def
get_filename
(
self
,
fullname
):
...
...
@@ -280,19 +286,19 @@ class PyPycLoader(PyLoader):
@abc.abstractmethod
def
source_mtime
(
self
,
fullname
):
"""Abstract method
which when implemented should return the
"""Abstract method
. Accepts a str filename and returns an int
modification time for the source of the module."""
raise
NotImplementedError
@abc.abstractmethod
def
bytecode_path
(
self
,
fullname
):
"""Abstract method
which when implemented should return the path to th
e
bytecode for the module."""
"""Abstract method
. Accepts a str filename and returns the str pathnam
e
to the
bytecode for the module."""
raise
NotImplementedError
@abc.abstractmethod
def
write_bytecode
(
self
,
fullname
,
bytecode
):
"""Abstract method
which when implemented should attempt to write the
bytecode for the module, returning a boolean representing whether the
bytecode was written or not."""
"""Abstract method
. Accepts a str filename and bytes object
representing the bytecode for the module. Returns a boolean
representing whether the
bytecode was written or not."""
raise
NotImplementedError
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