Skip to content

Commit

Permalink
fix: float validation in config
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-Becker committed Oct 15, 2023
1 parent 88e20f4 commit 80d3fe6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"values": ["Blue", "Orange", "Purple", "Red", "Yellow"],
"trait_path": "./trait-layers/backgrounds",
"filename": ["blue", "orange", "purple", "red", "yellow"],
"weights": [20,20,20,20,20]
"weights": [20.0,20.0,20.0,20.0,20.0]
},
{
"name": "Foreground",
Expand Down Expand Up @@ -36,4 +36,4 @@
"baseURI": ".",
"name": "NFT #",
"description": "This is a description for this NFT series."
}
}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pytest-env
pytest-cov
alive-progress
toml
autoflake
6 changes: 3 additions & 3 deletions src/common/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ def validate_config(config: dict) -> bool:
)

for j, weight in enumerate(layer["weights"]):
if not isinstance(weight, int):
if not isinstance(weight, int) and not isinstance(weight, float):
raise ConfigValidationError(
'config["layers"][{}]["{}"][{}]: Invalid layer weight: \'{}\'. Expected type: {}'.format(
i, required_key[0], j, weight, int
'config["layers"][{}]["{}"][{}]: Invalid layer weight: \'{}\'. Expected type: {} or {}'.format(
i, required_key[0], j, weight, int, float
)
)

Expand Down
Binary file modified trait-layers/.DS_Store
Binary file not shown.

0 comments on commit 80d3fe6

Please sign in to comment.