Skip to content

Commit d0ffe24

Browse files
authored
Merge pull request #213 from NYU-RTS/ruff-cleanup
ruff cleanup everything to make CI checks meaningful
2 parents 96ca599 + 0631f58 commit d0ffe24

67 files changed

Lines changed: 307 additions & 341 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎coldfront/config/auth.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from coldfront.config.base import AUTHENTICATION_BACKENDS, INSTALLED_APPS, TEMPLATES
12
from coldfront.config.env import ENV
2-
from coldfront.config.base import INSTALLED_APPS, AUTHENTICATION_BACKENDS, TEMPLATES
33

44
# ------------------------------------------------------------------------------
55
# ColdFront default authentication settings

‎coldfront/config/base.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
Base Django settings for ColdFront project.
77
"""
88

9-
import importlib.util
109
import os
11-
import sys
12-
import coldfront
1310

1411
from django.core.exceptions import ImproperlyConfigured
1512
from django.core.management.utils import get_random_secret_key

‎coldfront/config/database.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
from coldfront.config.env import ENV
34

45
# ------------------------------------------------------------------------------

‎coldfront/config/plugins/freeipa.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from coldfront.config.base import INSTALLED_APPS, ENV
2-
from coldfront.config.env import ENV
1+
from coldfront.config.base import ENV, INSTALLED_APPS
32

43
INSTALLED_APPS += [
54
"coldfront.plugins.freeipa",

‎coldfront/config/plugins/ldap.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from django.core.exceptions import ImproperlyConfigured
2+
13
from coldfront.config.base import AUTHENTICATION_BACKENDS
24
from coldfront.config.env import ENV
3-
from django.core.exceptions import ImproperlyConfigured
45

56
try:
67
import ldap
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
from coldfront.config.env import ENV
1+
from importlib.util import find_spec
2+
23
from django.core.exceptions import ImproperlyConfigured
34

4-
try:
5-
import ldap
6-
except ImportError:
5+
from coldfront.config.env import ENV
6+
7+
if find_spec("ldap") is None:
78
raise ImproperlyConfigured("Please run: pip install ldap3")
89

910
# ----------------------------------------------------------------------------
@@ -14,15 +15,11 @@
1415
LDAP_USER_SEARCH_BASE = ENV.str("LDAP_USER_SEARCH_BASE")
1516
LDAP_USER_SEARCH_BIND_DN = ENV.str("LDAP_USER_SEARCH_BIND_DN", default=None)
1617
LDAP_USER_SEARCH_BIND_PASSWORD = ENV.str("LDAP_USER_SEARCH_BIND_PASSWORD", default=None)
17-
LDAP_USER_SEARCH_CONNECT_TIMEOUT = ENV.float(
18-
"LDAP_USER_SEARCH_CONNECT_TIMEOUT", default=2.5
19-
)
18+
LDAP_USER_SEARCH_CONNECT_TIMEOUT = ENV.float("LDAP_USER_SEARCH_CONNECT_TIMEOUT", default=2.5)
2019
LDAP_USER_SEARCH_USE_SSL = ENV.bool("LDAP_USER_SEARCH_USE_SSL", default=True)
2120
LDAP_USER_SEARCH_USE_TLS = ENV.bool("LDAP_USER_SEARCH_USE_TLS", default=False)
2221
LDAP_USER_SEARCH_PRIV_KEY_FILE = ENV.str("LDAP_USER_SEARCH_PRIV_KEY_FILE", default=None)
2322
LDAP_USER_SEARCH_CERT_FILE = ENV.str("LDAP_USER_SEARCH_CERT_FILE", default=None)
2423
LDAP_USER_SEARCH_CACERT_FILE = ENV.str("LDAP_USER_SEARCH_CACERT_FILE", default=None)
2524

26-
ADDITIONAL_USER_SEARCH_CLASSES = [
27-
"coldfront.plugins.ldap_user_search.utils.LDAPUserSearch"
28-
]
25+
ADDITIONAL_USER_SEARCH_CLASSES = ["coldfront.plugins.ldap_user_search.utils.LDAPUserSearch"]

‎coldfront/config/plugins/openid.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from coldfront.config.base import INSTALLED_APPS, MIDDLEWARE, AUTHENTICATION_BACKENDS
1+
from coldfront.config.base import AUTHENTICATION_BACKENDS, INSTALLED_APPS, MIDDLEWARE
22
from coldfront.config.env import ENV
33

44
# ------------------------------------------------------------------------------

‎coldfront/config/plugins/slurmrest.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from coldfront.config.base import INSTALLED_APPS
22
from coldfront.config.env import ENV # noqa: F401
33

4-
54
INSTALLED_APPS += [
65
"coldfront.plugins.slurmrest",
76
]

‎coldfront/config/settings.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import environ
2-
from split_settings.tools import optional, include
2+
from split_settings.tools import include, optional
3+
34
from coldfront.config.env import ENV, PROJECT_ROOT
45

56
# ColdFront split settings

‎coldfront/core/allocation/admin.py‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
AllocationAccount,
1010
AllocationAdminNote,
1111
AllocationAttribute,
12+
AllocationAttributeChangeRequest,
1213
AllocationAttributeType,
1314
AllocationAttributeUsage,
1415
AllocationChangeRequest,
15-
AllocationAttributeChangeRequest,
16-
AllocationStatusChoice,
1716
AllocationChangeStatusChoice,
17+
AllocationStatusChoice,
1818
AllocationUser,
1919
AllocationUserNote,
2020
AllocationUserStatusChoice,
@@ -347,9 +347,7 @@ def allocation_status(self, obj):
347347
return obj.allocation.status
348348

349349
def user_info(self, obj):
350-
return "{} {} ({})".format(
351-
obj.user.first_name, obj.user.last_name, obj.user.username
352-
)
350+
return "{} {} ({})".format(obj.user.first_name, obj.user.last_name, obj.user.username)
353351

354352
def resource(self, obj):
355353
return obj.allocation.resources.first()
@@ -482,7 +480,7 @@ class AllocationChangeRequestAdmin(admin.ModelAdmin):
482480

483481

484482
@admin.register(AllocationAttributeChangeRequest)
485-
class AllocationChangeStatusChoiceAdmin(admin.ModelAdmin):
483+
class AllocationAttributeChangeRequestAdmin(admin.ModelAdmin):
486484
list_display = (
487485
"pk",
488486
"allocation_change_request",

0 commit comments

Comments
 (0)