File tree Expand file tree Collapse file tree 3 files changed +11
-14
lines changed Expand file tree Collapse file tree 3 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -76,10 +76,6 @@ def get_latest_file(file_list: list[Path]) -> Path:
7676 Returns:
7777 Path: The path of the latest file. Returns None if no valid date is found.
7878 """
79- # Initialize variables to keep track of the latest file and date
80- if len (file_list ) == 1 :
81- logger .info ("Using the only file: {}" , file_list [0 ])
82- return file_list [0 ]
8379 try :
8480 # Define the keywords to filter relevant files
8581 keywords = ["konsolidiertelesefassungmitfehlerkorrekturen" , "außerordentlicheveröffentlichung" ]
@@ -160,8 +156,9 @@ def parse_raw_nachrichtenstrukturzeile(input_path: Path) -> list[str]:
160156
161157
162158_pattern = re .compile (
163- r"MIG(?:Strom|Gas)?-?informatorischeLesefassung?(?P<version>(?P<major>\d+)\.(?P<minor>\d+)(?P<suffix>[a-z]?))"
164- r"(?:_|KonsolidierteLesefassung|-AußerordentlicheVeröffentlichung)" ,
159+ r"MIG(?:Strom|Gas)?(?:-informatorischeLesefassung)?"
160+ r"(?P<version>(?:S|G)?(?P<major>\d+)\.(?P<minor>\d+)(?P<suffix>[a-z]?))"
161+ r"(?:_|KonsolidierteLesefassung|-AußerordentlicheVeröffentlichung)?" ,
165162 re .IGNORECASE ,
166163)
167164
Original file line number Diff line number Diff line change 2525# ---
2626# name: TestParsing.test_extract_document_version[UTILMDG]
2727 tuple(
28- '',
29- None ,
30- None ,
31- '',
28+ 'G1.0a ',
29+ 1 ,
30+ 0 ,
31+ 'a ',
3232 )
3333# ---
3434# name: TestParsing.test_extract_document_version[UTILMDS]
3535 tuple(
36- '',
37- None ,
38- None ,
36+ 'S1.1 ',
37+ 1 ,
38+ 1 ,
3939 '',
4040 )
4141# ---
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ def test_parse_raw_nachrichtenstrukturzeile(self):
100100 pytest .param (
101101 Path (
102102 "edi_energy_de/FV2310/IFTSTAMIG-informatorischeLesefassung-AußerordentlicheVeröffentlichung_20231022_20231001.docx"
103- ),
103+ ), # will return nothing as there is no version number
104104 id = "IFTSTA" ,
105105 ),
106106 pytest .param (
You can’t perform that action at this time.
0 commit comments