-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
75 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: tox | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: test ${{ matrix.py }} - ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- Ubuntu | ||
- Windows | ||
- MacOs | ||
py: | ||
- "3.10" | ||
steps: | ||
- name: Setup python for test ${{ matrix.py }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.py }} | ||
- uses: actions/checkout@v3 | ||
- name: Upgrade pip | ||
run: python -m pip install -U pip | ||
- name: Install | ||
run: python -m pip install -e '.[dev]' | ||
- name: Check formatting | ||
run: ruff format pokemonred_puffer | ||
- name: Check lint | ||
run: ruff check pokemonred_puffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version. | ||
rev: v0.3.2 | ||
hooks: | ||
# Run the linter. | ||
- id: ruff | ||
# Run the formatter. | ||
- id: ruff-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
import os | ||
import json | ||
|
||
MAP_PATH = os.path.join(os.path.dirname(__file__), 'map_data.json') | ||
MAP_PATH = os.path.join(os.path.dirname(__file__), "map_data.json") | ||
GLOBAL_MAP_SHAPE = (444, 436) | ||
|
||
with open(MAP_PATH) as map_data: | ||
MAP_DATA = json.load(map_data)['regions'] | ||
MAP_DATA = {int(e['id']): e for e in MAP_DATA} | ||
MAP_DATA = json.load(map_data)["regions"] | ||
MAP_DATA = {int(e["id"]): e for e in MAP_DATA} | ||
|
||
|
||
# Handle KeyErrors | ||
def local_to_global(r: int, c: int, map_n: int): | ||
try: | ||
map_x, map_y,= MAP_DATA[map_n]['coordinates'] | ||
( | ||
map_x, | ||
map_y, | ||
) = MAP_DATA[map_n]["coordinates"] | ||
return r + map_y, c + map_x | ||
except KeyError: | ||
print(f'Map id {map_n} not found in map_data.json.') | ||
return r + 0, c + 0 | ||
print(f"Map id {map_n} not found in map_data.json.") | ||
return r + 0, c + 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ monitoring = [ | |
"nvitop" | ||
] | ||
dev = [ | ||
"pre-commit", | ||
"ruff" | ||
] | ||
|
||
|