Skip to content

Commit

Permalink
Merge pull request #111 from obiwac/ruff-as-a-formatter
Browse files Browse the repository at this point in the history
Ruff as a formatter
  • Loading branch information
obiwac authored Jul 30, 2024
2 parents d0d4979 + c37cbe0 commit 4a48e3a
Show file tree
Hide file tree
Showing 30 changed files with 783 additions and 202 deletions.
27 changes: 8 additions & 19 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: chartboost/ruff-action@v1
with:
python-version: "3.11"
- name: Create and activate venv
run: |
python -m venv .venv
source .venv/bin/activate
- name: Install dependencies
run: pip install tan ruff
- name: Cache venv
uses: actions/cache@v3
with:
path: ./.venv
key: venv-${{ runner.os }}
- name: Run formatter
run: |
tan --check . --use-tabs --line-length 120 --verbose
- name: Run linter
run: |
ruff check . --ignore E402 --ignore F405 --ignore F403
args: 'format --check'

check_linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
4 changes: 1 addition & 3 deletions community/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
# Recommended values are between 0 and 9

# Legacy Smooth FPS
SMOOTH_FPS = (
False # Legacy way to force the flushing of command buffer and forces the CPU to wait for the GPU to finish rendering.
)
SMOOTH_FPS = False # Legacy way to force the flushing of command buffer and forces the CPU to wait for the GPU to finish rendering.
# Incompatible Max CPU Ahead Frames (it won't be effective)
# Enable this to test whether its impact is better. Similar to Max CPU Ahead frames to 0

Expand Down
8 changes: 3 additions & 5 deletions community/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ def save_chunk(self, chunk_position):
for x in range(chunk.CHUNK_WIDTH):
for y in range(chunk.CHUNK_HEIGHT):
for z in range(chunk.CHUNK_LENGTH):
chunk_blocks[
x * chunk.CHUNK_LENGTH * chunk.CHUNK_HEIGHT + z * chunk.CHUNK_HEIGHT + y
] = self.world.chunks[
chunk_position
].blocks[x][y][z]
chunk_blocks[x * chunk.CHUNK_LENGTH * chunk.CHUNK_HEIGHT + z * chunk.CHUNK_HEIGHT + y] = (
self.world.chunks[chunk_position].blocks[x][y][z]
)

# save the chunk file

Expand Down
8 changes: 3 additions & 5 deletions episode-11/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ def save_chunk(self, chunk_position):
for x in range(chunk.CHUNK_WIDTH):
for y in range(chunk.CHUNK_HEIGHT):
for z in range(chunk.CHUNK_LENGTH):
chunk_blocks[
x * chunk.CHUNK_LENGTH * chunk.CHUNK_HEIGHT + z * chunk.CHUNK_HEIGHT + y
] = self.world.chunks[
chunk_position
].blocks[x][y][z]
chunk_blocks[x * chunk.CHUNK_LENGTH * chunk.CHUNK_HEIGHT + z * chunk.CHUNK_HEIGHT + y] = (
self.world.chunks[chunk_position].blocks[x][y][z]
)

# save the chunk file

Expand Down
8 changes: 3 additions & 5 deletions episode-12/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ def save_chunk(self, chunk_position):
for x in range(chunk.CHUNK_WIDTH):
for y in range(chunk.CHUNK_HEIGHT):
for z in range(chunk.CHUNK_LENGTH):
chunk_blocks[
x * chunk.CHUNK_LENGTH * chunk.CHUNK_HEIGHT + z * chunk.CHUNK_HEIGHT + y
] = self.world.chunks[
chunk_position
].blocks[x][y][z]
chunk_blocks[x * chunk.CHUNK_LENGTH * chunk.CHUNK_HEIGHT + z * chunk.CHUNK_HEIGHT + y] = (
self.world.chunks[chunk_position].blocks[x][y][z]
)

# save the chunk file

Expand Down
7 changes: 6 additions & 1 deletion episode-13/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ class Game:
def __init__(self):
self.config = gl.Config(double_buffer=True, major_version=3, minor_version=3, depth_size=16)
self.window = Window(
config=self.config, width=800, height=600, caption="Minecraft clone", resizable=True, vsync=False
config=self.config,
width=800,
height=600,
caption="Minecraft clone",
resizable=True,
vsync=False,
)

def run(self):
Expand Down
90 changes: 84 additions & 6 deletions episode-13/models/cactus.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,90 @@
colliders = [[(-0.4375, -0.5, -0.4375), (0.4375, 0.5, 0.4375)]]

vertex_positions = [
[0.4375, 0.5000, 0.5000, 0.4375, -0.5000, 0.5000, 0.4375, -0.5000, -0.5000, 0.4375, 0.5000, -0.5000], # right
[-0.4375, 0.5000, -0.5000, -0.4375, -0.5000, -0.5000, -0.4375, -0.5000, 0.5000, -0.4375, 0.5000, 0.5000], # left
[0.5000, 0.5000, 0.5000, 0.5000, 0.5000, -0.5000, -0.5000, 0.5000, -0.5000, -0.5000, 0.5000, 0.5000], # top
[-0.5000, -0.5000, 0.5000, -0.5000, -0.5000, -0.5000, 0.5000, -0.5000, -0.5000, 0.5000, -0.5000, 0.5000], # bottom
[-0.5000, 0.5000, 0.4375, -0.5000, -0.5000, 0.4375, 0.5000, -0.5000, 0.4375, 0.5000, 0.5000, 0.4375], # front
[0.5000, 0.5000, -0.4375, 0.5000, -0.5000, -0.4375, -0.5000, -0.5000, -0.4375, -0.5000, 0.5000, -0.4375], # back
[
0.4375,
0.5000,
0.5000,
0.4375,
-0.5000,
0.5000,
0.4375,
-0.5000,
-0.5000,
0.4375,
0.5000,
-0.5000,
], # right
[
-0.4375,
0.5000,
-0.5000,
-0.4375,
-0.5000,
-0.5000,
-0.4375,
-0.5000,
0.5000,
-0.4375,
0.5000,
0.5000,
], # left
[
0.5000,
0.5000,
0.5000,
0.5000,
0.5000,
-0.5000,
-0.5000,
0.5000,
-0.5000,
-0.5000,
0.5000,
0.5000,
], # top
[
-0.5000,
-0.5000,
0.5000,
-0.5000,
-0.5000,
-0.5000,
0.5000,
-0.5000,
-0.5000,
0.5000,
-0.5000,
0.5000,
], # bottom
[
-0.5000,
0.5000,
0.4375,
-0.5000,
-0.5000,
0.4375,
0.5000,
-0.5000,
0.4375,
0.5000,
0.5000,
0.4375,
], # front
[
0.5000,
0.5000,
-0.4375,
0.5000,
-0.5000,
-0.4375,
-0.5000,
-0.5000,
-0.4375,
-0.5000,
0.5000,
-0.4375,
], # back
]

