Skip to content

Commit a94d20e

Browse files
authored
Merge branch 'upstream' into bugfix_typos
2 parents 44f4226 + dffaf57 commit a94d20e

File tree

129 files changed

+23169
-2768
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+23169
-2768
lines changed

.circleci/config.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: 2.0
2+
3+
build_and_test: &build_and_test_steps
4+
- checkout
5+
- run: sudo pip install --upgrade pip
6+
- run: sudo pip install pytest -r requirements.txt
7+
- run: pip install --user .
8+
- run: python --version ; pip --version ; pwd ; ls -l
9+
- run: pytest
10+
11+
12+
jobs:
13+
StyleCheck:
14+
docker:
15+
- image: circleci/python:3.9
16+
steps:
17+
- checkout
18+
- run: sudo pip install black codespell flake8
19+
- run: python --version ; pip --version ; pwd ; ls -l
20+
- run: codespell -L queenland,uint
21+
# stop the build if there are Python syntax errors or undefined names
22+
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
23+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
24+
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
25+
- run: black . --check
26+
27+
28+
Python2:
29+
docker:
30+
- image: circleci/python:2.7.18
31+
steps: *build_and_test_steps
32+
33+
Python3:
34+
docker:
35+
- image: circleci/python:3.9
36+
steps: *build_and_test_steps
37+
38+
39+
workflows:
40+
version: 2
41+
build:
42+
jobs:
43+
- StyleCheck
44+
- Python2
45+
- Python3

.travis.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

CHANGELOG.rst

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,82 @@
11
CHANGELOG
22
============
33

4+
1.7.0 - May 17, 2021
5+
--------------------
6+
* Add DOI to the README #128
7+
* Add various missing attributes for co-op replays #129
8+
* Add support for python 3.8, 3.9 #132 #136
9+
* Fix owner on an event with no unit #133
10+
* Add support for ResourceTradeEvent #135
11+
* Fix depot URL template #139
12+
13+
1.6.0 - July 30, 2020
14+
---------------------
15+
* Add support for protocol 80949 (StarCraft 5.0) #122
16+
* Fix toJson script #118
17+
18+
1.5.0 - January 18, 2020
19+
------------------------
20+
* Add support for protocol 77379 #106 #107
21+
* Workaround for missing data #102 #104
22+
23+
1.4.0 - August 19, 2019
24+
-----------------------
25+
* Add support for protocol 75689 #95
26+
27+
1.3.2 - August 9, 2019
28+
----------------------
29+
* Allow pytest #84
30+
* Format code with black #87
31+
* Fix UnitTypeChangeEvent.__str__ #92
32+
* Add Stetmann #93
33+
34+
1.3.1 - November 29, 2018
35+
-------------------------
36+
* Parse backup if data is missing #69
37+
38+
1.3.0 - November 16, 2018
39+
-------------------------
40+
* Added support for protocol 70154 (StarCraft 4.7.0)
41+
* Added support for Zeratul
42+
* Updated CircleCI build for Python 3.7
43+
* Fixed a bug with printing TrackerEvent
44+
45+
1.2.0 - October 7, 2018
46+
-----------------------
47+
* Added support for Tychus
48+
* Verified that StarCraft 4.6.1 replays work
49+
50+
1.1.0 - June 26, 2018
51+
---------------------
52+
* Added support for protocol 65895 (StarCraft 4.4.0)
53+
54+
1.0.0 - May 18, 2018
55+
--------------------
56+
* Added support for protocol 48258 through 64469
57+
* Update game data and scripts for generating game data
58+
* Fix ggtracker/sc2reader CircleCI build for python 3
59+
* Added support for parsing Co-op replays
60+
61+
0.8.0 - December 16, 2016
62+
---------------------------
63+
* Merged into ggtracker/sc2reader, which mostly means that we have a bunch of parsing fixes. Thanks @StoicLoofah!
64+
465
0.7.0 -
566
---------------------------
667

