How to use _get_repr method in Slash

Best Python code snippet using slash

cprint.py

Source:cprint.py Github

copy

Full Screen

...25 print(str, file=sys.stdout)26 del self27 # FIMXE Find a more elegent way to check if unicode28 @classmethod29 def _get_repr(cls, arg):30 if isinstance(arg, str) or repr(arg)[0:2] == 'u"':31 return arg32 return repr(arg)33 @classmethod34 def ok(cls, arg):35 """36 Prints in blue to stdout37 """38 print(cprint.colors['OK'] + cls._get_repr(arg) + cprint.colors['ENDC'],39 file=sys.stdout)40 @classmethod41 def info(cls, arg):42 """43 Prints in green to stdout44 """45 print(cprint.colors['INFO'] + cls._get_repr(arg) + cprint.colors['ENDC'],46 file=sys.stdout)47 @classmethod48 def warn(cls, arg):49 """50 Prints in yellow to strerr51 """52 print(cprint.colors['WARNING'] + cls._get_repr(arg) + cprint.colors['ENDC'],53 file=sys.stderr)54 @classmethod55 def err(cls, arg, interrupt=False):56 """57 Prints in brown to stderr58 interrupt=True: stops the program59 """60 print(cprint.colors['ERR'] + cls._get_repr(arg) + cprint.colors['ENDC'],61 file=sys.stderr)62 if interrupt:63 print(cprint.colors['ERR'] + "Error: Program stopped." +64 cprint.colors['ENDC'],65 file=sys.stderr)66 exit(1)67 @classmethod68 def fatal(cls, arg, interrupt=False):69 """70 Prints in red to stderr71 interrupt=True: stops the program72 """73 print(cprint.colors['FATAL'] + cls._get_repr(arg) + cprint.colors['ENDC'],74 file=sys.stderr)75 if interrupt:76 print(cprint.colors['FATAL'] + "Fatal error: Program stopped." +77 cprint.colors['ENDC'],78 file=sys.stderr)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful