From d410f9d3c481d65b0d4d84ac1e237a102ee39e1b Mon Sep 17 00:00:00 2001 From: Raffson Date: Thu, 2 Feb 2023 21:37:53 +0100 Subject: [PATCH] Formatting... --- game/campaignloader/defaultsquadronassigner.py | 3 --- game/ground_forces/ai_ground_planner.py | 2 -- game/layout/layout.py | 1 - game/layout/layoutloader.py | 1 - game/missiongenerator/aircraft/waypoints/joinpoint.py | 1 - game/missiongenerator/aircraft/waypoints/splitpoint.py | 1 - game/missiongenerator/drawingsgenerator.py | 1 - game/missiongenerator/flotgenerator.py | 4 ---- game/missiongenerator/kneeboard.py | 2 -- game/procurement.py | 1 - game/scenery_group.py | 1 - game/server/eventstream/models.py | 1 - game/sim/missionresultsprocessor.py | 1 - game/theater/theatergroup.py | 3 ++- game/transfers.py | 1 - game/weather.py | 1 - qt_ui/liberation_theme.py | 4 ++-- qt_ui/uiconstants.py | 1 - qt_ui/widgets/QFrequencyWidget.py | 1 - qt_ui/widgets/QLink4Widget.py | 1 - qt_ui/widgets/combos/QPredefinedWaypointSelectionComboBox.py | 1 - qt_ui/windows/GameUpdateSignal.py | 1 - qt_ui/windows/QWaitingForMissionResultWindow.py | 1 - qt_ui/windows/groundobject/QGroundObjectMenu.py | 2 -- qt_ui/windows/intel.py | 1 - .../mission/flight/waypoints/QFlightWaypointInfoBox.py | 1 - qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py | 1 - .../flight/waypoints/QPredefinedWaypointSelectionWindow.py | 1 - qt_ui/windows/newgame/QNewGameWizard.py | 1 - qt_ui/windows/preferences/QLiberationPreferences.py | 1 - qt_ui/windows/settings/QSettingsWindow.py | 1 - qt_ui/windows/stats/QAircraftChart.py | 1 - qt_ui/windows/stats/QArmorChart.py | 1 - tests/test_factions.py | 1 - 34 files changed, 4 insertions(+), 43 deletions(-) diff --git a/game/campaignloader/defaultsquadronassigner.py b/game/campaignloader/defaultsquadronassigner.py index d085bee5..a49bb612 100644 --- a/game/campaignloader/defaultsquadronassigner.py +++ b/game/campaignloader/defaultsquadronassigner.py @@ -29,7 +29,6 @@ class DefaultSquadronAssigner: self.coalition.player ): for squadron_config in self.config.by_location[control_point]: - squadron_def = self.override_squadron_defaults( self.find_squadron_for(squadron_config, control_point), squadron_config, @@ -53,7 +52,6 @@ class DefaultSquadronAssigner: def find_squadron_for( self, config: SquadronConfig, control_point: ControlPoint ) -> Optional[SquadronDef]: - for preferred_aircraft in config.aircraft: squadron_def = self.find_preferred_squadron( preferred_aircraft, config.primary, control_point @@ -154,7 +152,6 @@ class DefaultSquadronAssigner: def override_squadron_defaults( squadron_def: Optional[SquadronDef], config: SquadronConfig ) -> Optional[SquadronDef]: - if squadron_def is None: return None diff --git a/game/ground_forces/ai_ground_planner.py b/game/ground_forces/ai_ground_planner.py index 5514deb1..5a58671b 100644 --- a/game/ground_forces/ai_ground_planner.py +++ b/game/ground_forces/ai_ground_planner.py @@ -89,7 +89,6 @@ class GroundPlanner: self.reserve: List[CombatGroup] = [] def plan_groundwar(self) -> None: - ground_unit_limit = self.cp.frontline_unit_count_limit remaining_available_frontline_units = ground_unit_limit @@ -139,7 +138,6 @@ class GroundPlanner: remaining_available_frontline_units -= available while available > 0: - if role == CombatGroupRole.SHORAD: count = 1 else: diff --git a/game/layout/layout.py b/game/layout/layout.py index d5b946d4..5fc6eecc 100644 --- a/game/layout/layout.py +++ b/game/layout/layout.py @@ -238,7 +238,6 @@ class AntiAirLayout(TgoLayout): location: PresetLocation, control_point: ControlPoint, ) -> IadsGroundObject: - if GroupTask.EARLY_WARNING_RADAR in self.tasks: return EwrGroundObject(name, location, control_point) elif any(tasking in self.tasks for tasking in GroupRole.AIR_DEFENSE.tasks): diff --git a/game/layout/layoutloader.py b/game/layout/layoutloader.py index 55be05c8..ef6ddc38 100644 --- a/game/layout/layoutloader.py +++ b/game/layout/layoutloader.py @@ -132,7 +132,6 @@ class LayoutLoader: temp_mis.country(country.name).ship_group, temp_mis.country(country.name).static_group, ): - try: g_id, u_id, group_name, group_mapping = mapping.group_for_name( dcs_group.name diff --git a/game/missiongenerator/aircraft/waypoints/joinpoint.py b/game/missiongenerator/aircraft/waypoints/joinpoint.py index 8b763e10..48ce1dbf 100644 --- a/game/missiongenerator/aircraft/waypoints/joinpoint.py +++ b/game/missiongenerator/aircraft/waypoints/joinpoint.py @@ -71,7 +71,6 @@ class JoinPointBuilder(PydcsWaypointBuilder): max_dist: float = 30.0, vertical_spacing: float = 2000.0, ) -> None: - rx = (random.random() + 0.1) * 333 ry = feet(vertical_spacing).meters rz = (random.random() + 0.1) * 50 * random.choice([-1, 1]) diff --git a/game/missiongenerator/aircraft/waypoints/splitpoint.py b/game/missiongenerator/aircraft/waypoints/splitpoint.py index 9bf99578..8b168e95 100644 --- a/game/missiongenerator/aircraft/waypoints/splitpoint.py +++ b/game/missiongenerator/aircraft/waypoints/splitpoint.py @@ -6,7 +6,6 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder class SplitPointBuilder(PydcsWaypointBuilder): def add_tasks(self, waypoint: MovingPoint) -> None: - if not self.flight.flight_type.is_air_to_air: # Capture any non A/A type to avoid issues with SPJs that use the primary radar such as the F/A-18C. # You can bully them with STT to not be able to fire radar guided missiles at you, diff --git a/game/missiongenerator/drawingsgenerator.py b/game/missiongenerator/drawingsgenerator.py index aba80a8a..2ee2c926 100644 --- a/game/missiongenerator/drawingsgenerator.py +++ b/game/missiongenerator/drawingsgenerator.py @@ -59,7 +59,6 @@ class DrawingsGenerator: if destination in seen: continue else: - # Determine path color if cp.captured and destination.captured: color = BLUE_PATH_COLOR diff --git a/game/missiongenerator/flotgenerator.py b/game/missiongenerator/flotgenerator.py index a61f2342..60a0a23b 100644 --- a/game/missiongenerator/flotgenerator.py +++ b/game/missiongenerator/flotgenerator.py @@ -204,7 +204,6 @@ class FlotGenerator: side: Country, forward_heading: Heading, ) -> None: - infantry_position = self.conflict.find_ground_position( group.points[0].position.random_point_within(250, 50), 500, @@ -344,7 +343,6 @@ class FlotGenerator: # Artillery will fall back when under attack if stance != CombatStance.RETREAT: - # Hold position dcs_group.points[1].tasks.append(Hold()) retreat = self.find_retreat_point( @@ -522,12 +520,10 @@ class FlotGenerator: from_cp: ControlPoint, to_cp: ControlPoint, ) -> None: - if not self.game.settings.perf_moving_units: return for dcs_group, group in ally_groups: - if group.role == CombatGroupRole.ARTILLERY: if self.game.settings.perf_artillery: target = self.get_artillery_target_in_range( diff --git a/game/missiongenerator/kneeboard.py b/game/missiongenerator/kneeboard.py index 37dac354..bf1e5288 100644 --- a/game/missiongenerator/kneeboard.py +++ b/game/missiongenerator/kneeboard.py @@ -192,7 +192,6 @@ class NumberedWaypoint: class FlightPlanBuilder: - WAYPOINT_DESC_MAX_LEN = 25 def __init__(self, start_time: datetime.datetime, units: UnitSystem) -> None: @@ -544,7 +543,6 @@ class SupportPage(KneeboardPage): aewc_ladder = [] for single_aewc in self.awacs: - if single_aewc.depature_location is None: dep = "-" arr = "-" diff --git a/game/procurement.py b/game/procurement.py index 5d3a0d7a..613b6ef8 100644 --- a/game/procurement.py +++ b/game/procurement.py @@ -41,7 +41,6 @@ class ProcurementAi: manage_front_line: bool, manage_aircraft: bool, ) -> None: - self.game = game self.is_player = for_player self.air_wing = game.air_wing_for(for_player) diff --git a/game/scenery_group.py b/game/scenery_group.py index 3a4f4291..473e0da7 100644 --- a/game/scenery_group.py +++ b/game/scenery_group.py @@ -31,7 +31,6 @@ class SceneryGroup: def __init__( self, zone_def: TriggerZone, zones: Iterable[TriggerZone], category: str ) -> None: - self.zone_def = zone_def self.zones = zones self.position = zone_def.position diff --git a/game/server/eventstream/models.py b/game/server/eventstream/models.py index fbb17ac3..a2d7a69c 100644 --- a/game/server/eventstream/models.py +++ b/game/server/eventstream/models.py @@ -50,7 +50,6 @@ class GameUpdateEventsJs(BaseModel): def from_events( cls, events: GameUpdateEvents, game: Game | None ) -> GameUpdateEventsJs: - # We still need to be able to send update events when there is no game loaded # because we need to send the unload event. new_combats = [] diff --git a/game/sim/missionresultsprocessor.py b/game/sim/missionresultsprocessor.py index 46d903f1..b3f03a25 100644 --- a/game/sim/missionresultsprocessor.py +++ b/game/sim/missionresultsprocessor.py @@ -235,7 +235,6 @@ class MissionResultsProcessor: delta = DEFEAT_INFLUENCE status_msg = f"Enemy casualties outnumber allied casualties along the {cp.name}-{enemy_cp.name} frontline. Allied forces claim a victory." elif ally_casualties > enemy_casualties: - if ( ally_units_alive > 2 * enemy_units_alive and player_aggresive diff --git a/game/theater/theatergroup.py b/game/theater/theatergroup.py index 6d803643..ddffe4bc 100644 --- a/game/theater/theatergroup.py +++ b/game/theater/theatergroup.py @@ -195,7 +195,8 @@ class TheaterGroup: def max_threat_range(self, radar_only: bool = False) -> Distance: """Calculate the maximum threat range of the TheaterGroup. - This also checks for Launcher and Tracker Pairs and if they are functioning or not. Allows to also use only radar emitting units for the calculation with the parameter.""" + This also checks for Launcher and Tracker Pairs and if they are functioning or not. Allows to also use only radar emitting units for the calculation with the parameter. + """ max_non_radar = meters(0) max_telar_range = meters(0) max_tel_range = meters(0) diff --git a/game/transfers.py b/game/transfers.py index d6124b4a..b755f4b9 100644 --- a/game/transfers.py +++ b/game/transfers.py @@ -717,7 +717,6 @@ class PendingTransfers: self.order_airlift_assets_at(control_point) def desired_airlift_capacity(self, control_point: ControlPoint) -> int: - if control_point.has_factory: is_major_hub = control_point.total_aircraft_parking > 0 # Check if there is a CP which is only reachable via Airlift diff --git a/game/weather.py b/game/weather.py index b1e52187..c8251bf1 100644 --- a/game/weather.py +++ b/game/weather.py @@ -299,7 +299,6 @@ class Weather: def interpolate_solar_activity( time_of_day: TimeOfDay, high: float, low: float ) -> float: - scale: float = 0 match time_of_day: diff --git a/qt_ui/liberation_theme.py b/qt_ui/liberation_theme.py index 0bc7dbb3..25eb26a4 100644 --- a/qt_ui/liberation_theme.py +++ b/qt_ui/liberation_theme.py @@ -32,7 +32,7 @@ def init(): if os.path.isfile(THEME_PREFERENCES_FILE_PATH): try: - with (open(THEME_PREFERENCES_FILE_PATH)) as prefs: + with open(THEME_PREFERENCES_FILE_PATH) as prefs: pref_data = json.loads(prefs.read()) __theme_index = pref_data["theme_index"] set_theme_index(__theme_index) @@ -83,5 +83,5 @@ def get_theme_css_file(): # save current theme index to json file def save_theme_config(): pref_data = {"theme_index": get_theme_index()} - with (open(THEME_PREFERENCES_FILE_PATH, "w")) as prefs: + with open(THEME_PREFERENCES_FILE_PATH, "w") as prefs: prefs.write(json.dumps(pref_data)) diff --git a/qt_ui/uiconstants.py b/qt_ui/uiconstants.py index f37edc49..dcd87b58 100644 --- a/qt_ui/uiconstants.py +++ b/qt_ui/uiconstants.py @@ -24,7 +24,6 @@ ICONS: Dict[str, QPixmap] = {} def load_icons(): - ICONS["New"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/new.png") ICONS["Open"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/open.png") ICONS["Save"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/save.png") diff --git a/qt_ui/widgets/QFrequencyWidget.py b/qt_ui/widgets/QFrequencyWidget.py index 30abddda..935ee167 100644 --- a/qt_ui/widgets/QFrequencyWidget.py +++ b/qt_ui/widgets/QFrequencyWidget.py @@ -14,7 +14,6 @@ from qt_ui.windows.QRadioFrequencyDialog import QRadioFrequencyDialog class QFrequencyWidget(QWidget): - freq_changed = Signal(QWidget) def __init__( diff --git a/qt_ui/widgets/QLink4Widget.py b/qt_ui/widgets/QLink4Widget.py index 1126e346..dc0647ed 100644 --- a/qt_ui/widgets/QLink4Widget.py +++ b/qt_ui/widgets/QLink4Widget.py @@ -13,7 +13,6 @@ from qt_ui.windows.QRadioFrequencyDialog import QRadioFrequencyDialog class QLink4Widget(QWidget): - freq_changed = Signal(QWidget) def __init__(self, cp: NavalControlPoint, game_model: GameModel) -> None: diff --git a/qt_ui/widgets/combos/QPredefinedWaypointSelectionComboBox.py b/qt_ui/widgets/combos/QPredefinedWaypointSelectionComboBox.py index 1c9ca999..6947817a 100644 --- a/qt_ui/widgets/combos/QPredefinedWaypointSelectionComboBox.py +++ b/qt_ui/widgets/combos/QPredefinedWaypointSelectionComboBox.py @@ -54,7 +54,6 @@ class QPredefinedWaypointSelectionComboBox(QFilteredComboBox): return waypoints def find_possible_waypoints(self): - self.wpts = [] model = QStandardItemModel() i = 0 diff --git a/qt_ui/windows/GameUpdateSignal.py b/qt_ui/windows/GameUpdateSignal.py index ba7309c2..0ce7f89b 100644 --- a/qt_ui/windows/GameUpdateSignal.py +++ b/qt_ui/windows/GameUpdateSignal.py @@ -10,7 +10,6 @@ from game.game import TurnState class GameUpdateSignal(QObject): - instance = None gameupdated = Signal(Game) budgetupdated = Signal(Game) diff --git a/qt_ui/windows/QWaitingForMissionResultWindow.py b/qt_ui/windows/QWaitingForMissionResultWindow.py index 1ef616c1..e16fdf41 100644 --- a/qt_ui/windows/QWaitingForMissionResultWindow.py +++ b/qt_ui/windows/QWaitingForMissionResultWindow.py @@ -30,7 +30,6 @@ from qt_ui.windows.GameUpdateSignal import GameUpdateSignal class DebriefingFileWrittenSignal(QObject): - instance = None debriefingReceived = Signal(Debriefing) diff --git a/qt_ui/windows/groundobject/QGroundObjectMenu.py b/qt_ui/windows/groundobject/QGroundObjectMenu.py index 4db606bf..d99c58b1 100644 --- a/qt_ui/windows/groundobject/QGroundObjectMenu.py +++ b/qt_ui/windows/groundobject/QGroundObjectMenu.py @@ -57,7 +57,6 @@ class QGroundObjectMenu(QDialog): self.init_ui() def init_ui(self): - self.mainLayout = QVBoxLayout() self.budget = QBudgetBox(self.game) self.budget.setGame(self.game) @@ -92,7 +91,6 @@ class QGroundObjectMenu(QDialog): self.setLayout(self.mainLayout) def doLayout(self): - self.update_total_value() self.intelBox = QGroupBox("Units :") self.intelLayout = QGridLayout() diff --git a/qt_ui/windows/intel.py b/qt_ui/windows/intel.py index 8ae11087..3f412644 100644 --- a/qt_ui/windows/intel.py +++ b/qt_ui/windows/intel.py @@ -160,7 +160,6 @@ class IntelWindow(QDialog): self.refresh_layout() def refresh_layout(self) -> None: - # Clear the existing layout if self.layout(): idx = 0 diff --git a/qt_ui/windows/mission/flight/waypoints/QFlightWaypointInfoBox.py b/qt_ui/windows/mission/flight/waypoints/QFlightWaypointInfoBox.py index 4af48d55..70b1b6d4 100644 --- a/qt_ui/windows/mission/flight/waypoints/QFlightWaypointInfoBox.py +++ b/qt_ui/windows/mission/flight/waypoints/QFlightWaypointInfoBox.py @@ -14,7 +14,6 @@ class QFlightWaypointInfoBox(QGroupBox): self.init_ui() def init_ui(self) -> None: - layout = QVBoxLayout() x_pos_layout = QHBoxLayout() diff --git a/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py b/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py index 04f07d51..54e19efc 100644 --- a/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py +++ b/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py @@ -60,7 +60,6 @@ class QFlightWaypointTab(QFrame): self.recreate_buttons.clear() for task in self.package.target.mission_types(for_player=True): - if task == FlightType.AIR_ASSAULT and not self.game.settings.plugin_option( "ctld" ): diff --git a/qt_ui/windows/mission/flight/waypoints/QPredefinedWaypointSelectionWindow.py b/qt_ui/windows/mission/flight/waypoints/QPredefinedWaypointSelectionWindow.py index 63dd4386..33cb50a7 100644 --- a/qt_ui/windows/mission/flight/waypoints/QPredefinedWaypointSelectionWindow.py +++ b/qt_ui/windows/mission/flight/waypoints/QPredefinedWaypointSelectionWindow.py @@ -27,7 +27,6 @@ PREDEFINED_WAYPOINT_CATEGORIES = [ class QPredefinedWaypointSelectionWindow(QDialog): - # List of FlightWaypoint waypoints_added = Signal(list) diff --git a/qt_ui/windows/newgame/QNewGameWizard.py b/qt_ui/windows/newgame/QNewGameWizard.py index 4bfa6bcb..4e76c316 100644 --- a/qt_ui/windows/newgame/QNewGameWizard.py +++ b/qt_ui/windows/newgame/QNewGameWizard.py @@ -442,7 +442,6 @@ class FactionSelection(QtWidgets.QWizardPage): self.updateUnitRecap() def updateUnitRecap(self): - red_faction = FACTIONS[self.redFactionSelect.currentText()] blue_faction = FACTIONS[self.blueFactionSelect.currentText()] diff --git a/qt_ui/windows/preferences/QLiberationPreferences.py b/qt_ui/windows/preferences/QLiberationPreferences.py index fbfa6770..1cc9c7ee 100644 --- a/qt_ui/windows/preferences/QLiberationPreferences.py +++ b/qt_ui/windows/preferences/QLiberationPreferences.py @@ -87,7 +87,6 @@ class QLiberationPreferences(QFrame): self.edit_dcs_install_dir.setText(install_dir) def apply(self): - print("Applying changes") self.saved_game_dir = self.edit_saved_game_dir.text() self.dcs_install_dir = self.edit_dcs_install_dir.text() diff --git a/qt_ui/windows/settings/QSettingsWindow.py b/qt_ui/windows/settings/QSettingsWindow.py index b313c86f..6c60e4d7 100644 --- a/qt_ui/windows/settings/QSettingsWindow.py +++ b/qt_ui/windows/settings/QSettingsWindow.py @@ -331,7 +331,6 @@ class QSettingsWindow(QDialog): self.setLayout(self.layout) def initCheatLayout(self): - self.cheatPage = QWidget() self.cheatLayout = QVBoxLayout() self.cheatPage.setLayout(self.cheatLayout) diff --git a/qt_ui/windows/stats/QAircraftChart.py b/qt_ui/windows/stats/QAircraftChart.py index 439f775b..2da34020 100644 --- a/qt_ui/windows/stats/QAircraftChart.py +++ b/qt_ui/windows/stats/QAircraftChart.py @@ -18,7 +18,6 @@ class QAircraftChart(QFrame): self.setLayout(self.layout) def generateUnitCharts(self): - self.alliedAircraft = [ d.allied_units.aircraft_count for d in self.game.game_stats.data_per_turn ] diff --git a/qt_ui/windows/stats/QArmorChart.py b/qt_ui/windows/stats/QArmorChart.py index 4a140b32..e5b7763a 100644 --- a/qt_ui/windows/stats/QArmorChart.py +++ b/qt_ui/windows/stats/QArmorChart.py @@ -18,7 +18,6 @@ class QArmorChart(QFrame): self.setLayout(self.layout) def generateUnitCharts(self): - self.alliedArmor = [ d.allied_units.vehicles_count for d in self.game.game_stats.data_per_turn ] diff --git a/tests/test_factions.py b/tests/test_factions.py index bec4c278..0a02f211 100644 --- a/tests/test_factions.py +++ b/tests/test_factions.py @@ -106,7 +106,6 @@ class TestFactionLoader(unittest.TestCase): @pytest.mark.skip(reason="Faction unit names in the json files are outdated") def test_load_valid_faction_with_invalid_country(self) -> None: - with (RESOURCES_DIR / "invalid_faction_country.json").open("r") as data: try: Faction.from_json(json.load(data))