def _f(object_to_check): log.info('{}, args: {}'.format(f_object, object_to_check)) for segment in object_to_check.split('.'): if int(segment) > 255: raise Exceptions.FailCheckDigitIP('Oops :)') log.info('Function: {}, Status: OK'.format(f_object.__name__)) return f_object(object_to_check)
def _f(object_to_check): log.info('{}, args: {}'.format(f_object, object_to_check)) if not ''.join(object_to_check.split('.')).isdigit(): raise Exceptions.FailCheckDigitIP( '{} should contain numbers and dots'.format(object_to_check)) log.info('Function: {}, Status: OK'.format(f_object.__name__)) return f_object(object_to_check)
def _f(object_to_check): log.info('{}, args: {}'.format(f_object, object_to_check)) for segment in object_to_check.split('.'): if len(segment) > 3: raise Exceptions.FailCheckDigitIP( 'Every segment must consist of from one to three digits') log.info('Function: {}, Status: OK'.format(f_object.__name__)) return f_object(object_to_check)