Skip to content
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

fix: 修复失效toml文件;mypy check failed #830

Merged
merged 9 commits into from
Dec 7, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ def validate_rsa_secret(self, private_key_content: bytes, public_key_content: by

def create_rsa_secret(self, options: dict):
random_flag = options.get("random_flag")
private_key: bytes
public_key: bytes
if not random_flag:
# read the private_key and public key from the file
private_key_file = options.get("private_key_file")
public_key_file = options.get("public_key_file")
private_key_file: str = options.get("private_key_file", "")
public_key_file: str = options.get("public_key_file", "")
with open(private_key_file, "rb") as private_file:
private_key = private_file.read()

Expand Down Expand Up @@ -92,10 +94,10 @@ def create_rsa_secret(self, options: dict):
)

# base64加密入库
public_key = base64.b64encode(public_key).decode()
private_key = base64.b64encode(private_key).decode()
public_key_base64: str = base64.b64encode(public_key).decode()
private_key_base64: str = base64.b64encode(private_key).decode()

return public_key, private_key
return public_key_base64, private_key_base64

def handle(self, *args, **options):
category_id = options.get("category_id")
Expand Down
2 changes: 1 addition & 1 deletion src/api/bkuser_core/categories/plugins/local/syncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def _sync_users(self, parser_set: "ParserSet", users: list, is_overwrite: bool =
success_count = 0

total = len(users)
should_deleted_department_profile_relation_ids = []
should_deleted_department_profile_relation_ids: list = []
for index, user_raw_info in enumerate(users):
if self._judge_data_all_none(user_raw_info):
logger.debug("empty line, skipping")
Expand Down
33 changes: 20 additions & 13 deletions src/api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ opentelemetry-instrumentation-requests = "0.26b1"
opentelemetry-instrumentation-celery = "0.26b1"
opentelemetry-instrumentation-logging = "0.26b1"
opentelemetry-exporter-jaeger = "1.7.1"
rsa = "3.4.2"

rsa = "^4.9"

[tool.poetry.dev-dependencies]
ipython = "^7.15.0"
Expand Down Expand Up @@ -88,4 +87,4 @@ url = "https://mirrors.tencent.com/pypi/simple/"

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "bkuser_core.config.overlays.dev"
addopts = "--disable-pytest-warnings --reuse-db"
addopts = "--disable-pytest-warnings --reuse-db"