diff --git a/ipaclient/remote_plugins/2_114/automember.py b/ipaclient/remote_plugins/2_114/automember.py
index 09b5a8d01..f6b941d64 100644
--- a/ipaclient/remote_plugins/2_114/automember.py
+++ b/ipaclient/remote_plugins/2_114/automember.py
@@ -16,7 +16,7 @@ from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
-__doc__ = _("""
+__doc__ = _(r"""
Auto Membership Rule.
Bring clarity to the membership of hosts and users by configuring inclusive
diff --git a/ipaclient/remote_plugins/2_114/group.py b/ipaclient/remote_plugins/2_114/group.py
index 86d8f7d4a..5bf4a8580 100644
--- a/ipaclient/remote_plugins/2_114/group.py
+++ b/ipaclient/remote_plugins/2_114/group.py
@@ -16,7 +16,7 @@ from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
-__doc__ = _("""
+__doc__ = _(r"""
Groups of users
Manage groups of users. By default, new groups are POSIX groups. You
diff --git a/ipaclient/remote_plugins/2_114/hbactest.py b/ipaclient/remote_plugins/2_114/hbactest.py
index b0c49b71b..4b168f3d9 100644
--- a/ipaclient/remote_plugins/2_114/hbactest.py
+++ b/ipaclient/remote_plugins/2_114/hbactest.py
@@ -16,7 +16,7 @@ from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
-__doc__ = _("""
+__doc__ = _(r"""
Simulate use of Host-based access controls
HBAC rules control who can access what services on what hosts.
diff --git a/ipaclient/remote_plugins/2_114/trust.py b/ipaclient/remote_plugins/2_114/trust.py
index 69226663a..4c26599dc 100644
--- a/ipaclient/remote_plugins/2_114/trust.py
+++ b/ipaclient/remote_plugins/2_114/trust.py
@@ -16,7 +16,7 @@ from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
-__doc__ = _("""
+__doc__ = _(r"""
Cross-realm trusts
Manage trust relationship between IPA and Active Directory domains.
diff --git a/ipaclient/remote_plugins/2_156/automember.py b/ipaclient/remote_plugins/2_156/automember.py
index 09b5a8d01..f6b941d64 100644
--- a/ipaclient/remote_plugins/2_156/automember.py
+++ b/ipaclient/remote_plugins/2_156/automember.py
@@ -16,7 +16,7 @@ from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
-__doc__ = _("""
+__doc__ = _(r"""
Auto Membership Rule.
Bring clarity to the membership of hosts and users by configuring inclusive
diff --git a/ipaclient/remote_plugins/2_156/group.py b/ipaclient/remote_plugins/2_156/group.py
index ed57c4caa..e18003ecb 100644
--- a/ipaclient/remote_plugins/2_156/group.py
+++ b/ipaclient/remote_plugins/2_156/group.py
@@ -16,7 +16,7 @@ from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
-__doc__ = _("""
+__doc__ = _(r"""
Groups of users
Manage groups of users. By default, new groups are POSIX groups. You
diff --git a/ipaclient/remote_plugins/2_156/hbactest.py b/ipaclient/remote_plugins/2_156/hbactest.py
index b0c49b71b..4b168f3d9 100644
--- a/ipaclient/remote_plugins/2_156/hbactest.py
+++ b/ipaclient/remote_plugins/2_156/hbactest.py
@@ -16,7 +16,7 @@ from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
-__doc__ = _("""
+__doc__ = _(r"""
Simulate use of Host-based access controls
HBAC rules control who can access what services on what hosts.
diff --git a/ipaclient/remote_plugins/2_156/trust.py b/ipaclient/remote_plugins/2_156/trust.py
index 39a563831..c5c8f60e6 100644
--- a/ipaclient/remote_plugins/2_156/trust.py
+++ b/ipaclient/remote_plugins/2_156/trust.py
@@ -16,7 +16,7 @@ from ipapython.dnsutil import DNSName
if six.PY3:
unicode = str
-__doc__ = _("""
+__doc__ = _(r"""
Cross-realm trusts
Manage trust relationship between IPA and Active Directory domains.
diff --git a/ipaclient/remote_plugins/compat.py b/ipaclient/remote_plugins/compat.py
index c1ae63539..2a600fccc 100644
--- a/ipaclient/remote_plugins/compat.py
+++ b/ipaclient/remote_plugins/compat.py
@@ -2,6 +2,8 @@
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
#
+from __future__ import unicode_literals
+
import importlib
import os
import re
@@ -42,19 +44,19 @@ def get_package(server_info, client):
if not is_valid:
if not client.isconnected():
client.connect(verbose=False)
- env = client.forward(u'env', u'api_version', version=u'2.0')
+ env = client.forward('env', 'api_version', version='2.0')
try:
server_version = env['result']['api_version']
except KeyError:
- ping = client.forward(u'ping', version=u'2.0')
+ ping = client.forward('ping', version='2.0')
try:
- match = re.search(u'API version (2\.[0-9]+)', ping['summary'])
+ match = re.search(r'API version (2\.[0-9]+)', ping['summary'])
except KeyError:
match = None
if match is not None:
server_version = match.group(1)
else:
- server_version = u'2.0'
+ server_version = '2.0'
server_info['version'] = server_version
server_info.update_validity()
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 084ee5f91..f0204a151 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -24,6 +24,8 @@ The classes in this module make heavy use of Python container emulation. If
you are unfamiliar with this Python feature, see
http://docs.python.org/ref/sequence-types.html
"""
+from __future__ import unicode_literals
+
import logging
import operator
import re
@@ -173,7 +175,7 @@ class Plugin(ReadOnly):
def __summary_getter(cls):
doc = cls.doc
if not _(doc).msg:
- return u'<%s.%s>' % (cls.__module__, cls.__name__)
+ return '<%s.%s>' % (cls.__module__, cls.__name__)
else:
return unicode(doc).split('\n\n', 1)[0].strip()
@@ -467,7 +469,7 @@ class API(ReadOnly):
level = ipa_log_manager.convert_log_level(match.group(1))
value = getattr(self.env, attr)
- regexps = re.split('\s*,\s*', value)
+ regexps = re.split(r'\s*,\s*', value)
# Add the regexp, it maps to the configured level
for regexp in regexps:
diff --git a/ipapython/certdb.py b/ipapython/certdb.py
index dcab5512e..84ce1cf35 100644
--- a/ipapython/certdb.py
+++ b/ipapython/certdb.py
@@ -554,7 +554,7 @@ class NSSDatabase:
chain = result.output.splitlines()
for c in chain:
- m = re.match('\s*"(.*)" \[.*', c)
+ m = re.match(r'\s*"(.*)" \[.*', c)
if m:
root_nicknames.append(m.groups()[0])
diff --git a/ipapython/dn.py b/ipapython/dn.py
index aa15c19ca..8974b420c 100644
--- a/ipapython/dn.py
+++ b/ipapython/dn.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-'''
+r'''
Goal
----
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index f144b9809..d87b9e3c1 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -310,7 +310,7 @@ def template_str(txt, vars):
# eval() is a special string one can insert into a template to have the
# Python interpreter evaluate the string. This is intended to allow
# math to be performed in templates.
- pattern = re.compile('(eval\s*\(([^()]*)\))')
+ pattern = re.compile(r'(eval\s*\(([^()]*)\))')
val = pattern.sub(lambda x: str(eval(x.group(2))), val)
return val
@@ -1145,7 +1145,7 @@ def config_replace_variables(filepath, replacevars=dict(), appendvars=dict(),
One have to run restore_context(filepath) afterwards or
security context of the file will not be correct after modification
"""
- pattern = re.compile('''
+ pattern = re.compile(r'''
(^
\s*
(?P