How to use the bugwarrior.config.asbool function in bugwarrior

To help you get started, we’ve selected a few bugwarrior examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ralphbean / bugwarrior / bugwarrior / services / gitlab.py View on Github external
def to_taskwarrior(self):
        author = self.record['author']
        milestone = self.record.get('milestone')
        created = self.record['created_at']
        updated = self.record.get('updated_at')
        state = self.record['state']
        upvotes = self.record.get('upvotes', 0)
        downvotes = self.record.get('downvotes', 0)
        work_in_progress = int(asbool(self.record.get('work_in_progress', 0)))
        assignee = self.record.get('assignee')
        duedate = self.record.get('due_date')
        weight = self.record.get('weight')
        number = (
            self.record['id'] if self.extra['type'] == 'todo'
            else self.record['iid'])
        priority = (
            self.origin['default_priority'] if self.extra['type'] == 'issue'
            else 'H')
        title = (
            'Todo from %s for %s' % (author['name'], self.extra['project'])
            if self.extra['type'] == 'todo' else self.record['title'])
        description = (
            self.record['body'] if self.extra['type'] == 'todo'
            else self.record['description'])
github ralphbean / bugwarrior / bugwarrior / services / bts.py View on Github external
def __init__(self, *args, **kw):
        super(BTSService, self).__init__(*args, **kw)
        self.email = self.config.get('email', default=None)
        self.packages = self.config.get('packages', default=None)
        self.udd = self.config.get(
            'udd', default=False, to_type=asbool)
        self.udd_ignore_sponsor = self.config.get(
            'udd_ignore_sponsor', default=True, to_type=asbool)
        self.ignore_pkg = self.config.get('ignore_pkg', default=None)
        self.ignore_src = self.config.get('ignore_src', default=None)
        self.ignore_pending = self.config.get(
            'ignore_pending', default=True, to_type=asbool)
github ralphbean / bugwarrior / bugwarrior / services / trello.py View on Github external
def get_service_metadata(self):
        """
        Return extra config options to be passed to the TrelloIssue class
        """
        return {
            'import_labels_as_tags':
            self.config.get('import_labels_as_tags', False, asbool),
            'label_template':
            self.config.get('label_template', DEFAULT_LABEL_TEMPLATE),
            }
github ralphbean / bugwarrior / bugwarrior / db.py View on Github external
def _bool_option(section, option, default):
        try:
            return asbool(conf.get(section, option))
        except (NoSectionError, NoOptionError):
            return default
github ralphbean / bugwarrior / bugwarrior / services / bts.py View on Github external
def __init__(self, *args, **kw):
        super(BTSService, self).__init__(*args, **kw)
        self.email = self.config.get('email', default=None)
        self.packages = self.config.get('packages', default=None)
        self.udd = self.config.get(
            'udd', default=False, to_type=asbool)
        self.udd_ignore_sponsor = self.config.get(
            'udd_ignore_sponsor', default=True, to_type=asbool)
        self.ignore_pkg = self.config.get('ignore_pkg', default=None)
        self.ignore_src = self.config.get('ignore_src', default=None)
        self.ignore_pending = self.config.get(
            'ignore_pending', default=True, to_type=asbool)
github ralphbean / bugwarrior / bugwarrior / services / __init__.py View on Github external
def __init__(self, main_config, main_section, target):
        self.config = ServiceConfig(self.CONFIG_PREFIX, main_config, target)
        self.main_section = main_section
        self.main_config = main_config
        self.target = target

        self.desc_len = self._get_config_or_default('description_length', 35, asint);
        self.anno_len = self._get_config_or_default('annotation_length', 45, asint);
        self.inline_links = self._get_config_or_default('inline_links', True, asbool);
        self.annotation_links = self._get_config_or_default('annotation_links', not self.inline_links, asbool)
        self.annotation_comments = self._get_config_or_default('annotation_comments', True, asbool)
        self.annotation_newlines = self._get_config_or_default('annotation_newlines', False, asbool)
        self.shorten = self._get_config_or_default('shorten', False, asbool)

        self.default_priority = self.config.get('default_priority', 'M')

        self.add_tags = []
        for raw_option in aslist(self.config.get('add_tags', '')):
            option = raw_option.strip(' +;')
            if option:
                self.add_tags.append(option)

        log.info("Working on [%s]", self.target)
github ralphbean / bugwarrior / bugwarrior / services / jira.py View on Github external
def __init__(self, *args, **kw):
        super(JiraService, self).__init__(*args, **kw)
        self.username = self.config.get('username')
        self.url = self.config.get('base_uri')
        password = self.get_password('password', self.username)

        default_query = 'assignee="' + self.username + \
            '" AND resolution is null'
        self.query = self.config.get('query', default_query)
        self.use_cookies = self.config.get(
            'use_cookies', default=False, to_type=asbool
        )

        if password == '@kerberos':
            auth = dict(kerberos=True)
        else:
            if self.use_cookies:
                auth = dict(auth=(self.username, password))
            else:
                auth = dict(basic_auth=(self.username, password))
        self.jira = JIRA(
            options={
                'server': self.config.get('base_uri'),
                'rest_api_version': 'latest',
                'verify': self.config.get('verify_ssl', default=True, to_type=asbool),
            },
            **auth
github ralphbean / bugwarrior / bugwarrior / services / redmine.py View on Github external
def __init__(self, *args, **kw):
        super(RedMineService, self).__init__(*args, **kw)

        self.url = self.config.get('url').rstrip("/")
        self.key = self.get_password('key')
        self.issue_limit = self.config.get('issue_limit')

        self.verify_ssl = self.config.get(
            'verify_ssl', default=True, to_type=asbool
        )

        login = self.config.get('login')
        if login:
            password = self.get_password('password', login)
        auth = (login, password) if (login and password) else None
        self.client = RedMineClient(self.url, self.key, auth, self.issue_limit, self.verify_ssl)

        self.project_name = self.config.get('project_name')
github ralphbean / bugwarrior / bugwarrior / services / bz.py View on Github external
self.username = self.config.get('username')
        self.ignore_cc = self.config.get('ignore_cc', default=False,
                                         to_type=lambda x: x == "True")
        self.query_url = self.config.get('query_url', default=None)
        self.include_needinfos = self.config.get(
            'include_needinfos', False, to_type=lambda x: x == "True")
        self.open_statuses = self.config.get('open_statuses', _open_statuses, to_type=aslist)
        log.debug(" filtering on statuses: %r", self.open_statuses)

        # So more modern bugzilla's require that we specify
        # query_format=advanced along with the xmlrpc request.
        # https://bugzilla.redhat.com/show_bug.cgi?id=825370
        # ...but older bugzilla's don't know anything about that argument.
        # Here we make it possible for the user to specify whether they want
        # to pass that argument or not.
        self.advanced = asbool(self.config.get('advanced', 'no'))

        force_rest_kwargs = {}
        if asbool(self.config.get("force_rest", "no")):
            force_rest_kwargs = {"force_rest": True}

        url = 'https://%s' % self.base_uri
        api_key = self.config.get('api_key', default=None)
        if api_key:
            try:
                self.bz = bugzilla.Bugzilla(url=url, api_key=api_key, **force_rest_kwargs)
            except TypeError:
                raise Exception("Bugzilla API keys require python-bugzilla>=2.1.0")
        else:
            password = self.get_password('password', self.username)
            self.bz = bugzilla.Bugzilla(url=url, **force_rest_kwargs)
            self.bz.login(self.username, password)