tex_coords = [
Expand Down
120 changes: 112 additions & 8 deletions episode-13/models/crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,118 @@
colliders = []

vertex_positions = [
[0.25, 0.4375, 0.50, 0.25, -0.5625, 0.50, 0.25, -0.5625, -0.50, 0.25, 0.4375, -0.50], # right
[0.25, 0.4375, -0.50, 0.25, -0.5625, -0.50, 0.25, -0.5625, 0.50, 0.25, 0.4375, 0.50], # right
[-0.25, 0.4375, -0.50, -0.25, -0.5625, -0.50, -0.25, -0.5625, 0.50, -0.25, 0.4375, 0.50], # left
[-0.25, 0.4375, 0.50, -0.25, -0.5625, 0.50, -0.25, -0.5625, -0.50, -0.25, 0.4375, -0.50], # left
[-0.50, 0.4375, 0.25, -0.50, -0.5625, 0.25, 0.50, -0.5625, 0.25, 0.50, 0.4375, 0.25], # front
[0.50, 0.4375, 0.25, 0.50, -0.5625, 0.25, -0.50, -0.5625, 0.25, -0.50, 0.4375, 0.25], # front
[0.50, 0.4375, -0.25, 0.50, -0.5625, -0.25, -0.50, -0.5625, -0.25, -0.50, 0.4375, -0.25], # back
[-0.50, 0.4375, -0.25, -0.50, -0.5625, -0.25, 0.50, -0.5625, -0.25, 0.50, 0.4375, -0.25], # back
[
0.25,
0.4375,
0.50,
0.25,
-0.5625,
0.50,
0.25,
-0.5625,
-0.50,
0.25,
0.4375,
-0.50,
], # right
[
0.25,
0.4375,
-0.50,
0.25,
-0.5625,
-0.50,
0.25,
-0.5625,
0.50,
0.25,
0.4375,
0.50,
], # right
[
-0.25,
0.4375,
-0.50,
-0.25,
-0.5625,
-0.50,
-0.25,
-0.5625,
0.50,
-0.25,
0.4375,
0.50,
], # left
[
-0.25,
0.4375,
0.50,
-0.25,
-0.5625,
0.50,
-0.25,
-0.5625,
-0.50,
-0.25,
0.4375,
-0.50,
], # left
[
-0.50,
0.4375,
0.25,
-0.50,
-0.5625,
0.25,
0.50,
-0.5625,
0.25,
0.50,
0.4375,
0.25,
], # front
[
0.50,
0.4375,
0.25,
0.50,
-0.5625,
0.25,
-0.50,
-0.5625,
0.25,
-0.50,
0.4375,
0.25,
], # front
[
0.50,
0.4375,
-0.25,
0.50,
-0.5625,
-0.25,
-0.50,
-0.5625,
-0.25,
-0.50,
0.4375,
-0.25,
], # back
[
-0.50,
0.4375,
-0.25,
-0.50,
-0.5625,
-0.25,
0.50,
-0.5625,
-0.25,
0.50,
0.4375,
-0.25,
], # back
]

tex_coords = [
Expand Down
60 changes: 56 additions & 4 deletions episode-13/models/fire.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,62 @@
colliders = []

vertex_positions = [
[-0.3536, 0.5000, 0.3536, -0.3536, -0.5000, 0.3536, 0.3536, -0.5000, -0.3536, 0.3536, 0.5000, -0.3536],
[-0.3536, 0.5000, -0.3536, -0.3536, -0.5000, -0.3536, 0.3536, -0.5000, 0.3536, 0.3536, 0.5000, 0.3536],
[0.3536, 0.5000, -0.3536, 0.3536, -0.5000, -0.3536, -0.3536, -0.5000, 0.3536, -0.3536, 0.5000, 0.3536],
[0.3536, 0.5000, 0.3536, 0.3536, -0.5000, 0.3536, -0.3536, -0.5000, -0.3536, -0.3536, 0.5000, -0.3536],
[
-0.3536,
0.5000,
0.3536,
-0.3536,
-0.5000,
0.3536,
0.3536,
-0.5000,
-0.3536,
0.3536,
0.5000,
-0.3536,
],
[
-0.3536,
0.5000,
-0.3536,
-0.3536,
-0.5000,
-0.3536,
0.3536,
-0.5000,
0.3536,
0.3536,
0.5000,
0.3536,
],
[
0.3536,
0.5000,
-0.3536,
0.3536,
-0.5000,
-0.3536,
-0.3536,
-0.5000,
0.3536,
-0.3536,
0.5000,
0.3536,
],
[
0.3536,
0.5000,
0.3536,
0.3536,
-0.5000,
0.3536,
-0.3536,
-0.5000,
-0.3536,
-0.3536,
0.5000,
-0.3536,
],
]

tex_coords = [
Expand Down
Loading

0 comments on commit 4a48e3a

Please sign in to comment.