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¶
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¶
What you want to do |
What you need to write |
Further details |
---|---|---|
Get item |
getitem_('a')
|
|
Get 2nd item from the given list or tuple |
getitem_(1)
|
|
Get item |
getitem_('a', offset=False)
|
|
Get attribute |
getattr_('__dict__')
|
|
Get value of |
getattr_('a')
|
|
Create a tuple which contains |
struct((add.by(2), keep))
|
|
Create a dict with |
struct({
'plus2': add.by(2),
'origin': keep(),
})
|
|
Create nested structure, like |
struct({
'plus': (
add.by(2),
add.by(4),
),
'origin': keep(),
})
|
Math Calculation¶
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 |
le.than(2)
|
|
Check if the given value is less than |
lt.than(2)
|
|
Check if the given value is greater than or equal to |
ge.than(2)
|
|
Check if the given value is greater than |
gt.than(2)
|
|
Check if the given value is equal to |
eq.to_(2)
|
|
Check if the given value is not equal to |
ne.to_(2)
|
|
Check if |
ge(add.by(2), mul.by(2))
|
|
Check if |
eq(add.by(2), mul.by(2))
|
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 |
interval.lr(x, y)
|
|
Check if the given value falls within the interval |
interval.lR(x, y)
|
|
Check if the given value falls within the interval |
interval.Lr(x, y)
|
|
Check if the given value falls within the interval |
interval.LR(x, y)
|
|
Check if the given value falls within the interval |
interval.L(x)
|
|
Check if the given value falls within the interval |
interval.l(x)
|
|
Check if the given value falls within the interval |
interval.R(y)
|
|
Check if the given value falls within the interval |
interval.r(y)
|
|
Check if the given value falls within the interval |
interval.R(y1).lR(x2, y2)
|
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 |
is_type(int) & ge.than(2)
|
|
Check if the given value is a string or an value which is greater than or equal to |
is_type(str) | ge.than(2)
|
|
Calculate the |
pow_.by(2) >> interval.Lr(10, 100)
|
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 |
regexp('\\d{11}').match.check
|
|
Check if the given text is a 11-digits phone number (similar with |
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)]
|