diff options
author | Dan Schult <dschult@colgate.edu> | 2021-07-07 11:29:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-07 11:29:55 -0400 |
commit | c47964d7ab849d143cd57607a2a6dbbb53bbaf30 (patch) | |
tree | 7cb4134876e1a2f8e989a14b09cfcfc323dcd1ad /networkx/utils | |
parent | cabf22e98d06d6c34ff88515f339b515695a7455 (diff) | |
download | networkx-c47964d7ab849d143cd57607a2a6dbbb53bbaf30.tar.gz |
Changes to rst files to make doctests pass (#4947)
* rst double colons for example code
* add nx. prefix to doctest function calls
* Remove one line from 1->2 migration rst file
the line shows code that works for 1.x *and* 2.x.
But it no longer works for all v2.x code. Readers should just use the
next line of code, so no reason to keep this in the file.
* capture output from subplot and rename DiGraph as DG in introduction.rst
* skip running the entire test suite as an example in old_release_log.rst
* doctest of examples
* remove changes to nexp files
Diffstat (limited to 'networkx/utils')
-rw-r--r-- | networkx/utils/misc.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/networkx/utils/misc.py b/networkx/utils/misc.py index ad6e3506..0bd8baa0 100644 --- a/networkx/utils/misc.py +++ b/networkx/utils/misc.py @@ -314,27 +314,27 @@ def arbitrary_element(iterable): -------- Arbitrary elements from common Iterable objects: - >>> arbitrary_element([1, 2, 3]) # list + >>> nx.utils.arbitrary_element([1, 2, 3]) # list 1 - >>> arbitrary_element((1, 2, 3)) # tuple + >>> nx.utils.arbitrary_element((1, 2, 3)) # tuple 1 - >>> arbitrary_element({1, 2, 3}) # set + >>> nx.utils.arbitrary_element({1, 2, 3}) # set 1 >>> d = {k: v for k, v in zip([1, 2, 3], [3, 2, 1])} - >>> arbitrary_element(d) # dict_keys + >>> nx.utils.arbitrary_element(d) # dict_keys 1 - >>> arbitrary_element(d.values()) # dict values + >>> nx.utils.arbitrary_element(d.values()) # dict values 3 `str` is also an Iterable: - >>> arbitrary_element("hello") + >>> nx.utils.arbitrary_element("hello") 'h' :exc:`ValueError` is raised if `iterable` is an iterator: >>> iterator = iter([1, 2, 3]) # Iterator, *not* Iterable - >>> arbitrary_element(iterator) + >>> nx.utils.arbitrary_element(iterator) Traceback (most recent call last): ... ValueError: cannot return an arbitrary item from an iterator @@ -345,9 +345,9 @@ def arbitrary_element(iterable): ordered, sequential calls will return the same value:: >>> l = [1, 2, 3] - >>> arbitrary_element(l) + >>> nx.utils.arbitrary_element(l) 1 - >>> arbitrary_element(l) + >>> nx.utils.arbitrary_element(l) 1 """ |