Skip to content

Commit c06d774

Browse files
committed
Add blanklines to Python docstrings so example code renders correctly
1 parent 09f7e45 commit c06d774

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

python/pyspark/rdd.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class MaxHeapQ(object):
134134

135135
"""
136136
An implementation of MaxHeap.
137+
137138
>>> import pyspark.rdd
138139
>>> heap = pyspark.rdd.MaxHeapQ(5)
139140
>>> [heap.insert(i) for i in range(10)]
@@ -381,6 +382,7 @@ def mapPartitionsWithSplit(self, f, preservesPartitioning=False):
381382
def getNumPartitions(self):
382383
"""
383384
Returns the number of partitions in RDD
385+
384386
>>> rdd = sc.parallelize([1, 2, 3, 4], 2)
385387
>>> rdd.getNumPartitions()
386388
2
@@ -570,6 +572,7 @@ def sortByKey(self, ascending=True, numPartitions=None, keyfunc=lambda x: x):
570572
"""
571573
Sorts this RDD, which is assumed to consist of (key, value) pairs.
572574
# noqa
575+
573576
>>> tmp = [('a', 1), ('b', 2), ('1', 3), ('d', 4), ('2', 5)]
574577
>>> sc.parallelize(tmp).sortByKey(True, 2).collect()
575578
[('1', 3), ('2', 5), ('a', 1), ('b', 2), ('d', 4)]
@@ -1205,6 +1208,7 @@ def collectAsMap(self):
12051208
def keys(self):
12061209
"""
12071210
Return an RDD with the keys of each tuple.
1211+
12081212
>>> m = sc.parallelize([(1, 2), (3, 4)]).keys()
12091213
>>> m.collect()
12101214
[1, 3]
@@ -1214,6 +1218,7 @@ def keys(self):
12141218
def values(self):
12151219
"""
12161220
Return an RDD with the values of each tuple.
1221+
12171222
>>> m = sc.parallelize([(1, 2), (3, 4)]).values()
12181223
>>> m.collect()
12191224
[2, 4]
@@ -1638,6 +1643,7 @@ def repartition(self, numPartitions):
16381643
Internally, this uses a shuffle to redistribute data.
16391644
If you are decreasing the number of partitions in this RDD, consider
16401645
using `coalesce`, which can avoid performing a shuffle.
1646+
16411647
>>> rdd = sc.parallelize([1,2,3,4,5,6,7], 4)
16421648
>>> sorted(rdd.glom().collect())
16431649
[[1], [2, 3], [4, 5], [6, 7]]
@@ -1652,6 +1658,7 @@ def repartition(self, numPartitions):
16521658
def coalesce(self, numPartitions, shuffle=False):
16531659
"""
16541660
Return a new RDD that is reduced into `numPartitions` partitions.
1661+
16551662
>>> sc.parallelize([1, 2, 3, 4, 5], 3).glom().collect()
16561663
[[1], [2, 3], [4, 5]]
16571664
>>> sc.parallelize([1, 2, 3, 4, 5], 3).coalesce(1).glom().collect()
@@ -1690,6 +1697,7 @@ def name(self):
16901697
def setName(self, name):
16911698
"""
16921699
Assign a name to this RDD.
1700+
16931701
>>> rdd1 = sc.parallelize([1,2])
16941702
>>> rdd1.setName('RDD1')
16951703
>>> rdd1.name()
@@ -1749,6 +1757,7 @@ class PipelinedRDD(RDD):
17491757

17501758
"""
17511759
Pipelined maps:
1760+
17521761
>>> rdd = sc.parallelize([1, 2, 3, 4])
17531762
>>> rdd.map(lambda x: 2 * x).cache().map(lambda x: 2 * x).collect()
17541763
[4, 8, 12, 16]

0 commit comments

Comments
 (0)