Skip to content

Commit

Permalink
Merge pull request #3 from salve-org/v0.2.0
Browse files Browse the repository at this point in the history
V0.2.0
  • Loading branch information
Moosems committed Sep 7, 2024
2 parents ae9e0fd + 2af1f57 commit 10d1c84
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 79 deletions.
5 changes: 4 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Fixes #__.

Changes in PR:
To do:
- [ ] ...

Cuurent changes in PR:
- ...
43 changes: 43 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Formatting

on: push

jobs:
formatting-isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11.1

- name: Code Formatting (App)
run: |
pip install -r requirements-dev.txt
isort --check .
formatting-ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11.1

- name: Code Formatting (App)
run: |
pip install -r requirements-dev.txt
ruff format --check .
ruff-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11.1

- name: Code Formatting (App)
run: |
pip install -r requirements-dev.txt
ruff check .
17 changes: 0 additions & 17 deletions .github/workflows/isort.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload salve to Pypi
name: Upload token_tools to Pypi

on:
release:
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/ruff-format.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/ruff.yml

This file was deleted.

30 changes: 29 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Code Tests
on: push

jobs:
testing:
testing-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -16,3 +16,31 @@ jobs:
pip install .
pip install -r requirements-dev.txt
python3 -m pytest .
testing-macos:
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11.1

- name: Run tests
run: |
pip install .
pip install -r requirements-dev.txt
python3 -m pytest .
testing-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11.1

- name: Run tests
run: |
pip install .
pip install -r requirements-dev.txt
python3 -m pytest . -s
18 changes: 0 additions & 18 deletions .github/workflows/windows-tests.yml

This file was deleted.

6 changes: 2 additions & 4 deletions token_tools/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
Token = tuple[tuple[int, int], int, str]

GENERIC_TOKENS: list[str] = [
"Whitespace",
"Text",
"Identifier", # Variable
"Error",
"Keyword",
"Name",
"Type",
"String",
"Number",
"Literal",
"Operator",
"Punctuation",
"Comment",
"Generic",
]
6 changes: 3 additions & 3 deletions token_tools/token_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def normal_text_range(
"""Takes the full text and a text range (inclusively numbered) and returns the split text and a tuple with the proper text range."""
# Text range is the first and last line inclusively with -1 for the end line indicating that it goes until the last line
split_text: list[str] = full_text.splitlines()
split_len: int = len(split_text)

if text_range[1] == -1:
# This indicates that the text range should span the length of the entire code
split_len: int = len(split_text)
if text_range[1] > split_len or text_range[1] == -1:
# This indicates that the text range should span the length of the entire code or is too long
split_len = (
1 if split_len == 0 else split_len
) # If its a one line code snippet, we need to +1
Expand Down

0 comments on commit 10d1c84

Please sign in to comment.