comparison mercurial/util.py @ 8118:35f7fda52c92

util: return boolean result directly in util.binary
author Martin Geisler <mg@lazybytes.net>
date Wed, 22 Apr 2009 17:14:58 +0200
parents 25b63941b17b
children bbc24c0753a0
comparison
equal deleted inserted replaced
8117:2b30d8488819 8118:35f7fda52c92
221 return fn(s, cmd[len(name):].lstrip()) 221 return fn(s, cmd[len(name):].lstrip())
222 return pipefilter(s, cmd) 222 return pipefilter(s, cmd)
223 223
224 def binary(s): 224 def binary(s):
225 """return true if a string is binary data""" 225 """return true if a string is binary data"""
226 if s and '\0' in s: 226 return bool(s and '\0' in s)
227 return True
228 return False
229 227
230 def unique(g): 228 def unique(g):
231 """return the uniq elements of iterable g""" 229 """return the uniq elements of iterable g"""
232 return dict.fromkeys(g).keys() 230 return dict.fromkeys(g).keys()
233 231