68+
* Deprecated unit.killed_by in favor of unit.killing_player
69+
* Added unit.killed_units
70+
* Added unit.killing_unit
71+
* Added UnitDiedEvent.killing_player
72+
* Added UnitDiedEvent.killing_unit
73+
* Deprecated UnitDiedEvent.killer_pid in favor of UnitDiedEvent.killing_player_id
74+
* Deprecated UnitDiedEvent.killer in favor of UnitDiedEvent.killing_player
75+
* Use generic UnitType and Ability classes for data. This means no more unit._type_class.__class__.__name__. But hopefully people were not doing that anyway.
76+
* Now a CorruptTrackerFileError is raised when the tracker file is corrupted (generally only older resume_from_replay replays)
77+
* Removed the defunct replay.player_names attribute.
78+
* Removed the defunct replay.events_by_type attribute.
79+
* Removed the defunct replay.other_people attribute.
780
* Replays can now be pickled and stored for later consumption.
881
* All references to the gateway attribute have been replaced in favor of region; e.g. replay.region
982
* Use generic UnitType and Ability classes for data. This means no more unit._type_class.__class__.__name__. But hopefully people were not doing that anyway.
@@ -100,7 +173,7 @@ Changed Stuff (non-backwards compatible!):
100173
--------------------
101174

102175
* Fixes several game event parsing issues for older replays.
103-
* Propperly maps ability ids for armory vehicle & ship armor upgrades.
176+
* Properly maps ability ids for armory vehicle & ship armor upgrades.
104177
* Uses the US depot for SEA battle.net depot dependencies.
105178
* ``PlayerStatEvent.food_used`` and ``food_made`` are now properly divided by 4096
106179
* ``AbilityEvent.flags`` are now processed into a dictionary mapping flag name to True/False (``AbilityEvent.flag``)

CONTRIBUTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,22 @@ If you can't share your code/replays publicly try to replicate with a smaller sc
1414
Patches
1515
=========
1616

17-
Please submit patches by pull request where possible. Patches should add a test to confirm their fix and should not break previously working tests.
17+
Please submit patches by pull request where possible. Patches should add a test to confirm their fix and should not break previously working tests. Circle CI automatically runs tests on each pull request so please check https://circleci.com/gh/ggtracker/sc2reader to see the results of those tests.
1818

1919
If you are having trouble running/add/fixing tests for your patch let me know and I'll see if I can help.
2020

