Skip to content

Commit

Permalink
Upgrade flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
hackdna committed Nov 21, 2024
1 parent ae6f171 commit 3491ca5
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
exclude = .venv
8 changes: 4 additions & 4 deletions forest/bonsai/tests/test_simulate_gps_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def test_get_path_close_locations(coords1, coords3):
== 2)


@pytest.fixture()
@pytest.fixture
def random_path(directions1, coords1, coords2):
lat1, lon1 = coords1
lat2, lon2 = coords2
Expand Down Expand Up @@ -507,7 +507,7 @@ def test_person_office_days(sample_coordinates, sample_locations,
assert len(random_person.office_days) <= 5


@pytest.fixture()
@pytest.fixture
def sample_person(sample_coordinates, sample_locations, sample_attributes):
user_attrs = sample_attributes["User 5"]
attributes = Attributes(**user_attrs)
Expand Down Expand Up @@ -804,7 +804,7 @@ def test_gen_all_traj_dist_travelled(sample_person, mocker):
assert np.all(total_d_list >= 0)


@pytest.fixture()
@pytest.fixture
def generated_trajectory(sample_person, mocker):
mocker.patch(
"forest.bonsai.simulate_gps_data.get_path", side_effect=mock_get_path
Expand Down Expand Up @@ -869,7 +869,7 @@ def test_load_attributes_switches(sample_attributes):
assert switches[5]["travelling_status-20"] == 1


@pytest.fixture()
@pytest.fixture
def sample_addresses():
return np.array(
[
Expand Down
14 changes: 7 additions & 7 deletions forest/jasmine/tests/test_traj2stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
)


@pytest.fixture()
@pytest.fixture
def coords1():
return 51.457183, -2.597960


@pytest.fixture()
@pytest.fixture
def coords2():
return 51.457267, -2.598045

Expand Down Expand Up @@ -54,7 +54,7 @@ def test_transform_point_to_circle_radius(coords1):
assert 4 <= distance <= 5


@pytest.fixture()
@pytest.fixture
def sample_trajectory():
"""16 minutes of a random trajectory"""
return np.array(
Expand Down Expand Up @@ -153,7 +153,7 @@ def sample_trajectory():
)


@pytest.fixture()
@pytest.fixture
def sample_nearby_locations():
ids = {
"post_box": [560374554],
Expand Down Expand Up @@ -480,7 +480,7 @@ def test_gps_summaries_pcr(
assert summary["physical_circadian_rhythm_stratified"].iloc[1] == 0


@pytest.fixture()
@pytest.fixture
def mobmat1():
"""mobility matrix 1"""
return np.array(
Expand All @@ -494,7 +494,7 @@ def mobmat1():
)


@pytest.fixture()
@pytest.fixture
def mobmat2():
"""mobility matrix 2"""
return np.array(
Expand All @@ -508,7 +508,7 @@ def mobmat2():
)


@pytest.fixture()
@pytest.fixture
def mobmat3():
"""mobility matrix 3"""
return np.array(
Expand Down
2 changes: 1 addition & 1 deletion forest/oak/tests/test_preprocess_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from forest.oak.base import preprocess_dates


@pytest.fixture()
@pytest.fixture
def sample_file_list():
return [
'2023-11-01 00_00_00+00_00.csv', '2023-11-01 01_00_00+00_00.csv',
Expand Down
2 changes: 1 addition & 1 deletion forest/oak/tests/test_run_hourly.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from forest.constants import Frequency


@pytest.fixture()
@pytest.fixture
def sample_run_input(signal_bout):
t_hours_pd = pd.Series(pd.to_datetime([
"2020-02-25 08:00:00-05:00",
Expand Down
2 changes: 1 addition & 1 deletion forest/poplar/tests/test_poplar_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_get_files_timestamps():
# Testing functions in forest.poplar.functions.helpers


@pytest.fixture()
@pytest.fixture
def gps_df():
return read_data("idr8gqdh", TEST_DATA_DIR, "gps", "America/New_York",
time_start=[2021, 12, 15, 20, 9, 50],
Expand Down
6 changes: 3 additions & 3 deletions forest/sycamore/tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@
SEP_QS_DIR = os.path.join(TEST_DATA_DIR, "dir_with_seps_in_qs")


@pytest.fixture()
@pytest.fixture
def agg_data_config():
return aggregate_surveys_config(SAMPLE_DIR, SURVEY_SETTINGS_PATH,
"UTC", users=["16au2moz", "idr8gqdh"])


@pytest.fixture()
@pytest.fixture
def agg_data_no_config():
return aggregate_surveys_no_config(SAMPLE_DIR, study_tz="UTC",
users=["16au2moz", "idr8gqdh"])


@pytest.fixture()
@pytest.fixture
def submits_data():
agg_data = aggregate_surveys_config(
SAMPLE_DIR, SURVEY_SETTINGS_PATH_FOR_SUBMITS, study_tz="UTC",
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Homepage = "https://github.com/onnela-lab/forest"
[project.optional-dependencies]
dev = [
"build",
"flake8==6.1.0",
"flake8-pytest-style==1.7.2",
"flake8",
"flake8-pytest-style",
"mypy==1.6.1",
"pytest==7.4.3",
"pytest-mock==3.12.0",
Expand Down

0 comments on commit 3491ca5

Please sign in to comment.