Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

Sourcery refactored main branch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 8, 2023

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from StarkGang October 8, 2023 15:14
ss = ""
for sentence in sentences:
ss += sentence + "\n"
ss = "".join(sentence + "\n" for sentence in sentences)
Copy link
Author

Choose a reason for hiding this comment

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

Function TextDetectorGUI.update refactored with the following changes:

  • Use str.join() instead of for loop (use-join)

Comment on lines -168 to +173
filename = os.path.join("./known_faces/", name + ".jpg")
filename = os.path.join("./known_faces/", f"{name}.jpg")
if os.path.exists(filename):
return tk.messagebox.showerror(
"Error", "A face with this name already exists."
)
# Show a pop-up message
resp = tk.messagebox.askokcancel(
if resp := tk.messagebox.askokcancel(
"Cheese", "Smile for the camera! Click OK to click and image."
)
if resp:
):
Copy link
Author

Choose a reason for hiding this comment

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

Function SaveFaceGUI.save_face refactored with the following changes:

This removes the following comments ( why? ):

# Show a pop-up message

Comment on lines -13 to +16
data_dir + "/shape_predictor_68_face_landmarks.dat"
f"{data_dir}/shape_predictor_68_face_landmarks.dat"
)
face_recognition_model = dlib.face_recognition_model_v1(
data_dir + "/dlib_face_recognition_resnet_model_v1.dat"
f"{data_dir}/dlib_face_recognition_resnet_model_v1.dat"
Copy link
Author

Choose a reason for hiding this comment

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

Lines 13-16 refactored with the following changes:

return person_names[min_index] + "?" + " ({0:.2f})".format(min_value)
return f"{person_names[min_index]}?" + " ({0:.2f})".format(min_value)
Copy link
Author

Choose a reason for hiding this comment

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

Function find_match refactored with the following changes:

data_dir + "/haarcascade_frontalface_default.xml"
f"{data_dir}/haarcascade_frontalface_default.xml"
Copy link
Author

Choose a reason for hiding this comment

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

Function recognize_faces_in_frame refactored with the following changes:

Comment on lines -55 to +57
data = []
image = Image.fromarray(img)
image = image.resize((30, 30))
data.append(np.array(image))
data = [np.array(image)]
Copy link
Author

Choose a reason for hiding this comment

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

Function image_processing refactored with the following changes:

sentences = [" ".join(s) for s in sentences]

return sentences
return [" ".join(s) for s in sentences]
Copy link
Author

Choose a reason for hiding this comment

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

Function group_words_to_sentences refactored with the following changes:

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

Successfully merging this pull request may close these issues.

0 participants