-
Notifications
You must be signed in to change notification settings - Fork 9
Remove duplicate worker code #19
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
Conversation
@@ -91,7 +95,8 @@ def _get_img_ids_and_features(self): | |||
known_features.append(current_features) | |||
return img_ids, np.array(known_features) | |||
|
|||
def _prepare_matches(self, matches, that_img_id, distance_score): | |||
@classmethod |
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.
Should this be @staticmethod, as it does not seem that cls is used?
def _delete_img(self, img_id): | ||
self.logger.debug('deleting img') | ||
for extension in self.allowed_file_extensions: | ||
img_name = "{}.{}".format(img_id, extension) | ||
fpath = os.path.join(self.img_dir, img_name) | ||
try: | ||
os.remove(fpath) | ||
self.logger.debug("removed {}".format(img_id)) | ||
except: | ||
self.logger.debug("removed %s", img_id) |
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.
Is it preferable to use printf style strings over newer format strings? (should we consider using python 3.6, perhaps and using f'{}' instead?)
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.
Using %s
here is by design since this is a logger call. If you do self.logger.debug('removed {}'.format(img_id))
, the format string will always be allocated even if the log level is higher than debug. With self.logger.debug('removed %s', img_id)
, the logging framework will only format the string if it's actually going to be printed.
@@ -1,3 +1,5 @@ | |||
# pylint: disable=too-few-public-methods |
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.
Should we specify the inline pylint instructions into a pylintrc or are they specific to these few cases?
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.
These are just a few cases (some of which I'll also refactor). In general you want .pylintrc
to be as empty as possible so that you get the full linting goodness.
See #9