Skip to content

Commit 2c91d7a

Browse files
committed
Begin using isort to organize imports.
1 parent 090d148 commit 2c91d7a

35 files changed

Lines changed: 100 additions & 92 deletions

.github/workflows/python-package.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install Python dependencies
3232
run: |
3333
python -m pip install --upgrade pip
34-
python -m pip install flake8 mypy pytest pytest-cov pytest-benchmark black
34+
python -m pip install flake8 mypy pytest pytest-cov pytest-benchmark black isort
3535
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3636
- name: Initialize package
3737
run: |
@@ -48,6 +48,11 @@ jobs:
4848
- name: Check formatting with Black
4949
run: |
5050
black --check tcod/
51+
- name: Check import order
52+
run: |
53+
isort tcod/ --check --diff
54+
isort tests/ --check --diff
55+
isort examples/ --check --diff --thirdparty tcod
5156
- name: Build package.
5257
run: |
5358
python setup.py develop # Install the package in-place.

examples/cavegen.py

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

1212

1313
def convolve(tiles: np.array, wall_rule: int = 5) -> np.array:

examples/distribution/PyInstaller/hello_world.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# copyright and related or neighboring rights for the "hello world" PyInstaller
44
# example script. This work is published from: United States.
55
# https://creativecommons.org/publicdomain/zero/1.0/
6-
import sys
76
import os.path
7+
import sys
88

99
import tcod
1010

examples/distribution/cx_Freeze/hello_world.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import tdl
44

5-
65
WIDTH, HEIGHT = 80, 60
76
console = None
87

examples/distribution/cx_Freeze/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import sys
33

4-
from cx_Freeze import setup, Executable
4+
from cx_Freeze import Executable, setup
55

66
# cx_Freeze options, see documentation.
77
build_exe_options = {

examples/eventget.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import tcod
1111

12-
1312
WIDTH, HEIGHT = 720, 480
1413
FLAGS = tcod.context.SDL_WINDOW_RESIZABLE | tcod.context.SDL_WINDOW_MAXIMIZED
1514

examples/samples_libtcodpy.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
#
77
from __future__ import division
88

9-
import sys
10-
import os
11-
129
import math
10+
import os
11+
import sys
1312
import warnings
1413

1514
import tcod as libtcod

examples/samples_tcod.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
# To the extent possible under law, the libtcod maintainers have waived all
66
# copyright and related or neighboring rights to these samples.
77
# https://creativecommons.org/publicdomain/zero/1.0/
8-
import sys
9-
import os
10-
118
import copy
129
import math
10+
import os
1311
import random
12+
import sys
1413
import time
1514
import warnings
1615

examples/thread_jobs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@
1313
Typically the field-of-view tasks run good but not great, and the path-finding
1414
tasks run poorly.
1515
"""
16-
import sys
17-
1816
import concurrent.futures
1917
import multiprocessing
2018
import platform
19+
import sys
2120
import timeit
22-
from typing import List, Tuple, Callable
21+
from typing import Callable, List, Tuple
2322

2423
import tcod
2524

26-
2725
THREADS = multiprocessing.cpu_count()
2826

2927
MAP_WIDTH = 100

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ requires = [
1010
line-length = 79
1111
py36 = false
1212
target-version = ["py35"]
13+
14+
[tool.isort]
15+
profile= "black"
16+
py_version = "35"
17+
skip_gitignore = true
18+
line_length = 79

0 commit comments

Comments
 (0)