Skip to main content

Quick schema validator.

Project description


pip3 install shucks

Simple Usage

Validating a login form accepting email or phone and a password.

import shucks
import math

schema = shucks.And(
    'id': shucks.If(
      shucks.And(str, lambda v: '@' in v),
        lambda v: v.split('@', 1)[1],
        shucks.contain({'', '', ''})
        shucks.Or(str, int),
        shucks.Con(str, shucks.Con(len, shucks.range(10, 10)))
    'password': shucks.And(
      shucks.Con(len, shucks.And(shucks.range(8, math.inf))),
      shucks.wrap(shucks.Not(lambda v: 'logo' in v), 'logo')
    shucks.Opt('remember'): bool

data = {
  'id': 1234567890
  'password': 'logo1234'

shucks.check(schema, data)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shucks-1.2.1.tar.gz (5.8 kB view hashes)

Uploaded source

Built Distribution

shucks-1.2.1-py3-none-any.whl (8.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page