Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Creation of Opensuse data Files #156

Merged
merged 1 commit into from Aug 29, 2023

Conversation

Princee215
Copy link
Contributor

As mentioned in #145 issue. All the OpenSUSE data files that are being generated have an empty JSON file, that was due to a buggy code that Arsh and I tried to correct. We use to have separate chunk of code for creation of different files, In this PR I've use nested for loop and try to reduce down the repetition and the lines of code.
Once this get a green flag, I'll subsequently update the data files in the data repository that are empty right now.

@pleia2 and @arshPratap please take a look and let me know if there's anything that needs to be done.

@arshPratap
Copy link
Member

Thanks @Princee215 ..works really well..just some minor fixes thats all

@arshPratap
Copy link
Member

@Princee215 lemme know when you have fixed the changes I have suggested .. I would love to approve this PR
@pleia2 would love to hear your thoughts on this .
Thanks

print("Couldn't pull. Error: ",str(e))
else:
data = json.loads(data_source)
regex_pattern = r"-(.*?)-"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Princee215 could you move the regex_pattern above (its seems like a constant), ... define it just below source_data list

data_dict = {"packageName":package_name,"description":"","version":version}
opensuse_list.append(data_dict)
q_index = q[i]
file_name = f'{DATA_FILE_LOCATION}/{q_index}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename q_index to file_name and rename the file_name to file_path

file_name = f'{DATA_FILE_LOCATION}/{q_index}'
with open(file_name,'w') as file:
json.dump(opensuse_list,file,indent=2)
print(f"Saved!\nfilename: {q_index}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove q_index and rename as defined above

@Princee215
Copy link
Contributor Author

Sure, thanks @arshPratap, i see these changes. And I'll try to edit as soon as possible.

Signed-off-by: Princee215 <princeesingh215@gmail.com>
@pleia2 pleia2 merged commit dc8842e into openmainframeproject:master Aug 29, 2023
1 check passed
@arshPratap
Copy link
Member

arshPratap commented Aug 29, 2023

Great Work @Princee215 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants