Skip to content

Sourcery refactored master branch - #1

Open
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master
Open

sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Sep 17, 2023

Copy link
Copy Markdown

Branch master 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 master branch, then run:

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

Help us improve this pull request!

Comment thread afy/cam_fomm.py
Comment on lines -22 to +23
if _platform == 'darwin':
if not opt.is_client:
if not opt.is_client:
if _platform == 'darwin':

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 22-23 refactored with the following changes:

Comment thread afy/cam_fomm.py
Comment on lines -74 to +78
for i, f in enumerate(images_list):
for f in images_list:
if f.endswith('.jpg') or f.endswith('.jpeg') or f.endswith('.png'):
img = cv2.imread(f)
if img is None:
log("Failed to open image: {}".format(f))
log(f"Failed to open image: {f}")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function load_images refactored with the following changes:

Comment thread afy/cam_fomm.py
Comment on lines +165 to +178
elif cam_frames := cam_selector.query_cameras(config['query_n_cams']):
cam_id = (
list(cam_frames)[0]
if len(cam_frames) == 1
else cam_selector.select_camera(
cam_frames, window="CLICK ON YOUR CAMERA"
)
)
log(f"Selected camera {cam_id}")

with open(cam_config, 'w') as f:
yaml.dump({'cam_id': cam_id}, f)
else:
log("No cameras are available")
with open(cam_config, 'w') as f:
yaml.dump({'cam_id': cam_id}, f)
else:
log("No cameras are available")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function select_camera refactored with the following changes:

Comment thread afy/camera_selector.py
continue

for i in range(10):
for _ in range(10):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function query_cameras refactored with the following changes:

Comment thread afy/camera_selector.py
Comment on lines -77 to +85
cv2.putText(grid, f'Click on the web camera to use', (10, grid.shape[0] - 30), 0, 0.7, (200, 200, 200), 2)
cv2.putText(
grid,
'Click on the web camera to use',
(10, grid.shape[0] - 30),
0,
0.7,
(200, 200, 200),
2,
)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function select_camera refactored with the following changes:

Comment thread afy/camera_selector.py
Comment on lines -104 to +112
cam_frames = query_cameras(config['query_n_cams'])

if cam_frames:
if cam_frames := query_cameras(config['query_n_cams']):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 104-106 refactored with the following changes:

Comment thread afy/predictor_local.py
adapt_movement_scale = 1

kp_new = {k: v for k, v in kp_driving.items()}
kp_new = dict(kp_driving.items())

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function normalize_kp refactored with the following changes:

Comment thread afy/predictor_local.py
Comment on lines -114 to +116
kp_landmarks = self.fa.get_landmarks(image)
if kp_landmarks:
if kp_landmarks := self.fa.get_landmarks(image):
kp_image = kp_landmarks[0]
kp_image = self.normalize_alignment_kp(kp_image)
return kp_image
return self.normalize_alignment_kp(kp_image)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function PredictorLocal.get_frame_kp refactored with the following changes:

Comment thread afy/predictor_worker.py
timing = AccumDict()
log = Logger('./var/log/predictor_worker.log', verbose=opt.verbose)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function PredictorWorker.predictor_worker refactored with the following changes:

Comment thread afy/utils.py
pad_h += int(sh * (h / w) - sh) // 2
out = np.pad(img, [[pad_h, pad_h], [pad_w, pad_w], [0,0]], 'constant')
return out
return np.pad(img, [[pad_h, pad_h], [pad_w, pad_w], [0,0]], 'constant')

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function pad_img refactored with the following changes:

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.

0 participants