Ignore:
Timestamp:
03/24/19 08:15:59 (4 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Ran 2to3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/rpc.py

    r889 r919  
    1 import const
    2 import rpccommon
    3 
    4 from common import MAVA_BASE_URL
     1from . import const
     2from . import rpccommon
     3
     4from .common import MAVA_BASE_URL
    55
    66import jsonrpclib
     
    2828        For all other names, the value will be stored as the same-named
    2929        attribute."""
    30         for (key, value) in value.iteritems():
     30        for (key, value) in value.items():
    3131            if key in instructions:
    3232                instruction = instructions[key]
     
    3737                    value = instruction(value)
    3838                except:
    39                     print >> sys.stderr, "Failed to convert value '%s' of attribute '%s':" % \
    40                         (value, key)
     39                    print("Failed to convert value '%s' of attribute '%s':" % \
     40                        (value, key), file=sys.stderr)
    4141                    import traceback
    4242                    traceback.print_exc()
     
    297297    def writeIntoFile(self, f):
    298298        """Write the flight into a file."""
    299         print >> f, "callsign=%s" % (self.callsign,)
     299        print("callsign=%s" % (self.callsign,), file=f)
    300300        date = self.departureTime.date()
    301         print >> f, "date=%04d-%02d-%0d" % (date.year, date.month, date.day)
    302         print >> f, "dep_airport=%s" % (self.departureICAO,)
    303         print >> f, "dest_airport=%s" % (self.arrivalICAO,)
    304         print >> f, "planecode=%s" % \
    305               (BookedFlight.TYPE2TYPECODE[self.aircraftType],)
    306         print >> f, "planetype=%s" % (self.aircraftTypeName,)
    307         print >> f, "tail_nr=%s" % (self.tailNumber,)
    308         print >> f, "passenger=%d" % (self.numPassengers,)
    309         print >> f, "crew=%d" % (self.numCrew,)
    310         print >> f, "bag=%d" % (self.bagWeight,)
    311         print >> f, "cargo=%d" % (self.cargoWeight,)
    312         print >> f, "mail=%d" % (self.mailWeight,)
    313         print >> f, "flight_route=%s" % (self.route,)
     301        print("date=%04d-%02d-%0d" % (date.year, date.month, date.day), file=f)
     302        print("dep_airport=%s" % (self.departureICAO,), file=f)
     303        print("dest_airport=%s" % (self.arrivalICAO,), file=f)
     304        print("planecode=%s" % \
     305              (BookedFlight.TYPE2TYPECODE[self.aircraftType],), file=f)
     306        print("planetype=%s" % (self.aircraftTypeName,), file=f)
     307        print("tail_nr=%s" % (self.tailNumber,), file=f)
     308        print("passenger=%d" % (self.numPassengers,), file=f)
     309        print("crew=%d" % (self.numCrew,), file=f)
     310        print("bag=%d" % (self.bagWeight,), file=f)
     311        print("cargo=%d" % (self.cargoWeight,), file=f)
     312        print("mail=%d" % (self.mailWeight,), file=f)
     313        print("flight_route=%s" % (self.route,), file=f)
    314314        departureTime = self.departureTime
    315         print >> f, "departure_time=%02d\\:%02d\\:%02d" % \
    316               (departureTime.hour, departureTime.minute, departureTime.second)
     315        print("departure_time=%02d\\:%02d\\:%02d" % \
     316              (departureTime.hour, departureTime.minute, departureTime.second), file=f)
    317317        arrivalTime = self.arrivalTime
    318         print >> f, "arrival_time=%02d\\:%02d\\:%02d" % \
    319               (arrivalTime.hour, arrivalTime.minute, arrivalTime.second)
    320         print >> f, "foglalas_id=%s" % ("0" if self.id is None else self.id,)
     318        print("arrival_time=%02d\\:%02d\\:%02d" % \
     319              (arrivalTime.hour, arrivalTime.minute, arrivalTime.second), file=f)
     320        print("foglalas_id=%s" % ("0" if self.id is None else self.id,), file=f)
    321321
    322322#---------------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.