diff --git a/python/pyspark/mllib/__init__.py b/python/pyspark/mllib/__init__.py index 8bff2668e2e16..0c7f4910747d2 100644 --- a/python/pyspark/mllib/__init__.py +++ b/python/pyspark/mllib/__init__.py @@ -32,29 +32,4 @@ import rand as random random.__name__ = 'random' random.RandomRDDs.__module__ = __name__ + '.random' - - -class RandomModuleHook(object): - """ - Hook to import pyspark.mllib.random - """ - fullname = __name__ + '.random' - - def find_module(self, name, path=None): - # skip all other modules - if not name.startswith(self.fullname): - return - return self - - def load_module(self, name): - if name == self.fullname: - return random - - cname = name.rsplit('.', 1)[-1] - try: - return getattr(random, cname) - except AttributeError: - raise ImportError - - -sys.meta_path.append(RandomModuleHook()) +sys.modules[__name__ + '.random'] = random