Skip to content

Commit

Permalink
fix and enable flake8 E721
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatV committed May 25, 2024
1 parent 230da30 commit add3f6d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
- id: flake8
args:
- --count
- --select=E9,F63,F7,F82
- --select=E9,F63,F7,F82,E721
- --show-source
- --statistics
exclude: ^benchmark/|^test_tipc/
Expand Down
20 changes: 10 additions & 10 deletions ppocr/losses/distillation_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def _check_model_name_pairs(self, model_name_pairs):
def _check_maps_name(self, maps_name):
if maps_name is None:
return None
elif type(maps_name) == str:
elif isinstance(maps_name, str):
return [maps_name]
elif type(maps_name) == list:
elif isinstance(maps_name, list):
return [maps_name]
else:
return None
Expand Down Expand Up @@ -174,9 +174,9 @@ def _check_model_name_pairs(self, model_name_pairs):
def _check_maps_name(self, maps_name):
if maps_name is None:
return None
elif type(maps_name) == str:
elif isinstance(maps_name, str):
return [maps_name]
elif type(maps_name) == list:
elif isinstance(maps_name, list):
return [maps_name]
else:
return None
Expand Down Expand Up @@ -282,9 +282,9 @@ def _check_model_name_pairs(self, model_name_pairs):
def _check_maps_name(self, maps_name):
if maps_name is None:
return None
elif type(maps_name) == str:
elif isinstance(maps_name, str):
return [maps_name]
elif type(maps_name) == list:
elif isinstance(maps_name, list):
return [maps_name]
else:
return None
Expand Down Expand Up @@ -428,9 +428,9 @@ def _check_model_name_pairs(self, model_name_pairs):
def _check_maps_name(self, maps_name):
if maps_name is None:
return None
elif type(maps_name) == str:
elif isinstance(maps_name, str):
return [maps_name]
elif type(maps_name) == list:
elif isinstance(maps_name, list):
return [maps_name]
else:
return None
Expand Down Expand Up @@ -536,9 +536,9 @@ def _check_model_name_pairs(self, model_name_pairs):
def _check_maps_name(self, maps_name):
if maps_name is None:
return None
elif type(maps_name) == str:
elif isinstance(maps_name, str):
return [maps_name]
elif type(maps_name) == list:
elif isinstance(maps_name, list):
return [maps_name]
else:
return None
Expand Down
2 changes: 1 addition & 1 deletion tools/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def train(
if "global_step" in pre_best_model_dict:
global_step = pre_best_model_dict["global_step"]
start_eval_step = 0
if type(eval_batch_step) == list and len(eval_batch_step) >= 2:
if isinstance(eval_batch_step, list) and len(eval_batch_step) >= 2:
start_eval_step = eval_batch_step[0] if not eval_batch_epoch else 0
eval_batch_step = (
eval_batch_step[1]
Expand Down

0 comments on commit add3f6d

Please sign in to comment.