Parameters:
     - login
     - tableName
     - importDir
     - failureDir
     - setTime
338777
def importDirectory(self, login, tableName, importDir, failureDir, setTime):
    
    self.send_importDirectory(login, tableName, importDir, failureDir, setTime)
    self.recv_importDirectory()
468466
def setTableProperty(self, login, tableName, property, value):
    
    self.send_setTableProperty(login, tableName, property, value)
    self.recv_setTableProperty()
670107
def dir_import_table(self):
        
        import_header = list(self.optional_data_directories)[1]
        import_offset = self.resolve_rva(import_header.VirtualAddress)

        i = 0
        while True:
            offset = import_offset + i*Import_DirectoryTable.get_size()
            idt = Import_DirectoryTable(self.stream, offset, self)

            if idt.is_empty():
                break
            else:
                yield idt

            i += 1
392362
def setup(
            self):
        

        return self.arguments, self.settings, self.log, self.dbConn
838702
def update_time_reset_passwd(user_name, the_time):
        '''
        
        '''
        entry = TabMember.update(
            time_reset_passwd=the_time,
        ).where(TabMember.user_name == user_name)
        try:
            entry.execute()
            return True
        except:
            return False
1165301
def setup(settings):
    
    connector = settings.get('db_connector')
    if connector == 'postgres':
        from playhouse.pool import PooledPostgresqlExtDatabase
        return PooledPostgresqlExtDatabase(settings['db_name'],
                           user=settings['db_user'],
                           password=settings['db_password'],
                           host=settings['db_host'],
                           port=settings.get('db_port'),
                           max_connections=settings.get('db_max_conn'),
                           stale_timeout=settings.get('db_stale_timeout'),
                           timeout=settings.get('db_timeout'),
                           register_hstore=False)
956259
def init_db(drop_all=False, bind=engine):
    """"""
    try:
        if drop_all:
            Base.metadata.drop_all(bind=bind)
        Base.metadata.create_all(bind=bind)
    except OperationalError as err:
        msg = 'password authentication failed for user "dallinger"'
        if msg in err.message:
            sys.stderr.write(db_user_warning)
        raise

    return session
302464
def runRmdir(self, dir, timeout=None, **kwargs):
        
        cmd_args = {'dir': dir, 'logEnviron': self.logEnviron}
        if timeout:
            cmd_args['timeout'] = timeout
        return self.runRemoteCommand('rmdir', cmd_args, **kwargs)
973200
def mergeTablets(self, login, tableName, startRow, endRow):
    
    self.send_mergeTablets(login, tableName, startRow, endRow)
    self.recv_mergeTablets()
127104
def set_one_time_boot(self, value):
        
        dic = {'value': value}
        data = self._execute_command(
            'SET_ONE_TIME_BOOT', 'SERVER_INFO', 'write', dic)
        return data
175889
def deleteTable(self, login, tableName):
    
    self.send_deleteTable(login, tableName)
    self.recv_deleteTable()
157037
private void setFalseLogin(final DateTime _logintry,
                               final int _count)
        throws EFapsException
    {
        if (_count > 0) {
            final DateTime now = new DateTime(DateTimeUtil.getCurrentTimeFromDB().getTime());
            final SystemConfiguration kernelConfig = EFapsSystemConfiguration.get();

            final int minutes = kernelConfig.getAttributeValueAsInteger(KernelSettings.LOGIN_TIME_RETRY);

            final int maxtries = kernelConfig.getAttributeValueAsInteger(KernelSettings.LOGIN_MAX_TRIES);

            final int count = _count + 1;
            if (minutes > 0 && _logintry.minusMinutes(minutes).isBefore(now)) {
                updateFalseLoginDB(1);
            } else {
                updateFalseLoginDB(count);
            }
            if (maxtries > 0 && count > maxtries && getStatus()) {
                setStatusInDB(false);
            }
        } else {
            updateFalseLoginDB(1);
        }
    }
674358
def _insert_data(self, name, value, timestamp, interval, config, **kwargs):
    ''''''
    kwargs = {
      'name'        : name,
      'interval'    : interval,
      'insert_time' : time.time(),
      'i_time'      : config['i_calc'].to_bucket(timestamp),
      'value'       : value
    }
    if not config['coarse']:
      kwargs['r_time'] = config['r_calc'].to_bucket(timestamp)
    stmt = self._table.insert().values(**kwargs)
    conn = self._client.connect()
    result = conn.execute(stmt)
299317
def init_stats(output_dir, config):
    

    try:
        os.makedirs(output_dir, 0o755)
    except OSError as e:
        print("ERROR: Can not create output directory: %s\n" % e)
        raise

    db_uri = get_db_uri(config, output_dir)

    set_database(db_uri, db, config)

    tables_to_create = [t for t in [Result, Turret] if not t.table_exists()]

    db.get_conn()
    db.create_tables(tables_to_create)
1037732
def get_commands_from_dir(directory, zip_backup=True, remove_dir=True):
    """"""
    # Get SQL commands file paths
    failed_scripts = sorted([os.path.join(directory, fn) for fn in os.listdir(directory) if fn.endswith('.sql')])

    # Read each failed SQL file and append contents to a list
    print('\tReading SQL scripts from files')
    commands = []
    for sql_file in failed_scripts:
        with open(sql_file, 'r') as txt:
            sql_command = txt.read()
        commands.append(sql_command)

    # Remove most recent failures folder after reading
    if zip_backup:
        ZipBackup(directory).backup()
    if remove_dir:
        shutil.rmtree(directory)
    return commands
18885
def connect(cls, dbname):
        
        test_times_schema = """
        CREATE TABLE IF NOT EXISTS test_times (
          file text,
          module text,
          class text,
          func text,
          elapsed float
        )
        """
        
        setup_times_schema = """
        CREATE TABLE IF NOT EXISTS setup_times (
          file text,
          module text,
          class text,
          func text,
          elapsed float
        )
        """
        
        schemas = [test_times_schema,
                   setup_times_schema]
        
        db_file = '{}.db'.format(dbname)
                
        cls.connection = sqlite3.connect(db_file)
        for s in schemas:
            cls.connection.execute(s)
486176
def cli(ctx, directory, uri, verbose, count):
    """"""
    # configure root logger to print to STDERR
    loglevel = "INFO"
    if verbose:
        loglevel = "DEBUG"
    coloredlogs.install(level=loglevel)
    
    p = Path(directory)
    
    if not p.is_dir():
        LOG.warning("{0} is not a valid directory".format(directory))
        ctx.abort()
    
    start_time = datetime.now()
    # Make sure that the database is indexed
    index_call = ['loqusdb', 'index']
    base_call = ['loqusdb']
    if uri:
        base_call.append('--uri')
        base_call.append(uri)
        index_call.append('--uri')
        index_call.append(uri)
    
    subprocess.run(index_call)
    base_call.append('load')
    
    nr_files = 0
    for nr_files,file_name in enumerate(list(p.glob('*.vcf')),1):
        call = deepcopy(base_call)
        case_id = file_name.stem.split('.')[0]
        call.append('--sv-variants')
        call.append(str(file_name))
        call.append('--case-id')
        call.append(case_id)
        if count:
            continue
        try:
            subprocess.run(call, check=True)
        except subprocess.CalledProcessError as err:
            LOG.warning(err)
            LOG.warning("Failed to load file %s", filename)
            LOG.info("Continue with files...")
        
        if nr_files % 100:
            LOG.info("%s files loaded", nr_files)
        
    LOG.info("%s files inserted", nr_files)
    LOG.info("Time to insert files: {}".format(datetime.now()-start_time))