Skip to content

Commit 87db4a4

Browse files
committed
fix and lint for E228 missing space around modulo operator
1 parent d167e37 commit 87db4a4

File tree

17 files changed

+28
-25
lines changed

17 files changed

+28
-25
lines changed

examples/incomplete/wls_extended.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def index_trim_outlier(resid, k):
277277
for i in range(4):
278278
plt.subplot(2,2,i+1)
279279
plt.hist(bootres[:,i],50)
280-
plt.title('var%d'%i)
280+
plt.title('var%d' % i)
281281
#@savefig wls_bootstrap.png
282282
plt.figtext(0.5, 0.935, 'OLS Bootstrap',
283283
ha='center', color='black', weight='bold', size='large')
@@ -316,7 +316,7 @@ def index_trim_outlier(resid, k):
316316
for i in range(4):
317317
plt.subplot(2,2,i+1)
318318
plt.hist(bootreswls[:,i],50)
319-
plt.title('var%d'%i)
319+
plt.title('var%d' % i)
320320
#@savefig wls_bootstrap_rm2.png
321321
plt.figtext(0.5, 0.935, 'WLS rm2 Bootstrap',
322322
ha='center', color='black', weight='bold', size='large')

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ select=
1919
# E114: Indentation is not a multiple of four (comment)
2020
E227,
2121
# E227: missing whitespace around bitwise or shift operator
22+
E228,
23+
# E228: missing whitespace around modulo operator
2224
E211,
2325
# E211: whitespace before '['
2426
E401,

