Skip to content

Commit 7d97ef9

Browse files
committed
remove python2 future imports
1 parent 2123d52 commit 7d97ef9

15 files changed

+14
-51
lines changed

control/delay.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#
4343
# $Id$
4444

45-
from __future__ import division
4645

4746
__all__ = ['pade']
4847

control/frdata.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
# Author: M.M. (Rene) van Paassen (using xferfcn.py as basis)
3636
# Date: 02 Oct 12
3737

38-
from __future__ import division
3938

4039
"""
4140
Frequency response data representation and functions.

control/margins.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
margins.margin
1010
"""
1111

12-
# Python 3 compatibility (needs to go here)
13-
from __future__ import print_function
14-
1512
"""Copyright (c) 2011 by California Institute of Technology
1613
All rights reserved.
1714

control/modelsimp.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
#
4141
# $Id$
4242

43-
# Python 3 compatibility
44-
from __future__ import print_function
45-
4643
# External packages and modules
4744
import numpy as np
4845
import warnings

control/phaseplot.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3535
# POSSIBILITY OF SUCH DAMAGE.
3636

37-
# Python 3 compatibility
38-
from __future__ import print_function
39-
4037
import numpy as np
4138
import matplotlib.pyplot as mpl
4239

control/statesp.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
99
"""
1010

11-
# Python 3 compatibility (needs to go here)
12-
from __future__ import print_function
13-
from __future__ import division # for _convert_to_statespace
14-
1511
"""Copyright (c) 2010 by California Institute of Technology
1612
All rights reserved.
1713

control/tests/convert_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
1515
"""
1616

17-
from __future__ import print_function
18-
from warnings import warn
1917

2018
import numpy as np
2119
import pytest

control/tests/delay_test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Primitive; ideally test to numerical limits
55
"""
66

7-
from __future__ import division
8-
97
import numpy as np
108
import pytest
119

@@ -94,4 +92,3 @@ def testT0(self):
9492
np.array(refnum), np.array(num))
9593
np.testing.assert_array_almost_equal_nulp(
9694
np.array(refden), np.array(den))
97-

control/tests/iosys_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
created for that purpose.
99
"""
1010

11-
from __future__ import print_function
1211
import re
1312

1413
import numpy as np
1514
import pytest
16-
import scipy as sp
1715

