support shortcut [{'title':'title', 'payload':'payload'}]
199467
def convert_shortcut_quick_reply(items):
        
        if items is not None and isinstance(items, list):
            result = []
            for item in items:
                if isinstance(item, QuickReply):
                    result.append(item)
                elif isinstance(item, dict):
                    result.append(QuickReply(title=item.get('title'), payload=item.get('payload')))
                else:
                    raise ValueError('Invalid quick_replies variables')
            return result
        else:
            return items
24383
def title_translations(self, key, value):
    """"""
    return {
        'language': langdetect.detect(value.get('a')),
        'source': value.get('9'),
        'subtitle': value.get('b'),
        'title': value.get('a'),
    }
1039500
def item(title, url = '#', options = {})
      raise 'item third parameter expects a Hash' unless options.kind_of?(Hash)

      prev_item = menu_items.last

      if prev_item.parent == true # This came from root or dropdown
        lft = prev_item.lft + 1 # Go down. from lft
        rgt = prev_item.rgt + 1
      else
        lft = prev_item.rgt + 1 # Go accross, from rgt
        rgt = prev_item.rgt + 2
      end

      menu_items.each do |item|
        item.rgt = (item.rgt + 2) if item.rgt > (lft - 1)
        item.lft = (item.lft + 2) if item.lft > (lft - 1)
      end

      atts = build_menu_item_attributes(title, url, options).merge({:lft => lft, :rgt => rgt})

      menu_items.build(atts)
    end
1047071
def create_shortcuts(self):
        """"""
        # Configurable
        copy_clipboard_file = config_shortcut(self.copy_file_clipboard,
                                              context='explorer',
                                              name='copy file', parent=self)
        paste_clipboard_file = config_shortcut(self.save_file_clipboard,
                                               context='explorer',
                                               name='paste file', parent=self)
        copy_absolute_path = config_shortcut(self.copy_absolute_path,
                                             context='explorer',
                                             name='copy absolute path',
                                             parent=self)
        copy_relative_path = config_shortcut(self.copy_relative_path,
                                             context='explorer',
                                             name='copy relative path',
                                             parent=self)
        return [copy_clipboard_file, paste_clipboard_file, copy_absolute_path,
                copy_relative_path]
952516
def specific_keys
      %w(
        animate
        size
        background
        transparent
        enhanced
        rounded
        butt
        linewidth
        dashlength
        tiny
        small
        medium
        large
        giant
        font
        fontscale
        crop
      )
    end
224067
def title_prefix_json(soup):
    ""
    prefix = title_prefix(soup)
    prefix_rewritten = elifetools.json_rewrite.rewrite_json("title_prefix_json", soup, prefix)
    return prefix_rewritten
265838
def generate_payload(exclude=None, **kwargs):
    
    if exclude is None:
        exclude = []
    return {key: value for key, value in kwargs.items() if
            key not in exclude + DEFAULT_FILTER
            and value is not None
            and not key.startswith('_')}
791012
def skip_item_key(self, item, key):
        
        if "skip" in item:
            item["skip"].append(key)
        else:
            item["skip"] = [key]
        return item
1295558
def OnOk(self, event):
        """"""

        # Get key values from textctrls

        key_strings = [self.row_textctrl.GetValue(),
                       self.col_textctrl.GetValue(),
                       self.tab_textctrl.GetValue()]

        key = []

        for key_string in key_strings:
            try:
                key.append(int(key_string))
            except ValueError:
                key.append(0)

        # Post event

        post_command_event(self.parent, self.GotoCellMsg, key=tuple(key))
260281
def key_values(self):
        
        key_values = {}
        for key in self.keys:
            if key in self.payload:
                key_values[key] = self.payload[key]
        return key_values
1140199
def toDict(self):
        
        return {
            'titleAlignments': [titleAlignment.toDict()
                                for titleAlignment in self],
            'subjectTitle': self.subjectTitle,
            'subjectLength': self.subjectLength,
        }
