Changeset 930:6da5e7a7ca9b for src/mlx


Ignore:
Timestamp:
04/27/19 12:21:24 (6 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

More robust NOTAM parsing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/web.py

    r928 r930  
    1515import hashlib
    1616import time
     17import re
    1718import datetime
    1819import codecs
     
    578579    def _parseCurrentNOTAM2(self):
    579580        """Parse the current NOTAM with a second, more flexible method."""
     581        self._currentNOTAM = self._currentNOTAM.replace("\\n", "\n")
    580582        lines = self._currentNOTAM.splitlines()
     583        if len(lines)==1:
     584            lines = lines[0].splitlines()
    581585        lines = [line.strip() for line in lines]
    582586
     
    614618
    615619        def parseTime(item):
     620            item = re.sub("([0-9]+).*", "\\1", item)
    616621            try:
    617622                return datetime.datetime.strptime(item, "%y%m%d%H%M")
Note: See TracChangeset for help on using the changeset viewer.