# HG changeset patch # User Sandro Knauß # Date 1744672787 -7200 # Node ID 42fd5075a5d1c24690b7a67443e33170c0dcc953 # Parent 81916344c63b9736b71d192dc5004a9a59ed1733 2to3 diff -r 81916344c63b -r 42fd5075a5d1 createdoc.py --- a/createdoc.py Wed Jun 21 00:52:38 2023 +0200 +++ b/createdoc.py Tue Apr 15 01:19:47 2025 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # Copyright (c) 2012 netzguerilla.net # @@ -38,7 +38,7 @@ from docutils.utils import new_document from docutils.writers.html4css1 import Writer,HTMLTranslator -from iro.view.xmlrpc import TwistedInterface as Current +from iro.view.xmlrpc import TwistedInterface as Current from iro import __version__ from createerm import createSchemaPlot, tables, tables_cls @@ -100,10 +100,10 @@ def keywords(f): NORMAL = 0 TYPE = 1 - pd = publish_doctree(f.__doc__.decode('utf8')) + pd = publish_doctree(f.__doc__) kws={} - for child in pd[1][0]: + for child in pd[1]: kw = Keyword() ftyp = NORMAL for sc in child: @@ -124,7 +124,7 @@ raise Exception("Unknown field_name: %s"%(p[0])) if sc.tagname == "field_body": if ftyp == NORMAL: - kw.description = Markup(reSTify(sc[0])) + kw.description = Markup(reSTify(sc[0]).decode()) if ftyp == TYPE: kw.typ = sc[0][0] else: @@ -134,9 +134,9 @@ def ret(f): NORMAL = 0 TYPE = 1 - - pd = publish_doctree(f.__doc__.decode('utf8')) - for child in pd[1][0]: + + pd = publish_doctree(f.__doc__) + for child in pd[1]: kw = Keyword(name="return") ftyp = NORMAL for sc in child: @@ -153,9 +153,7 @@ raise Exception("Unknown field_name: %s"%(p[0])) if sc.tagname == "field_body": if ftyp == NORMAL: - kw.description = Markup(reSTify(sc[0])) - if ftyp == TYPE: - kw.typ = sc[0][0] + kw.description = Markup(reSTify(sc[0]).decode()) else: return kw @@ -174,20 +172,22 @@ title=name[0].upper()+name[1:] Link.__init__(self,name,title) m=methods[name] - (args, varargs, keywords, defaults)=inspect.getargspec(m) - a=[] - for b in args: - if b in ("self","session"): - continue - else: - a.append(b) - - args = a - self.func_line=inspect.formatargspec(args, varargs, keywords, defaults) + + signature=inspect.signature(m) + + parameters = signature.parameters.copy() + + for arg in ("self", "session"): + try: + del(parameters[arg]) + except KeyError: + pass + + self.func_line=str(signature.replace(parameters=parameters.values())) pd = publish_doctree(m.__doc__) if pd[0].tagname == "paragraph": self.description = pd[0].astext() - self.args=[Arg(a,m) for a in args] + self.args=[Arg(a,m) for a in parameters] self.rets=[ret(m)] class Table(Link): @@ -197,7 +197,7 @@ title=self.tablename[0].upper()+self.tablename[1:] Link.__init__(self,name,title) - self.description = Markup(publish_string(cls.__doc__,writer=_w)) + self.description = Markup(publish_string(cls.__doc__,writer=_w).decode()) class File: def __init__(self,path): diff -r 81916344c63b -r 42fd5075a5d1 iro/config.py --- a/iro/config.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/config.py Tue Apr 15 01:19:47 2025 +0200 @@ -22,7 +22,7 @@ from twisted.python import log import os.path -from ConfigParser import ConfigParser +from configparser import ConfigParser import signal from functools import partial try: @@ -30,8 +30,8 @@ except ImportError: from ordereddict import OrderedDict -from validate import vInteger -from error import NeededOption +from .validate import vInteger +from .error import NeededOption class MyConfigParser(ConfigParser): """Configparser that also validate configfile. diff -r 81916344c63b -r 42fd5075a5d1 iro/model/__init__.py --- a/iro/model/__init__.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/model/__init__.py Tue Apr 15 01:19:47 2025 +0200 @@ -24,11 +24,11 @@ before using the model, you have to use, you have to set the Engine with :func:`dbdefer.setEngine` and set the Threadpool with :func:`dbdefer.setPool` (see :func:`iro.main.runReactor` for initalizing this module). """ -import schema -import user -import utils -import job -import offer +from . import schema +from . import user +from . import utils +from . import job +from . import offer -from dbdefer import setEngine -from pool import setPool +from .dbdefer import setEngine +from .pool import setPool diff -r 81916344c63b -r 42fd5075a5d1 iro/model/dbdefer.py --- a/iro/model/dbdefer.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/model/dbdefer.py Tue Apr 15 01:19:47 2025 +0200 @@ -59,9 +59,9 @@ return func(*al, **kw) caller=func - argspec = inspect.getargspec(caller) + argspec = inspect.getfullargspec(caller) args =[i for i in argspec.args if i != "session" ] - sargs=", ".join(args) + sargs=", ".join(args) if sargs: sargs+=", session" else: @@ -71,7 +71,7 @@ defaults = (None,) else: defaults += (None,) - evaldict = caller.func_globals.copy() + evaldict = caller.__globals__.copy() evaldict['_call_'] = func evaldict['decorator'] = wrapper wrap = FunctionMaker.create( diff -r 81916344c63b -r 42fd5075a5d1 iro/model/job.py --- a/iro/model/job.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/model/job.py Tue Apr 15 01:19:47 2025 +0200 @@ -22,10 +22,10 @@ from twisted.python import log, threadable from datetime import datetime -from collections import MutableMapping +from collections.abc import MutableMapping -import schema -import offer +from . import schema +from . import offer from .dbdefer import dbdefer class ExJob: diff -r 81916344c63b -r 42fd5075a5d1 iro/model/message.py --- a/iro/model/message.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/model/message.py Tue Apr 15 01:19:47 2025 +0200 @@ -24,7 +24,7 @@ """ from email.mime.text import MIMEText from email.header import Header -from email.Utils import formatdate +from email.utils import formatdate class Message: """ Baseclass for all different message typs.""" diff -r 81916344c63b -r 42fd5075a5d1 iro/model/offer.py --- a/iro/model/offer.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/model/offer.py Tue Apr 15 01:19:47 2025 +0200 @@ -21,7 +21,7 @@ from .dbdefer import dbdefer -import schema +from . import schema from ..config import configParser from ..offer import getProvider, Offer diff -r 81916344c63b -r 42fd5075a5d1 iro/model/schema.py --- a/iro/model/schema.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/model/schema.py Tue Apr 15 01:19:47 2025 +0200 @@ -32,7 +32,7 @@ from sqlalchemy.orm.exc import DetachedInstanceError import sqlalchemy.sql.functions as func -import job +from . import job from ..error import JobNotFound Base = declarative_base() diff -r 81916344c63b -r 42fd5075a5d1 iro/offer/sipgate.py --- a/iro/offer/sipgate.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/offer/sipgate.py Tue Apr 15 01:19:47 2025 +0200 @@ -21,7 +21,7 @@ from functools import partial from twisted.web.xmlrpc import Proxy -import xmlrpclib +import xmlrpc.client as xmlrpclib from decimal import Decimal from .provider import providers, Provider diff -r 81916344c63b -r 42fd5075a5d1 iro/offer/smstrade.py --- a/iro/offer/smstrade.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/offer/smstrade.py Tue Apr 15 01:19:47 2025 +0200 @@ -22,7 +22,7 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import urllib +import urllib.request, urllib.parse from functools import partial from decimal import Decimal import copy @@ -106,7 +106,7 @@ def __init__(self, name): self.url = "https://gateway.smstrade.de" - options =[("key", Option(lambda x,y:x,long="smstrade Gateway Key https://login.smstrade.de/index.php?gateway", must=True)),] + options =[("key", Option(lambda x,y:x,int="smstrade Gateway Key https://login.smstrade.de/index.php?gateway", must=True)),] Provider.__init__(self, name, {"sms":["basic","economy","gold","direct"]},options) def send(self, route, recipient, sms): @@ -121,8 +121,6 @@ """ #logger.debug('smstrade.sendSMS(%s,%s)'%(sms, recipient)) - route = unicode(route) - if recipient.land != '49' and route == "basic": raise RejectRecipient(recipient) @@ -170,21 +168,21 @@ ps={} for p in parameters: - if p in self._params.keys(): + if p in list(self._params.keys()): if self._params[p][0] == "boolean": if parameters[p] != self._params[p][1]: ps[p]=int(bool(parameters[p])) else: ps[p] = parameters[p] - params = urllib.urlencode(ps) + params = urllib.parse.urlencode(ps) dp=copy.deepcopy(ps) dp["key"]="" - print 'smstrade._send-parameters:%s\n\t->%s'%(str(dp), urllib.urlencode(dp)) + print('smstrade._send-parameters:%s\n\t->%s'%(str(dp), urllib.parse.urlencode(dp))) - response = urllib.urlopen(self.url, params) + response = urllib.request.urlopen(self.url, params) data = response.readlines() - print "result:%s"%(data) + print("result:%s"%(data)) if len(data) == 1: return StatusCode(int(data[0])) return StatusCode(int(data[0]),exID=data[1].strip(),costs=data[2],count=data[3]) diff -r 81916344c63b -r 42fd5075a5d1 iro/validate.py --- a/iro/validate.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/validate.py Tue Apr 15 01:19:47 2025 +0200 @@ -131,7 +131,7 @@ tel=Telnumber(v) if tel not in ret: ret.append(tel) - except InvalidTel, e: + except InvalidTel as e: e.field=field raise e return ret diff -r 81916344c63b -r 42fd5075a5d1 iro/view/xmlrpc.py --- a/iro/view/xmlrpc.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/view/xmlrpc.py Tue Apr 15 01:19:47 2025 +0200 @@ -20,7 +20,8 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -*- coding: utf-8 -*- -from twisted.web import soap, xmlrpc +#from twisted.web import soap +from twisted.web import xmlrpc from ..controller.viewinterface import Interface @@ -67,25 +68,25 @@ return xmlrpc.XMLRPC._ebRender(self, failure) -class SOAPInterface(TwistedInterface,soap.SOAPPublisher): - """SOAP interface""" - def __init__(self): - soap.SOAPPublisher.__init__(self) - TwistedInterface.__init__(self) - - def lookupFunction(self, functionName): - if functionName in self.listProcedures(): - function = getattr(self, functionName, None) - if function: - return function, getattr(function, "useKeywords", False) - return None - else: - return None +#class SOAPInterface(TwistedInterface,soap.SOAPPublisher): +# """SOAP interface""" +# def __init__(self): +# soap.SOAPPublisher.__init__(self) +# TwistedInterface.__init__(self) +# +# def lookupFunction(self, functionName): +# if functionName in self.listProcedures(): +# function = getattr(self, functionName, None) +# if function: +# return function, getattr(function, "useKeywords", False) +# return None +# else: +# return None def appendResource(root): """adding XML-RPC and SOAP to root.""" root.putChild('RPC2', XMLRPCInterface()) - root.putChild('SOAP', SOAPInterface()) + #root.putChild('SOAP', SOAPInterface()) if __name__ == '__main__': from twisted.web import resource, server