(hex_str)
Helper for copying hexstr in prefered style
Helper for copying hexstr in prefered style
Helper for copying hexstr in prefered style
def copy_hex_to_clipboard(hex_str):
    """ Helper for copying hexstr in prefered style
    """
    from dwarf_debugger.lib.prefs import Prefs
    _prefs = Prefs()
    uppercase = (_prefs.get('dwarf_ui_hexstyle', 'upper').lower() == 'upper')
    if isinstance(hex_str, str):
        if hex_str.startswith('0x'):
            if uppercase:
                hex_str = hex_str.upper().replace('0X', '0x')
            else:
                hex_str = hex_str.lower()

            pyperclip.copy(hex_str)
    elif isinstance(hex_str, int):
        str_fmt = '0x{0:x}'
        if uppercase:
            str_fmt = '0x{0:X}'

        pyperclip.copy(str_fmt.format(hex_str))
def copy_hex_to_clipboard ( hex_str ) : from dwarf_debugger . lib . prefs import Prefs _prefs = Prefs ( ) uppercase = ( _prefs . get ( 'dwarf_ui_hexstyle' , 'upper' ) . lower ( ) == 'upper' ) if isinstance ( hex_str , str ) : if hex_str . startswith ( '0x' ) : if uppercase : hex_str = hex_str . upper ( ) . replace ( '0X' , '0x' ) else : hex_str = hex_str . lower ( ) pyperclip . copy ( hex_str ) elif isinstance ( hex_str , int ) : str_fmt = '0x{0:x}' if uppercase : str_fmt = '0x{0:X}' pyperclip . copy ( str_fmt . format ( hex_str ) )