Change stdlib imports to use std prefix in most examples (#17202)

This commit is contained in:
Danil Yarantsev 2021-03-01 00:17:19 +03:00 • committed by GitHub
commit 56461c280f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 127 additions and 127 deletions

View file

@ -13,7 +13,7 @@
## (A crit bit tree is a form of `radix tree`:idx: or `patricia trie`:idx:.)
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
var critbitAsSet: CritBitTree[void] = ["kitten", "puppy"].toCritBitTree
doAssert critbitAsSet.len == 2
@ -335,7 +335,7 @@ iterator leaves[T](n: Node[T]): Node[T] =
iterator keys*[T](c: CritBitTree[T]): string =
## Yields all keys in lexicographical order.
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
let c = {"key1": 1, "key2": 2}.toCritBitTree
doAssert toSeq(c.keys) == @["key1", "key2"]
@ -349,7 +349,7 @@ iterator values*[T](c: CritBitTree[T]): T =
## **See also:**
## * `mvalues iterator <#mvalues.i,CritBitTree[T]>`_
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
let c = {"key1": 1, "key2": 2}.toCritBitTree
doAssert toSeq(c.values) == @[1, 2]
@ -375,7 +375,7 @@ iterator pairs*[T](c: CritBitTree[T]): tuple[key: string, val: T] =
## **See also:**
## * `mpairs iterator <#mpairs.i,CritBitTree[T]>`_
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
let c = {"key1": 1, "key2": 2}.toCritBitTree
doAssert toSeq(c.pairs) == @[(key: "key1", val: 1), (key: "key2", val: 2)]
@ -407,7 +407,7 @@ proc allprefixedAux[T](c: CritBitTree[T], key: string): Node[T] =
iterator keysWithPrefix*[T](c: CritBitTree[T], prefix: string): string =
## Yields all keys starting with `prefix`.
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
let c = {"key1": 42, "key2": 43}.toCritBitTree
doAssert toSeq(c.keysWithPrefix("key")) == @["key1", "key2"]
@ -422,7 +422,7 @@ iterator valuesWithPrefix*[T](c: CritBitTree[T], prefix: string): T =
## **See also:**
## * `mvaluesWithPrefix iterator <#mvaluesWithPrefix.i,CritBitTree[T],string>`_
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
let c = {"key1": 42, "key2": 43}.toCritBitTree
doAssert toSeq(c.valuesWithPrefix("key")) == @[42, 43]
@ -451,7 +451,7 @@ iterator pairsWithPrefix*[T](c: CritBitTree[T],
## **See also:**
## * `mpairsWithPrefix iterator <#mpairsWithPrefix.i,CritBitTree[T],string>`_
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
let c = {"key1": 42, "key2": 43}.toCritBitTree
doAssert toSeq(c.pairsWithPrefix("key")) == @[(key: "key1", val: 42), (key: "key2", val: 43)]

View file

@ -200,7 +200,7 @@ iterator items*[T](deq: Deque[T]): T =
## **See also:**
## * `mitems iterator <#mitems,Deque[T]>`_
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
let a = [10, 20, 30, 40, 50].toDeque
assert toSeq(a.items) == @[10, 20, 30, 40, 50]
@ -230,7 +230,7 @@ iterator mitems*[T](deq: var Deque[T]): var T =
iterator pairs*[T](deq: Deque[T]): tuple[key: int, val: T] =
## Yields every `(position, value)`-pair of `deq`.
runnableExamples:
from sequtils import toSeq
from std/sequtils import toSeq
let a = [10, 20, 30].toDeque
assert toSeq(a.pairs) == @[(0, 10), (1, 20), (2, 30)]

View file

@ -165,7 +165,7 @@ proc newSinglyLinkedNode*[T](value: T): <//>(SinglyLinkedNode[T]) =
func toSinglyLinkedList*[T](elems: openArray[T]): SinglyLinkedList[T] {.since: (1, 5, 1).} =
## Creates a new `SinglyLinkedList` from members of `elems`.
runnableExamples:
import sequtils
import std/sequtils
let a = [1, 2, 3, 4, 5].toSinglyLinkedList
assert a.toSeq == [1, 2, 3, 4, 5]
result = initSinglyLinkedList[T]()
@ -175,7 +175,7 @@ func toSinglyLinkedList*[T](elems: openArray[T]): SinglyLinkedList[T] {.since: (
func toDoublyLinkedList*[T](elems: openArray[T]): DoublyLinkedList[T] {.since: (1, 5, 1).} =
## Creates a new `DoublyLinkedList` from members of `elems`.
runnableExamples:
import sequtils
import std/sequtils
let a = [1, 2, 3, 4, 5].toDoublyLinkedList
assert a.toSeq == [1, 2, 3, 4, 5]
result = initDoublyLinkedList[T]()
@ -359,7 +359,7 @@ proc prepend*[T: SomeLinkedList](a: var T, b: T) {.since: (1, 5, 1).} =
## * `prependMoved proc <#prependMoved,DoublyLinkedList[T],DoublyLinkedList[T]>`_
## for moving the second list instead of copying
runnableExamples:
import sequtils
import std/sequtils
var a = [4, 5].toSinglyLinkedList
let b = [1, 2, 3].toSinglyLinkedList
a.prepend b
@ -476,7 +476,7 @@ proc prepend*[T](L: var SinglyLinkedList[T], value: T) {.inline.} =
func copy*[T](a: SinglyLinkedList[T]): SinglyLinkedList[T] {.since: (1, 5, 1).} =
## Creates a shallow copy of `a`.
runnableExamples:
import sequtils
import std/sequtils
type Foo = ref object
x: int
var
@ -675,7 +675,7 @@ proc add*[T: SomeLinkedList](a: var T, b: T) {.since: (1, 5, 1).} =
## * `addMoved proc <#addMoved,DoublyLinkedList[T],DoublyLinkedList[T]>`_
## for moving the second list instead of copying
runnableExamples:
import sequtils
import std/sequtils
var a = [1, 2, 3].toSinglyLinkedList
let b = [4, 5].toSinglyLinkedList
a.add b

View file

@ -39,7 +39,7 @@
## `method call syntax<manual.html#procedures-method-call-syntax>`_.
runnableExamples:
import sugar
import std/sugar
# Creating a sequence from 1 to 10, multiplying each member by 2,
# keeping only the members which are not divisible by 6.
@ -62,7 +62,7 @@ runnableExamples:
runnableExamples:
from strutils import join
from std/strutils import join
let
vowels = @"aeiou"

View file

@ -774,7 +774,7 @@ iterator allValues*[A, B](t: Table[A, B]; key: A): B {.deprecated:
## `add proc<#add,Table[A,B],A,sinkB>`_).
##
runnableExamples:
import sequtils, algorithm
import std/[sequtils, algorithm]
var a = {'a': 3, 'b': 5}.toTable
for i in 1..3: a.add('z', 10*i)