From 80d3fe6d6120e238e6381d48649d449c75212203 Mon Sep 17 00:00:00 2001 From: Jon-Becker Date: Sun, 15 Oct 2023 14:51:43 -0400 Subject: [PATCH] fix: float validation in config --- .DS_Store | Bin 6148 -> 10244 bytes config.json | 4 ++-- requirements.txt | 1 + src/common/validate.py | 6 +++--- trait-layers/.DS_Store | Bin 6148 -> 6148 bytes 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.DS_Store b/.DS_Store index 2ea8e723296faa609edc2d2c08c3f354800bb9e0..5e1d48e76e7a27023c8a17ba4050bdedc2c1f79b 100644 GIT binary patch literal 10244 zcmeHML2MgE6#Y}X&BjhztE#9F1zAX;9NJ)42snV`Bn~v9g@O?rptxS!vKQ=KV>>Y+ z4f3rAE|q#{rAl1kR>U1H2q7d6AP$wPazWfdh#LoZe`d3uvArSm&{pb zw>*xfukEVuG_|pRxy&IB?%<;e_3`Nft4r%>)u}gz`3CHD%rlX16CSRPoM@h{$1HUG ze|>hoyrA$;SdFrXx6*SV%5g5K2#*KOeF~6G-ONEeI+nv>_;}QzP1w6srYbd&d6nKr zUjU5{CdPOWpWMk9COdQ*W9%um&e`qXZ!CF#e#7^CkG>-&|F5sfuiW|P!4)$l=LTwK ztD+b)vrAn9!dKQZ#h=vb@sf`h zFepZC@#@#(5k2<9NTbISU;a9ZC;jw%C$)M!q9Mndp)<5bE3`_lP>EKjtkh4n9r6Iy zBkxNct__Swf96$f=yjy0ZbeAPY)1UV*%+uF`GQfWfdKmoZGfvf4dj~esbQigtWj}L zLqAKeBhMu&(pktwYEx~@1N)`nk&#h8K(?N2wdHKUZUpZ>eK`I^;hoL!Pr$NERf8$| zo1aOcM(5~O;`yhe*(3e*yE&;fco9D`FZ-i?p=ZYY{3lbZ$E~ltyYm##{Poz=EsXf| z2gjd7{4Vw*JZtGBW^x5PRUJK3c5j2HSU-2r>x56+@7zwy>-BTFn_^!gx&Oe7VtCT$V%Y%E1qBPN@uTDhsir{ zd44SzEC=g;ttZDRDTU+AILt9%Xb0@OT<+e{`x1P!8(L9yg-kx=iF63WWyU^bJ zXzSwk$5)vLOaq}L9SY@+xQ0e-y2edQe0_a4Tm2SZy7Fr6J@rtE9b3Pld$BieZ!*L9 zW5?bob^TW0H(;}qH{07{8L$jk1}p=XfqTF}LdDGT`~TJW|Nrj+G8@t|U>Ueu42Wd0 zR9r^1xZkGyu04zE0xm9WH&jx(ppviSA?53MeBsyePvTcq3gUkYA35Ifpe1;;1Y=&Zn0)|9}WQJ4* zJs_FSkOE}sV#<2vTP-Y>wxd!wdjC^)PY( diff --git a/config.json b/config.json index d2db83b..4a26339 100644 --- a/config.json +++ b/config.json @@ -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", @@ -36,4 +36,4 @@ "baseURI": ".", "name": "NFT #", "description": "This is a description for this NFT series." -} \ No newline at end of file +} diff --git a/requirements.txt b/requirements.txt index 0760fc2..97a82e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ pytest-env pytest-cov alive-progress toml +autoflake diff --git a/src/common/validate.py b/src/common/validate.py index 91dae8f..8c758a8 100644 --- a/src/common/validate.py +++ b/src/common/validate.py @@ -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 ) ) diff --git a/trait-layers/.DS_Store b/trait-layers/.DS_Store index 02d26bca8021972543e6ea984973c7caa6a2b619..127f040400b3d7c0431e433f164f53e934694f03 100644 GIT binary patch delta 357 zcmZoMXfc@J&&acT+a%