-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
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
base: master
Are you sure you want to change the base?
Conversation
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.
Due to GitHub API limits, only the first 60 comments can be shown.
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 opencv_windows_management.__init__ refactored with the following changes:
- Replace
dict()with{}(dict-literal)
ch04-图片/show_image.py
Outdated
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 39-46 refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons) - Swap positions of nested conditionals (
swap-nested-ifs) - Hoist nested repeated code outside conditional statements (
hoist-similar-statement-from-if)
This removes the following comments ( why? ):
#TODO 分辨率太大,需要缩放
# if t.any():
# if temp == img:
# t = temp == img
# if t.all():
ch05-视频/5.VideoPlay.py
Outdated
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 27-27 refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation) - Remove unnecessary calls to
str()from formatted values in f-strings (remove-str-from-fstring)
ch05-视频/5.VideoWriter.py
Outdated
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 21-31 refactored with the following changes:
- Swap if/else branches (
swap-if-else-branches) - Remove unnecessary else after guard condition (
remove-unnecessary-else)
ch05-视频/VideoCaptureOnePicture.py
Outdated
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 32-32 refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
ch22-直方图/hist.py
Outdated
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 hist_curve refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
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 56-56 refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
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 53-63 refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation) - Remove unnecessary else after guard condition (
remove-unnecessary-else)
This removes the following comments ( why? ):
# 静止画面,不用重复计算
ch26-Hough圆环变换/HoughCircles_chess.py
Outdated
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 detect_weiqi refactored with the following changes:
- Move assignment closer to its usage within a block (
move-assign-in-block) - Move setting of default value for variable into
elsebranch (introduce-default-else) - Replace if statement with if expression (
assign-if-exp)
ch37-特征匹配/37.4-SIFT_match.py
Outdated
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 28-36 refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension)
This removes the following comments ( why? ):
# Apply ratio test
# 比值测试,首先获取与 A距离最近的点 B (最近)和 C (次近),
# 因为假设匹配是一一对应的,真正的匹配的理想距离为0
# 只有当 B/C 小于阀值时(0.75)才被认为是匹配,
ch37-特征匹配/37.5-FLANN匹配器.py
Outdated
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 41-41 refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore)
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 31-35 refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension)
This removes the following comments ( why? ):
# store all the good matches as per Lowe's ratio test.
ch43-姿势估计/calib3d.py
Outdated
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 75-75 refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
ch44-对极几何/code.py
Outdated
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 67-67 refactored with the following changes:
- Remove unnecessary calls to
enumeratewhen the index is not used (remove-unused-enumerate)
ch47-支持向量机/47.2-使用SVM进行-手写数据OCR.py
Outdated
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 hog refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# hist is a 64 bit vector
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 18-88 refactored with the following changes:
- Replace call to format with f-string [×2] (
use-fstring-for-formatting) - Merge consecutive list appends into a single extend (
merge-list-appends-into-extend)
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 60-108 refactored with the following changes:
- Merge consecutive list appends into a single extend (
merge-list-appends-into-extend) - Replace call to format with f-string (
use-fstring-for-formatting)
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 get_image_difference refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# taking only 10% of histogram diff, since it's less accurate than template method
my10-识别二维码/QR_Scaner1.py
Outdated
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 main refactored with the following changes:
- Replace call to format with f-string [×2] (
use-fstring-for-formatting)
官方samples/_coverage.py
Outdated
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 15-15 refactored with the following changes:
- Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension) - Replace unneeded comprehension with generator (
comprehension-to-generator) - Use f-string instead of string concatenation (
use-fstring-for-concatenation)
官方samples/asift.py
Outdated
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 affine_detect refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
官方samples/calibrate.py
Outdated
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 37-109 refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Replace interpolated string formatting with f-string [×2] (
replace-interpolation-with-fstring) - Use f-string instead of string concatenation (
use-fstring-for-concatenation)
This removes the following comments ( why? ):
# default
官方samples/common.py
Outdated
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 rect2rect_mtx refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
官方samples/common.py
Outdated
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 grouper refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
官方samples/common.py
Outdated
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 mosaic refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
官方samples/fitline.py
Outdated
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 52-55 refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
官方samples/fitline.py
Outdated
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 93-96 refactored with the following changes:
- Swap positions of nested conditionals (
swap-nested-ifs) - Hoist nested repeated code outside conditional statements (
hoist-similar-statement-from-if) - Replace if statement with if expression (
assign-if-exp)
官方samples/gaussian_mix.py
Outdated
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 make_gaussians refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore)
官方samples/hist.py
Outdated
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 hist_curve refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
官方samples/houghlines.py
Outdated
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 31-51 refactored with the following changes:
- Remove redundant conditional (
remove-redundant-if)
This removes the following comments ( why? ):
# HoughLines
# HoughLinesP
Branch
masterrefactored 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
masterbranch, then run:Help us improve this pull request!