1816
import control as ct
1917
from control import iosys as ios
@@ -1270,7 +1268,7 @@ def test_lineariosys_statespace(self, tsys):
12701268
(2, 2, 'rss', ct.LinearIOSystem.__rsub__, 2, 2),
12711269
(2, 2, 2, ct.LinearIOSystem.__rsub__, 2, 2),
12721270
(2, 2, np.random.rand(2, 2), ct.LinearIOSystem.__rsub__, 2, 2),
1273-
1271+
12741272
])
12751273
def test_operand_conversion(self, Pout, Pin, C, op, PCout, PCin):
12761274
P = ct.LinearIOSystem(

control/tests/margin_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
BG, 30 Jun 2020 -- convert to pytest, gh-425
77
BG, 16 Nov 2020 -- pick from gh-438 and add discrete test
88
"""
9-
from __future__ import print_function
109

1110
import numpy as np
1211
import pytest

control/xferfcn.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
for the python-control library.
88
"""
99

10-
# Python 3 compatibility (needs to go here)
11-
from __future__ import print_function
12-
from __future__ import division
13-
1410
"""Copyright (c) 2010 by California Institute of Technology
1511
All rights reserved.
1612

doc/pvtol-nested.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,5 @@ Code
1717
Notes
1818
.....
1919

20-
1. Importing `print_function` from `__future__` in line 11 is only
21-
required if using Python 2.7.
22-
23-
2. The environment variable `PYCONTROL_TEST_EXAMPLES` is used for
20+
1. The environment variable `PYCONTROL_TEST_EXAMPLES` is used for
2421
testing to turn off plotting of the outputs.

examples/check-controllability-and-observability.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
RMM, 6 Sep 2010
55
"""
66

7-
from __future__ import print_function
8-
97
import numpy as np # Load the scipy functions
108
from control.matlab import * # Load the controls systems library
119

examples/pvtol-nested.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
# package.
99
#
1010

11-
from __future__ import print_function
12-
1311
import os
1412
import matplotlib.pyplot as plt # MATLAB plotting functions
1513
from control.matlab import * # MATLAB-like functions
@@ -30,7 +28,7 @@
3028
# Inner loop control design
3129
#
3230
# This is the controller for the pitch dynamics. Goal is to have
33-
# fast response for the pitch dynamics so that we can use this as a
31+
# fast response for the pitch dynamics so that we can use this as a
3432
# control for the lateral dynamics
3533
#
3634

@@ -40,7 +38,7 @@
4038
Li = Pi*Ci
4139

4240
# Bode plot for the open loop process
43-
plt.figure(1)
41+
plt.figure(1)
4442
bode(Pi)
4543

4644
# Bode plot for the loop transfer function, with margins
@@ -137,7 +135,7 @@
137135
# Add a box in the region we are going to expand
138136
plt.plot([-2, -2, 1, 1, -2], [-4, 4, 4, -4, -4], 'r-')
139137

140-
# Expanded region
138+
# Expanded region
141139
plt.figure(8)
142140
plt.clf()
143141
nyquist(L)

examples/tfvis.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/usr/bin/python
22
# needs pmw (in pypi, conda-forge)
3-
# For Python 2, needs future (in conda pypi and "default")
4-
5-
from __future__ import print_function
63

74
""" Simple GUI application for visualizing how the poles/zeros of the transfer
85
function effects the bode, nyquist and step response of a SISO system """
@@ -20,7 +17,7 @@
2017
notice, this list of conditions and the following disclaimer in the
2118
documentation and/or other materials provided with the distribution.
2219
23-
3. Neither the name of the project author nor the names of its
20+
3. Neither the name of the project author nor the names of its
2421
contributors may be used to endorse or promote products derived
2522
from this software without specific prior written permission.
2623
@@ -146,7 +143,7 @@ def set_poles(self, poles):
146143
self.denominator = make_poly(poles)
147144
self.denominator_widget.setentry(
148145
' '.join([format(i,'.3g') for i in self.denominator]))
149-
146+
150147
def set_zeros(self, zeros):
151148
""" Set the zeros to the new positions"""
152149
self.numerator = make_poly(zeros)
@@ -208,7 +205,7 @@ def __init__(self, parent):
208205
self.canvas_step.get_tk_widget().grid(row=1, column=0,
209206
padx=0, pady=0)
210207

211-
self.canvas_nyquist = FigureCanvasTkAgg(self.f_nyquist,
208+
self.canvas_nyquist = FigureCanvasTkAgg(self.f_nyquist,
212209
master=self.figure)
213210
self.canvas_nyquist.draw()
214211
self.canvas_nyquist.get_tk_widget().grid(row=1, column=1,
@@ -221,7 +218,7 @@ def __init__(self, parent):
221218
self.canvas_pzmap.mpl_connect('motion_notify_event',
222219
self.mouse_move)
223220

224-
self.apply()
221+
self.apply()
225222

226223
def button_press(self, event):
227224
""" Handle button presses, detect if we are going to move
@@ -276,12 +273,12 @@ def button_release(self, event):
276273
self.zeros = tfcn.zero()
277274
self.poles = tfcn.pole()
278275
self.sys = tfcn
279-
self.redraw()
276+
self.redraw()
280277

281278
def mouse_move(self, event):
282279
""" Handle mouse movement, redraw pzmap while drag/dropping """
283280
if (self.move_zero != None and
284-
event.xdata != None and
281+
event.xdata != None and
285282
event.ydata != None):
286283

287284
if (self.index1 == self.index2):
@@ -320,7 +317,7 @@ def apply(self):
320317
self.zeros = tfcn.zero()
321318
self.poles = tfcn.pole()
322319
self.sys = tfcn
323-
self.redraw()
320+
self.redraw()
324321

325322
def draw_pz(self, tfcn):
326323
"""Draw pzmap"""
@@ -338,7 +335,7 @@ def draw_pz(self, tfcn):
338335
def redraw(self):
339336
""" Redraw all diagrams """
340337
self.draw_pz(self.sys)
341-
338+
342339
self.f_bode.clf()
343340
plt.figure(self.f_bode.number)
344341
control.matlab.bode(self.sys, logspace(-2, 2, 1000))
@@ -376,7 +373,7 @@ def handler():
376373
# Launch a GUI for the Analysis module
377374
root = tkinter.Tk()
378375
root.protocol("WM_DELETE_WINDOW", handler)
379-
Pmw.initialise(root)
376+
Pmw.initialise(root)
380377
root.title('Analysis of Linear Systems')
381378
Analysis(root)
382379
root.mainloop()

0 commit comments

Comments
 (0)