Skip to content

Commit

Permalink
Merge pull request #7 from soar-zhengjian/master
Browse files Browse the repository at this point in the history
modify some statements to support python3
  • Loading branch information
classicsong authored Nov 23, 2017
2 parents bd9bf3a + a817516 commit 2761504
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 6 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions uai/arch_conf/base_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ def _add_args(self):

def load_params(self):
self.params = vars(self.parser.parse_args())
if self.params.has_key('cpu'):
if 'cpu' in self.params:
if self.params['cpu'] < 1 or self.params["cpu"] > 8:
raise RuntimeError('cpu should be int between 1 to 8, but now:{0}'.format(self.params['cpu']))
if self.params.has_key('memory'):
if 'memory' in self.params:
if self.params['memory'] < 1 or self.params["memory"] > 8:
raise RuntimeError('memory should be int between 1 to 8, but now:{0}'.format(self.params['memory']))
if self.params.has_key('deploy_weight'):
if 'deploy_weight' in self.params:
if int(self.params['deploy_weight']) < 1 or int(self.params["deploy_weight"]) > 100:
raise RuntimeError('deploy_weight should be int between 1 to 100, but now:{0}'.format(self.params['deploy_weight']))

Expand Down
2 changes: 1 addition & 1 deletion uai/cmd/base_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def _cmd_request(self):
self._cmd_common_request()

def _cmd_common_request(self):
if self.cmd_params.has_key('Signature'):
if 'Signature' in self.cmd_params:
self.cmd_params.pop('Signature')
self.cmd_params['Signature'] = _verfy_ac(self.conf_params['private_key'],
self.cmd_params)
Expand Down
2 changes: 1 addition & 1 deletion uai/pack/base_pack_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _load_args(self):

def _analysis_args(self):
self.config.load_params()
if self.config.params.has_key("ai_arch_v"):
if "ai_arch_v" in self.config.params:
if self.platform != self.config.params["ai_arch_v"].lower().split('-')[0]:
raise RuntimeError("ai_arch_v should be one version of " + self.platform)

Expand Down
2 changes: 1 addition & 1 deletion uaitrain/operation/pack_docker_image/base_pack_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,4 @@ def cmd_run(self, args):
self.cpu_image = cpu_image_name

self._build_userimage()


0 comments on commit 2761504

Please sign in to comment.