From 5055e87c651326bc0e7b541ee9c74eefe3e97ae4 Mon Sep 17 00:00:00 2001 From: Kevin Leung Date: Sun, 7 Oct 2018 10:52:50 -0700 Subject: [PATCH 1/7] add tychus support --- sc2reader/data/attributes.json | 1 + 1 file changed, 1 insertion(+) diff --git a/sc2reader/data/attributes.json b/sc2reader/data/attributes.json index aa651dc2..751f8dc8 100644 --- a/sc2reader/data/attributes.json +++ b/sc2reader/data/attributes.json @@ -712,6 +712,7 @@ "Rayn": "Raynor", "Stuk": "Stukov", "Swan": "Swann", + "Tych": "Tychus", "Vora": "Vorazun", "Zaga": "Zagara" } From 2ab1d91c4a2e792e3cb6d2de958e148e3d781c36 Mon Sep 17 00:00:00 2001 From: Kevin Leung Date: Sun, 7 Oct 2018 10:55:38 -0700 Subject: [PATCH 2/7] v1.2 notes --- CHANGELOG.rst | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 21be080b..43ddf6b8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ CHANGELOG ============ +1.2.0 - October 7, 2018 +----------------------- +* Added support for Tychus +* Verified that StarCraft 4.6.1 replays work + 1.1.0 - June 26, 2018 --------------------- * Added support for protocol 65895 (StarCraft 4.4.0) diff --git a/setup.py b/setup.py index ba9db028..27d87fe4 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setuptools.setup( license="MIT", name="sc2reader", - version='1.1.0', + version='1.2.0', keywords=["starcraft 2", "sc2", "replay", "parser"], description="Utility for parsing Starcraft II replay files", long_description=open("README.rst").read()+"\n\n"+open("CHANGELOG.rst").read(), From 8f023ec3840d1b7356014e84e092b404d3224896 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sun, 7 Oct 2018 20:00:02 +0200 Subject: [PATCH 3/7] =?UTF-8?q?CircleCI:=20Upgrade=20from=20Python=203.6?= =?UTF-8?q?=20=E2=80=94>=203.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c9e042e0..5bd5244a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,19 +14,19 @@ my-steps: &steps - run: python -m unittest discover test_replays jobs: - Python_2.7: + Python2: docker: - - image: circleci/python:2.7 + - image: circleci/python:2.7.15 steps: *steps - Python_3.6: + Python3: docker: - - image: circleci/python:3.6 + - image: circleci/python:3.7 steps: *steps workflows: version: 2 build: jobs: - - Python_2.7 - - Python_3.6 + - Python2 + - Python3 From 0480ec9316f18af9915c7b065f32e4fe17d441b5 Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 8 Oct 2018 11:33:18 +0200 Subject: [PATCH 4/7] Force a retest --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5bd5244a..1370bc61 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ my-steps: &steps - checkout - run: sudo pip install -r requirements.txt - run: sudo pip install flake8 pytest - - run: python --version ; pip --version ; pwd ; ls + - run: python --version ; pip --version ; pwd ; ls -l # stop the build if there are Python syntax errors or undefined names - run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide From ef02b2a9e2db0dd0398116f2ba51b6bcc32cedb2 Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 8 Oct 2018 19:13:31 +0200 Subject: [PATCH 5/7] Update trove classifiers to current versions of Python --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 27d87fe4..c14bc2a2 100644 --- a/setup.py +++ b/setup.py @@ -23,10 +23,11 @@ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.2", - "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Games/Entertainment", From fdb913fe7e5bd59eac37818e7015cb57f5b3cb90 Mon Sep 17 00:00:00 2001 From: Kevin Leung Date: Wed, 25 Jul 2018 22:18:09 -0700 Subject: [PATCH 6/7] #63 cast players in TrackerEvent.__str__ --- sc2reader/events/tracker.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sc2reader/events/tracker.py b/sc2reader/events/tracker.py index 41b5c2f2..fe3e6f78 100644 --- a/sc2reader/events/tracker.py +++ b/sc2reader/events/tracker.py @@ -230,7 +230,7 @@ def __init__(self, frames, data, build): self.ff_vespene_lost_technology = clamp(self.stats[38]) if build >= 26490 else None def __str__(self): - return self._str_prefix() + "{0: >15} - Stats Update".format(self.player) + return self._str_prefix() + "{0: >15} - Stats Update".format(str(self.player)) class UnitBornEvent(TrackerEvent): @@ -291,7 +291,7 @@ def __init__(self, frames, data, build): self.location = (self.x, self.y) def __str__(self): - return self._str_prefix() + "{0: >15} - Unit born {1}".format(self.unit_upkeeper, self.unit) + return self._str_prefix() + "{0: >15} - Unit born {1}".format(str(self.unit_upkeeper), self.unit) class UnitDiedEvent(TrackerEvent): @@ -361,7 +361,7 @@ def __init__(self, frames, data, build): self.killing_unit_id = self.killing_unit_index << 18 | self.killing_unit_recycle def __str__(self): - return self._str_prefix() + "{0: >15} - Unit died {1}.".format(self.unit.owner, self.unit) + return self._str_prefix() + "{0: >15} - Unit died {1}.".format(str(self.unit.owner), self.unit) class UnitOwnerChangeEvent(TrackerEvent): @@ -397,7 +397,7 @@ def __init__(self, frames, data, build): self.unit_controller = None def __str__(self): - return self._str_prefix() + "{0: >15} took {1}".format(self.unit_upkeeper, self.unit) + return self._str_prefix() + "{0: >15} took {1}".format(str(self.unit_upkeeper), self.unit) class UnitTypeChangeEvent(TrackerEvent): @@ -425,7 +425,7 @@ def __init__(self, frames, data, build): self.unit_type_name = data[2].decode('utf8') def __str__(self): - return self._str_prefix() + "{0: >15} - Unit {0} type changed to {1}".format(self.unit.owner, self.unit, self.unit_type_name) + return self._str_prefix() + "{0: >15} - Unit {0} type changed to {1}".format(str(self.unit.owner), self.unit, self.unit_type_name) class UpgradeCompleteEvent(TrackerEvent): @@ -448,7 +448,7 @@ def __init__(self, frames, data, build): self.count = data[2] def __str__(self): - return self._str_prefix() + "{0: >15} - {1}upgrade completed".format(self.player, self.upgrade_type_name) + return self._str_prefix() + "{0: >15} - {1} upgrade completed".format(str(self.player), self.upgrade_type_name) class UnitInitEvent(TrackerEvent): @@ -504,7 +504,7 @@ def __init__(self, frames, data, build): self.location = (self.x, self.y) def __str__(self): - return self._str_prefix() + "{0: >15} - Unit initiated {1}".format(self.unit_upkeeper, self.unit) + return self._str_prefix() + "{0: >15} - Unit initiated {1}".format(str(self.unit_upkeeper), self.unit) class UnitDoneEvent(TrackerEvent): @@ -528,7 +528,7 @@ def __init__(self, frames, data, build): self.unit = None def __str__(self): - return self._str_prefix() + "{0: >15} - Unit {1} done".format(self.unit.owner, self.unit) + return self._str_prefix() + "{0: >15} - Unit {1} done".format(str(self.unit.owner), self.unit) class UnitPositionsEvent(TrackerEvent): From 5cdfad17f6245a9680ad05d2c7b24dd05a47e7ef Mon Sep 17 00:00:00 2001 From: Gus Foley Date: Wed, 31 Oct 2018 02:39:41 -0700 Subject: [PATCH 7/7] Add test for print functionality. Load a lotv replay and print all the events to ensure they print. The output from the prints have been redirected to a stream using StringIO and then checked for the last few events to occur. --- test_replays/test_all.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test_replays/test_all.py b/test_replays/test_all.py index 61e73302..5d1f2c93 100644 --- a/test_replays/test_all.py +++ b/test_replays/test_all.py @@ -11,6 +11,11 @@ import unittest2 as unittest else: import unittest +# StringIO was changed in python 3 +try: + from io import StringIO +except ImportError: + from StringIO import StringIO import sc2reader from sc2reader.exceptions import CorruptTrackerFileError @@ -582,6 +587,15 @@ def test_65895(self): factory = sc2reader.factories.SC2Factory() replay = factory.load_replay(replayfilename) + def test_event_print(self): + replay = sc2reader.load_replay("test_replays/lotv/lotv1.SC2Replay") + with StringIO() as capturedOutput: + sys.stdout = capturedOutput + for event in replay.events: + print(event) + self.assertIn("PlayerLeaveEvent", capturedOutput.getvalue()) + sys.stdout = sys.__stdout__ + class TestGameEngine(unittest.TestCase): class TestEvent(object):