diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2011-04-28 18:47:39 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2011-04-28 18:47:39 +0000 |
commit | 2e677444701d1c0295fa126b056d26c7468f9862 (patch) | |
tree | 94ce222bb9f66a02a234aeca814ee44b78e98812 | |
parent | ad76395a82a71d1ff872c7c627bf6dada7116ee1 (diff) |
put standard library imports before application imports and remove some unused imports
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1438 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | pynslcd/alias.py | 7 | ||||
-rw-r--r-- | pynslcd/common.py | 9 | ||||
-rw-r--r-- | pynslcd/ether.py | 6 | ||||
-rw-r--r-- | pynslcd/group.py | 10 | ||||
-rw-r--r-- | pynslcd/host.py | 6 | ||||
-rw-r--r-- | pynslcd/netgroup.py | 8 | ||||
-rw-r--r-- | pynslcd/network.py | 6 | ||||
-rw-r--r-- | pynslcd/pam.py | 10 | ||||
-rw-r--r-- | pynslcd/passwd.py | 10 | ||||
-rw-r--r-- | pynslcd/protocol.py | 5 | ||||
-rw-r--r-- | pynslcd/rpc.py | 5 | ||||
-rw-r--r-- | pynslcd/service.py | 5 | ||||
-rw-r--r-- | pynslcd/shadow.py | 6 |
13 files changed, 40 insertions, 53 deletions
diff --git a/pynslcd/alias.py b/pynslcd/alias.py index 5126466..979d266 100644 --- a/pynslcd/alias.py +++ b/pynslcd/alias.py @@ -1,7 +1,7 @@ # alias.py - lookup functions for aliasnet addresses # -# Copyright (C) 2010 Arthur de Jong +# Copyright (C) 2010, 2011 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,12 +18,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA +import ldap.filter + import constants import common -import ldap -import ldap.filter - class AliasRequest(common.Request): diff --git a/pynslcd/common.py b/pynslcd/common.py index 04f0679..1b1f2cb 100644 --- a/pynslcd/common.py +++ b/pynslcd/common.py @@ -1,7 +1,7 @@ # common.py - functions that are used by different modules # -# Copyright (C) 2010 Arthur de Jong +# Copyright (C) 2010, 2011 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,13 +18,14 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA -import cfg -import constants - import re import ldap import ldap.dn +import cfg +import constants + + _validname_re = re.compile(r'^[a-z0-9._@$][a-z0-9._@$ \\~-]{0,98}[a-z0-9._@$~-]$', re.IGNORECASE) def isvalidname(name): diff --git a/pynslcd/ether.py b/pynslcd/ether.py index 9c77ea7..e5724b8 100644 --- a/pynslcd/ether.py +++ b/pynslcd/ether.py @@ -18,12 +18,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA -import constants -import common - import struct import ldap.filter +import constants +import common + def ether_aton(ether): return struct.pack('BBBBBB', *(int(x, 16) for x in ether.split(':'))) diff --git a/pynslcd/group.py b/pynslcd/group.py index 95ac9b4..d77479f 100644 --- a/pynslcd/group.py +++ b/pynslcd/group.py @@ -1,7 +1,7 @@ # group.py - group entry lookup routines # -# Copyright (C) 2010 Arthur de Jong +# Copyright (C) 2010, 2011 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,14 +18,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA -import constants -import common -import cfg - import logging -import ldap import ldap.filter +import constants +import common + def clean(lst): for i in lst: diff --git a/pynslcd/host.py b/pynslcd/host.py index 3c1d5be..1f5d58c 100644 --- a/pynslcd/host.py +++ b/pynslcd/host.py @@ -18,13 +18,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA +import ldap.filter + import constants import common -import struct -import ldap.filter -import socket - class HostRequest(common.Request): diff --git a/pynslcd/netgroup.py b/pynslcd/netgroup.py index 7082bc5..b31343c 100644 --- a/pynslcd/netgroup.py +++ b/pynslcd/netgroup.py @@ -18,14 +18,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA -import constants -import common - -import struct import ldap.filter -import socket import re +import constants +import common + _netgroup_triple_re = re.compile(r'^\s*\(\s*(?P<host>.*)\s*,\s*(?P<user>.*)\s*,\s*(?P<domain>.*)\s*\)\s*$') diff --git a/pynslcd/network.py b/pynslcd/network.py index b32824c..397d669 100644 --- a/pynslcd/network.py +++ b/pynslcd/network.py @@ -18,13 +18,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA +import ldap.filter + import constants import common -import struct -import ldap.filter -import socket - class NetworkRequest(common.Request): diff --git a/pynslcd/pam.py b/pynslcd/pam.py index d795a64..2203e19 100644 --- a/pynslcd/pam.py +++ b/pynslcd/pam.py @@ -1,7 +1,7 @@ # pam.py - functions authentication, authorisation and session handling # -# Copyright (C) 2010 Arthur de Jong +# Copyright (C) 2010, 2011 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,15 +18,15 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA -import constants -import common -import cfg - import logging import ldap +import constants +import common +import cfg import passwd + def try_bind(userdn, password): # open a new connection conn = ldap.initialize(cfg.ldap_uri) diff --git a/pynslcd/passwd.py b/pynslcd/passwd.py index 80b2a4a..5176244 100644 --- a/pynslcd/passwd.py +++ b/pynslcd/passwd.py @@ -1,7 +1,7 @@ # passwd.py - lookup functions for user account information # -# Copyright (C) 2010 Arthur de Jong +# Copyright (C) 2010, 2011 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,14 +18,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA -import constants -import common -import cfg - -import logging import ldap import ldap.filter +import constants +import common + class PasswdRequest(common.Request): diff --git a/pynslcd/protocol.py b/pynslcd/protocol.py index 32334ff..32a6db9 100644 --- a/pynslcd/protocol.py +++ b/pynslcd/protocol.py @@ -18,12 +18,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA +import ldap.filter + import constants import common -import struct -import ldap.filter - class ProtocolRequest(common.Request): diff --git a/pynslcd/rpc.py b/pynslcd/rpc.py index 5682d14..9db1b16 100644 --- a/pynslcd/rpc.py +++ b/pynslcd/rpc.py @@ -18,12 +18,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA +import ldap.filter + import constants import common -import struct -import ldap.filter - class RpcRequest(common.Request): diff --git a/pynslcd/service.py b/pynslcd/service.py index 959344c..671bd20 100644 --- a/pynslcd/service.py +++ b/pynslcd/service.py @@ -18,12 +18,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA +import ldap.filter + import constants import common -import struct -import ldap.filter - class ServiceRequest(common.Request): diff --git a/pynslcd/shadow.py b/pynslcd/shadow.py index 3f2a5d7..7a9ed1a 100644 --- a/pynslcd/shadow.py +++ b/pynslcd/shadow.py @@ -1,7 +1,7 @@ # shadow.py - lookup functions for shadownet addresses # -# Copyright (C) 2010 Arthur de Jong +# Copyright (C) 2010, 2011 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,11 +18,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA +import ldap.filter + import constants import common -import ldap.filter - class ShadowRequest(common.Request): |