From a8a2a70977e5c8cac3d2857a9446624896247ad8 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:24:18 +0100 Subject: [PATCH 01/18] CircleCI: Look for typos with codespell --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e96bb5b..c6752cf4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,8 +15,9 @@ jobs: - image: circleci/python:3.8 steps: - checkout - - run: sudo pip install flake8 black + - run: sudo pip install black codespell flake8 - run: python --version ; pip --version ; pwd ; ls -l + - run: codespell # stop the build if there are Python syntax errors or undefined names - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide From 142a91e3ebd63f2c2f55e113f3c5d86c37813937 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:30:36 +0100 Subject: [PATCH 02/18] codespell -L queenland,uint --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c6752cf4..546b7a7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ jobs: - checkout - run: sudo pip install black codespell flake8 - run: python --version ; pip --version ; pwd ; ls -l - - run: codespell + - run: codespell -L queenland,uint # stop the build if there are Python syntax errors or undefined names - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide From 2356efb1b90dfe944ec6946a680481a9e5944a21 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:34:16 +0100 Subject: [PATCH 03/18] Typo: Properly --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 49419793..a6526d8c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -159,7 +159,7 @@ Changed Stuff (non-backwards compatible!): -------------------- * Fixes several game event parsing issues for older replays. -* Propperly maps ability ids for armory vehicle & ship armor upgrades. +* Properly maps ability ids for armory vehicle & ship armor upgrades. * Uses the US depot for SEA battle.net depot dependencies. * ``PlayerStatEvent.food_used`` and ``food_made`` are now properly divided by 4096 * ``AbilityEvent.flags`` are now processed into a dictionary mapping flag name to True/False (``AbilityEvent.flag``) From f787abcacadc4fd2d0e244bc24782fce754553eb Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:37:14 +0100 Subject: [PATCH 04/18] Fix typos found by codespell --- examples/sc2autosave.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/sc2autosave.py b/examples/sc2autosave.py index 74bb1567..f7091ba4 100755 --- a/examples/sc2autosave.py +++ b/examples/sc2autosave.py @@ -37,7 +37,7 @@ -------------------- The --rename option allows you to specify a renaming format string. The string -is constructed the pythonic (3.0) way with {:field} indicating the substition +is constructed the pythonic (3.0) way with {:field} indicating the substitution of a field. The forward slash (/) is a special character here which terminates a folder name and allows for organization into subdirectories. All other string characters form the template into which the fields are inserted. @@ -138,7 +138,7 @@ files every SECONDS seconds. --rename FORMAT :map - Inserts the map name. - :date - Inserts a string formated datetime object using --date-format. + :date - Inserts a string formatted datetime object using --date-format. :length - Inserts a string formatted time object using --length-format. :teams - Inserts a comma separated player list. Teams are separated with a ' vs ' string. Format the player with --player-format. @@ -602,7 +602,7 @@ def main(): try: run(parser.parse_args()) except KeyboardInterrupt: - print("\n\nScript Interupted. Process Aborting") + print("\n\nScript Interrupted. Process Aborting") if __name__ == "__main__": From 2841052a459ac9a3ddb49e43fbe7e537c3c7396c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:40:33 +0100 Subject: [PATCH 05/18] Fix typos found by codespell --- docs/source/tutorials/prettyprinter.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/tutorials/prettyprinter.rst b/docs/source/tutorials/prettyprinter.rst index a8584620..310e852a 100644 --- a/docs/source/tutorials/prettyprinter.rst +++ b/docs/source/tutorials/prettyprinter.rst @@ -93,7 +93,7 @@ Many of the replay attributes are nested data structures which are generally all Each of these nested structures can be found either on its own reference page or lumped together with the other minor structures on the Misc Structures page. -So now all we need to do is build the ouput using the available replay attributes. Lets start with the header portion. We'll use a block string formatting method that makes this clean and easy: +So now all we need to do is build the output using the available replay attributes. Lets start with the header portion. We'll use a block string formatting method that makes this clean and easy: :: @@ -199,7 +199,7 @@ With this in mind, lets make a slight change to our main function to support any Any time that you start dealing with directories or collections of files you run into dangers with recursion and annoyances of tedium. sc2reader provides options to mitigate these concerns. * directory: Default ''. The directory string when supplied, becomes the base of all the file paths sent into sc2reader and can save you the hassle of fully qualifying your file paths each time. -* depth: Default -1. When handling directory inputs, sc2reader searches the directory recursively until all .SC2Replay files have been loaded. By setting the maxium depth value this behavior can be mitigated. +* depth: Default -1. When handling directory inputs, sc2reader searches the directory recursively until all .SC2Replay files have been loaded. By setting the maximum depth value this behavior can be mitigated. * exclude: Default []. When recursing directories you can choose to exclude directories from the file search by directory name (not full path). * followlinks: Default false. When recursing directories, enables or disables the follow symlinks behavior. From a829efbdc998fd0cf12d4e94f2c8befbc6b78af6 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:42:15 +0100 Subject: [PATCH 06/18] Fix typos found by codespell --- docs/source/articles/whatsinareplay.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/articles/whatsinareplay.rst b/docs/source/articles/whatsinareplay.rst index 5acf6ea4..466f3bf0 100644 --- a/docs/source/articles/whatsinareplay.rst +++ b/docs/source/articles/whatsinareplay.rst @@ -35,7 +35,7 @@ The last file provides a record of important events from the game. * replay.tracker.events - Records important game events and game state updates. -This file was introduced in 2.0.4 and is unncessary for the Starcraft II to reproduce the game. Instead, it records interesting game events and game state for community developers to use when analyzing replays. +This file was introduced in 2.0.4 and is unnecessary for the Starcraft II to reproduce the game. Instead, it records interesting game events and game state for community developers to use when analyzing replays. What isn't in a replay? From 3b4a88c687a815a96258d028463cbee4f755355e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:49:55 +0100 Subject: [PATCH 07/18] Fix typos found by codespell --- sc2reader/objects.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sc2reader/objects.py b/sc2reader/objects.py index a49c3012..5d37f62a 100644 --- a/sc2reader/objects.py +++ b/sc2reader/objects.py @@ -18,7 +18,7 @@ class Team(object): objects with some metadata. As such, it implements iterable and can be looped over like a list. - :param interger number: The team number as recorded in the replay + :param integer number: The team number as recorded in the replay """ #: A unique hash identifying the team of players @@ -140,7 +140,7 @@ def __init__(self, sid, slot_data): #: The Battle.net subregion the entity is registered to self.subregion = int(parts[2]) - #: The Battle.net acount identifier. Used to construct the + #: The Battle.net account identifier. Used to construct the #: bnet profile url. This value can be zero for games #: played offline when a user was not logged in to battle.net. self.toon_id = int(parts[3]) @@ -240,7 +240,7 @@ def __init__(self, pid, slot_data, detail_data, attribute_data): #: The Battle.net subregion the entity is registered to self.subregion = detail_data["bnet"]["subregion"] - #: The Battle.net acount identifier. Used to construct the + #: The Battle.net account identifier. Used to construct the #: bnet profile url. This value can be zero for games #: played offline when a user was not logged in to battle.net. self.toon_id = detail_data["bnet"]["uid"] @@ -604,8 +604,8 @@ def __init__(self, contents): #: The map base height (what is that?). This value is 4096*Base Height in the editor (giving a decimal value). self.base_height = data.read_uint32() / 4096 - # Leave early so we dont barf. Turns out ggtracker doesnt need - # any of the map data thats loaded below. + # Leave early so we don't barf. Turns out ggtracker doesn't need + # any of the map data that is loaded below. return #: Load screen type: 0 = default, 1 = custom From 6c5687bf4edd2cc4fc12262c2fe8995a87d7a216 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:51:03 +0100 Subject: [PATCH 08/18] Fix typos found by codespell --- sc2reader/engine/plugins/supply.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc2reader/engine/plugins/supply.py b/sc2reader/engine/plugins/supply.py index c106f757..8305e50b 100644 --- a/sc2reader/engine/plugins/supply.py +++ b/sc2reader/engine/plugins/supply.py @@ -87,7 +87,7 @@ def remove_from_units_alive(self, event, replay): ) def handleInitGame(self, event, replay): - ## This dictionary contains te supply of every unit + ## This dictionary contains the supply of every unit self.unit_name_to_supply = { # Zerg "Drone": (1, 17), From 8130c5d1c4127bfe6e24c4b6480131cafb7be90c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:53:15 +0100 Subject: [PATCH 09/18] Fix typos found by codespell --- sc2reader/engine/plugins/creeptracker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc2reader/engine/plugins/creeptracker.py b/sc2reader/engine/plugins/creeptracker.py index 98f0148f..db5e6ac8 100644 --- a/sc2reader/engine/plugins/creeptracker.py +++ b/sc2reader/engine/plugins/creeptracker.py @@ -117,7 +117,7 @@ def __init__(self, replay): self.creep_spread_image_by_minute = dict() ## This list contains all the active cgus in every time frame self.creep_gen_units = dict() - ## Thist list corresponds to creep_gen_units storing the time of each CGU + ## This list corresponds to creep_gen_units storing the time of each CGU self.creep_gen_units_times = dict() ## convert all possible cgu radii into a sets of coordinates centred around the origin, ## in order to use this with the CGUs, the centre point will be @@ -168,7 +168,7 @@ def radius_to_map_positions(self, radius): ## this function converts all radius into map coordinates ## centred around the origin that the creep can exist ## the cgu_radius_to_map_position function will simply - ## substract every coordinate with the centre point of the tumour + ## subtract every coordinate with the centre point of the tumour output_coordinates = list() # Sample a square area using the radius for x in range(-radius, radius): From 43160a72b6cbc2b32cf3d6f9686fdff17815c653 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:54:20 +0100 Subject: [PATCH 10/18] Fix typos found by codespell --- sc2reader/engine/plugins/selection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc2reader/engine/plugins/selection.py b/sc2reader/engine/plugins/selection.py index 9f741894..59d4ee02 100644 --- a/sc2reader/engine/plugins/selection.py +++ b/sc2reader/engine/plugins/selection.py @@ -21,7 +21,7 @@ class SelectionTracker(object): control_group_9 = selection[9] active_selection = selection[10] - # TODO: list a few error inducing sitations + # TODO: list a few error inducing situations """ name = "SelectionTracker" From e8c188a04db69978d486a61c8a3d18abac074400 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 04:57:27 +0100 Subject: [PATCH 11/18] Fix typos found by codespell --- sc2reader/events/game.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sc2reader/events/game.py b/sc2reader/events/game.py index 9dda98b5..346adb96 100644 --- a/sc2reader/events/game.py +++ b/sc2reader/events/game.py @@ -324,7 +324,7 @@ def __init__(self, frame, pid, data): #: This id can be 0 when the target unit is shrouded by fog of war. self.target_unit_id = self.ability_type_data.get("unit_tag", None) - #: A reference to the targetted unit. When the :attr:`target_unit_id` is + #: A reference to the targeted unit. When the :attr:`target_unit_id` is #: 0 this target unit is a generic, reused fog of war unit of the :attr:`target_unit_type` #: with an id of zero. It should not be confused with a real unit. self.target_unit = None @@ -333,7 +333,7 @@ def __init__(self, frame, pid, data): self.target_unit_type = self.ability_type_data.get("unit_link", None) #: Integer player id of the controlling player. Available for TargetUnit type events starting in 19595. - #: When the targetted unit is under fog of war this id is zero. + #: When the targeted unit is under fog of war this id is zero. self.control_player_id = self.ability_type_data.get("control_player_id", None) #: Integer player id of the player paying upkeep. Available for TargetUnit type events. @@ -374,7 +374,7 @@ class UpdateTargetUnitCommandEvent(TargetUnitCommandEvent): from TargetUnitCommandEvent, but for flexibility, it will be treated differently. - One example of this event occuring is casting inject on a hatchery while + One example of this event occurring is casting inject on a hatchery while holding shift, and then shift clicking on a second hatchery. """ @@ -406,7 +406,7 @@ class SelectionEvent(GameEvent): player is updated. Unlike other game events, these events can also be generated by non-player actions like unit deaths or transformations. - Starting in Starcraft 2.0.0, selection events targetting control group + Starting in Starcraft 2.0.0, selection events targeting control group buffers are also generated when control group selections are modified by non-player actions. When a player action updates a control group a :class:`ControlGroupEvent` is generated. @@ -529,7 +529,7 @@ class ControlGroupEvent(GameEvent): * :class:`GetControlGroup` - Recorded when a user retrieves a control group (#). * :class:`AddToControlGroup` - Recorded when a user adds to a control group (shift+ctrl+#) - All three events have the same set of data (shown below) but are interpretted differently. + All three events have the same set of data (shown below) but are interpreted differently. See the class entry for details. """ From 52c812ac0effb69c553ab015d91f946279c92432 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 05:00:13 +0100 Subject: [PATCH 12/18] Fix typos found by codespell --- sc2reader/resources.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc2reader/resources.py b/sc2reader/resources.py index dfcf9d75..4722cf28 100644 --- a/sc2reader/resources.py +++ b/sc2reader/resources.py @@ -73,7 +73,7 @@ class Replay(Resource): #: Deprecated, use :attr:`game_type` or :attr:`real_type` instead type = str() - #: The game type choosen at game creation: 1v1, 2v2, 3v3, 4v4, FFA + #: The game type chosen at game creation: 1v1, 2v2, 3v3, 4v4, FFA game_type = str() #: The real type of the replay as observed by counting players on teams. @@ -1237,7 +1237,7 @@ def use_property(prop, player=None): # Lobby properties can require on player properties. # How does this work? I assume that one player satisfying the - # property requirments is sufficient + # property requirements is sufficient if requirement.is_lobby: values = [setting] else: From 0c3398409d5c2c8fa92be21e99cae4833fa32207 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 05:01:31 +0100 Subject: [PATCH 13/18] Fix typos found by codespell --- sc2reader/decoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc2reader/decoders.py b/sc2reader/decoders.py index 78372e8f..8520e259 100644 --- a/sc2reader/decoders.py +++ b/sc2reader/decoders.py @@ -20,7 +20,7 @@ class ByteDecoder(object): Used to unpack parse byte aligned files. """ - #: The Bytes object used internaly for reading from the + #: The Bytes object used internally for reading from the #: decoder contents. cStringIO is faster than managing our #: own string access in python. For PyPy installations a #: managed string implementation might be faster. From 80c95c9d8d998e8d89dbd11607ee1a04fa6be7a4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 05:02:51 +0100 Subject: [PATCH 14/18] Fix typos found by codespell --- sc2reader/readers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc2reader/readers.py b/sc2reader/readers.py index c7bac539..ccae2121 100644 --- a/sc2reader/readers.py +++ b/sc2reader/readers.py @@ -1074,7 +1074,7 @@ def control_group_update_event(self, data): def decrement_game_time_remaining_event(self, data): # really this should be set to 19, and a new GameEventsReader_41743 should be introduced that specifies 32 bits. - # but I dont care about ability to read old replays. + # but I don't care about ability to read old replays. return dict(decrement_ms=data.read_bits(32)) From e108f4dfbde80ef6802c6a0216d4738a702da9eb Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 05:05:32 +0100 Subject: [PATCH 15/18] Fix typos found by codespell --- sc2reader/data/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sc2reader/data/__init__.py b/sc2reader/data/__init__.py index 6f6fa1a7..b6ec2d75 100755 --- a/sc2reader/data/__init__.py +++ b/sc2reader/data/__init__.py @@ -84,7 +84,7 @@ def __init__(self, unit_id): #: The unique in-game id for this unit. The id can sometimes be zero because #: TargetUnitCommandEvents will create a new unit with id zero when a unit - #: behind the fog of war is targetted. + #: behind the fog of war is targeted. self.id = unit_id #: A reference to the unit type this unit is current in. @@ -301,11 +301,11 @@ class Build(object): """ :param build_id: The build number identifying this dataset. - The datapack for a particualr group of builds. Maps internal integer ids + The datapack for a particular group of builds. Maps internal integer ids to :class:`Unit` and :class:`Ability` types. Also contains builder methods for creating new units and changing their types. - All build data is valid for standard games only. For arcade maps milage + All build data is valid for standard games only. For arcade maps mileage may vary. """ From d416eaa76ec5ac6e1e38a8eebb2a332f5ee0381a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 05:06:16 +0100 Subject: [PATCH 16/18] Fix typos found by codespell --- sc2reader/scripts/sc2parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc2reader/scripts/sc2parse.py b/sc2reader/scripts/sc2parse.py index 311db343..868f897a 100755 --- a/sc2reader/scripts/sc2parse.py +++ b/sc2reader/scripts/sc2parse.py @@ -27,7 +27,7 @@ def main(): parser = argparse.ArgumentParser( - description="Recursively parses replay files, inteded for debugging parse issues." + description="Recursively parses replay files, intended for debugging parse issues." ) parser.add_argument( "--one_each", From 605d068de6128f4d5d5653fdf730806e1f0a41d0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 05:07:57 +0100 Subject: [PATCH 17/18] Fix typos found by codespell --- sc2reader/scripts/sc2attributes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc2reader/scripts/sc2attributes.py b/sc2reader/scripts/sc2attributes.py index 109cf30b..a794e235 100644 --- a/sc2reader/scripts/sc2attributes.py +++ b/sc2reader/scripts/sc2attributes.py @@ -50,7 +50,7 @@ def main(): global decisions parser = argparse.ArgumentParser( - description="Recursively parses replay files, inteded for debugging parse issues." + description="Recursively parses replay files, intended for debugging parse issues." ) parser.add_argument( "folders", metavar="folder", type=str, nargs="+", help="Path to a folder" From 5a526f8a592d7de249166198c26d1ccb8df47589 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Jan 2020 05:08:56 +0100 Subject: [PATCH 18/18] Fix typos found by codespell --- sc2reader/scripts/sc2replayer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc2reader/scripts/sc2replayer.py b/sc2reader/scripts/sc2replayer.py index d8711962..011cffc6 100755 --- a/sc2reader/scripts/sc2replayer.py +++ b/sc2reader/scripts/sc2replayer.py @@ -31,7 +31,7 @@ def getch(): except ImportError as e: try: - # Opps, we might be on windows, try this one + # Oops, we might be on windows, try this one from msvcrt import getch except ImportError as e: # We can't make getch happen, just dump events to the screen