summaryrefslogtreecommitdiffstats
path: root/contrib/python/pexpect
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/python/pexpect
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/pexpect')
-rw-r--r--contrib/python/pexpect/.dist-info/METADATA98
-rw-r--r--contrib/python/pexpect/.dist-info/top_level.txt2
-rw-r--r--contrib/python/pexpect/LICENSE10
-rw-r--r--contrib/python/pexpect/README.rst110
-rw-r--r--contrib/python/pexpect/pexpect/__init__.py2
-rw-r--r--contrib/python/pexpect/pexpect/_async.py48
-rw-r--r--contrib/python/pexpect/pexpect/bashrc.sh32
-rw-r--r--contrib/python/pexpect/pexpect/expect.py200
-rw-r--r--contrib/python/pexpect/pexpect/pty_spawn.py146
-rw-r--r--contrib/python/pexpect/pexpect/pxssh.py116
-rw-r--r--contrib/python/pexpect/pexpect/replwrap.py22
-rw-r--r--contrib/python/pexpect/pexpect/run.py2
-rw-r--r--contrib/python/pexpect/pexpect/screen.py2
-rw-r--r--contrib/python/pexpect/pexpect/spawnbase.py6
-rw-r--r--contrib/python/pexpect/ya.make14
15 files changed, 405 insertions, 405 deletions
diff --git a/contrib/python/pexpect/.dist-info/METADATA b/contrib/python/pexpect/.dist-info/METADATA
index 4c417227db8..d85ab9e7138 100644
--- a/contrib/python/pexpect/.dist-info/METADATA
+++ b/contrib/python/pexpect/.dist-info/METADATA
@@ -1,49 +1,49 @@
-Metadata-Version: 2.1
-Name: pexpect
-Version: 4.8.0
-Summary: Pexpect allows easy control of interactive console applications.
-Home-page: https://pexpect.readthedocs.io/
-Author: Noah Spurrier; Thomas Kluyver; Jeff Quast
-License: ISC license
-Platform: UNIX
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Environment :: Console
-Classifier: Intended Audience :: Developers
-Classifier: Intended Audience :: System Administrators
-Classifier: License :: OSI Approved :: ISC License (ISCL)
-Classifier: Operating System :: POSIX
-Classifier: Operating System :: MacOS :: MacOS X
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Topic :: Software Development
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Classifier: Topic :: Software Development :: Quality Assurance
-Classifier: Topic :: Software Development :: Testing
-Classifier: Topic :: System
-Classifier: Topic :: System :: Archiving :: Packaging
-Classifier: Topic :: System :: Installation/Setup
-Classifier: Topic :: System :: Shells
-Classifier: Topic :: System :: Software Distribution
-Classifier: Topic :: Terminals
-Requires-Dist: ptyprocess (>=0.5)
-
-
-Pexpect is a pure Python module for spawning child applications; controlling
-them; and responding to expected patterns in their output. Pexpect works like
-Don Libes' Expect. Pexpect allows your script to spawn a child application and
-control it as if a human were typing commands.
-
-Pexpect can be used for automating interactive applications such as ssh, ftp,
-passwd, telnet, etc. It can be used to a automate setup scripts for duplicating
-software package installations on different servers. It can be used for
-automated software testing. Pexpect is in the spirit of Don Libes' Expect, but
-Pexpect is pure Python.
-
-The main features of Pexpect require the pty module in the Python standard
-library, which is only available on Unix-like systems. Some features—waiting
-for patterns from file descriptors or subprocesses—are also available on
-Windows.
-
-
+Metadata-Version: 2.1
+Name: pexpect
+Version: 4.8.0
+Summary: Pexpect allows easy control of interactive console applications.
+Home-page: https://pexpect.readthedocs.io/
+Author: Noah Spurrier; Thomas Kluyver; Jeff Quast
+License: ISC license
+Platform: UNIX
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: System Administrators
+Classifier: License :: OSI Approved :: ISC License (ISCL)
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Topic :: Software Development
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Software Development :: Quality Assurance
+Classifier: Topic :: Software Development :: Testing
+Classifier: Topic :: System
+Classifier: Topic :: System :: Archiving :: Packaging
+Classifier: Topic :: System :: Installation/Setup
+Classifier: Topic :: System :: Shells
+Classifier: Topic :: System :: Software Distribution
+Classifier: Topic :: Terminals
+Requires-Dist: ptyprocess (>=0.5)
+
+
+Pexpect is a pure Python module for spawning child applications; controlling
+them; and responding to expected patterns in their output. Pexpect works like
+Don Libes' Expect. Pexpect allows your script to spawn a child application and
+control it as if a human were typing commands.
+
+Pexpect can be used for automating interactive applications such as ssh, ftp,
+passwd, telnet, etc. It can be used to a automate setup scripts for duplicating
+software package installations on different servers. It can be used for
+automated software testing. Pexpect is in the spirit of Don Libes' Expect, but
+Pexpect is pure Python.
+
+The main features of Pexpect require the pty module in the Python standard
+library, which is only available on Unix-like systems. Some features—waiting
+for patterns from file descriptors or subprocesses—are also available on
+Windows.
+
+
diff --git a/contrib/python/pexpect/.dist-info/top_level.txt b/contrib/python/pexpect/.dist-info/top_level.txt
index 808fb07afdc..4fcca4ea564 100644
--- a/contrib/python/pexpect/.dist-info/top_level.txt
+++ b/contrib/python/pexpect/.dist-info/top_level.txt
@@ -1 +1 @@
-pexpect
+pexpect
diff --git a/contrib/python/pexpect/LICENSE b/contrib/python/pexpect/LICENSE
index 754db5afcb8..712aef602a6 100644
--- a/contrib/python/pexpect/LICENSE
+++ b/contrib/python/pexpect/LICENSE
@@ -1,4 +1,4 @@
-ISC LICENSE
+ISC LICENSE
This license is approved by the OSI and FSF as GPL-compatible.
http://opensource.org/licenses/isc-license.txt
@@ -6,10 +6,10 @@ ISC LICENSE
Copyright (c) 2013-2014, Pexpect development team
Copyright (c) 2012, Noah Spurrier <[email protected]>
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
diff --git a/contrib/python/pexpect/README.rst b/contrib/python/pexpect/README.rst
index 85d35b98ab9..c4b0a6839c2 100644
--- a/contrib/python/pexpect/README.rst
+++ b/contrib/python/pexpect/README.rst
@@ -1,55 +1,55 @@
-.. image:: https://travis-ci.org/pexpect/pexpect.svg?branch=master
- :target: https://travis-ci.org/pexpect/pexpect
- :align: right
- :alt: Build status
-
-Pexpect is a Pure Python Expect-like module
-
-Pexpect makes Python a better tool for controlling other applications.
-
-Pexpect is a pure Python module for spawning child applications; controlling
-them; and responding to expected patterns in their output. Pexpect works like
-Don Libes' Expect. Pexpect allows your script to spawn a child application and
-control it as if a human were typing commands.
-
-Pexpect can be used for automating interactive applications such as ssh, ftp,
-passwd, telnet, etc. It can be used to automate setup scripts for duplicating
-software package installations on different servers. It can be used for
-automated software testing. Pexpect is in the spirit of Don Libes' Expect, but
-Pexpect is pure Python.
-
-The main features of Pexpect require the pty module in the Python standard
-library, which is only available on Unix-like systems. Some features—waiting
-for patterns from file descriptors or subprocesses—are also available on
-Windows.
-
-If you want to work with the development version of the source code then please
-read the DEVELOPERS.rst document in the root of the source code tree.
-
-Free, open source, and all that good stuff.
-
-You can install Pexpect using pip::
-
- pip install pexpect
-
-`Docs on ReadTheDocs <https://pexpect.readthedocs.io/>`_
-
-PEXPECT LICENSE::
-
- http://opensource.org/licenses/isc-license.txt
-
- Copyright (c) 2013-2016, Pexpect development team
- Copyright (c) 2012, Noah Spurrier <[email protected]>
-
- PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
- PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE
- COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-This license is approved by the OSI and FSF as GPL-compatible.
+.. image:: https://travis-ci.org/pexpect/pexpect.svg?branch=master
+ :target: https://travis-ci.org/pexpect/pexpect
+ :align: right
+ :alt: Build status
+
+Pexpect is a Pure Python Expect-like module
+
+Pexpect makes Python a better tool for controlling other applications.
+
+Pexpect is a pure Python module for spawning child applications; controlling
+them; and responding to expected patterns in their output. Pexpect works like
+Don Libes' Expect. Pexpect allows your script to spawn a child application and
+control it as if a human were typing commands.
+
+Pexpect can be used for automating interactive applications such as ssh, ftp,
+passwd, telnet, etc. It can be used to automate setup scripts for duplicating
+software package installations on different servers. It can be used for
+automated software testing. Pexpect is in the spirit of Don Libes' Expect, but
+Pexpect is pure Python.
+
+The main features of Pexpect require the pty module in the Python standard
+library, which is only available on Unix-like systems. Some features—waiting
+for patterns from file descriptors or subprocesses—are also available on
+Windows.
+
+If you want to work with the development version of the source code then please
+read the DEVELOPERS.rst document in the root of the source code tree.
+
+Free, open source, and all that good stuff.
+
+You can install Pexpect using pip::
+
+ pip install pexpect
+
+`Docs on ReadTheDocs <https://pexpect.readthedocs.io/>`_
+
+PEXPECT LICENSE::
+
+ http://opensource.org/licenses/isc-license.txt
+
+ Copyright (c) 2013-2016, Pexpect development team
+ Copyright (c) 2012, Noah Spurrier <[email protected]>
+
+ PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
+ PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE
+ COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES.
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+This license is approved by the OSI and FSF as GPL-compatible.
diff --git a/contrib/python/pexpect/pexpect/__init__.py b/contrib/python/pexpect/pexpect/__init__.py
index 7e30453787c..454d68ebe9f 100644
--- a/contrib/python/pexpect/pexpect/__init__.py
+++ b/contrib/python/pexpect/pexpect/__init__.py
@@ -75,7 +75,7 @@ if sys.platform != 'win32':
from .pty_spawn import spawn, spawnu
from .run import run, runu
-__version__ = '4.8.0'
+__version__ = '4.8.0'
__revision__ = ''
__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'spawnu', 'run', 'runu',
'which', 'split_command_line', '__version__', '__revision__']
diff --git a/contrib/python/pexpect/pexpect/_async.py b/contrib/python/pexpect/pexpect/_async.py
index dfbfeef5fb9..028e2aba204 100644
--- a/contrib/python/pexpect/pexpect/_async.py
+++ b/contrib/python/pexpect/pexpect/_async.py
@@ -1,6 +1,6 @@
import asyncio
import errno
-import signal
+import signal
from pexpect import EOF
@@ -8,7 +8,7 @@ from pexpect import EOF
def expect_async(expecter, timeout=None):
# First process data that was previously read - if it maches, we don't need
# async stuff.
- idx = expecter.existing_data()
+ idx = expecter.existing_data()
if idx is not None:
return idx
if not expecter.spawn.async_pw_transport:
@@ -27,24 +27,24 @@ def expect_async(expecter, timeout=None):
transport.pause_reading()
return expecter.timeout(e)
-def repl_run_command_async(repl, cmdlines, timeout=-1):
- res = []
- repl.child.sendline(cmdlines[0])
- for line in cmdlines[1:]:
- yield from repl._expect_prompt(timeout=timeout, async_=True)
- res.append(repl.child.before)
- repl.child.sendline(line)
-
- # Command was fully submitted, now wait for the next prompt
- prompt_idx = yield from repl._expect_prompt(timeout=timeout, async_=True)
- if prompt_idx == 1:
- # We got the continuation prompt - command was incomplete
- repl.child.kill(signal.SIGINT)
- yield from repl._expect_prompt(timeout=1, async_=True)
- raise ValueError("Continuation prompt found - input was incomplete:")
- return u''.join(res + [repl.child.before])
+def repl_run_command_async(repl, cmdlines, timeout=-1):
+ res = []
+ repl.child.sendline(cmdlines[0])
+ for line in cmdlines[1:]:
+ yield from repl._expect_prompt(timeout=timeout, async_=True)
+ res.append(repl.child.before)
+ repl.child.sendline(line)
+ # Command was fully submitted, now wait for the next prompt
+ prompt_idx = yield from repl._expect_prompt(timeout=timeout, async_=True)
+ if prompt_idx == 1:
+ # We got the continuation prompt - command was incomplete
+ repl.child.kill(signal.SIGINT)
+ yield from repl._expect_prompt(timeout=1, async_=True)
+ raise ValueError("Continuation prompt found - input was incomplete:")
+ return u''.join(res + [repl.child.before])
+
class PatternWaiter(asyncio.Protocol):
transport = None
@@ -56,7 +56,7 @@ class PatternWaiter(asyncio.Protocol):
if not self.fut.done():
self.fut.set_result(result)
self.transport.pause_reading()
-
+
def error(self, exc):
if not self.fut.done():
self.fut.set_exception(exc)
@@ -64,14 +64,14 @@ class PatternWaiter(asyncio.Protocol):
def connection_made(self, transport):
self.transport = transport
-
+
def data_received(self, data):
spawn = self.expecter.spawn
s = spawn._decoder.decode(data)
spawn._log(s, 'read')
if self.fut.done():
- spawn._before.write(s)
+ spawn._before.write(s)
spawn._buffer.write(s)
return
@@ -83,7 +83,7 @@ class PatternWaiter(asyncio.Protocol):
except Exception as e:
self.expecter.errored()
self.error(e)
-
+
def eof_received(self):
# N.B. If this gets called, async will close the pipe (the spawn object)
# for us
@@ -94,7 +94,7 @@ class PatternWaiter(asyncio.Protocol):
self.error(e)
else:
self.found(index)
-
+
def connection_lost(self, exc):
if isinstance(exc, OSError) and exc.errno == errno.EIO:
# We may get here without eof_received being called, e.g on Linux
diff --git a/contrib/python/pexpect/pexpect/bashrc.sh b/contrib/python/pexpect/pexpect/bashrc.sh
index c734ac90b85..99ac8e5191e 100644
--- a/contrib/python/pexpect/pexpect/bashrc.sh
+++ b/contrib/python/pexpect/pexpect/bashrc.sh
@@ -1,16 +1,16 @@
-# Different platforms have different names for the systemwide bashrc
-if [[ -f /etc/bashrc ]]; then
- source /etc/bashrc
-fi
-if [[ -f /etc/bash.bashrc ]]; then
- source /etc/bash.bashrc
-fi
-if [[ -f ~/.bashrc ]]; then
- source ~/.bashrc
-fi
-
-# Reset PS1 so pexpect can find it
-PS1="$"
-
-# Unset PROMPT_COMMAND, so that it can't change PS1 to something unexpected.
-unset PROMPT_COMMAND
+# Different platforms have different names for the systemwide bashrc
+if [[ -f /etc/bashrc ]]; then
+ source /etc/bashrc
+fi
+if [[ -f /etc/bash.bashrc ]]; then
+ source /etc/bash.bashrc
+fi
+if [[ -f ~/.bashrc ]]; then
+ source ~/.bashrc
+fi
+
+# Reset PS1 so pexpect can find it
+PS1="$"
+
+# Unset PROMPT_COMMAND, so that it can't change PS1 to something unexpected.
+unset PROMPT_COMMAND
diff --git a/contrib/python/pexpect/pexpect/expect.py b/contrib/python/pexpect/pexpect/expect.py
index d3409db9d73..9d38bf219b5 100644
--- a/contrib/python/pexpect/pexpect/expect.py
+++ b/contrib/python/pexpect/pexpect/expect.py
@@ -6,101 +6,101 @@ class Expecter(object):
def __init__(self, spawn, searcher, searchwindowsize=-1):
self.spawn = spawn
self.searcher = searcher
- # A value of -1 means to use the figure from spawn, which should
- # be None or a positive number.
+ # A value of -1 means to use the figure from spawn, which should
+ # be None or a positive number.
if searchwindowsize == -1:
searchwindowsize = spawn.searchwindowsize
self.searchwindowsize = searchwindowsize
- self.lookback = None
- if hasattr(searcher, 'longest_string'):
- self.lookback = searcher.longest_string
+ self.lookback = None
+ if hasattr(searcher, 'longest_string'):
+ self.lookback = searcher.longest_string
- def do_search(self, window, freshlen):
+ def do_search(self, window, freshlen):
spawn = self.spawn
searcher = self.searcher
- if freshlen > len(window):
- freshlen = len(window)
- index = searcher.search(window, freshlen, self.searchwindowsize)
+ if freshlen > len(window):
+ freshlen = len(window)
+ index = searcher.search(window, freshlen, self.searchwindowsize)
if index >= 0:
spawn._buffer = spawn.buffer_type()
spawn._buffer.write(window[searcher.end:])
- spawn.before = spawn._before.getvalue()[
- 0:-(len(window) - searcher.start)]
+ spawn.before = spawn._before.getvalue()[
+ 0:-(len(window) - searcher.start)]
spawn._before = spawn.buffer_type()
- spawn._before.write(window[searcher.end:])
- spawn.after = window[searcher.start:searcher.end]
+ spawn._before.write(window[searcher.end:])
+ spawn.after = window[searcher.start:searcher.end]
spawn.match = searcher.match
spawn.match_index = index
# Found a match
return index
- elif self.searchwindowsize or self.lookback:
- maintain = self.searchwindowsize or self.lookback
- if spawn._buffer.tell() > maintain:
- spawn._buffer = spawn.buffer_type()
- spawn._buffer.write(window[-maintain:])
-
- def existing_data(self):
- # First call from a new call to expect_loop or expect_async.
- # self.searchwindowsize may have changed.
- # Treat all data as fresh.
- spawn = self.spawn
- before_len = spawn._before.tell()
- buf_len = spawn._buffer.tell()
- freshlen = before_len
- if before_len > buf_len:
- if not self.searchwindowsize:
- spawn._buffer = spawn.buffer_type()
- window = spawn._before.getvalue()
- spawn._buffer.write(window)
- elif buf_len < self.searchwindowsize:
- spawn._buffer = spawn.buffer_type()
- spawn._before.seek(
- max(0, before_len - self.searchwindowsize))
- window = spawn._before.read()
- spawn._buffer.write(window)
- else:
- spawn._buffer.seek(max(0, buf_len - self.searchwindowsize))
- window = spawn._buffer.read()
- else:
- if self.searchwindowsize:
- spawn._buffer.seek(max(0, buf_len - self.searchwindowsize))
- window = spawn._buffer.read()
- else:
- window = spawn._buffer.getvalue()
- return self.do_search(window, freshlen)
-
- def new_data(self, data):
- # A subsequent call, after a call to existing_data.
- spawn = self.spawn
- freshlen = len(data)
- spawn._before.write(data)
- if not self.searchwindowsize:
- if self.lookback:
- # search lookback + new data.
- old_len = spawn._buffer.tell()
- spawn._buffer.write(data)
- spawn._buffer.seek(max(0, old_len - self.lookback))
- window = spawn._buffer.read()
- else:
- # copy the whole buffer (really slow for large datasets).
- spawn._buffer.write(data)
- window = spawn.buffer
- else:
- if len(data) >= self.searchwindowsize or not spawn._buffer.tell():
- window = data[-self.searchwindowsize:]
- spawn._buffer = spawn.buffer_type()
- spawn._buffer.write(window[-self.searchwindowsize:])
- else:
- spawn._buffer.write(data)
- new_len = spawn._buffer.tell()
- spawn._buffer.seek(max(0, new_len - self.searchwindowsize))
- window = spawn._buffer.read()
- return self.do_search(window, freshlen)
+ elif self.searchwindowsize or self.lookback:
+ maintain = self.searchwindowsize or self.lookback
+ if spawn._buffer.tell() > maintain:
+ spawn._buffer = spawn.buffer_type()
+ spawn._buffer.write(window[-maintain:])
+ def existing_data(self):
+ # First call from a new call to expect_loop or expect_async.
+ # self.searchwindowsize may have changed.
+ # Treat all data as fresh.
+ spawn = self.spawn
+ before_len = spawn._before.tell()
+ buf_len = spawn._buffer.tell()
+ freshlen = before_len
+ if before_len > buf_len:
+ if not self.searchwindowsize:
+ spawn._buffer = spawn.buffer_type()
+ window = spawn._before.getvalue()
+ spawn._buffer.write(window)
+ elif buf_len < self.searchwindowsize:
+ spawn._buffer = spawn.buffer_type()
+ spawn._before.seek(
+ max(0, before_len - self.searchwindowsize))
+ window = spawn._before.read()
+ spawn._buffer.write(window)
+ else:
+ spawn._buffer.seek(max(0, buf_len - self.searchwindowsize))
+ window = spawn._buffer.read()
+ else:
+ if self.searchwindowsize:
+ spawn._buffer.seek(max(0, buf_len - self.searchwindowsize))
+ window = spawn._buffer.read()
+ else:
+ window = spawn._buffer.getvalue()
+ return self.do_search(window, freshlen)
+
+ def new_data(self, data):
+ # A subsequent call, after a call to existing_data.
+ spawn = self.spawn
+ freshlen = len(data)
+ spawn._before.write(data)
+ if not self.searchwindowsize:
+ if self.lookback:
+ # search lookback + new data.
+ old_len = spawn._buffer.tell()
+ spawn._buffer.write(data)
+ spawn._buffer.seek(max(0, old_len - self.lookback))
+ window = spawn._buffer.read()
+ else:
+ # copy the whole buffer (really slow for large datasets).
+ spawn._buffer.write(data)
+ window = spawn.buffer
+ else:
+ if len(data) >= self.searchwindowsize or not spawn._buffer.tell():
+ window = data[-self.searchwindowsize:]
+ spawn._buffer = spawn.buffer_type()
+ spawn._buffer.write(window[-self.searchwindowsize:])
+ else:
+ spawn._buffer.write(data)
+ new_len = spawn._buffer.tell()
+ spawn._buffer.seek(max(0, new_len - self.searchwindowsize))
+ window = spawn._buffer.read()
+ return self.do_search(window, freshlen)
+
def eof(self, err=None):
spawn = self.spawn
- spawn.before = spawn._before.getvalue()
+ spawn.before = spawn._before.getvalue()
spawn._buffer = spawn.buffer_type()
spawn._before = spawn.buffer_type()
spawn.after = EOF
@@ -116,15 +116,15 @@ class Expecter(object):
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
-
- exc = EOF(msg)
- exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
- raise exc
-
+
+ exc = EOF(msg)
+ exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
+ raise exc
+
def timeout(self, err=None):
spawn = self.spawn
- spawn.before = spawn._before.getvalue()
+ spawn.before = spawn._before.getvalue()
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
@@ -139,17 +139,17 @@ class Expecter(object):
if err is not None:
msg = str(err) + '\n' + msg
- exc = TIMEOUT(msg)
- exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
- raise exc
-
+ exc = TIMEOUT(msg)
+ exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
+ raise exc
+
def errored(self):
spawn = self.spawn
- spawn.before = spawn._before.getvalue()
+ spawn.before = spawn._before.getvalue()
spawn.after = None
spawn.match = None
spawn.match_index = None
-
+
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
@@ -158,9 +158,9 @@ class Expecter(object):
end_time = time.time() + timeout
try:
- idx = self.existing_data()
- if idx is not None:
- return idx
+ idx = self.existing_data()
+ if idx is not None:
+ return idx
while True:
# No match at this point
if (timeout is not None) and (timeout < 0):
@@ -169,10 +169,10 @@ class Expecter(object):
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
if self.spawn.delayafterread is not None:
time.sleep(self.spawn.delayafterread)
- idx = self.new_data(incoming)
- # Keep reading until exception or return.
- if idx is not None:
- return idx
+ idx = self.new_data(incoming)
+ # Keep reading until exception or return.
+ if idx is not None:
+ return idx
if timeout is not None:
timeout = end_time - time.time()
except EOF as e:
@@ -210,7 +210,7 @@ class searcher_string(object):
self.eof_index = -1
self.timeout_index = -1
self._strings = []
- self.longest_string = 0
+ self.longest_string = 0
for n, s in enumerate(strings):
if s is EOF:
self.eof_index = n
@@ -219,8 +219,8 @@ class searcher_string(object):
self.timeout_index = n
continue
self._strings.append((n, s))
- if len(s) > self.longest_string:
- self.longest_string = len(s)
+ if len(s) > self.longest_string:
+ self.longest_string = len(s)
def __str__(self):
'''This returns a human-readable string that represents the state of
@@ -309,7 +309,7 @@ class searcher_re(object):
self.eof_index = -1
self.timeout_index = -1
self._searches = []
- for n, s in enumerate(patterns):
+ for n, s in enumerate(patterns):
if s is EOF:
self.eof_index = n
continue
diff --git a/contrib/python/pexpect/pexpect/pty_spawn.py b/contrib/python/pexpect/pexpect/pty_spawn.py
index 8e28ca7cd7d..b988746ba77 100644
--- a/contrib/python/pexpect/pexpect/pty_spawn.py
+++ b/contrib/python/pexpect/pexpect/pty_spawn.py
@@ -191,7 +191,7 @@ class spawn(SpawnBase):
self.STDIN_FILENO = pty.STDIN_FILENO
self.STDOUT_FILENO = pty.STDOUT_FILENO
self.STDERR_FILENO = pty.STDERR_FILENO
- self.str_last_chars = 100
+ self.str_last_chars = 100
self.cwd = cwd
self.env = env
self.echo = echo
@@ -213,8 +213,8 @@ class spawn(SpawnBase):
s.append(repr(self))
s.append('command: ' + str(self.command))
s.append('args: %r' % (self.args,))
- s.append('buffer (last %s chars): %r' % (self.str_last_chars,self.buffer[-self.str_last_chars:]))
- s.append('before (last %s chars): %r' % (self.str_last_chars,self.before[-self.str_last_chars:] if self.before else ''))
+ s.append('buffer (last %s chars): %r' % (self.str_last_chars,self.buffer[-self.str_last_chars:]))
+ s.append('before (last %s chars): %r' % (self.str_last_chars,self.before[-self.str_last_chars:] if self.before else ''))
s.append('after: %r' % (self.after,))
s.append('match: %r' % (self.match,))
s.append('match_index: ' + str(self.match_index))
@@ -431,83 +431,83 @@ class spawn(SpawnBase):
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
- On the other hand, if there are bytes available to read immediately,
- all those bytes will be read (up to the buffer size). So, if the
- buffer size is 1 megabyte and there is 1 megabyte of data available
- to read, the buffer will be filled, regardless of timeout.
-
- This is a wrapper around os.read(). It uses select.select() or
- select.poll() to implement the timeout. '''
+ On the other hand, if there are bytes available to read immediately,
+ all those bytes will be read (up to the buffer size). So, if the
+ buffer size is 1 megabyte and there is 1 megabyte of data available
+ to read, the buffer will be filled, regardless of timeout.
+ This is a wrapper around os.read(). It uses select.select() or
+ select.poll() to implement the timeout. '''
+
if self.closed:
raise ValueError('I/O operation on closed file.')
- if self.use_poll:
- def select(timeout):
- return poll_ignore_interrupts([self.child_fd], timeout)
- else:
- def select(timeout):
- return select_ignore_interrupts([self.child_fd], [], [], timeout)[0]
-
- # If there is data available to read right now, read as much as
- # we can. We do this to increase performance if there are a lot
- # of bytes to be read. This also avoids calling isalive() too
- # often. See also:
- # * https://github.com/pexpect/pexpect/pull/304
- # * http://trac.sagemath.org/ticket/10295
- if select(0):
- try:
- incoming = super(spawn, self).read_nonblocking(size)
- except EOF:
- # Maybe the child is dead: update some attributes in that case
- self.isalive()
- raise
- while len(incoming) < size and select(0):
- try:
- incoming += super(spawn, self).read_nonblocking(size - len(incoming))
- except EOF:
- # Maybe the child is dead: update some attributes in that case
- self.isalive()
- # Don't raise EOF, just return what we read so far.
- return incoming
- return incoming
-
+ if self.use_poll:
+ def select(timeout):
+ return poll_ignore_interrupts([self.child_fd], timeout)
+ else:
+ def select(timeout):
+ return select_ignore_interrupts([self.child_fd], [], [], timeout)[0]
+
+ # If there is data available to read right now, read as much as
+ # we can. We do this to increase performance if there are a lot
+ # of bytes to be read. This also avoids calling isalive() too
+ # often. See also:
+ # * https://github.com/pexpect/pexpect/pull/304
+ # * http://trac.sagemath.org/ticket/10295
+ if select(0):
+ try:
+ incoming = super(spawn, self).read_nonblocking(size)
+ except EOF:
+ # Maybe the child is dead: update some attributes in that case
+ self.isalive()
+ raise
+ while len(incoming) < size and select(0):
+ try:
+ incoming += super(spawn, self).read_nonblocking(size - len(incoming))
+ except EOF:
+ # Maybe the child is dead: update some attributes in that case
+ self.isalive()
+ # Don't raise EOF, just return what we read so far.
+ return incoming
+ return incoming
+
if timeout == -1:
timeout = self.timeout
if not self.isalive():
- # The process is dead, but there may or may not be data
- # available to read. Note that some systems such as Solaris
- # do not give an EOF when the child dies. In fact, you can
- # still try to read from the child_fd -- it will block
- # forever or until TIMEOUT. For that reason, it's important
- # to do this check before calling select() with timeout.
- if select(0):
- return super(spawn, self).read_nonblocking(size)
- self.flag_eof = True
- raise EOF('End Of File (EOF). Braindead platform.')
+ # The process is dead, but there may or may not be data
+ # available to read. Note that some systems such as Solaris
+ # do not give an EOF when the child dies. In fact, you can
+ # still try to read from the child_fd -- it will block
+ # forever or until TIMEOUT. For that reason, it's important
+ # to do this check before calling select() with timeout.
+ if select(0):
+ return super(spawn, self).read_nonblocking(size)
+ self.flag_eof = True
+ raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
- # Make sure that the timeout is at least 2 seconds.
+ # Make sure that the timeout is at least 2 seconds.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
- if timeout is not None and timeout < 2:
- timeout = 2
+ if timeout is not None and timeout < 2:
+ timeout = 2
- # Because of the select(0) check above, we know that no data
- # is available right now. But if a non-zero timeout is given
- # (possibly timeout=None), we call select() with a timeout.
- if (timeout != 0) and select(timeout):
+ # Because of the select(0) check above, we know that no data
+ # is available right now. But if a non-zero timeout is given
+ # (possibly timeout=None), we call select() with a timeout.
+ if (timeout != 0) and select(timeout):
return super(spawn, self).read_nonblocking(size)
- if not self.isalive():
- # Some platforms, such as Irix, will claim that their
- # processes are alive; timeout on the select; and
- # then finally admit that they are not alive.
- self.flag_eof = True
- raise EOF('End of File (EOF). Very slow platform.')
- else:
- raise TIMEOUT('Timeout exceeded.')
+ if not self.isalive():
+ # Some platforms, such as Irix, will claim that their
+ # processes are alive; timeout on the select; and
+ # then finally admit that they are not alive.
+ self.flag_eof = True
+ raise EOF('End of File (EOF). Very slow platform.')
+ else:
+ raise TIMEOUT('Timeout exceeded.')
def write(self, s):
'''This is similar to send() except that there is no return value.
@@ -753,15 +753,15 @@ class spawn(SpawnBase):
child process in interact mode is duplicated to the given log.
You may pass in optional input and output filter functions. These
- functions should take bytes array and return bytes array too. Even
- with ``encoding='utf-8'`` support, meth:`interact` will always pass
- input_filter and output_filter bytes. You may need to wrap your
- function to decode and encode back to UTF-8.
-
- The output_filter will be passed all the output from the child process.
- The input_filter will be passed all the keyboard input from the user.
- The input_filter is run BEFORE the check for the escape_character.
+ functions should take bytes array and return bytes array too. Even
+ with ``encoding='utf-8'`` support, meth:`interact` will always pass
+ input_filter and output_filter bytes. You may need to wrap your
+ function to decode and encode back to UTF-8.
+ The output_filter will be passed all the output from the child process.
+ The input_filter will be passed all the keyboard input from the user.
+ The input_filter is run BEFORE the check for the escape_character.
+
Note that if you change the window size of the parent the SIGWINCH
signal will not be passed through to the child. If you want the child
window size to change when the parent's window size changes then do
diff --git a/contrib/python/pexpect/pexpect/pxssh.py b/contrib/python/pexpect/pexpect/pxssh.py
index 3d53bd97462..d566b59d4d1 100644
--- a/contrib/python/pexpect/pexpect/pxssh.py
+++ b/contrib/python/pexpect/pexpect/pxssh.py
@@ -109,7 +109,7 @@ class pxssh (spawn):
username = raw_input('username: ')
password = getpass.getpass('password: ')
s.login (hostname, username, password)
-
+
`debug_command_string` is only for the test suite to confirm that the string
generated for SSH is correct, using this will not allow you to do
anything other than get a string back from `pxssh.pxssh.login()`.
@@ -118,12 +118,12 @@ class pxssh (spawn):
def __init__ (self, timeout=30, maxread=2000, searchwindowsize=None,
logfile=None, cwd=None, env=None, ignore_sighup=True, echo=True,
options={}, encoding=None, codec_errors='strict',
- debug_command_string=False, use_poll=False):
+ debug_command_string=False, use_poll=False):
spawn.__init__(self, None, timeout=timeout, maxread=maxread,
searchwindowsize=searchwindowsize, logfile=logfile,
cwd=cwd, env=env, ignore_sighup=ignore_sighup, echo=echo,
- encoding=encoding, codec_errors=codec_errors, use_poll=use_poll)
+ encoding=encoding, codec_errors=codec_errors, use_poll=use_poll)
self.name = '<pxssh>'
@@ -154,7 +154,7 @@ class pxssh (spawn):
# Unsetting SSH_ASKPASS on the remote side doesn't disable it! Annoying!
#self.SSH_OPTS = "-x -o'RSAAuthentication=no' -o 'PubkeyAuthentication=no'"
self.force_password = False
-
+
self.debug_command_string = debug_command_string
# User defined SSH options, eg,
@@ -220,7 +220,7 @@ class pxssh (spawn):
can take 12 seconds. Low latency connections are more likely to fail
with a low sync_multiplier. Best case sync time gets worse with a
high sync multiplier (500 ms with default). '''
-
+
# All of these timing pace values are magic.
# I came up with these based on what seemed reliable for
# connecting to a heavily loaded machine I have.
@@ -253,19 +253,19 @@ class pxssh (spawn):
### TODO: This is getting messy and I'm pretty sure this isn't perfect.
### TODO: I need to draw a flow chart for this.
### TODO: Unit tests for SSH tunnels, remote SSH command exec, disabling original prompt sync
- def login (self, server, username=None, password='', terminal_type='ansi',
+ def login (self, server, username=None, password='', terminal_type='ansi',
original_prompt=r"[#$]", login_timeout=10, port=None,
auto_prompt_reset=True, ssh_key=None, quiet=True,
sync_multiplier=1, check_local_ip=True,
password_regex=r'(?i)(?:password:)|(?:passphrase for key)',
ssh_tunnels={}, spawn_local_ssh=True,
- sync_original_prompt=True, ssh_config=None, cmd='ssh'):
+ sync_original_prompt=True, ssh_config=None, cmd='ssh'):
'''This logs the user into the given server.
- It uses 'original_prompt' to try to find the prompt right after login.
- When it finds the prompt it immediately tries to reset the prompt to
- something more easily matched. The default 'original_prompt' is very
- optimistic and is easily fooled. It's more reliable to try to match the original
+ It uses 'original_prompt' to try to find the prompt right after login.
+ When it finds the prompt it immediately tries to reset the prompt to
+ something more easily matched. The default 'original_prompt' is very
+ optimistic and is easily fooled. It's more reliable to try to match the original
prompt as exactly as possible to prevent false matches by server
strings such as the "Message Of The Day". On many systems you can
disable the MOTD on the remote server by creating a zero-length file
@@ -283,31 +283,31 @@ class pxssh (spawn):
uses a unique prompt in the :meth:`prompt` method. If the original prompt is
not reset then this will disable the :meth:`prompt` method unless you
manually set the :attr:`PROMPT` attribute.
-
+
Set ``password_regex`` if there is a MOTD message with `password` in it.
Changing this is like playing in traffic, don't (p)expect it to match straight
away.
-
+
If you require to connect to another SSH server from the your original SSH
connection set ``spawn_local_ssh`` to `False` and this will use your current
session to do so. Setting this option to `False` and not having an active session
will trigger an error.
-
+
Set ``ssh_key`` to a file path to an SSH private key to use that SSH key
for the session authentication.
Set ``ssh_key`` to `True` to force passing the current SSH authentication socket
to the desired ``hostname``.
-
+
Set ``ssh_config`` to a file path string of an SSH client config file to pass that
file to the client to handle itself. You may set any options you wish in here, however
doing so will require you to post extra information that you may not want to if you
run into issues.
-
- Alter the ``cmd`` to change the ssh client used, or to prepend it with network
- namespaces. For example ```cmd="ip netns exec vlan2 ssh"``` to execute the ssh in
- network namespace named ```vlan```.
+
+ Alter the ``cmd`` to change the ssh client used, or to prepend it with network
+ namespaces. For example ```cmd="ip netns exec vlan2 ssh"``` to execute the ssh in
+ network namespace named ```vlan```.
'''
-
+
session_regex_array = ["(?i)are you sure you want to continue connecting", original_prompt, password_regex, "(?i)permission denied", "(?i)terminal type", TIMEOUT]
session_init_regex_array = []
session_init_regex_array.extend(session_regex_array)
@@ -323,7 +323,7 @@ class pxssh (spawn):
if ssh_config is not None:
if spawn_local_ssh and not os.path.isfile(ssh_config):
raise ExceptionPxssh('SSH config does not exist or is not a file.')
- ssh_options = ssh_options + ' -F ' + ssh_config
+ ssh_options = ssh_options + ' -F ' + ssh_config
if port is not None:
ssh_options = ssh_options + ' -p %s'%(str(port))
if ssh_key is not None:
@@ -334,7 +334,7 @@ class pxssh (spawn):
if spawn_local_ssh and not os.path.isfile(ssh_key):
raise ExceptionPxssh('private ssh key does not exist or is not a file.')
ssh_options = ssh_options + ' -i %s' % (ssh_key)
-
+
# SSH tunnels, make sure you know what you're putting into the lists
# under each heading. Do not expect these to open 100% of the time,
# The port you're requesting might be bound.
@@ -357,42 +357,42 @@ class pxssh (spawn):
if spawn_local_ssh==False:
tunnel = quote(str(tunnel))
ssh_options = ssh_options + ' -' + cmd_type + ' ' + str(tunnel)
-
- if username is not None:
- ssh_options = ssh_options + ' -l ' + username
- elif ssh_config is None:
- raise TypeError('login() needs either a username or an ssh_config')
- else: # make sure ssh_config has an entry for the server with a username
- with open(ssh_config, 'rt') as f:
- lines = [l.strip() for l in f.readlines()]
-
- server_regex = r'^Host\s+%s\s*$' % server
- user_regex = r'^User\s+\w+\s*$'
- config_has_server = False
- server_has_username = False
- for line in lines:
- if not config_has_server and re.match(server_regex, line, re.IGNORECASE):
- config_has_server = True
- elif config_has_server and 'hostname' in line.lower():
- pass
- elif config_has_server and 'host' in line.lower():
- server_has_username = False # insurance
- break # we have left the relevant section
- elif config_has_server and re.match(user_regex, line, re.IGNORECASE):
- server_has_username = True
- break
-
- if lines:
- del line
-
- del lines
-
- if not config_has_server:
- raise TypeError('login() ssh_config has no Host entry for %s' % server)
- elif not server_has_username:
- raise TypeError('login() ssh_config has no user entry for %s' % server)
-
- cmd += " %s %s" % (ssh_options, server)
+
+ if username is not None:
+ ssh_options = ssh_options + ' -l ' + username
+ elif ssh_config is None:
+ raise TypeError('login() needs either a username or an ssh_config')
+ else: # make sure ssh_config has an entry for the server with a username
+ with open(ssh_config, 'rt') as f:
+ lines = [l.strip() for l in f.readlines()]
+
+ server_regex = r'^Host\s+%s\s*$' % server
+ user_regex = r'^User\s+\w+\s*$'
+ config_has_server = False
+ server_has_username = False
+ for line in lines:
+ if not config_has_server and re.match(server_regex, line, re.IGNORECASE):
+ config_has_server = True
+ elif config_has_server and 'hostname' in line.lower():
+ pass
+ elif config_has_server and 'host' in line.lower():
+ server_has_username = False # insurance
+ break # we have left the relevant section
+ elif config_has_server and re.match(user_regex, line, re.IGNORECASE):
+ server_has_username = True
+ break
+
+ if lines:
+ del line
+
+ del lines
+
+ if not config_has_server:
+ raise TypeError('login() ssh_config has no Host entry for %s' % server)
+ elif not server_has_username:
+ raise TypeError('login() ssh_config has no user entry for %s' % server)
+
+ cmd += " %s %s" % (ssh_options, server)
if self.debug_command_string:
return(cmd)
diff --git a/contrib/python/pexpect/pexpect/replwrap.py b/contrib/python/pexpect/pexpect/replwrap.py
index c930f1e4fe0..abd8b6da4ef 100644
--- a/contrib/python/pexpect/pexpect/replwrap.py
+++ b/contrib/python/pexpect/pexpect/replwrap.py
@@ -61,11 +61,11 @@ class REPLWrapper(object):
self.child.expect(orig_prompt)
self.child.sendline(prompt_change)
- def _expect_prompt(self, timeout=-1, async_=False):
+ def _expect_prompt(self, timeout=-1, async_=False):
return self.child.expect_exact([self.prompt, self.continuation_prompt],
- timeout=timeout, async_=async_)
+ timeout=timeout, async_=async_)
- def run_command(self, command, timeout=-1, async_=False):
+ def run_command(self, command, timeout=-1, async_=False):
"""Send a command to the REPL, wait for and return output.
:param str command: The command to send. Trailing newlines are not needed.
@@ -75,10 +75,10 @@ class REPLWrapper(object):
:param int timeout: How long to wait for the next prompt. -1 means the
default from the :class:`pexpect.spawn` object (default 30 seconds).
None means to wait indefinitely.
- :param bool async_: On Python 3.4, or Python 3.3 with asyncio
- installed, passing ``async_=True`` will make this return an
- :mod:`asyncio` Future, which you can yield from to get the same
- result that this method would normally give directly.
+ :param bool async_: On Python 3.4, or Python 3.3 with asyncio
+ installed, passing ``async_=True`` will make this return an
+ :mod:`asyncio` Future, which you can yield from to get the same
+ result that this method would normally give directly.
"""
# Split up multiline commands and feed them in bit-by-bit
cmdlines = command.splitlines()
@@ -88,10 +88,10 @@ class REPLWrapper(object):
if not cmdlines:
raise ValueError("No command was given")
- if async_:
- from ._async import repl_run_command_async
- return repl_run_command_async(self, cmdlines, timeout)
-
+ if async_:
+ from ._async import repl_run_command_async
+ return repl_run_command_async(self, cmdlines, timeout)
+
res = []
self.child.sendline(cmdlines[0])
for line in cmdlines[1:]:
diff --git a/contrib/python/pexpect/pexpect/run.py b/contrib/python/pexpect/pexpect/run.py
index ff288a12461..7dc8856cfd2 100644
--- a/contrib/python/pexpect/pexpect/run.py
+++ b/contrib/python/pexpect/pexpect/run.py
@@ -67,7 +67,7 @@ def run(command, timeout=30, withexitstatus=False, events=None,
contains patterns and responses. Whenever one of the patterns is seen
in the command output, run() will send the associated response string.
So, run() in the above example can be also written as:
-
+
run("mencoder dvd://1 -o video.avi -oac copy -ovc copy",
events=[(TIMEOUT,print_ticks)], timeout=5)
diff --git a/contrib/python/pexpect/pexpect/screen.py b/contrib/python/pexpect/pexpect/screen.py
index 79f95c4e542..b7670cbcd5f 100644
--- a/contrib/python/pexpect/pexpect/screen.py
+++ b/contrib/python/pexpect/pexpect/screen.py
@@ -90,7 +90,7 @@ class screen:
self.encoding = encoding
self.encoding_errors = encoding_errors
if encoding is not None:
- self.decoder = codecs.getincrementaldecoder(encoding)(encoding_errors)
+ self.decoder = codecs.getincrementaldecoder(encoding)(encoding_errors)
else:
self.decoder = None
self.cur_r = 1
diff --git a/contrib/python/pexpect/pexpect/spawnbase.py b/contrib/python/pexpect/pexpect/spawnbase.py
index 59e905764cd..a2d4b54d218 100644
--- a/contrib/python/pexpect/pexpect/spawnbase.py
+++ b/contrib/python/pexpect/pexpect/spawnbase.py
@@ -120,9 +120,9 @@ class SpawnBase(object):
self.async_pw_transport = None
# This is the read buffer. See maxread.
self._buffer = self.buffer_type()
- # The buffer may be trimmed for efficiency reasons. This is the
- # untrimmed buffer, used to create the before attribute.
- self._before = self.buffer_type()
+ # The buffer may be trimmed for efficiency reasons. This is the
+ # untrimmed buffer, used to create the before attribute.
+ self._before = self.buffer_type()
def _log(self, s, direction):
if self.logfile is not None:
diff --git a/contrib/python/pexpect/ya.make b/contrib/python/pexpect/ya.make
index a5bb92fcacb..dfb94c09e52 100644
--- a/contrib/python/pexpect/ya.make
+++ b/contrib/python/pexpect/ya.make
@@ -2,9 +2,9 @@ PY23_LIBRARY()
LICENSE(ISC)
-OWNER(g:python-contrib borman)
+OWNER(g:python-contrib borman)
-VERSION(4.8.0)
+VERSION(4.8.0)
PEERDIR(
contrib/python/ptyprocess
@@ -37,10 +37,10 @@ IF (PYTHON3)
)
ENDIF()
-RESOURCE_FILES(
- PREFIX contrib/python/pexpect/
- .dist-info/METADATA
- .dist-info/top_level.txt
-)
+RESOURCE_FILES(
+ PREFIX contrib/python/pexpect/
+ .dist-info/METADATA
+ .dist-info/top_level.txt
+)
END()