Pyjeb

Latest version: v1.0.4

Safety actively analyzes 681775 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.0.4

new features
alow single value in list
It's now possible to provide a single value in list
Exemple :
python
controls = [
{ "name": "vehicles", "type": "dict" },
{ "name": "vehicles.cars", "type": "list" },
{ "name": "vehicles.cars.color", "validset": ["red", "blue", r"^(?:[0-9a-fA-F]{3}){1,2}$"] },
{ "name": "vehicles.cars.is_broken", "type": "boolean", "default": False },
{ "name": "vehicles.cars.buy_date" },
{ "name": "vehicles.cars.type", "default": "usual", "expressions": ["if color == 'red' return 'sportive'"] }
]

before the only way to provide a single value was to use a dict
data = {
"vehicles": {
"cars": [
{
"color": "red",
"is_broken": False,
"buy_date": "2021-01-01"
}
]
}
}

now it's possible to provide a single value in list
data = {
"vehicles": {
"cars": {
"color": "red",
"is_broken": False,
"buy_date": "2021-01-01"
}
}
}


control_and_setup(controls, data)
print (data)


Output:
if a single value is provided then the value is converted to a list
json
{
"vehicles": {
"cars": [
{
"color": "red",
"is_broken": false,
"buy_date": "2021-01-01",
"type": "sportive"
}
]
}
}

1.0.3

new features
regex on validset
It's now possible to setup a validset with value and regex.
Exemple :
python
controls = [
{ "name": "vehicles", "type": "dict" },
{ "name": "vehicles.cars", "type": "list" },
The validset allow value "red", "bleue" and hexadecimal color (like FFBB19)
{ "name": "vehicles.cars.color", "validset": ["red", "blue", r"^(?:[0-9a-fA-F]{3}){1,2}$"] },
{ "name": "vehicles.cars.is_broken", "type": "boolean", "default": False },
{ "name": "vehicles.cars.buy_date" },
{ "name": "vehicles.cars.type", "default": "usual", "expressions": ["if color == 'red' return 'sportive'"] }
]

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.