1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
|
Description: Migrate to Python 3
Origin: commit:528efa18d05f852a3b3d737903c3ed1de7fe405c
Bug-Debian: https://bugs.debian.org/937185
Index: okasha/okasha/baseWebApp.py
===================================================================
--- okasha.orig/okasha/baseWebApp.py 2019-09-14 02:51:35.545932396 +0200
+++ okasha/okasha/baseWebApp.py 2019-09-14 02:53:43.510444736 +0200
@@ -24,16 +24,16 @@
except ImportError:
import simplejson as json
-import urlparse # for parsing query string
+import urllib.parse # for parsing query string
from cgi import escape, FieldStorage # for html escaping
from operator import attrgetter # for OkashaFields
-from Cookie import SimpleCookie # in python 3.0 it's from http.cookies import SimpleCookie
-from utils import fromFs, toFs, safeHash
+from http.cookies import SimpleCookie # in python 3.0 it's from http.cookies import SimpleCookie
+from .utils import fromFs, toFs, safeHash
try:
- from cStringIO import StringIO
+ from io import StringIO
except ImportError:
- from StringIO import StringIO
+ from io import StringIO
#import urllib # to be used for quote and unquote
@@ -63,7 +63,7 @@
fileNotFoundException=lambda *a,**kw: webAppBaseException(404,*a,**kw)
def redirectException(location,*a,**kw):
e=webAppBaseException(302,*a,**kw)
- if type(location)==unicode: l=location.encode('utf-8')
+ if type(location)==str: l=location.encode('utf-8')
else: l=location
e.kw['location']=l
return e
@@ -98,7 +98,7 @@
self[k]=v
return v
def __delattr__(self, key):
- if self.has_key(key): del self[key]
+ if key in self: del self[key]
return super(dict, self).__delattr__(key)
@@ -110,8 +110,8 @@
self.contentType=contentType
self.headers=headers
self.cookies=SimpleCookie('')
- self.title=u''
- self.meta_description=u''
+ self.title=''
+ self.meta_description=''
self.meta_keywords=[]
self.js_links={}
self.css_links={}
@@ -123,8 +123,8 @@
pos can be head, begin, end
'''
if not name: name=os.path.basename(js)
- if not self.js_links.has_key(pos): self.js_links[pos]={}
- if self.js_links[pos].has_key(name): return False
+ if pos not in self.js_links: self.js_links[pos]={}
+ if name in self.js_links[pos]: return False
self.js_links[pos][name]=(weight, js)
return True
@@ -134,45 +134,45 @@
name is a way to avoid registering the same file twice
'''
if not name: name=os.path.basename(css)
- if not self.css_links.has_key(media): self.css_links[media]={}
- if self.css_links[media].has_key(name): return False
+ if media not in self.css_links: self.css_links[media]={}
+ if name in self.css_links[media]: return False
self.css_links[media][name]=(weight, css)
return True
def render_css_links(self):
r=[]
- for media, v in self.css_links.items():
- l=v.values()
+ for media, v in list(self.css_links.items()):
+ l=list(v.values())
l.sort()
for w,f in l:
- r.append(u'<link rel="stylesheet" media="%s" type="text/css" href="%s%s/%s" />' % (
+ r.append('<link rel="stylesheet" media="%s" type="text/css" href="%s%s/%s" />' % (
media, self.rq.script, self.rq.webapp._themePrefix, f,
))
- return u'\n'.join(r)
+ return '\n'.join(r)
def render_js_links(self, pos='head'):
- if not self.js_links.has_key(pos): return ''
+ if pos not in self.js_links: return ''
r=[]
- l=self.js_links[pos].values()
+ l=list(self.js_links[pos].values())
l.sort()
for w,f in l:
- r.append(u'<script type="text/javascript" src="%s%s/%s"></script>' % (
+ r.append('<script type="text/javascript" src="%s%s/%s"></script>' % (
self.rq.script, self.rq.webapp._themePrefix, f,
))
- return u'\n'.join(r)
+ return '\n'.join(r)
def setCookie(self, key, value, t=None, path=None, domain=None, comment=None):
"""
sets or replace a cookies with key and value, and sets its expire time in seconds since now (if given)
"""
- if isinstance(value,unicode): value=value.encode('utf8')
+ if isinstance(value,str): value=value.encode('utf8')
self.cookies[key]=value
if t!=None:
# TODO: is this the right way of setting both expires and max-age
self.cookies[key]['expires']=time.strftime("%a, %d %b %Y %H:%M:%S UTC", time.gmtime(time.time()+t))
if t>0: self.cookies[key]['max-age']=t
if path==None: path=self.rq.script+'/'
- if isinstance(path,unicode): path=path.encode('utf8')
+ if isinstance(path,str): path=path.encode('utf8')
self.cookies[key]['path']=path
if domain!=None: self.cookies[key]['domain']=domain
if comment!=None: self.cookies[key]['comment']=comment
@@ -272,7 +272,7 @@
self.response=Response(self)
# FIXME: find a way to simplify decoding query strings into unicode
qs=environ.get('QUERY_STRING','')
- if environ.has_key('wsgi.input'):
+ if 'wsgi.input' in environ:
self.q=OkashaFields(fp=environ['wsgi.input'],environ=environ)
else: self.q=OkashaFields(fp=StringIO(''),environ=environ)
@@ -281,7 +281,7 @@
self.uri=environ['PATH_INFO'] # can be / or /view
- if type(self.uri)!=unicode:
+ if type(self.uri)!=str:
try: self.uri=self.uri.decode('utf8')
except UnicodeDecodeError:
webapp._logger.warning('unable to decode uri=[%s]' % self.uri.__repr__())
@@ -289,7 +289,7 @@
if not self.uri: self.uriList=[]; return
if self.uri.endswith('/'): self.tailingSlash=True
else: self.tailingSlash=False
- if self.uri.startswith('/'): self.uriList=self.uri[1:].split(u'/')
+ if self.uri.startswith('/'): self.uriList=self.uri[1:].split('/')
else: self.uriList=self.uri.split('/') # NOTE: this should never happen
if self.uriList and self.uriList[-1]=='': self.uriList.pop()
@@ -334,11 +334,11 @@
if rq.response.headers==None: rq.response.headers=self._headers
rs=webAppResponses.get(rq.response.code,"%d Unknown code" % rq.response.code)
cookies=rq.response.cookies.output(header="")
- if cookies: h=map(lambda c: ('Set-Cookie',c),cookies.split('\n'))
+ if cookies: h=[('Set-Cookie',c) for c in cookies.split('\n')]
else: h=[]
- rq.start_response(rs, [('content-type', rq.response.contentType)]+h+map(lambda k: (k,rq.response.headers[k]),rq.response.headers))
- if type(r)==unicode: return (r.encode('utf8'),)
- elif isinstance(r, basestring): return (r,)
+ rq.start_response(rs, [('content-type', rq.response.contentType)]+h+[(k,rq.response.headers[k]) for k in rq.response.headers])
+ if type(r)==str: return (r.encode('utf8'),)
+ elif isinstance(r, str): return (r,)
return r
return wrapper
@@ -395,7 +395,7 @@
def parse_theme(theme_d):
r={}
- fn=os.path.join(theme_d, u"theme.txt")
+ fn=os.path.join(theme_d, "theme.txt")
if not os.path.exists(fn): return {}
try:
f=open(fn)
@@ -454,8 +454,8 @@
self._theme_lookup=theme_lookup
themesDir=get_theme_dirs(theme_lookup, theme)
if not hasattr(themesDir, '__iter__'): themesDir=[themesDir]
- self._themesDir=map(os.path.abspath, themesDir)
- self._templatesDir=map(lambda s: s+'/templates/', themesDir)
+ self._themesDir=list(map(os.path.abspath, themesDir))
+ self._templatesDir=[s+'/templates/' for s in themesDir]
# TODO: add a self._staticFilesCache
self._staticBaseDir={}
self._themePrefix=themePrefix
@@ -471,10 +471,10 @@
self._redirectBaseUrls={}
for k in redirectBaseUrls:
self._redirectBaseUrls[self._tailingSlash(k)]=self._tailingSlash(redirectBaseUrls[k])
- self._staticBaseDirKeys=self._staticBaseDir.keys()
+ self._staticBaseDirKeys=list(self._staticBaseDir.keys())
self._staticBaseDirKeys.sort()
self._staticBaseDirKeys.reverse() # so it's from longer to shorter
- self._redirectBaseUrlsKeys=self._redirectBaseUrls.keys()
+ self._redirectBaseUrlsKeys=list(self._redirectBaseUrls.keys())
self._redirectBaseUrlsKeys.sort()
self._redirectBaseUrlsKeys.reverse()
@@ -513,12 +513,12 @@
def _302(self, rq, e):
rs=webAppResponses[302]
cookies=rq.response.cookies.output(header="")
- if cookies: h=map(lambda c: ('Set-Cookie',c),cookies.split('\n'))
+ if cookies: h=[('Set-Cookie',c) for c in cookies.split('\n')]
else: h=[]
rq.start_response(rs, [
('content-type', 'text/plain'),
('Location', e.kw['location'])]+h)
- return ("Redirect to "+ e.kw['location'],)
+ return (("Redirect to "+ str(e.kw['location'])).encode('utf-8'),)
# you may customize exceptions like this
# @expose(response=404,contentType='text/plain; charset=utf-8')
Index: okasha/okasha/bottleTemplate.py
===================================================================
--- okasha.orig/okasha/bottleTemplate.py 2019-09-14 02:51:35.545932396 +0200
+++ okasha/okasha/bottleTemplate.py 2019-09-14 02:51:35.537932363 +0200
@@ -20,8 +20,8 @@
"""
import sys, os, os.path
-from baseWebApp import fileNotFoundException
-from bottleTemplateSegment import SimpleTemplate, TemplateError
+from .baseWebApp import fileNotFoundException
+from .bottleTemplateSegment import SimpleTemplate, TemplateError
class bottleTemplate(object):
def __init__(self, *a, **kw):
Index: okasha/okasha/bottleTemplateSegment.py
===================================================================
--- okasha.orig/okasha/bottleTemplateSegment.py 2019-09-14 02:51:35.545932396 +0200
+++ okasha/okasha/bottleTemplateSegment.py 2019-09-14 02:51:35.537932363 +0200
@@ -28,7 +28,7 @@
import sys, os, os.path, tokenize, functools, re
from cgi import escape
-from baseWebApp import webAppBaseException
+from .baseWebApp import webAppBaseException
#########################
@@ -53,14 +53,14 @@
def touni(x, enc='utf8'): # Convert anything to unicode (py3)
return str(x, encoding=enc) if isinstance(x, bytes) else str(x)
else:
- from StringIO import StringIO as BytesIO
+ from io import StringIO as BytesIO
from types import StringType
NCTextIOWrapper = None
def touni(x, enc='utf8'): # Convert anything to unicode (py2)
- return x if isinstance(x, unicode) else unicode(str(x), encoding=enc)
+ return x if isinstance(x, str) else str(str(x), encoding=enc)
def tob(data, enc='utf8'): # Convert strings to bytes (py2 and py3)
- return data.encode(enc) if isinstance(data, unicode) else data
+ return data.encode(enc) if isinstance(data, str) else data
class BaseTemplate(object):
@@ -83,7 +83,7 @@
self.name = name
self.source = source.read() if hasattr(source, 'read') else source
self.filename = source.filename if hasattr(source, 'filename') else None
- self.lookup = map(os.path.abspath, lookup)
+ self.lookup = list(map(os.path.abspath, lookup))
self.encoding = encoding
self.settings = self.settings.copy() # Copy from class variable
self.settings.update(settings) # Apply
@@ -154,7 +154,7 @@
lineno = 0 # Current line of code
ptrbuffer = [] # Buffer for printable strings and token tuple instances
codebuffer = [] # Buffer for generated python code
- touni = functools.partial(unicode, encoding=self.encoding)
+ touni = functools.partial(str, encoding=self.encoding)
multiline = dedent = False
def yield_tokens(line):
@@ -168,7 +168,7 @@
""" Removes comments from a line of code. """
line = codeline.splitlines()[0]
try:
- tokens = list(tokenize.generate_tokens(iter(line).next))
+ tokens = list(tokenize.generate_tokens(iter(line).__next__))
except tokenize.TokenError:
return line.rsplit('#',1) if '#' in line else (line, '')
for token in tokens:
@@ -200,8 +200,8 @@
for line in template.splitlines(True):
lineno += 1
- line = line if isinstance(line, unicode)\
- else unicode(line, encoding=self.encoding)
+ line = line if isinstance(line, str)\
+ else str(line, encoding=self.encoding)
if lineno <= 2:
m = re.search(r"%.*coding[:=]\s*([-\w\.]+)", line)
if m: self.encoding = m.group(1)
Index: okasha/okasha/kidTemplate.py
===================================================================
--- okasha.orig/okasha/kidTemplate.py 2019-09-14 02:51:35.545932396 +0200
+++ okasha/okasha/kidTemplate.py 2019-09-14 02:51:35.537932363 +0200
@@ -18,7 +18,7 @@
"""
import sys, os, os.path
import kid
-from baseWebApp import fileNotFoundException
+from .baseWebApp import fileNotFoundException
#from utils import ObjectsCache # kid has its own cache
def kidTemplate(rq, o, bfn=None, **kw):
Index: okasha/okasha/utils.py
===================================================================
--- okasha.orig/okasha/utils.py 2019-09-14 02:51:35.545932396 +0200
+++ okasha/okasha/utils.py 2019-09-14 02:51:35.541932379 +0200
@@ -18,11 +18,11 @@
"""
import sys, time, hashlib, random
import bisect
-from itertools import groupby,imap
+from itertools import groupby
import re
fs_encoding=sys.getfilesystemencoding().startswith('ANSI') and 'UTF-8' or sys.getfilesystemencoding()
-dD_re=re.compile(ur'(\d+|\D+)')
+dD_re=re.compile(r'(\d+|\D+)')
def stringOrFloat(s):
try: return float(s)
@@ -47,7 +47,7 @@
"""
recives a blob encoded in filesystem encoding and convert it into a unicode object
"""
- if type(filenameblob)!=unicode:
+ if type(filenameblob)!=str:
return filenameblob.decode(fs_encoding)
return filenameblob
@@ -55,20 +55,20 @@
"""
recives a unicode object and encode it into filesystem encoding
"""
- if type(filename)==unicode:
+ if type(filename)==str:
return filename.encode(fs_encoding)
return filename
def randomblob(m,M):
- return ''.join(map(lambda i: chr(random.randrange(0,255)), range(random.randrange(m,M))))
+ return ''.join([chr(random.randrange(0,255)) for i in range(random.randrange(m,M))])
def safeHash(stringSeed, o):
"""
a URL safe hash, it results a 22 byte long string hash based on md5sum
"""
- if isinstance(o,unicode): o=o.encode('utf8')
+ if isinstance(o,str): o=o.encode('utf8')
return hashlib.md5(stringSeed+o).digest().encode('base64').replace('+','-').replace('/','_')[:22]
# TODO: is this needed by anything ?
@@ -76,13 +76,13 @@
"""
Unix-like uniq, the iteratable argument should be sorted first to get unique elements.
"""
- return imap(lambda j:j[0],groupby(l,lambda i: i))
+ return map(lambda j:j[0],groupby(l,lambda i: i))
def unixUniqAndCount(l):
"""
Unix-like uniq -c, it returns an iteratable of tuples (count, uniq_entry)
"""
- return imap(lambda j:(len(list(j[1])),j[0]),groupby(l,lambda i: i))
+ return map(lambda j:(len(list(j[1])),j[0]),groupby(l,lambda i: i))
class ObjectsCacheObject:
def __init__(self, objId, obj):
@@ -198,7 +198,7 @@
def append(self, objId, obj):
self._lock.acquire()
try:
- if self._hash.has_key(objId):
+ if objId in self._hash:
# replace it
self._get(objId) # this will make it last object
# remove it
Index: okasha/okasha/xsltTemplate.py
===================================================================
--- okasha.orig/okasha/xsltTemplate.py 2019-09-14 02:51:35.545932396 +0200
+++ okasha/okasha/xsltTemplate.py 2019-09-14 02:51:35.541932379 +0200
@@ -18,9 +18,9 @@
"""
import sys, os, os.path, threading
from lxml import etree
-from utils import ObjectsCache # kid has its own cache
+from .utils import ObjectsCache # kid has its own cache
-from baseWebApp import fileNotFoundException
+from .baseWebApp import fileNotFoundException
xsltCache=ObjectsCache(lock=threading.Lock())
@@ -41,7 +41,7 @@
trans = etree.XSLT(xslt_doc)
xsltCache.append(fn, trans)
# prepare object
- if isinstance(o,basestring):
+ if isinstance(o,str):
doc=etree.fromstring(o)
else: doc=o
r = trans(doc, **kw)
Index: okasha/test.py
===================================================================
--- okasha.orig/test.py 2019-09-14 02:51:35.545932396 +0200
+++ okasha/test.py 2019-09-14 02:51:35.541932379 +0200
@@ -19,7 +19,6 @@
"""
from okasha.baseWebApp import *
-from okasha.kidTemplate import kidTemplate
from okasha.xsltTemplate import xsltTemplate
from okasha.bottleTemplate import bottleTemplate
@@ -100,7 +99,6 @@
<li><a href="%(script)s/tmp/err/raised/?id=5">tmp (not allowed)</a></li>
<li><a href="%(script)s/format/some/args/?id=5">format</a></li>
<li><a href="%(script)s/bottletmp/red/yellow/green/">bottle templates</a></li>
-<li><a href="%(script)s/kidtmp/some/args/?id=5">kid templates</a></li>
<li><a href="%(script)s/xslt/some/args/?id=5">xslt templates</a></li>
<li><a href="%(script)s/docbook/some/args/?id=5">docbook templates</a></li>
<li><a href="%(script)s/cookies/">cookies</a></li>
@@ -153,30 +151,19 @@
'colors':args
}
- @expose(kidTemplate,["kidtest.kid"])
- def kidtmp(self, rq, *args):
- """
- http://localhost:8080/kidtmp/some/args/?id=5
- """
- return {
- 'h1':'this is how kid templates works',
- 'ls':['apple','banana','orange','tomato'],
- 'args':'/'.join(args)
- }
-
@expose(xsltTemplate,["test.xsl"], contentType="text/xml; charset=utf-8")
def xslt(self, rq, *args):
"""
http://localhost:8080/xslt/some/args/?id=5
"""
- return u'''<a><b>Text</b></a>'''
+ return '''<a><b>Text</b></a>'''
@expose(xsltTemplate,["docbook.xsl"])
def docbook(self, rq, *args):
"""
http://localhost:8080/docbook/some/args/?id=5
"""
- return u'''\
+ return '''\
<article id="myarticle" lang="ar_JO">
<section id="mysection1">
<title>عنوان الفصل الأول</title>
@@ -207,11 +194,11 @@
"""
http://localhost:8080/cookies/
"""
- if rq.q.has_key('color'):
+ if 'color' in rq.q:
c=rq.q.getfirst('color','')
rq.response.setCookie('color',c, 60*5) # expires in 5 minutes
return {'color':c}
- if rq.cookies.has_key('color'):
+ if 'color' in rq.cookies:
return {'color':rq.cookies['color'].value.decode('utf8')}
return {'color':''}
@@ -222,7 +209,7 @@
"""
color=rq.q.getfirst('color','')
b=rq.q.getfirst('b','')
- if rq.q.has_key('file1'):
+ if 'file1' in rq.q:
f=rq.q.getfirst('file1','') # get it as string
rq.q.save_in('file1','/tmp/')
else: f=""
Index: okasha/testsuit/cachetest.py
===================================================================
--- okasha.orig/testsuit/cachetest.py 2019-09-14 02:51:35.545932396 +0200
+++ okasha/testsuit/cachetest.py 2019-09-14 02:51:35.541932379 +0200
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import sys, os, os.path, time
-print
+print()
try:
from okasha.utils import ObjectsCache
@@ -15,42 +15,42 @@
from okasha.utils import ObjectsCache
ch=ObjectsCache(lock=None, minCount=10, maxCount=100, maxTime=0)
-print "asserting empty start: ",
+print("asserting empty start: ", end=' ')
assert(len(ch.objs)==0)
-print "OK"
+print("OK")
-print "asserting respecting minCount: ",
+print("asserting respecting minCount: ", end=' ')
for i in range(10):
ch.append(i,i)
assert(len(ch.objs)==i+1)
-print "OK, after inserting 10 objects we have ", len(ch.objs), " cached"
+print("OK, after inserting 10 objects we have ", len(ch.objs), " cached")
-print "asserting getting least expected while below minCount: ",
+print("asserting getting least expected while below minCount: ", end=' ')
ch=ObjectsCache(lock=None, minCount=10, maxCount=100, maxTime=0)
for i in range(10):
ch.append(i,100-3*i)
for j in range(i+1):
assert(ch.get(j)==100-3*j)
-print "OK"
+print("OK")
-print "asserting getting while below minCount: ",
+print("asserting getting while below minCount: ", end=' ')
ch=ObjectsCache(lock=None, minCount=10, maxCount=100, maxTime=0)
for i in range(10):
ch.append(i,100-3*i)
for j in range(i,-1,-1):
assert(ch.get(j)==100-3*j)
-print "OK"
+print("OK")
-print "asserting below maxCount: ",
+print("asserting below maxCount: ", end=' ')
ch=ObjectsCache(lock=None, minCount=10, maxCount=100, maxTime=0)
for i in range(100):
ch.append(i,3*i)
for j in range(i+1):
assert(ch.get(j)==3*j)
-print "OK"
+print("OK")
-print "asserting above maxCount (132 objs in 100 max): ",
+print("asserting above maxCount (132 objs in 100 max): ", end=' ')
ch=ObjectsCache(lock=None, minCount=10, maxCount=100, maxTime=0)
maxmissing=0
for i in range(132):
@@ -64,12 +64,12 @@
if v==None: missing+=1
maxmissing=max(missing,maxmissing)
assert(maxmissing<=32)
-print "OK, we are keeping ", len(ch.objs), " objects and the maximum missing=",maxmissing
+print("OK, we are keeping ", len(ch.objs), " objects and the maximum missing=",maxmissing)
import random
random.seed(time.time())
-print "random testing: "
+print("random testing: ")
# insert 5 values then choose randomly between getting or inserting
# when in getting mode, choose a random number of how many times to repeat getting the same id
|