Skip to content

Commit

Permalink
Fix precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-cty committed Oct 14, 2023
1 parent f7eea7e commit 2679dbf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 2 additions & 1 deletion codecarbon/emissions_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ def _measure_power_and_energy(self) -> None:
self._do_measurements()
self._last_measured_time = time.time()
self._measure_occurrence += 1
if (len(self._output_handlers) > 0
if (
len(self._output_handlers) > 0
and self._api_call_interval != -1
and self._measure_occurrence >= self._api_call_interval
):
Expand Down
13 changes: 5 additions & 8 deletions tests/test_custom_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
import unittest
from typing import List

from codecarbon.emissions_tracker import (
EmissionsTracker,
track_emissions,
)
from codecarbon.output import (
BaseOutput, EmissionsData,
)
from codecarbon.emissions_tracker import EmissionsTracker, track_emissions
from codecarbon.output import BaseOutput, EmissionsData


def heavy_computation(run_time_secs: int = 3):
Expand Down Expand Up @@ -65,7 +60,9 @@ def dummy_train_model():
self.verify_custom_handler_state(handler_0)
self.verify_custom_handler_state(handler_1)

def verify_custom_handler_state(self, handler: CustomOutput, expected_lines=1) -> None:
def verify_custom_handler_state(
self, handler: CustomOutput, expected_lines=1
) -> None:
assert len(handler.log) == expected_lines
results = handler.log[0]
self.assertEqual(results.project_name, self.project_name)
Expand Down

0 comments on commit 2679dbf

Please sign in to comment.