How to use ioctl_GWINSZ method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

term.py

Source:term.py Github

copy

Full Screen

...33 return sizex, sizey34 except:35 pass36def _size_linux(file=None):37 def ioctl_GWINSZ(fd):38 try:39 import fcntl40 import termios41 cr = struct.unpack(42 'hh',43 fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))44 return cr45 except:46 pass47 if file:48 cr = ioctl_GWINSZ(file.fileno())49 else:50 cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)51 if not cr:52 try:53 fd = os.open(os.ctermid(), os.O_RDONLY)54 cr = ioctl_GWINSZ(fd)55 os.close(fd)56 except:57 pass58 if not cr:59 try:60 cr = (os.environ['LINES'], os.environ['COLUMNS'])61 except:62 return None63 return int(cr[1]), int(cr[0])64def colorize(s, color):65 if s is None:66 return ""67 if type(s) not in (str, unicode):68 s = str(s)...

Full Screen

Full Screen

terminal.py

Source:terminal.py Github

copy

Full Screen

...23 <http://stackoverflow.com/a/566752>24 """25 import os26 env = os.environ27 def ioctl_GWINSZ(fd):28 try:29 import fcntl, termios, struct, os30 cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,31 '1234'))32 except:33 return34 return cr35 cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)36 if not cr:37 try:38 fd = os.open(os.ctermid(), os.O_RDONLY)39 cr = ioctl_GWINSZ(fd)40 os.close(fd)41 except:42 pass43 if not cr:44 cr = (env.get('LINES', 25), env.get('COLUMNS', 80))45 return int(cr[1]), int(cr[0])46def clear_terminal():47 """ clear_terminal: Clears the terminal's window.48 """49 import sys...

Full Screen

Full Screen

console.py

Source:console.py Github

copy

Full Screen

...11 BOLD = '\033[1m'12 UNDERLINE = '\033[4m'13def getTerminalSize():14 env = os.environ15 def ioctl_GWINSZ(fd):16 try:17 import fcntl, termios, struct, os18 cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,19 '1234'))20 except:21 return22 return cr23 cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)24 if not cr:25 try:26 fd = os.open(os.ctermid(), os.O_RDONLY)27 cr = ioctl_GWINSZ(fd)28 os.close(fd)29 except:30 pass31 if not cr:32 cr = (env.get('LINES', 25), env.get('COLUMNS', 80))...

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 Lemoncheesecake 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