Skip to content

Instantly share code, notes, and snippets.

@seta-phucpham
Last active January 26, 2024 06:25
Show Gist options
  • Save seta-phucpham/a98300134c34c8df621ec7dd00c30d5f to your computer and use it in GitHub Desktop.
Save seta-phucpham/a98300134c34c8df621ec7dd00c30d5f to your computer and use it in GitHub Desktop.
temp
./app/api/admin_v2/comments.py: status.HTTP_404_NOT_FOUND, "The current time period don't have this employee"
./app/api/admin_v2/comments.py: status.HTTP_404_NOT_FOUND, "You are not the reviewer of this employee in current time period"
./app/api/admin_v2/comments.py: status.HTTP_404_NOT_FOUND, "You are not allowed to create comment"
./app/api/admin_v2/comments.py: status.HTTP_404_NOT_FOUND, "Comment not found"
./app/api/admin_v2/comments.py: status.HTTP_404_NOT_FOUND, "You are not authorized to update this comment"
./app/api/admin_v2/comments.py: status.HTTP_404_NOT_FOUND, "You are not authorized to delete this comment"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Time period already exists"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't create time period for past year"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't create time period for past quarter"
./app/api/admin_v2/sessions.py: status.HTTP_404_NOT_FOUND, "Time period not found"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't update time period for past quarter"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't update time period for starting quarter"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't update time period to past year"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't update time period to past quarter"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't delete time period for past quarter"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't delete time period for starting quarter"
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't unassign reviewers in past time period."
./app/api/admin_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "Can't unassign reviewers in current time period."
./app/api/admin_v2/inputs.py: status.HTTP_400_BAD_REQUEST, "Session format is invalid. Expected format: S{quarter}_{year}"
./app/api/admin_v2/inputs.py: status.HTTP_404_NOT_FOUND, "Input not found"
./app/api/admin_v2/employees.py: status.HTTP_400_BAD_REQUEST, "Invalid time period format"
./app/api/admin_v2/employees.py: status.HTTP_400_BAD_REQUEST, "Invalid goal_submit_status"
./app/api/admin_v2/employees.py: status.HTTP_400_BAD_REQUEST, "Invalid input_submit_status"
./app/api/admin_v2/employees.py: status.HTTP_400_BAD_REQUEST, "Invalid review_check"
./app/api/admin_v2/employees.py: status.HTTP_404_NOT_FOUND, "Employee not found"
./app/api/admin_v2/employees.py: status.HTTP_404_NOT_FOUND, "Role not found"
./app/api/admin_v2/employees.py: status.HTTP_404_NOT_FOUND, "Employee not enrolled in this time period"
./app/api/admin_v2/employees.py: status.HTTP_404_NOT_FOUND, "Reviewer not found"
./app/api/admin_v2/employees.py: status.HTTP_400_BAD_REQUEST, "Time period format is invalid. Expected format: S{quarter}_{year}"
./app/api/admin_v2/employees.py: status.HTTP_404_NOT_FOUND, "This employee does not enroll in this time period"
./app/api/admin_v2/employees.py: status.HTTP_400_BAD_REQUEST, "Invalid session format"
./app/api/admin_v2/employees.py: status.HTTP_404_NOT_FOUND, "This time period don't have this employee"
./app/api/admin_v2/employees.py: status.HTTP_404_NOT_FOUND, "This employee is not enrolled in this time period"
./app/api/admin_v2/goals.py: status.HTTP_404_NOT_FOUND, "Employee not found or you are not the reviewer of this employee."
./app/api/admin_v2/goals.py: status.HTTP_400_BAD_REQUEST, "Time period has already ended"
./app/api/admin_v2/goals.py: status.HTTP_400_BAD_REQUEST, "Invalid Due Date ."
./app/api/admin_v2/goals.py: status.HTTP_400_BAD_REQUEST, "There must be at least 1 goal key results."
./app/api/admin_v2/goals.py: status.HTTP_400_BAD_REQUEST, "There must be at most 5 goal key results."
./app/api/admin_v2/goals.py: status.HTTP_404_NOT_FOUND, "Goal not found"
./app/api/admin_v2/goals.py: status.HTTP_400_BAD_REQUEST, "Some goals already approved"
./app/api/admin_v2/goals.py: status.HTTP_403_FORBIDDEN, "You are not the author of this comment"
./app/api/v2/inputs.py: status.HTTP_404_NOT_FOUND, "Session not found"
./app/api/v2/inputs.py: status.HTTP_401_UNAUTHORIZED, "You are not authorized to update this input"
./app/api/v2/inputs.py: status.HTTP_400_BAD_REQUEST, "You can only submit 3 inputs per quarter"
./app/api/v2/inputs.py: status.HTTP_404_NOT_FOUND, "One of the inputs not found"
./app/api/v2/inputs.py: status.HTTP_401_UNAUTHORIZED, "You are not authorized to submit one of the inputs"
./app/api/v2/inputs.py: status.HTTP_400_BAD_REQUEST, "One of the inputs is not in draft state"
./app/api/v2/inputs.py: status.HTTP_401_UNAUTHORIZED, "You are not authorized to delete this input"
./app/api/v2/inputs.py: status.HTTP_400_BAD_REQUEST, "Input is not in draft state"
./app/api/v2/comments.py: status.HTTP_404_NOT_FOUND, "This session don't have this employee"
./app/api/v2/attachments.py: 403, "You don't have permission to delete this file"
./app/api/v2/goals.py: status.HTTP_400_BAD_REQUEST, "Time period has ended"
./app/api/v2/goals.py: status.HTTP_400_BAD_REQUEST, "The due date has already passed."
./app/api/v2/goals.py: status.HTTP_400_BAD_REQUEST, "The due date must be within the session period."
./app/api/v2/goals.py: status.HTTP_400_BAD_REQUEST, "This goal is already approved and cannot be edited"
./app/api/v2/goals.py: status.HTTP_404_NOT_FOUND, "Session not found or you are not enrolled in this session"
./app/api/v2/goals.py: status.HTTP_400_BAD_REQUEST, "Due date is invalid"
./app/api/v2/goals.py: status.HTTP_400_BAD_REQUEST, "Cannot update due date of declined goal"
./app/api/v2/goals.py: status.HTTP_400_BAD_REQUEST, "This goal is already approved and cannot be deleted"
./app/api/v2/goals.py: status.HTTP_401_UNAUTHORIZED, "You are not authorized to update this evaluation"
./app/crud/auth.py: status.HTTP_401_UNAUTHORIZED, "Invalid Zoho Authorization Code"
./app/crud/auth.py: status.HTTP_401_UNAUTHORIZED, "Invalid User"
./app/crud/auth.py: status.HTTP_401_UNAUTHORIZED, "Invalid Code"
./app/crud_v2/sessions.py: status.HTTP_400_BAD_REQUEST, "No current session"
./app/crud_v2/employees.py: status.HTTP_404_NOT_FOUND, "Session not found."
./app/crud_v2/employees.py: status.HTTP_400_BAD_REQUEST, "Cannot assign reviewer for employee in ended session."
./app/crud_v2/comments.py: status.HTTP_404_NOT_FOUND, "You are not the reviewer of this employee in this time period"
./app/crud_v2/inputs.py: status.HTTP_400_BAD_REQUEST, "You are not enrolled in this session"
./app/crud_v2/goals.py: status.HTTP_404_NOT_FOUND, "This employee is not enrolled in this session"
./app/crud_v2/goals.py: status.HTTP_400_BAD_REQUEST, "Action is invalid"
./app/crud_v2/goals.py: status.HTTP_404_NOT_FOUND, "User not found"
./app/crud_v2/goals.py: status.HTTP_403_FORBIDDEN, "Only assigned reviewers can update this goal evaluation"
./app/crud_v2/goals.py: status.HTTP_400_BAD_REQUEST, "Goal has been deleted"
./app/crud_v2/goals.py: status.HTTP_404_NOT_FOUND, "Goal evaluation not found"
./app/crud_v2/goals.py: status.HTTP_401_UNAUTHORIZED, "You are not authorized to delete this evaluation"
The current time period don't have this employee
You are not the reviewer of this employee in current time period
You are not allowed to create comment
Comment not found
You are not authorized to update this comment
You are not authorized to delete this comment
Time period already exists
Can't create time period for past year
Can't create time period for past quarter
Time period not found
Can't update time period for past quarter
Can't update time period for starting quarter
Can't update time period to past year
Can't update time period to past quarter
Can't delete time period for past quarter
Can't delete time period for starting quarter
Can't unassign reviewers in past time period.
Can't unassign reviewers in current time period.
Session format is invalid. Expected format: S{quarter}_{year}
Input not found
Invalid time period format
Invalid goal_submit_status
Invalid input_submit_status
Invalid review_check
Employee not found
Role not found
Employee not enrolled in this time period
Reviewer not found
Time period format is invalid. Expected format: S{quarter}_{year}
This employee does not enroll in this time period
Invalid session format
This time period don't have this employee
This employee is not enrolled in this time period
Employee not found or you are not the reviewer of this employee.
Time period has already ended
Invalid Due Date .
There must be at least 1 goal key results.
There must be at most 5 goal key results.
Goal not found
Some goals already approved
You are not the author of this comment
Session not found
You are not authorized to update this input
You can only submit 3 inputs per quarter
One of the inputs not found
You are not authorized to submit one of the inputs
One of the inputs is not in draft state
You are not authorized to delete this input
Input is not in draft state
This session don't have this employee
You don't have permission to delete this file
Time period has ended
The due date has already passed.
The due date must be within the session period.
This goal is already approved and cannot be edited
Session not found or you are not enrolled in this session
Due date is invalid
Cannot update due date of declined goal
This goal is already approved and cannot be deleted
You are not authorized to update this evaluation
Invalid Zoho Authorization Code
Invalid User
Invalid Code
No current session
Session not found.
Cannot assign reviewer for employee in ended session.
You are not the reviewer of this employee in this time period
You are not enrolled in this session
This employee is not enrolled in this session
Action is invalid
User not found
Only assigned reviewers can update this goal evaluation
Goal has been deleted
Goal evaluation not found
You are not authorized to delete this evaluation
import os
import re
def search_python_files(directory, pattern):
regex = re.compile(pattern)
result = []
for root, dirs, files in os.walk(directory):
for file in files:
if file.endswith(".py"):
file_path = os.path.join(root, file)
with open(file_path, "r") as f:
content = f.read()
matches = regex.findall(content)
for match in matches:
code, message = match
result.append((file_path, code, message))
return result
def remove_dupplicates(result):
unique_result = []
messages = set()
for file_path, code, message in result:
if message not in messages:
unique_result.append((file_path, code, message))
messages.add(message)
return unique_result
pattern = r'raise HTTPException\(\s+status_code=(.*)\s+detail=(".*").*\s+\)'
directory = "./app"
result = search_python_files(directory, pattern)
result = remove_dupplicates(result)
# print(f"Found {len(result)} matches:")
for file_path, code, match in result:
print(f"{file_path}: {code} {match}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment