From owner-svn-src-stable@FreeBSD.ORG Thu Oct 25 03:12:35 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2F6A2507; Thu, 25 Oct 2012 03:12:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1769F8FC16; Thu, 25 Oct 2012 03:12:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9P3CYRU058129; Thu, 25 Oct 2012 03:12:34 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9P3CYh7058127; Thu, 25 Oct 2012 03:12:34 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201210250312.q9P3CYh7058127@svn.freebsd.org> From: Eitan Adler Date: Thu, 25 Oct 2012 03:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r242037 - stable/7/games/fortune/tools X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2012 03:12:35 -0000 Author: eadler Date: Thu Oct 25 03:12:34 2012 New Revision: 242037 URL: http://svn.freebsd.org/changeset/base/242037 Log: MFC r241834: Make do_uniq work with python3 Approved by: cperciva (implicit) Modified: stable/7/games/fortune/tools/do_uniq.py Directory Properties: stable/7/games/fortune/ (props changed) Modified: stable/7/games/fortune/tools/do_uniq.py ============================================================================== --- stable/7/games/fortune/tools/do_uniq.py Thu Oct 25 03:12:31 2012 (r242036) +++ stable/7/games/fortune/tools/do_uniq.py Thu Oct 25 03:12:34 2012 (r242037) @@ -34,26 +34,26 @@ def edit(datfile): for line in file(datfile): if line == "%\n": key = hash(fortune) - if not dups.has_key(key): + if key not in dups: dups[key] = [] dups[key].append(fortune) fortunes.append(fortune) fortune = "" else: fortune += line - for key in dups.keys(): + for key in list(dups.keys()): if len(dups[key]) == 1: del dups[key] o = file(datfile + '~', "w") for fortune in fortunes: key = hash(fortune) if key in dups: - print '\n' * 50 + print('\n' * 50) for f in dups[key]: if f != fortune: - print f, '%' - print fortune, '%' - if raw_input("Remove last fortune? ") == 'y': + print(f, '%') + print(fortune, '%') + if input("Remove last fortune? ") == 'y': del dups[key] continue o.write(fortune + "%\n")