Skip to content

Commit

Permalink
fix #80 support json array (#85)
Browse files Browse the repository at this point in the history
* fix #80 support json array

* pre-commit format

* monthly update
  • Loading branch information
lucemia authored Mar 11, 2024
1 parent 4f1b42c commit 61fbac9
Show file tree
Hide file tree
Showing 40 changed files with 228 additions and 351 deletions.
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

0 comments on commit 61fbac9

Please sign in to comment.