Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GHA linting errors #242

Merged
merged 5 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci_tests_quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ jobs:
run: |
brew install ta-lib

- name: Install HDF5 macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install hdf5
brew install c-blosc

- name: Developer Command Prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@v1

Expand Down
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
3 changes: 1 addition & 2 deletions tests/test_memoize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class TestRememberLast:
def test_remember_last(self):

# Store the count in a list so we can mutate it from inside `func`.
call_count = [0]

Expand Down Expand Up @@ -94,4 +93,4 @@ def func(self, x):
while gc.collect():
pass

assert not [inst for inst in gc.get_objects() if type(inst) == clz]
assert not [inst for inst in gc.get_objects() if type(inst) is clz]
Loading