Changeset: 88b675fa0430 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/88b675fa0430 Modified Files: misc/python/fixlicense.py testing/malmapi.py Branch: Dec2023 Log Message:
Use startswith method. diffs (42 lines): diff --git a/misc/python/fixlicense.py b/misc/python/fixlicense.py --- a/misc/python/fixlicense.py +++ b/misc/python/fixlicense.py @@ -141,7 +141,7 @@ def getcomments(file, pre=None, post=Non f = open(file) # can raise IOError line = f.readline() f.close() - if line[:2] == '#!': + if line.startswith('#!'): if 'bash' in line or '/sh' in line: ext = '.sh' elif 'python' in line or 'PYTHON' in line: @@ -236,7 +236,7 @@ def addlicense(file, pre=None, post=None if pre: g.write(pre + '\n') for l in license: - if l[:1] == '\t' or (not l and (not end or end[:1] == '\t')): + if l.startswith('\t') or (not l and (not end or end.startswith('\t'))): # if text after start begins with tab, remove spaces from start g.write(start.rstrip() + l + end + '\n') else: diff --git a/testing/malmapi.py b/testing/malmapi.py --- a/testing/malmapi.py +++ b/testing/malmapi.py @@ -69,7 +69,7 @@ def handle_error(error): """ - if error[:13] == 'SQLException:': + if error.startswith('SQLException:'): idx = str.index(error, ':', 14) error = error[idx + 10:] if len(error) > 5 and error[:5] in errors: @@ -104,7 +104,7 @@ class Connection(object): unix_socket is used if hostname is not defined. """ - if hostname and hostname[:1] == '/' and not unix_socket: + if hostname and hostname.startswith('/') and not unix_socket: unix_socket = '%s/.s.monetdb.%d' % (hostname, port) hostname = None if not unix_socket and os.path.exists("/tmp/.s.monetdb.%i" % port): _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org