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
aaebe1c1
Kaydet (Commit)
aaebe1c1
authored
Eki 15, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use bytes throughout telnetlib docs
üst
3de7fb86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
32 deletions
+33
-32
telnetlib.rst
Doc/library/telnetlib.rst
+33
-32
No files found.
Doc/library/telnetlib.rst
Dosyayı görüntüle @
aaebe1c1
...
@@ -62,58 +62,58 @@ Telnet Objects
...
@@ -62,58 +62,58 @@ Telnet Objects
.. method:: Telnet.read_until(expected[, timeout])
.. method:: Telnet.read_until(expected[, timeout])
Read until a given
string, *expected*, is encountered or until *timeout* seconds
Read until a given
byte string, *expected*, is encountered or until *timeout*
have passed.
seconds
have passed.
When no match is found, return whatever is available instead, possibly
the
empty
When no match is found, return whatever is available instead, possibly empty
string. Raise :exc:`EOFError` if the connection is closed and no cooked data is
bytes. Raise :exc:`EOFError` if the connection is closed and no cooked data
available.
is
available.
.. method:: Telnet.read_all()
.. method:: Telnet.read_all()
Read all data until EOF; block until connection closed.
Read all data until EOF
as bytes
; block until connection closed.
.. method:: Telnet.read_some()
.. method:: Telnet.read_some()
Read at least one byte of cooked data unless EOF is hit. Return ``
''`` if EOF is
Read at least one byte of cooked data unless EOF is hit. Return ``
b''`` if
hit. Block if no data is immediately available.
EOF is
hit. Block if no data is immediately available.
.. method:: Telnet.read_very_eager()
.. method:: Telnet.read_very_eager()
Read everything that can be without blocking in I/O (eager).
Read everything that can be without blocking in I/O (eager).
Raise :exc:`EOFError` if connection closed and no cooked data available.
Return
Raise :exc:`EOFError` if connection closed and no cooked data available.
``''`` if no cooked data available otherwise. Do not block unless in the midst
Return ``b''`` if no cooked data available otherwise. Do not block unless in
of an IAC sequence.
the midst
of an IAC sequence.
.. method:: Telnet.read_eager()
.. method:: Telnet.read_eager()
Read readily available data.
Read readily available data.
Raise :exc:`EOFError` if connection closed and no cooked data available.
Return
Raise :exc:`EOFError` if connection closed and no cooked data available.
``''`` if no cooked data available otherwise. Do not block unless in the midst
Return ``b''`` if no cooked data available otherwise. Do not block unless in
of an IAC sequence.
the midst
of an IAC sequence.
.. method:: Telnet.read_lazy()
.. method:: Telnet.read_lazy()
Process and return data already in the queues (lazy).
Process and return data already in the queues (lazy).
Raise :exc:`EOFError` if connection closed and no data available. Return
``''``
Raise :exc:`EOFError` if connection closed and no data available. Return
if no cooked data available otherwise. Do not block unless in the midst of an
``b''`` if no cooked data available otherwise. Do not block unless in the
IAC sequence.
midst of an
IAC sequence.
.. method:: Telnet.read_very_lazy()
.. method:: Telnet.read_very_lazy()
Return any data available in the cooked queue (very lazy).
Return any data available in the cooked queue (very lazy).
Raise :exc:`EOFError` if connection closed and no data available. Return
``''``
Raise :exc:`EOFError` if connection closed and no data available. Return
if no cooked data available otherwise. This method never blocks.
``b''``
if no cooked data available otherwise. This method never blocks.
.. method:: Telnet.read_sb_data()
.. method:: Telnet.read_sb_data()
...
@@ -163,9 +163,9 @@ Telnet Objects
...
@@ -163,9 +163,9 @@ Telnet Objects
.. method:: Telnet.write(buffer)
.. method:: Telnet.write(buffer)
Write a
string to the socket, doubling any IAC characters. This can block if the
Write a
byte string to the socket, doubling any IAC characters. This can
connection is blocked. May raise :exc:`socket.error` if the connection is
block if the connection is blocked. May raise :exc:`socket.error` if the
closed.
c
onnection is c
losed.
.. method:: Telnet.interact()
.. method:: Telnet.interact()
...
@@ -183,20 +183,21 @@ Telnet Objects
...
@@ -183,20 +183,21 @@ Telnet Objects
Read until one from a list of a regular expressions matches.
Read until one from a list of a regular expressions matches.
The first argument is a list of regular expressions, either compiled
The first argument is a list of regular expressions, either compiled
(:class:`re.RegexObject` instances) or uncompiled (strings). The optional second
(:class:`re.RegexObject` instances) or uncompiled (byte strings). The
argument is a timeout, in seconds; the default is to block indefinitely.
optional second argument is a timeout, in seconds; the default is to block
indefinitely.
Return a tuple of three items: the index in the list of the first regular
Return a tuple of three items: the index in the list of the first regular
expression that matches; the match object returned; and the
text read up till
expression that matches; the match object returned; and the
bytes read up
and including the match.
till
and including the match.
If end of file is found and no
text was read, raise :exc:`EOFError`. Otherwise,
If end of file is found and no
bytes were read, raise :exc:`EOFError`.
when nothing matches, return ``(-1, None, text)`` where *text* is the text
Otherwise, when nothing matches, return ``(-1, None, data)`` where *data* is
received so far (may be the empty string
if a timeout happened).
the bytes received so far (may be empty bytes
if a timeout happened).
If a regular expression ends with a greedy match (such as ``.*``) or if more
If a regular expression ends with a greedy match (such as ``.*``) or if more
than one expression can match the same input, the results are
indeterministic,
than one expression can match the same input, the results are
and may depend on the I/O timing.
indeterministic,
and may depend on the I/O timing.
.. method:: Telnet.set_option_negotiation_callback(callback)
.. method:: Telnet.set_option_negotiation_callback(callback)
...
@@ -234,5 +235,5 @@ A simple example illustrating typical use::
...
@@ -234,5 +235,5 @@ A simple example illustrating typical use::
tn.write(b"ls\n")
tn.write(b"ls\n")
tn.write(b"exit\n")
tn.write(b"exit\n")
print(tn.read_all())
print(tn.read_all()
.decode('ascii')
)
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