From nobody Tue Feb 10 02:44:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558773604; cv=none; d=zoho.com; s=zohoarc; b=LsSs0lh3OKLxFHRiFZLEEo7Z7BwLP721UraDn92jy3oh0DTvR7E4+/qUc8gEPovv2Ow2a7pN25hEaEaItpLj6ruCPPq1qX9K1YQScND5qrEabQtbZ4lE//IVn8bdjZbRxcojd1aynIrdG7ryVTsA3dcp2ckyeVQN/vX8WSmRFhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558773604; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=roE1lsQhRTNW9CeHIa/lwKKnugJ6zDAjotn2o48wTtk=; b=VHWsied6H896jQw2BY8Bi8w2wZvFy9IFSTND6NHmt1i7XEfqLXUoEp4KwOj3L11TfBybc/4RcpH0YgVJQf+GGyyN4H5Iez1G/pdtn5EEx+iUXQXOLUEBPuY7KkGkcrCDiWooh9cb2epmbcKjS0rcnw0mHfGKYOpXb8hOIYcs/64= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558773604615610.5999124115324; Sat, 25 May 2019 01:40:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67E3A859FB; Sat, 25 May 2019 08:39:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C5BA17C2F; Sat, 25 May 2019 08:39:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 524C41806B13; Sat, 25 May 2019 08:39:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4P8dq3e022587 for ; Sat, 25 May 2019 04:39:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9A94710021B1; Sat, 25 May 2019 08:39:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 956781001F5D for ; Sat, 25 May 2019 08:39:50 +0000 (UTC) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 71E8E308213B for ; Sat, 25 May 2019 08:39:31 +0000 (UTC) Received: by mail-wr1-f45.google.com with SMTP id t4so3838065wrx.7 for ; Sat, 25 May 2019 01:39:31 -0700 (PDT) Received: from donizetti.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u15sm9569001wru.16.2019.05.25.01.39.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 May 2019 01:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+uxzyA4oNIkOmAdSuNnQPDwygP+YWCYnAMDt5x0FTD4=; b=R4OeyBdghUsX65sN2d/WT3RV1+wE8x9tIcagZRMZ7OnJ7p8ZXyn2qFPDV69lCEjwJC sSw1YTw0j7rRHEW93XaZqWkeOvgNtg5QRqvjcsGuDl2bzFzK/fQZrmisDQhYBMkJz+tJ bMRFfd+Bg4eoBuULhktqDnqNih02oLcuvGPBWQLOr7sAOosaO/DTx53OUpqdsPk67CK5 QiEHiqCLuxxeewyOiVfWgnmC5eI0MeT3opBF98eKneJ5h6/if/ukgUZMlNS4Xab7vCug BLzhxbYJVoHVJzk0eW0MJ3dvh4CwjcSeH41N9ORgBLoTn9jjNQqvdB+9v4oTggy0+TEN KkrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=+uxzyA4oNIkOmAdSuNnQPDwygP+YWCYnAMDt5x0FTD4=; b=QxsWAd347qOT6PAKzZ10AznQ8uSnvXXg+efjhiV9K6SkCeuVgrGSfm5jgLwo9Cvybx kBPIcVbUG2ZRxuBz+3RSawbXiHIe5273x8ky8ruaYmzYwe+9NUOgjfAOZdDJYqKk4dF5 WPv68Hg/T/DBJIv5ro23iOMXismXA2g+iJ9o9bRxsXI55+pGbSSDaxH9KDp5bJe/XfUx cgFpZ94tULnGXNnF3liW3gFtJojKfTfT1SWmjKWd1hEQ75kqB0fOu9gZCQNNY/YzdyaQ SDVM54eXRbei78oMF5oXbCQEmYA84rbfzoRtVE0Gg5PiKAqQFeN0kRIs+K/fgqO6Jex5 z3xg== X-Gm-Message-State: APjAAAUvqmOcQFv9N/umLKc3mQRH+/Z4hFrFtj/s4sezlg8Yp7Cw29NI T3JQgnOim3lsI81wyQU/X4f6MPq/ X-Google-Smtp-Source: APXvYqyFq0Q2eAtIAR4W7W3+pxKU1leJrBwRM12hq9I5qe7pMR1GM1hIQb3xUVArIrQGVEIFEGaZSw== X-Received: by 2002:a5d:4988:: with SMTP id r8mr2834442wrq.57.1558773569853; Sat, 25 May 2019 01:39:29 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Sat, 25 May 2019 10:39:24 +0200 Message-Id: <20190525083927.8277-2-pbonzini@redhat.com> In-Reply-To: <20190525083927.8277-1-pbonzini@redhat.com> References: <20190525083927.8277-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 25 May 2019 08:39:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 25 May 2019 08:39:31 +0000 (UTC) for IP:'209.85.221.45' DOMAIN:'mail-wr1-f45.google.com' HELO:'mail-wr1-f45.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.191 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.221.45 mail-wr1-f45.google.com 209.85.221.45 mail-wr1-f45.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 1/4] modules: do not use "import *" X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 25 May 2019 08:39:58 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" import * prevents static analysis of undefined symbols, drop it. Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- mod.py | 16 ++++++++-------- mods/email.py | 30 +++++++++++++++--------------- mods/git.py | 10 +++++----- mods/testing.py | 22 +++++++++++----------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/mod.py b/mod.py index a7ba7e2..d47745c 100644 --- a/mod.py +++ b/mod.py @@ -15,7 +15,7 @@ from django.conf import settings from django.template import Template, Context import traceback import configparser -from schema import * +import schema =20 class PatchewModule(object): """ Module base class """ @@ -103,22 +103,22 @@ class PatchewModule(object): value=3Dconfig) =20 def _build_one(self, request, project, prefix, config, scm): - if type(scm) =3D=3D MapSchema: + if type(scm) =3D=3D schema.MapSchema: return self._build_map_scm(request, project, prefix, config, s= cm) - elif type(scm) =3D=3D StringSchema: + elif type(scm) =3D=3D schema.StringSchema: return self._build_string_scm(request, project, prefix, config= , scm) - elif type(scm) =3D=3D IntegerSchema: + elif type(scm) =3D=3D schema.IntegerSchema: return self._build_integer_scm(request, project, prefix, confi= g, scm) - elif type(scm) =3D=3D BooleanSchema: + elif type(scm) =3D=3D schema.BooleanSchema: return self._build_boolean_scm(request, project, prefix, confi= g, scm) - elif type(scm) =3D=3D EnumSchema: + elif type(scm) =3D=3D schema.EnumSchema: return self._build_enum_scm(request, project, prefix, config, = scm) - elif type(scm) =3D=3D ArraySchema: + elif type(scm) =3D=3D schema.ArraySchema: return self._build_array_scm(request, project, prefix, config,= scm) assert False =20 def build_config_html(self, request, project): - assert isinstance(self.project_config_schema, ArraySchema) + assert isinstance(self.project_config_schema, schema.ArraySchema) scm =3D self.project_config_schema config =3D self.get_project_config(project) return self._build_one(request, project, scm.name, config, scm) diff --git a/mods/email.py b/mods/email.py index 175af9d..e95fbe9 100644 --- a/mods/email.py +++ b/mods/email.py @@ -21,7 +21,7 @@ import email.utils import uuid from api.models import Message, Project from event import register_handler, get_events_info -from schema import * +import schema =20 _default_config =3D """ [smtp] @@ -52,46 +52,46 @@ Email information is configured in "INI" style: default_config =3D _default_config =20 email_schema =3D \ - ArraySchema("{name}", "Email Notification", + schema.ArraySchema("{name}", "Email Notification", desc=3D"Email notification", members=3D[ - EnumSchema("event", "Event", + schema.EnumSchema("event", "Event", enums=3Dlambda: get_events_info(), required=3DTrue, desc=3D"Which event to trigger the emai= l notification"), - BooleanSchema("enabled", "Enabled", + schema.BooleanSchema("enabled", "Enabled", desc=3D"Whether this event is enable= d", default=3DTrue), - BooleanSchema("reply_to_all", "Reply to all", + schema.BooleanSchema("reply_to_all", "Reply to all= ", desc=3D'If set, Cc all the receipien= ts of the email message associated to the event. Also, if set the original = sender of the email message will be a recipient even if the "to" field is n= onempty', default=3DFalse), - BooleanSchema("in_reply_to", "Set In-Reply-To", + schema.BooleanSchema("in_reply_to", "Set In-Reply-= To", desc=3D'Whether to set In-Reply-To t= o the message id, if the event has an associated email message', default=3DTrue), - BooleanSchema("set_reply_to", "Set Reply-To", + schema.BooleanSchema("set_reply_to", "Set Reply-To= ", desc=3D'Whether to set Reply-To to t= he project mailing list, if the event has an associated email message', default=3DTrue), - BooleanSchema("reply_subject", "Set replying subje= ct", + schema.BooleanSchema("reply_subject", "Set replyin= g subject", desc=3D'Whether to set Subject to "R= e: xxx", if the event has an associated email message', default=3DTrue), - BooleanSchema("to_user", "Send to user", + schema.BooleanSchema("to_user", "Send to user", desc=3D'Whether to set To to a user = email, if the event has an associated user', default=3DFalse), - StringSchema("to", "To", desc=3D"Send email to"), - StringSchema("cc", "Cc", desc=3D"Cc list"), - StringSchema("subject_template", "Subject template= ", + schema.StringSchema("to", "To", desc=3D"Send email= to"), + schema.StringSchema("cc", "Cc", desc=3D"Cc list"), + schema.StringSchema("subject_template", "Subject t= emplate", desc=3D"""The django template for sub= ject""", required=3DTrue), - StringSchema("body_template", "Body template", + schema.StringSchema("body_template", "Body templat= e", desc=3D"The django template for email= body.", multiline=3DTrue, required=3DTrue), ]) =20 project_config_schema =3D \ - ArraySchema("email", desc=3D"Configuration for email module", + schema.ArraySchema("email", desc=3D"Configuration for email module= ", members=3D[ - MapSchema("notifications", "Email notifications", + schema.MapSchema("notifications", "Email notificat= ions", desc=3D"Email notifications", item=3Demail_schema), ]) diff --git a/mods/git.py b/mods/git.py index 78939b8..753da7e 100644 --- a/mods/git.py +++ b/mods/git.py @@ -25,7 +25,7 @@ from api.models import (Message, Project, Result) from api.rest import PluginMethodField, SeriesSerializer, reverse_detail from api.views import APILoginRequiredView, prepare_series from patchew.logviewer import LogView -from schema import * +import schema from rest_framework import generics, mixins, serializers from rest_framework.fields import CharField, SerializerMethodField =20 @@ -64,14 +64,14 @@ class GitModule(PatchewModule): result_data_serializer_class =3D ResultDataSerializer =20 project_config_schema =3D \ - ArraySchema("git", desc=3D"Configuration for git module", + schema.ArraySchema("git", desc=3D"Configuration for git module", members=3D[ - StringSchema("push_to", "Push remote", + schema.StringSchema("push_to", "Push remote", desc=3D"Remote to push to", required=3DTrue), - StringSchema("public_repo", "Public repo", + schema.StringSchema("public_repo", "Public repo", desc=3D"Publicly visible repo URL"), - StringSchema("url_template", "URL template", + schema.StringSchema("url_template", "URL template", desc=3D"Publicly visible URL template= for applied branch, where %t will be replaced by the applied tag name", required=3DTrue), ]) diff --git a/mods/testing.py b/mods/testing.py index 90bb2be..cece418 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -24,7 +24,7 @@ from api.rest import PluginMethodField, TestPermission, r= everse_detail from api.search import SearchEngine from event import emit_event, declare_event, register_handler from patchew.logviewer import LogView -from schema import * +import schema from rest_framework import serializers, generics from rest_framework.fields import CharField, BooleanField from rest_framework.response import Response @@ -64,17 +64,17 @@ class TestingModule(PatchewModule): result_data_serializer_class =3D ResultDataSerializer =20 test_schema =3D \ - ArraySchema("{name}", "Test", desc=3D"Test spec", + schema.ArraySchema("{name}", "Test", desc=3D"Test spec", members=3D[ - BooleanSchema("enabled", "Enabled", + schema.BooleanSchema("enabled", "Enabled", desc=3D"Whether this test is enabled= ", default=3DTrue), - StringSchema("requirements", "Requirements", + schema.StringSchema("requirements", "Requirements", desc=3D"List of requirements of the t= est"), - IntegerSchema("timeout", "Timeout", + schema.IntegerSchema("timeout", "Timeout", default=3D3600, desc=3D"Timeout for the test"), - StringSchema("script", "Test script", + schema.StringSchema("script", "Test script", desc=3D"The testing script", default=3DTESTING_SCRIPT_DEFAULT, multiline=3DTrue, @@ -82,9 +82,9 @@ class TestingModule(PatchewModule): ]) =20 requirement_schema =3D \ - ArraySchema("{name}", "Requirement", desc=3D"Test requirement spec= ", + schema.ArraySchema("{name}", "Requirement", desc=3D"Test requireme= nt spec", members=3D[ - StringSchema("script", "Probe script", + schema.StringSchema("script", "Probe script", desc=3D"The probing script for this r= equirement", default=3D"#!/bin/bash\ntrue", multiline=3DTrue, @@ -92,12 +92,12 @@ class TestingModule(PatchewModule): ]) =20 project_config_schema =3D \ - ArraySchema("testing", desc=3D"Configuration for testing module", + schema.ArraySchema("testing", desc=3D"Configuration for testing mo= dule", members=3D[ - MapSchema("tests", "Tests", + schema.MapSchema("tests", "Tests", desc=3D"Testing specs", item=3Dtest_schema), - MapSchema("requirements", "Requirements", + schema.MapSchema("requirements", "Requirements", desc=3D"Requirement specs", item=3Drequirement_schema), ]) --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel