Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_issue(
self, templates=None, issue=None, description=None, add_tags=None
):
templates = {} if templates is None else templates
origin = {
'annotation_length': 100, # Arbitrary
'default_priority': 'H', # Arbitrary
'description_length': 100, # Arbitrary
'templates': templates,
'shorten': False, # Arbitrary
'add_tags': add_tags if add_tags else [],
}
issue = Issue({}, origin)
issue.to_taskwarrior = lambda: (
self.arbitrary_issue if description is None else description
)
issue.get_default_description = lambda: (
self.arbitrary_default_description
if description is None else description
)
return issue
TYPE_NAME_MAP = {
'date': 'Date & Time',
'numeric': 'Numeric',
'string': 'Text (string)',
'duration': 'Duration'
}
if __name__ == '__main__':
service = sys.argv[1]
module = import_by_path(
'bugwarrior.services.{service}'.format(service=service)
)
rows = []
for name, obj in inspect.getmembers(module):
if inspect.isclass(obj) and issubclass(obj, Issue):
for field_name, details in obj.UDAS.items():
rows.append(
[
'``%s``' % field_name,
' '.join(details['label'].split(' ')[1:]),
TYPE_NAME_MAP.get(
details['type'],
'``%s``' % details['type'],
),
]
)
rows = sorted(rows, cmp=row_comparator)
rows.insert(0, ['Field Name', 'Description', 'Type'])
filename = os.path.join(os.path.dirname(__file__), 'service_template.html')
import bugzilla
import time
import pytz
import datetime
import six
from bugwarrior.config import die, asbool, aslist
from bugwarrior.services import IssueService, Issue
import logging
log = logging.getLogger(__name__)
class BugzillaIssue(Issue):
URL = 'bugzillaurl'
SUMMARY = 'bugzillasummary'
BUG_ID = 'bugzillabugid'
STATUS = 'bugzillastatus'
NEEDINFO = 'bugzillaneedinfo'
PRODUCT = 'bugzillaproduct'
COMPONENT = 'bugzillacomponent'
ASSIGNED_ON = 'bugzillaassignedon'
UDAS = {
URL: {
'type': 'string',
'label': 'Bugzilla URL',
},
SUMMARY: {
'type': 'string',
from __future__ import absolute_import
import re
import six
import requests
from jinja2 import Template
from bugwarrior.config import asbool, die
from bugwarrior.services import IssueService, Issue, ServiceClient
import logging
log = logging.getLogger(__name__)
class YoutrackIssue(Issue):
ISSUE = 'youtrackissue'
SUMMARY = 'youtracksummary'
URL = 'youtrackurl'
PROJECT = 'youtrackproject'
NUMBER = 'youtracknumber'
UDAS = {
ISSUE: {
'type': 'string',
'label': 'YouTrack Issue'
},
SUMMARY: {
'type': 'string',
'label': 'YouTrack Summary',
},
URL: {
from builtins import str
import six
from bugwarrior.config import aslist
from bugwarrior.services import IssueService, Issue
# This comes from PyPI
import phabricator
import logging
log = logging.getLogger(__name__)
class PhabricatorIssue(Issue):
TITLE = 'phabricatortitle'
URL = 'phabricatorurl'
TYPE = 'phabricatortype'
OBJECT_NAME = 'phabricatorid'
UDAS = {
TITLE: {
'type': 'string',
'label': 'Phabricator Title',
},
URL: {
'type': 'string',
'label': 'Phabricator URL',
},
TYPE: {
'type': 'string',
class TeamworkClient(ServiceClient):
def __init__(self, host, token):
self.host = host
self.token = token
def authenticate(self):
response = requests.get(self.host + "/authenticate.json", auth=(self.token, ""))
return self.json_response(response)
def call_api(self, method, endpoint, data=None):
response = requests.get(self.host + endpoint, auth=(self.token, ""), params=data)
return self.json_response(response)
class TeamworkIssue(Issue):
URL = 'teamwork_url'
TITLE = 'teamwork_title'
DESCRIPTION_LONG = 'teamwork_description_long'
PROJECT_ID = 'teamwork_project_id'
STATUS = 'teamwork_status'
ID = 'teamwork_id'
UDAS = {
URL: {
'type': 'string',
'label': 'Teamwork Url',
},
TITLE: {
'type': 'string',
'label': 'Teamwork Title',
},
from builtins import map
from builtins import range
import offtrac
import csv
import io as StringIO
import requests
import urllib.request, urllib.parse, urllib.error
from bugwarrior.config import die, asbool
from bugwarrior.services import Issue, IssueService
import logging
log = logging.getLogger(__name__)
class TracIssue(Issue):
SUMMARY = 'tracsummary'
URL = 'tracurl'
NUMBER = 'tracnumber'
COMPONENT = 'traccomponent'
UDAS = {
SUMMARY: {
'type': 'string',
'label': 'Trac Summary',
},
URL: {
'type': 'string',
'label': 'Trac URL',
},
NUMBER: {
'type': 'numeric',
from __future__ import absolute_import
import json
import os
import requests
from bugwarrior.config import die
from bugwarrior.services import IssueService, Issue, ServiceClient
class GerritIssue(Issue):
SUMMARY = 'gerritsummary'
URL = 'gerriturl'
FOREIGN_ID = 'gerritid'
BRANCH = 'gerritbranch'
TOPIC = 'gerrittopic'
UDAS = {
SUMMARY: {
'type': 'string',
'label': 'Gerrit Summary'
},
URL: {
'type': 'string',
'label': 'Gerrit URL',
},
FOREIGN_ID: {
import os
import re
import time
import googleapiclient.discovery
import httplib2
import oauth2client.client
import oauth2client.file
import oauth2client.tools
from bugwarrior.services import IssueService, Issue
log = logging.getLogger(__name__)
class GmailIssue(Issue):
THREAD_ID = 'gmailthreadid'
SUBJECT = 'gmailsubject'
URL = 'gmailurl'
LAST_SENDER = 'gmaillastsender'
LAST_SENDER_ADDR = 'gmaillastsenderaddr'
LAST_MESSAGE_ID = 'gmaillastmessageid'
SNIPPET = 'gmailsnippet'
LABELS = 'gmaillabels'
UNIQUE_KEY = (THREAD_ID,)
UDAS = {
THREAD_ID: {
'type': 'string',
'label': 'GMail Thread Id',
},
SUBJECT: {
def call_api(self, uri, params):
url = self.url.rstrip("/") + uri
kwargs = {
'headers': {'X-Redmine-API-Key': self.key},
'params': params}
if self.auth:
kwargs['auth'] = self.auth
kwargs['verify'] = self.verify_ssl
return self.json_response(requests.get(url, **kwargs))
class RedMineIssue(Issue):
URL = 'redmineurl'
SUBJECT = 'redminesubject'
ID = 'redmineid'
DESCRIPTION = 'redminedescription'
TRACKER = 'redminetracker'
STATUS = 'redminestatus'
AUTHOR = 'redmineauthor'
CATEGORY = 'redminecategory'
START_DATE = 'redminestartdate'
SPENT_HOURS = 'redminespenthours'
ESTIMATED_HOURS = 'redmineestimatedhours'
CREATED_ON = 'redminecreatedon'
UPDATED_ON = 'redmineupdatedon'
DUEDATE = 'redmineduedate'
ASSIGNED_TO = 'redmineassignedto'
PROJECT_NAME = 'redmineprojectname'