Skip to content

Commit a3315cd

Browse files
committed
Run black and isort.
1 parent a2c31d1 commit a3315cd

25 files changed

+162
-79
lines changed

axelrod/ecosystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(
3333
population: List[int] = None,
3434
) -> None:
3535
"""Create a new ecosystem.
36-
36+
3737
Parameters
3838
----------
3939
results: ResultSet
@@ -83,7 +83,7 @@ def __init__(
8383

8484
def reproduce(self, turns: int):
8585
"""Reproduce populations according to the payoff matrix.
86-
86+
8787
Parameters
8888
----------
8989
turns: int

axelrod/game.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(
2020
self, r: Score = 3, s: Score = 0, t: Score = 5, p: Score = 1
2121
) -> None:
2222
"""Create a new game object.
23-
23+
2424
Parameters
2525
----------
2626
r: int or float

axelrod/graph.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99

1010
class Graph(object):
1111
"""Weighted and directed graph class.
12-
12+
1313
This class is intended for the graph associated to a Markov process,
1414
since it gives easy access to the neighbors of a particular state.
1515
1616
Vertices can be any hashable Python object.
17-
17+
1818
Initialize with a list of edges:
1919
[[node1, node2, weights], ...]
2020
Weights can be omitted for an undirected graph.
2121
2222
For efficiency, neighbors are cached in dictionaries. Undirected
2323
graphs are implemented as directed graphs in which every edge (s, t)
2424
has the opposite edge (t, s).
25-
25+
2626
Attributes
2727
----------
2828
directed: Boolean indicating whether the graph is directed
@@ -31,7 +31,7 @@ class Graph(object):
3131
all tails to their edge weights (None means no weight)
3232
in_mapping: a dictionary mapping all tails to dictionaries that map
3333
all heads to their edge weights (none means to weight)
34-
34+
3535
Properties
3636
----------
3737
vertices: the set of vertices in the graph

axelrod/load_data_.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ def load_pso_tables(filename="pso_gambler.csv", directory="data"):
5656
rows = load_file(filename, directory)
5757
d = dict()
5858
for row in rows:
59-
name, a, b, c, = str(row[0]), int(row[1]), int(row[2]), int(row[3])
59+
name, a, b, c, = (
60+
str(row[0]),
61+
int(row[1]),
62+
int(row[2]),
63+
int(row[3]),
64+
)
6065
values = list(map(float, row[4:]))
6166
d[(name, int(a), int(b), int(c))] = values
6267
return d

axelrod/result_set.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ def _reshape_out(
152152
"DD to C count",
153153
"DD to D count",
154154
]
155-
self.state_to_action_distribution = self._build_state_to_action_distribution(
156-
sum_per_player_opponent_df[columns]
155+
self.state_to_action_distribution = (
156+
self._build_state_to_action_distribution(
157+
sum_per_player_opponent_df[columns]
158+
)
157159
)
158160
self.normalised_state_to_action_distribution = (
159161
self._build_normalised_state_to_action_distribution()

axelrod/strategies/cooperator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ def strategy(self, opponent: Player) -> Action:
5959
After 3 rounds, if opponent has not defected to a max history depth of
6060
10, defect.
6161
"""
62-
if self._has_played_enough_rounds_to_be_tricky() and self._opponents_has_cooperated_enough_to_be_tricky(
63-
opponent
62+
if (
63+
self._has_played_enough_rounds_to_be_tricky()
64+
and self._opponents_has_cooperated_enough_to_be_tricky(opponent)
6465
):
6566
return D
6667
return C

axelrod/strategies/grudger.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ def __init__(self) -> None:
167167
self.grudge_memory = 0
168168

169169
def strategy(self, opponent: Player) -> Action:
170-
"""Begins by playing C, then plays D, D, D, D, C, C against a defection
171-
"""
170+
"""Begins by playing C, then plays D, D, D, D, C, C against a defection"""
172171
if self.grudged:
173172
strategy = [D, D, D, C, C][self.grudge_memory]
174173
self.grudge_memory += 1

axelrod/strategies/human.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,14 @@ def _status_messages(self):
118118
if PROMPT2
119119
else lambda cli: [(token_toolbar, self._history_toolbar())]
120120
)
121-
print_statement = "{}Turn {}: {} played {}, opponent played {}".format(
122-
linesep,
123-
len(self.history),
124-
self.human_name,
125-
self.symbols[self.history[-1]],
126-
self.symbols[self.history.coplays[-1]],
121+
print_statement = (
122+
"{}Turn {}: {} played {}, opponent played {}".format(
123+
linesep,
124+
len(self.history),
125+
self.human_name,
126+
self.symbols[self.history[-1]],
127+
self.symbols[self.history.coplays[-1]],
128+
)
127129
)
128130
else:
129131
toolbar = None

axelrod/strategies/lookerup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,8 @@ def mutate(self):
535535
if r < self.mutation_probability:
536536
initial_actions[i] = initial_actions[i].flip()
537537
return self.create_new(
538-
lookup_dict=lookup_dict, initial_actions=tuple(initial_actions),
538+
lookup_dict=lookup_dict,
539+
initial_actions=tuple(initial_actions),
539540
)
540541

541542
def crossover(self, other):

axelrod/strategies/sequence_player.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(self) -> None:
8080

8181

8282
class ThueMorseInverse(ThueMorse):
83-
""" A player who plays the inverse of the Thue-Morse sequence.
83+
"""A player who plays the inverse of the Thue-Morse sequence.
8484
8585
Names:
8686

0 commit comments

Comments
 (0)