Add files to the ATVS Keystroke database.
162790
def add_files(session, imagedir, verbose):
  """"""

  def add_file(session, basename, userid, shotid, sessionid):
    """Parse a single filename and add it to the list."""
    session.add(File(userid, basename, sessionid, shotid))

  filenames = os.listdir(imagedir)
  for filename in filenames:
    basename, extension = os.path.splitext(filename)
    if extension == db_file_extension:
      if verbose>1: print("  Adding file '%s'..." % (basename))
      parts = string.split(basename, "_")
      ctype = parts[0]
      shotid = int(parts[2])
      userid = ctype + '_%d' % int(parts[1])
      if parts[0] == "Impostor":
        sessionid = 3
      elif parts[0] == "Genuine" and shotid <= 6:
        sessionid = 1
      elif parts[0] == "Genuine" and shotid > 6:
        sessionid = 2
        shotid = shotid - 6
      add_file(session, basename, userid, shotid, sessionid)
617003
def add(self, **kwargs):
        """"""
        if "path" in kwargs:
            path = kwargs["path"]
            if isinstance(path, bytes):
                path = String(path)
            if not path[0].startswith("/"):
                paths = self.normalize_paths(self.path, path)
            else:
                paths = self.normalize_paths(path)
            kwargs["path"] = "/".join(paths)
        return self.create(self, **kwargs)
463639
def massage_keys(keys):
    """"""
    m_keys = []
    for key in keys:
        if key.startswith('keybase:'):
            m_keys.append(cryptorito.key_from_keybase(key[8:])['fingerprint'])
        else:
            m_keys.append(key)

    return m_keys
776194
def add_key(pub):
    """"""
    global _server_keys
    key = rsa.PublicKey.load_pkcs1(pub)
    _server_keys[_compute_fingerprint(key)] = key
1076418
def addFile(self, path, msg=""):
        """"""
        item = Item.from_path(repo=self.repo, path=path)
        self.addItem(item)
400229
def key_add(self):
        """"""
        from .main import add_api_key
        add_api_key(self.key_name.get(), self.key_val.get())

        # Clear the text fields
        self.key_name.set("")
        self.key_val.set("")
861374
def install_key_data(self, keydata, target):
        """"""

        target.seek(0)
        contents = target.read()
        ssh_opts = 'no-port-forwarding'
        if keydata in contents:
            raise InstallError('key data already in file - refusing '
                               'to double-install.\n')
        command = '%s --run' % self.authprogs_binary
        if self.logfile:
            command += ' --logfile=%s' % self.logfile
        if self.keyname:
            command += ' --keyname=%s' % self.keyname

        target.write('command="%(command)s",%(ssh_opts)s %(keydata)s\n' %
                     {'command': command,
                      'keydata': keydata,
                      'ssh_opts': ssh_opts})
305349
public void setupKeys()
    {
        KeyAreaInfo keyArea = null;
        keyArea = new KeyAreaInfo(this, Constants.UNIQUE, ID_KEY);
        keyArea.addKeyField(ID, Constants.ASCENDING);
        keyArea = new KeyAreaInfo(this, Constants.UNIQUE, KEY_FILENAME_KEY);
        keyArea.addKeyField(KEY_FILENAME, Constants.ASCENDING);
        keyArea.addKeyField(KEY_NUMBER, Constants.ASCENDING);
    }
543459
def add(self, obj=None, filename=None, data=None, info={}, html=None):
        ""
        initial_last_key = list(self._files.keys())[-1] if len(self) else None
        if self._auto:
            exporters = self.exporters[:]
            # Can only associate html for one exporter at a time
            for exporter in exporters:
                self.exporters = [exporter]
                super(NotebookArchive, self).add(obj, filename, data,
                                                 info=dict(info,
                                                           notebook=self.notebook_name))
                # Only add substitution if file successfully added to archive.
                new_last_key = list(self._files.keys())[-1] if len(self) else None
                if new_last_key != initial_last_key:
                    self._replacements[new_last_key] = html

            # Restore the full list of exporters
            self.exporters = exporters
404890
def _addDPFilesToOldEntry(self, *files):
        """"""
        # quiet flag is always true
        self.view_entry_dialog.addDataProducts(self.purrer.makeDataProducts(
            [(file, True) for file in files], unbanish=True, unignore=True))
931417
def add(self, dic):
        '''
        '''
        for kw in dic:
            checkKey(kw, self.keyWord)
            self._add([Pair(kw, StringSingle(dic[kw]))], self.d)
96227
def augment_main_keys(self, keys, file):
        
        nfile = file
        ansigenome_block = """
ansigenome_info:
  galaxy_id: ''

  travis: False

  synopsis: |
    Describe your role in a few paragraphs....

  usage: |
    Describe how to use in more detail...

  #custom: |
  #  Any custom output you want after the usage section..
"""

        for key in keys:
            if key[0] not in nfile:
                if key[0] == "ansigenome_info":
                    # make sure ansigenome_info is always on the bottom
                    nfile = nfile + "\n{0}".format(ansigenome_block)
                else:
                    nfile = "\n{0}: {1}\n\n".format(key[0], key[1]) + nfile

        return nfile
1302273
def _fill_entries(self):
        """"""
        for file in self.index.files:
            path = self.index.paths[file.pathIndex]
            data_offset = file.dataOffset
            data_size = file.dataSize
            obj = RAFEntry(self._data_handle, path, data_offset, data_size)
            # Add to full path dictionary
            assert path not in self.entries_full
            self.entries_full[path.lower()] = obj
            # Add to name dictionary
            name = os.path.basename(path).lower()
            if name not in self.entries_name:
                self.entries_name[name] = []
            self.entries_name[name].append(obj)
1248266
def sync(self):
        """"""
        self.elk.send(ka_encode())
        self.get_descriptions(TextDescriptions.KEYPAD.value)
571560
def generate_key(filepath):
    ''' 
    '''
    fs = path.abspath(path.expanduser(filepath))
    with open(fs, 'wb') as outfile:
        outfile.write(Fernet.generate_key())
    chmod(fs, 0o400)
    return fs
150596
def input(self, str, filename=''):
        
        self.filestack.append([filename, 1, self.lex, self.input_data])

        self.input_data = str
        self.lex = lex.lex(object=self)
        self.lex.input(self.input_data)
1003592
def add_files(self, files):
        
        for file in files:
            file.copy(project=self.id)