@@ -22,6 +22,83 @@ def read_spe_file(self) -> list:
22
22
23
23
return spe_list [1 :]
24
24
25
+ def process_str_with_num (self , _str : str ) -> list :
26
+
27
+ _list = []
28
+
29
+ for idx , item in enumerate (_str ):
30
+ if item .isnumeric ():
31
+ sep_idx = idx
32
+ break
33
+
34
+ _list .append (str (_str [:sep_idx ]).strip ())
35
+ _list .append (_str [sep_idx :])
36
+
37
+ return _list
38
+
39
+ def process_str_with_blank (self , _str : str ) -> list :
40
+
41
+ _list = []
42
+
43
+ for idx , item in enumerate (_str ):
44
+ if item .isspace ():
45
+ sep_idx = idx
46
+ break
47
+
48
+ _list .append (_str [:sep_idx ])
49
+ _list .append (str (_str [sep_idx :]).strip ())
50
+
51
+ return _list
52
+
53
+ def process_str_with_blanks (self , _str : str ) -> list :
54
+
55
+ sep_idx = []
56
+ _list = []
57
+ last = 0
58
+
59
+ for idx , item in enumerate (_str ):
60
+ if item .isspace ():
61
+ sep_idx .append (idx )
62
+
63
+ sep_idx .append (len (_str )- 1 )
64
+
65
+ for indicies in sep_idx :
66
+ _list .append (_str [last :indicies ])
67
+ last = indicies
68
+
69
+ return [str (item ).strip () for item in _list if item != " " ]
70
+
71
+ def create_uniform_list (self , _list : list , max_items : int , max_chars : int ) -> list :
72
+
73
+ for idx , item in enumerate (_list ):
74
+ if len (item ) > max_chars :
75
+ del (_list [idx ])
76
+ _list .insert (idx , item [:max_chars ])
77
+ _list .insert (idx + 1 , item [max_chars :])
78
+
79
+ while len (_list ) < max_items :
80
+ if len (_list ) == max_items - 1 :
81
+ _list .append ('0' )
82
+ else :
83
+ _list .append ('000000' )
84
+
85
+ return _list
86
+
87
+ def create_uniform_item (self , _str : str , max_char : int ) -> str :
88
+
89
+ while len (_str ) < max_char :
90
+ _str = _str + '0'
91
+
92
+ return _str
93
+
94
+ def create_uniform_items (self , _list : list , max_char : list ) -> list :
95
+
96
+ for idx , item in enumerate (_list ):
97
+ if len (item ) != max_char [idx ]:
98
+ _list [idx ] = self .create_uniform_item (item , max_char [idx ])
99
+
100
+ return _list
101
+
25
102
def check_for_new_markdown (self , _list : list ) -> bool :
26
103
27
104
_translate = ['ATV' ,'BGN' ,'COM' ,'CRS' ,'DEG' ,'DMG' ,'DTP' ,'FOS' ,
@@ -67,57 +144,4 @@ def find_app_types(self, _list: list) -> list:
67
144
if str (item ).startswith ('REF!48!' ):
68
145
_apps .append (_tranlsate .get (str (item ).split ('!' )[- 1 ].strip ('\\ ' ), 'Other' ))
69
146
70
- return _apps
71
-
72
- def rearrange_markdown_list (self , _list : list ) -> list :
73
-
74
- app_list = self .find_app_types (_list )
75
- updated_list = self .remove_markdown_items (_list )
76
-
77
- from pprint import pprint
78
- pprint (updated_list )
79
-
80
- _example = [
81
- 'N1!TM!!ZZ!TXAPP' ,
82
- 'RQS!AQ!ZZ!APP SUBMIT/TRANSMIT!!' ,
83
- 'REF!48!' ,
84
- 'REF!SY!' ,
85
- 'SSE!' ,
86
- 'FOS!' ,
87
- 'RQS!AQ!ZZ!FORMER STUDENT!' ,
88
- 'N1!HS!' ,
89
- ]
90
-
91
- for idx , sublist in enumerate (updated_list ):
92
- sublist [:] = [item for item in sublist if any (str (item ).startswith (add ) for add in _example )]
93
-
94
- return updated_list
95
-
96
- # insert_no_matter_what = [
97
- # 'RQS!AQ!ZZ!FORMER STUDENT!'
98
- # ]
99
-
100
- # output = _list.copy()
101
-
102
- # for apps in output:
103
- # for idx, item in enumerate(apps):
104
- # for e_idx, e_item in enumerate(example):
105
- # # if e_item not in apps and e_item in insert_no_matter_what:
106
- # # print(f'Item {item} was not found!, inserting at index {e_idx} anyways.')
107
- # # apps.insert(e_idx, e_item)
108
- # if str(item).startswith(e_item):
109
-
110
- # if e_item == 'N1!HS!':
111
- # hs_name = apps.pop(idx)
112
- # hs_loc = apps.pop(idx)
113
- # apps.insert(e_idx, hs_name)
114
- # apps.insert(e_idx+1, hs_loc)
115
-
116
- # else:
117
- # # print(f'\n{item} found in example list, {e_item}')
118
- # # print(f'Popping item idx {idx} from apps list')
119
- # apps.pop(idx) # Remove from list before moving
120
- # # print(f'Inserting {item} at index {e_idx} for apps list')
121
- # apps.insert(e_idx, item) # Move removed item to correct spot in list
122
-
123
- # return output
147
+ return _apps
0 commit comments