diff --git a/.circleci/config.yml b/.circleci/config.yml index 85dfc97c..7878a239 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -version: 2.0 +version: 2.1 build_and_test: &build_and_test_steps - checkout @@ -11,27 +11,21 @@ build_and_test: &build_and_test_steps jobs: - StyleCheck: + pre-commit: docker: - image: cimg/python:3.11 steps: - checkout - - run: python --version ; pip --version ; pwd ; ls -l - - run: pip install black codespell ruff - - run: codespell -L queenland,uint,assertin - - run: ruff check - - run: black . --check + - run: pipx run pre-commit run --all-files --show-diff-on-failure - - Python3: + pytest: docker: - - image: cimg/python:3.11 + - image: cimg/python:3.13 steps: *build_and_test_steps workflows: - version: 2 build: jobs: - - StyleCheck - - Python3 + - pre-commit + - pytest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..7a7acd60 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,70 @@ +# Learn more about this config here: https://pre-commit.com/ + +# To enable these pre-commit hooks run: +# `pipx install pre-commit` or `brew install pre-commit` +# Then in the project root directory run `pre-commit install` + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-added-large-files + - id: check-ast + # - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + exclude: "test_s2gs/test_all.py$" + # - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + - id: check-symlinks + - id: check-toml + - id: check-vcs-permalinks + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: file-contents-sorter + - id: fix-byte-order-marker + - id: forbid-new-submodules + - id: forbid-submodules + #- id: mixed-line-ending + # args: + # - --fix=lf + #- id: name-tests-test + #- id: pretty-format-json + # exclude: fe/jsconfig.json + - id: requirements-txt-fixer + - id: sort-simple-yaml + - id: trailing-whitespace + + - repo: https://github.com/MarcoGorelli/auto-walrus + rev: 0.3.4 + hooks: + - id: auto-walrus + + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell # See pyproject.toml for args + additional_dependencies: + - tomli + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.13.2 + hooks: + - id: ruff-check + # - id: ruff-format + + - repo: https://github.com/tox-dev/pyproject-fmt + rev: v2.6.0 + hooks: + - id: pyproject-fmt + + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.24.1 + hooks: + - id: validate-pyproject diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ba71454a..01a2cb1e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -214,4 +214,3 @@ Changed Stuff (non-backwards compatible!): * is_build flag marking abilities that create units * build_unit indicating the unit type that is built * build_time indicating the build time for the ability - diff --git a/README.rst b/README.rst index 63d74a99..c2a4eb5e 100644 --- a/README.rst +++ b/README.rst @@ -327,4 +327,3 @@ and kept this project going. .. _phpsc2replay: http://code.google.com/p/phpsc2replay/ .. _sc2replay-csharp: https://github.com/ascendedguard/sc2replay-csharp .. _s2protocol: https://github.com/Blizzard/s2protocol - diff --git a/docs/source/articles/addingnewdatapacks.rst b/docs/source/articles/addingnewdatapacks.rst index ac64d5bd..d806348e 100644 --- a/docs/source/articles/addingnewdatapacks.rst +++ b/docs/source/articles/addingnewdatapacks.rst @@ -2,4 +2,4 @@ Adding new Datapacks ======================= -TODO \ No newline at end of file +TODO diff --git a/docs/source/dataobjects.rst b/docs/source/dataobjects.rst index 45e89d27..085de37f 100644 --- a/docs/source/dataobjects.rst +++ b/docs/source/dataobjects.rst @@ -25,4 +25,4 @@ Build -------------------------- .. autoclass:: Build - :members: \ No newline at end of file + :members: diff --git a/docs/source/events/index.rst b/docs/source/events/index.rst index 0d3fd98d..177fb97a 100644 --- a/docs/source/events/index.rst +++ b/docs/source/events/index.rst @@ -13,4 +13,3 @@ All of the gamplay and state information contained in the replay is packed into game message tracker - diff --git a/docs/source/factories.rst b/docs/source/factories.rst index a4675cfc..423f3de0 100644 --- a/docs/source/factories.rst +++ b/docs/source/factories.rst @@ -29,4 +29,4 @@ DoubleCachedSC2Factory -------------------------- .. autoclass:: DoubleCachedSC2Factory - :members: \ No newline at end of file + :members: diff --git a/docs/source/mainobjects.rst b/docs/source/mainobjects.rst index 53c008a8..c8190760 100644 --- a/docs/source/mainobjects.rst +++ b/docs/source/mainobjects.rst @@ -23,4 +23,3 @@ Game Summary .. autoclass:: GameSummary :members: - diff --git a/docs/source/sc2reader.rst b/docs/source/sc2reader.rst index 108a60c3..03a665ee 100644 --- a/docs/source/sc2reader.rst +++ b/docs/source/sc2reader.rst @@ -3,4 +3,4 @@ SC2Reader ====================== -The replay factory \ No newline at end of file +The replay factory diff --git a/pyproject.toml b/pyproject.toml index e33c1d05..0eebca8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,3 +78,6 @@ lint.ignore = [ "F841", # Run `ruff --select=F841 --fix .` ] lint.mccabe.max-complexity = 34 + +[tool.codespell] +ignore-words-list = "queenland" diff --git a/sc2reader/data/HotS/base_abilities.csv b/sc2reader/data/HotS/base_abilities.csv index 8f6e91fe..9b101cf3 100755 --- a/sc2reader/data/HotS/base_abilities.csv +++ b/sc2reader/data/HotS/base_abilities.csv @@ -1,370 +1,370 @@ -1,CAbilEffect -2,CAbilQueueable -3,CAbilProgress -4,CAbilRedirect -5,CAbilArmMagazine -6,CAbilAttack -7,CAbilAugment -8,CAbilBattery -9,CAbilBeacon -10,CAbilBehavior -11,CAbilBuild -12,CAbilBuildable -13,CAbilEffectInstant -14,CAbilEffectTarget -15,CAbilHarvest -16,CAbilInteract -17,CAbilInventory -18,CAbilLearn -19,CAbilMerge -20,CAbilMergeable -21,CAbilMorph -22,CAbilMorphPlacement -23,CAbilMove -24,CAbilPawn -25,CAbilQueue -26,CAbilRally -27,CAbilResearch -28,CAbilRevive -29,CAbilSpecialize -30,CAbilStop -31,CAbilTrain -32,CAbilTransport -33,CAbilWarpable -34,CAbilWarpTrain -35,Taunt -36,stop -37,HoldFire -38,move -39,Beacon -40,ReviveSelf -41,ReviveSelfAtTarget -42,ReviveSelfReplaceTarget -43,ReviveSelfOnCreep -45,attack -47,MetalGateDefaultLower -48,MetalGateDefaultRaise -49,TerranAddOns -50,TerranBuildingLiftOff -51,TerranBuildingLand -52,Refund -53,Salvage -54,DisguiseChangeling -55,SalvageShared -56,Corruption -57,GhostHoldFire -58,GhostWeaponsFree -59,MorphToInfestedTerran -60,Explode -61,FleetBeaconResearch -62,FungalGrowth -63,GuardianShield -64,MULERepair -65,MorphZerglingToBaneling -66,NexusTrainMothership -67,Feedback -68,MassRecall -69,PlacePointDefenseDrone -70,HallucinationArchon -71,HallucinationColossus -72,HallucinationHighTemplar -73,HallucinationImmortal -74,HallucinationPhoenix -75,HallucinationProbe -76,HallucinationStalker -77,HallucinationVoidRay -78,HallucinationWarpPrism -79,HallucinationZealot -80,MULEGather -81,SeekerMissile -82,CalldownMULE -83,GravitonBeam -84,BuildinProgressNydusCanal -85,Siphon -86,Leech -87,SpawnChangeling -88,DisguiseAsZealot -89,DisguiseAsMarineWithShield -90,DisguiseAsMarineWithoutShield -91,DisguiseAsZerglingWithWings -92,DisguiseAsZerglingWithoutWings -93,PhaseShift -94,Rally -95,ProgressRally -96,RallyCommand -97,RallyNexus -98,RallyHatchery -99,RoachWarrenResearch -100,SapStructure -101,InfestedTerrans -102,NeuralParasite -103,SpawnLarva -104,StimpackMarauder -105,SupplyDrop -106,250mmStrikeCannons -107,TemporalRift -108,TimeWarp -109,UltraliskCavernResearch -110,WormholeTransit -111,SCVHarvest -112,ProbeHarvest -113,AttackWarpPrism -114,que1 -115,que5 -116,que5CancelToSelection -117,que5LongBlend -118,que5Addon -119,BuildInProgress -120,Repair -121,TerranBuild -122,RavenBuild -123,Stimpack -124,GhostCloak -125,Snipe -126,MedivacHeal -127,SiegeMode -128,Unsiege -129,BansheeCloak -130,MedivacTransport -131,ScannerSweep -132,Yamato -133,AssaultMode -134,FighterMode -135,BunkerTransport -136,CommandCenterTransport -137,CommandCenterLiftOff -138,CommandCenterLand -139,BarracksAddOns -140,BarracksLiftOff -141,FactoryAddOns -142,FactoryLiftOff -143,StarportAddOns -144,StarportLiftOff -145,FactoryLand -146,StarportLand -147,CommandCenterTrain -148,BarracksLand -149,SupplyDepotLower -150,SupplyDepotRaise -151,BarracksTrain -152,FactoryTrain -153,StarportTrain -154,EngineeringBayResearch -155,MercCompoundResearch -156,ArmSiloWithNuke -157,BarracksTechLabResearch -158,FactoryTechLabResearch -159,StarportTechLabResearch -160,GhostAcademyResearch +1,CAbilEffect +2,CAbilQueueable +3,CAbilProgress +4,CAbilRedirect +5,CAbilArmMagazine +6,CAbilAttack +7,CAbilAugment +8,CAbilBattery +9,CAbilBeacon +10,CAbilBehavior +11,CAbilBuild +12,CAbilBuildable +13,CAbilEffectInstant +14,CAbilEffectTarget +15,CAbilHarvest +16,CAbilInteract +17,CAbilInventory +18,CAbilLearn +19,CAbilMerge +20,CAbilMergeable +21,CAbilMorph +22,CAbilMorphPlacement +23,CAbilMove +24,CAbilPawn +25,CAbilQueue +26,CAbilRally +27,CAbilResearch +28,CAbilRevive +29,CAbilSpecialize +30,CAbilStop +31,CAbilTrain +32,CAbilTransport +33,CAbilWarpable +34,CAbilWarpTrain +35,Taunt +36,stop +37,HoldFire +38,move +39,Beacon +40,ReviveSelf +41,ReviveSelfAtTarget +42,ReviveSelfReplaceTarget +43,ReviveSelfOnCreep +45,attack +47,MetalGateDefaultLower +48,MetalGateDefaultRaise +49,TerranAddOns +50,TerranBuildingLiftOff +51,TerranBuildingLand +52,Refund +53,Salvage +54,DisguiseChangeling +55,SalvageShared +56,Corruption +57,GhostHoldFire +58,GhostWeaponsFree +59,MorphToInfestedTerran +60,Explode +61,FleetBeaconResearch +62,FungalGrowth +63,GuardianShield +64,MULERepair +65,MorphZerglingToBaneling +66,NexusTrainMothership +67,Feedback +68,MassRecall +69,PlacePointDefenseDrone +70,HallucinationArchon +71,HallucinationColossus +72,HallucinationHighTemplar +73,HallucinationImmortal +74,HallucinationPhoenix +75,HallucinationProbe +76,HallucinationStalker +77,HallucinationVoidRay +78,HallucinationWarpPrism +79,HallucinationZealot +80,MULEGather +81,SeekerMissile +82,CalldownMULE +83,GravitonBeam +84,BuildinProgressNydusCanal +85,Siphon +86,Leech +87,SpawnChangeling +88,DisguiseAsZealot +89,DisguiseAsMarineWithShield +90,DisguiseAsMarineWithoutShield +91,DisguiseAsZerglingWithWings +92,DisguiseAsZerglingWithoutWings +93,PhaseShift +94,Rally +95,ProgressRally +96,RallyCommand +97,RallyNexus +98,RallyHatchery +99,RoachWarrenResearch +100,SapStructure +101,InfestedTerrans +102,NeuralParasite +103,SpawnLarva +104,StimpackMarauder +105,SupplyDrop +106,250mmStrikeCannons +107,TemporalRift +108,TimeWarp +109,UltraliskCavernResearch +110,WormholeTransit +111,SCVHarvest +112,ProbeHarvest +113,AttackWarpPrism +114,que1 +115,que5 +116,que5CancelToSelection +117,que5LongBlend +118,que5Addon +119,BuildInProgress +120,Repair +121,TerranBuild +122,RavenBuild +123,Stimpack +124,GhostCloak +125,Snipe +126,MedivacHeal +127,SiegeMode +128,Unsiege +129,BansheeCloak +130,MedivacTransport +131,ScannerSweep +132,Yamato +133,AssaultMode +134,FighterMode +135,BunkerTransport +136,CommandCenterTransport +137,CommandCenterLiftOff +138,CommandCenterLand +139,BarracksAddOns +140,BarracksLiftOff +141,FactoryAddOns +142,FactoryLiftOff +143,StarportAddOns +144,StarportLiftOff +145,FactoryLand +146,StarportLand +147,CommandCenterTrain +148,BarracksLand +149,SupplyDepotLower +150,SupplyDepotRaise +151,BarracksTrain +152,FactoryTrain +153,StarportTrain +154,EngineeringBayResearch +155,MercCompoundResearch +156,ArmSiloWithNuke +157,BarracksTechLabResearch +158,FactoryTechLabResearch +159,StarportTechLabResearch +160,GhostAcademyResearch 161,ArmoryResearch -162,ProtossBuild -163,WarpPrismTransport -164,GatewayTrain -165,StargateTrain -166,RoboticsFacilityTrain -167,NexusTrain -168,PsiStorm -169,HangarQueue5 -170,BroodLordQueue2 -171,CarrierHangar -172,ForgeResearch -173,RoboticsBayResearch -174,TemplarArchivesResearch -175,ZergBuild -176,DroneHarvest -177,evolutionchamberresearch -178,UpgradeToLair -179,UpgradeToHive -180,UpgradeToGreaterSpire -181,LairResearch -182,SpawningPoolResearch -183,HydraliskDenResearch -184,SpireResearch -185,LarvaTrain -186,MorphToBroodLord -187,BurrowBanelingDown -188,BurrowBanelingUp -189,BurrowDroneDown -190,BurrowDroneUp -191,BurrowHydraliskDown -192,BurrowHydraliskUp -193,BurrowRoachDown -194,BurrowRoachUp -195,BurrowZerglingDown -196,BurrowZerglingUp -197,BurrowInfestorTerranDown -198,BurrowInfestorTerranUp -199,RedstoneLavaCritterBurrow -200,RedstoneLavaCritterInjuredBurrow -201,RedstoneLavaCritterUnburrow -202,RedstoneLavaCritterInjuredUnburrow -203,OverlordTransport -204,Mergeable -205,Warpable -206,WarpGateTrain -207,BurrowQueenDown -208,BurrowQueenUp -209,NydusCanalTransport -210,Blink -211,BurrowInfestorDown -212,BurrowInfestorUp -213,MorphToOverseer -214,UpgradeToPlanetaryFortress -215,InfestationPitResearch -216,BanelingNestResearch -217,BurrowUltraliskDown -218,BurrowUltraliskUp -219,UpgradeToOrbital -220,UpgradeToWarpGate -221,MorphBackToGateway -222,OrbitalLiftOff -223,OrbitalCommandLand -224,ForceField -225,PhasingMode -226,TransportMode -227,FusionCoreResearch -228,CyberneticsCoreResearch -229,TwilightCouncilResearch -230,TacNukeStrike -231,SalvageBunkerRefund -232,SalvageBunker -233,EMP -234,Vortex -235,TrainQueen -236,BurrowCreepTumorDown -237,Transfusion -238,TechLabMorph -239,BarracksTechLabMorph -240,FactoryTechLabMorph -241,StarportTechLabMorph -242,ReactorMorph -243,BarracksReactorMorph -244,FactoryReactorMorph -245,StarportReactorMorph -246,AttackRedirect -247,StimpackRedirect -248,StimpackMarauderRedirect -249,burrowedStop -250,StopRedirect -251,GenerateCreep -252,QueenBuild -253,SpineCrawlerUproot -254,SporeCrawlerUproot -255,SpineCrawlerRoot -256,SporeCrawlerRoot -257,CreepTumorBuild -258,BuildAutoTurret -259,ArchonWarp -260,BuildNydusCanal -261,BroodLordHangar -262,Charge -263,TowerCapture -264,HerdInteract -265,Frenzy -266,Contaminate -267,Shatter -268,InfestedTerransLayEgg -269,que5Passive -270,que5PassiveCancelToSelection -294,BridgeExtend -295,BridgeRetract -296,DigesterCreepSpray -297,MorphToMothership -298,MothershipStasis -299,MothershipCoreWeapon -300,NexusTrainMothershipCore -301,MothershipCoreTeleport -302,SalvageDroneRefund -303,SalvageDrone -304,SalvageZerglingRefund -305,SalvageZergling -306,SalvageQueenRefund -307,SalvageQueen -308,SalvageRoachRefund -309,SalvageRoach -310,SalvageBanelingRefund -311,SalvageBaneling -312,SalvageHydraliskRefund -313,SalvageHydralisk -314,SalvageInfestorRefund -315,SalvageInfestor -316,SalvageSwarmHostRefund -317,SalvageSwarmHost -318,SalvageUltraliskRefund -319,SalvageUltralisk -320,DigesterTransport -321,SpectreShield -322,XelNagaHealingShrine -323,NexusInvulnerability -324,NexusPhaseShift -325,SpawnChangelingTarget -326,QueenLand -327,QueenFly -328,OracleCloakField -329,FlyerShield -330,LocustTrain -331,MothershipCoreMassRecall -332,SingleRecall -333,MorphToHellion -334,RestoreShields -335,Scryer -336,BurrowChargeTrial -337,SnipeDoT -338,SwarmHostSpawnLocusts -339,Clone -340,BuildingShield -341,MorphToCollapsibleRockTowerDebris -342,MorphToHellionTank -343,BuildingStasis -344,ResourceBlocker -345,ResourceStun -346,MaxiumThrust -347,Sacrifice -348,BurrowChargeMP -349,BurrowChargeRevD -350,MorphToSwarmHostBurrowedMP -351,MorphToSwarmHostMP -352,SpawnInfestedTerran -353,attackProtossBuilding -354,burrowedBanelingStop -355,stopProtossBuilding -356,BurrowProtector -357,EyeStalk -358,Yoink -359,ViperConsumeStructure -360,ProtossBuildingQueue -361,que8 -362,TestZerg -363,VolatileBurstBuilding -364,PickupScrapSmall -365,PickupScrapMedium -366,PickupScrapLarge -367,PickupPalletGas -368,PickupPalletMinerals -369,MassiveKnockover -370,WidowMineBurrow -371,WidowMineUnburrow -372,WidowMineAttack -373,TornadoMissile -374,MothershipCoreEnergize -375,HallucinationOracle -376,MedivacSpeedBoost -377,ExtendingBridgeNEWide8Out -378,ExtendingBridgeNEWide8 -379,ExtendingBridgeNWWide8Out -380,ExtendingBridgeNWWide8 -381,ExtendingBridgeNEWide10Out -382,ExtendingBridgeNEWide10 -383,ExtendingBridgeNWWide10Out -384,ExtendingBridgeNWWide10 -385,ExtendingBridgeNEWide12Out -386,ExtendingBridgeNEWide12 -387,ExtendingBridgeNWWide12Out -388,ExtendingBridgeNWWide12 -389,InvulnerabilityShield -390,CritterFlee -391,OracleRevelation -392,OracleRevelationMode -393,OracleNormalMode -413,PhaseShield -414,UltraliskWeaponCooldown +162,ProtossBuild +163,WarpPrismTransport +164,GatewayTrain +165,StargateTrain +166,RoboticsFacilityTrain +167,NexusTrain +168,PsiStorm +169,HangarQueue5 +170,BroodLordQueue2 +171,CarrierHangar +172,ForgeResearch +173,RoboticsBayResearch +174,TemplarArchivesResearch +175,ZergBuild +176,DroneHarvest +177,evolutionchamberresearch +178,UpgradeToLair +179,UpgradeToHive +180,UpgradeToGreaterSpire +181,LairResearch +182,SpawningPoolResearch +183,HydraliskDenResearch +184,SpireResearch +185,LarvaTrain +186,MorphToBroodLord +187,BurrowBanelingDown +188,BurrowBanelingUp +189,BurrowDroneDown +190,BurrowDroneUp +191,BurrowHydraliskDown +192,BurrowHydraliskUp +193,BurrowRoachDown +194,BurrowRoachUp +195,BurrowZerglingDown +196,BurrowZerglingUp +197,BurrowInfestorTerranDown +198,BurrowInfestorTerranUp +199,RedstoneLavaCritterBurrow +200,RedstoneLavaCritterInjuredBurrow +201,RedstoneLavaCritterUnburrow +202,RedstoneLavaCritterInjuredUnburrow +203,OverlordTransport +204,Mergeable +205,Warpable +206,WarpGateTrain +207,BurrowQueenDown +208,BurrowQueenUp +209,NydusCanalTransport +210,Blink +211,BurrowInfestorDown +212,BurrowInfestorUp +213,MorphToOverseer +214,UpgradeToPlanetaryFortress +215,InfestationPitResearch +216,BanelingNestResearch +217,BurrowUltraliskDown +218,BurrowUltraliskUp +219,UpgradeToOrbital +220,UpgradeToWarpGate +221,MorphBackToGateway +222,OrbitalLiftOff +223,OrbitalCommandLand +224,ForceField +225,PhasingMode +226,TransportMode +227,FusionCoreResearch +228,CyberneticsCoreResearch +229,TwilightCouncilResearch +230,TacNukeStrike +231,SalvageBunkerRefund +232,SalvageBunker +233,EMP +234,Vortex +235,TrainQueen +236,BurrowCreepTumorDown +237,Transfusion +238,TechLabMorph +239,BarracksTechLabMorph +240,FactoryTechLabMorph +241,StarportTechLabMorph +242,ReactorMorph +243,BarracksReactorMorph +244,FactoryReactorMorph +245,StarportReactorMorph +246,AttackRedirect +247,StimpackRedirect +248,StimpackMarauderRedirect +249,burrowedStop +250,StopRedirect +251,GenerateCreep +252,QueenBuild +253,SpineCrawlerUproot +254,SporeCrawlerUproot +255,SpineCrawlerRoot +256,SporeCrawlerRoot +257,CreepTumorBuild +258,BuildAutoTurret +259,ArchonWarp +260,BuildNydusCanal +261,BroodLordHangar +262,Charge +263,TowerCapture +264,HerdInteract +265,Frenzy +266,Contaminate +267,Shatter +268,InfestedTerransLayEgg +269,que5Passive +270,que5PassiveCancelToSelection +294,BridgeExtend +295,BridgeRetract +296,DigesterCreepSpray +297,MorphToMothership +298,MothershipStasis +299,MothershipCoreWeapon +300,NexusTrainMothershipCore +301,MothershipCoreTeleport +302,SalvageDroneRefund +303,SalvageDrone +304,SalvageZerglingRefund +305,SalvageZergling +306,SalvageQueenRefund +307,SalvageQueen +308,SalvageRoachRefund +309,SalvageRoach +310,SalvageBanelingRefund +311,SalvageBaneling +312,SalvageHydraliskRefund +313,SalvageHydralisk +314,SalvageInfestorRefund +315,SalvageInfestor +316,SalvageSwarmHostRefund +317,SalvageSwarmHost +318,SalvageUltraliskRefund +319,SalvageUltralisk +320,DigesterTransport +321,SpectreShield +322,XelNagaHealingShrine +323,NexusInvulnerability +324,NexusPhaseShift +325,SpawnChangelingTarget +326,QueenLand +327,QueenFly +328,OracleCloakField +329,FlyerShield +330,LocustTrain +331,MothershipCoreMassRecall +332,SingleRecall +333,MorphToHellion +334,RestoreShields +335,Scryer +336,BurrowChargeTrial +337,SnipeDoT +338,SwarmHostSpawnLocusts +339,Clone +340,BuildingShield +341,MorphToCollapsibleRockTowerDebris +342,MorphToHellionTank +343,BuildingStasis +344,ResourceBlocker +345,ResourceStun +346,MaxiumThrust +347,Sacrifice +348,BurrowChargeMP +349,BurrowChargeRevD +350,MorphToSwarmHostBurrowedMP +351,MorphToSwarmHostMP +352,SpawnInfestedTerran +353,attackProtossBuilding +354,burrowedBanelingStop +355,stopProtossBuilding +356,BurrowProtector +357,EyeStalk +358,Yoink +359,ViperConsumeStructure +360,ProtossBuildingQueue +361,que8 +362,TestZerg +363,VolatileBurstBuilding +364,PickupScrapSmall +365,PickupScrapMedium +366,PickupScrapLarge +367,PickupPalletGas +368,PickupPalletMinerals +369,MassiveKnockover +370,WidowMineBurrow +371,WidowMineUnburrow +372,WidowMineAttack +373,TornadoMissile +374,MothershipCoreEnergize +375,HallucinationOracle +376,MedivacSpeedBoost +377,ExtendingBridgeNEWide8Out +378,ExtendingBridgeNEWide8 +379,ExtendingBridgeNWWide8Out +380,ExtendingBridgeNWWide8 +381,ExtendingBridgeNEWide10Out +382,ExtendingBridgeNEWide10 +383,ExtendingBridgeNWWide10Out +384,ExtendingBridgeNWWide10 +385,ExtendingBridgeNEWide12Out +386,ExtendingBridgeNEWide12 +387,ExtendingBridgeNWWide12Out +388,ExtendingBridgeNWWide12 +389,InvulnerabilityShield +390,CritterFlee +391,OracleRevelation +392,OracleRevelationMode +393,OracleNormalMode +413,PhaseShield +414,UltraliskWeaponCooldown diff --git a/sc2reader/data/WoL/16117_units.csv b/sc2reader/data/WoL/16117_units.csv index 6a186ec8..01278ce2 100644 --- a/sc2reader/data/WoL/16117_units.csv +++ b/sc2reader/data/WoL/16117_units.csv @@ -347,4 +347,4 @@ 360,ShapeOrangeSmall 361,ShapeTreasureChestOpen 362,ShapeTreasureChestClosed -363,ShapeWatermelonSmall \ No newline at end of file +363,ShapeWatermelonSmall diff --git a/sc2reader/data/WoL/24944_abilities.csv b/sc2reader/data/WoL/24944_abilities.csv index 3d4857b4..cdbec346 100644 --- a/sc2reader/data/WoL/24944_abilities.csv +++ b/sc2reader/data/WoL/24944_abilities.csv @@ -266,4 +266,4 @@ 267,Shatter 268,InfestedTerransLayEgg 269,que5Passive -270,que5PassiveCancelToSelection \ No newline at end of file +270,que5PassiveCancelToSelection diff --git a/sc2reader/data/WoL/24944_units.csv b/sc2reader/data/WoL/24944_units.csv index 19e31394..3f4e8788 100644 --- a/sc2reader/data/WoL/24944_units.csv +++ b/sc2reader/data/WoL/24944_units.csv @@ -372,4 +372,4 @@ 388,ShapeWatermelonSmall 389,UnbuildableRocksDestructible 390,UnbuildableBricksDestructible -391,UnbuildablePlatesDestructible \ No newline at end of file +391,UnbuildablePlatesDestructible diff --git a/sc2reader/data/train_commands.json b/sc2reader/data/train_commands.json index 3e5a46e6..f6893c4b 100644 --- a/sc2reader/data/train_commands.json +++ b/sc2reader/data/train_commands.json @@ -475,4 +475,4 @@ "Sentry", 21.3 ] -} \ No newline at end of file +} diff --git a/sc2reader/decoders.py b/sc2reader/decoders.py index ed726356..d47ec7a3 100644 --- a/sc2reader/decoders.py +++ b/sc2reader/decoders.py @@ -321,10 +321,9 @@ def read_bits(self, count): """ result = 0 bits = count - bit_shift = self._bit_shift # If we've got a byte in progress use it first - if bit_shift != 0: + if (bit_shift := self._bit_shift) != 0: bits_left = 8 - bit_shift if bits_left < bits: diff --git a/sc2reader/objects.py b/sc2reader/objects.py index 03632dee..b277cf54 100644 --- a/sc2reader/objects.py +++ b/sc2reader/objects.py @@ -558,8 +558,7 @@ def __init__(self, contents): # According to http://www.galaxywiki.net/MapInfo_(File_Format) # With a couple small changes for version 0x20+ data = ByteDecoder(contents, endian="LITTLE") - magic = data.read_string(4) - if magic != "MapI": + if (magic := data.read_string(4)) != "MapI": self.logger.warning(f"Invalid MapInfo file: {magic}") return diff --git a/sc2reader/resources.py b/sc2reader/resources.py index 388f1765..7bb3b9a9 100644 --- a/sc2reader/resources.py +++ b/sc2reader/resources.py @@ -895,8 +895,7 @@ def _get_datapack(self): return None def _read_data(self, data_file, reader): - data = utils.extract_data_file(data_file, self.archive) - if data: + if data := utils.extract_data_file(data_file, self.archive): self.raw_data[data_file] = reader(data, self) elif self.opt["debug"] and data_file not in [ "replay.message.events", @@ -966,12 +965,10 @@ def __init__(self, map_file, filename=None, region=None, map_hash=None, **option #: A reference to the map's :class:`~sc2reader.objects.MapInfo` object self.map_info = None - map_info_file = self.archive.read_file("MapInfo") - if map_info_file: + if map_info_file := self.archive.read_file("MapInfo"): self.map_info = MapInfo(map_info_file) - doc_info_file = self.archive.read_file("DocumentInfo") - if doc_info_file: + if doc_info_file := self.archive.read_file("DocumentInfo"): doc_info = ElementTree.fromstring(doc_info_file.decode("utf8")) icon_path_node = doc_info.find("Icon/Value")