Best Python code snippet using avocado_python
arch.py
Source:arch.py  
...24#25from __future__ import unicode_literals26from pkg._arch import lib, ffi27NULL = ffi.NULL28def _get_sysinfo(sicmd):29    ret = 030    bufsz = 3231    buf = lib.malloc(bufsz)32    buf = ffi.gc(buf, lib.free)33    if buf == NULL:34        return NULL35    while True:36        ret = lib.sysinfo(sicmd, buf, bufsz)37        if ret < 0:38            return NULL39        if ret > bufsz:40            bufsz = ret41            tmp = lib.realloc(buf, bufsz)42            tmp = ffi.gc(tmp, lib.free)43            if tmp == NULL:44                return NULL45            buf = tmp46        else:47            break48        if buf == NULL:49            break50    return buf51def get_isainfo():52    """Return a list of strings constituting the architecture tags for the53    invoking system."""54    buf = NULL55    buf1 = _get_sysinfo(lib.SI_ARCHITECTURE_64)56    buf2 = _get_sysinfo(lib.SI_ARCHITECTURE_32)57    if buf1 == NULL and buf2 == NULL:58        return59    if buf1 == NULL and buf2:60        buf = buf261    if buf2 == NULL and buf1:62        buf = buf163    from pkg.misc import force_text64    # ffi.string returns a bytes65    if buf == NULL:66        buf1 = force_text(ffi.string(ffi.cast("char *", buf1)))67        buf2 = force_text(ffi.string(ffi.cast("char *", buf2)))68        robj = [buf1, buf2]69    else:70        buf = force_text(ffi.string(ffi.cast("char *", buf)))71        robj = [buf]72    return robj73def get_release():74    """Return the release string ("5.11") for the invoking system."""75    buf = _get_sysinfo(lib.SI_RELEASE)76    if buf == NULL:77        return78    from pkg.misc import force_text79    return force_text(ffi.string(ffi.cast("char *", buf)))80def get_platform():81    """Return the platform tag ("i86pc") for the invoking system."""82    buf = _get_sysinfo(lib.SI_PLATFORM)83    if buf == NULL:84        return85    from pkg.misc import force_text86    return force_text(ffi.string(ffi.cast("char *", buf)))87# Vim hints...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
