From 989087cea7cad0c77559e72ea9545bd950c97905 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:30:00 +0000 Subject: [PATCH 1/6] Initial plan From c18d36b6b44ffc1e5c408285de31986e0cc8bca0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:34:56 +0000 Subject: [PATCH 2/6] Support multiple car IOG slots - update config and fetch logic Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com> --- apps/predbat/config.py | 6 +-- apps/predbat/fetch.py | 120 +++++++++++++++++++++++------------------ 2 files changed, 72 insertions(+), 54 deletions(-) diff --git a/apps/predbat/config.py b/apps/predbat/config.py index 77a85cdbc..de8bdf5fc 100644 --- a/apps/predbat/config.py +++ b/apps/predbat/config.py @@ -2006,9 +2006,9 @@ "car_charging_limit": {"type": "sensor", "sensor_type": "float", "entries": "num_cars"}, "car_charging_exclusive": {"type": "boolean_list", "entries": "num_cars"}, "carbon_intensity": {"type": "sensor", "sensor_type": "string"}, - "octopus_intelligent_slot": {"type": "sensor", "sensor_type": "boolean|action"}, - "octopus_ready_time": {"type": "sensor", "sensor_type": "string"}, - "octopus_charge_limit": {"type": "sensor", "sensor_type": "float"}, + "octopus_intelligent_slot": {"type": "sensor|sensor_list", "sensor_type": "boolean|action", "entries": "num_cars"}, + "octopus_ready_time": {"type": "sensor|sensor_list", "sensor_type": "string", "entries": "num_cars"}, + "octopus_charge_limit": {"type": "sensor|sensor_list", "sensor_type": "float", "entries": "num_cars"}, "octopus_slot_low_rate": {"type": "boolean"}, "octopus_slot_max": {"type": "integer"}, "octopus_saving_session_octopoints_per_penny": {"type": "integer"}, diff --git a/apps/predbat/fetch.py b/apps/predbat/fetch.py index 98470eaec..8db6bf5c3 100644 --- a/apps/predbat/fetch.py +++ b/apps/predbat/fetch.py @@ -614,41 +614,51 @@ def fetch_sensor_data(self, save=True): # Work out current car SoC and limit self.car_charging_loss = 1 - float(self.get_arg("car_charging_loss")) - entity_id = self.get_arg("octopus_intelligent_slot", indirect=False) + # Get octopus intelligent slot configuration - could be single value or list for multiple cars + entity_id_config = self.get_arg("octopus_intelligent_slot", indirect=False) ohme_automatic = self.get_arg("ohme_automatic", False) - if entity_id: - completed = [] - planned = [] - - if entity_id and "octopus_intelligent_slot_action_config" in self.args: - config_entry = self.get_arg("octopus_intelligent_slot_action_config", None, indirect=False) - service_name = entity_id.replace(".", "/") - result = self.call_service_wrapper(service_name, config_entry=config_entry, return_response=True) - if result and ("slots" in result): - planned = result["slots"] - else: - self.log("Warn: Unable to get data from {} - octopus_intelligent_slot using action config {}, result was {}".format(entity_id, config_entry, result)) - else: - try: - completed = self.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or self.get_state_wrapper(entity_id=entity_id, attribute="completedDispatches") - planned = self.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or self.get_state_wrapper(entity_id=entity_id, attribute="plannedDispatches") - except (ValueError, TypeError): - self.log("Warn: Unable to get data from {} - octopus_intelligent_slot may not be set correctly in apps.yaml".format(entity_id)) - self.record_status(message="Error: octopus_intelligent_slot not set correctly in apps.yaml", had_errors=True) + # Normalize to list for multi-car support + if entity_id_config and not isinstance(entity_id_config, list): + entity_id_list = [entity_id_config] + elif entity_id_config: + entity_id_list = entity_id_config + else: + entity_id_list = [] - # Completed and planned slots - if completed: - self.octopus_slots += completed - if planned and (not self.octopus_intelligent_ignore_unplugged or self.car_charging_planned[0]): - # We only count planned slots if the car is plugged in or we are ignoring unplugged cars - self.octopus_slots += planned + if entity_id_list: + # Process each car's intelligent slot configuration + for car_n in range(min(len(entity_id_list), self.num_cars)): + entity_id = entity_id_list[car_n] + if not entity_id: + continue - # Get rate for import to compute charging costs - if self.rate_import: - self.rate_scan(self.rate_import, print=False) + completed = [] + planned = [] + + if entity_id and "octopus_intelligent_slot_action_config" in self.args: + config_entry = self.get_arg("octopus_intelligent_slot_action_config", None, indirect=False) + service_name = entity_id.replace(".", "/") + result = self.call_service_wrapper(service_name, config_entry=config_entry, return_response=True) + if result and ("slots" in result): + planned = result["slots"] + else: + self.log("Warn: Unable to get data from {} for car {} - octopus_intelligent_slot using action config {}, result was {}".format(entity_id, car_n, config_entry, result)) + else: + try: + completed = self.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or self.get_state_wrapper(entity_id=entity_id, attribute="completedDispatches") + planned = self.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or self.get_state_wrapper(entity_id=entity_id, attribute="plannedDispatches") + except (ValueError, TypeError): + self.log("Warn: Unable to get data from {} for car {} - octopus_intelligent_slot may not be set correctly in apps.yaml".format(entity_id, car_n)) + self.record_status(message="Error: octopus_intelligent_slot not set correctly in apps.yaml for car {}".format(car_n), had_errors=True) + + # Completed and planned slots - merge from all cars + if completed: + self.octopus_slots += completed + if planned and (not self.octopus_intelligent_ignore_unplugged or self.car_charging_planned[car_n]): + # We only count planned slots if the car is plugged in or we are ignoring unplugged cars + self.octopus_slots += planned - if self.num_cars >= 1: # Extract vehicle data if we can get it size = self.get_state_wrapper(entity_id=entity_id, attribute="vehicle_battery_size_in_kwh") rate = self.get_state_wrapper(entity_id=entity_id, attribute="charge_point_power_in_kw") @@ -661,45 +671,53 @@ def fetch_sensor_data(self, save=True): except (ValueError, TypeError): rate = None if size: - self.car_charging_battery_size[0] = size + self.car_charging_battery_size[car_n] = size if rate: # Take the max as Octopus over reports - self.car_charging_rate[0] = max(rate, self.car_charging_rate[0]) + self.car_charging_rate[car_n] = max(rate, self.car_charging_rate[car_n]) # Get car charging limit again from car based on new battery size - self.car_charging_limit[0] = dp3((float(self.get_arg("car_charging_limit", 100.0, index=0)) * self.car_charging_battery_size[0]) / 100.0) + self.car_charging_limit[car_n] = dp3((float(self.get_arg("car_charging_limit", 100.0, index=car_n)) * self.car_charging_battery_size[car_n]) / 100.0) # Extract vehicle preference if we can get it if self.octopus_intelligent_charging: - octopus_ready_time = self.get_arg("octopus_ready_time", None) + octopus_ready_time = self.get_arg("octopus_ready_time", None, index=car_n) if isinstance(octopus_ready_time, str) and len(octopus_ready_time) == 5: octopus_ready_time += ":00" - octopus_limit = self.get_arg("octopus_charge_limit", None) + octopus_limit = self.get_arg("octopus_charge_limit", None, index=car_n) if octopus_limit: try: octopus_limit = float(octopus_limit) except (ValueError, TypeError): - self.log("Warn: octopus_charge_limit is set to a bad value {} in apps.yaml, must be a number".format(octopus_limit)) + self.log("Warn: octopus_charge_limit is set to a bad value {} for car {} in apps.yaml, must be a number".format(octopus_limit, car_n)) octopus_limit = None if octopus_limit: - octopus_limit = dp3(float(octopus_limit) * self.car_charging_battery_size[0] / 100.0) - self.car_charging_limit[0] = min(self.car_charging_limit[0], octopus_limit) + octopus_limit = dp3(float(octopus_limit) * self.car_charging_battery_size[car_n] / 100.0) + self.car_charging_limit[car_n] = min(self.car_charging_limit[car_n], octopus_limit) if octopus_ready_time: - self.car_charging_plan_time[0] = octopus_ready_time - - # Use octopus slots for charging? - self.octopus_slots = self.add_now_to_octopus_slot(self.octopus_slots, self.now_utc) - if not self.octopus_intelligent_ignore_unplugged or self.car_charging_planned[0]: - self.car_charging_slots[0] = self.load_octopus_slots(self.octopus_slots, self.octopus_intelligent_consider_full) - if self.car_charging_slots[0]: - self.log("Car 0 using Octopus Intelligent, charging planned - charging limit {}, ready time {} - battery size {}".format(self.car_charging_limit[0], self.car_charging_plan_time[0], self.car_charging_battery_size[0])) - self.car_charging_planned[0] = True + self.car_charging_plan_time[car_n] = octopus_ready_time + + # Get rate for import to compute charging costs + if self.rate_import: + self.rate_scan(self.rate_import, print=False) + + # Use octopus slots for charging - process for each car + if self.octopus_intelligent_charging: + self.octopus_slots = self.add_now_to_octopus_slot(self.octopus_slots, self.now_utc) + for car_n in range(min(len(entity_id_list), self.num_cars)): + if not entity_id_list[car_n]: + continue + if not self.octopus_intelligent_ignore_unplugged or self.car_charging_planned[car_n]: + self.car_charging_slots[car_n] = self.load_octopus_slots(self.octopus_slots, self.octopus_intelligent_consider_full) + if self.car_charging_slots[car_n]: + self.log("Car {} using Octopus Intelligent, charging planned - charging limit {}, ready time {} - battery size {}".format(car_n, self.car_charging_limit[car_n], self.car_charging_plan_time[car_n], self.car_charging_battery_size[car_n])) + self.car_charging_planned[car_n] = True else: - self.log("Car 0 using Octopus Intelligent, no charging is planned") - self.car_charging_planned[0] = False + self.log("Car {} using Octopus Intelligent, no charging is planned".format(car_n)) + self.car_charging_planned[car_n] = False else: - self.log("Car 0 using Octopus Intelligent is unplugged") - self.car_charging_planned[0] = False + self.log("Car {} using Octopus Intelligent is unplugged".format(car_n)) + self.car_charging_planned[car_n] = False else: # Disable octopus charging if we don't have the slot sensor self.octopus_intelligent_charging = False From edb12a85126264ea752c50d019abf0af3a146293 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:38:42 +0000 Subject: [PATCH 3/6] Add multi-car IOG test and safety check in ha.py Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com> --- apps/predbat/ha.py | 3 + apps/predbat/tests/test_multi_car_iog.py | 232 +++++++++++++++++++++++ apps/predbat/unit_test.py | 2 + 3 files changed, 237 insertions(+) create mode 100644 apps/predbat/tests/test_multi_car_iog.py diff --git a/apps/predbat/ha.py b/apps/predbat/ha.py index 7ef312a58..d6203568b 100644 --- a/apps/predbat/ha.py +++ b/apps/predbat/ha.py @@ -480,6 +480,9 @@ def get_state(self, entity_id=None, default=None, attribute=None, refresh=False, Get state from cached HA data """ if entity_id: + if isinstance(entity_id, list): + self.log("Error: get_state called with list entity_id: {}, this should be a single entity string".format(entity_id)) + return default self.db_mirror_list[entity_id.lower()] = True if not entity_id: diff --git a/apps/predbat/tests/test_multi_car_iog.py b/apps/predbat/tests/test_multi_car_iog.py new file mode 100644 index 000000000..71d72d223 --- /dev/null +++ b/apps/predbat/tests/test_multi_car_iog.py @@ -0,0 +1,232 @@ +# ----------------------------------------------------------------------------- +# Predbat Home Battery System +# Copyright Trefor Southwell 2024 - All Rights Reserved +# This application maybe used for personal use only and not for commercial use +# ----------------------------------------------------------------------------- +# fmt off +# pylint: disable=consider-using-f-string +# pylint: disable=line-too-long +# pylint: disable=attribute-defined-outside-init + +from datetime import datetime, timedelta +from tests.test_infra import reset_rates + + +def run_multi_car_iog_test(testname, my_predbat): + """ + Test multi-car Intelligent Octopus Go (IOG) support + """ + failed = False + print("**** Running Test: multi_car_iog {} ****".format(testname)) + + # Setup test data - similar to what fetch_sensor_data does + my_predbat.num_cars = 2 + my_predbat.car_charging_planned = [True, True] # Both cars plugged in + my_predbat.car_charging_now = [False, False] + my_predbat.car_charging_plan_smart = [False, False] + my_predbat.car_charging_plan_max_price = [0, 0] + my_predbat.car_charging_plan_time = ["07:00:00", "07:00:00"] + my_predbat.car_charging_battery_size = [100.0, 80.0] + my_predbat.car_charging_limit = [100.0, 80.0] + my_predbat.car_charging_rate = [7.4, 7.4] + my_predbat.car_charging_slots = [[], []] + my_predbat.car_charging_exclusive = [False, False] + my_predbat.car_charging_loss = 1.0 + my_predbat.octopus_intelligent_charging = True + my_predbat.octopus_intelligent_ignore_unplugged = False + my_predbat.octopus_intelligent_consider_full = False + my_predbat.octopus_slots = [] + + # Test 1: Single car config (backward compatibility) + print("Test 1: Single car config (backward compatibility)") + my_predbat.args["octopus_intelligent_slot"] = "binary_sensor.octopus_energy_intelligent_dispatching" + + # Mock entity state + slot1_start = (my_predbat.now_utc + timedelta(hours=1)).strftime("%Y-%m-%dT%H:%M:%S%z") + slot1_end = (my_predbat.now_utc + timedelta(hours=2)).strftime("%Y-%m-%dT%H:%M:%S%z") + + my_predbat.ha_interface.set_state( + "binary_sensor.octopus_energy_intelligent_dispatching", + "on", + attributes={ + "completed_dispatches": [], + "planned_dispatches": [ + { + "start": slot1_start, + "end": slot1_end, + "charge_in_kwh": 10.0, + "source": "smart-charge", + "location": "AT_HOME" + } + ], + "vehicle_battery_size_in_kwh": 100.0, + "charge_point_power_in_kw": 7.4 + } + ) + + # Simulate the octopus intelligent slot processing from fetch_sensor_data + my_predbat.octopus_slots = [] + entity_id_config = my_predbat.get_arg("octopus_intelligent_slot", indirect=False) + + # Normalize to list + if entity_id_config and not isinstance(entity_id_config, list): + entity_id_list = [entity_id_config] + elif entity_id_config: + entity_id_list = entity_id_config + else: + entity_id_list = [] + + # Process each car + for car_n in range(min(len(entity_id_list), my_predbat.num_cars)): + entity_id = entity_id_list[car_n] + if not entity_id: + continue + + completed = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or [] + planned = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or [] + + if completed: + my_predbat.octopus_slots += completed + if planned: + my_predbat.octopus_slots += planned + + if len(my_predbat.octopus_slots) != 1: + print("ERROR: Expected 1 slot for single car, got {}".format(len(my_predbat.octopus_slots))) + print("Slots: {}".format(my_predbat.octopus_slots)) + failed = True + + # Test 2: Multi-car config + print("Test 2: Multi-car config with two cars") + my_predbat.octopus_slots = [] + my_predbat.args["octopus_intelligent_slot"] = [ + "binary_sensor.octopus_energy_intelligent_dispatching_car1", + "binary_sensor.octopus_energy_intelligent_dispatching_car2" + ] + + # Mock entity states for both cars + slot2_start = (my_predbat.now_utc + timedelta(hours=2)).strftime("%Y-%m-%dT%H:%M:%S%z") + slot2_end = (my_predbat.now_utc + timedelta(hours=3)).strftime("%Y-%m-%dT%H:%M:%S%z") + + my_predbat.ha_interface.set_state( + "binary_sensor.octopus_energy_intelligent_dispatching_car1", + "on", + attributes={ + "completed_dispatches": [], + "planned_dispatches": [ + { + "start": slot1_start, + "end": slot1_end, + "charge_in_kwh": 10.0, + "source": "smart-charge", + "location": "AT_HOME" + } + ], + "vehicle_battery_size_in_kwh": 100.0, + "charge_point_power_in_kw": 7.4 + } + ) + + my_predbat.ha_interface.set_state( + "binary_sensor.octopus_energy_intelligent_dispatching_car2", + "on", + attributes={ + "completed_dispatches": [], + "planned_dispatches": [ + { + "start": slot2_start, + "end": slot2_end, + "charge_in_kwh": 8.0, + "source": "smart-charge", + "location": "AT_HOME" + } + ], + "vehicle_battery_size_in_kwh": 80.0, + "charge_point_power_in_kw": 7.4 + } + ) + + # Simulate the octopus intelligent slot processing + entity_id_config = my_predbat.get_arg("octopus_intelligent_slot", indirect=False) + + # Normalize to list + if entity_id_config and not isinstance(entity_id_config, list): + entity_id_list = [entity_id_config] + elif entity_id_config: + entity_id_list = entity_id_config + else: + entity_id_list = [] + + # Process each car + for car_n in range(min(len(entity_id_list), my_predbat.num_cars)): + entity_id = entity_id_list[car_n] + if not entity_id: + continue + + completed = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or [] + planned = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or [] + + if completed: + my_predbat.octopus_slots += completed + if planned: + my_predbat.octopus_slots += planned + + # Should have slots from both cars merged + if len(my_predbat.octopus_slots) != 2: + print("ERROR: Expected 2 slots (one from each car), got {}".format(len(my_predbat.octopus_slots))) + print("Slots: {}".format(my_predbat.octopus_slots)) + failed = True + + # Test 3: Multi-car config with empty slot + print("Test 3: Multi-car config with one empty/None slot") + my_predbat.octopus_slots = [] + my_predbat.args["octopus_intelligent_slot"] = [ + "binary_sensor.octopus_energy_intelligent_dispatching_car1", + None + ] + + # Simulate the octopus intelligent slot processing + entity_id_config = my_predbat.get_arg("octopus_intelligent_slot", indirect=False) + + # Normalize to list + if entity_id_config and not isinstance(entity_id_config, list): + entity_id_list = [entity_id_config] + elif entity_id_config: + entity_id_list = entity_id_config + else: + entity_id_list = [] + + # Process each car + for car_n in range(min(len(entity_id_list), my_predbat.num_cars)): + entity_id = entity_id_list[car_n] + if not entity_id: + continue + + completed = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or [] + planned = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or [] + + if completed: + my_predbat.octopus_slots += completed + if planned: + my_predbat.octopus_slots += planned + + # Should have slots from first car only + if len(my_predbat.octopus_slots) != 1: + print("ERROR: Expected 1 slot (from first car only), got {}".format(len(my_predbat.octopus_slots))) + print("Slots: {}".format(my_predbat.octopus_slots)) + failed = True + + if failed: + print("Test: {} FAILED".format(testname)) + else: + print("Test: {} PASSED".format(testname)) + + return failed + + +def run_multi_car_iog_tests(my_predbat): + """ + Run all multi-car IOG tests + """ + failed = False + failed |= run_multi_car_iog_test("multi_car_iog_basic", my_predbat) + return failed diff --git a/apps/predbat/unit_test.py b/apps/predbat/unit_test.py index 94f46f258..c17266808 100644 --- a/apps/predbat/unit_test.py +++ b/apps/predbat/unit_test.py @@ -22,6 +22,7 @@ from tests.test_model import run_model_tests from tests.test_execute import run_execute_tests from tests.test_octopus_slots import run_load_octopus_slots_tests +from tests.test_multi_car_iog import run_multi_car_iog_tests from tests.test_multi_inverter import run_inverter_multi_tests from tests.test_window2minutes import test_window2minutes from tests.test_history_attribute import test_history_attribute @@ -179,6 +180,7 @@ def main(): ("web_if", run_test_web_if, "Web interface tests", False), ("nordpool", run_nordpool_test, "Nordpool tests", False), ("octopus_slots", run_load_octopus_slots_tests, "Load Octopus slots tests", False), + ("multi_car_iog", run_multi_car_iog_tests, "Multi-car IOG tests", False), ("rate_add_io_slots", run_rate_add_io_slots_tests, "Rate add IO slots tests", False), ("find_charge_rate", test_find_charge_rate, "Find charge rate tests", False), ("energydataservice", test_energydataservice, "Energy data service tests", False), From 0d281ed1e253803ed70863abc3429def1214df4a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:40:22 +0000 Subject: [PATCH 4/6] Fix ruff linting issues - remove unused imports and variables Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com> --- apps/predbat/fetch.py | 1 - apps/predbat/tests/test_multi_car_iog.py | 3 +- coverage/venv/bin/Activate.ps1 | 247 +++++++++++++++++++++++ coverage/venv/bin/activate | 70 +++++++ coverage/venv/bin/activate.csh | 27 +++ coverage/venv/bin/activate.fish | 69 +++++++ coverage/venv/bin/coverage | 8 + coverage/venv/bin/coverage-3.12 | 8 + coverage/venv/bin/coverage3 | 8 + coverage/venv/bin/f2py | 8 + coverage/venv/bin/fonttools | 8 + coverage/venv/bin/identify-cli | 8 + coverage/venv/bin/nodeenv | 8 + coverage/venv/bin/normalizer | 8 + coverage/venv/bin/numpy-config | 8 + coverage/venv/bin/pip | 8 + coverage/venv/bin/pip3 | 8 + coverage/venv/bin/pip3.12 | 8 + coverage/venv/bin/pre-commit | 8 + coverage/venv/bin/pyftmerge | 8 + coverage/venv/bin/pyftsubset | 8 + coverage/venv/bin/python | 1 + coverage/venv/bin/python3 | 1 + coverage/venv/bin/python3.12 | 1 + coverage/venv/bin/ttx | 8 + coverage/venv/bin/virtualenv | 8 + coverage/venv/lib64 | 1 + coverage/venv/pyvenv.cfg | 5 + coverage/venv/share/man/man1/ttx.1 | 225 +++++++++++++++++++++ 29 files changed, 784 insertions(+), 3 deletions(-) create mode 100644 coverage/venv/bin/Activate.ps1 create mode 100644 coverage/venv/bin/activate create mode 100644 coverage/venv/bin/activate.csh create mode 100644 coverage/venv/bin/activate.fish create mode 100755 coverage/venv/bin/coverage create mode 100755 coverage/venv/bin/coverage-3.12 create mode 100755 coverage/venv/bin/coverage3 create mode 100755 coverage/venv/bin/f2py create mode 100755 coverage/venv/bin/fonttools create mode 100755 coverage/venv/bin/identify-cli create mode 100755 coverage/venv/bin/nodeenv create mode 100755 coverage/venv/bin/normalizer create mode 100755 coverage/venv/bin/numpy-config create mode 100755 coverage/venv/bin/pip create mode 100755 coverage/venv/bin/pip3 create mode 100755 coverage/venv/bin/pip3.12 create mode 100755 coverage/venv/bin/pre-commit create mode 100755 coverage/venv/bin/pyftmerge create mode 100755 coverage/venv/bin/pyftsubset create mode 120000 coverage/venv/bin/python create mode 120000 coverage/venv/bin/python3 create mode 120000 coverage/venv/bin/python3.12 create mode 100755 coverage/venv/bin/ttx create mode 100755 coverage/venv/bin/virtualenv create mode 120000 coverage/venv/lib64 create mode 100644 coverage/venv/pyvenv.cfg create mode 100644 coverage/venv/share/man/man1/ttx.1 diff --git a/apps/predbat/fetch.py b/apps/predbat/fetch.py index 8db6bf5c3..248baf066 100644 --- a/apps/predbat/fetch.py +++ b/apps/predbat/fetch.py @@ -616,7 +616,6 @@ def fetch_sensor_data(self, save=True): # Get octopus intelligent slot configuration - could be single value or list for multiple cars entity_id_config = self.get_arg("octopus_intelligent_slot", indirect=False) - ohme_automatic = self.get_arg("ohme_automatic", False) # Normalize to list for multi-car support if entity_id_config and not isinstance(entity_id_config, list): diff --git a/apps/predbat/tests/test_multi_car_iog.py b/apps/predbat/tests/test_multi_car_iog.py index 71d72d223..fd8dc3873 100644 --- a/apps/predbat/tests/test_multi_car_iog.py +++ b/apps/predbat/tests/test_multi_car_iog.py @@ -8,8 +8,7 @@ # pylint: disable=line-too-long # pylint: disable=attribute-defined-outside-init -from datetime import datetime, timedelta -from tests.test_infra import reset_rates +from datetime import timedelta def run_multi_car_iog_test(testname, my_predbat): diff --git a/coverage/venv/bin/Activate.ps1 b/coverage/venv/bin/Activate.ps1 new file mode 100644 index 000000000..b49d77ba4 --- /dev/null +++ b/coverage/venv/bin/Activate.ps1 @@ -0,0 +1,247 @@ +<# +.Synopsis +Activate a Python virtual environment for the current PowerShell session. + +.Description +Pushes the python executable for a virtual environment to the front of the +$Env:PATH environment variable and sets the prompt to signify that you are +in a Python virtual environment. Makes use of the command line switches as +well as the `pyvenv.cfg` file values present in the virtual environment. + +.Parameter VenvDir +Path to the directory that contains the virtual environment to activate. The +default value for this is the parent of the directory that the Activate.ps1 +script is located within. + +.Parameter Prompt +The prompt prefix to display when this virtual environment is activated. By +default, this prompt is the name of the virtual environment folder (VenvDir) +surrounded by parentheses and followed by a single space (ie. '(.venv) '). + +.Example +Activate.ps1 +Activates the Python virtual environment that contains the Activate.ps1 script. + +.Example +Activate.ps1 -Verbose +Activates the Python virtual environment that contains the Activate.ps1 script, +and shows extra information about the activation as it executes. + +.Example +Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv +Activates the Python virtual environment located in the specified location. + +.Example +Activate.ps1 -Prompt "MyPython" +Activates the Python virtual environment that contains the Activate.ps1 script, +and prefixes the current prompt with the specified string (surrounded in +parentheses) while the virtual environment is active. + +.Notes +On Windows, it may be required to enable this Activate.ps1 script by setting the +execution policy for the user. You can do this by issuing the following PowerShell +command: + +PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + +For more information on Execution Policies: +https://go.microsoft.com/fwlink/?LinkID=135170 + +#> +Param( + [Parameter(Mandatory = $false)] + [String] + $VenvDir, + [Parameter(Mandatory = $false)] + [String] + $Prompt +) + +<# Function declarations --------------------------------------------------- #> + +<# +.Synopsis +Remove all shell session elements added by the Activate script, including the +addition of the virtual environment's Python executable from the beginning of +the PATH variable. + +.Parameter NonDestructive +If present, do not remove this function from the global namespace for the +session. + +#> +function global:deactivate ([switch]$NonDestructive) { + # Revert to original values + + # The prior prompt: + if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { + Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt + Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT + } + + # The prior PYTHONHOME: + if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { + Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME + Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME + } + + # The prior PATH: + if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { + Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH + Remove-Item -Path Env:_OLD_VIRTUAL_PATH + } + + # Just remove the VIRTUAL_ENV altogether: + if (Test-Path -Path Env:VIRTUAL_ENV) { + Remove-Item -Path env:VIRTUAL_ENV + } + + # Just remove VIRTUAL_ENV_PROMPT altogether. + if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { + Remove-Item -Path env:VIRTUAL_ENV_PROMPT + } + + # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: + if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { + Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force + } + + # Leave deactivate function in the global namespace if requested: + if (-not $NonDestructive) { + Remove-Item -Path function:deactivate + } +} + +<# +.Description +Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the +given folder, and returns them in a map. + +For each line in the pyvenv.cfg file, if that line can be parsed into exactly +two strings separated by `=` (with any amount of whitespace surrounding the =) +then it is considered a `key = value` line. The left hand string is the key, +the right hand is the value. + +If the value starts with a `'` or a `"` then the first and last character is +stripped from the value before being captured. + +.Parameter ConfigDir +Path to the directory that contains the `pyvenv.cfg` file. +#> +function Get-PyVenvConfig( + [String] + $ConfigDir +) { + Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" + + # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). + $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue + + # An empty map will be returned if no config file is found. + $pyvenvConfig = @{ } + + if ($pyvenvConfigPath) { + + Write-Verbose "File exists, parse `key = value` lines" + $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath + + $pyvenvConfigContent | ForEach-Object { + $keyval = $PSItem -split "\s*=\s*", 2 + if ($keyval[0] -and $keyval[1]) { + $val = $keyval[1] + + # Remove extraneous quotations around a string value. + if ("'""".Contains($val.Substring(0, 1))) { + $val = $val.Substring(1, $val.Length - 2) + } + + $pyvenvConfig[$keyval[0]] = $val + Write-Verbose "Adding Key: '$($keyval[0])'='$val'" + } + } + } + return $pyvenvConfig +} + + +<# Begin Activate script --------------------------------------------------- #> + +# Determine the containing directory of this script +$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition +$VenvExecDir = Get-Item -Path $VenvExecPath + +Write-Verbose "Activation script is located in path: '$VenvExecPath'" +Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" +Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" + +# Set values required in priority: CmdLine, ConfigFile, Default +# First, get the location of the virtual environment, it might not be +# VenvExecDir if specified on the command line. +if ($VenvDir) { + Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" +} +else { + Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." + $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") + Write-Verbose "VenvDir=$VenvDir" +} + +# Next, read the `pyvenv.cfg` file to determine any required value such +# as `prompt`. +$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir + +# Next, set the prompt from the command line, or the config file, or +# just use the name of the virtual environment folder. +if ($Prompt) { + Write-Verbose "Prompt specified as argument, using '$Prompt'" +} +else { + Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" + if ($pyvenvCfg -and $pyvenvCfg['prompt']) { + Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" + $Prompt = $pyvenvCfg['prompt']; + } + else { + Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" + Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" + $Prompt = Split-Path -Path $venvDir -Leaf + } +} + +Write-Verbose "Prompt = '$Prompt'" +Write-Verbose "VenvDir='$VenvDir'" + +# Deactivate any currently active virtual environment, but leave the +# deactivate function in place. +deactivate -nondestructive + +# Now set the environment variable VIRTUAL_ENV, used by many tools to determine +# that there is an activated venv. +$env:VIRTUAL_ENV = $VenvDir + +if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { + + Write-Verbose "Setting prompt to '$Prompt'" + + # Set the prompt to include the env name + # Make sure _OLD_VIRTUAL_PROMPT is global + function global:_OLD_VIRTUAL_PROMPT { "" } + Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT + New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt + + function global:prompt { + Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " + _OLD_VIRTUAL_PROMPT + } + $env:VIRTUAL_ENV_PROMPT = $Prompt +} + +# Clear PYTHONHOME +if (Test-Path -Path Env:PYTHONHOME) { + Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME + Remove-Item -Path Env:PYTHONHOME +} + +# Add the venv to the PATH +Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH +$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/coverage/venv/bin/activate b/coverage/venv/bin/activate new file mode 100644 index 000000000..4327693c2 --- /dev/null +++ b/coverage/venv/bin/activate @@ -0,0 +1,70 @@ +# This file must be used with "source bin/activate" *from bash* +# You cannot run it directly + +deactivate () { + # reset old environment variables + if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # Call hash to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + hash -r 2> /dev/null + + if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + unset VIRTUAL_ENV_PROMPT + if [ ! "${1:-}" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +# on Windows, a path can contain colons and backslashes and has to be converted: +if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then + # transform D:\path\to\venv to /d/path/to/venv on MSYS + # and to /cygdrive/d/path/to/venv on Cygwin + export VIRTUAL_ENV=$(cygpath /home/runner/work/batpred/batpred/coverage/venv) +else + # use the path as-is + export VIRTUAL_ENV=/home/runner/work/batpred/batpred/coverage/venv +fi + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/"bin":$PATH" +export PATH + +# unset PYTHONHOME if set +# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) +# could use `if (set -u; : $PYTHONHOME) ;` in bash +if [ -n "${PYTHONHOME:-}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1:-}" + PS1='(venv) '"${PS1:-}" + export PS1 + VIRTUAL_ENV_PROMPT='(venv) ' + export VIRTUAL_ENV_PROMPT +fi + +# Call hash to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +hash -r 2> /dev/null diff --git a/coverage/venv/bin/activate.csh b/coverage/venv/bin/activate.csh new file mode 100644 index 000000000..9eb3fa788 --- /dev/null +++ b/coverage/venv/bin/activate.csh @@ -0,0 +1,27 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. + +# Created by Davide Di Blasi . +# Ported to Python 3.3 venv by Andrew Svetlov + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV /home/runner/work/batpred/batpred/coverage/venv + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/"bin":$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + set prompt = '(venv) '"$prompt" + setenv VIRTUAL_ENV_PROMPT '(venv) ' +endif + +alias pydoc python -m pydoc + +rehash diff --git a/coverage/venv/bin/activate.fish b/coverage/venv/bin/activate.fish new file mode 100644 index 000000000..6d8fecd2c --- /dev/null +++ b/coverage/venv/bin/activate.fish @@ -0,0 +1,69 @@ +# This file must be used with "source /bin/activate.fish" *from fish* +# (https://fishshell.com/). You cannot run it directly. + +function deactivate -d "Exit virtual environment and return to normal shell environment" + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + set -e _OLD_FISH_PROMPT_OVERRIDE + # prevents error when using nested fish instances (Issue #93858) + if functions -q _old_fish_prompt + functions -e fish_prompt + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + end + + set -e VIRTUAL_ENV + set -e VIRTUAL_ENV_PROMPT + if test "$argv[1]" != "nondestructive" + # Self-destruct! + functions -e deactivate + end +end + +# Unset irrelevant variables. +deactivate nondestructive + +set -gx VIRTUAL_ENV /home/runner/work/batpred/batpred/coverage/venv + +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx PATH "$VIRTUAL_ENV/"bin $PATH + +# Unset PYTHONHOME if set. +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # fish uses a function instead of an env var to generate the prompt. + + # Save the current fish_prompt function as the function _old_fish_prompt. + functions -c fish_prompt _old_fish_prompt + + # With the original prompt function renamed, we can override with our own. + function fish_prompt + # Save the return status of the last command. + set -l old_status $status + + # Output the venv prompt; color taken from the blue of the Python logo. + printf "%s%s%s" (set_color 4B8BBE) '(venv) ' (set_color normal) + + # Restore the return status of the previous command. + echo "exit $old_status" | . + # Output the original/"old" prompt. + _old_fish_prompt + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" + set -gx VIRTUAL_ENV_PROMPT '(venv) ' +end diff --git a/coverage/venv/bin/coverage b/coverage/venv/bin/coverage new file mode 100755 index 000000000..11ddb6d5a --- /dev/null +++ b/coverage/venv/bin/coverage @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from coverage.cmdline import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/coverage-3.12 b/coverage/venv/bin/coverage-3.12 new file mode 100755 index 000000000..106c7e8c5 --- /dev/null +++ b/coverage/venv/bin/coverage-3.12 @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from coverage.cmdline import main_deprecated +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main_deprecated()) diff --git a/coverage/venv/bin/coverage3 b/coverage/venv/bin/coverage3 new file mode 100755 index 000000000..106c7e8c5 --- /dev/null +++ b/coverage/venv/bin/coverage3 @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from coverage.cmdline import main_deprecated +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main_deprecated()) diff --git a/coverage/venv/bin/f2py b/coverage/venv/bin/f2py new file mode 100755 index 000000000..6a6ca2ecb --- /dev/null +++ b/coverage/venv/bin/f2py @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/fonttools b/coverage/venv/bin/fonttools new file mode 100755 index 000000000..7b9c4ba8e --- /dev/null +++ b/coverage/venv/bin/fonttools @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fontTools.__main__ import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/identify-cli b/coverage/venv/bin/identify-cli new file mode 100755 index 000000000..a78678e8d --- /dev/null +++ b/coverage/venv/bin/identify-cli @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from identify.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/nodeenv b/coverage/venv/bin/nodeenv new file mode 100755 index 000000000..354c31b7c --- /dev/null +++ b/coverage/venv/bin/nodeenv @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from nodeenv import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/normalizer b/coverage/venv/bin/normalizer new file mode 100755 index 000000000..bceb80f61 --- /dev/null +++ b/coverage/venv/bin/normalizer @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from charset_normalizer.cli import cli_detect +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_detect()) diff --git a/coverage/venv/bin/numpy-config b/coverage/venv/bin/numpy-config new file mode 100755 index 000000000..cfc11056f --- /dev/null +++ b/coverage/venv/bin/numpy-config @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from numpy._configtool import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/pip b/coverage/venv/bin/pip new file mode 100755 index 000000000..14994c2df --- /dev/null +++ b/coverage/venv/bin/pip @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/pip3 b/coverage/venv/bin/pip3 new file mode 100755 index 000000000..14994c2df --- /dev/null +++ b/coverage/venv/bin/pip3 @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/pip3.12 b/coverage/venv/bin/pip3.12 new file mode 100755 index 000000000..14994c2df --- /dev/null +++ b/coverage/venv/bin/pip3.12 @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/pre-commit b/coverage/venv/bin/pre-commit new file mode 100755 index 000000000..52dede485 --- /dev/null +++ b/coverage/venv/bin/pre-commit @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pre_commit.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/pyftmerge b/coverage/venv/bin/pyftmerge new file mode 100755 index 000000000..bb15b3e32 --- /dev/null +++ b/coverage/venv/bin/pyftmerge @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fontTools.merge import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/pyftsubset b/coverage/venv/bin/pyftsubset new file mode 100755 index 000000000..e7fa668a7 --- /dev/null +++ b/coverage/venv/bin/pyftsubset @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fontTools.subset import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/python b/coverage/venv/bin/python new file mode 120000 index 000000000..b8a0adbbb --- /dev/null +++ b/coverage/venv/bin/python @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/coverage/venv/bin/python3 b/coverage/venv/bin/python3 new file mode 120000 index 000000000..ae65fdaa1 --- /dev/null +++ b/coverage/venv/bin/python3 @@ -0,0 +1 @@ +/usr/bin/python3 \ No newline at end of file diff --git a/coverage/venv/bin/python3.12 b/coverage/venv/bin/python3.12 new file mode 120000 index 000000000..b8a0adbbb --- /dev/null +++ b/coverage/venv/bin/python3.12 @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/coverage/venv/bin/ttx b/coverage/venv/bin/ttx new file mode 100755 index 000000000..9242dfa35 --- /dev/null +++ b/coverage/venv/bin/ttx @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fontTools.ttx import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/coverage/venv/bin/virtualenv b/coverage/venv/bin/virtualenv new file mode 100755 index 000000000..469d27def --- /dev/null +++ b/coverage/venv/bin/virtualenv @@ -0,0 +1,8 @@ +#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from virtualenv.__main__ import run_with_catch +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(run_with_catch()) diff --git a/coverage/venv/lib64 b/coverage/venv/lib64 new file mode 120000 index 000000000..7951405f8 --- /dev/null +++ b/coverage/venv/lib64 @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/coverage/venv/pyvenv.cfg b/coverage/venv/pyvenv.cfg new file mode 100644 index 000000000..458747159 --- /dev/null +++ b/coverage/venv/pyvenv.cfg @@ -0,0 +1,5 @@ +home = /usr/bin +include-system-site-packages = false +version = 3.12.3 +executable = /usr/bin/python3.12 +command = /usr/bin/python3 -m venv /home/runner/work/batpred/batpred/coverage/venv diff --git a/coverage/venv/share/man/man1/ttx.1 b/coverage/venv/share/man/man1/ttx.1 new file mode 100644 index 000000000..bba23b5e5 --- /dev/null +++ b/coverage/venv/share/man/man1/ttx.1 @@ -0,0 +1,225 @@ +.Dd May 18, 2004 +.\" ttx is not specific to any OS, but contrary to what groff_mdoc(7) +.\" seems to imply, entirely omitting the .Os macro causes 'BSD' to +.\" be used, so I give a zero-width space as its argument. +.Os \& +.\" The "FontTools Manual" argument apparently has no effect in +.\" groff 1.18.1. I think it is a bug in the -mdoc groff package. +.Dt TTX 1 "FontTools Manual" +.Sh NAME +.Nm ttx +.Nd tool for manipulating TrueType and OpenType fonts +.Sh SYNOPSIS +.Nm +.Bk +.Op Ar option ... +.Ek +.Bk +.Ar file ... +.Ek +.Sh DESCRIPTION +.Nm +is a tool for manipulating TrueType and OpenType fonts. It can convert +TrueType and OpenType fonts to and from an +.Tn XML Ns -based format called +.Tn TTX . +.Tn TTX +files have a +.Ql .ttx +extension. +.Pp +For each +.Ar file +argument it is given, +.Nm +detects whether it is a +.Ql .ttf , +.Ql .otf +or +.Ql .ttx +file and acts accordingly: if it is a +.Ql .ttf +or +.Ql .otf +file, it generates a +.Ql .ttx +file; if it is a +.Ql .ttx +file, it generates a +.Ql .ttf +or +.Ql .otf +file. +.Pp +By default, every output file is created in the same directory as the +corresponding input file and with the same name except for the +extension, which is substituted appropriately. +.Nm +never overwrites existing files; if necessary, it appends a suffix to +the output file name before the extension, as in +.Pa Arial#1.ttf . +.Ss "General options" +.Bl -tag -width ".Fl t Ar table" +.It Fl h +Display usage information. +.It Fl d Ar dir +Write the output files to directory +.Ar dir +instead of writing every output file to the same directory as the +corresponding input file. +.It Fl o Ar file +Write the output to +.Ar file +instead of writing it to the same directory as the +corresponding input file. +.It Fl v +Be verbose. Write more messages to the standard output describing what +is being done. +.It Fl a +Allow virtual glyphs ID's on compile or decompile. +.El +.Ss "Dump options" +The following options control the process of dumping font files +(TrueType or OpenType) to +.Tn TTX +files. +.Bl -tag -width ".Fl t Ar table" +.It Fl l +List table information. Instead of dumping the font to a +.Tn TTX +file, display minimal information about each table. +.It Fl t Ar table +Dump table +.Ar table . +This option may be given multiple times to dump several tables at +once. When not specified, all tables are dumped. +.It Fl x Ar table +Exclude table +.Ar table +from the list of tables to dump. This option may be given multiple +times to exclude several tables from the dump. The +.Fl t +and +.Fl x +options are mutually exclusive. +.It Fl s +Split tables. Dump each table to a separate +.Tn TTX +file and write (under the name that would have been used for the output +file if the +.Fl s +option had not been given) one small +.Tn TTX +file containing references to the individual table dump files. This +file can be used as input to +.Nm +as long as the referenced files can be found in the same directory. +.It Fl i +.\" XXX: I suppose OpenType programs (exist and) are also affected. +Don't disassemble TrueType instructions. When this option is specified, +all TrueType programs (glyph programs, the font program and the +pre-program) are written to the +.Tn TTX +file as hexadecimal data instead of +assembly. This saves some time and results in smaller +.Tn TTX +files. +.It Fl y Ar n +When decompiling a TrueType Collection (TTC) file, +decompile font number +.Ar n , +starting from 0. +.El +.Ss "Compilation options" +The following options control the process of compiling +.Tn TTX +files into font files (TrueType or OpenType): +.Bl -tag -width ".Fl t Ar table" +.It Fl m Ar fontfile +Merge the input +.Tn TTX +file +.Ar file +with +.Ar fontfile . +No more than one +.Ar file +argument can be specified when this option is used. +.It Fl b +Don't recalculate glyph bounding boxes. Use the values in the +.Tn TTX +file as is. +.El +.Sh "THE TTX FILE FORMAT" +You can find some information about the +.Tn TTX +file format in +.Pa documentation.html . +In particular, you will find in that file the list of tables understood by +.Nm +and the relations between TrueType GlyphIDs and the glyph names used in +.Tn TTX +files. +.Sh EXAMPLES +In the following examples, all files are read from and written to the +current directory. Additionally, the name given for the output file +assumes in every case that it did not exist before +.Nm +was invoked. +.Pp +Dump the TrueType font contained in +.Pa FreeSans.ttf +to +.Pa FreeSans.ttx : +.Pp +.Dl ttx FreeSans.ttf +.Pp +Compile +.Pa MyFont.ttx +into a TrueType or OpenType font file: +.Pp +.Dl ttx MyFont.ttx +.Pp +List the tables in +.Pa FreeSans.ttf +along with some information: +.Pp +.Dl ttx -l FreeSans.ttf +.Pp +Dump the +.Sq cmap +table from +.Pa FreeSans.ttf +to +.Pa FreeSans.ttx : +.Pp +.Dl ttx -t cmap FreeSans.ttf +.Sh NOTES +On MS\-Windows and MacOS, +.Nm +is available as a graphical application to which files can be dropped. +.Sh SEE ALSO +.Pa documentation.html +.Pp +.Xr fontforge 1 , +.Xr ftinfo 1 , +.Xr gfontview 1 , +.Xr xmbdfed 1 , +.Xr Font::TTF 3pm +.Sh AUTHORS +.Nm +was written by +.An -nosplit +.An "Just van Rossum" Aq just@letterror.com . +.Pp +This manual page was written by +.An "Florent Rougon" Aq f.rougon@free.fr +for the Debian GNU/Linux system based on the existing FontTools +documentation. It may be freely used, modified and distributed without +restrictions. +.\" For Emacs: +.\" Local Variables: +.\" fill-column: 72 +.\" sentence-end: "[.?!][]\"')}]*\\($\\| $\\| \\| \\)[ \n]*" +.\" sentence-end-double-space: t +.\" End: \ No newline at end of file From 963a8ed998b0d53a82740f74b98dfe776ec7764a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:41:24 +0000 Subject: [PATCH 5/6] Add coverage/venv to .gitignore and remove from repository Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com> --- .gitignore | 1 + coverage/venv/bin/Activate.ps1 | 247 ----------------------------- coverage/venv/bin/activate | 70 -------- coverage/venv/bin/activate.csh | 27 ---- coverage/venv/bin/activate.fish | 69 -------- coverage/venv/bin/coverage | 8 - coverage/venv/bin/coverage-3.12 | 8 - coverage/venv/bin/coverage3 | 8 - coverage/venv/bin/f2py | 8 - coverage/venv/bin/fonttools | 8 - coverage/venv/bin/identify-cli | 8 - coverage/venv/bin/nodeenv | 8 - coverage/venv/bin/normalizer | 8 - coverage/venv/bin/numpy-config | 8 - coverage/venv/bin/pip | 8 - coverage/venv/bin/pip3 | 8 - coverage/venv/bin/pip3.12 | 8 - coverage/venv/bin/pre-commit | 8 - coverage/venv/bin/pyftmerge | 8 - coverage/venv/bin/pyftsubset | 8 - coverage/venv/bin/python | 1 - coverage/venv/bin/python3 | 1 - coverage/venv/bin/python3.12 | 1 - coverage/venv/bin/ttx | 8 - coverage/venv/bin/virtualenv | 8 - coverage/venv/lib64 | 1 - coverage/venv/pyvenv.cfg | 5 - coverage/venv/share/man/man1/ttx.1 | 225 -------------------------- 28 files changed, 1 insertion(+), 783 deletions(-) delete mode 100644 coverage/venv/bin/Activate.ps1 delete mode 100644 coverage/venv/bin/activate delete mode 100644 coverage/venv/bin/activate.csh delete mode 100644 coverage/venv/bin/activate.fish delete mode 100755 coverage/venv/bin/coverage delete mode 100755 coverage/venv/bin/coverage-3.12 delete mode 100755 coverage/venv/bin/coverage3 delete mode 100755 coverage/venv/bin/f2py delete mode 100755 coverage/venv/bin/fonttools delete mode 100755 coverage/venv/bin/identify-cli delete mode 100755 coverage/venv/bin/nodeenv delete mode 100755 coverage/venv/bin/normalizer delete mode 100755 coverage/venv/bin/numpy-config delete mode 100755 coverage/venv/bin/pip delete mode 100755 coverage/venv/bin/pip3 delete mode 100755 coverage/venv/bin/pip3.12 delete mode 100755 coverage/venv/bin/pre-commit delete mode 100755 coverage/venv/bin/pyftmerge delete mode 100755 coverage/venv/bin/pyftsubset delete mode 120000 coverage/venv/bin/python delete mode 120000 coverage/venv/bin/python3 delete mode 120000 coverage/venv/bin/python3.12 delete mode 100755 coverage/venv/bin/ttx delete mode 100755 coverage/venv/bin/virtualenv delete mode 120000 coverage/venv/lib64 delete mode 100644 coverage/venv/pyvenv.cfg delete mode 100644 coverage/venv/share/man/man1/ttx.1 diff --git a/.gitignore b/.gitignore index 8801fa2d2..bbb832fcb 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ coverage/predbat_standalone/ coverage/predbat_standalone_ha/ coverage/supabase/ coverage/octopus/ +coverage/venv/ .coverage .pytest_cache/ .tox/ diff --git a/coverage/venv/bin/Activate.ps1 b/coverage/venv/bin/Activate.ps1 deleted file mode 100644 index b49d77ba4..000000000 --- a/coverage/venv/bin/Activate.ps1 +++ /dev/null @@ -1,247 +0,0 @@ -<# -.Synopsis -Activate a Python virtual environment for the current PowerShell session. - -.Description -Pushes the python executable for a virtual environment to the front of the -$Env:PATH environment variable and sets the prompt to signify that you are -in a Python virtual environment. Makes use of the command line switches as -well as the `pyvenv.cfg` file values present in the virtual environment. - -.Parameter VenvDir -Path to the directory that contains the virtual environment to activate. The -default value for this is the parent of the directory that the Activate.ps1 -script is located within. - -.Parameter Prompt -The prompt prefix to display when this virtual environment is activated. By -default, this prompt is the name of the virtual environment folder (VenvDir) -surrounded by parentheses and followed by a single space (ie. '(.venv) '). - -.Example -Activate.ps1 -Activates the Python virtual environment that contains the Activate.ps1 script. - -.Example -Activate.ps1 -Verbose -Activates the Python virtual environment that contains the Activate.ps1 script, -and shows extra information about the activation as it executes. - -.Example -Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv -Activates the Python virtual environment located in the specified location. - -.Example -Activate.ps1 -Prompt "MyPython" -Activates the Python virtual environment that contains the Activate.ps1 script, -and prefixes the current prompt with the specified string (surrounded in -parentheses) while the virtual environment is active. - -.Notes -On Windows, it may be required to enable this Activate.ps1 script by setting the -execution policy for the user. You can do this by issuing the following PowerShell -command: - -PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - -For more information on Execution Policies: -https://go.microsoft.com/fwlink/?LinkID=135170 - -#> -Param( - [Parameter(Mandatory = $false)] - [String] - $VenvDir, - [Parameter(Mandatory = $false)] - [String] - $Prompt -) - -<# Function declarations --------------------------------------------------- #> - -<# -.Synopsis -Remove all shell session elements added by the Activate script, including the -addition of the virtual environment's Python executable from the beginning of -the PATH variable. - -.Parameter NonDestructive -If present, do not remove this function from the global namespace for the -session. - -#> -function global:deactivate ([switch]$NonDestructive) { - # Revert to original values - - # The prior prompt: - if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { - Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt - Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT - } - - # The prior PYTHONHOME: - if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { - Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME - Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME - } - - # The prior PATH: - if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { - Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH - Remove-Item -Path Env:_OLD_VIRTUAL_PATH - } - - # Just remove the VIRTUAL_ENV altogether: - if (Test-Path -Path Env:VIRTUAL_ENV) { - Remove-Item -Path env:VIRTUAL_ENV - } - - # Just remove VIRTUAL_ENV_PROMPT altogether. - if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { - Remove-Item -Path env:VIRTUAL_ENV_PROMPT - } - - # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: - if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { - Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force - } - - # Leave deactivate function in the global namespace if requested: - if (-not $NonDestructive) { - Remove-Item -Path function:deactivate - } -} - -<# -.Description -Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the -given folder, and returns them in a map. - -For each line in the pyvenv.cfg file, if that line can be parsed into exactly -two strings separated by `=` (with any amount of whitespace surrounding the =) -then it is considered a `key = value` line. The left hand string is the key, -the right hand is the value. - -If the value starts with a `'` or a `"` then the first and last character is -stripped from the value before being captured. - -.Parameter ConfigDir -Path to the directory that contains the `pyvenv.cfg` file. -#> -function Get-PyVenvConfig( - [String] - $ConfigDir -) { - Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" - - # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). - $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue - - # An empty map will be returned if no config file is found. - $pyvenvConfig = @{ } - - if ($pyvenvConfigPath) { - - Write-Verbose "File exists, parse `key = value` lines" - $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath - - $pyvenvConfigContent | ForEach-Object { - $keyval = $PSItem -split "\s*=\s*", 2 - if ($keyval[0] -and $keyval[1]) { - $val = $keyval[1] - - # Remove extraneous quotations around a string value. - if ("'""".Contains($val.Substring(0, 1))) { - $val = $val.Substring(1, $val.Length - 2) - } - - $pyvenvConfig[$keyval[0]] = $val - Write-Verbose "Adding Key: '$($keyval[0])'='$val'" - } - } - } - return $pyvenvConfig -} - - -<# Begin Activate script --------------------------------------------------- #> - -# Determine the containing directory of this script -$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition -$VenvExecDir = Get-Item -Path $VenvExecPath - -Write-Verbose "Activation script is located in path: '$VenvExecPath'" -Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" -Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" - -# Set values required in priority: CmdLine, ConfigFile, Default -# First, get the location of the virtual environment, it might not be -# VenvExecDir if specified on the command line. -if ($VenvDir) { - Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" -} -else { - Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." - $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") - Write-Verbose "VenvDir=$VenvDir" -} - -# Next, read the `pyvenv.cfg` file to determine any required value such -# as `prompt`. -$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir - -# Next, set the prompt from the command line, or the config file, or -# just use the name of the virtual environment folder. -if ($Prompt) { - Write-Verbose "Prompt specified as argument, using '$Prompt'" -} -else { - Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" - if ($pyvenvCfg -and $pyvenvCfg['prompt']) { - Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" - $Prompt = $pyvenvCfg['prompt']; - } - else { - Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" - Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" - $Prompt = Split-Path -Path $venvDir -Leaf - } -} - -Write-Verbose "Prompt = '$Prompt'" -Write-Verbose "VenvDir='$VenvDir'" - -# Deactivate any currently active virtual environment, but leave the -# deactivate function in place. -deactivate -nondestructive - -# Now set the environment variable VIRTUAL_ENV, used by many tools to determine -# that there is an activated venv. -$env:VIRTUAL_ENV = $VenvDir - -if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { - - Write-Verbose "Setting prompt to '$Prompt'" - - # Set the prompt to include the env name - # Make sure _OLD_VIRTUAL_PROMPT is global - function global:_OLD_VIRTUAL_PROMPT { "" } - Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT - New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt - - function global:prompt { - Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " - _OLD_VIRTUAL_PROMPT - } - $env:VIRTUAL_ENV_PROMPT = $Prompt -} - -# Clear PYTHONHOME -if (Test-Path -Path Env:PYTHONHOME) { - Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME - Remove-Item -Path Env:PYTHONHOME -} - -# Add the venv to the PATH -Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH -$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/coverage/venv/bin/activate b/coverage/venv/bin/activate deleted file mode 100644 index 4327693c2..000000000 --- a/coverage/venv/bin/activate +++ /dev/null @@ -1,70 +0,0 @@ -# This file must be used with "source bin/activate" *from bash* -# You cannot run it directly - -deactivate () { - # reset old environment variables - if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then - PATH="${_OLD_VIRTUAL_PATH:-}" - export PATH - unset _OLD_VIRTUAL_PATH - fi - if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then - PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" - export PYTHONHOME - unset _OLD_VIRTUAL_PYTHONHOME - fi - - # Call hash to forget past commands. Without forgetting - # past commands the $PATH changes we made may not be respected - hash -r 2> /dev/null - - if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then - PS1="${_OLD_VIRTUAL_PS1:-}" - export PS1 - unset _OLD_VIRTUAL_PS1 - fi - - unset VIRTUAL_ENV - unset VIRTUAL_ENV_PROMPT - if [ ! "${1:-}" = "nondestructive" ] ; then - # Self destruct! - unset -f deactivate - fi -} - -# unset irrelevant variables -deactivate nondestructive - -# on Windows, a path can contain colons and backslashes and has to be converted: -if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then - # transform D:\path\to\venv to /d/path/to/venv on MSYS - # and to /cygdrive/d/path/to/venv on Cygwin - export VIRTUAL_ENV=$(cygpath /home/runner/work/batpred/batpred/coverage/venv) -else - # use the path as-is - export VIRTUAL_ENV=/home/runner/work/batpred/batpred/coverage/venv -fi - -_OLD_VIRTUAL_PATH="$PATH" -PATH="$VIRTUAL_ENV/"bin":$PATH" -export PATH - -# unset PYTHONHOME if set -# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) -# could use `if (set -u; : $PYTHONHOME) ;` in bash -if [ -n "${PYTHONHOME:-}" ] ; then - _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" - unset PYTHONHOME -fi - -if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then - _OLD_VIRTUAL_PS1="${PS1:-}" - PS1='(venv) '"${PS1:-}" - export PS1 - VIRTUAL_ENV_PROMPT='(venv) ' - export VIRTUAL_ENV_PROMPT -fi - -# Call hash to forget past commands. Without forgetting -# past commands the $PATH changes we made may not be respected -hash -r 2> /dev/null diff --git a/coverage/venv/bin/activate.csh b/coverage/venv/bin/activate.csh deleted file mode 100644 index 9eb3fa788..000000000 --- a/coverage/venv/bin/activate.csh +++ /dev/null @@ -1,27 +0,0 @@ -# This file must be used with "source bin/activate.csh" *from csh*. -# You cannot run it directly. - -# Created by Davide Di Blasi . -# Ported to Python 3.3 venv by Andrew Svetlov - -alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' - -# Unset irrelevant variables. -deactivate nondestructive - -setenv VIRTUAL_ENV /home/runner/work/batpred/batpred/coverage/venv - -set _OLD_VIRTUAL_PATH="$PATH" -setenv PATH "$VIRTUAL_ENV/"bin":$PATH" - - -set _OLD_VIRTUAL_PROMPT="$prompt" - -if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - set prompt = '(venv) '"$prompt" - setenv VIRTUAL_ENV_PROMPT '(venv) ' -endif - -alias pydoc python -m pydoc - -rehash diff --git a/coverage/venv/bin/activate.fish b/coverage/venv/bin/activate.fish deleted file mode 100644 index 6d8fecd2c..000000000 --- a/coverage/venv/bin/activate.fish +++ /dev/null @@ -1,69 +0,0 @@ -# This file must be used with "source /bin/activate.fish" *from fish* -# (https://fishshell.com/). You cannot run it directly. - -function deactivate -d "Exit virtual environment and return to normal shell environment" - # reset old environment variables - if test -n "$_OLD_VIRTUAL_PATH" - set -gx PATH $_OLD_VIRTUAL_PATH - set -e _OLD_VIRTUAL_PATH - end - if test -n "$_OLD_VIRTUAL_PYTHONHOME" - set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME - set -e _OLD_VIRTUAL_PYTHONHOME - end - - if test -n "$_OLD_FISH_PROMPT_OVERRIDE" - set -e _OLD_FISH_PROMPT_OVERRIDE - # prevents error when using nested fish instances (Issue #93858) - if functions -q _old_fish_prompt - functions -e fish_prompt - functions -c _old_fish_prompt fish_prompt - functions -e _old_fish_prompt - end - end - - set -e VIRTUAL_ENV - set -e VIRTUAL_ENV_PROMPT - if test "$argv[1]" != "nondestructive" - # Self-destruct! - functions -e deactivate - end -end - -# Unset irrelevant variables. -deactivate nondestructive - -set -gx VIRTUAL_ENV /home/runner/work/batpred/batpred/coverage/venv - -set -gx _OLD_VIRTUAL_PATH $PATH -set -gx PATH "$VIRTUAL_ENV/"bin $PATH - -# Unset PYTHONHOME if set. -if set -q PYTHONHOME - set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME - set -e PYTHONHOME -end - -if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" - # fish uses a function instead of an env var to generate the prompt. - - # Save the current fish_prompt function as the function _old_fish_prompt. - functions -c fish_prompt _old_fish_prompt - - # With the original prompt function renamed, we can override with our own. - function fish_prompt - # Save the return status of the last command. - set -l old_status $status - - # Output the venv prompt; color taken from the blue of the Python logo. - printf "%s%s%s" (set_color 4B8BBE) '(venv) ' (set_color normal) - - # Restore the return status of the previous command. - echo "exit $old_status" | . - # Output the original/"old" prompt. - _old_fish_prompt - end - - set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" - set -gx VIRTUAL_ENV_PROMPT '(venv) ' -end diff --git a/coverage/venv/bin/coverage b/coverage/venv/bin/coverage deleted file mode 100755 index 11ddb6d5a..000000000 --- a/coverage/venv/bin/coverage +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from coverage.cmdline import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/coverage-3.12 b/coverage/venv/bin/coverage-3.12 deleted file mode 100755 index 106c7e8c5..000000000 --- a/coverage/venv/bin/coverage-3.12 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from coverage.cmdline import main_deprecated -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main_deprecated()) diff --git a/coverage/venv/bin/coverage3 b/coverage/venv/bin/coverage3 deleted file mode 100755 index 106c7e8c5..000000000 --- a/coverage/venv/bin/coverage3 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from coverage.cmdline import main_deprecated -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main_deprecated()) diff --git a/coverage/venv/bin/f2py b/coverage/venv/bin/f2py deleted file mode 100755 index 6a6ca2ecb..000000000 --- a/coverage/venv/bin/f2py +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from numpy.f2py.f2py2e import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/fonttools b/coverage/venv/bin/fonttools deleted file mode 100755 index 7b9c4ba8e..000000000 --- a/coverage/venv/bin/fonttools +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from fontTools.__main__ import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/identify-cli b/coverage/venv/bin/identify-cli deleted file mode 100755 index a78678e8d..000000000 --- a/coverage/venv/bin/identify-cli +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from identify.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/nodeenv b/coverage/venv/bin/nodeenv deleted file mode 100755 index 354c31b7c..000000000 --- a/coverage/venv/bin/nodeenv +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from nodeenv import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/normalizer b/coverage/venv/bin/normalizer deleted file mode 100755 index bceb80f61..000000000 --- a/coverage/venv/bin/normalizer +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from charset_normalizer.cli import cli_detect -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli_detect()) diff --git a/coverage/venv/bin/numpy-config b/coverage/venv/bin/numpy-config deleted file mode 100755 index cfc11056f..000000000 --- a/coverage/venv/bin/numpy-config +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from numpy._configtool import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/pip b/coverage/venv/bin/pip deleted file mode 100755 index 14994c2df..000000000 --- a/coverage/venv/bin/pip +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/pip3 b/coverage/venv/bin/pip3 deleted file mode 100755 index 14994c2df..000000000 --- a/coverage/venv/bin/pip3 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/pip3.12 b/coverage/venv/bin/pip3.12 deleted file mode 100755 index 14994c2df..000000000 --- a/coverage/venv/bin/pip3.12 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/pre-commit b/coverage/venv/bin/pre-commit deleted file mode 100755 index 52dede485..000000000 --- a/coverage/venv/bin/pre-commit +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pre_commit.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/pyftmerge b/coverage/venv/bin/pyftmerge deleted file mode 100755 index bb15b3e32..000000000 --- a/coverage/venv/bin/pyftmerge +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from fontTools.merge import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/pyftsubset b/coverage/venv/bin/pyftsubset deleted file mode 100755 index e7fa668a7..000000000 --- a/coverage/venv/bin/pyftsubset +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from fontTools.subset import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/python b/coverage/venv/bin/python deleted file mode 120000 index b8a0adbbb..000000000 --- a/coverage/venv/bin/python +++ /dev/null @@ -1 +0,0 @@ -python3 \ No newline at end of file diff --git a/coverage/venv/bin/python3 b/coverage/venv/bin/python3 deleted file mode 120000 index ae65fdaa1..000000000 --- a/coverage/venv/bin/python3 +++ /dev/null @@ -1 +0,0 @@ -/usr/bin/python3 \ No newline at end of file diff --git a/coverage/venv/bin/python3.12 b/coverage/venv/bin/python3.12 deleted file mode 120000 index b8a0adbbb..000000000 --- a/coverage/venv/bin/python3.12 +++ /dev/null @@ -1 +0,0 @@ -python3 \ No newline at end of file diff --git a/coverage/venv/bin/ttx b/coverage/venv/bin/ttx deleted file mode 100755 index 9242dfa35..000000000 --- a/coverage/venv/bin/ttx +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from fontTools.ttx import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/coverage/venv/bin/virtualenv b/coverage/venv/bin/virtualenv deleted file mode 100755 index 469d27def..000000000 --- a/coverage/venv/bin/virtualenv +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/runner/work/batpred/batpred/coverage/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from virtualenv.__main__ import run_with_catch -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(run_with_catch()) diff --git a/coverage/venv/lib64 b/coverage/venv/lib64 deleted file mode 120000 index 7951405f8..000000000 --- a/coverage/venv/lib64 +++ /dev/null @@ -1 +0,0 @@ -lib \ No newline at end of file diff --git a/coverage/venv/pyvenv.cfg b/coverage/venv/pyvenv.cfg deleted file mode 100644 index 458747159..000000000 --- a/coverage/venv/pyvenv.cfg +++ /dev/null @@ -1,5 +0,0 @@ -home = /usr/bin -include-system-site-packages = false -version = 3.12.3 -executable = /usr/bin/python3.12 -command = /usr/bin/python3 -m venv /home/runner/work/batpred/batpred/coverage/venv diff --git a/coverage/venv/share/man/man1/ttx.1 b/coverage/venv/share/man/man1/ttx.1 deleted file mode 100644 index bba23b5e5..000000000 --- a/coverage/venv/share/man/man1/ttx.1 +++ /dev/null @@ -1,225 +0,0 @@ -.Dd May 18, 2004 -.\" ttx is not specific to any OS, but contrary to what groff_mdoc(7) -.\" seems to imply, entirely omitting the .Os macro causes 'BSD' to -.\" be used, so I give a zero-width space as its argument. -.Os \& -.\" The "FontTools Manual" argument apparently has no effect in -.\" groff 1.18.1. I think it is a bug in the -mdoc groff package. -.Dt TTX 1 "FontTools Manual" -.Sh NAME -.Nm ttx -.Nd tool for manipulating TrueType and OpenType fonts -.Sh SYNOPSIS -.Nm -.Bk -.Op Ar option ... -.Ek -.Bk -.Ar file ... -.Ek -.Sh DESCRIPTION -.Nm -is a tool for manipulating TrueType and OpenType fonts. It can convert -TrueType and OpenType fonts to and from an -.Tn XML Ns -based format called -.Tn TTX . -.Tn TTX -files have a -.Ql .ttx -extension. -.Pp -For each -.Ar file -argument it is given, -.Nm -detects whether it is a -.Ql .ttf , -.Ql .otf -or -.Ql .ttx -file and acts accordingly: if it is a -.Ql .ttf -or -.Ql .otf -file, it generates a -.Ql .ttx -file; if it is a -.Ql .ttx -file, it generates a -.Ql .ttf -or -.Ql .otf -file. -.Pp -By default, every output file is created in the same directory as the -corresponding input file and with the same name except for the -extension, which is substituted appropriately. -.Nm -never overwrites existing files; if necessary, it appends a suffix to -the output file name before the extension, as in -.Pa Arial#1.ttf . -.Ss "General options" -.Bl -tag -width ".Fl t Ar table" -.It Fl h -Display usage information. -.It Fl d Ar dir -Write the output files to directory -.Ar dir -instead of writing every output file to the same directory as the -corresponding input file. -.It Fl o Ar file -Write the output to -.Ar file -instead of writing it to the same directory as the -corresponding input file. -.It Fl v -Be verbose. Write more messages to the standard output describing what -is being done. -.It Fl a -Allow virtual glyphs ID's on compile or decompile. -.El -.Ss "Dump options" -The following options control the process of dumping font files -(TrueType or OpenType) to -.Tn TTX -files. -.Bl -tag -width ".Fl t Ar table" -.It Fl l -List table information. Instead of dumping the font to a -.Tn TTX -file, display minimal information about each table. -.It Fl t Ar table -Dump table -.Ar table . -This option may be given multiple times to dump several tables at -once. When not specified, all tables are dumped. -.It Fl x Ar table -Exclude table -.Ar table -from the list of tables to dump. This option may be given multiple -times to exclude several tables from the dump. The -.Fl t -and -.Fl x -options are mutually exclusive. -.It Fl s -Split tables. Dump each table to a separate -.Tn TTX -file and write (under the name that would have been used for the output -file if the -.Fl s -option had not been given) one small -.Tn TTX -file containing references to the individual table dump files. This -file can be used as input to -.Nm -as long as the referenced files can be found in the same directory. -.It Fl i -.\" XXX: I suppose OpenType programs (exist and) are also affected. -Don't disassemble TrueType instructions. When this option is specified, -all TrueType programs (glyph programs, the font program and the -pre-program) are written to the -.Tn TTX -file as hexadecimal data instead of -assembly. This saves some time and results in smaller -.Tn TTX -files. -.It Fl y Ar n -When decompiling a TrueType Collection (TTC) file, -decompile font number -.Ar n , -starting from 0. -.El -.Ss "Compilation options" -The following options control the process of compiling -.Tn TTX -files into font files (TrueType or OpenType): -.Bl -tag -width ".Fl t Ar table" -.It Fl m Ar fontfile -Merge the input -.Tn TTX -file -.Ar file -with -.Ar fontfile . -No more than one -.Ar file -argument can be specified when this option is used. -.It Fl b -Don't recalculate glyph bounding boxes. Use the values in the -.Tn TTX -file as is. -.El -.Sh "THE TTX FILE FORMAT" -You can find some information about the -.Tn TTX -file format in -.Pa documentation.html . -In particular, you will find in that file the list of tables understood by -.Nm -and the relations between TrueType GlyphIDs and the glyph names used in -.Tn TTX -files. -.Sh EXAMPLES -In the following examples, all files are read from and written to the -current directory. Additionally, the name given for the output file -assumes in every case that it did not exist before -.Nm -was invoked. -.Pp -Dump the TrueType font contained in -.Pa FreeSans.ttf -to -.Pa FreeSans.ttx : -.Pp -.Dl ttx FreeSans.ttf -.Pp -Compile -.Pa MyFont.ttx -into a TrueType or OpenType font file: -.Pp -.Dl ttx MyFont.ttx -.Pp -List the tables in -.Pa FreeSans.ttf -along with some information: -.Pp -.Dl ttx -l FreeSans.ttf -.Pp -Dump the -.Sq cmap -table from -.Pa FreeSans.ttf -to -.Pa FreeSans.ttx : -.Pp -.Dl ttx -t cmap FreeSans.ttf -.Sh NOTES -On MS\-Windows and MacOS, -.Nm -is available as a graphical application to which files can be dropped. -.Sh SEE ALSO -.Pa documentation.html -.Pp -.Xr fontforge 1 , -.Xr ftinfo 1 , -.Xr gfontview 1 , -.Xr xmbdfed 1 , -.Xr Font::TTF 3pm -.Sh AUTHORS -.Nm -was written by -.An -nosplit -.An "Just van Rossum" Aq just@letterror.com . -.Pp -This manual page was written by -.An "Florent Rougon" Aq f.rougon@free.fr -for the Debian GNU/Linux system based on the existing FontTools -documentation. It may be freely used, modified and distributed without -restrictions. -.\" For Emacs: -.\" Local Variables: -.\" fill-column: 72 -.\" sentence-end: "[.?!][]\"')}]*\\($\\| $\\| \\| \\)[ \n]*" -.\" sentence-end-double-space: t -.\" End: \ No newline at end of file From 10f51fca06372dbb9fa3f19f194d08f9da501051 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:43:16 +0000 Subject: [PATCH 6/6] Refactor test code to reduce duplication using helper function Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com> --- apps/predbat/tests/test_multi_car_iog.py | 101 +++++++---------------- 1 file changed, 32 insertions(+), 69 deletions(-) diff --git a/apps/predbat/tests/test_multi_car_iog.py b/apps/predbat/tests/test_multi_car_iog.py index fd8dc3873..85b4e0014 100644 --- a/apps/predbat/tests/test_multi_car_iog.py +++ b/apps/predbat/tests/test_multi_car_iog.py @@ -11,6 +11,35 @@ from datetime import timedelta +def process_octopus_intelligent_slots(my_predbat): + """ + Helper function to simulate the octopus intelligent slot processing from fetch_sensor_data + """ + entity_id_config = my_predbat.get_arg("octopus_intelligent_slot", indirect=False) + + # Normalize to list + if entity_id_config and not isinstance(entity_id_config, list): + entity_id_list = [entity_id_config] + elif entity_id_config: + entity_id_list = entity_id_config + else: + entity_id_list = [] + + # Process each car + for car_n in range(min(len(entity_id_list), my_predbat.num_cars)): + entity_id = entity_id_list[car_n] + if not entity_id: + continue + + completed = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or [] + planned = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or [] + + if completed: + my_predbat.octopus_slots += completed + if planned: + my_predbat.octopus_slots += planned + + def run_multi_car_iog_test(testname, my_predbat): """ Test multi-car Intelligent Octopus Go (IOG) support @@ -65,29 +94,7 @@ def run_multi_car_iog_test(testname, my_predbat): # Simulate the octopus intelligent slot processing from fetch_sensor_data my_predbat.octopus_slots = [] - entity_id_config = my_predbat.get_arg("octopus_intelligent_slot", indirect=False) - - # Normalize to list - if entity_id_config and not isinstance(entity_id_config, list): - entity_id_list = [entity_id_config] - elif entity_id_config: - entity_id_list = entity_id_config - else: - entity_id_list = [] - - # Process each car - for car_n in range(min(len(entity_id_list), my_predbat.num_cars)): - entity_id = entity_id_list[car_n] - if not entity_id: - continue - - completed = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or [] - planned = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or [] - - if completed: - my_predbat.octopus_slots += completed - if planned: - my_predbat.octopus_slots += planned + process_octopus_intelligent_slots(my_predbat) if len(my_predbat.octopus_slots) != 1: print("ERROR: Expected 1 slot for single car, got {}".format(len(my_predbat.octopus_slots))) @@ -145,29 +152,7 @@ def run_multi_car_iog_test(testname, my_predbat): ) # Simulate the octopus intelligent slot processing - entity_id_config = my_predbat.get_arg("octopus_intelligent_slot", indirect=False) - - # Normalize to list - if entity_id_config and not isinstance(entity_id_config, list): - entity_id_list = [entity_id_config] - elif entity_id_config: - entity_id_list = entity_id_config - else: - entity_id_list = [] - - # Process each car - for car_n in range(min(len(entity_id_list), my_predbat.num_cars)): - entity_id = entity_id_list[car_n] - if not entity_id: - continue - - completed = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or [] - planned = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or [] - - if completed: - my_predbat.octopus_slots += completed - if planned: - my_predbat.octopus_slots += planned + process_octopus_intelligent_slots(my_predbat) # Should have slots from both cars merged if len(my_predbat.octopus_slots) != 2: @@ -184,29 +169,7 @@ def run_multi_car_iog_test(testname, my_predbat): ] # Simulate the octopus intelligent slot processing - entity_id_config = my_predbat.get_arg("octopus_intelligent_slot", indirect=False) - - # Normalize to list - if entity_id_config and not isinstance(entity_id_config, list): - entity_id_list = [entity_id_config] - elif entity_id_config: - entity_id_list = entity_id_config - else: - entity_id_list = [] - - # Process each car - for car_n in range(min(len(entity_id_list), my_predbat.num_cars)): - entity_id = entity_id_list[car_n] - if not entity_id: - continue - - completed = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="completed_dispatches") or [] - planned = my_predbat.get_state_wrapper(entity_id=entity_id, attribute="planned_dispatches") or [] - - if completed: - my_predbat.octopus_slots += completed - if planned: - my_predbat.octopus_slots += planned + process_octopus_intelligent_slots(my_predbat) # Should have slots from first car only if len(my_predbat.octopus_slots) != 1: