mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Python code modernization, 8/n (#1179)
* Use to_text instead of to_native. * Remove no longer needed pylint ignores. * Remove another pylint ignore. * Remove no longer needed ignore. * Address redefined-outer-name. * Address consider-using-with.
This commit is contained in:
@@ -10,7 +10,7 @@ from __future__ import annotations
|
||||
import base64
|
||||
import random
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_text
|
||||
|
||||
|
||||
def generate_insecure_key() -> bytes:
|
||||
@@ -31,7 +31,7 @@ def scramble(value: str, key: bytes) -> str:
|
||||
b_value = to_bytes(value)
|
||||
k = key[0]
|
||||
b_value = bytes([k ^ b for b in b_value])
|
||||
return f"=S={to_native(base64.b64encode(b_value))}"
|
||||
return f"=S={to_text(base64.b64encode(b_value))}"
|
||||
|
||||
|
||||
def unscramble(value: str, key: bytes) -> str:
|
||||
|
||||
Reference in New Issue
Block a user