Skip to content

Commit

Permalink
fix more pylint warnings
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@21967 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 5, 2019
1 parent a3895ef commit fa526a6
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/xpra/server/auth/fail_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# later version. See the file COPYING for details.


def init(opts):
def init(_opts):
pass

class Authenticator(object):
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/server/auth/hosts_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def main():
sys.argv = sys.argv[1:]
while len(sys.argv)>=2:
peername, host = sys.argv[:2]
v = check_host(peername, host)
print("host check for '%s', '%s': %s" % (peername, host, v))
check = check_host(peername, host)
print("host check for '%s', '%s': %s" % (peername, host, check))
sys.argv = sys.argv[2:]
return 0

Expand Down
2 changes: 1 addition & 1 deletion src/xpra/server/auth/ldap3_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def main(argv):
from xpra.platform import program_context
with program_context("LDAP3-Password-Auth", "LDAP3-Password-Authentication"):
for x in list(argv):
if x=="-v" or x=="--verbose":
if x in ("-v", "--verbose"):
enable_debug_for("auth")
argv.remove(x)
if len(argv) not in (3,4,5,6):
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/server/auth/ldap_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def main(argv):
from xpra.platform import program_context
with program_context("LDAP-Password-Auth", "LDAP-Password-Authentication"):
for x in list(argv):
if x=="-v" or x=="--verbose":
if x in ("-v", "--verbose"):
enable_debug_for("auth")
argv.remove(x)
if len(argv) not in (3,4,5,6,7):
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/server/auth/multifile_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def parse_filedata(self, data):
i += 1
line = line.strip()
log("line %s: %s", i, line)
if len(line)==0 or line.startswith(b"#"):
if not line or line.startswith(b"#"):
continue
try:
v = parse_auth_line(line)
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/server/auth/peercred_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, username, **kwargs):
x = osexpand(x.strip())
try:
allow_uids.append(int(x))
except:
except ValueError:
import pwd
try:
pw = pwd.getpwnam(x)
Expand All @@ -46,7 +46,7 @@ def __init__(self, username, **kwargs):
x = osexpand(x.strip())
try:
allow_gids.append(int(x))
except:
except ValueError:
gid = get_group_id(x)
if gid>=0:
allow_gids.append(gid)
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/server/auth/reject_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from xpra.net.digest import get_salt, choose_digest

def init(opts):
def init(_opts):
pass


Expand Down
13 changes: 6 additions & 7 deletions src/xpra/server/auth/sqlite_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def fmt(values, sizes):
return s
def cursor_callback(cursor):
rows = cursor.fetchall()
if len(rows)==0:
if not rows:
print("no rows found")
return
print("%i rows found:" % len(rows))
Expand Down Expand Up @@ -187,24 +187,23 @@ def usage(msg="invalid number of arguments"):
if l!=3:
return usage()
return create(filename)
elif cmd=="add":
if cmd=="add":
if l<5 or l>10:
return usage()
return add_user(filename, *argv[3:])
elif cmd=="remove":
if cmd=="remove":
if l not in (4, 5):
return usage()
return remove_user(filename, *argv[3:])
elif cmd=="list":
if cmd=="list":
if l!=3:
return usage()
return list_users(filename)
elif cmd=="authenticate":
if cmd=="authenticate":
if l!=5:
return usage()
return authenticate(filename, *argv[3:])
else:
return usage("invalid command '%s'" % cmd)
return usage("invalid command '%s'" % cmd)
return 0


Expand Down
6 changes: 2 additions & 4 deletions src/xpra/server/auth/win32_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def __repr__(self):


def main():
import sys
from xpra.platform import program_context
from xpra.log import enable_color
with program_context("Auth-Test", "Auth-Test"):
Expand All @@ -71,9 +70,8 @@ def main():
if a.check(password):
log.info("authentication succeeded")
return 0
else:
log.error("authentication failed")
return 1
log.error("authentication failed")
return 1

if __name__ == "__main__":
import sys
Expand Down

0 comments on commit fa526a6

Please sign in to comment.