-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Script to update max RPC versions supported in AK #5023
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
base: master
Are you sure you want to change the base?
Conversation
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packaging/tools/update_rpcs_max_versions.py:61
- [nitpick] The variable 'pipe_char' is reused across different contexts to compute multiple column widths. Consider using more descriptive names (e.g., first_pipe_index, second_pipe_index) to improve readability.
pipe_char = line.find('|')
with open(f'./clients/src/main/resources/common/message/{api}Request.json', | ||
'r') as f: | ||
text = f.readlines() | ||
text = "".join([line for line in text | ||
if '#' not in line and '//' not in line]) | ||
json_object = json.loads(text) | ||
max_version = json_object["validVersions"].split("-")[-1] | ||
print('| ', end='') | ||
print(str(api_num).ljust(max_first_column), end='') | ||
print('| ', end='') | ||
print(api.ljust(max_second_column), end='') | ||
print('| ', end='') | ||
print(str(max_version).ljust(max_third_column) + '|') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling for file I/O operations. If the JSON file is missing or unreadable, an unhandled exception will occur.
with open(f'./clients/src/main/resources/common/message/{api}Request.json', | |
'r') as f: | |
text = f.readlines() | |
text = "".join([line for line in text | |
if '#' not in line and '//' not in line]) | |
json_object = json.loads(text) | |
max_version = json_object["validVersions"].split("-")[-1] | |
print('| ', end='') | |
print(str(api_num).ljust(max_first_column), end='') | |
print('| ', end='') | |
print(api.ljust(max_second_column), end='') | |
print('| ', end='') | |
print(str(max_version).ljust(max_third_column) + '|') | |
try: | |
with open(f'./clients/src/main/resources/common/message/{api}Request.json', | |
'r') as f: | |
text = f.readlines() | |
text = "".join([line for line in text | |
if '#' not in line and '//' not in line]) | |
json_object = json.loads(text) | |
max_version = json_object["validVersions"].split("-")[-1] | |
print('| ', end='') | |
print(str(api_num).ljust(max_first_column), end='') | |
print('| ', end='') | |
print(api.ljust(max_second_column), end='') | |
print('| ', end='') | |
print(str(max_version).ljust(max_third_column) + '|') | |
except FileNotFoundError: | |
print(f"Error: File {api}Request.json not found.", file=sys.stderr) | |
except IOError: | |
print(f"Error: Could not read file {api}Request.json.", file=sys.stderr) | |
except json.JSONDecodeError: | |
print(f"Error: JSON decode error in file {api}Request.json.", file=sys.stderr) |
Copilot uses AI. Check for mistakes.
9bea0f9
to
8002f73
Compare
No description provided.