コード例 #1
0
ファイル: __init__.py プロジェクト: leearmstrong/pytrains
 class Association(Record):
     prefix = Discriminator('AA')
     type = NewDeleteRevises()
     main_uid = Field(6, str)
     associated_uid = Field(6, str)
     start_date = Field(6, yymmdd)
     end_date = Field(6, yymmdd)
     days = Field(7, days)
     category = Field(2, one_of(
         Constant('JJ', 'join'),
         Constant('VV', 'divide'),
         Constant('NP', 'next'),
         empty = Constant('  ', 'empty (not in spec)')
         ))
     date_indication = Field(1, one_of(
         same_day = Constant('S', 'standard (same day)'),
         next_day = Constant('N', 'over next midnight'),
         prev_day = Constant('P', 'over previous midnight'),
         empty = Constant(' ', 'empty (not in spec)')
         ))
     tiploc = Field(7)
     base_loc_suffix = Field(1)
     assoc_loc_suffix = Field(1)
     diagram_type = Field(1)
     association_type = Field(1, one_of(
         passenger = Constant('P', 'passenger use'),
         operating = Constant('O', 'operating use only'),
         empty = Constant(' ', 'empty (not in spec)')
         ))
     spare = Skip(31)
     stp = STPIndicator()
コード例 #2
0
 class StationDetails(Record):
     record_type = Discriminator('A')
     spaces = Skip(4)
     station_name = Field(30, strip)
     cate_type = Field(
         1,
         one_of(
             none=Constant('0', 'Not an interchange Point'),
             small=Constant('1', 'Small Interchange Point'),
             medium=Constant('2', 'Medium Interchange Point'),
             large=Constant('3', 'Large Interchange Point'),
             subsidiary=Constant('9', 'A subsidiary TIPLOC'),
         ))
     tiploc = Field(7)
     subsidiary_code = Field(3)
     spaces2 = Skip(3)
     principal_code = Field(3)
     easting = Field(5, int)
     coordinate_type = Field(
         1, one_of(
             Constant('E', 'Estimated'),
             Constant(' ', 'Actual'),
         ))
     northing = Field(5, int)
     change_time = Field(2, int)
     footnote = Field(2)
     spaces3 = Skip(11)
     region = Field(3)
コード例 #3
0
ファイル: fields.py プロジェクト: leearmstrong/pytrains
 def __init__(self):
     super(NewDeleteRevises, self).__init__(size=1,
                                            convertor=one_of(
                                                Constant('N', 'new'),
                                                Constant('D', 'delete'),
                                                Constant('R', 'revises'),
                                            ))
コード例 #4
0
ファイル: fields.py プロジェクト: cjw296/pytrains
 def __init__(self):
     super(NewDeleteRevises, self).__init__(
         size=1,
         convertor=one_of(
             Constant('N', 'new'),
             Constant('D', 'delete'),
             Constant('R', 'revises'),
             ))
コード例 #5
0
ファイル: fields.py プロジェクト: leearmstrong/pytrains
 def __init__(self):
     both = Constant('B', 'First & Standard seats.')
     convertor = one_of(
         both=both,
         standard=Constant('S', 'Standard class only.'),
     )
     convertor[' '] = both
     super(CLASS, self).__init__(size=1, convertor=convertor)
コード例 #6
0
ファイル: fields.py プロジェクト: cjw296/pytrains
 def __init__(self):
     super(BHX, self).__init__(
         size=1,
         convertor=one_of(
             none = Constant('X', 'Does not run on specified Bank Holiday Mondays.'),
             edinburgh = Constant('E', 'Does not run on specified Edinburgh Holiday dates'),
             glasgow = Constant('G', 'Does not run on specified Glasgow Holiday dates.'),
             empty = Constant(' ', 'empty (not in spec)')
             ))
コード例 #7
0
ファイル: fields.py プロジェクト: leearmstrong/pytrains
 def __init__(self):
     super(STPIndicator,
           self).__init__(size=1,
                          convertor=one_of(
                              non_overlay=Constant(' ', 'non overlay user'),
                              cancel=Constant('C', 'stp cancellation'),
                              new=Constant('N', 'new stp (not an overlay)'),
                              permanent=Constant('P', 'permanent'),
                              overlay=Constant('O', 'stp overlay'),
                          ))
コード例 #8
0
ファイル: fields.py プロジェクト: cjw296/pytrains
 def __init__(self):
     both = Constant('B', 'First & Standard seats.')
     convertor = one_of(
             both = both,
             standard = Constant('S', 'Standard class only.'),
             )
     convertor[' '] = both
     super(CLASS, self).__init__(
         size=1,
         convertor=convertor)
コード例 #9
0
ファイル: fields.py プロジェクト: cjw296/pytrains
 def __init__(self):
     super(STPIndicator, self).__init__(
         size=1,
         convertor=one_of(
             non_overlay = Constant(' ', 'non overlay user'),
             cancel = Constant('C', 'stp cancellation'),
             new = Constant('N', 'new stp (not an overlay)'),
             permanent = Constant('P', 'permanent'),
             overlay = Constant('O', 'stp overlay'),
             ))
コード例 #10
0
ファイル: fields.py プロジェクト: leearmstrong/pytrains
 def __init__(self):
     super(BHX, self).__init__(
         size=1,
         convertor=one_of(
             none=Constant(
                 'X', 'Does not run on specified Bank Holiday Mondays.'),
             edinburgh=Constant(
                 'E', 'Does not run on specified Edinburgh Holiday dates'),
             glasgow=Constant(
                 'G', 'Does not run on specified Glasgow Holiday dates.'),
             empty=Constant(' ', 'empty (not in spec)')))
コード例 #11
0
ファイル: __init__.py プロジェクト: leearmstrong/pytrains
 class BasicSchedule(Record):
     prefix = Discriminator('BS')
     type = NewDeleteRevises()
     train_uid = Field(6)
     date_from = Field(6, yymmdd)
     date_to = Field(6, yymmdd)
     days = Field(7, days)
     bank_holiday_running = BHX()
     status = STATUS()
     category = CATEGORY()
     identity = Field(4)
     headcode = Field(4)
     course_indicator = Skip(1)
     train_service_code = Field(8)
     portion_id = Field(1) # AKA BUSSEC
     power_type = POWER_TYPE()
     timing_load = Field(4) # Not decoded as requires power_type field
     speed = Field(3, safe_int)
     oper_chars = OPERATING_CHARACTERISTICS()
     train_class = CLASS()
     sleepers = Field(1, one_of(
         none = Constant(' ', 'No sleepers'),
         both = Constant('B', 'First & Standard Class'),
         first = Constant('F', 'First Class only.'),
         standard = Constant('S', 'Standard Class only.'),
         ))
     reservations = Field(1, one_of(
         compulsory = Constant('A', 'Seat Reservations Compulsory'),
         bicycle = Constant('E', 'Reservations for Bicycles Essential'),
         recommended = Constant('R', 'Seat Reservations Recommended'),
         possible = Constant('S', 'Seat Reservations possible from any station'),
         empty = Constant(' ', 'empty (not in spec)')
         ))
     connection_indicator = Field(1) # not used
     catering_code = CATERING()
     service_branding = Skip(4) # appears to be always empty
     spare = Skip(1)
     stp = STPIndicator()
コード例 #12
0
ファイル: __init__.py プロジェクト: leearmstrong/pytrains
 class Header(Record):
     prefix = Discriminator('HD')
     mainframe_id = Field(20)
     date_of_extract = Field(6, ddmmyy)
     time_of_extract = Field(4, hhmm)
     current_file_ref = Field(7)
     last_file_ref = Field(7)
     update_indicator = Field(1, one_of(
         Constant('U', 'update'),
         Constant('F', 'full')
         ))
     version = Field(1)
     start_date = Field(6, ddmmyy)
     end_date = Field(6, ddmmyy)
