From 4b44b0d284c1713a853d358d798f4416ab9516bc Mon Sep 17 00:00:00 2001 From: Dmitry Vasilev Date: Mon, 25 Apr 2022 00:00:34 +0300 Subject: [PATCH 1/2] Fix PEP8 E111 issue --- .../src/main/resources/python/rest.mustache | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/rest.mustache b/modules/openapi-generator/src/main/resources/python/rest.mustache index d4293e70da23..4740f10fd003 100644 --- a/modules/openapi-generator/src/main/resources/python/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/rest.mustache @@ -290,10 +290,10 @@ def is_ipv4(target): """ Test if IPv4 address or not """ try: - chk = ipaddress.IPv4Address(target) - return True + chk = ipaddress.IPv4Address(target) + return True except ipaddress.AddressValueError: - return False + return False def in_ipv4net(target, net): """ Test if target belongs to given IPv4 network @@ -333,6 +333,6 @@ def should_bypass_proxies(url, no_proxy=None): if is_ipv4(parsed.hostname): for item in entries: - if in_ipv4net(parsed.hostname, item): - return True + if in_ipv4net(parsed.hostname, item): + return True return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) From 060852ac109e4d1ccd5b58994bf26ee1127c7afb Mon Sep 17 00:00:00 2001 From: Dmitry Vasiliev Date: Mon, 25 Apr 2022 00:35:58 +0300 Subject: [PATCH 2/2] Update samples --- samples/client/petstore/python/petstore_api/rest.py | 10 +++++----- .../petstore_api/rest.py | 10 +++++----- .../x-auth-id-alias/python/x_auth_id_alias/rest.py | 10 +++++----- .../dynamic-servers/python/dynamic_servers/rest.py | 10 +++++----- .../client/petstore/python/petstore_api/rest.py | 10 +++++----- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index 476138a6bc84..e264c456aab0 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -298,10 +298,10 @@ def is_ipv4(target): """ Test if IPv4 address or not """ try: - chk = ipaddress.IPv4Address(target) - return True + chk = ipaddress.IPv4Address(target) + return True except ipaddress.AddressValueError: - return False + return False def in_ipv4net(target, net): """ Test if target belongs to given IPv4 network @@ -341,6 +341,6 @@ def should_bypass_proxies(url, no_proxy=None): if is_ipv4(parsed.hostname): for item in entries: - if in_ipv4net(parsed.hostname, item): - return True + if in_ipv4net(parsed.hostname, item): + return True return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py index 476138a6bc84..e264c456aab0 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py @@ -298,10 +298,10 @@ def is_ipv4(target): """ Test if IPv4 address or not """ try: - chk = ipaddress.IPv4Address(target) - return True + chk = ipaddress.IPv4Address(target) + return True except ipaddress.AddressValueError: - return False + return False def in_ipv4net(target, net): """ Test if target belongs to given IPv4 network @@ -341,6 +341,6 @@ def should_bypass_proxies(url, no_proxy=None): if is_ipv4(parsed.hostname): for item in entries: - if in_ipv4net(parsed.hostname, item): - return True + if in_ipv4net(parsed.hostname, item): + return True return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py index c3566a6d0b23..636f31b19a36 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py @@ -298,10 +298,10 @@ def is_ipv4(target): """ Test if IPv4 address or not """ try: - chk = ipaddress.IPv4Address(target) - return True + chk = ipaddress.IPv4Address(target) + return True except ipaddress.AddressValueError: - return False + return False def in_ipv4net(target, net): """ Test if target belongs to given IPv4 network @@ -341,6 +341,6 @@ def should_bypass_proxies(url, no_proxy=None): if is_ipv4(parsed.hostname): for item in entries: - if in_ipv4net(parsed.hostname, item): - return True + if in_ipv4net(parsed.hostname, item): + return True return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py index b73beb6fd00e..2ad59429196c 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py @@ -298,10 +298,10 @@ def is_ipv4(target): """ Test if IPv4 address or not """ try: - chk = ipaddress.IPv4Address(target) - return True + chk = ipaddress.IPv4Address(target) + return True except ipaddress.AddressValueError: - return False + return False def in_ipv4net(target, net): """ Test if target belongs to given IPv4 network @@ -341,6 +341,6 @@ def should_bypass_proxies(url, no_proxy=None): if is_ipv4(parsed.hostname): for item in entries: - if in_ipv4net(parsed.hostname, item): - return True + if in_ipv4net(parsed.hostname, item): + return True return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/openapi3/client/petstore/python/petstore_api/rest.py b/samples/openapi3/client/petstore/python/petstore_api/rest.py index 476138a6bc84..e264c456aab0 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python/petstore_api/rest.py @@ -298,10 +298,10 @@ def is_ipv4(target): """ Test if IPv4 address or not """ try: - chk = ipaddress.IPv4Address(target) - return True + chk = ipaddress.IPv4Address(target) + return True except ipaddress.AddressValueError: - return False + return False def in_ipv4net(target, net): """ Test if target belongs to given IPv4 network @@ -341,6 +341,6 @@ def should_bypass_proxies(url, no_proxy=None): if is_ipv4(parsed.hostname): for item in entries: - if in_ipv4net(parsed.hostname, item): - return True + if in_ipv4net(parsed.hostname, item): + return True return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} )