Skip to content

Commit 485026e

Browse files
committed
Fix flake8 style issues
1 parent cfe818c commit 485026e

File tree

6 files changed

+144
-91
lines changed

6 files changed

+144
-91
lines changed

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
ignore = F821
3+
exclude = venv,ldap_hooks/__init__.py,example/setup_ldap_entry_hook_config.py

example/hello_hook_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
c.DockerSpawner.pre_spawn_hook = hello_hook
1414

1515
# Authenticator setup
16-
c.JupyterHub.authenticator_class = 'jhubauthenticators.DummyAuthenticator'
16+
c.JupyterHub.authenticator_class = 'jhubauthenticators.DummyAuthenticator'

example/setup_ldap_entry_hook_config.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Example config
2-
from jhubauthenticators import RegexUsernameParser, JSONParser
2+
from jhubauthenticators import RegexUsernameParser
33
from ldap_hooks import setup_ldap_entry_hook
4-
from ldap_hooks import LDAP, LDAP_SEARCH_ATTRIBUTE_QUERY, SPAWNER_SUBMIT_DATA, \
5-
INCREMENT_ATTRIBUTE
4+
from ldap_hooks import LDAP, LDAP_SEARCH_ATTRIBUTE_QUERY, \
5+
SPAWNER_SUBMIT_DATA, INCREMENT_ATTRIBUTE
66
c = get_config()
77

88
c.JupyterHub.ip = '0.0.0.0'
@@ -21,7 +21,8 @@
2121
c.HeaderAuthenticator.header_parser_classes = {'auth': RegexUsernameParser}
2222
c.HeaderAuthenticator.user_external_allow_attributes = ['data']
2323
# Email regex
24-
RegexUsernameParser.username_extract_regex = '([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)'
24+
RegexUsernameParser.username_extract_regex = '([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]' \
25+
'+\.[a-zA-Z0-9-.]+)'
2526

2627

2728
# Define LDAP connection options
@@ -48,15 +49,18 @@
4849
'NB_UID': '{uidNumber}'},
4950
}
5051

51-
# Attributes used to check whether the ldap data of type object_classes already exists
52+
# Attributes used to check whether the ldap data
53+
# of type object_classes already exists
5254
# LDAP.unique_object_attributes = ['emailAddress']
53-
LDAP.search_attribute_queries = [{'search_base': LDAP.base_dn,
54-
'search_filter': '(objectclass=X-nextUserIdentifier)',
55-
'attributes': ['uidNumber']}]
55+
LDAP.search_attribute_queries = [
56+
{'search_base': LDAP.base_dn,
57+
'search_filter': '(objectclass=X-nextUserIdentifier)',
58+
'attributes': ['uidNumber']}
59+
]
5660

61+
modify_dn = 'cn=uidNext' + ',' + LDAP.base_dn
5762
LDAP.search_result_operation = {'uidNumber': {'action': INCREMENT_ATTRIBUTE,
58-
'modify_dn': 'cn=uidNext'
59-
+ ',' + LDAP.base_dn}}
63+
'modify_dn': modify_dn}}
6064

6165
# Submit object settings
6266
LDAP.object_classes = ['X-certsDistinguishedName', 'PosixAccount']

0 commit comments

Comments
 (0)