Skip to content

Commit a1f7fcd

Browse files
committed
ruff formatting
1 parent 696485f commit a1f7fcd

File tree

11 files changed

+11
-23
lines changed

11 files changed

+11
-23
lines changed

docs/conf.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#
1414
import os
1515
import sys
16-
import sphinx_rtd_theme
1716

1817
sys.path.insert(0, os.path.abspath(".."))
1918

examples/agent_agent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def spread_virus_to_neighbors(self):
5555
maxx=self.model.xmax,
5656
maxy=self.model.ymax,
5757
grid="orthogonal",
58-
search_ids=np.where(self.infected == True)[0],
58+
search_ids=np.where(self.infected)[0],
5959
).ravel()
6060
neighbors = neighbors[neighbors != -1]
6161
to_infect = neighbors[~self.vaccinated[neighbors]]

examples/agent_environment.py

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def set_locations(self):
3939
def step(self):
4040
values_from_array = sample_from_map(MAP, self.locations, MAP_GEOTRANSFORM)
4141
values_from_GTiff = self.data.sample_coords(self.locations)
42+
print(values_from_array)
43+
print(values_from_GTiff)
4244

4345

4446
class Agents(AgentBaseClass):

honeybees/argparse.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
"--GUI",
1010
dest="GUI",
1111
action="store_true",
12-
help=f"The model can be run with or without a visual interface. The visual interface is useful to display the results in real-time while the model is running and to better understand what is going on. You can simply start or stop the model with the click of a buttion, or advance the model by an `x` number of timesteps. However, the visual interface is much slower than running the model without it.",
12+
help="The model can be run with or without a visual interface. The visual interface is useful to display the results in real-time while the model is running and to better understand what is going on. You can simply start or stop the model with the click of a buttion, or advance the model by an `x` number of timesteps. However, the visual interface is much slower than running the model without it.",
1313
)
1414
parser.set_defaults(GUI=False)
1515
parser.add_argument(
1616
"--no-browser",
1717
dest="browser",
1818
action="store_false",
19-
help=f"Do not open browser when running the model. This option is, for example, useful when running the model on a server, and you would like to remotely access the model.",
19+
help="Do not open browser when running the model. This option is, for example, useful when running the model on a server, and you would like to remotely access the model.",
2020
)
2121
parser.set_defaults(browser=True)
2222
default_port = 8521

honeybees/library/mapIO.py

-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ def get_source_gt(self) -> None:
3030
"""Get Geotransformation of the source file. Must be implemented in the child class."""
3131
raise NotImplementedError
3232

33-
def get_data_array(self) -> None:
34-
"""Read data array. Must be implemented in child class."""
35-
raise NotImplementedError
36-
3733
def set_window_and_gt(self) -> None:
3834
"""This function gets the geotransformation (gt) of the cut map, and the rows to read from the original data (rowslice, colslice)."""
3935
gt_ds = self.get_source_gt()

honeybees/model.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from datetime import timedelta
33
from dateutil.relativedelta import relativedelta
4-
from time import time
54
import logging
65
import yaml
76

@@ -203,13 +202,13 @@ def step(self, step_size=1, report=True):
203202

204203
assert isinstance(n, int) and n > 0
205204
for _ in range(n):
206-
t0 = time()
205+
# t0 = time()
207206
# print('Simulating agent behavior')
208207
self.agents.step()
209-
t1 = time()
208+
# t1 = time()
210209
if report:
211210
self.reporter.step()
212-
t2 = time()
211+
# t2 = time()
213212
# print('\tstep time', t1- t0)
214213
# print('\treport time', t2 - t1)
215214

honeybees/reporter.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from collections.abc import Iterable
2424
import os
2525
import numpy as np
26-
from pathlib import Path
2726

2827
try:
2928
import cupy as cp

honeybees/visualization/UserParam.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(
7575
valid = True
7676

7777
if self.param_type == self.NUMBER:
78-
valid = not (self.value is None)
78+
valid = self.value is not None
7979

8080
elif self.param_type == self.SLIDER:
8181
valid = not (

honeybees/visualization/canvas.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22
import math
3-
from typing import Type
43
from honeybees.visualization.ModularVisualization import VisualizationElement
54
import numpy as np
65
from PIL import Image
@@ -175,11 +174,11 @@ def get_static_space_state(self, model):
175174
if isinstance(geojsons, (list, tuple)):
176175
for geojson in geojsons:
177176
assert isinstance(geojson, dict)
178-
if not "properties" in geojson:
177+
if "properties" not in geojson:
179178
raise ValueError(
180179
f"Geojson for {name} has not properties"
181180
)
182-
if not "id" in geojson["properties"]:
181+
if "id" not in geojson["properties"]:
183182
raise ValueError(f"Geojson for {name} has not ID")
184183
ID = geojson["properties"]["id"]
185184
if ID in used_IDs:

honeybees/visualization/modules/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@
22
"""
33
Container for all built-in visualization modules.
44
"""
5-
6-
from honeybees.visualization.modules.ChartVisualization import ChartModule

tests/library/test_neighbors.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# -*- coding: utf-8 -*-
22
import numpy as np
3-
import matplotlib.pyplot as plt
43
import pytest
5-
import os
6-
import numpy as np
74
from numba import njit
85

96
import matplotlib.patches as mpatches
107
from honeybees.library import geohash
11-
from honeybees.library.raster import coord_to_pixel
128
from honeybees.library.neighbors import find_neighbors
139

1410

0 commit comments

Comments
 (0)