mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 19:50:25 -07:00
parent
5babe2daea
commit
6f6bdf7914
12 changed files with 58 additions and 71 deletions
|
@ -18,4 +18,3 @@
|
|||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ patterns = {
|
|||
r'''^
|
||||
(?:{i4}\.){{3}}{i4} # Three parts followed by dots plus one
|
||||
$
|
||||
'''.format(i4=ipv4_component), re.X|re.I
|
||||
'''.format(i4=ipv4_component), re.X | re.I
|
||||
),
|
||||
|
||||
# This matches an IPv6 address, but also permits range expressions.
|
||||
|
@ -143,7 +143,7 @@ patterns = {
|
|||
::(?:ffff:)?(?:{0}\.){{3}}{0}|
|
||||
(?:0:){{5}}ffff:(?:{0}\.){{3}}{0}
|
||||
$
|
||||
'''.format(ipv6_component), re.X|re.I
|
||||
'''.format(ipv6_component), re.X | re.I
|
||||
),
|
||||
|
||||
# This matches a hostname or host pattern including [x:y(:z)] ranges.
|
||||
|
@ -161,11 +161,12 @@ patterns = {
|
|||
{label} # We must have at least one label
|
||||
(?:\.{label})* # Followed by zero or more .labels
|
||||
$
|
||||
'''.format(label=label), re.X|re.I|re.UNICODE
|
||||
'''.format(label=label), re.X | re.I | re.UNICODE
|
||||
),
|
||||
|
||||
}
|
||||
|
||||
|
||||
def parse_address(address, allow_ranges=False):
|
||||
"""
|
||||
Takes a string and returns a (host, port) tuple. If the host is None, then
|
||||
|
|
|
@ -24,6 +24,7 @@ try:
|
|||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
|
||||
def jsonify(result, format=False):
|
||||
''' format JSON output (uncompressed or uncompressed) '''
|
||||
|
||||
|
@ -38,4 +39,3 @@ def jsonify(result, format=False):
|
|||
return json.dumps(result, sort_keys=True, indent=indent, ensure_ascii=False)
|
||||
except UnicodeDecodeError:
|
||||
return json.dumps(result, sort_keys=True, indent=indent)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue