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: float validation in config #57

Merged
merged 1 commit into from
Oct 15, 2023
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
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.