List the available_tasks
972369
def list_tasks(collector, tasks, **kwargs):
    """"""
    print("Available tasks to choose from are:")
    print("Use the --task option to choose one")
    print("")
    keygetter = lambda item: item[1].label
    tasks = sorted(tasks.items(), key=keygetter)
    for label, items in itertools.groupby(tasks, keygetter):
        print("--- {0}".format(label))
        print("----{0}".format("-" * len(label)))
        sorted_tasks = sorted(list(items), key=lambda item: len(item[0]))
        max_length = max(len(name) for name, _ in sorted_tasks)
        for key, task in sorted_tasks:
            desc = dedent(task.description or "").strip().split('\n')[0]
            print("\t{0}{1} :-: {2}".format(" " * (max_length-len(key)), key, desc))
        print("")
1043184
def _get_task_kwargs(self):
        
        res = {}
        for (param_name, param_obj) in self._get_task_cls().get_params():
            attr = getattr(self.known_args, param_name)
            if attr:
                res.update(((param_name, param_obj.parse(attr)),))

        return res
175267
def tasks
      RRRSpec.redis.lrange(RRRSpec.make_key(key, 'tasks'), 0, -1).map do |key|
        Task.new(key)
      end
    end
181960
private static void displayAvailableFilters(ProjectFile project)
   {
      System.out.println("Unknown filter name supplied.");
      System.out.println("Available task filters:");
      for (Filter filter : project.getFilters().getTaskFilters())
      {
         System.out.println("   " + filter.getName());
      }

      System.out.println("Available resource filters:");
      for (Filter filter : project.getFilters().getResourceFilters())
      {
         System.out.println("   " + filter.getName());
      }

   }
97966
def find_tasks(source_code):
    """"""
    results = []
    for line, text in enumerate(source_code.splitlines()):
        for todo in re.findall(TASKS_PATTERN, text):
            todo_text = (todo[-1].strip(' :').capitalize() if todo[-1]
                         else todo[-2])
            results.append((todo_text, line + 1))
    return results
406612
def get_my_tasks(self, *args):
        

        url = self.build_url(self._endpoints.get('get_my_tasks'))

        response = self.con.get(url)

        if not response:
            return None

        data = response.json()

        return [
            self.task_constructor(parent=self, **{self._cloud_data_key: site})
            for site in data.get('value', [])]
110288
def parameters(self):
        
        parameters = []
        for task in self.tasks:
            parameters.extend(task.parameters)
        return parameters
135108
def get_task_list(self):
        
        request = urllib.request.Request(self.url + '/rest/v1/tasks/all.json')
        if self.authorization_header() is not None:
            request.add_header('Authorization', self.authorization_header())
        request.add_header('User-Agent', 'GenePatternRest')
        response = urllib.request.urlopen(request)
        response_string = response.read().decode('utf-8')
        category_and_tasks = json.loads(response_string)
        raw_list = category_and_tasks['all_modules']
        task_list = []
        for task_dict in raw_list:
            task = GPTask(self, task_dict['lsid'], task_dict)
            task_list.append(task)
        return task_list
540617
def tasks(self, name):
        ''''''
        found = self[name]
        if isinstance(found, Shovel):
            return [v for _, v in found.items()]
        return [found]
1338838
public function listAction()
    {
        $arg = $this->request->get('args');
        $tasks = $this->taskProcessor->find($arg);

        $length = 0;
        foreach ($tasks as $t) $length = $length < strlen($t->getName()) ? strlen($t->getName()) : $length;

        foreach ($tasks as $task) {
            $this->send('%s        %s', str_pad($task->getName(), $length), $task->getShortDescription());
        }
    }
1370757
def task_actions(self):
        
        if self._task_actions is None:
            self._task_actions = TaskActionsList(
                self._version,
                assistant_sid=self._solution['assistant_sid'],
                task_sid=self._solution['sid'],
            )
        return self._task_actions
759182
def view_task(self, task):
        
        log.debug('Viewing task %s', task.name)
        self.cur_task = None
        self.pages_tabw.setCurrentIndex(7)

        self.task_dep_le.setText(task.name)
        statusmap = {"New": 0, "Open": 1, "Done":2}
        self.task_status_cb.setCurrentIndex(statusmap.get(task.status, -1))
        dt = dt_to_qdatetime(task.deadline) if task.deadline else None
        self.task_deadline_de.setDateTime(dt)

        self.task_link_le.setText(task.element.name)

        userrootdata = treemodel.ListItemData(['Username', 'First', 'Last', 'Email'])
        userrootitem = treemodel.TreeItem(userrootdata)
        for user in task.users.all():
            userdata = djitemdata.UserItemData(user)
            treemodel.TreeItem(userdata, userrootitem)
        self.task_user_model = treemodel.TreeModel(userrootitem)
        self.task_user_tablev.setModel(self.task_user_model)

        self.cur_task = task
1045523
def get_my_choices_tasks(current_proj):
    

    task_list = []
    tasks = Task.objects.all()
    for task in tasks:
        if task.project == current_proj:
            task_list.append(task)

    task_tuple = []
    counter = 1
    for task in task_list:
        task_tuple.append((counter, task))
        counter = counter + 1
    return task_tuple
1051688
def todo_tasks(self):
        """"""
        tasks = [task for task in self.all_tasks if task._state == NewTask._PENDING]
        return tasks
730512
def get_tasks(self):
        
        tasks = collections.OrderedDict()
        for dep in self.ordered_dependencies:
            tasks[dep.name] = dep.task

        return tasks
840546
def schedule(self, name, timer, func, *args, **kwargs):
        '''
        
        '''
        self.tasks.append(Task(name, func, timer, *args, **kwargs))
        self.active[name] = []  # list of greenlets
        self.waiting[name] = []
72225
def get_smart_tasks(self):
        
        def process_result(result):
            return [self.get_smart_task(task) for task in result]

        return Command('get', [ROOT_SMART_TASKS],
                       process_result=process_result)