Skip to content

Commit 9838f84

Browse files
Move to pyproject.toml. (#1440)
* Move to pyproject.toml. This uses hatch. Note I've removed the human player. I don't believe we ever use it. If we want to we can add it back in. * Bump version number.
1 parent 95052da commit 9838f84

Some content is hidden

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

67 files changed

+328
-564
lines changed

.github/workflows/config.yml

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

.github/workflows/tests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
max-parallel: 4
10+
matrix:
11+
os: [ubuntu-latest, macOS-latest, windows-latest]
12+
python-version: ["3.11", "3.12"]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: update pip
22+
run: |
23+
python -m pip install --upgrade pip
24+
25+
- name: install tox
26+
run: |
27+
python -m pip install tox tox-gh-actions
28+
29+
- name: run tox
30+
run: |
31+
python -m tox

axelrod/classifier.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
)
1515

1616
import yaml
17+
1718
from axelrod.makes_use_of import makes_use_of
1819
from axelrod.player import Player
1920

axelrod/fingerprint.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
from tempfile import mkstemp
44
from typing import Any, List, Union
55

6-
import axelrod as axl
76
import dask.dataframe as dd
87
import matplotlib.pyplot as plt
98
import numpy as np
109
import tqdm
10+
from mpl_toolkits.axes_grid1 import make_axes_locatable
11+
12+
import axelrod as axl
1113
from axelrod import Player
1214
from axelrod.interaction_utils import (
1315
compute_final_score_per_turn,
1416
read_interactions_from_file,
1517
)
1618
from axelrod.strategy_transformers import DualTransformer, JossAnnTransformer
17-
from mpl_toolkits.axes_grid1 import make_axes_locatable
1819

1920
Point = namedtuple("Point", "x y")
2021

axelrod/game.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from typing import Tuple, Union
21
from enum import Enum
2+
from typing import Tuple, Union
33

44
import numpy as np
55

@@ -71,6 +71,7 @@ def get_value(x):
7171
if isinstance(x, Enum):
7272
return x.value
7373
return x
74+
7475
row, col = map(get_value, pair)
7576

7677
return (self.A[row][col], self.B[row][col])
@@ -97,7 +98,9 @@ class Game(AsymmetricGame):
9798
The numerical score attribute to all combinations of action pairs.
9899
"""
99100

100-
def __init__(self, r: Score = 3, s: Score = 0, t: Score = 5, p: Score = 1) -> None:
101+
def __init__(
102+
self, r: Score = 3, s: Score = 0, t: Score = 5, p: Score = 1
103+
) -> None:
101104
"""Create a new game object.
102105
103106
Parameters

axelrod/interaction_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
This is used by both the Match class and the ResultSet class which analyse
88
interactions.
99
"""
10+
1011
from collections import Counter, defaultdict
1112

1213
import pandas as pd
1314
import tqdm
15+
1416
from axelrod.action import Action, str_to_actions
1517

1618
from .game import Game

axelrod/load_data_.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pathlib
2+
import pkgutil
23
from typing import Dict, List, Text, Tuple
34

4-
import pkgutil
55

66
def axl_filename(path: pathlib.Path) -> pathlib.Path:
77
"""Given a path under Axelrod/, return absolute filepath.
@@ -27,7 +27,7 @@ def load_file(filename: str, directory: str) -> List[List[str]]:
2727
path = str(pathlib.Path(directory) / filename)
2828
data_bytes = pkgutil.get_data(__name__, path)
2929
data = data_bytes.decode("UTF-8", "replace")
30-
30+
3131
rows = []
3232
for line in data.split("\n"):
3333
if line.startswith("#") or len(line) == 0:
@@ -57,7 +57,12 @@ def load_pso_tables(filename="pso_gambler.csv", directory="data"):
5757
rows = load_file(filename, directory)
5858
d = dict()
5959
for row in rows:
60-
name, a, b, c, = (
60+
(
61+
name,
62+
a,
63+
b,
64+
c,
65+
) = (
6166
str(row[0]),
6267
int(row[1]),
6368
int(row[2]),

axelrod/moran.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import matplotlib.pyplot as plt
77
import numpy as np
8+
89
from axelrod import DEFAULT_TURNS, EvolvablePlayer, Game, Player
910
from axelrod.deterministic_cache import DeterministicCache
1011
from axelrod.graph import Graph, complete_graph

axelrod/player.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import Any, Dict
77

88
import numpy as np
9+
910
from axelrod import _module_random
1011
from axelrod.action import Action
1112
from axelrod.game import DefaultGame
@@ -121,7 +122,7 @@ def _post_init(self):
121122
def _post_transform(self):
122123
"""Handles post transform tasks such as further reclassifying."""
123124
# Reclassify strategy post __init__, if needed.
124-
for (reclassifier, args, kwargs) in self._reclassifiers:
125+
for reclassifier, args, kwargs in self._reclassifiers:
125126
self.classifier = reclassifier(self.classifier, *args, **kwargs)
126127

127128
def __eq__(self, other):

axelrod/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def _payoff_heatmap(
176176
names: namesType,
177177
title: titleType = None,
178178
ax: matplotlib.axes.SubplotBase = None,
179-
cmap: str = 'viridis'
179+
cmap: str = "viridis",
180180
) -> matplotlib.figure.Figure:
181181
"""Generic heatmap plot"""
182182

0 commit comments

Comments
 (0)