lint: ruff run

This commit is contained in:
RhodeCode Admin 2023-07-18 13:46:39 +02:00
parent 42301154fc
commit 3c7a0fe047
9 changed files with 11 additions and 12 deletions

View file

@ -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:

View file

@ -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()

View file

@ -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"),

View file

@ -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

View file

@ -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.Formatter):
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

View file

@ -112,8 +112,8 @@ class UrlizePattern(markdown.inlinepatterns.Pattern):
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

View file

@ -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

View file

@ -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

View file

@ -164,7 +164,7 @@ def test_ValidRepoGroup_edit_group_no_root_permission(localizer, repo_group):
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, 'ąćżź')