summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2012-11-18 11:06:42 -0800
committerBrian Dolbec <dolsen@gentoo.org>2012-11-18 11:06:42 -0800
commit60f1fa4b722a79cf86c6a0940a9df218d57787b3 (patch)
treee074e53d9082072068cd0556928a526faea403f9
parent599442ca69c94f236132443ce8a5c24fa05fcdc1 (diff)
downloadlayman-60f1fa4b722a79cf86c6a0940a9df218d57787b3.tar.gz
layman-60f1fa4b722a79cf86c6a0940a9df218d57787b3.tar.bz2
layman-60f1fa4b722a79cf86c6a0940a9df218d57787b3.zip
remove the mispaelled duplicate file after syncronizing any changes
-rw-r--r--layman/compatability.py45
-rw-r--r--layman/compatibility.py21
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