Skip to content

Commit 916bfbb

Browse files
committed
Add better VSCode support. Fix several warnings and some documentation.
1 parent 8b9c6f3 commit 916bfbb

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"editor.rulers": [
3+
79,
4+
120
5+
],
6+
"editor.formatOnSave": true,
7+
"editor.codeActionsOnSave": {
8+
"source.organizeImports": true
9+
},
10+
"python.linting.enabled": true,
11+
"python.linting.flake8Enabled": true,
12+
"python.linting.mypyEnabled": true,
13+
"python.linting.mypyArgs": [
14+
"--ignore-missing-imports",
15+
"--follow-imports=silent",
16+
"--show-column-numbers"
17+
],
18+
"python.formatting.provider": "black"
19+
}

examples/cavegen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
This will print the result to the console, so be sure to run this from the
77
command line.
88
"""
9-
import numpy as np # type: ignore
10-
import scipy.signal # type: ignore
9+
import numpy as np
10+
import scipy.signal
1111

1212

13-
def convolve(tiles: np.array, wall_rule: int = 5) -> np.array:
13+
def convolve(tiles: np.ndarray, wall_rule: int = 5) -> np.ndarray:
1414
"""Return the next step of the cave generation algorithm.
1515
1616
`tiles` is the input array. (0: wall, 1: floor)
@@ -25,7 +25,7 @@ def convolve(tiles: np.array, wall_rule: int = 5) -> np.array:
2525
return neighbors < wall_rule # Apply the wall rule.
2626

2727

28-
def show(tiles: np.array) -> None:
28+
def show(tiles: np.ndarray) -> None:
2929
"""Print out the tiles of an array."""
3030
for line in tiles:
3131
print("".join("# "[int(cell)] for cell in line))

examples/framerate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import statistics
99
import time
1010
from collections import deque
11-
from typing import Deque, List, Optional, Tuple
11+
from typing import Deque, Optional
1212

1313
import tcod
1414

tcod/console.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,8 +1257,8 @@ def load_xp(
12571257
12581258
Example::
12591259
1260+
import numpy as np
12601261
import tcod
1261-
from numpy import np
12621262
12631263
path = "example.xp" # REXPaint file with one layer.
12641264
@@ -1311,8 +1311,8 @@ def save_xp(
13111311
13121312
Example::
13131313
1314+
import numpy as np
13141315
import tcod
1315-
from numpy import np
13161316
13171317
console = tcod.Console(80, 24) # Example console.
13181318

0 commit comments

Comments
 (0)