From 16caedce81732232fd4beaf46656ff605d057d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Fri, 3 Mar 2017 08:13:12 +0100 Subject: [PATCH] Adding licenses to files and fixing some pyflakes errors --- taiga/importers/asana/api.py | 2 -- taiga/importers/asana/importer.py | 19 +++++++++++++++++- taiga/importers/asana/tasks.py | 2 +- taiga/importers/exceptions.py | 18 +++++++++++++++++ taiga/importers/github/api.py | 2 -- taiga/importers/github/importer.py | 20 ++++++++++++++++++- taiga/importers/github/tasks.py | 2 +- taiga/importers/jira/agile.py | 18 +++++++++++++++++ taiga/importers/jira/common.py | 20 ++++++++++++++++++- taiga/importers/jira/normal.py | 18 +++++++++++++++++ .../management/commands/import_from_asana.py | 5 +---- .../management/commands/import_from_github.py | 10 +++------- .../management/commands/import_from_jira.py | 5 +---- .../commands/import_from_pivotal.py | 4 ---- .../management/commands/import_from_trello.py | 4 ---- taiga/importers/permissions.py | 5 +---- taiga/importers/pivotal/api.py | 1 - taiga/importers/pivotal/importer.py | 18 +++++++++++++++++ taiga/importers/pivotal/tasks.py | 2 +- taiga/importers/services.py | 18 +++++++++++++++++ taiga/importers/trello/api.py | 1 - 21 files changed, 155 insertions(+), 39 deletions(-) diff --git a/taiga/importers/asana/api.py b/taiga/importers/asana/api.py index e8b130e2..3c19b896 100644 --- a/taiga/importers/asana/api.py +++ b/taiga/importers/asana/api.py @@ -20,10 +20,8 @@ from taiga.base.api import viewsets from taiga.base import response from taiga.base import exceptions as exc from taiga.base.decorators import list_route -from taiga.users.models import AuthData, User from taiga.users.services import get_user_photo_url from taiga.users.gravatar import get_user_gravatar_id -from taiga.projects.serializers import ProjectSerializer from taiga.importers import permissions, exceptions from taiga.importers.services import resolve_users_bindings diff --git a/taiga/importers/asana/importer.py b/taiga/importers/asana/importer.py index 2899ace9..fe26d930 100644 --- a/taiga/importers/asana/importer.py +++ b/taiga/importers/asana/importer.py @@ -1,6 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Andrey Antukh +# Copyright (C) 2014-2017 Jesús Espino +# Copyright (C) 2014-2017 David Barragán +# Copyright (C) 2014-2017 Alejandro Alonso +# This program 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. +# +# This program 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 this program. If not, see . + import requests import asana -import json from django.core.files.base import ContentFile from django.contrib.contenttypes.models import ContentType diff --git a/taiga/importers/asana/tasks.py b/taiga/importers/asana/tasks.py index b294c661..bd707b0d 100644 --- a/taiga/importers/asana/tasks.py +++ b/taiga/importers/asana/tasks.py @@ -44,7 +44,7 @@ def import_project(self, user_id, token, project_id, options): "project": project_id, "exception": e } - email = mail_builder.importer_import_error(admin, ctx) + email = mail_builder.importer_import_error(user, ctx) email.send() logger.error('Error importing Asana project %s (by %s)', project_id, user, exc_info=sys.exc_info()) else: diff --git a/taiga/importers/exceptions.py b/taiga/importers/exceptions.py index ebb8de86..0646095d 100644 --- a/taiga/importers/exceptions.py +++ b/taiga/importers/exceptions.py @@ -1,3 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Andrey Antukh +# Copyright (C) 2014-2017 Jesús Espino +# Copyright (C) 2014-2017 David Barragán +# Copyright (C) 2014-2017 Alejandro Alonso +# This program 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. +# +# This program 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 this program. If not, see . + class InvalidRequest(Exception): pass diff --git a/taiga/importers/github/api.py b/taiga/importers/github/api.py index 6def5d03..56a0d061 100644 --- a/taiga/importers/github/api.py +++ b/taiga/importers/github/api.py @@ -20,10 +20,8 @@ from taiga.base.api import viewsets from taiga.base import response from taiga.base import exceptions as exc from taiga.base.decorators import list_route -from taiga.users.models import AuthData, User from taiga.users.services import get_user_photo_url from taiga.users.gravatar import get_user_gravatar_id -from taiga.projects.serializers import ProjectSerializer from taiga.importers import permissions from taiga.importers import exceptions diff --git a/taiga/importers/github/importer.py b/taiga/importers/github/importer.py index 18c5cbce..9d5d4df7 100644 --- a/taiga/importers/github/importer.py +++ b/taiga/importers/github/importer.py @@ -1,3 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Andrey Antukh +# Copyright (C) 2014-2017 Jesús Espino +# Copyright (C) 2014-2017 David Barragán +# Copyright (C) 2014-2017 Alejandro Alonso +# This program 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. +# +# This program 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 this program. If not, see . + import requests from urllib.parse import parse_qsl from django.core.files.base import ContentFile @@ -19,7 +37,7 @@ from taiga.timeline.rebuilder import rebuild_timeline from taiga.timeline.models import Timeline from taiga.users.models import User, AuthData -from taiga.importers.exceptions import InvalidAuthResult +from taiga.importers.exceptions import InvalidAuthResult, FailedRequest class GithubClient: diff --git a/taiga/importers/github/tasks.py b/taiga/importers/github/tasks.py index 6af268ee..b3102621 100644 --- a/taiga/importers/github/tasks.py +++ b/taiga/importers/github/tasks.py @@ -44,7 +44,7 @@ def import_project(self, user_id, token, project_id, options): "project": project_id, "exception": e } - email = mail_builder.importer_import_error(admin, ctx) + email = mail_builder.importer_import_error(user, ctx) email.send() logger.error('Error importing GitHub project %s (by %s)', project_id, user, exc_info=sys.exc_info()) else: diff --git a/taiga/importers/jira/agile.py b/taiga/importers/jira/agile.py index 0f4d70cf..bca5cada 100644 --- a/taiga/importers/jira/agile.py +++ b/taiga/importers/jira/agile.py @@ -1,3 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Andrey Antukh +# Copyright (C) 2014-2017 Jesús Espino +# Copyright (C) 2014-2017 David Barragán +# Copyright (C) 2014-2017 Alejandro Alonso +# This program 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. +# +# This program 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 this program. If not, see . + import datetime from django.template.defaultfilters import slugify diff --git a/taiga/importers/jira/common.py b/taiga/importers/jira/common.py index 553025d5..f1ffa691 100644 --- a/taiga/importers/jira/common.py +++ b/taiga/importers/jira/common.py @@ -1,3 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Andrey Antukh +# Copyright (C) 2014-2017 Jesús Espino +# Copyright (C) 2014-2017 David Barragán +# Copyright (C) 2014-2017 Alejandro Alonso +# This program 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. +# +# This program 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 this program. If not, see . + import requests from urllib.parse import parse_qsl from oauthlib.oauth1 import SIGNATURE_RSA @@ -7,7 +25,7 @@ from django.core.files.base import ContentFile from django.contrib.contenttypes.models import ContentType from taiga.users.models import User -from taiga.projects.models import Project, ProjectTemplate, Membership, Points +from taiga.projects.models import Points from taiga.projects.userstories.models import UserStory from taiga.projects.tasks.models import Task from taiga.projects.issues.models import Issue diff --git a/taiga/importers/jira/normal.py b/taiga/importers/jira/normal.py index 45584545..2854ec26 100644 --- a/taiga/importers/jira/normal.py +++ b/taiga/importers/jira/normal.py @@ -1,3 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Andrey Antukh +# Copyright (C) 2014-2017 Jesús Espino +# Copyright (C) 2014-2017 David Barragán +# Copyright (C) 2014-2017 Alejandro Alonso +# This program 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. +# +# This program 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 this program. If not, see . + from collections import OrderedDict from django.template.defaultfilters import slugify diff --git a/taiga/importers/management/commands/import_from_asana.py b/taiga/importers/management/commands/import_from_asana.py index 677dc870..8c82771a 100644 --- a/taiga/importers/management/commands/import_from_asana.py +++ b/taiga/importers/management/commands/import_from_asana.py @@ -21,11 +21,8 @@ from django.conf import settings from django.db.models import Q from taiga.importers.asana.importer import AsanaImporter -from taiga.users.models import User, AuthData -from taiga.projects.services import projects as service +from taiga.users.models import User -import unittest.mock -import timeit import json diff --git a/taiga/importers/management/commands/import_from_github.py b/taiga/importers/management/commands/import_from_github.py index 3c1f3884..330017f8 100644 --- a/taiga/importers/management/commands/import_from_github.py +++ b/taiga/importers/management/commands/import_from_github.py @@ -21,11 +21,7 @@ from django.conf import settings from django.db.models import Q from taiga.importers.github.importer import GithubImporter -from taiga.users.models import User, AuthData -from taiga.projects.services import projects as service - -import unittest.mock -import timeit +from taiga.users.models import User class Command(BaseCommand): @@ -57,8 +53,8 @@ class Command(BaseCommand): print("Go to here and come with your code (in the redirected url): {}".format(url)) code = input("Code: ") access_data = GithubImporter.get_access_token( - settings.IMPORTERS.get('github', {}).get('client_id', None) - settings.IMPORTERS.get('github', {}).get('client_secret', None) + settings.IMPORTERS.get('github', {}).get('client_id', None), + settings.IMPORTERS.get('github', {}).get('client_secret', None), code ) token = access_data diff --git a/taiga/importers/management/commands/import_from_jira.py b/taiga/importers/management/commands/import_from_jira.py index 50997593..04dc0b87 100644 --- a/taiga/importers/management/commands/import_from_jira.py +++ b/taiga/importers/management/commands/import_from_jira.py @@ -23,10 +23,7 @@ from django.conf import settings from taiga.importers.jira.agile import JiraAgileImporter from taiga.importers.jira.normal import JiraNormalImporter from taiga.users.models import User -from taiga.projects.services import projects as service -import unittest.mock -import timeit import json @@ -69,7 +66,7 @@ class Command(BaseCommand): True ) print(url) - code = input("Go to the url and get back the code") + input("Go to the url, allow the user and get back and press enter") token = JiraNormalImporter.get_access_token( server, settings.IMPORTERS.get('jira', {}).get('consumer_key', None), diff --git a/taiga/importers/management/commands/import_from_pivotal.py b/taiga/importers/management/commands/import_from_pivotal.py index 5a51e95b..0af57eb5 100644 --- a/taiga/importers/management/commands/import_from_pivotal.py +++ b/taiga/importers/management/commands/import_from_pivotal.py @@ -21,10 +21,6 @@ from django.db.models import Q from taiga.importers.pivotal import PivotalImporter from taiga.users.models import User -from taiga.projects.services import projects as service - -import unittest.mock -import timeit class Command(BaseCommand): diff --git a/taiga/importers/management/commands/import_from_trello.py b/taiga/importers/management/commands/import_from_trello.py index 903a601f..31ab0c9a 100644 --- a/taiga/importers/management/commands/import_from_trello.py +++ b/taiga/importers/management/commands/import_from_trello.py @@ -21,10 +21,6 @@ from django.db.models import Q from taiga.importers.trello.importer import TrelloImporter from taiga.users.models import User -from taiga.projects.services import projects as service - -import unittest.mock -import timeit class Command(BaseCommand): diff --git a/taiga/importers/permissions.py b/taiga/importers/permissions.py index beca1b69..9268c2ef 100644 --- a/taiga/importers/permissions.py +++ b/taiga/importers/permissions.py @@ -16,10 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from taiga.base.api.permissions import TaigaResourcePermission, AllowAny, IsAuthenticated -from taiga.base.api.permissions import IsSuperUser, HasProjectPerm, IsProjectAdmin - -from taiga.permissions.permissions import CommentAndOrUpdatePerm +from taiga.base.api.permissions import TaigaResourcePermission, IsAuthenticated class ImporterPermission(TaigaResourcePermission): diff --git a/taiga/importers/pivotal/api.py b/taiga/importers/pivotal/api.py index 0838edbb..967ea508 100644 --- a/taiga/importers/pivotal/api.py +++ b/taiga/importers/pivotal/api.py @@ -23,7 +23,6 @@ from taiga.base.decorators import list_route from taiga.users.models import AuthData, User from taiga.users.services import get_user_photo_url from taiga.users.gravatar import get_user_gravatar_id -from taiga.projects.serializers import ProjectSerializer from taiga.importers import permissions from .importer import PivotalImporter diff --git a/taiga/importers/pivotal/importer.py b/taiga/importers/pivotal/importer.py index 6f1456ca..c49da4ab 100644 --- a/taiga/importers/pivotal/importer.py +++ b/taiga/importers/pivotal/importer.py @@ -1,3 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Andrey Antukh +# Copyright (C) 2014-2017 Jesús Espino +# Copyright (C) 2014-2017 David Barragán +# Copyright (C) 2014-2017 Alejandro Alonso +# This program 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. +# +# This program 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 this program. If not, see . + from django.core.files.base import ContentFile from django.contrib.contenttypes.models import ContentType import requests diff --git a/taiga/importers/pivotal/tasks.py b/taiga/importers/pivotal/tasks.py index 9435e54e..2cb87902 100644 --- a/taiga/importers/pivotal/tasks.py +++ b/taiga/importers/pivotal/tasks.py @@ -44,7 +44,7 @@ def import_project(self, user_id, token, project_id, options): "project": project_id, "exception": e } - email = mail_builder.importer_import_error(admin, ctx) + email = mail_builder.importer_import_error(user, ctx) email.send() logger.error('Error importing PivotalTracker project %s (by %s)', project_id, user, exc_info=sys.exc_info()) else: diff --git a/taiga/importers/services.py b/taiga/importers/services.py index 402120df..d2a0e50c 100644 --- a/taiga/importers/services.py +++ b/taiga/importers/services.py @@ -1,3 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Andrey Antukh +# Copyright (C) 2014-2017 Jesús Espino +# Copyright (C) 2014-2017 David Barragán +# Copyright (C) 2014-2017 Alejandro Alonso +# This program 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. +# +# This program 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 this program. If not, see . + from taiga.users.models import User diff --git a/taiga/importers/trello/api.py b/taiga/importers/trello/api.py index 21da8a1b..8cda25b7 100644 --- a/taiga/importers/trello/api.py +++ b/taiga/importers/trello/api.py @@ -25,7 +25,6 @@ from taiga.base.decorators import list_route from taiga.users.models import AuthData, User from taiga.users.services import get_user_photo_url from taiga.users.gravatar import get_user_gravatar_id -from taiga.projects.serializers import ProjectSerializer from .importer import TrelloImporter from taiga.importers import permissions