コード例 #13
0
ファイル: fields.py プロジェクト: leearmstrong/pytrains
 def __init__(self):
     super(STATUS, self).__init__(
         size=1,
         convertor=one_of(
             bus=Constant('B', 'Bus (Permanent).'),
             freight=Constant('F', 'Freight (Permanent - WTT).'),
             passenger=Constant('P',
                                'Passenger & Parcels (Permanent - WTT).'),
             ship=Constant('S', 'Ship (Permanent).'),
             trip=Constant('T', 'Trip (Permanent).'),
             stp_passenger=Constant('1', 'STP Passenger & Parcels.'),
             stp_freight=Constant('2', 'STP Freight.'),
             stp_trip=Constant('3', 'STP Trip.'),
             stp_ship=Constant('4', 'STP Ship.'),
             stp_bus=Constant('5', 'STP Bus.'),
             empty=Constant(' ', 'empty (not in spec)')))
コード例 #14
0
ファイル: fields.py プロジェクト: cjw296/pytrains
 def __init__(self):
     super(STATUS, self).__init__(
         size=1,
         convertor=one_of(
             bus=Constant('B', 'Bus (Permanent).'),
             freight=Constant('F', 'Freight (Permanent - WTT).'),
             passenger=Constant('P', 'Passenger & Parcels (Permanent - WTT).'),
             ship = Constant('S', 'Ship (Permanent).'),
             trip = Constant('T', 'Trip (Permanent).'),
             stp_passenger = Constant('1', 'STP Passenger & Parcels.'),
             stp_freight = Constant('2', 'STP Freight.'),
             stp_trip = Constant('3', 'STP Trip.'),
             stp_ship = Constant('4', 'STP Ship.'),
             stp_bus = Constant('5', 'STP Bus.'),
             empty = Constant(' ', 'empty (not in spec)')
             ))
コード例 #15
0
ファイル: fields.py プロジェクト: cjw296/pytrains
 def __init__(self):
     super(POWER_TYPE, self).__init__(
         size=3,
         convertor=one_of(
             d = Constant('D  ', 'Diesel'),
             dem = Constant('DEM', 'Diesel Electric Multiple Unit.'),
             dmu = Constant('DMU', 'Diesel Mechanical Multiple Unit'),
             e = Constant('E  ', 'Electric.'),
             ed = Constant('ED ', 'Electro-Diesel.'),
             eml = Constant('EML', 'EMU plus D, E, ED locomotive.'),
             emu = Constant('EMU', 'Electric Multiple Unit.'),
             epu = Constant('EPU', 'Electric Parcels Unit.'),
             hst = Constant('HST', 'High Speed Train.'),
             lds = Constant('LDS', 'Diesel Shunting Locomotive.'),
             empty = Constant('   ', 'empty (not in spec)')
             ))
コード例 #16
0
ファイル: fields.py プロジェクト: leearmstrong/pytrains
 def __init__(self):
     super(POWER_TYPE, self).__init__(
         size=3,
         convertor=one_of(d=Constant('D  ', 'Diesel'),
                          dem=Constant('DEM',
                                       'Diesel Electric Multiple Unit.'),
                          dmu=Constant('DMU',
                                       'Diesel Mechanical Multiple Unit'),
                          e=Constant('E  ', 'Electric.'),
                          ed=Constant('ED ', 'Electro-Diesel.'),
                          eml=Constant('EML',
                                       'EMU plus D, E, ED locomotive.'),
                          emu=Constant('EMU', 'Electric Multiple Unit.'),
                          epu=Constant('EPU', 'Electric Parcels Unit.'),
                          hst=Constant('HST', 'High Speed Train.'),
                          lds=Constant('LDS',
                                       'Diesel Shunting Locomotive.'),
                          empty=Constant('   ', 'empty (not in spec)')))
