[elbe-devel] [PATCH 19/25] py3: annotations - use func instead of func.func
Manuel Traut
manut at linutronix.de
Fri Dec 1 16:51:16 CET 2017
func.func is not available in py3 but using only
func works in py2 and py3.
I don't have an idea, why func.func was used.
Signed-off-by: Manuel Traut <manut at linutronix.de>
---
elbepack/daemons/soap/authentication.py | 22 +++++++++++-----------
elbepack/daemons/soap/faults.py | 16 ++++++++--------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/elbepack/daemons/soap/authentication.py b/elbepack/daemons/soap/authentication.py
index 65c6cf89..08909c71 100644
--- a/elbepack/daemons/soap/authentication.py
+++ b/elbepack/daemons/soap/authentication.py
@@ -32,7 +32,7 @@ def authenticated_uid(func):
@authenticated_uid
def get_files (self, uid, builddir):
"""
- if func.func_code.co_argcount == 2:
+ if func.__code__.co_argcount == 2:
@wraps(func)
def wrapped(self):
s = self.transport.req_env['beaker.session']
@@ -43,7 +43,7 @@ def authenticated_uid(func):
return func(self,uid)
return wrapped
- elif func.func_code.co_argcount == 3:
+ elif func.__code__.co_argcount == 3:
@wraps(func)
def wrapped(self, arg1):
s = self.transport.req_env['beaker.session']
@@ -54,7 +54,7 @@ def authenticated_uid(func):
return func(self,uid,arg1)
return wrapped
- elif func.func_code.co_argcount == 4:
+ elif func.__code__.co_argcount == 4:
@wraps(func)
def wrapped(self, arg1, arg2):
s = self.transport.req_env['beaker.session']
@@ -65,7 +65,7 @@ def authenticated_uid(func):
return func(self,uid,arg1,arg2)
return wrapped
- elif func.func_code.co_argcount == 5:
+ elif func.__code__.co_argcount == 5:
@wraps(func)
def wrapped(self, arg1, arg2, arg3):
s = self.transport.req_env['beaker.session']
@@ -76,7 +76,7 @@ def authenticated_uid(func):
return func(self,uid,arg1,arg2,arg3)
return wrapped
- elif func.func_code.co_argcount == 6:
+ elif func.__code__.co_argcount == 6:
@wraps(func)
def wrapped(self, arg1, arg2, arg3, arg4):
s = self.transport.req_env['beaker.session']
@@ -87,7 +87,7 @@ def authenticated_uid(func):
return func(self,uid,arg1,arg2,arg3,arg4)
return wrapped
- elif func.func_code.co_argcount == 7:
+ elif func.__code__.co_argcount == 7:
@wraps(func)
def wrapped(self, arg1, arg2, arg3, arg4, arg5):
s = self.transport.req_env['beaker.session']
@@ -99,7 +99,7 @@ def authenticated_uid(func):
return func(self,uid,arg1,arg2,arg3,arg4,arg5)
return wrapped
else:
- raise Exception( "arg count %d not implemented" % func.func_code.co_argcount )
+ raise Exception( "arg count %d not implemented" % func.__code__.co_argcount )
@@ -114,7 +114,7 @@ def authenticated_admin(func):
@authenticated_uid
def get_files (self, uid, builddir):
"""
- if func.func_code.co_argcount == 1:
+ if func.__code__.co_argcount == 1:
@wraps(func)
def wrapped(self):
s = self.transport.req_env['beaker.session']
@@ -127,7 +127,7 @@ def authenticated_admin(func):
raise SoapElbeNotAuthorized()
return func(self)
return wrapped
- elif func.func_code.co_argcount == 2:
+ elif func.__code__.co_argcount == 2:
@wraps(func)
def wrapped(self, arg1):
s = self.transport.req_env['beaker.session']
@@ -141,7 +141,7 @@ def authenticated_admin(func):
return func(self,arg1)
return wrapped
- elif func.func_code.co_argcount == 3:
+ elif func.__code__.co_argcount == 3:
@wraps(func)
def wrapped(self, arg1, arg2):
s = self.transport.req_env['beaker.session']
@@ -155,4 +155,4 @@ def authenticated_admin(func):
return func(self,arg1,arg2)
return wrapped
else:
- raise Exception( "arg count %d not implemented" % func.func_code.co_argcount )
+ raise Exception( "arg count %d not implemented" % func.__code__.co_argcount )
diff --git a/elbepack/daemons/soap/faults.py b/elbepack/daemons/soap/faults.py
index 54a1affe..3a0e64c0 100644
--- a/elbepack/daemons/soap/faults.py
+++ b/elbepack/daemons/soap/faults.py
@@ -71,7 +71,7 @@ def soap_faults(func):
""" decorator, which wraps Exceptions to the proper
Soap Faults, and raises these.
"""
- if func.func_code.co_argcount == 1:
+ if func.__code__.co_argcount == 1:
@wraps(func)
def wrapped(self):
try:
@@ -91,7 +91,7 @@ def soap_faults(func):
except Exception as e:
raise SoapElbeProjectError (format_exc ())
return wrapped
- if func.func_code.co_argcount == 2:
+ if func.__code__.co_argcount == 2:
@wraps (func)
def wrapped (self, arg1):
try:
@@ -111,7 +111,7 @@ def soap_faults(func):
except Exception as e:
raise SoapElbeProjectError (format_exc ())
return wrapped
- if func.func_code.co_argcount == 3:
+ if func.__code__.co_argcount == 3:
@wraps (func)
def wrapped (self, arg1, arg2):
try:
@@ -131,7 +131,7 @@ def soap_faults(func):
except Exception as e:
raise SoapElbeProjectError (format_exc ())
return wrapped
- if func.func_code.co_argcount == 4:
+ if func.__code__.co_argcount == 4:
@wraps (func)
def wrapped (self, arg1, arg2, arg3):
try:
@@ -151,7 +151,7 @@ def soap_faults(func):
except Exception as e:
raise SoapElbeProjectError (format_exc ())
return wrapped
- if func.func_code.co_argcount == 5:
+ if func.__code__.co_argcount == 5:
@wraps (func)
def wrapped (self, arg1, arg2, arg3, arg4):
try:
@@ -171,7 +171,7 @@ def soap_faults(func):
except Exception as e:
raise SoapElbeProjectError (format_exc ())
return wrapped
- if func.func_code.co_argcount == 6:
+ if func.__code__.co_argcount == 6:
@wraps (func)
def wrapped (self, arg1, arg2, arg3, arg4, arg5):
try:
@@ -191,7 +191,7 @@ def soap_faults(func):
except Exception as e:
raise SoapElbeProjectError (format_exc ())
return wrapped
- if func.func_code.co_argcount == 7:
+ if func.__code__.co_argcount == 7:
@wraps (func)
def wrapped (self, arg1, arg2, arg3, arg4, arg5, arg6):
try:
@@ -212,5 +212,5 @@ def soap_faults(func):
raise SoapElbeProjectError (format_exc ())
return wrapped
else:
- raise Exception( "arg count %d not implemented" % func.func_code.co_argcount )
+ raise Exception( "arg count %d not implemented" % func.__code__.co_argcount )
--
2.15.1
More information about the elbe-devel
mailing list