Runs iSort (https://pypi.python.org/pypi/isort)

    Args:
        amend: whether or not to commit results
        stage: whether or not to stage changes
192800
def sort(amend: bool = False, stage: bool = False):
    
    _sort(amend, stage)
1294847
def run(self):
        """"""
        last_status = ''
        # lambda is used to avoid http://bugs.python.org/issue30473 in py36
        start_times = defaultdict(lambda: datetime.datetime.now())
        max_stage_id = -1

        status = self.sc.statusTracker()
        while True:
            with self.condition:
                if self.sc._jsc is None or not self.alive:
                    # End the thread
                    self.paused = True
                    break
                elif self.paused:
                    # Pause the thread
                    self.condition.wait()
            stage_ids = status.getActiveStageIds()
            progressbar_list = []
            # Only show first 3
            stage_counter = 0
            current_max_stage = max_stage_id
            for stage_id in stage_ids:
                stage_info = status.getStageInfo(stage_id)
                if stage_info and stage_info.numTasks > 0:
                    # Set state variables used for flushing later
                    current_max_stage = stage_id
                    stage_counter += 1
                    td = datetime.datetime.now() - start_times[stage_id]
                    s = _format_stage_info(self.bar_width, stage_info, td, self.timedelta_formatter)
                    progressbar_list.append(s)
                if stage_counter == 3:
                    break

            # Ensure that when we get a new maximum stage id we print a \n
            # to make the progress bar go on to the next line.
            if current_max_stage > max_stage_id:
                if last_status != '':
                    sys.stderr.write("\n")
                sys.stderr.flush()
                max_stage_id = current_max_stage

            new_status = ' '.join(progressbar_list)
            if new_status != last_status:
                sys.stderr.write("\r" + new_status)
                sys.stderr.flush()
                last_status = new_status
            time.sleep(self.sleep_time)
125436
def do_commit_amends(self):
        
        commit_cumalative_count = 0
        for days in MARKED_DAYS:
            amend_date = (
                self.end_date - datetime.timedelta(days)).strftime("%Y-%m-%d %H:%M:%S")
            for commit_number_in_a_day in xrange(0, self.max_commits):
                commit_cumalative_count += 1
                subprocess.check_call(
                    ['git', 'commit', '--amend', "--date='<" + amend_date + " + 0530 >' ", '-C',
                     'HEAD~{commit_number}'.format(commit_number=commit_cumalative_count)], cwd=self.repository_name)
                subprocess.check_call(
                    ['git', 'pull', '--no-edit'], cwd=self.repository_name)
                subprocess.check_call(
                    ['git', 'push', 'origin', 'master'], cwd=self.repository_name)
374769
def run(self, *args):
        
        if self.prefix_char is None:
            prefix_char = config.suite_alias_prefix_char
        else:
            prefix_char = self.prefix_char

        if prefix_char == '':
            # empty prefix char means we don't support the '+' args
            return self._run_no_args(args)
        else:
            return self._run(prefix_char, args)
412101
def _write_reqs(amend: bool = False, stage: bool = False):
    
    LOGGER.info('writing requirements')

    base_cmd = 'pipenv lock -r'
    _write_reqs_file(f'{base_cmd}', 'requirements.txt')
    _write_reqs_file(f'{base_cmd} -d', 'requirements-dev.txt')
    files_to_add = ['Pipfile', 'requirements.txt', 'requirements-dev.txt']

    if amend:
        CTX.repo.amend_commit(append_to_msg='update requirements [auto]', files_to_add=files_to_add)
    elif stage:
        CTX.repo.stage_subset(*files_to_add)
910576
def create_or_update(options) #:nodoc:
                                  #      puts 'create_or_update'
      ret = true
      run_callbacks :save do
        result = new_record? ? create(options) : update(options)
#        puts 'save_callbacks result=' + result.inspect
        ret = result
      end
      ret
    end
40135
def _commit(self):
        

        params = {'commit': 'true'}

        response = self._do_request(
            self.UPDATE_ENDPOINT,
            params=params
        )

        if response and response.status_code == 200:
            logger.debug('Index commited')
            return None

        logger.warning('Fail to commite index')
494647
def run_on_changes(paths)
      paths += @failed_paths if @options[:keep_failed]
      paths = @inspector.clean(paths).uniq

      if passed = @runner.run(paths)
        remove_failed(paths)

        # run all the specs if the run before this one failed
        if @last_failed && @options[:all_after_pass]
          @last_failed = false
          run_all
        end
      else
        @last_failed = true
        add_failed(paths)

        throw :task_has_failed
      end
    end
316249
def insert(self, revision, index):
        
        if not isinstance(revision, Revision):
            raise InvalidArgType()

        for rev in self.revisions:
            if rev == revision:
                return self

        self.revisions.insert(index, revision)

        return self
101662
def run(self, args):
        
        changes_detected = self.detect_changes()
        message = self.get_message(changes_detected)
        print(message)
        return int(changes_detected)
12213
def run_on_modifications(paths)
      return pending_result if paths.empty?
      Guard::UI.info("Running: #{paths.join(', ')}", reset: true)
      do_run{ @runner.run(paths) }
    end
1204675
def run_on_changes(paths)
      specs = Inspector.clean(paths)
      return false if specs.empty?

      specs += self.rerun_specs if options[:keep_failed]

      # RSpec reloads the files, so reload only non spec files
      (paths - specs).each { |path| Reloader.reload_file(path) }

      passed, failed_examples, passed_examples = Runner.run(specs, options)

      self.rerun_specs += failed_examples
      self.rerun_specs -= passed_examples

      run_all if passed && !self.last_run_passed && options[:all_after_pass]

      self.last_run_passed = passed

      throw :task_has_failed unless passed
    end
872549
def edit(self, changelist=0):
        
        command = 'reopen' if self.action in ('add', 'edit') else 'edit'
        if int(changelist):
            self._connection.run([command, '-c', str(changelist.change), self.depotFile])
        else:
            self._connection.run([command, self.depotFile])

        self.query()
969558
def _run(self):
        
        tup = self.read_tuple()
        self._current_tups = [tup]
        if self.is_heartbeat(tup):
            self.send_message({"command": "sync"})
        elif self.is_tick(tup):
            self.process_tick(tup)
            if self.auto_ack:
                self.ack(tup)
        else:
            self.process(tup)
            if self.auto_ack:
                self.ack(tup)
        # Reset _current_tups so that we don't accidentally fail the wrong
        # Tuples if a successive call to read_tuple fails.
        # This is not done in `finally` clause because we want the current
        # Tuples to fail when there is an exception.
        self._current_tups = []
304135
def run_on_modifications(paths)
      changed_files, success = Runner.run(Inspector.clean(paths), watchers, options)

      throw :task_has_failed unless success
    end
41407
def revert(self, unchanged=False):
        
        cmd = ['revert']
        if unchanged:
            cmd.append('-a')

        wasadd = self.action == 'add'

        cmd.append(self.depotFile)

        self._connection.run(cmd)

        if 'movedFile' in self._p4dict:
            self._p4dict['depotFile'] = self._p4dict['movedFile']

        if not wasadd:
            self.query()

        if self._changelist:
            self._changelist.remove(self, permanent=True)
806622
def run(
    categories, param_file, project_dir, plugin, target,
    status_update_interval
):
    
    return _run(
        categories, param_file, project_dir, plugin, target,
        status_update_interval
    )