Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 18.219.23.38
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/bin/lp-capture-bug-counts
#! /usr/bin/python

import sys

from lptools import config

project_name = 'bzr'


def get_project():
    sys.stderr.write('getting project... ')
    project = launchpad.projects[project_name]
    sys.stderr.write('%s (%s)\n' % (project.name, project.title))
    return project


class BugCategory(object):
    """Holds a set of logically-related bugs"""

    def __init__(self):
        self.bugs = set()

    def add(self, bt):
        self.bugs.add(bt)

    def count_bugs(self):
        return len(self.bugs)

    def get_link_url(self):
        return None


class HasPatchBugCategory(BugCategory):

    def get_name(self):
        return 'HasPatch'

    def get_link_url(self):
        return 'https://bugs.edge.launchpad.net/%s/+bugs' \
            '?search=Search&field.has_patch=on' \
            % (project_name)


class StatusBugCategory(BugCategory):

    def __init__(self, status):
        BugCategory.__init__(self)
        self.status = status

    def get_name(self):
        return self.status

    def get_link_url(self):
        return 'https://bugs.edge.launchpad.net/%s/+bugs?search=Search&field.status=%s' \
            % (project_name, self.status)


class CannedQuery(object):

    def __init__(self, project):
        self.project = project

    def _run_query(self, from_collection):
        sys.stderr.write(self.get_name())
        for bt in from_collection:
            yield bt
            sys.stderr.write('.')
        sys.stderr.write('\n')

    def show_text(self):
        # print self.get_name()
        for category in self.query_categories():
            print '%6d %s %s' % (category.count_bugs(),
                category.get_name(),
                category.get_link_url() or '')
        print


class PatchCannedQuery(CannedQuery):

    def get_collection(self):
        return self.project.searchTasks(has_patch=True)

    def get_name(self):
        return 'Bugs with patches'

    def query_categories(self):
        has_patches = HasPatchBugCategory()
        for bt in self._run_query(
            self.project.searchTasks(has_patch=True)):
            has_patches.add(bt)
        return [has_patches]


class StatusCannedQuery(CannedQuery):

    def get_name(self):
        return 'By Status'

    def query_categories(self):
        by_status = {}
        for bugtask in self._run_query(self.project.searchTasks()):
            if bugtask.status not in by_status:
                by_status[bugtask.status] = StatusBugCategory(bugtask.status)
            by_status[bugtask.status].add(bugtask)
        return by_status.values()


def show_bug_report(project):
    for query_class in StatusCannedQuery, PatchCannedQuery:
        query_class(project).show_text()


launchpad = config.get_launchpad("capture-bug-counts")
project = get_project()
show_bug_report(project)

Anon7 - 2022
AnonSec Team