mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
pylint: Fix use-maxsplit-arg
Pylint 2.9.0 new checker: > Emitted when accessing only the first or last element of str.split(). The first and last element can be accessed by using str.split(sep, maxsplit=1)[0] or str.rsplit(sep, maxsplit=1)[-1] instead. Fixes: https://pagure.io/freeipa/issue/9117 Signed-off-by: Stanislav Levin <slev@altlinux.org> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
committed by
Rob Crittenden
parent
106d011e5f
commit
6fd75de5a7
@@ -41,7 +41,7 @@ class ServerInfo(MutableMapping):
|
||||
try:
|
||||
self._language = locale.setlocale(
|
||||
locale.LC_MESSAGES, ''
|
||||
).split('.')[0].lower()
|
||||
).split('.', maxsplit=1)[0].lower()
|
||||
except locale.Error:
|
||||
self._language = 'en_us'
|
||||
|
||||
|
||||
@@ -533,7 +533,7 @@ class LanguageAwareTransport(MultiProtocolTransport):
|
||||
try:
|
||||
lang = locale.setlocale(
|
||||
locale.LC_MESSAGES, ''
|
||||
).split('.')[0].lower()
|
||||
).split('.', maxsplit=1)[0].lower()
|
||||
except locale.Error:
|
||||
# fallback to default locale
|
||||
lang = 'en_us'
|
||||
|
||||
@@ -63,12 +63,6 @@ VERSION = '@VERSION@'
|
||||
|
||||
SETUPTOOLS_VERSION = tuple(int(v) for v in setuptools.__version__.split("."))
|
||||
|
||||
# backwards compatibility with setuptools 0.9.8, split off +gitHASH suffix
|
||||
# PEP 440 was introduced in setuptools 8.
|
||||
if SETUPTOOLS_VERSION < (8, 0, 0):
|
||||
VERSION = VERSION.split('+')[0]
|
||||
|
||||
|
||||
PACKAGE_VERSION = {
|
||||
'cryptography': 'cryptography >= 1.6',
|
||||
'custodia': 'custodia >= 0.3.1',
|
||||
|
||||
@@ -59,7 +59,9 @@ class TestWinsyncMigrate(IntegrationTest):
|
||||
ipa_group = 'ipa_group'
|
||||
ad_user = 'testuser'
|
||||
default_shell = platformconstants.DEFAULT_SHELL
|
||||
selinuxuser = platformconstants.SELINUX_USERMAP_ORDER.split("$")[0]
|
||||
selinuxuser = platformconstants.SELINUX_USERMAP_ORDER.split(
|
||||
"$", maxsplit=1
|
||||
)[0]
|
||||
test_role = 'test_role'
|
||||
test_hbac_rule = 'test_hbac_rule'
|
||||
test_selinux_map = 'test_selinux_map'
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
from ipaplatform.constants import constants as platformconstants
|
||||
|
||||
# for example, user_u:s0
|
||||
selinuxuser1 = platformconstants.SELINUX_USERMAP_ORDER.split("$")[0]
|
||||
selinuxuser2 = platformconstants.SELINUX_USERMAP_ORDER.split("$")[1]
|
||||
selunux_users = platformconstants.SELINUX_USERMAP_ORDER.split("$")
|
||||
selinuxuser1 = selunux_users[0]
|
||||
selinuxuser2 = selunux_users[1]
|
||||
|
||||
selinux_mcs_max = platformconstants.SELINUX_MCS_MAX
|
||||
selinux_mls_max = platformconstants.SELINUX_MLS_MAX
|
||||
|
||||
@@ -281,7 +281,7 @@ class test_cert_find(XMLRPC_test):
|
||||
|
||||
is_db_configured()
|
||||
|
||||
short = api.env.host.split('.')[0]
|
||||
short = api.env.host.split('.', maxsplit=1)[0]
|
||||
|
||||
def test_0001_find_all(self):
|
||||
"""
|
||||
|
||||
@@ -33,8 +33,9 @@ from ipatests.test_xmlrpc.test_user_plugin import get_user_result
|
||||
import pytest
|
||||
|
||||
rule1 = u'selinuxrule1'
|
||||
selinuxuser1 = platformconstants.SELINUX_USERMAP_ORDER.split("$")[0]
|
||||
selinuxuser2 = platformconstants.SELINUX_USERMAP_ORDER.split("$")[1]
|
||||
selinux_users = platformconstants.SELINUX_USERMAP_ORDER.split("$")
|
||||
selinuxuser1 = selinux_users[0]
|
||||
selinuxuser2 = selinux_users[1]
|
||||
|
||||
INVALID_MCS = "Invalid MCS value, must match {}, where max category {}".format(
|
||||
platformconstants.SELINUX_MCS_REGEX,
|
||||
|
||||
Reference in New Issue
Block a user