Skip to content

Commit

Permalink
pylint: Fix C0207(use-maxsplit-arg)
Browse files Browse the repository at this point in the history
Since Pylint 2.9.0 there is new check:
> New checker use-maxsplit-arg. Emitted either when accessing only the
first or last element of str.split().

See pylint-dev/pylint#4440 for details.
  • Loading branch information
stanislavlevin committed Aug 3, 2021
1 parent 0f06bf3 commit b4bd22f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ipaclient/remote_plugins/__init__.py
Expand Up @@ -40,7 +40,7 @@ def __init__(self, api):
try:
self._language = locale.setlocale(
locale.LC_MESSAGES, ''
).split('.')[0].lower()
).split('.', maxsplit=1)[0].lower()
except locale.Error:
self._language = 'en_us'

Expand Down
2 changes: 1 addition & 1 deletion ipalib/rpc.py
Expand Up @@ -533,7 +533,7 @@ def get_host_info(self, host):
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'
Expand Down
6 changes: 0 additions & 6 deletions ipasetup.py.in
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions ipatests/test_integration/test_winsyncmigrate.py
Expand Up @@ -10,7 +10,7 @@

import pytest

from ipaplatform.constants import constants as platformconstants
from ipaplatform.constants import constants

from ipatests.pytest_ipa.integration import tasks
from ipatests.test_integration.base import IntegrationTest
Expand Down Expand Up @@ -58,8 +58,8 @@ class TestWinsyncMigrate(IntegrationTest):

ipa_group = 'ipa_group'
ad_user = 'testuser'
default_shell = platformconstants.DEFAULT_SHELL
selinuxuser = platformconstants.SELINUX_USERMAP_ORDER.split("$")[0]
default_shell = constants.DEFAULT_SHELL
selinuxuser = constants.SELINUX_USERMAP_ORDER.split("$", maxsplit=1)[0]
test_role = 'test_role'
test_hbac_rule = 'test_hbac_rule'
test_selinux_map = 'test_selinux_map'
Expand Down
6 changes: 3 additions & 3 deletions ipatests/test_util.py
Expand Up @@ -41,17 +41,17 @@ def __init__(self, *ops):
self.__ops = frozenset(ops)
self.__prop = 'prop value'

def __get_prop(self):
def __get_prop(self): # pylint: disable=unused-private-member
if 'get' not in self.__ops:
raise AttributeError('get prop')
return self.__prop

def __set_prop(self, value):
def __set_prop(self, value): # pylint: disable=unused-private-member
if 'set' not in self.__ops:
raise AttributeError('set prop')
self.__prop = value

def __del_prop(self):
def __del_prop(self): # pylint: disable=unused-private-member
if 'del' not in self.__ops:
raise AttributeError('del prop')
self.__prop = None
Expand Down
5 changes: 3 additions & 2 deletions ipatests/test_webui/data_selinuxusermap.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ipatests/test_xmlrpc/test_cert_plugin.py
Expand Up @@ -281,7 +281,7 @@ def certfind_setup(self, request, xmlrpc_setup):

is_db_configured()

short = api.env.host.split('.')[0]
short = api.env.host.split('.', maxsplit=1)[0]

def test_0001_find_all(self):
"""
Expand Down
5 changes: 3 additions & 2 deletions ipatests/test_xmlrpc/test_selinuxusermap_plugin.py
Expand Up @@ -32,8 +32,9 @@
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,
Expand Down

0 comments on commit b4bd22f

Please sign in to comment.