Untitled
unknown
plain_text
16 days ago
1.4 kB
5
Indexable
Never
def get_immediate_conditional_flow(self, input_param_idx, data): """ Function to get immediate code flow. I will the end capturing flow till the immediate IF or EVALUATE """ seq_list = [] row = tuple(data.iloc[input_param_idx]) seq_list.append(row[0]) # While loop to get seq id of flow while (pd.notna(row[5])) and (row[4] not in ['IF', 'EVALUATE']) and (row[5]): row = tuple(data[data['Sequence'].astype('int')==int(float(row[5]))].iloc[0]) seq_list.append(row[0]) #DF with retrieved seq id df = data[data.Sequence.isin(seq_list)] #If steatement under ELSE if 'ELSE' in df.Keywords.to_list(): df = df[~df['Keywords'].str.contains('ELSE')] ls = df['Statement'].iloc[0].strip().split() ls.insert(1, 'NOT') df.iloc[0, 1] = ' '.join(ls) return df input_param_idx = data[data['Sequence'].astype(str)==str(st.query_params['seq_id'])].index.item() df = bre_utils.get_immediate_conditional_flow(input_param_idx, data) lines = [f'000000 PROGRAM-ID {st.query_params["program_id"]}']+[str(i) for i in bre_utils.get_code(df)] #Code block st.markdown(code_css, unsafe_allow_html=True) st.code("\n".join(lines), language='cobol') st.markdown('</div>', unsafe_allow_html=True)
Leave a Comment