- From: Drew Perttula <drewp@bigasterisk.com>
- Date: Wed, 29 Apr 2009 00:35:40 -0700
- To: public-cwm-talk@w3.org
- Message-ID: <49F8034C.1070109@bigasterisk.com>
Here are some module name tweaks and one method rewrite that take care of the deprecation warnings in python 2.6 (which a lot of people might see this week due to the new Ubuntu release). I did not test these except to confirm that cwm starts up more quietly. The only controversial change would be my change in term.py where instead of putting the refcount-protection line in a __new__ method (which is unfortunately intertwined with the signature of this __init__ and the superclass's __new__), I just put the refcount-protection in the actual __init__. The patch is for the latest 2000/10/swap/ source, which is from 2008-09-03, I think.
? build
? cwm_20080903-1_i386.deb
? description-pak
? sparql/__init__.pyc
? sparql/sparql_parser.pyc
? sparql/sparql_table.pyc
? sparql/sparql_tokens.pyc
? sparql/sparql_tokens_table.py
? sparql/sparql_tokens_table.pyc
? sparql/webserver.pyc
Index: cwm_crypto.py
===================================================================
RCS file: /sources/public/2000/10/swap/cwm_crypto.py,v
retrieving revision 1.11
diff -u -r1.11 cwm_crypto.py
--- cwm_crypto.py 21 Jul 2005 15:22:59 -0000 1.11
+++ cwm_crypto.py 29 Apr 2009 07:33:53 -0000
@@ -9,10 +9,10 @@
"""
__author__ = 'Sean B. Palmer'
-__cvsid__ = '$Id: cwm_crypto.py,v 1.11 2005-07-21 15:22:59 syosi Exp $'
+__cvsid__ = '$Id: cwm_crypto.py,v 1.11 2005/07/21 15:22:59 syosi Exp $'
__version__ = '$Revision: 1.11 $'
-import md5, sha, binascii, quopri, base64
+import hashlib, binascii, quopri, base64
from term import Function, ReverseFunction, LightBuiltIn
USE_PKC = 1
@@ -103,12 +103,12 @@
class BI_md5(LightBuiltIn, Function):
def evaluateObject(self, subj_py):
- m = md5.new(subj_py).digest()
+ m = hashlib.md5(subj_py).digest()
return binascii.hexlify(m)
class BI_sha(LightBuiltIn, Function):
def evaluateObject(self, subj_py):
- m = sha.new(subj_py).digest()
+ m = hashlib.sha1(subj_py).digest()
return binascii.hexlify(m)
# Create a new RSA key
Index: cwm_string.py
===================================================================
RCS file: /sources/public/2000/10/swap/cwm_string.py,v
retrieving revision 1.37
diff -u -r1.37 cwm_string.py
--- cwm_string.py 15 Feb 2008 00:43:45 -0000 1.37
+++ cwm_string.py 29 Apr 2009 07:33:53 -0000
@@ -15,7 +15,6 @@
from diag import verbosity, progress
import urllib # for hasContent
-import md5, binascii # for building md5 URIs
from term import LightBuiltIn, ReverseFunction, Function, UnknownType
from local_decimal import Decimal
Index: llyn.py
===================================================================
RCS file: /sources/public/2000/10/swap/llyn.py,v
retrieving revision 1.186
diff -u -r1.186 llyn.py
--- llyn.py 26 Dec 2007 19:54:11 -0000 1.186
+++ llyn.py 29 Apr 2009 07:33:55 -0000
@@ -57,7 +57,6 @@
import urllib # for log:content
-import md5, binascii # for building md5 URIs
import uripath
from uripath import canonical
Index: term.py
===================================================================
RCS file: /sources/public/2000/10/swap/term.py,v
retrieving revision 1.80
diff -u -r1.80 term.py
--- term.py 26 Dec 2007 19:54:11 -0000 1.80
+++ term.py 29 Apr 2009 07:33:57 -0000
@@ -30,7 +30,7 @@
import uripath # DanC's tested and correct one
-import md5, binascii # for building md5 URIs
+import hashlib, binascii # for building md5 URIs
from uripath import refTo
from RDFSink import runNamespace
@@ -1396,7 +1396,7 @@
Hmm... encoding... assuming utf8? @@test this.
Hmm... for a class of literals including this one,
strictly speaking."""
- x=md5.new()
+ x = hashlib.md5()
x.update(self.string)
d=x.digest()
b16=binascii.hexlify(d)
@@ -1591,13 +1591,10 @@
"""This class is a supercalss to any builtin predicate in cwm.
A binary operator can calculate truth value given 2 arguments"""
- def __new__(cls, *args, **keywords):
- self = Fragment.__new__(cls, *args, **keywords)
- BuiltIn.all.append(self) # to prevent the forgetting of builtins
- return self
all = []
def __init__(self, resource, fragid):
+ BuiltIn.all.append(self)
Fragment.__init__(self, resource, fragid)
def eval(self, subj, obj, queue, bindings, proof, query):
Index: why.py
===================================================================
RCS file: /sources/public/2000/10/swap/why.py,v
retrieving revision 1.53
diff -u -r1.53 why.py
--- why.py 27 Jun 2007 17:58:39 -0000 1.53
+++ why.py 29 Apr 2009 07:33:58 -0000
@@ -27,7 +27,6 @@
import urllib # for hasContent
import uripath # DanC's tested and correct one
-import md5, binascii # for building md5 URIs
from uripath import refTo
from myStore import Namespace
Received on Wednesday, 29 April 2009 08:23:57 UTC