-
Notifications
You must be signed in to change notification settings - Fork 10
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
Sourcery refactored master branch #1
base: master
Are you sure you want to change the base?
Conversation
calibration = {'objpoints': objpoints, | ||
return {'objpoints': objpoints, | ||
'imgpoints': imgpoints, | ||
'cal_images': cal_images, | ||
'mtx': mtx, | ||
'dist': dist, | ||
'rvecs': rvecs, | ||
'tvecs': tvecs} | ||
|
||
return calibration |
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.
Function calculate_camera_calibration
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
images = [] | ||
for i in range(1, 12): | ||
images.append(imread('../test_images/test%s.jpg' % i)) | ||
|
||
images = [imread('../test_images/test%s.jpg' % i) for i in range(1, 12)] |
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.
Lines 29-32
refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension
)
abs_s = np.absolute(sobel) | ||
|
||
return abs_s | ||
return np.absolute(sobel) |
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.
Function abs_sobel
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
mask = cv2.inRange(hsv, (20, 50, 150), (40, 255, 255)) | ||
|
||
return mask | ||
return cv2.inRange(hsv, (20, 50, 150), (40, 255, 255)) |
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.
Function extract_yellow
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
mask = cv2.inRange(hsv, (0, 0, 0.), (255, 153, 128)) | ||
return mask | ||
return cv2.inRange(hsv, (0, 0, 0.), (255, 153, 128)) |
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.
Function extract_dark
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
mask = cv2.inRange(img, p, 255) | ||
return mask | ||
return cv2.inRange(img, p, 255) |
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.
Function extract_highlights
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
else: | ||
new_left = Line(y=left[0], x=left[1]) | ||
new_right = Line(y=right[0], x=right[1]) | ||
return are_lanes_plausible(new_left, new_right) | ||
new_left = Line(y=left[0], x=left[1]) | ||
new_right = Line(y=right[0], x=right[1]) | ||
return are_lanes_plausible(new_left, new_right) |
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.
Function LaneDetector.__line_plausible
refactored with the following changes:
- Remove unnecessary else after guard condition (
remove-unnecessary-else
)
is_parallel = first_coefi_dif < threshold[0] and second_coefi_dif < threshold[1] | ||
|
||
return is_parallel | ||
return first_coefi_dif < threshold[0] and second_coefi_dif < threshold[1] |
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.
Function Line.is_current_fit_parallel
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
curverad = ((1 + (2 * fit_cr[0] * y_eval / 2. + fit_cr[1]) ** 2) ** 1.5) / np.absolute(2 * fit_cr[0]) | ||
|
||
return curverad | ||
return ( | ||
(1 + (2 * fit_cr[0] * y_eval / 2.0 + fit_cr[1]) ** 2) ** 1.5 | ||
) / np.absolute(2 * fit_cr[0]) |
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.
Function calc_curvature
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.13%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
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:Help us improve this pull request!