Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BTrees
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
BTrees
Commits
4274ae3b
Commit
4274ae3b
authored
Dec 04, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disuse '_set_operation' mega-function for 'difference'.
parent
93dd97dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
BTrees/_base.py
BTrees/_base.py
+26
-3
No files found.
BTrees/_base.py
View file @
4274ae3b
...
...
@@ -1190,7 +1190,6 @@ def _set_operation(s1, s2,
if
c2
:
copy
(
i2
,
w2
)
i2
.
advance
()
if
c1
:
while
i1
.
active
:
copy
(
i1
,
w1
)
...
...
@@ -1199,7 +1198,6 @@ def _set_operation(s1, s2,
while
i2
.
active
:
copy
(
i2
,
w2
)
i2
.
advance
()
return
r
...
...
@@ -1216,7 +1214,32 @@ class set_operation(object):
def
difference
(
set_type
,
o1
,
o2
):
if
o1
is
None
or
o2
is
None
:
return
o1
return
_set_operation
(
o1
,
o2
,
1
,
0
,
1
,
0
,
1
,
0
,
0
)
#return _set_operation(o1, o2, 1, 0, 1, 0, 1, 0, 0)
i1
=
_SetIteration
(
o1
,
True
,
0
)
i2
=
_SetIteration
(
o2
,
False
,
0
)
if
i1
.
useValues
:
result
=
o1
.
_mapping_type
()
def
copy
(
i
):
result
.
_keys
.
append
(
i
.
key
)
result
.
_values
.
append
(
i
.
value
)
else
:
result
=
o1
.
_set_type
()
def
copy
(
i
):
result
.
_keys
.
append
(
i
.
key
)
while
i1
.
active
and
i2
.
active
:
cmp_
=
cmp
(
i1
.
key
,
i2
.
key
)
if
cmp_
<
0
:
copy
(
i1
)
i1
.
advance
()
elif
cmp_
==
0
:
i1
.
advance
()
i2
.
advance
()
else
:
i2
.
advance
()
while
i1
.
active
:
copy
(
i1
)
i1
.
advance
()
return
result
def
union
(
set_type
,
o1
,
o2
):
if
o1
is
None
:
...
...
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