summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2013-09-25 11:02:57 +0100
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2013-09-25 11:10:41 +0100
commitf5966649bf5de39c611b9514664c12ea41f3645b (patch)
tree5f47ca04721ebbeed8e47438fbd63bfcf1c7cd4b
parent481a5cc4eff2fc6ad49da822718440f207e93865 (diff)
downloadroadmap-f5966649bf5de39c611b9514664c12ea41f3645b.tar.gz
license and pep8 fixes
Change-Id: Id91baecd9de2599ba41cca83fc38d585c594de74
-rw-r--r--roadmap/__init__.py17
-rw-r--r--roadmap/admin.py17
-rw-r--r--roadmap/fixtures/create_fixture.py51
-rw-r--r--roadmap/management/commands/__init__.py17
-rw-r--r--roadmap/management/commands/burndown_snapshot.py22
-rw-r--r--roadmap/management/commands/roadmap_import.py54
6 files changed, 149 insertions, 29 deletions
diff --git a/roadmap/__init__.py b/roadmap/__init__.py
index e69de29..3fce9d0 100644
--- a/roadmap/__init__.py
+++ b/roadmap/__init__.py
@@ -0,0 +1,17 @@
+# Copyright (C) 2013 Linaro
+#
+# This file is part of roadmap.
+#
+# roadmap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# roadmap is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with roadmap. If not, see <http://www.gnu.org/licenses/>.
+
diff --git a/roadmap/admin.py b/roadmap/admin.py
index 6847123..f0c4438 100644
--- a/roadmap/admin.py
+++ b/roadmap/admin.py
@@ -1,3 +1,20 @@
+# Copyright (C) 2013 Linaro
+#
+# This file is part of roadmap.
+#
+# roadmap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# roadmap is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with roadmap. If not, see <http://www.gnu.org/licenses/>.
+
from django.contrib import admin
from roadmap.models import (
FixVersion,
diff --git a/roadmap/fixtures/create_fixture.py b/roadmap/fixtures/create_fixture.py
index badc025..f0b92e1 100644
--- a/roadmap/fixtures/create_fixture.py
+++ b/roadmap/fixtures/create_fixture.py
@@ -1,13 +1,31 @@
+# Copyright (C) 2013 Linaro
+#
+# This file is part of roadmap.
+#
+# roadmap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# roadmap is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with roadmap. If not, see <http://www.gnu.org/licenses/>.
+
import yaml
import parsedatetime.parsedatetime as pdt
from dateutil import rrule
from datetime import datetime, timedelta
+
def create_milestone(index, milestone_name, milestone_date, is_major=False):
return {'model': 'roadmap.Milestone',
'pk': index,
- 'fields':
+ 'fields':
{'name': milestone_name,
'date': milestone_date.strftime("%Y-%m-%d"),
'is_major': is_major,
@@ -23,53 +41,64 @@ end = datetime.strptime("2015-12-31", "%Y-%m-%d")
initial_data = []
last_index = 0
-for index, dt in enumerate(rrule.rrule(rrule.MONTHLY, dtstart=start, until=end), start=1):
+for index, dt in enumerate(
+ rrule.rrule(rrule.MONTHLY, dtstart=start, until=end),
+ start=1):
dtstring = "last thursday of %s" % dt.strftime("%B %Y")
milestone_name = dt.strftime("%Y.%m")
print dtstring
milestone_date = datetime(*p.parseDateText(dtstring)[:6])
- initial_data.append(create_milestone(index, milestone_name, milestone_date, False))
+ initial_data.append(
+ create_milestone(index, milestone_name, milestone_date, False))
last_index = index
last_index = last_index + 1
milestone_name = "Linaro Connect Europe/UDS 2011"
milestone_date = datetime(*p.parseDateText("9th May 2011")[:6])
-initial_data.append(create_milestone(last_index, milestone_name, milestone_date, True))
+initial_data.append(
+ create_milestone(last_index, milestone_name, milestone_date, True))
last_index = last_index + 1
milestone_name = "Linaro Connect Europe 2011"
milestone_date = datetime(*p.parseDateText("1st August 2011")[:6])
-initial_data.append(create_milestone(last_index, milestone_name, milestone_date, True))
+initial_data.append(
+ create_milestone(last_index, milestone_name, milestone_date, True))
last_index = last_index + 1
milestone_name = "Linaro Connect USA 2011"
milestone_date = datetime(*p.parseDateText("31st October 2011")[:6])
-initial_data.append(create_milestone(last_index, milestone_name, milestone_date, True))
+initial_data.append(
+ create_milestone(last_index, milestone_name, milestone_date, True))
last_index = last_index + 1
milestone_name = "Linaro Connect USA 2012"
milestone_date = datetime(*p.parseDateText("6th February 2012")[:6])
-initial_data.append(create_milestone(last_index, milestone_name, milestone_date, True))
+initial_data.append(
+ create_milestone(last_index, milestone_name, milestone_date, True))
last_index = last_index + 1
milestone_name = "Linaro Connect Asia 2012"
milestone_date = datetime(*p.parseDateText("28th May 2012")[:6])
-initial_data.append(create_milestone(last_index, milestone_name, milestone_date, True))
+initial_data.append(
+ create_milestone(last_index, milestone_name, milestone_date, True))
last_index = last_index + 1
milestone_name = "Linaro Connect Europe 2013"
milestone_date = datetime(*p.parseDateText("8th July 2013")[:6])
-initial_data.append(create_milestone(last_index, milestone_name, milestone_date, True))
+initial_data.append(
+ create_milestone(last_index, milestone_name, milestone_date, True))
last_index = last_index + 1
milestone_name = "Linaro Connect Asia 2013"
milestone_date = datetime(*p.parseDateText("4th March 2013")[:6])
-initial_data.append(create_milestone(last_index, milestone_name, milestone_date, True))
+initial_data.append(
+ create_milestone(last_index, milestone_name, milestone_date, True))
last_index = last_index + 1
milestone_name = "Linaro Connect Europe 2012"
milestone_date = datetime(*p.parseDateText("29th October 2012")[:6])
-initial_data.append(create_milestone(last_index, milestone_name, milestone_date, True))
+initial_data.append(
+ create_milestone(last_index, milestone_name, milestone_date, True))
f = open("initial_data.yaml", "w")
f.write(yaml.dump(initial_data))
diff --git a/roadmap/management/commands/__init__.py b/roadmap/management/commands/__init__.py
index e69de29..3fce9d0 100644
--- a/roadmap/management/commands/__init__.py
+++ b/roadmap/management/commands/__init__.py
@@ -0,0 +1,17 @@
+# Copyright (C) 2013 Linaro
+#
+# This file is part of roadmap.
+#
+# roadmap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# roadmap is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with roadmap. If not, see <http://www.gnu.org/licenses/>.
+
diff --git a/roadmap/management/commands/burndown_snapshot.py b/roadmap/management/commands/burndown_snapshot.py
index 408121a..ecbefac 100644
--- a/roadmap/management/commands/burndown_snapshot.py
+++ b/roadmap/management/commands/burndown_snapshot.py
@@ -1,11 +1,29 @@
+# Copyright (C) 2013 Linaro
+#
+# This file is part of roadmap.
+#
+# roadmap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# roadmap is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with roadmap. If not, see <http://www.gnu.org/licenses/>.
+
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from optparse import make_option
from roadmap.helpers import collect_burndown, collect_component_burndown
from roadmap.models import Project, CardType
-BURNDOWN_PROJECT='project'
-BURNDOWN_CARDTYPE='cardtype'
+BURNDOWN_PROJECT = 'project'
+BURNDOWN_CARDTYPE = 'cardtype'
+
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
diff --git a/roadmap/management/commands/roadmap_import.py b/roadmap/management/commands/roadmap_import.py
index 854ac30..bad3ef5 100644
--- a/roadmap/management/commands/roadmap_import.py
+++ b/roadmap/management/commands/roadmap_import.py
@@ -1,3 +1,20 @@
+# Copyright (C) 2013 Linaro
+#
+# This file is part of roadmap.
+#
+# roadmap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# roadmap is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with roadmap. If not, see <http://www.gnu.org/licenses/>.
+
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from getpass import getpass
@@ -62,34 +79,34 @@ class Command(BaseCommand):
dest=VERBOSE,
action='store_true',
default=False,
- help='Enables verbose logging. Default: false.'
+ help='Enables verbose logging. Default: false.'
),
)
help = 'Imports current snapshot from Jira server'
def handle(self, *args, **options):
- if options[JIRA_SERVER] == None :
+ if options[JIRA_SERVER] == None:
raise CommandError("Option `--server=...` must be specified.")
- if options[JIRA_USER] == None :
+ if options[JIRA_USER] == None:
raise CommandError("Option `--username=...` must be specified.")
jira_password = getpass("JIRA password (%s):" % options[JIRA_USER])
- jira_options={
- 'server': options[JIRA_SERVER],
+ jira_options = {
+ 'server': options[JIRA_SERVER],
'verify': options[JIRA_VERIFY]}
jira = JIRA(
- options=jira_options,
- basic_auth=(options[JIRA_USER], jira_password))
+ options=jira_options,
+ basic_auth=(options[JIRA_USER], jira_password))
start = 0
if options[JIRA_KEY] == None:
issues = jira.search_issues(
- 'project="%s"' % settings.JIRA_PROJECT,
- startAt=start,
+ 'project="%s"' % settings.JIRA_PROJECT,
+ startAt=start,
expand="changelog")
else:
issues = jira.search_issues(
- 'key="%s"' % options[JIRA_KEY],
- startAt=start,
+ 'key="%s"' % options[JIRA_KEY],
+ startAt=start,
expand="changelog")
options.update({SINGLE_UPDATE: False})
@@ -97,17 +114,22 @@ class Command(BaseCommand):
while len(issues) > 0:
#allissues.extend(issues)
for index, issue in enumerate(issues, start=1):
- print "Processing %s/%s (%s/%s) %s" % (index + start, issues.total, index, len(issues), issue.key)
+ print "Processing %s/%s (%s/%s) %s" % (
+ index + start,
+ issues.total,
+ index,
+ len(issues),
+ issue.key)
create_or_update(issue, options, jira)
start = start + len(issues)
if options[JIRA_KEY] == None:
issues = jira.search_issues(
- 'project="%s"' % settings.JIRA_PROJECT,
- startAt=start,
+ 'project="%s"' % settings.JIRA_PROJECT,
+ startAt=start,
expand="changelog")
else:
issues = jira.search_issues(
- 'key="%s"' % options[JIRA_KEY],
- startAt=start,
+ 'key="%s"' % options[JIRA_KEY],
+ startAt=start,
expand="changelog")