From 343afe6e4bec68c0ff02f871b2e991445e93ea16 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sun, 6 May 2018 16:15:41 +0200 Subject: [PATCH] Fix undefined names --- qpid/connection08.py | 9 +++++++-- qpid/datatypes.py | 2 +- qpid/debug.py | 5 ++--- qpid/framer.py | 1 + qpid/managementdata.py | 2 +- qpid/packer.py | 9 +++++++-- qpid/saslmech/scram.py | 2 +- qpid/spec08.py | 2 +- qpid/tests/__init__.py | 2 +- qpid_tests/broker_0_10/management.py | 2 +- 10 files changed, 23 insertions(+), 13 deletions(-) diff --git a/qpid/connection08.py b/qpid/connection08.py index 54d7f88e..5e0e91b7 100644 --- a/qpid/connection08.py +++ b/qpid/connection08.py @@ -24,6 +24,7 @@ """ import socket, codec, errno, qpid +from abc import abstractmethod from cStringIO import StringIO from codec import EOF from compat import SHUT_RDWR @@ -335,9 +336,13 @@ def init(self, args, kwargs): self.bof = True self.eof = True - def encode(self, enc): abstract + @abstractmethod + def encode(self, enc): + pass - def decode(spec, dec, size): abstract + @abstractmethod + def decode(spec, dec, size): + pass class Method(Frame): diff --git a/qpid/datatypes.py b/qpid/datatypes.py index ca1466c2..667bd032 100644 --- a/qpid/datatypes.py +++ b/qpid/datatypes.py @@ -292,7 +292,7 @@ def is_set(self): class UUID: def __init__(self, hex=None, bytes=None): if [hex, bytes].count(None) != 1: - raise TypeErrror("need one of hex or bytes") + raise TypeError("need one of hex or bytes") if bytes is not None: self.bytes = bytes elif hex is not None: diff --git a/qpid/debug.py b/qpid/debug.py index b5dbd4d9..6c64e43c 100644 --- a/qpid/debug.py +++ b/qpid/debug.py @@ -40,10 +40,10 @@ def acquire(self, blocking=1): while not self.lock.acquire(blocking=0): time.sleep(1) print >> sys.out, "TRYING" - traceback.print_stack(None, None, out) + traceback.print_stack(None, None, sys.out) print >> sys.out, "TRYING" print >> sys.out, "ACQUIRED" - traceback.print_stack(None, None, out) + traceback.print_stack(None, None, sys.out) print >> sys.out, "ACQUIRED" return True @@ -52,4 +52,3 @@ def _is_owned(self): def release(self): self.lock.release() - diff --git a/qpid/framer.py b/qpid/framer.py index 08e17228..b701e977 100644 --- a/qpid/framer.py +++ b/qpid/framer.py @@ -22,6 +22,7 @@ from packer import Packer from threading import RLock from logging import getLogger +from qpid.sasl import SASLError raw = getLogger("qpid.io.raw") frm = getLogger("qpid.io.frm") diff --git a/qpid/managementdata.py b/qpid/managementdata.py index 61cb10c1..f62dce18 100644 --- a/qpid/managementdata.py +++ b/qpid/managementdata.py @@ -750,7 +750,7 @@ def do_schema (self, data): def do_call (self, data): encTokens = data.split () try: - tokens = [a.decode(locale.getpreferredencoding()) for a in encArgs] + tokens = [a.decode(locale.getpreferredencoding()) for a in encTokens] except: tokens = encTokens if len (tokens) < 2: diff --git a/qpid/packer.py b/qpid/packer.py index 22c16918..40f35c7b 100644 --- a/qpid/packer.py +++ b/qpid/packer.py @@ -18,12 +18,17 @@ # import struct +from abc import abstractmethod class Packer: - def read(self, n): abstract + @abstractmethod + def read(self, n): + pass - def write(self, s): abstract + @abstractmethod + def write(self, s): + pass def unpack(self, fmt): values = struct.unpack(fmt, self.read(struct.calcsize(fmt))) diff --git a/qpid/saslmech/scram.py b/qpid/saslmech/scram.py index 11a2d2fb..c57d308d 100644 --- a/qpid/saslmech/scram.py +++ b/qpid/saslmech/scram.py @@ -19,7 +19,7 @@ from hmac import HMAC from binascii import b2a_hex -from sasl import Sasl +from sasl import Sasl, SaslException import os import base64 diff --git a/qpid/spec08.py b/qpid/spec08.py index a0047e71..84abd2d1 100644 --- a/qpid/spec08.py +++ b/qpid/spec08.py @@ -475,7 +475,7 @@ def find_rules(node, rules): def load_rules(specfile): rules = [] - find_rules(xmlutil.parse(specfile), rules) + find_rules(mllib.xml_parse(specfile), rules) return rules def test_summary(): diff --git a/qpid/tests/__init__.py b/qpid/tests/__init__.py index 85ab013b..c54ab012 100644 --- a/qpid/tests/__init__.py +++ b/qpid/tests/__init__.py @@ -59,4 +59,4 @@ def testQux(self): def testQuxFail(self): import sys sys.stdout.write("this test has output with no newline") - fdsa + fdsa # noqa It is supposed to fail diff --git a/qpid_tests/broker_0_10/management.py b/qpid_tests/broker_0_10/management.py index 75183929..ed90a027 100644 --- a/qpid_tests/broker_0_10/management.py +++ b/qpid_tests/broker_0_10/management.py @@ -20,6 +20,7 @@ from qpid.datatypes import Message, RangedSet from qpid.testlib import TestBase010 from qpid.management import managementChannel, managementClient +from qpid.queue import Empty from threading import Condition from time import sleep import qmf.console @@ -723,4 +724,3 @@ def test_timestamp_config(self): assert(False) self.assertEqual("def", msg.content) self.assertEqual(False, "x-amqp-0-10.timestamp" in msg.properties) -