Skip to content

Commit

Permalink
Merge pull request #639 from pytorch/pylint_fix
Browse files Browse the repository at this point in the history
Fixed pylint issue for server and model-archiver
  • Loading branch information
dhaniram-kshirsagar authored Aug 25, 2020
2 parents 66216ce + f6441a5 commit 7e84927
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion model-archiver/model_archiver/model_archiver_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class ModelArchiverError(Exception):
Error for Model Archiver module
"""
def __init__(self, message):
super(ModelArchiverError, self).__init__(message)
super().__init__(message)
4 changes: 2 additions & 2 deletions ts/model_service_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def __init__(self, s_type=None, s_name=None, host_addr=None, port_num=None):
self.sock_name, self.port = s_name, -1
try:
os.remove(s_name)
except OSError:
except OSError as e :
if os.path.exists(s_name):
raise RuntimeError("socket already in use: {}.".format(s_name))
raise RuntimeError("socket already in use: {}.".format(s_name)) from e

elif s_type == "tcp":
self.sock_name = host_addr if host_addr is not None else "127.0.0.1"
Expand Down
2 changes: 1 addition & 1 deletion ts/torch_handler/object_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ObjectDetector(VisionHandler):
threshold = 0.5

def initialize(self, context):
super(ObjectDetector, self).initialize(context)
super().initialize(context)

# Torchvision breaks with object detector models before 0.6.0
if version.parse(torchvision_version) < version.parse("0.6.0"):
Expand Down
6 changes: 2 additions & 4 deletions ts/torch_handler/text_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# pylint: disable=W0223
# Details : https://github.com/PyCQA/pylint/issues/3098
"""
Base module for all text based default handler.
Contains various text based utility methods
Expand All @@ -26,12 +24,12 @@ class TextHandler(BaseHandler, ABC):
Contains various text based utility methods
"""
def __init__(self):
super(TextHandler, self).__init__()
super().__init__()
self.source_vocab = None
self.tokenizer = get_tokenizer('basic_english')

def initialize(self, context):
super(TextHandler, self).initialize(context)
super().initialize(context)
self.initialized = False
source_vocab = self.manifest['model']['sourceVocab'] if 'sourceVocab' in self.manifest['model'] else None
if source_vocab:
Expand Down

0 comments on commit 7e84927

Please sign in to comment.