Package: pyis
pyispyisis a library to check values in your python projects.InstallationDocumentationExamplesDevelopersNext UpdateInstallationWay number 1 :Using pippip3 install pyisWay number 2 :Clone and installgit clone https://github.com/BlackIQ/pyis && cd pyis
pip3 install -e .Documentationpyishas lots of functions that we will name them and say an aexample for each of them.First import it.frompyisimport*versionfor check versionprint(version)is_set()is a function that check variable is set or not.i="Hello"ii=Noneis_set(i)# Returns Trueis_set(ii)# Returns Falseis_empty()is a function that check variable is empty or not.e="Hey"ee=Noneis_empty(e)# Returns Falseis_empty(ee)# Returns Trueis_number()is a function that check variable isintor not.v1=18v2="string"is_number(v1)# Returns Trueis_number(v2)# Returns Falseis_string()is a function that check variable isstror not.v1="Annahita"v2=3.14is_string(v1)# Returns Trueis_string(v2)# Returns Falseis_float()is a function that check variable isfloator not.v1=3.14v2=['hi','hey','hello']is_float(v1)# Returns Trueis_float(v2)# Returns Falseis_list()is a function that check variable islistor not.v1=['github','gitlab']v2=2021is_list(v1)# Returns Trueis_list(v2)# Returns Falseis_bool()is a function that check variable isboolor not.v1=Truev2="false"is_bool(v1)# Returns Trueis_bool(v2)# Returns Falseis_positive()is a function that check variable ispositiveor not.v1=20v2=5-7is_positive(v1)# Returns Trueis_positive(v2)# Returns Falseis_negative()is a function that check variable isnegativeor not.v1=10-30v2=1is_negative(v1)# Returns Trueis_negative(v2)# Returns Falseis_zero()is a function that check variable iszeroor not.v1=0v2=1is_zero(v1)# Returns Trueis_zero(v2)# Returns Falseis_function()is a function that check variable isfunctionor not.defhello(name):print(f"Hello{name}")is_function(hello)# Returns TrueExamplesHere are some examples that you can get the point better.Numbers, check number is float or int. Then check is positive or negative or zeroHere we useis_numberto check if input isintandis_floatto see input isfloat.then we use functions for check value. As you know, we have:is_positivefor check if number is more than 0.is_negativefor check if number is less than 0.is_zerofor check if number is exactly 0.number=input("Give me number")# Check number is int or notifis_number(number):# Number is more than 0 functionifis_positive(number):print("Number is positive")# Number is less than 0 functionelifis_negative(number):print("Number is negative")# Number is equal to 0 functionelifis_zero(number):print("Number is zero")# Check number is float or notelifis_float(number):# Number is more than 0 functionifis_positive(number):print("Number is positive")# Number is less than 0 functionelifis_negative(number):print("Number is negative")# Number is equal to 0 functionelifis_zero(number):print("Number is zero")Set or empty and talking abouttuple,listanddictionaryThink there is alistordictionarythat you want to check values.For check if var is:listwe useis_list.tuplewe useis_tuple.dictwe useis_dict.So we useis_setto check if var is set or not. For check is var is empty we useis_empty.tpl=(1,2,5)l=['Hi',10]dct={'name':None}# Function returns ( True ). Parm is dictionaryifis_dict(dct):# Here is a tuple.ifis_tuple(tpl):print("This is a tuple")# Lets check listifis_list(l):# See is it set or not. Returns ( True )ifis_set(l[1]):print("This item is set")# Here we get ( True ). Parm is not set. It is emptyifis_empty(dct['name']):print("This var is empty")Strings and BooleansTime of say some examples for strings and booleans.When there is something and you want to check is itstringyou can useis_string. We do same forbool,is_boolfor see var isbooleanor not.So we know this two functions now:is_stringfor check strings.is_boolto see var isbooleanlst=['False','amir',True]# Here it will returns ( True ). Why? Item is stringifis_string(lst[0]):print("Item 1 is string")# Now we get ( False ). As you can see, item is stringifis_bool(lst[1]):print("This item is boolean")# Nice ( True ). Item is booleanifis_bool(lst[2]):print("I can see a boolean")Functions checkingSee, think there iscallablevar. How do you check? You can useis_functionto check it.So, how user can check functions?is_functionfor check functiondefyou(name,friend):print(f"Hello{name}and{friend}!")# Get True or False. You is a function, so it returns ( True )ifis_function(you):print("Look, a function!")DevelopersAmirhossein Mohammadi.Pull Requests are welcome to every one.Next UpdateAdd most repeted item in a listAdd class checkerAdd link string checkerAdd IP checkerAdd version valuepyis2021 ©