File: classImplements.patch

package info (click to toggle)
spyne 2.14.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,968 kB
  • sloc: python: 35,938; xml: 3,140; sh: 137; makefile: 135; ruby: 19
file content (44 lines) | stat: -rw-r--r-- 1,198 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Origin: https://github.com/arskom/spyne/pull/707
From: Eric Atkin <eatkin@certusllc.us>
Date: Wed, 1 May 2024 17:31:50 -0600
Subject: Use classImplements() instead of deprecated implements()

---
 spyne/client/twisted/__init__.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/spyne/client/twisted/__init__.py b/spyne/client/twisted/__init__.py
index aaf65e9c4..70a79594e 100644
--- a/spyne/client/twisted/__init__.py
+++ b/spyne/client/twisted/__init__.py
@@ -26,6 +26,8 @@
 from spyne.client import RemoteProcedureBase
 from spyne.client import ClientBase
 
+from zope.interface import classImplements
+
 from twisted.internet import reactor
 from twisted.internet.defer import Deferred
 from twisted.internet.protocol import Protocol
@@ -39,10 +41,6 @@
 
 
 class _Producer(object):
-    if six.PY2:
-        from zope.interface import implements
-        implements(IBodyProducer)
-
     _deferred = None
 
     def __init__(self, body):
@@ -84,6 +82,10 @@ def stopProducing(self):
         self.__paused = True
 
 
+if six.PY2:
+    classImplements(_Producer, IBodyProducer)
+
+
 class _Protocol(Protocol):
     def __init__(self, ctx):
         self.ctx = ctx