Check cluster.py and checkstats.py if order of the columns is changed,
184454
@Override
    protected void populateColumnSchema(ArrayList<ColumnInfo> columns) {
        super.populateColumnSchema(columns);
        columns.add(new ColumnInfo(VoltSystemProcedure.CNAME_SITE_ID, VoltSystemProcedure.CTYPE_ID));
        columns.add(new ColumnInfo(Columns.PARTITION_ID, VoltType.BIGINT));
        columns.add(new ColumnInfo(Columns.SOURCE_NAME, VoltType.STRING));
        columns.add(new ColumnInfo(Columns.EXPORT_TARGET, VoltType.STRING));
        columns.add(new ColumnInfo(Columns.ACTIVE, VoltType.STRING));
        columns.add(new ColumnInfo(Columns.TUPLE_COUNT, VoltType.BIGINT));
        columns.add(new ColumnInfo(Columns.TUPLE_PENDING, VoltType.BIGINT));
        columns.add(new ColumnInfo(Columns.LAST_QUEUED_TIMESTAMP, VoltType.TIMESTAMP));
        columns.add(new ColumnInfo(Columns.LAST_ACKED_TIMESTAMP, VoltType.TIMESTAMP));
        columns.add(new ColumnInfo(Columns.AVERAGE_LATENCY, VoltType.BIGINT));
        columns.add(new ColumnInfo(Columns.MAX_LATENCY, VoltType.BIGINT));
        columns.add(new ColumnInfo(Columns.QUEUE_GAP, VoltType.BIGINT));
        columns.add(new ColumnInfo(Columns.STATUS, VoltType.STRING));
    }
1115701
def cluster_version(self):
        """"""
        versionstr = self.client.info()['version']['number']
        return [int(x) for x in versionstr.split('.')]
324463
def cluster_reset(self, *, hard=False):
        """"""
        reset = hard and b'HARD' or b'SOFT'
        fut = self.execute(b'CLUSTER', b'RESET', reset)
        return wait_ok(fut)
651098
def _process_change(self, server_description):
        
        td_old = self._description
        if self._publish_server:
            old_server_description = td_old._server_descriptions[
                server_description.address]
            self._events.put((
                self._listeners.publish_server_description_changed,
                (old_server_description, server_description,
                 server_description.address, self._topology_id)))

        self._description = updated_topology_description(
            self._description, server_description)

        self._update_servers()
        self._receive_cluster_time_no_lock(server_description.cluster_time)

        if self._publish_tp:
            self._events.put((
                self._listeners.publish_topology_description_changed,
                (td_old, self._description, self._topology_id)))

        # Wake waiters in select_servers().
        self._condition.notify_all()
844396
def display_replica_imbalance(cluster_topologies):
    
    assert cluster_topologies

    rg_ids = list(next(six.itervalues(cluster_topologies)).rgs.keys())
    assert all(
        set(rg_ids) == set(cluster_topology.rgs.keys())
        for cluster_topology in six.itervalues(cluster_topologies)
    )

    rg_imbalances = [
        stats.get_replication_group_imbalance_stats(
            list(cluster_topology.rgs.values()),
            list(cluster_topology.partitions.values()),
        )
        for cluster_topology in six.itervalues(cluster_topologies)
    ]

    _display_table_title_multicolumn(
        'Extra Replica Count',
        'Replication Group',
        rg_ids,
        list(cluster_topologies.keys()),
        [
            [erc[rg_id] for rg_id in rg_ids]
            for _, erc in rg_imbalances
        ],
    )

    for name, imbalance in zip(
            six.iterkeys(cluster_topologies),
            (imbalance for imbalance, _ in rg_imbalances)
    ):
        print(
            '\n'
            '{name}'
            'Total extra replica count: {imbalance}'
            .format(
                name='' if len(cluster_topologies) == 1 else name + '\n',
                imbalance=imbalance,
            )
        )
250762
def get_index_and_columns_order(cls, columns_in_file_expected, columns_dict, file_path):
        
        use_columns_with_index = []
        column_names_in_db = []

        column_names_from_file = cls.get_column_names_from_file(file_path)
        if not set(columns_in_file_expected).issubset(column_names_from_file):
            log.exception(
                '%s columns are not a subset of columns %s in file %s',
                columns_in_file_expected,
                column_names_from_file,
                file_path
            )
        else:
            for index, column in enumerate(column_names_from_file):
                if column in columns_dict:
                    use_columns_with_index.append(index)
                    column_names_in_db.append(columns_dict[column])
        return use_columns_with_index, column_names_in_db
