Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #80 support json array #85

Merged
merged 4 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ updates:
directory: "/" # Location of package manifests

schedule:
interval: "weekly"
interval: "monthly"
allow:
- dependency-type: "all"
13 changes: 1 addition & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.10"

[tool.poetry.group.test.dependencies]
[tool.poetry.group.dev]
optional = true

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.5.0"
mypy = "^1.6.1"
syrupy = "^4.0.2"
pytest-cov = "^4.1.0"
coveralls = "^3.3.1"
pytest-recording = "^0.13.0"


[tool.poetry.group.dev.dependencies]
pre-commit = "^3.5.0"
mypy = "^1.6.1"

[tool.poetry-dynamic-versioning]
enable = true
pattern = "default-unprefixed"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
set -ev

poetry export --without-hashes -f requirements.txt -o requirements.txt
poetry export --without-hashes --with test,dev -f requirements.txt -o requirements-test.txt
poetry export --without-hashes --with dev -f requirements.txt -o requirements-test.txt
7 changes: 6 additions & 1 deletion src/fuzzy_json/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def state_start(input: str) -> str:
def state_root_object(input: str, stack: list[str]) -> str | None:
input = input.strip()

if input[0] == "{":
if input[0] == "[":
return input[0] + state_value(input[1:], stack + ["["])
elif input[0] == "{":
return input[0] + state_object(input[1:], stack + ["{"])
else:
if input.startswith("json"):
Expand Down Expand Up @@ -105,6 +107,9 @@ def state_value(input: str, stack: list[str]) -> str | None:
def state_post_value(input: str, stack: list[str]) -> str | None:
input = input.strip()

if stack[-1] == "$":
return state_finish(input, stack)

if input[0] == ",":
if stack[-1] == "[":
return input[0] + state_value(input[1:], stack)
Expand Down
Loading
Loading