# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
# class Cookie:
# class Xcb:
#     def __init__(self, error):
#     def __str__(self):
#     def __init__(self, name, value):
#     def __getattr__(self, name):
#     def reply(self):
#     def check(self):
#     def __init__(self):
#     def __getattr__(self, name):
#         def request(func, *args, **kwargs):
#     def connect(self, display=None):
#     def mask(self, masks):
# 
# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
#     def __init__(self, error):
#         self.error = error
# 
#     def __str__(self):
#         label = xcb.event_get_error_label(self.error.response_type)
#         return "{}, type {}, code {}, major {}, minor {}".format(
#             xcb.ffi.string(label).decode("UTF-8"),
#             self.error.response_type, self.error.error_code,
#             self.error.major_code, self.error.minor_code)
# 
# Path: pwm/keysyms.py



from collections import defaultdict
from pwm.ffi.xcb import xcb
from pwm.ffi.xcb import XcbError
from pwm.keysyms import keysyms, keysym_strings
import re
    modifiers = 0
    keycode = None

    for part in key_string.split('-'):
        try:
            xcb_part = part.upper()
            xcb_part = re.sub(r"(.)([0-9])", r"\1_\2", xcb_part)
            modifiers |= getattr(xcb, "KEY_BUT_MASK_%s" % xcb_part)
            continue
        except:
            pass

        if len(part) == 1:
            part = part.lower()
        keycode = lookup_string(part)

    return modifiers, keycode


def lookup_string(kstr):
    """
    Finds the keycode associated with a string representation of a keysym.

    :param kstr: English representation of a keysym.
    :return: Keycode, if one exists.
    :rtype: int
    """
    if kstr in keysyms:
        return get_keycode(keysyms[kstr])
    elif len(kstr) > 1 and kstr.capitalize() in keysyms:

# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
# class Cookie:
# class Xcb:
#     def __init__(self, error):
#     def __str__(self):
#     def __init__(self, name, value):
#     def __getattr__(self, name):
#     def reply(self):
#     def check(self):
#     def __init__(self):
#     def __getattr__(self, name):
#         def request(func, *args, **kwargs):
#     def connect(self, display=None):
#     def mask(self, masks):
# 
# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
#     def __init__(self, error):
#         self.error = error
# 
#     def __str__(self):
#         label = xcb.event_get_error_label(self.error.response_type)
#         return "{}, type {}, code {}, major {}, minor {}".format(
#             xcb.ffi.string(label).decode("UTF-8"),
#             self.error.response_type, self.error.error_code,
#             self.error.major_code, self.error.minor_code)
# 
# Path: pwm/keysyms.py



# Path: pwm/keybind.py
from collections import defaultdict
from pwm.ffi.xcb import xcb
from pwm.ffi.xcb import XcbError
from pwm.keysyms import keysyms, keysym_strings
import re

    modifiers = 0
    keycode = None

    for part in key_string.split('-'):
        try:
            xcb_part = part.upper()
            xcb_part = re.sub(r"(.)([0-9])", r"\1_\2", xcb_part)
            modifiers |= getattr(xcb, "KEY_BUT_MASK_%s" % xcb_part)
            continue
        except:
            pass

        if len(part) == 1:
            part = part.lower()
        keycode = lookup_string(part)

    return modifiers, keycode


def lookup_string(kstr):
    """
    Finds the keycode associated with a string representation of a keysym.

    :param kstr: English representation of a keysym.
    :return: Keycode, if one exists.
    :rtype: int
    """
    if kstr in keysyms:
        return get_keycode(keysyms[kstr])
    elif len(kstr) > 1 and kstr.capitalize() in keysyms:

        return get_keycode(keysyms[kstr.capitalize()])