Skip to content

Tag: validation

How should I validate this correctly?

”’ This is a function which asks the user to input two values and then gives the longer word if the user inputs two words or gives the bigger number when the user enters two numbers. It returns can’t compare if the user enters a word and a number, however the problem I am facing is I am unab…

Using dynamic object name in YAML scheme

I want to validate YAML files in Python with my own scheme. A valid YAML shall look like this: While [windows, other] are dynamic, any name shall allowed there (i.e. “solaris”, “mac”, “templeOS”) I’m using validate from jsonschema like described here: Validating a yam…

MultiCheckbox Field Validation with Flask WTForms

I have a WTForm and I am trying to validate a custom multi-checkbox field, When I set the required flag to true, every checkbox needs to be checked. I just need at least one checkbox to be selected. When I don’t set the required flag, the native, and very elusive (is doesn’t appear in js, html, or…

How to close all the processes one by one in a program that operates with multiprocessing by means of an ‘if’ validation found in one of them process?

I need that when the variable text is equal to “Close your program” the 3 active processes(p1,p2,p3) are closed. I have tried to do something like this: But it is not working for me, and I would need a better code that allows me to close them one by one in that code block if text is equal to &#822…

How to reuse a root_validator in Pydantic?

The Pydantic docs have an example of reusing a validator: https://pydantic-docs.helpmanual.io/usage/validators/#reuse-validators Is it possible to reuse a root validator? Answer Yes, it is possible and the API is very similiar Example: It is also possible to parameterize the validator like in this example htt…