keycodes.py
def build_remap_command(*, remappings=None, swaps=None):
    """Build a command that will perform a remapping using macos' `hidutil`.
    
    Parameters
    ----------
    remappings : dict(int: int)
        Multiple rules that remap one physical key into another.
        These mappings are one way. Each key item of the dictionary will
        be mapped to its corresponding value, but the value key will
        not be remapped.
    
    swaps : list((int, int))
        A sequence of rules in the form of 2-tuples.
    
    Returns
    -------
    A string that can be copied and pasted into the terminal to execute
    the remapping.
    """
    remappings = remappings or dict()
    assert type(remappings) is dict
    remappings = set(remappings.items())
    
    swaps = swaps or []
    swaps = set(s for s in swaps) | set(tuple(reversed(s)) for s in swaps)
    
    rules = sorted(remappings | swaps)
    rules = list((k | 0x700000000, v | 0x700000000) for k, v in rules)
    
    cmd = command_phrase.format(', '.join(list(map(build_rule_string, rules))))
    return cmd
Build a command that will perform a remapping using macos' `hidutil`.
    
    Parameters
    ----------
    remappings : dict(int: int)
        Multiple rules that remap one physical key into another.
        These mappings are one way. Each key item of the dictionary will
        be mapped to its corresponding value, but the value key will
        not be remapped.
    
    swaps : list((int, int))
        A sequence of rules in the form of 2-tuples.
    
    Returns
    -------
    A string that can be copied and pasted into the terminal to execute
    the remapping.
    
Build a command that will perform a remapping using macos' `hidutil`.
Parameters

remappings : dict(int: int)
Multiple rules that remap one physical key into another.
These mappings are one way. Each key item of the dictionary will
be mapped to its corresponding value, but the value key will
not be remapped.

swaps : list((int, int))
A sequence of rules in the form of 2-tuples.

Returns

A string that can be copied and pasted into the terminal to execute
the remapping.
Build a command that will perform a remapping using macos ' ` hidutil ` . Parameters remappings : dict ( int : int ) Multiple rules that remap one physical key into another . These mappings are one way . Each key item of the dictionary will be mapped to its corresponding value but the value key will not be remapped . swaps : list (( int int )) A sequence of rules in the form of 2 - tuples . Returns A string that can be copied and pasted into the terminal to execute the remapping .
def build_remap_command(*, remappings=None, swaps=None):
    remappings = remappings or dict()
    assert type(remappings) is dict
    remappings = set(remappings.items())
    swaps = swaps or []
    swaps = set(s for s in swaps) | set(tuple(reversed(s)) for s in swaps)
    rules = sorted(remappings | swaps)
    rules = list((k | 0x700000000, v | 0x700000000) for k, v in rules)
    cmd = command_phrase.format(', '.join(list(map(build_rule_string, rules))))
    return cmd
def build_remap_command ( * , remappings = None , swaps = None ) : remappings = remappings or dict ( ) assert type ( remappings ) is dict remappings = set ( remappings . items ( ) ) swaps = swaps or [ ] swaps = set ( s for s in swaps ) | set ( tuple ( reversed ( s ) ) for s in swaps ) rules = sorted ( remappings | swaps ) rules = list ( ( k | 0x700000000 , v | 0x700000000 ) for k , v in rules ) cmd = command_phrase . format ( ', ' . join ( list ( map ( build_rule_string , rules ) ) ) ) return cmd
Build a command that will perform a remapping using macos' `hidutil`.
Build a command that will perform a remapping using macos ' ` hidutil ` .
"""Build a command that will perform a remapping using macos' `hidutil`.
    
    Parameters
    ----------
    remappings : dict(int: int)
        Multiple rules that remap one physical key into another.
        These mappings are one way. Each key item of the dictionary will
        be mapped to its corresponding value, but the value key will
        not be remapped.
    
    swaps : list((int, int))
        A sequence of rules in the form of 2-tuples.
    
    Returns
    -------
    A string that can be copied and pasted into the terminal to execute
    the remapping.
    """
remappings
swaps