Skip to content

Commit

Permalink
fixed flake8 lint errors due to version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-jansen committed Mar 14, 2024
1 parent 4a648f6 commit 5f62951
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
hooks:
- id: black
additional_dependencies: ['click==8.0.4']
language_version: python3.9
language_version: python3.11
- repo: https://github.com/PyCQA/flake8
rev: '6.0.0'
hooks:
Expand Down
2 changes: 1 addition & 1 deletion src/zipline/currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def name(self):
return self._name

def __eq__(self, other):
if type(self) != type(other):
if type(self) is not type(other):
return NotImplemented
return self.code == other.code

Expand Down
5 changes: 2 additions & 3 deletions src/zipline/finance/trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ def __init__(
data_frequency="daily",
arena="backtest",
):

assert type(start_session) == pd.Timestamp
assert type(end_session) == pd.Timestamp
assert type(start_session) is pd.Timestamp
assert type(end_session) is pd.Timestamp

assert trading_calendar is not None, "Must pass in trading calendar!"
assert start_session <= end_session, "Period start falls after period end."
Expand Down
4 changes: 2 additions & 2 deletions src/zipline/testing/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def check_allclose(actual, desired, rtol=1e-07, atol=0, err_msg="", verbose=True
--------
np.assert_allclose
"""
if type(actual) != type(desired):
if type(actual) is not type(desired):
raise AssertionError("%s != %s" % (type(actual), type(desired)))
return assert_allclose(
actual,
Expand All @@ -313,7 +313,7 @@ def check_arrays(x, y, err_msg="", verbose=True, check_dtypes=True):
--------
np.assert_array_equal
"""
assert type(x) == type(y), "{x} != {y}".format(x=type(x), y=type(y))
assert type(x) is type(y), "{x} != {y}".format(x=type(x), y=type(y))
assert x.dtype == y.dtype, "{x.dtype} != {y.dtype}".format(x=x, y=y)

if isinstance(x, LabelArray):
Expand Down
1 change: 0 additions & 1 deletion src/zipline/testing/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,6 @@ class level fixtures.

BCOLZ_DAILY_BAR_PATH = "daily_equity_pricing.bcolz"
BCOLZ_DAILY_BAR_READ_ALL_THRESHOLD = None
BCOLZ_DAILY_BAR_COUNTRY_CODE = None
EQUITY_DAILY_BAR_SOURCE_FROM_MINUTE = False
# allows WithBcolzEquityDailyBarReaderFromCSVs to call the
# `write_csvs`method without needing to reimplement `init_class_fixtures`
Expand Down
2 changes: 1 addition & 1 deletion src/zipline/testing/predicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def assert_timestamp_and_datetime_equal(
Returns raises unless ``allow_datetime_coercions`` is passed as True.
"""
assert allow_datetime_coercions or type(result) == type(expected), (
assert allow_datetime_coercions or type(result) is type(expected), (
"%sdatetime types (%s, %s) don't match and "
"allow_datetime_coercions was not set.\n%s"
% (
Expand Down
4 changes: 2 additions & 2 deletions src/zipline/utils/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create_simulation_parameters(

if start is None:
start = pd.Timestamp(f"{year}-01-01", tz="UTC")
elif type(start) == datetime:
elif type(start) is datetime:
start = pd.Timestamp(start)

if end is None:
Expand All @@ -51,7 +51,7 @@ def create_simulation_parameters(
end = trading_calendar.sessions[start_index + num_days - 1]
else:
end = pd.Timestamp(f"{year}-12-31", tz="UTC")
elif type(end) == datetime:
elif type(end) is datetime:
end = pd.Timestamp(end)

sim_params = SimulationParameters(
Expand Down

0 comments on commit 5f62951

Please sign in to comment.