1113827
def _update_threads(self):
        """"""
        if self.remaining_clusters is not None:
            self.threads = max(1,self.threads_total//self.remaining_clusters.value)
        #otherwise just keep the current (initial) value
        print("{} detected {} threads available to it".format(self.name,self.threads), file = self.log_fh)
329797
def _run_check_cmd(self, low_data):
        '''
        
        '''
        ret = {'result': False}
        cmd_opts = {}
        if 'shell' in self.opts['grains']:
            cmd_opts['shell'] = self.opts['grains'].get('shell')
        for entry in low_data['check_cmd']:
            cmd = self.functions['cmd.retcode'](
                entry, ignore_retcode=True, python_shell=True, **cmd_opts)
            log.debug('Last command return code: %s', cmd)
            if cmd == 0 and ret['result'] is False:
                ret.update({'comment': 'check_cmd determined the state succeeded', 'result': True})
            elif cmd != 0:
                ret.update({'comment': 'check_cmd determined the state failed', 'result': False})
                return ret
        return ret
459367
def checkConsistency(self):
        
        for referenceName, (dataUrl, indexFile) in self._chromFileMap.items():
            varFile = pysam.VariantFile(dataUrl, index_filename=indexFile)
            try:
                for chrom in varFile.index:
                    chrom, _, _ = self.sanitizeVariantFileFetch(chrom)
                    if not isEmptyIter(varFile.fetch(chrom)):
                        self._checkMetadata(varFile)
                        self._checkCallSetIds(varFile)
            finally:
                varFile.close()
1291267
def _check_updates_ready(self):
        """"""
        from spyder.widgets.helperwidgets import MessageCheckBox

        # feedback` = False is used on startup, so only positive feedback is
        # given. `feedback` = True is used when after startup (when using the
        # menu action, and gives feeback if updates are, or are not found.
        feedback = self.give_updates_feedback

        # Get results from worker
        update_available = self.worker_updates.update_available
        latest_release = self.worker_updates.latest_release
        error_msg = self.worker_updates.error

        url_r = __project_url__ + '/releases'
        url_i = 'https://docs.spyder-ide.org/installation.html'

        # Define the custom QMessageBox
        box = MessageCheckBox(icon=QMessageBox.Information,
                              parent=self)
        box.setWindowTitle(_("Spyder updates"))
        box.set_checkbox_text(_("Check for updates on startup"))
        box.setStandardButtons(QMessageBox.Ok)
        box.setDefaultButton(QMessageBox.Ok)

        # Adjust the checkbox depending on the stored configuration
        section, option = 'main', 'check_updates_on_startup'
        check_updates = CONF.get(section, option)
        box.set_checked(check_updates)

        if error_msg is not None:
            msg = error_msg
            box.setText(msg)
            box.set_check_visible(False)
            box.exec_()
            check_updates = box.is_checked()
        else:
            if update_available:
                anaconda_msg = ''
                if 'Anaconda' in sys.version or 'conda-forge' in sys.version:
                    anaconda_msg = _("<hr><b>IMPORTANT NOTE:</b> It seems "
                                     "that you are using Spyder with "
                                     "<b>Anaconda/Miniconda</b>. Please "
                                     "<b>don't</b> use <code>pip</code> to "
                                     "update it as that will probably break "
                                     "your installation.<br><br>"
                                     "Instead, please wait until new conda "
                                     "packages are available and use "
                                     "<code>conda</code> to perform the "
                                     "update.<hr>")
                msg = _("<b>Spyder %s is available!</b> <br><br>Please use "
                        "your package manager to update Spyder or go to our "
                        "<a href=\"%s\">Releases</a> page to download this "
                        "new version. <br><br>If you are not sure how to "
                        "proceed to update Spyder please refer to our "
                        " <a href=\"%s\">Installation</a> instructions."
                        "") % (latest_release, url_r, url_i)
                msg += '<br>' + anaconda_msg
                box.setText(msg)
                box.set_check_visible(True)
                box.exec_()
                check_updates = box.is_checked()
            elif feedback:
                msg = _("Spyder is up to date.")
                box.setText(msg)
                box.set_check_visible(False)
                box.exec_()
                check_updates = box.is_checked()

        # Update checkbox based on user interaction
        CONF.set(section, option, check_updates)

        # Enable check_updates_action after the thread has finished
        self.check_updates_action.setDisabled(False)

        # Provide feeback when clicking menu if check on startup is on
        self.give_updates_feedback = True
869558
def _check_diff(changes):
    '''
    
    '''
    for conf_dict in changes:
        if conf_dict == 'Networks':
            continue
        for item in changes[conf_dict]:
            if changes[conf_dict][item]['new'] is None:
                old = changes[conf_dict][item]['old']
                if old == '':
                    return True
                else:
                    try:
                        if all(x == '' for x in old):
                            return True
                    except TypeError:
                        # Old value is not an iterable type
                        pass
    return False
1062901
def IsDirty(self, proto):
    """"""
    if proto.dirty:
      return True

    for python_format, _, type_descriptor in itervalues(proto.GetRawData()):
      if python_format is not None and type_descriptor.IsDirty(python_format):
        proto.dirty = True
        return True

    return False
1294101
def has_file_changed(directory, checksums, filetype='genbank'):
    """"""
    pattern = NgdConfig.get_fileending(filetype)
    filename, expected_checksum = get_name_and_checksum(checksums, pattern)
    full_filename = os.path.join(directory, filename)
    # if file doesn't exist, it has changed
    if not os.path.isfile(full_filename):
        return True

    actual_checksum = md5sum(full_filename)
    return expected_checksum != actual_checksum
212587
def on_change(self, server_description):
        """"""
        # We do no I/O holding the lock.
        with self._lock:
            # Any monitored server was definitely in the topology description
            # once. Check if it's still in the description or if some state-
            # change removed it. E.g., we got a host list from the primary
            # that didn't include this server.
            if self._description.has_server(server_description.address):
                td_old = self._description
                if self._publish_server:
                    old_server_description = td_old._server_descriptions[
                        server_description.address]
                    self._events.put((
                        self._listeners.publish_server_description_changed,
                        (old_server_description, server_description,
                         server_description.address, self._topology_id)))

                self._description = updated_topology_description(
                    self._description, server_description)

                self._update_servers()

                if self._publish_tp:
                    self._events.put((
                        self._listeners.publish_topology_description_changed,
                        (td_old, self._description, self._topology_id)))

                # Wake waiters in select_servers().
                self._condition.notify_all()
677805
def reload_sync(self):
        ''
        header_lines = options.get('header', self)
        delim = options.get('delimiter', self)

        with self.source.open_text() as fp:
            # get one line anyway to determine number of columns
            lines = list(getlines(fp, int(header_lines) or 1))
            headers = [L.split(delim) for L in lines]

            if header_lines <= 0:
                self.columns = [ColumnItem('', i) for i in range(len(headers[0]))]
            else:
                self.columns = [
                    ColumnItem('\\n'.join(x), i)
                        for i, x in enumerate(zip(*headers[:header_lines]))
                    ]

            lines = lines[header_lines:]  # in case of header_lines == 0
            self._rowtype = namedlist('tsvobj', [c.name for c in self.columns])

            self.recalc()
            self.rows = []

            with Progress(total=self.source.filesize) as prog:
                for L in itertools.chain(lines, getlines(fp)):
                    row = L.split(delim)
                    ncols = self._rowtype.length()  # current number of cols
                    if len(row) > ncols:
                        # add unnamed columns to the type not found in the header
                        newcols = [ColumnItem('', len(row)+i, width=8) for i in range(len(row)-ncols)]
                        self._rowtype = namedlist(self._rowtype.__name__, list(self._rowtype._fields) + ['_' for c in newcols])
                        for c in newcols:
                            self.addColumn(c)
                    elif len(row) < ncols:
                        # extend rows that are missing entries
                        row.extend([None]*(ncols-len(row)))

                    self.addRow(self._rowtype(row))
                    prog.addProgress(len(L))
1135784
def _check_consistency(self):
        ''''''
        type_count = defaultdict(int)
        for _, section in sorted(self.sections.items()):
            type_count[section.section_type] += 1

        if type_count[POINT_TYPE.SOMA] != 1:
            L.info('Have %d somas, expected 1', type_count[POINT_TYPE.SOMA])
1050587
def run_checks(self):
        

        result = True
        differences_dict = {}

        if 'tables' not in self.ignore_list:
            tmp_result, differences_dict['tables'] = self.check_tables()
            result = False if not tmp_result else result
        if 'columns' not in self.ignore_list:
            tmp_result, differences_dict['columns'] = self.check_columns(
                'views' not in self.ignore_list)
            result = False if not tmp_result else result
        if 'constraints' not in self.ignore_list:
            tmp_result, differences_dict['constraints'] = \
                self.check_constraints()
            result = False if not tmp_result else result
        if 'views' not in self.ignore_list:
            tmp_result, differences_dict['views'] = self.check_views()
            result = False if not tmp_result else result
        if 'sequences' not in self.ignore_list:
            tmp_result, differences_dict['sequences'] = self.check_sequences()
            result = False if not tmp_result else result
        if 'indexes' not in self.ignore_list:
            tmp_result, differences_dict['indexes'] = self.check_indexes()
            result = False if not tmp_result else result
        if 'triggers' not in self.ignore_list:
            tmp_result, differences_dict['triggers'] = self.check_triggers()
            result = False if not tmp_result else result
        if 'functions' not in self.ignore_list:
            tmp_result, differences_dict['functions'] = self.check_functions()
            result = False if not tmp_result else result
        if 'rules' not in self.ignore_list:
            tmp_result, differences_dict['rules'] = self.check_rules()
            result = False if not tmp_result else result
        if self.verbose_level == 0:
            differences_dict = None
        return result, differences_dict