コード例 #17
0
ファイル: fields.py プロジェクト: cjw296/pytrains
 def __init__(self):
     super(CATEGORY, self).__init__(
         size=2,
         convertor=one_of(
             # Ordinary Passenger Trains
             Constant('OU', 'Unadvertised Ordinary Passenger'),
             Constant('OS', 'Staff Train'),
             Constant('OW', 'Mixed'),
             # Express Passenger Trains
             Constant('XC', 'Channel Tunnel'),
             Constant('XD', 'Sleeper (Europe Night Services)'),
             Constant('XI', 'International'),
             Constant('XR', 'Motorail'),
             Constant('XU', 'Unadvertised Express'),
             # Buses
             # Empty Coaching Stock Trains
             Constant('EE', 'Empty Coaching Stock (ECS)'),
             Constant('EL', 'ECS, London Underground/Metro Service.'),
             Constant('ES', 'ECS & Staff'),
             # Parcels and Postal Trains
             Constant('JJ', 'Postal'),
             Constant('PM', 'Post Office Controlled Parcels'),
             Constant('PP', 'Parcels'),
             Constant('PV', 'Empty NPCCS'),
             # Departmental Trains
             Constant('DD', 'Departmental'),
             Constant('DH', 'Civil Engineer'),
             Constant('DI', 'Mechanical & Electrical Engineer'),
             Constant('DQ', 'Stores'),
             Constant('DT', 'Test'),
             Constant('DY', 'Signal & Telecommunications Engineer'),
             # Light Locomotives
             Constant('ZB', 'Locomotive & Brake Van'),
             Constant('ZZ', 'Light Locomotive'),
             # (Freight Categories currently under review),
             # Railfreight Distribution
             Constant('J2', 'RfD Automotive (Components)'),
             Constant('H2', 'RfD Automotive (Vehicles)'),
             Constant('J3', 'RfD Edible Products (UK Contracts)'),
             Constant('J4', 'RfD Industrial Minerals (UK Contracts)'),
             Constant('J5', 'RfD Chemicals (UK Contracts)'),
             Constant('J6', 'RfD Building Materials (UK Contracts)'),
             Constant('J8', 'RfD General Merchandise (UK Contracts)'),
             Constant('H8', 'RfD European'),
             Constant('J9', 'RfD Freightliner (Contracts)'),
             Constant('H9', 'RfD Freightliner (Other)'),
             # Trainload Freight
             Constant('A0', 'Coal (Distributive)'),
             Constant('E0', 'Coal (Electricity) MGR'),
             Constant('B0', 'Coal (Other) and Nuclear'),
             Constant('B1', 'Metals'),
             Constant('B4', 'Aggregates'),
             Constant('B5', 'Domestic and Industrial Waste'),
             Constant('B6', 'Building Materials (TLF)'),
             Constant('B7', 'Petroleum Products'),
             # Railfreight Distribution (Channel Tunnel),
             Constant('H0', 'RfD European Channel Tunnel (Mixed Business)'),
             Constant('H1', 'RfD European Channel Tunnel Intermodal'),
             Constant('H3', 'RfD European Channel Tunnel Automotive'),
             Constant('H4', 'RfD European Channel Tunnel Contract Services'),
             Constant('H5', 'RfD European Channel Tunnel Haulmark'),
             Constant('H6', 'RfD European Channel Tunnel Joint Venture'),
             # the following appear to actually be in use in the free
             # CIF data provided by ATOC
             underground = Constant('OL', 'London Underground/Metro Service.'),
             passenger = Constant('OO', 'Ordinary Passenger'),
             express = Constant('XX', 'Express Passenger'),
             sleeper = Constant('XZ', 'Sleeper (Domestic)'),
             bus_replacement = Constant('BR', 'Bus - Replacement due to engineering work'),
             bus_wtt = Constant('BS', 'Bus - WTT Service'),
             empty = Constant('  ', 'empty (not in spec)')
             ))
