mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
batch 2 - update Python idiom to 3.7 using pyupgrade (#11342)
* batch 2 - update Python idiom to 3.7 using pyupgrade * Apply suggestions from code review
This commit is contained in:
parent
9e363c9f94
commit
266d9d3fb0
19 changed files with 64 additions and 70 deletions
|
|
@ -31,7 +31,7 @@ class ActionModule(ActionBase):
|
|||
if task_vars is None:
|
||||
task_vars = dict()
|
||||
|
||||
result = super(ActionModule, self).run(tmp, task_vars)
|
||||
result = super().run(tmp, task_vars)
|
||||
del tmp # tmp no longer has any effect
|
||||
|
||||
if "that" not in self._task.args:
|
||||
|
|
|
|||
|
|
@ -128,4 +128,4 @@ STATIC_URL = "/static/"
|
|||
STATIC_ROOT = "/tmp/django-static"
|
||||
|
||||
if "DJANGO_ANSIBLE_RAISE" in os.environ:
|
||||
raise ValueError("DJANGO_ANSIBLE_RAISE={0}".format(os.environ["DJANGO_ANSIBLE_RAISE"]))
|
||||
raise ValueError("DJANGO_ANSIBLE_RAISE={}".format(os.environ["DJANGO_ANSIBLE_RAISE"]))
|
||||
|
|
|
|||
|
|
@ -128,4 +128,4 @@ STATIC_URL = "/static/"
|
|||
STATIC_ROOT = "/tmp/django-static"
|
||||
|
||||
if "DJANGO_ANSIBLE_RAISE" in os.environ:
|
||||
raise ValueError("DJANGO_ANSIBLE_RAISE={0}".format(os.environ["DJANGO_ANSIBLE_RAISE"]))
|
||||
raise ValueError("DJANGO_ANSIBLE_RAISE={}".format(os.environ["DJANGO_ANSIBLE_RAISE"]))
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ except ImportError:
|
|||
|
||||
# Argument parsing
|
||||
if len(sys.argv) != 4:
|
||||
print("Syntax: {0} <bind> <port> <path>".format(sys.argv[0]))
|
||||
print(f"Syntax: {sys.argv[0]} <bind> <port> <path>")
|
||||
sys.exit(-1)
|
||||
|
||||
HOST, PORT, PATH = sys.argv[1:4]
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import lmdb
|
|||
map_size = 1024 * 100
|
||||
env = lmdb.open("./jp.mdb", map_size=map_size)
|
||||
with env.begin(write=True) as txn:
|
||||
txn.put("fr".encode(), "France".encode())
|
||||
txn.put("nl".encode(), "Netherlands".encode())
|
||||
txn.put("es".encode(), "Spain".encode())
|
||||
txn.put("be".encode(), "Belgium".encode())
|
||||
txn.put("lu".encode(), "Luxembourg".encode())
|
||||
txn.put(b"fr", b"France")
|
||||
txn.put(b"nl", b"Netherlands")
|
||||
txn.put(b"es", b"Spain")
|
||||
txn.put(b"be", b"Belgium")
|
||||
txn.put(b"lu", b"Luxembourg")
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ if len(sys.argv) > 3:
|
|||
ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
||||
|
||||
if HAS_TLS and ssl_ctx is not None:
|
||||
print("Using %s and %s" % (certfile, keyfile))
|
||||
print(f"Using {certfile} and {keyfile}")
|
||||
ssl_ctx.load_cert_chain(certfile=certfile, keyfile=keyfile)
|
||||
|
||||
print("Start SMTP server on port", port1)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class EchoServer(BaseHTTPRequestHandler):
|
|||
|
||||
def run_webserver():
|
||||
webServer = HTTPServer((hostname, server_port), EchoServer)
|
||||
print("Server started http://%s:%s" % (hostname, server_port))
|
||||
print(f"Server started http://{hostname}:{server_port}")
|
||||
|
||||
try:
|
||||
webServer.serve_forever()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ username = sys.argv[3]
|
|||
password = sys.argv[4]
|
||||
|
||||
if username:
|
||||
url = "http://%s:%s@127.0.0.1:9001/RPC2" % (quote(username, safe=""), quote(password, safe=""))
|
||||
url = "http://{}:{}@127.0.0.1:9001/RPC2".format(quote(username, safe=""), quote(password, safe=""))
|
||||
else:
|
||||
url = "http://127.0.0.1:9001/RPC2"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue