Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Autoformatting provided by black
  • Loading branch information
Chazzz committed Dec 11, 2020
commit 3d1c3bac9984b69f6a3fa3d7db75ab934928081b
13 changes: 10 additions & 3 deletions sc2reader/events/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,11 @@ def __init__(self, frame, pid, data):

def __str__(self):
return self._str_prefix() + " transfer {0} minerals, {1} gas, {2} terrazine, and {3} custom to {4}".format(
self.minerals, self.vespene, self.terrazine, self.custom_resource, self.recipient
self.minerals,
self.vespene,
self.terrazine,
self.custom_resource,
self.recipient,
)


Expand Down Expand Up @@ -685,8 +689,11 @@ def __init__(self, frame, pid, data):
self.custom_resource = self.resources[3] if len(self.resources) >= 4 else None

def __str__(self):
return self._str_prefix() + " requests {0} minerals, {1} gas, {2} terrazine, and {3} custom".format(
self.minerals, self.vespene, self.terrazine, self.custom_resource
return (
self._str_prefix()
+ " requests {0} minerals, {1} gas, {2} terrazine, and {3} custom".format(
Copy link
Collaborator

@cclauss cclauss Dec 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The {0} {1} {2} {3} thing has not been needed since Python 2.6 unless you want substitutions to land out of order or you want substitutions to repeat.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it was originally written and how the other classes in this file are written as well. Maybe create a separate issue to change this more broadly?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

self.minerals, self.vespene, self.terrazine, self.custom_resource
)
)


Expand Down
6 changes: 2 additions & 4 deletions test_replays/test_replays.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,8 @@ def test_send_resources(self):
"test_replays/2.0.4.24944/Backwater Complex (15).SC2Replay"
)
trade_events = [
event
for event in replay.events
if event.name == "ResourceTradeEvent"
]
event for event in replay.events if event.name == "ResourceTradeEvent"
]
self.assertEqual(len(trade_events), 5)
self.assertEqual(trade_events[0].sender.name, "Guardian")
self.assertEqual(trade_events[0].recipient.name, "Sturmkind")
Expand Down