프로젝트

일반

사용자정보

개정판 f30115b4

IDf30115b4a958e76f521936692c586649da6664d7
상위 e8f84ca5
하위 e8047e22

함의성이(가) 4년 이상 전에 추가함

issue #49: improve open speed and fix regular expression

Change-Id: I1988c64f578cb8bd2e69b4b9a91c51b706d82a59

차이점 보기:

DTI_PID/DTI_PID/CodeTables.py
54 54
                    # code
55 55
                    if text.startswith(value[1]):
56 56
                        return value[1], value[1]
57
                    else:
58
                        match = re.search(value[1], text, re.DOTALL)
57

  
58
                    # allowable
59
                    matches = [x for x in value[3] if x and text.startswith(x)]
60
                    if matches:
61
                        return value[1], matches[0]
62
                    
63
                    # code
64
                    match = re.search(value[1], text, re.DOTALL)
65
                    if match and match.start() is 0:
66
                        return text[:match.end()], text[:match.end()]
67

  
68
                    # allowable
69
                    if value[3][0]:
70
                        match = re.search(value[3][0], text, re.DOTALL)
59 71
                        if match and match.start() is 0:
60
                            return text[:match.end()], text[:match.end()]
61

  
62
                        # allowable
63
                        matches = [x for x in value[3] if x and text.startswith(x)]
64
                        if matches:
65
                            return value[1], matches[0]
66
                        else:
67
                            if value[3][0]:
68
                                match = re.search(value[3][0], text, re.DOTALL)
69
                                if match and match.start() is 0:
70
                                    return value[1], text[:match.end()]
72
                            return value[1], text[:match.end()]
71 73

  
72 74
                return None, None
73 75
        except Exception as ex:
......
86 88
        try:
87 89
            for value in self.values:
88 90
                # code
89
                if type(value[1]) is list:
91
                if type(value[1]) is list: # for inst code table
90 92
                    return None
91 93
                elif text == value[1]:
92 94
                    return value[1]
93
                else:
94
                    match = re.search(value[1], text, re.DOTALL)
95
                    if match and match.start() is 0 and match.end() is len(text):
96
                        return text
97 95

  
98
                    # allowable
99
                    matches = [x for x in value[3] if x and text == x]
100
                    if matches:
96
                # allowable
97
                matches = [x for x in value[3] if x and text == x]
98
                if matches:
99
                    return value[1]
100

  
101
                # code
102
                match = re.search(value[1], text, re.DOTALL)
103
                if match and match.start() is 0 and match.end() is len(text):
104
                    return text
105

  
106
                # allowable
107
                if value[3][0]:
108
                    match = re.search(value[3][0], text, re.DOTALL)
109
                    if match and match.start() is 0 and match.end() is len(text):
101 110
                        return value[1]
102
                    else:
103
                        if value[3][0]:
104
                            match = re.search(value[3][0], text, re.DOTALL)
105
                            if match and match.start() is 0 and match.end() is len(text):
106
                                return value[1]
107 111

  
108 112
            return None
109 113

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)