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

feat: (blur script) use new base64 image format #183

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

danleyb2
Copy link
Collaborator

No description provided.

Copy link

Risk Level 2 - /home/runner/work/deep-license-plate-recognition/deep-license-plate-recognition/blur/main.py

The changes introduce a new dependency on base64 which is standard and safe, but there's a potential issue with the merge_paths function. The indentation of the else block seems incorrect, which could lead to a SyntaxError. The correct indentation should align with the if statement. Additionally, the error handling in the process function could be improved by checking the response status code more precisely. Here's the suggested change for the merge_paths function:

if common_prefix == \"/\":
    # Custom output dir, exclude the first (/images/) prefix
    lgr.debug(f\"path1: {path1}\")
    lgr.debug(f\"path2: {path2}\")
    path3 = Path(path1) / Path(*path2.parts[2:])
else:
    real_path = os.path.relpath(path2, common_prefix)
    lgr.debug(f\"common_prefix: {common_prefix}\")
    lgr.debug(f\"real_path: {real_path}\")
    path3 = path1 / Path(real_path)

return path3

For the process function, consider using response.raise_for_status() to raise an HTTPError if the response was unsuccessful:

response.raise_for_status()

🔧🐍🚦


Powered by Code Review GPT

blur/main.py Outdated Show resolved Hide resolved
@marcbelmont
Copy link
Collaborator

@danleyb2
Is the comment from GPT making sense?

Co-authored-by: Marc Belmont <45101+marcbelmont@users.noreply.github.com>
@danleyb2
Copy link
Collaborator Author

@marcbelmont GPT comment is not usefull,

  1. It talks about SyntaxError which doesn't exist.
  2. It suggest using response.raise_for_status() but i prefer raising an exception that contains the response.text as msg

@marcbelmont marcbelmont merged commit c7aea75 into master Feb 28, 2024
@marcbelmont marcbelmont deleted the blur-base64-encode branch February 28, 2024 10:45
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.

2 participants