From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 480DD1381F3 for ; Sun, 18 Nov 2012 22:15:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C2C2121C027; Sun, 18 Nov 2012 22:15:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E350421C00A for ; Sun, 18 Nov 2012 22:15:27 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9539F33D78E for ; Sun, 18 Nov 2012 22:15:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 00091E5436 for ; Sun, 18 Nov 2012 22:15:23 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1353265602.60f1fa4b722a79cf86c6a0940a9df218d57787b3.dol-sen@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/compatability.py layman/compatibility.py X-VCS-Directories: layman/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 60f1fa4b722a79cf86c6a0940a9df218d57787b3 X-VCS-Branch: master Date: Sun, 18 Nov 2012 22:15:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7a74011a-b1d6-462e-b78c-de415ff9f222 X-Archives-Hash: 36bbe544a12d5a1b02db5cf8e2507089 commit: 60f1fa4b722a79cf86c6a0940a9df218d57787b3 Author: Brian Dolbec gentoo org> AuthorDate: Sun Nov 18 19:06:42 2012 +0000 Commit: Brian Dolbec gmail com> CommitDate: Sun Nov 18 19:06:42 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=60f1fa4b remove the mispaelled duplicate file after syncronizing any changes --- layman/compatability.py | 45 --------------------------------------------- layman/compatibility.py | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 47 deletions(-) diff --git a/layman/compatability.py b/layman/compatability.py deleted file mode 100644 index ea7149e..0000000 --- a/layman/compatability.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -""" Copyright 2005 - 2008 Gunnar Wrobel - 2011 - Brian Dolbec - Distributed under the terms of the GNU General Public License v2 -""" - -import sys, types - - -def encode(text, enc="UTF-8"): - """py2, py compatibility function""" - if hasattr(text, 'decode'): - return text.decode(enc) - return str(text) - - -def fileopen(path, mode, enc="UTF-8"): - """py2, py3 compatibility function""" - try: - f = open(path, mode, encoding=enc) - except TypeError: - f = open(path, mode) - return f - - -def cmp_to_key(mycmp): - 'Convert a cmp= function into a key= function' - class K(object): - def __init__(self, obj, *args): - self.obj = obj - def __lt__(self, other): - return mycmp(self.obj, other.obj) < 0 - def __gt__(self, other): - return mycmp(self.obj, other.obj) > 0 - def __eq__(self, other): - return mycmp(self.obj, other.obj) == 0 - def __le__(self, other): - return mycmp(self.obj, other.obj) <= 0 - def __ge__(self, other): - return mycmp(self.obj, other.obj) >= 0 - def __ne__(self, other): - return mycmp(self.obj, other.obj) != 0 - return K diff --git a/layman/compatibility.py b/layman/compatibility.py index b71a8af..e6206db 100644 --- a/layman/compatibility.py +++ b/layman/compatibility.py @@ -6,8 +6,6 @@ Distributed under the terms of the GNU General Public License v2 """ -import sys, types - def encode(text, enc="UTF-8"): """py2, py3 compatibility function""" @@ -27,3 +25,22 @@ def fileopen(path, mode='r', enc="UTF-8"): f = open(path, mode) return f + +def cmp_to_key(mycmp): + 'Convert a cmp= function into a key= function' + class K(object): + def __init__(self, obj, *args): + self.obj = obj + def __lt__(self, other): + return mycmp(self.obj, other.obj) < 0 + def __gt__(self, other): + return mycmp(self.obj, other.obj) > 0 + def __eq__(self, other): + return mycmp(self.obj, other.obj) == 0 + def __le__(self, other): + return mycmp(self.obj, other.obj) <= 0 + def __ge__(self, other): + return mycmp(self.obj, other.obj) >= 0 + def __ne__(self, other): + return mycmp(self.obj, other.obj) != 0 + return K