957269
function() {
    this.jsonInit({
      "id": "event_whenkeypressed",
      "message0": Blockly.Msg.EVENT_WHENKEYPRESSED,
      "args0": [
        {
          "type": "field_dropdown",
          "name": "KEY_OPTION",
          "options": [
            [Blockly.Msg.EVENT_WHENKEYPRESSED_SPACE, 'space'],
            [Blockly.Msg.EVENT_WHENKEYPRESSED_UP, 'up arrow'],
            [Blockly.Msg.EVENT_WHENKEYPRESSED_DOWN, 'down arrow'],
            [Blockly.Msg.EVENT_WHENKEYPRESSED_RIGHT, 'right arrow'],
            [Blockly.Msg.EVENT_WHENKEYPRESSED_LEFT, 'left arrow'],
            [Blockly.Msg.EVENT_WHENKEYPRESSED_ANY, 'any'],
            ['a', 'a'],
            ['b', 'b'],
            ['c', 'c'],
            ['d', 'd'],
            ['e', 'e'],
            ['f', 'f'],
            ['g', 'g'],
            ['h', 'h'],
            ['i', 'i'],
            ['j', 'j'],
            ['k', 'k'],
            ['l', 'l'],
            ['m', 'm'],
            ['n', 'n'],
            ['o', 'o'],
            ['p', 'p'],
            ['q', 'q'],
            ['r', 'r'],
            ['s', 's'],
            ['t', 't'],
            ['u', 'u'],
            ['v', 'v'],
            ['w', 'w'],
            ['x', 'x'],
            ['y', 'y'],
            ['z', 'z'],
            ['0', '0'],
            ['1', '1'],
            ['2', '2'],
            ['3', '3'],
            ['4', '4'],
            ['5', '5'],
            ['6', '6'],
            ['7', '7'],
            ['8', '8'],
            ['9', '9']
          ]
        }
      ],
      "category": Blockly.Categories.event,
      "extensions": ["colours_event", "shape_hat"]
    });
  }
33562
def name(self, key, value):
    
    def _get_title(value):
        c_value = force_single_element(value.get('c', ''))
        if c_value != 'title (e.g. Sir)':
            return c_value

    def _get_value(value):
        a_value = force_single_element(value.get('a', ''))
        q_value = force_single_element(value.get('q', ''))
        return a_value or normalize_name(q_value)

    if value.get('d'):
        dates = value['d']
        try:
            self['death_date'] = normalize_date(dates)
        except ValueError:
            dates = dates.split(' - ')
            if len(dates) == 1:
                dates = dates[0].split('-')
            self['birth_date'] = normalize_date(dates[0])
            self['death_date'] = normalize_date(dates[1])

    self['status'] = force_single_element(value.get('g', '')).lower()

    return {
        'numeration': force_single_element(value.get('b', '')),
        'preferred_name': force_single_element(value.get('q', '')),
        'title': _get_title(value),
        'value': _get_value(value),
    }
437886
function commandListTitle(command, context) {
  const url  = (context === 'README') ? `/docs/commands/${command}.md` : `/commands/${command}`
  // const url  = (context === 'README') ? `/docs/${command}.md` : `/${command}`
  return `### [${command}](${url})${newLine}`
}
240797
def _get_qkeysequence(shortcut):
    """"""
    if shortcut is None:
        return []
    if isinstance(shortcut, (tuple, list)):
        return [_get_qkeysequence(s) for s in shortcut]
    assert isinstance(shortcut, string_types)
    if hasattr(QKeySequence, shortcut):
        return QKeySequence(getattr(QKeySequence, shortcut))
    sequence = QKeySequence.fromString(shortcut)
    assert not sequence.isEmpty()
    return sequence
32811
def abbrev_hook(self, data: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
        """"""
        func = self.cmd_func(data.statement.command)
        if func is None:
            # check if the entered command might be an abbreviation
            possible_cmds = [cmd for cmd in self.get_all_commands() if cmd.startswith(data.statement.command)]
            if len(possible_cmds) == 1:
                raw = data.statement.raw.replace(data.statement.command, possible_cmds[0], 1)
                data.statement = self.statement_parser.parse(raw)
        return data
1341647
def show_shortcuts
      say "\nShortcuts:"
      max = settings.shortcuts.keys.max_by(&:length).length
      settings.shortcuts.each_pair do |shortcut, command|
        say "  #{shortcut.rjust max} : #{command}"
      end
    end