コード例 #18
0
ファイル: fields.py プロジェクト: leearmstrong/pytrains
 def __init__(self):
     super(CATEGORY, self).__init__(
         size=2,
         convertor=one_of(
             # Ordinary Passenger Trains
             Constant('OU', 'Unadvertised Ordinary Passenger'),
             Constant('OS', 'Staff Train'),
             Constant('OW', 'Mixed'),
             # Express Passenger Trains
             Constant('XC', 'Channel Tunnel'),
             Constant('XD', 'Sleeper (Europe Night Services)'),
             Constant('XI', 'International'),
             Constant('XR', 'Motorail'),
             Constant('XU', 'Unadvertised Express'),
             # Buses
             # Empty Coaching Stock Trains
             Constant('EE', 'Empty Coaching Stock (ECS)'),
             Constant('EL', 'ECS, London Underground/Metro Service.'),
             Constant('ES', 'ECS & Staff'),
             # Parcels and Postal Trains
             Constant('JJ', 'Postal'),
             Constant('PM', 'Post Office Controlled Parcels'),
             Constant('PP', 'Parcels'),
             Constant('PV', 'Empty NPCCS'),
             # Departmental Trains
             Constant('DD', 'Departmental'),
             Constant('DH', 'Civil Engineer'),
             Constant('DI', 'Mechanical & Electrical Engineer'),
             Constant('DQ', 'Stores'),
             Constant('DT', 'Test'),
             Constant('DY', 'Signal & Telecommunications Engineer'),
             # Light Locomotives
             Constant('ZB', 'Locomotive & Brake Van'),
             Constant('ZZ', 'Light Locomotive'),
             # (Freight Categories currently under review),
             # Railfreight Distribution
             Constant('J2', 'RfD Automotive (Components)'),
             Constant('H2', 'RfD Automotive (Vehicles)'),
             Constant('J3', 'RfD Edible Products (UK Contracts)'),
             Constant('J4', 'RfD Industrial Minerals (UK Contracts)'),
             Constant('J5', 'RfD Chemicals (UK Contracts)'),
             Constant('J6', 'RfD Building Materials (UK Contracts)'),
             Constant('J8', 'RfD General Merchandise (UK Contracts)'),
             Constant('H8', 'RfD European'),
             Constant('J9', 'RfD Freightliner (Contracts)'),
             Constant('H9', 'RfD Freightliner (Other)'),
             # Trainload Freight
             Constant('A0', 'Coal (Distributive)'),
             Constant('E0', 'Coal (Electricity) MGR'),
             Constant('B0', 'Coal (Other) and Nuclear'),
             Constant('B1', 'Metals'),
             Constant('B4', 'Aggregates'),
             Constant('B5', 'Domestic and Industrial Waste'),
             Constant('B6', 'Building Materials (TLF)'),
             Constant('B7', 'Petroleum Products'),
             # Railfreight Distribution (Channel Tunnel),
             Constant('H0', 'RfD European Channel Tunnel (Mixed Business)'),
             Constant('H1', 'RfD European Channel Tunnel Intermodal'),
             Constant('H3', 'RfD European Channel Tunnel Automotive'),
             Constant('H4',
                      'RfD European Channel Tunnel Contract Services'),
             Constant('H5', 'RfD European Channel Tunnel Haulmark'),
             Constant('H6', 'RfD European Channel Tunnel Joint Venture'),
             # the following appear to actually be in use in the free
             # CIF data provided by ATOC
             underground=Constant('OL',
                                  'London Underground/Metro Service.'),
             passenger=Constant('OO', 'Ordinary Passenger'),
             express=Constant('XX', 'Express Passenger'),
             sleeper=Constant('XZ', 'Sleeper (Domestic)'),
             bus_replacement=Constant(
                 'BR', 'Bus - Replacement due to engineering work'),
             bus_wtt=Constant('BS', 'Bus - WTT Service'),
             empty=Constant('  ', 'empty (not in spec)')))