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
dd6eefb3
Kaydet (Commit)
dd6eefb3
authored
Tem 18, 2000
tarafından
Greg Stein
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
no changes other than indentation level (now 4) and comment reflow.
use "cvs diff -b" to verify.
üst
9542f48f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
30 deletions
+39
-30
importers.py
Demo/imputil/importers.py
+3
-3
httplib.py
Lib/httplib.py
+18
-14
imputil.py
Lib/imputil.py
+18
-13
No files found.
Demo/imputil/importers.py
Dosyayı görüntüle @
dd6eefb3
...
...
@@ -90,7 +90,7 @@ def _fs_import(dir, modname, fqname):
# Simple function-based importer
#
class
FuncImporter
(
imputil
.
Importer
):
"Importer subclass to use a supplied
function rather than method overrides."
"Importer subclass to delegate to a
function rather than method overrides."
def
__init__
(
self
,
func
):
self
.
func
=
func
def
get_code
(
self
,
parent
,
modname
,
fqname
):
...
...
@@ -122,8 +122,8 @@ class PackageArchiveImporter(imputil.Importer):
# under the top level module (package / archive).
assert
parent
.
__importer__
==
self
# if a parent "package" is provided, then we are importing a sub-file
#
from the archive.
# if a parent "package" is provided, then we are importing a
# sub-file
from the archive.
result
=
self
.
get_subfile
(
parent
.
__archive__
,
modname
)
if
result
is
None
:
return
None
...
...
Lib/httplib.py
Dosyayı görüntüle @
dd6eefb3
...
...
@@ -106,7 +106,7 @@ class HTTPResponse:
self
.
chunked
=
_UNKNOWN
# is "chunked" being used?
self
.
chunk_left
=
_UNKNOWN
# bytes left to read in current chunk
self
.
length
=
_UNKNOWN
# number of bytes left in response
self
.
will_close
=
_UNKNOWN
# connectio
n will close at end of response
self
.
will_close
=
_UNKNOWN
# con
n will close at end of response
def
begin
(
self
):
if
self
.
msg
is
not
None
:
...
...
@@ -291,7 +291,8 @@ class HTTPResponse:
by a signal (resulting in a partial read).
Note that we cannot distinguish between EOF and an interrupt when zero
bytes have been read. IncompleteRead() will be raised in this situation.
bytes have been read. IncompleteRead() will be raised in this
situation.
This function should be used when <amt> bytes "should" be present for
reading. If the bytes are truly not available (due to EOF), then the
...
...
@@ -397,8 +398,8 @@ class HTTPConnection:
# if there is no prior response, then we can request at will.
#
# if point (2) is true, then we will have passed the socket to the
# response (effectively meaning, "there is no prior response"), and will
#
open a new one when a new request is made.
# response (effectively meaning, "there is no prior response"), and
# will
open a new one when a new request is made.
#
# Note: if a prior response exists, then we *can* start a new request.
# We are not allowed to begin fetching the response to this new
...
...
@@ -434,10 +435,10 @@ class HTTPConnection:
self
.
putheader
(
'Host'
,
self
.
host
)
# note: we are assuming that clients will not attempt to set these
# headers since *this* library must deal with the consequences.
# this also means that when the supporting libraries are
# updated to recognize other forms, then this code should be
#
changed (removed or updated).
# headers since *this* library must deal with the
# consequences. this also means that when the supporting
# libraries are updated to recognize other forms, then this
# code should be
changed (removed or updated).
# we only want a Content-Encoding of "identity" since we don't
# support encodings such as x-gzip or x-deflate.
...
...
@@ -513,14 +514,15 @@ class HTTPConnection:
# behavior)
#
# note: if a prior response existed, but was connection-close, then the
# socket and response were made independent of this HTTPConnection object
# since a new request requires that we open a whole new connection
# socket and response were made independent of this HTTPConnection
# object since a new request requires that we open a whole new
# connection
#
# this means the prior response had one of two states:
# 1) will_close: this connection was reset and the prior socket and
# response operate independently
# 2) persistent: the response was retained and we await its isclosed()
#
status to become true.
# 2) persistent: the response was retained and we await its
# isclosed()
status to become true.
#
if
self
.
__state
!=
_CS_REQ_SENT
or
self
.
__response
:
raise
ResponseNotReady
()
...
...
@@ -641,7 +643,8 @@ class HTTP(HTTPConnection):
def
putheader
(
self
,
header
,
*
values
):
"The superclass allows only one value argument."
HTTPConnection
.
putheader
(
self
,
header
,
string
.
joinfields
(
values
,
'
\r\n\t
'
))
HTTPConnection
.
putheader
(
self
,
header
,
string
.
joinfields
(
values
,
'
\r\n\t
'
))
def
getreply
(
self
):
"""Compat definition since superclass does not define it.
...
...
@@ -677,7 +680,8 @@ class HTTP(HTTPConnection):
# note that self.file == response.fp, which gets closed by the
# superclass. just clear the object ref here.
### hmm. messy. if status==-1, then self.file is owned by us.
### well... we aren't explicitly closing, but losing this ref will do it
### well... we aren't explicitly closing, but losing this ref will
### do it
self
.
file
=
None
...
...
Lib/imputil.py
Dosyayı görüntüle @
dd6eefb3
...
...
@@ -61,7 +61,8 @@ class ImportManager:
# .py files (or a .py file's cached bytecode)
for
desc
in
imp
.
get_suffixes
():
if
desc
[
2
]
==
imp
.
C_EXTENSION
:
self
.
add_suffix
(
desc
[
0
],
DynLoadSuffixImporter
(
desc
)
.
import_file
)
self
.
add_suffix
(
desc
[
0
],
DynLoadSuffixImporter
(
desc
)
.
import_file
)
self
.
add_suffix
(
'.py'
,
py_suffix_importer
)
def
_import_hook
(
self
,
fqname
,
globals
=
None
,
locals
=
None
,
fromlist
=
None
):
...
...
@@ -95,8 +96,8 @@ class ImportManager:
return
top_module
if
not
top_module
.
__dict__
.
get
(
'__ispkg__'
):
# __ispkg__ isn't defined (the module was not imported by us), or
#
it is zero.
# __ispkg__ isn't defined (the module was not imported by us),
# or
it is zero.
#
# In the former case, there is no way that we could import
# sub-modules that occur in the fromlist (but we can't raise an
...
...
@@ -107,16 +108,17 @@ class ImportManager:
# modules present, so we can just return.
#
# In both cases, since len(parts) == 1, the top_module is also
# the "bottom" which is the defined return when a fromlist exists.
# the "bottom" which is the defined return when a fromlist
# exists.
return
top_module
importer
=
top_module
.
__dict__
.
get
(
'__importer__'
)
if
importer
:
return
importer
.
_finish_import
(
top_module
,
parts
[
1
:],
fromlist
)
# If the importer does not exist, then we have to bail. A missing importer
# means that something else imported the module, and we have no knowledg
e
#
of how to get sub-modules out of the thing.
# If the importer does not exist, then we have to bail. A missing
# importer means that something else imported the module, and we hav
e
# no knowledge
of how to get sub-modules out of the thing.
raise
ImportError
,
'No module named '
+
fqname
def
_determine_import_context
(
self
,
globals
):
...
...
@@ -216,7 +218,8 @@ class Importer:
# since we imported/handled the bottom module, this means that we can
# also handle its fromlist (and reliably use __ispkg__).
# if the bottom node is a package, then (potentially) import some modules.
# if the bottom node is a package, then (potentially) import some
# modules.
#
# note: if it is not a package, then "fromlist" refers to names in
# the bottom module rather than modules.
...
...
@@ -294,10 +297,11 @@ class Importer:
def
_import_fromlist
(
self
,
package
,
fromlist
):
'Import any sub-modules in the "from" list.'
# if '*' is present in the fromlist, then look for the '__all__' variable
#
to find additional items (modules) to import.
# if '*' is present in the fromlist, then look for the '__all__'
# variable
to find additional items (modules) to import.
if
'*'
in
fromlist
:
fromlist
=
list
(
fromlist
)
+
list
(
package
.
__dict__
.
get
(
'__all__'
,
[]))
fromlist
=
list
(
fromlist
)
+
\
list
(
package
.
__dict__
.
get
(
'__all__'
,
[]))
for
sub
in
fromlist
:
# if the name is already present, then don't try to import it (it
...
...
@@ -335,8 +339,9 @@ class Importer:
modname specifies a single module (not dotted) within the parent.
fqname specifies the fully-qualified module name. This is a (potentially)
dotted name from the "root" of the module namespace down to the modname.
fqname specifies the fully-qualified module name. This is a
(potentially) dotted name from the "root" of the module namespace
down to the modname.
If there is no parent, then modname==fqname.
This method should return None, or a 3-tuple.
...
...
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