trivial: apply isort/pyupgrade
This commit is contained in:
parent
1d4c0a7ff5
commit
f2a6104d56
|
@ -1,6 +1,6 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Project, Platform, Service, InstalledService, Module
|
||||
from .models import InstalledService, Module, Platform, Project, Service
|
||||
|
||||
|
||||
class ProjectAdmin(admin.ModelAdmin):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from scrutiny.projects.models import Module
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import multiprocessing
|
||||
import multiprocessing.pool
|
||||
import requests
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
import django.utils.timezone
|
||||
import requests
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from scrutiny.projects.models import InstalledService, Module, Version, InstalledVersion
|
||||
from scrutiny.projects.models import InstalledService, InstalledVersion, Module, Version
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
@ -32,7 +32,7 @@ class Command(BaseCommand):
|
|||
print('Non-JSON response for %s' % service.url)
|
||||
return
|
||||
|
||||
current_modules = set([x for x in service.service.get_modules(platforms=[service.platform])])
|
||||
current_modules = {x for x in service.service.get_modules(platforms=[service.platform])}
|
||||
seen_modules = set()
|
||||
|
||||
for module_name, version_string in versions.items():
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import redmine
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
import redmine
|
||||
from redmine import Redmine
|
||||
|
||||
from scrutiny.projects.models import Module
|
||||
|
@ -19,9 +16,9 @@ class Command(BaseCommand):
|
|||
DEPLOYED_ID = None
|
||||
|
||||
for issue_status in redmine_server.issue_status.all():
|
||||
if issue_status.name == u'Résolu (à déployer)':
|
||||
if issue_status.name == 'Résolu (à déployer)':
|
||||
RESOLVED_ID = issue_status.id
|
||||
elif issue_status.name == u'Solution déployée':
|
||||
elif issue_status.name == 'Solution déployée':
|
||||
DEPLOYED_ID = issue_status.id
|
||||
|
||||
for module in Module.objects.all():
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.29 on 2020-12-16 14:35
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from .views import (
|
||||
IssuesSnippet,
|
||||
ModuleDeploymentsView,
|
||||
ModuleDiffView,
|
||||
ModuleIssuesView,
|
||||
ModulesView,
|
||||
ProjectDetailView,
|
||||
ProjectSummaryHistoryView,
|
||||
ProjectHistoryView,
|
||||
ModuleDiffView,
|
||||
IssuesSnippet,
|
||||
ModuleIssuesView,
|
||||
ModuleDeploymentsView,
|
||||
module_deployments_json,
|
||||
ProjectSummaryHistoryView,
|
||||
api_issues_json,
|
||||
module_deployments_json,
|
||||
)
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^modules/$', ModulesView.as_view(), name='modules-list'),
|
||||
url(r'^(?P<slug>[\w,-]+)/$', ProjectDetailView.as_view(), name='project-view'),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import re
|
||||
import requests
|
||||
|
||||
import requests
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from django.utils.encoding import force_text
|
||||
|
@ -17,7 +17,7 @@ def decorate_commit_line(line):
|
|||
return '<span class="other">%s</span>' % escaped_line
|
||||
|
||||
|
||||
class Issue(object):
|
||||
class Issue:
|
||||
def __init__(self, issue_id):
|
||||
self.id = issue_id
|
||||
self.commits = []
|
||||
|
@ -65,7 +65,7 @@ class Issue(object):
|
|||
self.commits.append(commit)
|
||||
|
||||
|
||||
class CommitAndIssues(object):
|
||||
class CommitAndIssues:
|
||||
def __init__(self, oneline):
|
||||
self.issues = []
|
||||
self.commit = oneline.strip()
|
||||
|
@ -91,7 +91,7 @@ class CommitAndIssues(object):
|
|||
|
||||
|
||||
def get_issue_deployment_status(issue_id):
|
||||
from .models import Module, InstalledService
|
||||
from .models import InstalledService, Module
|
||||
|
||||
data = {}
|
||||
for module in Module.objects.all():
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.views.decorators.csrf import csrf_exempt
|
|||
from django.views.generic.base import TemplateView
|
||||
from django.views.generic.detail import DetailView
|
||||
|
||||
from .models import Project, InstalledService, Module, InstalledVersion
|
||||
from .models import InstalledService, InstalledVersion, Module, Project
|
||||
from .utils import CommitAndIssues, decorate_commit_line, get_issue_deployment_status
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ class ProjectDetailView(DetailView):
|
|||
model = Project
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ProjectDetailView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
platforms = self.object.platform_set.all()
|
||||
services = self.object.service_set.all()
|
||||
|
@ -31,7 +31,7 @@ class ModuleDiffView(TemplateView):
|
|||
template_name = 'projects/diff.html'
|
||||
|
||||
def get_context_data(self, name, commit1, commit2, **kwargs):
|
||||
context = super(ModuleDiffView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['module'] = Module.objects.get(name=name)
|
||||
context['commit1'] = commit1
|
||||
context['commit2'] = commit2
|
||||
|
@ -50,7 +50,7 @@ class ModuleIssuesView(TemplateView):
|
|||
template_name = 'projects/issues.html'
|
||||
|
||||
def get_context_data(self, name, commit1, commit2, **kwargs):
|
||||
context = super(ModuleIssuesView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['module'] = Module.objects.get(name=name)
|
||||
context['commit1'] = commit1
|
||||
context['commit2'] = commit2
|
||||
|
@ -76,7 +76,7 @@ class ProjectHistoryView(DetailView):
|
|||
template_name_suffix = '_history'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ProjectHistoryView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
installed_versions = InstalledVersion.objects.filter(service__platform__project=self.object).order_by(
|
||||
'-timestamp'
|
||||
|
@ -110,7 +110,7 @@ class ProjectSummaryHistoryView(DetailView):
|
|||
]
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ProjectSummaryHistoryView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
platforms = list(self.get_object().platform_set.all())
|
||||
platform = platforms[-1]
|
||||
|
@ -192,7 +192,7 @@ class ModulesView(TemplateView):
|
|||
template_name = 'projects/modules.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ModulesView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['modules'] = Module.objects.all().order_by('name')
|
||||
return context
|
||||
|
||||
|
@ -215,7 +215,7 @@ class ModuleDeploymentsView(TemplateView):
|
|||
template_name = 'projects/deployments.html'
|
||||
|
||||
def get_context_data(self, name, **kwargs):
|
||||
context = super(ModuleDeploymentsView, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['versions'] = []
|
||||
context['module'] = Module.objects.get(name=name)
|
||||
module = context['module']
|
||||
|
@ -258,13 +258,13 @@ class IssuesSnippet(TemplateView):
|
|||
|
||||
@csrf_exempt
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(IssuesSnippet, self).dispatch(*args, **kwargs)
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
return self.get(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(IssuesSnippet, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
modules = json.loads(self.request.read().decode('utf-8'))
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Django settings for scrutiny project.
|
||||
|
||||
import os
|
||||
|
||||
from django.conf import global_settings
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
|
|
|
@ -8,7 +8,6 @@ from django.views.generic.base import TemplateView
|
|||
|
||||
from .projects.models import Project
|
||||
|
||||
|
||||
if 'mellon' in settings.INSTALLED_APPS:
|
||||
from mellon.utils import get_idps
|
||||
else:
|
||||
|
@ -38,7 +37,7 @@ class Home(TemplateView):
|
|||
template_name = 'scrutiny/home.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(Home, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['projects'] = Project.objects.all()
|
||||
return context
|
||||
|
||||
|
|
7
setup.py
7
setup.py
|
@ -1,9 +1,10 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from distutils.command.sdist import sdist
|
||||
import os
|
||||
import subprocess
|
||||
from distutils.command.sdist import sdist
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
|
||||
class eo_sdist(sdist):
|
||||
|
@ -24,7 +25,7 @@ def get_version():
|
|||
tag exists, take 0.0- and add the length of the commit log.
|
||||
"""
|
||||
if os.path.exists('VERSION'):
|
||||
with open('VERSION', 'r') as v:
|
||||
with open('VERSION') as v:
|
||||
return v.read()
|
||||
if os.path.exists('.git'):
|
||||
p = subprocess.Popen(
|
||||
|
|
Loading…
Reference in New Issue