Skip to content

Commit

Permalink
Bump the python-dependencies group across 1 directory with 9 updates (#…
Browse files Browse the repository at this point in the history
…51)

* Bump the python-dependencies group across 1 directory with 9 updates

Bumps the python-dependencies group with 9 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [typer](https://github.com/fastapi/typer) | `0.12.3` | `0.12.5` |
| [nox](https://github.com/wntrblm/nox) | `2024.4.15` | `2024.10.9` |
| [pre-commit](https://github.com/pre-commit/pre-commit) | `3.7.1` | `4.0.1` |
| [ruff](https://github.com/astral-sh/ruff) | `0.4.10` | `0.7.1` |
| [mypy](https://github.com/python/mypy) | `1.10.0` | `1.13.0` |
| [pytest](https://github.com/pytest-dev/pytest) | `8.2.2` | `8.3.3` |
| [sphinx](https://github.com/sphinx-doc/sphinx) | `7.3.7` | `8.1.3` |
| [furo](https://github.com/pradyunsg/furo) | `2024.5.6` | `2024.8.6` |
| [sphinx-autoapi](https://github.com/readthedocs/sphinx-autoapi) | `3.1.2` | `3.3.2` |



Updates `typer` from 0.12.3 to 0.12.5
- [Release notes](https://github.com/fastapi/typer/releases)
- [Changelog](https://github.com/fastapi/typer/blob/master/docs/release-notes.md)
- [Commits](fastapi/typer@0.12.3...0.12.5)

Updates `nox` from 2024.4.15 to 2024.10.9
- [Release notes](https://github.com/wntrblm/nox/releases)
- [Changelog](https://github.com/wntrblm/nox/blob/main/CHANGELOG.md)
- [Commits](wntrblm/nox@2024.04.15...2024.10.09)

Updates `pre-commit` from 3.7.1 to 4.0.1
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](pre-commit/pre-commit@v3.7.1...v4.0.1)

Updates `ruff` from 0.4.10 to 0.7.1
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@v0.4.10...0.7.1)

Updates `mypy` from 1.10.0 to 1.13.0
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.10.0...v1.13.0)

Updates `pytest` from 8.2.2 to 8.3.3
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@8.2.2...8.3.3)

Updates `sphinx` from 7.3.7 to 8.1.3
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/v8.1.3/CHANGES.rst)
- [Commits](sphinx-doc/sphinx@v7.3.7...v8.1.3)

Updates `furo` from 2024.5.6 to 2024.8.6
- [Release notes](https://github.com/pradyunsg/furo/releases)
- [Changelog](https://github.com/pradyunsg/furo/blob/main/docs/changelog.md)
- [Commits](pradyunsg/furo@2024.05.06...2024.08.06)

Updates `sphinx-autoapi` from 3.1.2 to 3.3.2
- [Release notes](https://github.com/readthedocs/sphinx-autoapi/releases)
- [Changelog](https://github.com/readthedocs/sphinx-autoapi/blob/main/CHANGELOG.rst)
- [Commits](readthedocs/sphinx-autoapi@v3.1.2...v3.3.2)

---
updated-dependencies:
- dependency-name: typer
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
- dependency-name: nox
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
- dependency-name: pre-commit
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: python-dependencies
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
- dependency-name: sphinx
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: python-dependencies
- dependency-name: furo
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
- dependency-name: sphinx-autoapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>

* Appease linter

Signed-off-by: GitHub <[email protected]>

* Bump pre-commit

Signed-off-by: GitHub <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: GitHub <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bradley Reynolds <[email protected]>
  • Loading branch information
dependabot[bot] and shenanigansd authored Oct 24, 2024
1 parent e759c1a commit bb7bab7
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Packaging
*.egg-info
dist
build

# Cache
__pycache__
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
Expand Down
7 changes: 6 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@


def linkcode_resolve(domain: str, info: dict) -> str | None:
"""linkcode_resolve."""
"""linkcode_resolve.
Returns
-------
A link to the source code.
"""
if domain != "py":
return None
if not info["module"]:
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@nox.session
def install(session: nox.Session) -> None:
"""Install the project."""
session.run("python", "-m", "pip", "install", ".[dev,test]")
session.run("python", "-m", "pip", "install", ".[dev,tests]")


@nox.session
Expand Down
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = { text = "MIT" }
readme = "README.md"
requires-python = ">=3.12,<3.13"
dependencies = [
"typer==0.12.3"
"typer==0.12.5"
]

[project.urls]
Expand All @@ -21,19 +21,19 @@ bpp = "bpp.cli:app"

[project.optional-dependencies]
dev = [
"nox==2024.4.15",
"pre-commit==3.7.1",
"ruff==0.4.10",
"mypy==1.10.0",
"nox==2024.10.9",
"pre-commit==4.0.1",
"ruff==0.7.1",
"mypy==1.13.0",
]
tests = [
"pytest==8.2.2",
"pytest==8.3.3",
"pytest-randomly==3.15.0",
]
docs = [
"sphinx==7.3.7",
"furo==2024.5.6",
"sphinx-autoapi==3.1.2",
"sphinx==8.1.3",
"furo==2024.8.6",
"sphinx-autoapi==3.3.2",
"releases==2.1.1",
]

Expand Down
30 changes: 26 additions & 4 deletions src/bpp/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ class ResultState(Enum):


def validate_syntax(syntax: Sequence[Sequence[Token]]) -> None:
"""Validate the given syntax."""
"""Validate the given syntax.
Raises
------
BrainfuckSyntaxError
If the syntax is invalid.
"""
in_loop = False
loop_started_at_line = 0
loop_started_at_character = 0
Expand Down Expand Up @@ -61,7 +67,13 @@ def increment_pointer(self: Self) -> None:
self.current_position += 1

def decrement_pointer(self: Self) -> None:
"""Decrement the pointer."""
"""Decrement the pointer.
Raises
------
BrainfuckSyntaxError
If the pointer goes negative.
"""
if self.current_position == 0:
msg = "Pointer can't be negative!"
raise BrainfuckSyntaxError(msg)
Expand Down Expand Up @@ -92,7 +104,12 @@ def get_input(self: Self) -> None:
self.memory[self.current_position] = ord(sys.stdin.read(1))

def handle_token(self: Self, token: Token) -> ResultState: # noqa: C901
"""Handle a single token."""
"""Handle a single token.
Returns
-------
The state of the interpreter after handling the token
"""
match token:
case Token.INCREMENT_POINTER:
self.increment_pointer()
Expand All @@ -115,7 +132,12 @@ def handle_token(self: Self, token: Token) -> ResultState: # noqa: C901
return ResultState.SUCCESS

def run(self: Self, code: str) -> str:
"""Run code."""
"""Run code.
Returns
-------
The output of the code.
"""
syntax = [tokenize(line) for line in code.split("\n")]
validate_syntax(syntax)
tokens = [token for line in syntax for token in line]
Expand Down
14 changes: 12 additions & 2 deletions src/bpp/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,25 @@ class Token(Enum):

@classmethod
def from_character(cls: type[Self], character: str) -> Self | None:
"""Get the token from a string."""
"""Get the token from a string.
Returns
-------
The token or None if the character is not a token.
"""
try:
return cls(character)
except ValueError:
return None


def tokenize(code: str) -> Sequence[Token]:
"""Convert text to tokens."""
"""Convert text to tokens.
Returns
-------
A sequence of tokens.
"""
tokens = []
for character in code:
token = Token.from_character(character)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from runpy import run_module

from bpp.cli import app
from typer.testing import CliRunner

from bpp.cli import app

runner = CliRunner()


Expand Down
1 change: 1 addition & 0 deletions tests/test_example_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path

import pytest

from bpp import Interpreter


Expand Down
1 change: 1 addition & 0 deletions tests/test_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from io import StringIO

import pytest

from bpp import BrainfuckSyntaxError, Interpreter

ASCII_LOWERCASE_A = 97
Expand Down
1 change: 1 addition & 0 deletions tests/test_tokens.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test the tokenizer."""

import pytest

from bpp import Token, tokenize


Expand Down

0 comments on commit bb7bab7

Please sign in to comment.