Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
fec86e26
Commit
fec86e26
authored
May 04, 2018
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Add support for custom compression levels
parent
0c34630c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
neo/lib/compress.py
neo/lib/compress.py
+2
-2
neo/tests/threaded/testConfig.py
neo/tests/threaded/testConfig.py
+2
-2
No files found.
neo/lib/compress.py
View file @
fec86e26
...
...
@@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
functools
import
partial
import
zlib
decompress_list
=
(
...
...
@@ -40,7 +39,8 @@ def getCompress(value):
alg
,
level
=
(
0
,
None
)
if
value
is
True
else
value
_compress
=
zlib
.
compress
if
level
:
_compress
=
partial
(
_compress
,
level
=
level
)
zlib_compress
=
_compress
_compress
=
lambda
data
:
zlib_compress
(
data
,
level
)
alg
+=
1
assert
0
<
alg
<
len
(
decompress_list
),
'invalid compression algorithm'
def
compress
(
data
):
...
...
neo/tests/threaded/testConfig.py
View file @
fec86e26
...
...
@@ -55,8 +55,8 @@ class ConfigTests(NEOThreadedTest):
for
kw
[
'compress'
]
in
'9'
,
'best'
,
'zlib=0'
,
'zlib=100'
:
self
.
assertRaises
(
ConfigurationSyntaxError
,
databaseFromDict
,
**
kw
)
for
compress
in
valid
:
with
self
.
_db
(
cluster
,
compress
=
compress
):
pass
with
self
.
_db
(
cluster
,
compress
=
compress
)
as
db
:
self
.
assertEqual
((
0
,
0
,
''
),
db
.
storage
.
app
.
compress
(
''
))
if
__name__
==
"__main__"
:
unittest
.
main
()
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