statsmodels/examples/l1_demo/demo.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,16 @@ def get_summary_str(results, true_params, get_l1_slsqp_results,
232232
#### Format summaries
233233
# Short summary
234234
print_str = '\n\n=========== Short Error Summary ============'
235-
print_str += '\n\n The maximum likelihood fit RMS error = %.4f'%RMSE_ML
235+
print_str += '\n\n The maximum likelihood fit RMS error = %.4f' % RMSE_ML
236236
if get_l1_slsqp_results:
237237
RMSE_l1_slsqp = get_RMSE(results_l1_slsqp, true_params)
238-
print_str += '\n The l1_slsqp fit RMS error = %.4f'%RMSE_l1_slsqp
238+
print_str += '\n The l1_slsqp fit RMS error = %.4f' % RMSE_l1_slsqp
239239
if get_l1_cvxopt_results:
240240
RMSE_l1_cvxopt_cp = get_RMSE(results_l1_cvxopt_cp, true_params)
241-
print_str += '\n The l1_cvxopt_cp fit RMS error = %.4f'%RMSE_l1_cvxopt_cp
241+
print_str += '\n The l1_cvxopt_cp fit RMS error = %.4f' % RMSE_l1_cvxopt_cp
242242
# Parameters
243243
print_str += '\n\n\n============== Parameters ================='
244-
print_str += "\n\nTrue parameters: \n%s"%true_params
244+
print_str += "\n\nTrue parameters: \n%s" % true_params
245245
# Full summary
246246
if print_summaries:
247247
print_str += '\n' + results_ML.summary().as_text()
@@ -250,11 +250,11 @@ def get_summary_str(results, true_params, get_l1_slsqp_results,
250250
if get_l1_cvxopt_results:
251251
print_str += '\n' + results_l1_cvxopt_cp.summary().as_text()
252252
else:
253-
print_str += '\n\nThe maximum likelihood params are \n%s'%results_ML.params
253+
print_str += '\n\nThe maximum likelihood params are \n%s' % results_ML.params
254254
if get_l1_slsqp_results:
255-
print_str += '\n\nThe l1_slsqp params are \n%s'%results_l1_slsqp.params
255+
print_str += '\n\nThe l1_slsqp params are \n%s' % results_l1_slsqp.params
256256
if get_l1_cvxopt_results:
257-
print_str += '\n\nThe l1_cvxopt_cp params are \n%s'%\
257+
print_str += '\n\nThe l1_cvxopt_cp params are \n%s' % \
258258
results_l1_cvxopt_cp.params
259259
# Return
260260
return print_str

statsmodels/iolib/tests/test_table_econpy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def custom_labeller(cell):
5858
class TestCell(object):
5959
def test_celldata(self):
6060
celldata = cell0data, cell1data, row1data[0], row1data[1]
61-
cells = [Cell(datum, datatype=i%2) for i, datum in enumerate(celldata)]
61+
cells = [Cell(datum, datatype=i % 2)
62+
for i, datum in enumerate(celldata)]
6263
for cell, datum in zip(cells, celldata):
6364
assert_equal(cell.data, datum)
6465

statsmodels/sandbox/distributions/examples/matchdist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def plothist(x,distfn, args, loc, scale, right=1):
4646

4747
plt.xlabel('Smarts')
4848
plt.ylabel('Probability')
49-
plt.title(r'$\mathrm{Testing: %s :}\ \mu=%f,\ \sigma=%f$'%(distfn.name,loc,scale))
49+
plt.title(r'$\mathrm{Testing: %s :}\ \mu=%f,\ \sigma=%f$' % (distfn.name,loc,scale))
5050

5151
#plt.axis([bins[0], bins[-1], 0, 0.134+0.05])
5252

statsmodels/sandbox/examples/ex_onewaygls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def print_results(res):
7070
## else:
7171
## print ''
7272
from statsmodels.iolib import SimpleTable
73-
print(SimpleTable([(['%r'%(row[0],)]
73+
print(SimpleTable([(['%r' % (row[0],)]
7474
+ list(row[1])
7575
+ ['*']*(row[1][1]>0.5).item() ) for row in ft[1]],
7676
headers=['pair', 'F-statistic','p-value','df_denom',
@@ -148,7 +148,7 @@ def print_results2(res):
148148

149149
from statsmodels.iolib import SimpleTable
150150
resvals = {}
151-
resvals['tab'] = str(SimpleTable([(['%r'%(row[0],)]
151+
resvals['tab'] = str(SimpleTable([(['%r' % (row[0],)]
152152
+ list(row[1])
153153
+ ['*']*(row[1][1]>0.5).item() ) for row in ft[1]],
154154
headers=['pair', 'F-statistic','p-value','df_denom',

statsmodels/sandbox/examples/try_quantile_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
plt.figure()
4141
plt.plot(y[sortidx], 'o', alpha=0.75)
4242
for lab, beta in zip(['ols', 'qr 0.25', 'qr 0.5', 'qr 0.75'], params):
43-
print('%-8s'%lab, np.round(beta, 4))
43+
print('%-8s' % lab, np.round(beta, 4))
4444
fitted = np.dot(x_sorted, beta)
4545
lw = 2 if lab == 'ols' else 1
4646
plt.plot(fitted, lw=lw, label=lab)

statsmodels/sandbox/examples/try_quantile_regression1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
plt.figure()
3636
plt.plot(x, y, '.', alpha=0.5)
3737
for lab, beta in zip(['ols', 'qr 0.1', 'qr 0.5', 'qr 0.75'], params):
38-
print('%-8s'%lab, np.round(beta, 4))
38+
print('%-8s' % lab, np.round(beta, 4))
3939
fitted = np.dot(exog, beta)
4040
lw = 2
4141
plt.plot(x, fitted, lw=lw, label=lab)

statsmodels/sandbox/regression/onewaygls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def print_summary(self, res):
335335

336336
from statsmodels.iolib import SimpleTable
337337
resvals = {}
338-
resvals['tab'] = str(SimpleTable([(['%r'%(row[0],)]
338+
resvals['tab'] = str(SimpleTable([(['%r' % (row[0],)]
339339
+ list(row[1])
340340
+ ['*']*(row[1][1]>0.5).item() ) for row in summtable],
341341
headers=['pair', 'F-statistic','p-value','df_denom',

statsmodels/sandbox/regression/try_catdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def convertlabels(ys, indices=None):
8585
else:
8686
idx = np.array(indices)
8787
if idx.size > 1 and ys.ndim == 2:
88-
ylabel = np.array(['@%s@'%ii[:2].tostring() for ii in ys])[:,np.newaxis]
88+
ylabel = np.array(['@%s@' % ii[:2].tostring() for ii in ys])[:,np.newaxis]
8989
#alternative
9090
## if ys[:,idx].dtype.kind == 'S':
9191
## ylabel = nd.array([' '.join(ii[:2]) for ii in ys])[:,np.newaxis]

0 commit comments

Comments
 (0)