Skip to content

Commit

Permalink
Remove dill from dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Jan 16, 2018
1 parent 794f5fa commit 95b62d2
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 46 deletions.
10 changes: 0 additions & 10 deletions Orange/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
import pickle
from unittest.mock import patch
# Needed because the pure-Python Unpickler that dill uses can also fail
# with struct.error Exception. This seems to work, side effects unknown.
with patch('pickle._Unpickler', pickle.Unpickler):
import dill
dill.settings['protocol'] = pickle.HIGHEST_PROTOCOL
dill.settings['recurse'] = True
dill.settings['byref'] = True

from .misc.lazy_module import _LazyModule
from .misc.datasets import _DatasetInfo
from .version import \
Expand Down
23 changes: 0 additions & 23 deletions Orange/widgets/data/tests/test_owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
freevars, validate_exp, FeatureFunc
)

import dill # Import dill after Orange because patched


class FeatureConstructorTest(unittest.TestCase):
def test_construct_variables_discrete(self):
Expand Down Expand Up @@ -93,27 +91,6 @@ def test_construct_numeric_names(self):
ContinuousVariable._clear_all_caches()


GLOBAL_CONST = 2


class PicklingTest(unittest.TestCase):
CLASS_CONST = 3

def test_lambdas_pickle(self):
NONLOCAL_CONST = 5

lambda_func = lambda x, local_const=7: \
x * local_const * NONLOCAL_CONST * self.CLASS_CONST * GLOBAL_CONST

def nested_func(x, local_const=7):
return x * local_const * NONLOCAL_CONST * self.CLASS_CONST * GLOBAL_CONST

self.assertEqual(lambda_func(11),
dill.loads(dill.dumps(lambda_func))(11))
self.assertEqual(nested_func(11),
dill.loads(dill.dumps(nested_func))(11))


class TestTools(unittest.TestCase):
def test_free_vars(self):
stmt = ast.parse("foo", "", "single")
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/model/owloadmodel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import pickle

import dill as pickle
from AnyQt.QtCore import QTimer
from AnyQt.QtWidgets import (
QSizePolicy, QHBoxLayout, QComboBox, QStyle, QFileDialog
Expand Down
3 changes: 2 additions & 1 deletion Orange/widgets/model/owsavemodel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import dill as pickle
import pickle

from AnyQt.QtWidgets import (
QComboBox, QStyle, QSizePolicy, QFileDialog, QApplication
)
Expand Down
11 changes: 4 additions & 7 deletions Orange/widgets/model/tests/test_owloadmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import pickle
from tempfile import mkstemp

import dill # Import dill after Orange because patched

from Orange.classification.majority import ConstantModel
from Orange.widgets.model.owloadmodel import OWLoadModel
from Orange.widgets.tests.base import WidgetTest
Expand All @@ -23,11 +21,10 @@ def test_show_error(self):
fd, fname = mkstemp(suffix='.pkcls')
os.close(fd)
try:
for pickle_impl in (pickle, dill):
with open(fname, 'wb') as f:
pickle_impl.dump(clsf, f)
self.widget.load(fname)
self.assertFalse(self.widget.Error.load_error.is_shown())
with open(fname, 'wb') as f:
pickle.dump(clsf, f)
self.widget.load(fname)
self.assertFalse(self.widget.Error.load_error.is_shown())

with open(fname, "w") as f:
f.write("X")
Expand Down
1 change: 0 additions & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ requirements:
- anyqt >=0.0.6
- joblib
- python.app # [osx]
- dill # pickle anything
- commonmark
- serverfiles

Expand Down
1 change: 0 additions & 1 deletion requirements-core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ chardet>=3.0.2
joblib>=0.9.4
keyring
keyrings.alt # for alternative keyring implementations
dill
setuptools>=36.3
serverfiles # for Data Sets synchronization
1 change: 0 additions & 1 deletion scripts/macos/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
AnyQt==0.0.8
Bottleneck==1.2.0
chardet==3.0.4
dill==0.2.6
docutils==0.13.1
joblib==0.11
keyring==10.3.1
Expand Down
1 change: 0 additions & 1 deletion scripts/windows/specs/PY34-win32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ AnyQt==0.0.8
PyQt5==5.5.1
docutils==0.13.1
pip==9.0.1
dill==0.2.6
pyqtgraph==0.10.0
six==1.10.0
xlrd==1.0.0

0 comments on commit 95b62d2

Please sign in to comment.