diff options
author | Davies Liu <davies@databricks.com> | 2014-11-13 10:24:54 -0800 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2014-11-13 10:24:54 -0800 |
commit | ce0333f9a008348692bb9a200449d2d992e7825e (patch) | |
tree | 03a42efe832281f0cb668d460a53153cd4bbc99b /python/pyspark/__init__.py | |
parent | 484fecbf1402c25f310be0b0a5ec15c11cbd65c3 (diff) | |
download | spark-ce0333f9a008348692bb9a200449d2d992e7825e.tar.gz spark-ce0333f9a008348692bb9a200449d2d992e7825e.tar.bz2 spark-ce0333f9a008348692bb9a200449d2d992e7825e.zip |
[SPARK-4348] [PySpark] [MLlib] rename random.py to rand.py
This PR rename random.py to rand.py to avoid the side affects of conflict with random module, but still keep the same interface as before.
```
>>> from pyspark.mllib.random import RandomRDDs
```
```
$ pydoc pyspark.mllib.random
Help on module random in pyspark.mllib:
NAME
random - Python package for random data generation.
FILE
/Users/davies/work/spark/python/pyspark/mllib/rand.py
CLASSES
__builtin__.object
pyspark.mllib.random.RandomRDDs
class RandomRDDs(__builtin__.object)
| Generator methods for creating RDDs comprised of i.i.d samples from
| some distribution.
|
| Static methods defined here:
|
| normalRDD(sc, size, numPartitions=None, seed=None)
```
cc mengxr
reference link: http://xion.org.pl/2012/05/06/hacking-python-imports/
Author: Davies Liu <davies@databricks.com>
Closes #3216 from davies/random and squashes the following commits:
7ac4e8b [Davies Liu] rename random.py to rand.py
Diffstat (limited to 'python/pyspark/__init__.py')
-rw-r--r-- | python/pyspark/__init__.py | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/python/pyspark/__init__.py b/python/pyspark/__init__.py index e39e6514d7..9556e4718e 100644 --- a/python/pyspark/__init__.py +++ b/python/pyspark/__init__.py @@ -37,16 +37,6 @@ Public classes: """ -# The following block allows us to import python's random instead of mllib.random for scripts in -# mllib that depend on top level pyspark packages, which transitively depend on python's random. -# Since Python's import logic looks for modules in the current package first, we eliminate -# mllib.random as a candidate for C{import random} by removing the first search path, the script's -# location, in order to force the loader to look in Python's top-level modules for C{random}. -import sys -s = sys.path.pop(0) -import random -sys.path.insert(0, s) - from pyspark.conf import SparkConf from pyspark.context import SparkContext from pyspark.rdd import RDD |