Cheat Sheet of Units

A cheat sheet will be provided in this part to make using the argsloader easier when you are unsure which unit to use.

Types

Unit Usage About Types

What you want to do

What you need to write

Further details

Check if the given object is a string

is_type(str)

Check if the given object is a list or tuple

is_type((list, tuple))

Transform a given object to string

to_type(str)

Transform a sequence-liked object to list

to_type(list)

Check if the given class is a subclass of dict

is_subclass(dict)

Data Structure

Unit Usage About Data Structures

What you want to do

What you need to write

Further details

Get item a from the given dict object

getitem_('a')

Get 2nd item from the given list or tuple

getitem_(1)

Get item a from the given dict object, which is not the original data and position offset should be disabled

getitem_('a', offset=False)

Get attribute __dict__ from the given object

getattr_('__dict__')

Get value of a from EasyDict, based on getter of attribute

getattr_('a')

Create a tuple which contains x + 2 and x (assume the given value is x)

struct((add.by(2), keep))

Create a dict with x + 2 and x (assume the given value is x)

struct({
    'plus2': add.by(2),
    'origin': keep(),
})

Create nested structure, like {'plus': (X, X), 'origin': X}

struct({
    'plus': (
        add.by(2),
        add.by(4),
    ),
    'origin': keep(),
})

Math Calculation

Math Validation

Unit Usage About Math Validation

What you want to do

What you need to write

Further details

Check if the given value is less than or equal to 2

le.than(2)

Check if the given value is less than 2

lt.than(2)

Check if the given value is greater than or equal to 2

ge.than(2)

Check if the given value is greater than 2

gt.than(2)

Check if the given value is equal to 2

eq.to_(2)

Check if the given value is not equal to 2

ne.to_(2)

Check if x + 2 is greater than or equal to x ** 2 (assume the given value is x)

ge(add.by(2), mul.by(2))

Check if x + 2 is equal to x * 2 (assume the given value is x)

eq(add.by(2), mul.by(2))

Numeric Validation

Unit Usage About Numeric Validation

What you want to do

What you need to write

Further details

Check if the given value is a number (float, int or number-liked str), and then transform it to a number

number()

Check if the given value falls within the interval (x, y)

interval.lr(x, y)

Check if the given value falls within the interval (x, y]

interval.lR(x, y)

Check if the given value falls within the interval [x, y)

interval.Lr(x, y)

Check if the given value falls within the interval [x, y]

interval.LR(x, y)

Check if the given value falls within the interval [x, +inf]

interval.L(x)

Check if the given value falls within the interval (x, +inf]

interval.l(x)

Check if the given value falls within the interval [-inf, y]

interval.R(y)

Check if the given value falls within the interval [-inf, y)

interval.r(y)

Check if the given value falls within the interval [-inf, y1] | (x2, y2]

interval.R(y1).lR(x2, y2)

Compound Condition

Unit Usage About Compound Condition

What you want to do

What you need to write

Further details

Check if the given value is an integer which is greater than or equal to 2

is_type(int) & ge.than(2)

Check if the given value is a string or an value which is greater than or equal to 2

is_type(str) | ge.than(2)

Calculate the 2 ** x, and then check if it falls within interval [10, 100)

pow_.by(2) >> interval.Lr(10, 100)

String or Text

Unit Usage About String or Text

What you want to do

What you need to write

Further details

Get the prefixed 11-digits phone number if it is

regexp('\\d{11}').match

Get this 11-digits phone number if it is

regexp('\\d{11}').match.full

Check if the prefix of the given text is a 11-digits phone number (similar with re.match)

regexp('\\d{11}').match.check

Check if the given text is a 11-digits phone number (similar with re.fullmatch)

regexp('\\d{11}').match.full.check

Get the NIN(from 1st to 3rd letter) of the 11-digits phone number

regexp('(\\d{3})(\\d{4})(\\d{4})').match[0]

Get the NIN(1st - 3rd), HLR(4th - 7th) and personal number (8th - 11th) of the 11-digits phone number with a triple tuple

regexp('(\\d{3})(\\d{4})(\\d{4})').match[(1, 2, 3)]