Skip to content

Commit

Permalink
MNT: fix line length in all relevant files
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Dec 21, 2023
1 parent aef3668 commit b25f387
Show file tree
Hide file tree
Showing 12 changed files with 475 additions and 277 deletions.
34 changes: 23 additions & 11 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,29 @@ def pytest_addoption(parser):
)
parser.addoption(
"--slow", action="store_true", default=False,
help="run very slow tests too: this may take 30 minutes or more and will may multiple"
"hundred requests to the api server - usage is highly discouraged"
help="run very slow tests too: this may take 30 minutes or more and "
"will make multiple hundred requests to the api server - usage "
"is highly discouraged"
)


def pytest_configure(config):
config.addinivalue_line("markers", "f1telapi: test connects to the f1 telemetry api")
config.addinivalue_line("markers", "ergastapi: test connects to the ergast api")
config.addinivalue_line("markers", "prjdoc: general non-code tests for project and structure")
config.addinivalue_line("markers", "slow: extremely slow tests (multiple minutes)")
config.addinivalue_line("markers",
"f1telapi: test connects to the f1 telemetry api")
config.addinivalue_line("markers",
"ergastapi: test connects to the ergast api")
config.addinivalue_line("markers",
"prjdoc: general non-code tests for project and "
"structure")
config.addinivalue_line("markers",
"slow: extremely slow tests (multiple minutes)")


def pytest_collection_modifyitems(config, items):
# cli conditional skip extremely slow tests
if not config.getoption("--slow"):
skip_slow = pytest.mark.skip(reason="need --slow option to run; usage highly discouraged")
skip_slow = pytest.mark.skip(reason="need --slow option to run; "
"usage highly discouraged")
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)
Expand All @@ -52,23 +59,28 @@ def pytest_collection_modifyitems(config, items):

# cli conditional skip test that connect to the ergast api
if not config.getoption("--ergast-api"):
skip_ergast = pytest.mark.skip(reason="need --ergast-api option to run")
skip_ergast = pytest.mark.skip(reason="need --ergast-api option to "
"run")
for item in items:
if "ergastapi" in item.keywords:
item.add_marker(skip_ergast)

# lint only: skip all
if config.getoption('--lint-only'):
items[:] = [item for item in items if item.get_closest_marker('flake8')]
items[:] = [item for item in items
if item.get_closest_marker('flake8')]

# only test documentation and project structure
if config.getoption('--prj-doc'):
skip_non_prj = pytest.mark.skip(reason="--prj-doc given: run only project structure and documentation tests")
skip_non_prj = pytest.mark.skip(reason="--prj-doc given: run only "
"project structure and "
"documentation tests")
for item in items:
if "prjdoc" not in item.keywords:
item.add_marker(skip_non_prj)
else:
skip_prj = pytest.mark.skip(reason="need --prj-doc to run project structure and documentation tests")
skip_prj = pytest.mark.skip(reason="need --prj-doc to run project "
"structure and documentation tests")
for item in items:
if "prjdoc" in item.keywords:
item.add_marker(skip_prj)
Expand Down
3 changes: 2 additions & 1 deletion examples/plot_gear_shifts_on_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
# Add a colorbar to the plot. Shift the colorbar ticks by +0.5 so that they
# are centered for each color segment.

cbar = plt.colorbar(mappable=lc_comp, label="Gear", boundaries=np.arange(1, 10))
cbar = plt.colorbar(mappable=lc_comp, label="Gear",
boundaries=np.arange(1, 10))
cbar.set_ticks(np.arange(1.5, 9.5))
cbar.set_ticklabels(np.arange(1, 9))

Expand Down
7 changes: 5 additions & 2 deletions examples/plot_qualifying_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@


# we only want support for timedelta plotting in this example
fastf1.plotting.setup_mpl(mpl_timedelta_support=True, color_scheme=None, misc_mpl_mods=False)
fastf1.plotting.setup_mpl(mpl_timedelta_support=True, color_scheme=None,
misc_mpl_mods=False)

session = fastf1.get_session(2021, 'Spanish Grand Prix', 'Q')
session.load()
Expand All @@ -37,7 +38,9 @@
for drv in drivers:
drvs_fastest_lap = session.laps.pick_driver(drv).pick_fastest()
list_fastest_laps.append(drvs_fastest_lap)
fastest_laps = Laps(list_fastest_laps).sort_values(by='LapTime').reset_index(drop=True)
fastest_laps = Laps(list_fastest_laps) \
.sort_values(by='LapTime') \
.reset_index(drop=True)


##############################################################################
Expand Down
9 changes: 6 additions & 3 deletions examples/plot_speed_on_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@

# After this, we plot the data itself.
# Create background track line
ax.plot(lap.telemetry['X'], lap.telemetry['Y'], color='black', linestyle='-', linewidth=16, zorder=0)
ax.plot(lap.telemetry['X'], lap.telemetry['Y'],
color='black', linestyle='-', linewidth=16, zorder=0)

# Create a continuous norm to map from data points to colors
norm = plt.Normalize(color.min(), color.max())
lc = LineCollection(segments, cmap=colormap, norm=norm, linestyle='-', linewidth=5)
lc = LineCollection(segments, cmap=colormap, norm=norm,
linestyle='-', linewidth=5)

# Set the values used for colormapping
lc.set_array(color)
Expand All @@ -73,7 +75,8 @@
# Finally, we create a color bar as a legend.
cbaxes = fig.add_axes([0.25, 0.05, 0.5, 0.05])
normlegend = mpl.colors.Normalize(vmin=color.min(), vmax=color.max())
legend = mpl.colorbar.ColorbarBase(cbaxes, norm=normlegend, cmap=colormap, orientation="horizontal")
legend = mpl.colorbar.ColorbarBase(cbaxes, norm=normlegend, cmap=colormap,
orientation="horizontal")


# Show the plot
Expand Down
Loading

0 comments on commit b25f387

Please sign in to comment.