21+
22+
Coding Style
23+
==============
24+
25+
We'd like our code to follow PEP8 coding style in this project.
26+
We use [python/black](https://github.com/python/black) in order to make our lives easier.
27+
We propose you do the same within this project, otherwise you might be asked to
28+
reformat your pull requests.
29+
30+
It's really simple just:
31+
32+
pip install black
33+
black .
34+
35+
And [there are plugins for many editors](https://black.readthedocs.io/en/stable/editor_integration.html).

CONTRIBUTORS.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
Author and Maintainer:
1+
Maintainer:
2+
David Joerg - @dsjoerg on github
3+
4+
Author:
25
Graylin Kim - graylinkim @ github
36

47
Contributors:
5-
David Joerg - @dsjoerg on github
68
Alexander Hanhikoski - @alexhanh on github
79
Bas Peschier (fizzgig) - @bpeschier on github
810
Jason Dana - @sheutka on github
@@ -11,5 +13,6 @@ Contributors:
1113
Kevin Leung - @StoicLoofah on github
1214
Daniele Zannotti (Durrza)
1315
Mike Anderson
16+
Christian Clauss - @cclauss on github
1417

1518
Special thanks to ggtracker, inc (ggtracker.com) for sponsoring sc2reader's continued development.

README.rst

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4007376.svg
2+
:target: https://doi.org/10.5281/zenodo.4007376
13

24
What is sc2reader?
35
====================
@@ -12,16 +14,16 @@ Who Uses sc2reader?
1214

1315
sc2reader is currently powering:
1416

15-
* Websites: `ggtracker.com`_, `gamereplays.org`_, `sc2companion.com`_
17+
* Websites: `gggreplays.com`_, `gamereplays.org`_, `spawningtool.com`_
1618
* Tools: `The Core`_
1719
* Experiments: `Midi Conversion`_
1820

19-
If you use sc2reader and you would like your tool, site, project, or implementation listed above, drop us a line on our `mailing list`_ or stop by our #sc2reader IRC channel and say hi!
21+
If you use sc2reader and you would like your tool, site, project, or implementation listed above, drop us a line on our `mailing list`_.
2022

2123

22-
.. _ggtracker.com: http://ggtracker.com
24+
.. _gggreplays.com: http://gggreplays.com
2325
.. _gamereplays.org: http://www.gamereplays.org/starcraft2/
24-
.. _sc2companion.com: http://sc2companion.com
26+
.. _spawningtool.com: https://lotv.spawningtool.com
2527
.. _The Core: http://www.teamliquid.net/forum/viewmessage.php?topic_id=341878
2628
.. _Midi Conversion: https://github.com/obohrer/sc2midi
2729

@@ -47,7 +49,7 @@ Replays can be parsed for the following general types of information:
4749
- Unfiltered Unit commands (attack, move, train, build, psi storm, etc)
4850
- Camera Movements for all players and observers.
4951

50-
Replays from release 2.0.8 on ward make additional state information available:
52+
Replays from release 2.0.8 onward make additional state information available:
5153

5254
- Unit states - creation time, positions, and deaths times
5355
- Player resource stats - collection rates/unspent totals
@@ -142,7 +144,7 @@ If you want to load a collection of replays, you can use the plural form. Loadin
142144

143145
replays = sc2reader.load_replays('path/to/replay/directory')
144146

145-
.. _sc2reader.scripts: https://github.com/GraylinKim/sc2reader/tree/master/sc2reader/scripts
147+
.. _sc2reader.scripts: https://github.com/ggtracker/sc2reader/tree/upstream/sc2reader/scripts
146148

147149

148150
Loading Maps
@@ -214,63 +216,81 @@ or with setuptools (specify a valid x.x.x)::
214216
cd sc2reader-x.x.x
215217
python setup.py install
216218

217-
Releases to PyPi can be very delayed (sorry!), for the latest and greatest you are encouraged to install from Github master.
219+
Releases to PyPi can be very delayed (sorry!), for the latest and greatest you are encouraged to install from Github upstream.
218220

219221

220222
From Github
221223
--------------------------
222224

223-
Github master is generally stable with development branches more unstable.
225+
Github upstream is generally stable with development branches more unstable.
224226

225-
We use `travis-ci`_ to provide a record of our `continuous testing`_ and `coveralls.io`_ provides a record of our `test coverage`_. Please verify that tests are passing before installing development versions.
227+
We use `circle-ci`_ to provide a record of our `continuous testing`_. Please verify that tests are passing before installing development versions.
226228

227229
Install from the latest source on Github with pip::
228230

229-
pip install -e git+git://github.com/GraylinKim/sc2reader#egg=sc2reader
231+
pip install -e git+git://github.com/ggtracker/sc2reader#egg=sc2reader
230232

231233
or with setuptools::
232234

233-
wget -O sc2reader-master.tar.gz https://github.com/GraylinKim/sc2reader/tarball/master
234-
tar -xzf sc2reader-master.tar.gz
235-
cd sc2reader-master
235+
wget -O sc2reader-upstream.tar.gz https://github.com/ggtracker/sc2reader/tarball/upstream
236+
tar -xzf sc2reader-upstream.tar.gz
237+
cd sc2reader-upstream
236238
python setup.py install
237239

238-
.. _travis-ci: https://travis-ci.org/
240+
.. _circle-ci: https://circleci.com/
239241
.. _coveralls.io: https://coveralls.io
240242
.. _test coverage: https://coveralls.io/r/GraylinKim/sc2reader
241-
.. _continuous testing: https://travis-ci.org/GraylinKim/sc2reader
243+
.. _continuous testing: https://circleci.com/gh/ggtracker/sc2reader
242244

243245

244246
For Contributors
245247
-------------------
246248

247249
Contributors should install from an active git repository using setuptools in `develop`_ mode. This will install links to the live code so that local edits are available to external modules automatically::
248250

249-
git clone https://github.com/GraylinKim/sc2reader.git
251+
git clone https://github.com/ggtracker/sc2reader.git
250252
cd sc2reader
251253
python setup.py develop
252254

253255
Please review the `CONTRIBUTING.md`_ file and get in touch with us before doing too much work. It'll make everyone happier in the long run.
254256

255257
.. _develop: http://peak.telecommunity.com/DevCenter/setuptools#development-mode
256-
.. _CONTRIBUTING.md: https://github.com/GraylinKim/sc2reader/blob/master/CONTRIBUTING.md
258+
.. _CONTRIBUTING.md: https://github.com/ggtracker/sc2reader/blob/upstream/CONTRIBUTING.md
257259

258260

259261
Testing
260262
-------------------
261263

262-
We use the built in ``unittest`` module for testing. If you are still on Python 2.6 you will need to install ``unittest2`` because our test suite requires newer features than are included in the main distribution.
264+
We use ``pytest`` for testing. If you don't have it just ``pip install pytest``.
265+
266+
To run the tests, just do::
267+
268+
pytest
269+
270+
271+
When repeatedly running tests it can be very helpful to make sure you've set a local cache directory to prevent long fetch times from battle.net.
272+
So make some local cache folder::
273+
274+
mkdir cache
275+
276+
And then run the tests like this::
263277

264-
To run the tests just use::
278+
SC2READER_CACHE_DIR=./cache pytest
265279

266-
python test_replays/test_all.py
267-
python test_s2gs/test_all.py
280+
To run just one test:
268281

269-
When repeatedly running tests it can be very helpful to make sure you've set a local cache directory to prevent long fetch times from battle.net::
282+
SC2READER_CACHE_DIR=./cache pytest test_replays/test_replays.py::TestReplays::test_38749
270283

271-
export SC2READER_CACHE_DIR=local_cache
272-
# or
273-
SC2READER_CACHE_DIR=local_cache python test_replays/test_all.py
284+
If you'd like to see which are the 10 slowest tests (to find performance issues maybe)::
285+
286+
pytest --durations=10
287+
288+
If you want ``pytest`` to stop after the first failing test::
289+
290+
pytest -x
291+
292+
293+
Have a look at the very fine ``pytest`` docs for more information.
274294

275295
Good luck, have fun!
276296

@@ -287,7 +307,7 @@ Issues and Support
287307
We have an `issue tracker`_ on Github that all bug reports and feature requests should be directed to. We have a `mailing list`_ with Google Groups that you can use to reach out for support. We are generally on FreeNode in the #sc2reader and can generally provide live support and address issues there as well.
288308

289309
.. _mailing list: http://groups.google.com/group/sc2reader
290-
.. _issue tracker: https://github.com/GraylinKim/sc2reader/issues
310+
.. _issue tracker: https://github.com/ggtracker/sc2reader/issues
291311

292312

293313
Acknowledgements
@@ -307,6 +327,7 @@ and kept this project going.
307327
their `s2protocol`_ full reference implementation.
308328

309329

330+
.. _ggtracker.com: http://ggtracker.com
310331
.. _phpsc2replay: http://code.google.com/p/phpsc2replay/
311332
.. _sc2replay-csharp: https://github.com/ascendedguard/sc2replay-csharp
312333
.. _s2protocol: https://github.com/Blizzard/s2protocol

docs/source/articles/conceptsinsc2reader.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Many attributes in sc2reader are prefixed with ``game_`` and ``real_``. Game ref
5555
GameEngine
5656
----------------
5757

58-
The game engine is used to process replay events and augument the replay with new statistics and game state. It implements a plugin system that allows developers
58+
The game engine is used to process replay events and augment the replay with new statistics and game state. It implements a plugin system that allows developers
5959
to inject their own logic into the game loop. It also allows plugins to ``yield`` new
6060
events to the event stream. This allows for basic message passing between plugins.
6161

docs/source/articles/whatsinareplay.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This file was introduced in 2.0.4 and is unnecessary for the Starcraft II to rep
4141
What isn't in a replay?
4242
--------------------------
4343

44-
Replays are specifically designed to only include data essential to recreate the game. Game state is not recorded because the game engine can recreate it based off the other information. That means no player resource counts, colleciton rates, supply values, vision, unit positions, unit deaths, etc. Information that you are super interested in probably is not directly recorded. Fortunately since 2.0.4 tracker events now record some of this information; prior to that patch we had to run our own simulations to guess at most of the data.
44+
Replays are specifically designed to only include data essential to recreate the game. Game state is not recorded because the game engine can recreate it based off the other information. That means no player resource counts, collection rates, supply values, vision, unit positions, unit deaths, etc. Information that you are super interested in probably is not directly recorded. Fortunately since 2.0.4 tracker events now record some of this information; prior to that patch we had to run our own simulations to guess at most of the data.
4545

4646

4747
The other important aspect of this is that instead of completely describing all of the game data (unit data, ability data, map info, etc), replays maintain a list of dependencies. These dependencies might look like this:

0 commit comments

Comments
 (0)