[asterisk-commits] Fixes to various issues reported by pyflakes (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 21 18:36:53 CST 2016


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/4619 )

Change subject: Fixes to various issues reported by pyflakes
......................................................................


Fixes to various issues reported by pyflakes

Pyflake is a python (2) source checker. This patch fixes various
(mostly trivial) errors and warnings it reports.

Change-Id: Ia35c5ac61751b927814cf693994c632c412386ea
---
M build_tools/get_documentation.py
M build_tools/post_process_documentation.py
M contrib/ast-db-manage/config/versions/4c573e7135bd_fix_tos_field_types.py
M contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py
M rest-api-templates/asterisk_processor.py
M rest-api-templates/swagger_model.py
M rest-api-templates/transform.py
7 files changed, 3 insertions(+), 10 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/build_tools/get_documentation.py b/build_tools/get_documentation.py
index 2ff4cb2..3211896 100644
--- a/build_tools/get_documentation.py
+++ b/build_tools/get_documentation.py
@@ -9,10 +9,7 @@
 '''
 
 import sys
-import os
 import xml.dom.minidom
-
-from xml.dom.minidom import Element
 
 
 def get_manager_event_method_type(candidate_string):
diff --git a/build_tools/post_process_documentation.py b/build_tools/post_process_documentation.py
index 5fa1c5b..c1496be 100644
--- a/build_tools/post_process_documentation.py
+++ b/build_tools/post_process_documentation.py
@@ -9,11 +9,9 @@
 '''
 
 import sys
-import os
 import optparse
-import xml.dom.minidom
 
-from xml.dom.minidom import Element, parse
+from xml.dom.minidom import parse
 
 
 def merge_parameter_information(managerEvent):
diff --git a/contrib/ast-db-manage/config/versions/4c573e7135bd_fix_tos_field_types.py b/contrib/ast-db-manage/config/versions/4c573e7135bd_fix_tos_field_types.py
index 27b498f..17906ae 100755
--- a/contrib/ast-db-manage/config/versions/4c573e7135bd_fix_tos_field_types.py
+++ b/contrib/ast-db-manage/config/versions/4c573e7135bd_fix_tos_field_types.py
@@ -11,7 +11,6 @@
 down_revision = '28887f25a46f'
 
 from alembic import op
-from alembic import context
 import sqlalchemy as sa
 from sqlalchemy.dialects.postgresql import ENUM
 
diff --git a/contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py b/contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py
index 01d4985..72f5ee1 100755
--- a/contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py
+++ b/contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py
@@ -33,7 +33,6 @@
 
 
 def upgrade():
-    context = op.get_context()
     # Was unable to find a way to use op.alter_column() to add the unique
     # index property.
     op.drop_column('queue_members', 'uniqueid')
diff --git a/rest-api-templates/asterisk_processor.py b/rest-api-templates/asterisk_processor.py
index 68a6799..9812946 100644
--- a/rest-api-templates/asterisk_processor.py
+++ b/rest-api-templates/asterisk_processor.py
@@ -20,6 +20,7 @@
 Asterisk RESTful HTTP binding code.
 """
 
+import os
 import re
 
 from swagger_model import *
diff --git a/rest-api-templates/swagger_model.py b/rest-api-templates/swagger_model.py
index c71352a..0885241 100644
--- a/rest-api-templates/swagger_model.py
+++ b/rest-api-templates/swagger_model.py
@@ -737,7 +737,7 @@
         self.swagger_version = resources_json.get('swaggerVersion')
         if not self.swagger_version in SWAGGER_VERSIONS:
             raise SwaggerError(
-                "Unsupported Swagger version %s" % swagger_version, context)
+                "Unsupported Swagger version %s" % self.swagger_version, context)
 
         validate_required_fields(resources_json, self.required_fields, context)
         self.api_version = resources_json['apiVersion']
diff --git a/rest-api-templates/transform.py b/rest-api-templates/transform.py
index fc12efe..c3a0300 100644
--- a/rest-api-templates/transform.py
+++ b/rest-api-templates/transform.py
@@ -52,7 +52,6 @@
         dest_exists = os.path.exists(dest_file)
         if dest_exists and not self.overwrite:
             return
-        tmp_file = tempfile.mkstemp()
         with tempfile.NamedTemporaryFile() as out:
             out.write(renderer.render(self.template, model))
             out.flush()

-- 
To view, visit https://gerrit.asterisk.org/4619
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia35c5ac61751b927814cf693994c632c412386ea
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list