Skip to content

Commit

Permalink
Merge pull request #1648 from Bidaya0/refactor/sca_scan_change_file_p…
Browse files Browse the repository at this point in the history
…lace

fix: ruff check
  • Loading branch information
Bidaya0 authored Jul 24, 2023
2 parents df503d0 + 2d6ad9f commit a51aded
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dongtai_common/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def is_system_admin(self):
return self.is_superuser == 1

def is_talent_admin(self):
return self.is_superuser == 2 or self.is_superuser == 1 or self.is_superuser == 6
return self.is_superuser in {2, 1, 6}

def get_talent(self):
try:
Expand Down
2 changes: 1 addition & 1 deletion dongtai_engine/preheat.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def register(cls, function):
if "return" in annotation_dict:
del annotation_dict["return"]

if annotation_dict == {"user_id": int} or annotation_dict == {"user_id": "int"}:
if annotation_dict == {"user_id": int} or annotation_dict == {"user_id": "int"}: # noqa: PLR1714
pass
else:
logger.info(f"{function.__name__} annotations not fit in")
Expand Down
2 changes: 1 addition & 1 deletion dongtai_engine/signals/handlers/vul_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def parse_cookie(req_header: str, taint_value: str) -> str | None:
# fixme 解析,然后匹配
_header_list = header.split(":")
_header_name = _header_list[0]
if _header_name == "cookie" or _header_name == "Cookie":
if _header_name in ("cookie", "Cookie"):
cookie_raw = ":".join(_header_list[1:])
break

Expand Down
2 changes: 1 addition & 1 deletion dongtai_engine/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def vul_recheck():
for index in range(item_length):
_header_list = header_raw[index].split(":")
_header_name = _header_list[0]
if _header_name == "cookie" or _header_name == "Cookie":
if _header_name in ("cookie", "Cookie"):
cookie_index = index
cookie_raw = ":".join(_header_list[1:])
break
Expand Down
2 changes: 1 addition & 1 deletion dongtai_web/aggr_vul/aggr_vul_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def get_vul_list_from_elastic_search(
field = ""
opt = ""
if isinstance(info, dict):
field = list(info.keys())[0]
field = next(iter(info.keys()))
opt = "lt" if info[field]["order"] == "desc" else "gt"
if isinstance(info, str):
if info.startswith("-"):
Expand Down
2 changes: 1 addition & 1 deletion dongtai_web/views/scas.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def get_vul_list_from_elastic_searchv2(
for info in order_list:
field = ""
if isinstance(info, dict):
field = list(info.keys())[0]
field = next(iter(info.keys()))
if isinstance(info, str):
field = info[1:] if info.startswith("-") else info
if field == "package_name.keyword":
Expand Down

0 comments on commit a51aded

Please sign in to comment.