# HG changeset patch # User RhodeCode Admin # Date 2023-07-18 11:46:39 # Node ID fed0c169e1f10d851b026feae15f1c4b79423cbc # Parent 8f6d1ed6450983ff40c76c4f82a974e7328d48ec lint: ruff run diff --git a/rhodecode/api/tests/test_create_user.py b/rhodecode/api/tests/test_create_user.py --- a/rhodecode/api/tests/test_create_user.py +++ b/rhodecode/api/tests/test_create_user.py @@ -180,7 +180,7 @@ class TestCreateUser(object): personal_group = RepoGroup.get_by_group_name(username) assert personal_group - assert personal_group.personal == True + assert personal_group.personal is True assert personal_group.user.username == username try: diff --git a/rhodecode/apps/user_group/tests/test_user_groups.py b/rhodecode/apps/user_group/tests/test_user_groups.py --- a/rhodecode/apps/user_group/tests/test_user_groups.py +++ b/rhodecode/apps/user_group/tests/test_user_groups.py @@ -191,7 +191,7 @@ class TestUserGroupsView(TestController) assert user_group.users_group_name == new_name assert user_group.user_group_description == 'DESC' - assert user_group.users_group_active == False + assert user_group.users_group_active is False def test_update_user_group_name_conflicts(self, user_util): self.log_user() diff --git a/rhodecode/authentication/plugins/auth_crowd.py b/rhodecode/authentication/plugins/auth_crowd.py --- a/rhodecode/authentication/plugins/auth_crowd.py +++ b/rhodecode/authentication/plugins/auth_crowd.py @@ -112,7 +112,7 @@ class CrowdServer(object): passwd="some_passwd", version="1") """ - if not "port" in kwargs: + if 'port' not in kwargs: kwargs["port"] = "8095" self._logger = kwargs.get("logger", logging.getLogger(__name__)) self._uri = "%s://%s:%s/crowd" % (kwargs.get("method", "http"), diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/version.py b/rhodecode/lib/dbmigrate/migrate/versioning/version.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/version.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/version.py @@ -105,7 +105,7 @@ class Collection(pathed.Pathed): return max([VerNum(0)] + list(self.versions.keys())) def _next_ver_num(self, use_timestamp_numbering): - if use_timestamp_numbering == True: + if use_timestamp_numbering is True: return VerNum(int(datetime.utcnow().strftime('%Y%m%d%H%M%S'))) else: return self.latest + 1 diff --git a/rhodecode/lib/logging_formatter.py b/rhodecode/lib/logging_formatter.py --- a/rhodecode/lib/logging_formatter.py +++ b/rhodecode/lib/logging_formatter.py @@ -1,4 +1,3 @@ - # Copyright (C) 2010-2023 RhodeCode GmbH # # This program is free software: you can redistribute it and/or modify @@ -182,5 +181,5 @@ class ColorFormatterSql(logging.Formatte colored_record = ''.join([start, def_record, end]) return colored_record -# marcink: needs to stay with this name for backward .ini compatability -Pyro4AwareFormatter = ExceptionAwareFormatter +# NOTE (marcink): needs to stay with this name for backward .ini compatability +Pyro4AwareFormatter = ExceptionAwareFormatter # noqa diff --git a/rhodecode/lib/markdown_ext.py b/rhodecode/lib/markdown_ext.py --- a/rhodecode/lib/markdown_ext.py +++ b/rhodecode/lib/markdown_ext.py @@ -112,8 +112,8 @@ class UrlizePattern(markdown.inlinepatte text = url - if not url.split('://')[0] in ('http','https','ftp'): - if '@' in url and not '/' in url: + if url.split('://')[0] not in ('http', 'https', 'ftp'): + if '@' in url and '/' not in url: url = 'mailto:' + url else: url = 'http://' + url diff --git a/rhodecode/tests/models/test_user_groups.py b/rhodecode/tests/models/test_user_groups.py --- a/rhodecode/tests/models/test_user_groups.py +++ b/rhodecode/tests/models/test_user_groups.py @@ -75,7 +75,7 @@ class TestGetUserGroups(object): groups = UserGroupModel().get_user_groups() expected = ('id', 'icon_link', 'value_display', 'value', 'value_type') for group in groups: - assert group['value_type'] is 'user_group' + assert group['value_type'] == 'user_group' for key in expected: assert key in group diff --git a/rhodecode/tests/models/test_users.py b/rhodecode/tests/models/test_users.py --- a/rhodecode/tests/models/test_users.py +++ b/rhodecode/tests/models/test_users.py @@ -50,7 +50,7 @@ class TestGetUsers(object): 'id', 'first_name', 'last_name', 'username', 'icon_link', 'value_display', 'value', 'value_type') for user in users: - assert user['value_type'] is 'user' + assert user['value_type'] == 'user' for key in expected_keys: assert key in user diff --git a/rhodecode/tests/other/test_validators.py b/rhodecode/tests/other/test_validators.py --- a/rhodecode/tests/other/test_validators.py +++ b/rhodecode/tests/other/test_validators.py @@ -164,7 +164,7 @@ def test_ValidRepoGroup_edit_group_no_ro def test_ValidPassword(localizer): validator = v.ValidPassword(localizer) assert 'lol' == validator.to_python('lol') - assert None == validator.to_python(None) + assert None is validator.to_python(None) pytest.raises(formencode.Invalid, validator.to_python, 'ąćżź')