Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
618a2277
Commit
618a2277
authored
Oct 23, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new copyright and untabified.
parent
803364dd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
280 additions
and
360 deletions
+280
-360
src/Persistence/PersistentMapping.py
src/Persistence/PersistentMapping.py
+64
-80
src/ZODB/Persistence.py
src/ZODB/Persistence.py
+40
-50
src/ZODB/PersistentMapping.py
src/ZODB/PersistentMapping.py
+64
-80
src/ZODB/PickleCache.py
src/ZODB/PickleCache.py
+48
-70
src/persistent/mapping.py
src/persistent/mapping.py
+64
-80
No files found.
src/Persistence/PersistentMapping.py
View file @
618a2277
#!/usr/local/bin/python
##############################################################################
# $What$
__doc__
=
'''Python implementation of persistent base types
$Id: PersistentMapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved. Copyright in this software is owned by DCLC,
# unless otherwise indicated. Permission to use, copy and
# distribute this software is hereby granted, provided that the
# above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear. Note that
# any product, process or technology described in this software
# may be the subject of other Intellectual Property rights
# reserved by Digital Creations, L.C. and are not licensed
# hereunder.
#
# Trademarks
#
# Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
# All other trademarks are owned by their respective companies.
#
# No Warranty
#
#
# The software is provided "as is" without warranty of any kind,
# Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA.
# either express or implied, including, but not limited to, the
# All rights reserved.
# implied warranties of merchantability, fitness for a particular
#
# purpose, or non-infringement. This software could include
# Redistribution and use in source and binary forms, with or without
# technical inaccuracies or typographical errors. Changes are
# modification, are permitted provided that the following conditions are
# periodically made to the software; these changes will be
# met:
# incorporated in new editions of the software. DCLC may make
#
# improvements and/or changes in this software at any time
# o Redistributions of source code must retain the above copyright
# without notice.
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS IS*
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#
#
# Limitation Of Liability
#
#
# If you have questions regarding this software, contact:
# In no event will DCLC be liable for direct, indirect, special,
# incidental, economic, cover, or consequential damages arising
# out of the use of or inability to use this software even if
# advised of the possibility of such damages. Some states do not
# allow the exclusion or limitation of implied warranties or
# limitation of liability for incidental or consequential
# damages, so the above limitation or exclusion may not apply to
# you.
#
#
# If you have questions regarding this software,
# contact:
#
#
# Digital Creations, L.C.
# Digital Creations, L.C.
# 910 Princess Ann Street
# 910 Princess Ann Street
...
@@ -59,10 +44,15 @@ $Id: PersistentMapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
...
@@ -59,10 +44,15 @@ $Id: PersistentMapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
#
#
# (540) 371-6909
# (540) 371-6909
#
#
__version__
=
'$Revision: 1.1 $'
[
11
:
-
2
]
##############################################################################
__doc__
=
'''Python implementation of persistent base types
$Id: PersistentMapping.py,v 1.2 1998/10/23 21:40:59 jim Exp $'''
__version__
=
'$Revision: 1.2 $'
[
11
:
-
2
]
import
Persistence
import
Persistence
class
PersistentMapping
(
Persistence
.
Persistent
):
class
PersistentMapping
(
Persistence
.
Persistent
):
"""A persistent wrapper for mapping objects.
"""A persistent wrapper for mapping objects.
...
@@ -72,49 +62,43 @@ class PersistentMapping(Persistence.Persistent):
...
@@ -72,49 +62,43 @@ class PersistentMapping(Persistence.Persistent):
"""
"""
def
__init__
(
self
,
container
=
None
):
def
__init__
(
self
,
container
=
None
):
if
container
is
None
:
container
=
{}
if
container
is
None
:
container
=
{}
self
.
_container
=
container
self
.
_container
=
container
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
return
self
.
_container
[
key
]
return
self
.
_container
[
key
]
def
__setitem__
(
self
,
key
,
v
):
def
__setitem__
(
self
,
key
,
v
):
self
.
_container
[
key
]
=
v
self
.
_container
[
key
]
=
v
try
:
del
self
.
_v_keys
try
:
del
self
.
_v_keys
except
:
pass
except
:
pass
self
.
__changed__
(
1
)
self
.
__changed__
(
1
)
def
__delitem__
(
self
,
key
):
def
__delitem__
(
self
,
key
):
del
self
.
_container
[
key
]
del
self
.
_container
[
key
]
try
:
del
self
.
_v_keys
try
:
del
self
.
_v_keys
except
:
pass
except
:
pass
self
.
__changed__
(
1
)
self
.
__changed__
(
1
)
def
__len__
(
self
):
return
len
(
self
.
_container
)
def
__len__
(
self
):
return
len
(
self
.
_container
)
def
keys
(
self
):
def
keys
(
self
):
try
:
return
self
.
_v_keys
try
:
return
self
.
_v_keys
except
:
pass
except
:
pass
keys
=
self
.
_v_keys
=
filter
(
keys
=
self
.
_v_keys
=
filter
(
lambda
k
:
k
[:
1
]
!=
'_'
,
lambda
k
:
k
[:
1
]
!=
'_'
,
self
.
_container
.
keys
())
self
.
_container
.
keys
())
keys
.
sort
()
keys
.
sort
()
return
keys
return
keys
def
clear
(
self
):
def
clear
(
self
):
self
.
_container
=
{}
self
.
_container
=
{}
if
hasattr
(
self
,
'_v_keys'
):
del
self
.
_v_keys
if
hasattr
(
self
,
'_v_keys'
):
del
self
.
_v_keys
def
values
(
self
):
def
values
(
self
):
return
map
(
lambda
k
,
d
=
self
:
d
[
k
],
self
.
keys
())
return
map
(
lambda
k
,
d
=
self
:
d
[
k
],
self
.
keys
())
def
items
(
self
):
def
items
(
self
):
return
map
(
lambda
k
,
d
=
self
:
(
k
,
d
[
k
]),
self
.
keys
())
return
map
(
lambda
k
,
d
=
self
:
(
k
,
d
[
k
]),
self
.
keys
())
def
has_key
(
self
,
key
):
return
self
.
_container
.
has_key
(
key
)
def
has_key
(
self
,
key
):
return
self
.
_container
.
has_key
(
key
)
############################################################################
# $Log: PersistentMapping.py,v $
# Revision 1.1 1997/12/15 17:51:33 jim
# Split off from Persistence.
#
src/ZODB/Persistence.py
View file @
618a2277
#!/usr/local/bin/python
##############################################################################
# $What$
__doc__
=
'''Python implementation of a persistent base types
$Id: Persistence.py,v 1.15 1998/10/23 21:36:59 jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved. Copyright in this software is owned by DCLC,
# unless otherwise indicated. Permission to use, copy and
# distribute this software is hereby granted, provided that the
# above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear. Note that
# any product, process or technology described in this software
# may be the subject of other Intellectual Property rights
# reserved by Digital Creations, L.C. and are not licensed
# hereunder.
#
# Trademarks
#
# Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
# All other trademarks are owned by their respective companies.
#
#
# No Warranty
# Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS IS*
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#
#
# The software is provided "as is" without warranty of any kind,
#
# either express or implied, including, but not limited to, the
# If you have questions regarding this software, contact:
# implied warranties of merchantability, fitness for a particular
# purpose, or non-infringement. This software could include
# technical inaccuracies or typographical errors. Changes are
# periodically made to the software; these changes will be
# incorporated in new editions of the software. DCLC may make
# improvements and/or changes in this software at any time
# without notice.
#
# Limitation Of Liability
#
# In no event will DCLC be liable for direct, indirect, special,
# incidental, economic, cover, or consequential damages arising
# out of the use of or inability to use this software even if
# advised of the possibility of such damages. Some states do not
# allow the exclusion or limitation of implied warranties or
# limitation of liability for incidental or consequential
# damages, so the above limitation or exclusion may not apply to
# you.
#
#
# If you have questions regarding this software,
# contact:
#
#
# Digital Creations, L.C.
# Digital Creations, L.C.
# 910 Princess Ann Street
# 910 Princess Ann Street
...
@@ -58,7 +44,11 @@ $Id: Persistence.py,v 1.15 1998/10/23 21:36:59 jim Exp $'''
...
@@ -58,7 +44,11 @@ $Id: Persistence.py,v 1.15 1998/10/23 21:36:59 jim Exp $'''
#
#
# (540) 371-6909
# (540) 371-6909
#
#
__version__
=
'$Revision: 1.15 $'
[
11
:
-
2
]
##############################################################################
__doc__
=
'''Python implementation of a persistent base types
$Id: Persistence.py,v 1.16 1998/10/23 21:40:15 jim Exp $'''
__version__
=
'$Revision: 1.16 $'
[
11
:
-
2
]
try
:
try
:
from
cPersistence
import
Persistent
from
cPersistence
import
Persistent
...
...
src/ZODB/PersistentMapping.py
View file @
618a2277
#!/usr/local/bin/python
##############################################################################
# $What$
__doc__
=
'''Python implementation of persistent base types
$Id: PersistentMapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved. Copyright in this software is owned by DCLC,
# unless otherwise indicated. Permission to use, copy and
# distribute this software is hereby granted, provided that the
# above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear. Note that
# any product, process or technology described in this software
# may be the subject of other Intellectual Property rights
# reserved by Digital Creations, L.C. and are not licensed
# hereunder.
#
# Trademarks
#
# Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
# All other trademarks are owned by their respective companies.
#
# No Warranty
#
#
# The software is provided "as is" without warranty of any kind,
# Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA.
# either express or implied, including, but not limited to, the
# All rights reserved.
# implied warranties of merchantability, fitness for a particular
#
# purpose, or non-infringement. This software could include
# Redistribution and use in source and binary forms, with or without
# technical inaccuracies or typographical errors. Changes are
# modification, are permitted provided that the following conditions are
# periodically made to the software; these changes will be
# met:
# incorporated in new editions of the software. DCLC may make
#
# improvements and/or changes in this software at any time
# o Redistributions of source code must retain the above copyright
# without notice.
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS IS*
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#
#
# Limitation Of Liability
#
#
# If you have questions regarding this software, contact:
# In no event will DCLC be liable for direct, indirect, special,
# incidental, economic, cover, or consequential damages arising
# out of the use of or inability to use this software even if
# advised of the possibility of such damages. Some states do not
# allow the exclusion or limitation of implied warranties or
# limitation of liability for incidental or consequential
# damages, so the above limitation or exclusion may not apply to
# you.
#
#
# If you have questions regarding this software,
# contact:
#
#
# Digital Creations, L.C.
# Digital Creations, L.C.
# 910 Princess Ann Street
# 910 Princess Ann Street
...
@@ -59,10 +44,15 @@ $Id: PersistentMapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
...
@@ -59,10 +44,15 @@ $Id: PersistentMapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
#
#
# (540) 371-6909
# (540) 371-6909
#
#
__version__
=
'$Revision: 1.1 $'
[
11
:
-
2
]
##############################################################################
__doc__
=
'''Python implementation of persistent base types
$Id: PersistentMapping.py,v 1.2 1998/10/23 21:40:59 jim Exp $'''
__version__
=
'$Revision: 1.2 $'
[
11
:
-
2
]
import
Persistence
import
Persistence
class
PersistentMapping
(
Persistence
.
Persistent
):
class
PersistentMapping
(
Persistence
.
Persistent
):
"""A persistent wrapper for mapping objects.
"""A persistent wrapper for mapping objects.
...
@@ -72,49 +62,43 @@ class PersistentMapping(Persistence.Persistent):
...
@@ -72,49 +62,43 @@ class PersistentMapping(Persistence.Persistent):
"""
"""
def
__init__
(
self
,
container
=
None
):
def
__init__
(
self
,
container
=
None
):
if
container
is
None
:
container
=
{}
if
container
is
None
:
container
=
{}
self
.
_container
=
container
self
.
_container
=
container
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
return
self
.
_container
[
key
]
return
self
.
_container
[
key
]
def
__setitem__
(
self
,
key
,
v
):
def
__setitem__
(
self
,
key
,
v
):
self
.
_container
[
key
]
=
v
self
.
_container
[
key
]
=
v
try
:
del
self
.
_v_keys
try
:
del
self
.
_v_keys
except
:
pass
except
:
pass
self
.
__changed__
(
1
)
self
.
__changed__
(
1
)
def
__delitem__
(
self
,
key
):
def
__delitem__
(
self
,
key
):
del
self
.
_container
[
key
]
del
self
.
_container
[
key
]
try
:
del
self
.
_v_keys
try
:
del
self
.
_v_keys
except
:
pass
except
:
pass
self
.
__changed__
(
1
)
self
.
__changed__
(
1
)
def
__len__
(
self
):
return
len
(
self
.
_container
)
def
__len__
(
self
):
return
len
(
self
.
_container
)
def
keys
(
self
):
def
keys
(
self
):
try
:
return
self
.
_v_keys
try
:
return
self
.
_v_keys
except
:
pass
except
:
pass
keys
=
self
.
_v_keys
=
filter
(
keys
=
self
.
_v_keys
=
filter
(
lambda
k
:
k
[:
1
]
!=
'_'
,
lambda
k
:
k
[:
1
]
!=
'_'
,
self
.
_container
.
keys
())
self
.
_container
.
keys
())
keys
.
sort
()
keys
.
sort
()
return
keys
return
keys
def
clear
(
self
):
def
clear
(
self
):
self
.
_container
=
{}
self
.
_container
=
{}
if
hasattr
(
self
,
'_v_keys'
):
del
self
.
_v_keys
if
hasattr
(
self
,
'_v_keys'
):
del
self
.
_v_keys
def
values
(
self
):
def
values
(
self
):
return
map
(
lambda
k
,
d
=
self
:
d
[
k
],
self
.
keys
())
return
map
(
lambda
k
,
d
=
self
:
d
[
k
],
self
.
keys
())
def
items
(
self
):
def
items
(
self
):
return
map
(
lambda
k
,
d
=
self
:
(
k
,
d
[
k
]),
self
.
keys
())
return
map
(
lambda
k
,
d
=
self
:
(
k
,
d
[
k
]),
self
.
keys
())
def
has_key
(
self
,
key
):
return
self
.
_container
.
has_key
(
key
)
def
has_key
(
self
,
key
):
return
self
.
_container
.
has_key
(
key
)
############################################################################
# $Log: PersistentMapping.py,v $
# Revision 1.1 1997/12/15 17:51:33 jim
# Split off from Persistence.
#
src/ZODB/PickleCache.py
View file @
618a2277
#!/usr/local/bin/python
##############################################################################
# $What$
__doc__
=
'''PickleJar Object Cache
$Id: PickleCache.py,v 1.3 1998/06/05 22:20:30 jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved. Copyright in this software is owned by DCLC,
# unless otherwise indicated. Permission to use, copy and
# distribute this software is hereby granted, provided that the
# above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear. Note that
# any product, process or technology described in this software
# may be the subject of other Intellectual Property rights
# reserved by Digital Creations, L.C. and are not licensed
# hereunder.
#
# Trademarks
#
# Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
# All other trademarks are owned by their respective companies.
#
# No Warranty
#
#
# The software is provided "as is" without warranty of any kind,
# Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA.
# either express or implied, including, but not limited to, the
# All rights reserved.
# implied warranties of merchantability, fitness for a particular
#
# purpose, or non-infringement. This software could include
# Redistribution and use in source and binary forms, with or without
# technical inaccuracies or typographical errors. Changes are
# modification, are permitted provided that the following conditions are
# periodically made to the software; these changes will be
# met:
# incorporated in new editions of the software. DCLC may make
#
# improvements and/or changes in this software at any time
# o Redistributions of source code must retain the above copyright
# without notice.
# notice, this list of conditions, and the disclaimer that follows.
#
#
# Limitation Of Liability
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS IS*
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#
#
# In no event will DCLC be liable for direct, indirect, special,
#
# incidental, economic, cover, or consequential damages arising
# If you have questions regarding this software, contact:
# out of the use of or inability to use this software even if
# advised of the possibility of such damages. Some states do not
# allow the exclusion or limitation of implied warranties or
# limitation of liability for incidental or consequential
# damages, so the above limitation or exclusion may not apply to
# you.
#
#
#
# If you have questions regarding this software,
# Digital Creations, L.C.
# contact:
# 910 Princess Ann Street
# Fredericksburge, Virginia 22401
#
#
#
Digital Creations, bob
o@digicool.com
#
inf
o@digicool.com
#
#
# (540) 371-6909
# (540) 371-6909
#
#
__version__
=
'$Revision: 1.3 $'
[
11
:
-
2
]
##############################################################################
__doc__
=
'''PickleJar Object Cache
$Id: PickleCache.py,v 1.4 1998/10/23 21:41:24 jim Exp $'''
__version__
=
'$Revision: 1.4 $'
[
11
:
-
2
]
from
sys
import
getrefcount
from
sys
import
getrefcount
class
PickleCache
:
class
PickleCache
:
...
@@ -64,8 +58,8 @@ class PickleCache:
...
@@ -64,8 +58,8 @@ class PickleCache:
if
cache_size
<
1
:
cache_size
=
1
if
cache_size
<
1
:
cache_size
=
1
self
.
cache_size
=
cache_size
self
.
cache_size
=
cache_size
self
.
data
,
self
.
cache_ids
,
self
.
cache_location
=
{},
[],
0
self
.
data
,
self
.
cache_ids
,
self
.
cache_location
=
{},
[],
0
for
a
in
'keys'
,
'items'
,
'values'
,
'has_key'
:
for
a
in
'keys'
,
'items'
,
'values'
,
'has_key'
:
setattr
(
self
,
a
,
getattr
(
self
.
data
,
a
))
setattr
(
self
,
a
,
getattr
(
self
.
data
,
a
))
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
...
@@ -114,19 +108,3 @@ class PickleCache:
...
@@ -114,19 +108,3 @@ class PickleCache:
if
rc
(
cache
[
id
])
<=
2
:
del
cache
[
id
]
if
rc
(
cache
[
id
])
<=
2
:
del
cache
[
id
]
cache
[
id
].
_p_deactivate
()
cache
[
id
].
_p_deactivate
()
l
=
len
(
cache
)
l
=
len
(
cache
)
############################################################################
#
# $Log: PickleCache.py,v $
# Revision 1.3 1998/06/05 22:20:30 jim
# Added __len__ and added a functional minimize method that
# tries to minimize the size of the cache.
#
# Revision 1.2 1998/03/23 15:50:27 jim
# Added import of getrefcound from sys.
#
# Revision 1.1 1997/12/15 17:51:55 jim
# Split off from PickleJar.
#
#
#
src/persistent/mapping.py
View file @
618a2277
#!/usr/local/bin/python
##############################################################################
# $What$
__doc__
=
'''Python implementation of persistent base types
$Id: mapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved. Copyright in this software is owned by DCLC,
# unless otherwise indicated. Permission to use, copy and
# distribute this software is hereby granted, provided that the
# above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear. Note that
# any product, process or technology described in this software
# may be the subject of other Intellectual Property rights
# reserved by Digital Creations, L.C. and are not licensed
# hereunder.
#
# Trademarks
#
# Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
# All other trademarks are owned by their respective companies.
#
# No Warranty
#
#
# The software is provided "as is" without warranty of any kind,
# Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA.
# either express or implied, including, but not limited to, the
# All rights reserved.
# implied warranties of merchantability, fitness for a particular
#
# purpose, or non-infringement. This software could include
# Redistribution and use in source and binary forms, with or without
# technical inaccuracies or typographical errors. Changes are
# modification, are permitted provided that the following conditions are
# periodically made to the software; these changes will be
# met:
# incorporated in new editions of the software. DCLC may make
#
# improvements and/or changes in this software at any time
# o Redistributions of source code must retain the above copyright
# without notice.
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS IS*
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#
#
# Limitation Of Liability
#
#
# If you have questions regarding this software, contact:
# In no event will DCLC be liable for direct, indirect, special,
# incidental, economic, cover, or consequential damages arising
# out of the use of or inability to use this software even if
# advised of the possibility of such damages. Some states do not
# allow the exclusion or limitation of implied warranties or
# limitation of liability for incidental or consequential
# damages, so the above limitation or exclusion may not apply to
# you.
#
#
# If you have questions regarding this software,
# contact:
#
#
# Digital Creations, L.C.
# Digital Creations, L.C.
# 910 Princess Ann Street
# 910 Princess Ann Street
...
@@ -59,10 +44,15 @@ $Id: mapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
...
@@ -59,10 +44,15 @@ $Id: mapping.py,v 1.1 1997/12/15 17:51:33 jim Exp $'''
#
#
# (540) 371-6909
# (540) 371-6909
#
#
__version__
=
'$Revision: 1.1 $'
[
11
:
-
2
]
##############################################################################
__doc__
=
'''Python implementation of persistent base types
$Id: mapping.py,v 1.2 1998/10/23 21:40:59 jim Exp $'''
__version__
=
'$Revision: 1.2 $'
[
11
:
-
2
]
import
Persistence
import
Persistence
class
PersistentMapping
(
Persistence
.
Persistent
):
class
PersistentMapping
(
Persistence
.
Persistent
):
"""A persistent wrapper for mapping objects.
"""A persistent wrapper for mapping objects.
...
@@ -72,49 +62,43 @@ class PersistentMapping(Persistence.Persistent):
...
@@ -72,49 +62,43 @@ class PersistentMapping(Persistence.Persistent):
"""
"""
def
__init__
(
self
,
container
=
None
):
def
__init__
(
self
,
container
=
None
):
if
container
is
None
:
container
=
{}
if
container
is
None
:
container
=
{}
self
.
_container
=
container
self
.
_container
=
container
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
return
self
.
_container
[
key
]
return
self
.
_container
[
key
]
def
__setitem__
(
self
,
key
,
v
):
def
__setitem__
(
self
,
key
,
v
):
self
.
_container
[
key
]
=
v
self
.
_container
[
key
]
=
v
try
:
del
self
.
_v_keys
try
:
del
self
.
_v_keys
except
:
pass
except
:
pass
self
.
__changed__
(
1
)
self
.
__changed__
(
1
)
def
__delitem__
(
self
,
key
):
def
__delitem__
(
self
,
key
):
del
self
.
_container
[
key
]
del
self
.
_container
[
key
]
try
:
del
self
.
_v_keys
try
:
del
self
.
_v_keys
except
:
pass
except
:
pass
self
.
__changed__
(
1
)
self
.
__changed__
(
1
)
def
__len__
(
self
):
return
len
(
self
.
_container
)
def
__len__
(
self
):
return
len
(
self
.
_container
)
def
keys
(
self
):
def
keys
(
self
):
try
:
return
self
.
_v_keys
try
:
return
self
.
_v_keys
except
:
pass
except
:
pass
keys
=
self
.
_v_keys
=
filter
(
keys
=
self
.
_v_keys
=
filter
(
lambda
k
:
k
[:
1
]
!=
'_'
,
lambda
k
:
k
[:
1
]
!=
'_'
,
self
.
_container
.
keys
())
self
.
_container
.
keys
())
keys
.
sort
()
keys
.
sort
()
return
keys
return
keys
def
clear
(
self
):
def
clear
(
self
):
self
.
_container
=
{}
self
.
_container
=
{}
if
hasattr
(
self
,
'_v_keys'
):
del
self
.
_v_keys
if
hasattr
(
self
,
'_v_keys'
):
del
self
.
_v_keys
def
values
(
self
):
def
values
(
self
):
return
map
(
lambda
k
,
d
=
self
:
d
[
k
],
self
.
keys
())
return
map
(
lambda
k
,
d
=
self
:
d
[
k
],
self
.
keys
())
def
items
(
self
):
def
items
(
self
):
return
map
(
lambda
k
,
d
=
self
:
(
k
,
d
[
k
]),
self
.
keys
())
return
map
(
lambda
k
,
d
=
self
:
(
k
,
d
[
k
]),
self
.
keys
())
def
has_key
(
self
,
key
):
return
self
.
_container
.
has_key
(
key
)
def
has_key
(
self
,
key
):
return
self
.
_container
.
has_key
(
key
)
############################################################################
# $Log: mapping.py,v $
# Revision 1.1 1997/12/15 17:51:33 jim
# Split off from Persistence.
#
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment