Upgrades flake8 from 1.5 -> 1.6

Also, removes flake8 ignores, since the warnings that were
at odds with eachother now work.
This commit is contained in:
Eddie Hebert
2012-11-19 12:49:09 -05:00
parent 4c3e0d5081
commit 0617e53d69
14 changed files with 56 additions and 54 deletions
+1 -1
View File
@@ -7,6 +7,6 @@ install:
- cat etc/requirements_dev.txt | grep -v "^#" | grep -v "^$" | grep -v ipython | grep -v nose | xargs pip install
- etc/ordered_pip.sh etc/requirements.txt
before_script:
- "flake8 --ignore=E124,E125,E126 zipline tests"
- "flake8 zipline tests"
script:
- nosetests
+1 -1
View File
@@ -117,7 +117,7 @@ The maintainers check the code using the flake8 script,
requirements_dev.txt.
Before submitting patches or pull requests, please ensure that your
changes pass ```flake8 --ignore=E124,E125,E126 zipline tests```
changes pass ```flake8 zipline tests```
Discussion and Help
===================
+1 -1
View File
@@ -18,7 +18,7 @@ changes pass
::
flake8 --ignore=E124,E125,E126 zipline tests
flake8 zipline tests
Discussion and Help
===================
+3 -3
View File
@@ -31,9 +31,9 @@ from zipline.finance.performance import PerformanceTracker
from zipline.utils.protocol_utils import ndict
from zipline.finance.trading import TransactionSimulator
from zipline.utils.test_utils import(
setup_logger,
teardown_logger,
assert_single_position
setup_logger,
teardown_logger,
assert_single_position
)
DEFAULT_TIMEOUT = 15 # seconds
+3 -3
View File
@@ -126,8 +126,8 @@ check treasury and benchmark data in findb, and re-run the test."""
trades[-1]['price'],
"last sale should be same as last trade. \
expected {exp} actual {act}".format(
exp=trades[-1]['price'],
act=pp.positions[1].last_sale_price)
exp=trades[-1]['price'],
act=pp.positions[1].last_sale_price)
)
self.assertEqual(
@@ -565,7 +565,7 @@ shares in position"
'price',
'changed']
perf_tracker = perf.PerformanceTracker(
self.trading_environment
self.trading_environment
)
for event in trade_history:
+5 -6
View File
@@ -763,12 +763,11 @@ class Risk(unittest.TestCase):
"mismatch for total months - \
expected:{total_months}/actual:{actual}, \
period:{period_length}, start:{start_date}, \
calculated end:{end}".format(
total_months=total_months,
period_length=period_length,
start_date=start_date,
end=col[-1].end_date,
actual=len(col))
calculated end:{end}".format(total_months=total_months,
period_length=period_length,
start_date=start_date,
end=col[-1].end_date,
actual=len(col))
)
self.assert_month(start_date.month, col[-1].end_date.month)
self.assert_last_day(col[-1].end_date)
+6 -6
View File
@@ -332,18 +332,18 @@ class TestBatchTransform(TestCase):
for test_history in [algo.history_return_price_class,
algo.history_return_price_decorator]:
np.testing.assert_array_equal(
range(2, 8),
test_history[2].values.flatten()
range(2, 8),
test_history[2].values.flatten()
)
np.testing.assert_array_equal(
range(2, 8),
test_history[3].values.flatten()
range(2, 8),
test_history[3].values.flatten()
)
np.testing.assert_array_equal(
range(4, 12),
test_history[4].values.flatten()
range(4, 12),
test_history[4].values.flatten()
)
def test_passing_of_args(self):
+3 -3
View File
@@ -24,9 +24,9 @@ from zipline.sources import DataFrameSource
from zipline.utils.factory import create_trading_environment
from zipline.transforms.utils import StatefulTransform
from zipline.finance.slippage import (
VolumeShareSlippage,
FixedSlippage,
transact_partial
VolumeShareSlippage,
FixedSlippage,
transact_partial
)
from zipline.finance.commission import PerShare, PerTrade
+7 -7
View File
@@ -389,13 +389,13 @@ class Position(object):
class PerformancePeriod(object):
def __init__(
self,
initial_positions,
starting_value,
starting_cash,
period_open=None,
period_close=None,
keep_transactions=False):
self,
initial_positions,
starting_value,
starting_cash,
period_open=None,
period_close=None,
keep_transactions=False):
self.period_open = period_open
self.period_close = period_close
+4 -4
View File
@@ -107,8 +107,8 @@ class RiskMetricsBase(object):
self.calculate_period_returns(returns)
benchmark_returns = [
x for x in self.trading_environment.benchmark_returns
if x.date >= returns[0].date and x.date <= returns[-1].date
x for x in self.trading_environment.benchmark_returns
if x.date >= returns[0].date and x.date <= returns[-1].date
]
self.benchmark_period_returns, self.benchmark_returns = \
@@ -382,8 +382,8 @@ class RiskMetricsIterative(RiskMetricsBase):
self.trading_days = 0
self.all_benchmark_returns = [
x for x in self.trading_environment.benchmark_returns
if x.date >= self.start_date
x for x in self.trading_environment.benchmark_returns
if x.date >= self.start_date
]
def update(self, returns_in_period):
+6 -5
View File
@@ -42,11 +42,12 @@ def transact_partial(slippage, commission):
def create_transaction(sid, amount, price, dt):
txn = {'sid': sid,
'amount': int(amount),
'dt': dt,
'price': price,
}
txn = {
'sid': sid,
'amount': int(amount),
'dt': dt,
'price': price,
}
transaction = ndict(txn)
return transaction
+5 -5
View File
@@ -37,11 +37,11 @@ def mock_raw_event(sid, dt):
def mock_done(id):
return ndict({
'dt': "DONE",
"source_id": id,
'tnfm_id': id,
'tnfm_value': None,
'type': DATASOURCE_TYPE.DONE
'dt': "DONE",
"source_id": id,
'tnfm_id': id,
'tnfm_value': None,
'type': DATASOURCE_TYPE.DONE
})
done_message = mock_done
+4 -3
View File
@@ -242,9 +242,10 @@ class DataFrameSource(SpecificEquityTrades):
for dt, series in df.iterrows():
if (dt < self.start) or (dt > self.end):
continue
event = {'dt': dt,
'source_id': self.get_hash(),
'type': DATASOURCE_TYPE.TRADE
event = {
'dt': dt,
'source_id': self.get_hash(),
'type': DATASOURCE_TYPE.TRADE
}
for sid, price in series.iterkv():
+7 -6
View File
@@ -19,10 +19,11 @@ from vwap import MovingVWAP
from returns import Returns
from utils import BatchTransform, batch_transform
__all__ = ['MovingAverage',
'MovingStandardDev',
'MovingVWAP',
'Returns',
'BatchTransform',
'batch_transform'
__all__ = [
'MovingAverage',
'MovingStandardDev',
'MovingVWAP',
'Returns',
'BatchTransform',
'batch_transform'
]