diff options
author | Danil Yarantsev <tiberiumk12@gmail.com> | 2021-03-01 00:17:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 13:17:19 -0800 |
commit | 56461c280f78c55f538da7f382e1c2c308e04915 (patch) | |
tree | f98e1d9a440725e4bdf3f44a1694aec958299ff6 /lib/pure | |
parent | 26a6ceb34eb2bfca4e39dec2dac2d0a2cdc1bade (diff) | |
download | Nim-56461c280f78c55f538da7f382e1c2c308e04915.tar.gz |
Change stdlib imports to use std prefix in most examples (#17202)
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/asyncfile.nim | 2 | ||||
-rw-r--r-- | lib/pure/asyncftpclient.nim | 6 | ||||
-rw-r--r-- | lib/pure/asynchttpserver.nim | 10 | ||||
-rw-r--r-- | lib/pure/asyncnet.nim | 2 | ||||
-rw-r--r-- | lib/pure/base64.nim | 8 | ||||
-rw-r--r-- | lib/pure/cgi.nim | 2 | ||||
-rw-r--r-- | lib/pure/collections/critbits.nim | 14 | ||||
-rw-r--r-- | lib/pure/collections/deques.nim | 4 | ||||
-rw-r--r-- | lib/pure/collections/lists.nim | 10 | ||||
-rw-r--r-- | lib/pure/collections/sequtils.nim | 4 | ||||
-rw-r--r-- | lib/pure/collections/tables.nim | 2 | ||||
-rw-r--r-- | lib/pure/dynlib.nim | 2 | ||||
-rw-r--r-- | lib/pure/htmlparser.nim | 14 | ||||
-rw-r--r-- | lib/pure/httpclient.nim | 18 | ||||
-rw-r--r-- | lib/pure/json.nim | 14 | ||||
-rw-r--r-- | lib/pure/logging.nim | 6 | ||||
-rw-r--r-- | lib/pure/osproc.nim | 2 | ||||
-rw-r--r-- | lib/pure/parsecfg.nim | 12 | ||||
-rw-r--r-- | lib/pure/parsecsv.nim | 20 | ||||
-rw-r--r-- | lib/pure/parseopt.nim | 4 | ||||
-rw-r--r-- | lib/pure/parseutils.nim | 2 | ||||
-rw-r--r-- | lib/pure/pegs.nim | 2 | ||||
-rw-r--r-- | lib/pure/streams.nim | 10 | ||||
-rw-r--r-- | lib/pure/streamwrapper.nim | 2 | ||||
-rw-r--r-- | lib/pure/strscans.nim | 2 | ||||
-rw-r--r-- | lib/pure/strutils.nim | 2 | ||||
-rw-r--r-- | lib/pure/times.nim | 2 |
27 files changed, 89 insertions, 89 deletions
diff --git a/lib/pure/asyncfile.nim b/lib/pure/asyncfile.nim index 4a0db8f71..c51b338e3 100644 --- a/lib/pure/asyncfile.nim +++ b/lib/pure/asyncfile.nim @@ -10,7 +10,7 @@ ## This module implements asynchronous file reading and writing. ## ## .. code-block:: Nim -## import asyncfile, asyncdispatch, os +## import std/[asyncfile, asyncdispatch, os] ## ## proc main() {.async.} = ## var file = openAsync(getTempDir() / "foobar.txt", fmReadWrite) diff --git a/lib/pure/asyncftpclient.nim b/lib/pure/asyncftpclient.nim index 0c29837fe..0ee45785d 100644 --- a/lib/pure/asyncftpclient.nim +++ b/lib/pure/asyncftpclient.nim @@ -22,7 +22,7 @@ ## connect to an FTP server. You can do so with the `connect` procedure. ## ## .. code-block::nim -## import asyncdispatch, asyncftpclient +## import std/[asyncdispatch, asyncftpclient] ## proc main() {.async.} = ## var ftp = newAsyncFtpClient("example.com", user = "test", pass = "test") ## await ftp.connect() @@ -42,7 +42,7 @@ ## instead specify an absolute path. ## ## .. code-block::nim -## import asyncdispatch, asyncftpclient +## import std/[asyncdispatch, asyncftpclient] ## proc main() {.async.} = ## var ftp = newAsyncFtpClient("example.com", user = "test", pass = "test") ## await ftp.connect() @@ -63,7 +63,7 @@ ## `progressInterval` milliseconds. ## ## .. code-block::nim -## import asyncdispatch, asyncftpclient +## import std/[asyncdispatch, asyncftpclient] ## ## proc onProgressChanged(total, progress: BiggestInt, ## speed: float) {.async.} = diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim index 41c4dec09..f5baf1517 100644 --- a/lib/pure/asynchttpserver.nim +++ b/lib/pure/asynchttpserver.nim @@ -19,7 +19,7 @@ runnableExamples: # respond to all requests with a `200 OK` response code and "Hello World" # as the response body. Run locally with: # `nim doc --doccmd:-d:nimAsyncHttpServerEnableTest --lib:lib lib/pure/asynchttpserver.nim` - import asyncdispatch + import std/asyncdispatch if defined(nimAsyncHttpServerEnableTest): proc main {.async.} = const port = 8080 @@ -78,9 +78,9 @@ func getSocket*(a: AsyncHttpServer): AsyncSocket {.since: (1, 5, 1).} = ## Useful for identifying what port the AsyncHttpServer is bound to, if it ## was chosen automatically. runnableExamples: - from asyncdispatch import Port - from asyncnet import getFd - from nativesockets import getLocalAddr, AF_INET + from std/asyncdispatch import Port + from std/asyncnet import getFd + from std/nativesockets import getLocalAddr, AF_INET let server = newAsyncHttpServer() server.listen(Port(0)) # Socket is not bound until this point let port = getLocalAddr(server.getSocket.getFd, AF_INET)[1] @@ -113,7 +113,7 @@ proc respond*(req: Request, code: HttpCode, content: string, ## Example: ## ## .. code-block::nim - ## import json + ## import std/json ## proc handler(req: Request) {.async.} = ## if req.url.path == "/hello-world": ## let msg = %* {"message": "Hello World"} diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 346e5cbac..7db8ce41e 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -67,7 +67,7 @@ ## ## .. code-block::nim ## -## import asyncnet, asyncdispatch +## import std/[asyncnet, asyncdispatch] ## ## var clients {.threadvar.}: seq[AsyncSocket] ## diff --git a/lib/pure/base64.nim b/lib/pure/base64.nim index a590ac002..bf196b54d 100644 --- a/lib/pure/base64.nim +++ b/lib/pure/base64.nim @@ -24,14 +24,14 @@ ## ------------- ## ## .. code-block::nim -## import base64 +## import std/base64 ## let encoded = encode("Hello World") ## assert encoded == "SGVsbG8gV29ybGQ=" ## ## Apart from strings you can also encode lists of integers or characters: ## ## .. code-block::nim -## import base64 +## import std/base64 ## let encodedInts = encode([1,2,3]) ## assert encodedInts == "AQID" ## let encodedChars = encode(['h','e','y']) @@ -42,7 +42,7 @@ ## ------------- ## ## .. code-block::nim -## import base64 +## import std/base64 ## let decoded = decode("SGVsbG8gV29ybGQ=") ## assert decoded == "Hello World" ## @@ -50,7 +50,7 @@ ## --------------- ## ## .. code-block::nim -## import base64 +## import std/base64 ## doAssert encode("c\xf7>", safe = true) == "Y_c-" ## doAssert encode("c\xf7>", safe = false) == "Y/c+" ## diff --git a/lib/pure/cgi.nim b/lib/pure/cgi.nim index 8cc0284b4..fd5089dbb 100644 --- a/lib/pure/cgi.nim +++ b/lib/pure/cgi.nim @@ -11,7 +11,7 @@ ## ## .. code-block:: Nim ## -## import strtabs, cgi +## import std/[strtabs, cgi] ## ## # Fill the values when debugging: ## when debug: diff --git a/lib/pure/collections/critbits.nim b/lib/pure/collections/critbits.nim index dd2203e13..e12984995 100644 --- a/lib/pure/collections/critbits.nim +++ b/lib/pure/collections/critbits.nim @@ -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)] diff --git a/lib/pure/collections/deques.nim b/lib/pure/collections/deques.nim index 7614b9d20..a75de0dfb 100644 --- a/lib/pure/collections/deques.nim +++ b/lib/pure/collections/deques.nim @@ -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)] diff --git a/lib/pure/collections/lists.nim b/lib/pure/collections/lists.nim index e1c3808b2..edb852999 100644 --- a/lib/pure/collections/lists.nim +++ b/lib/pure/collections/lists.nim @@ -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 diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim index 0872257f4..e937b8394 100644 --- a/lib/pure/collections/sequtils.nim +++ b/lib/pure/collections/sequtils.nim @@ -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" diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 74f658261..e19298239 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -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) diff --git a/lib/pure/dynlib.nim b/lib/pure/dynlib.nim index caf2c1ec3..f7f87dee7 100644 --- a/lib/pure/dynlib.nim +++ b/lib/pure/dynlib.nim @@ -24,7 +24,7 @@ ## ## .. code-block::nim ## -## import dynlib +## import std/dynlib ## ## type ## greetFunction = proc(): cstring {.gcsafe, stdcall.} diff --git a/lib/pure/htmlparser.nim b/lib/pure/htmlparser.nim index 05bfbfe4d..c572146a7 100644 --- a/lib/pure/htmlparser.nim +++ b/lib/pure/htmlparser.nim @@ -32,11 +32,11 @@ ## .. code-block:: Nim ## :test: ## -## import htmlparser -## import xmltree # To use '$' for XmlNode -## import strtabs # To access XmlAttributes -## import os # To use splitFile -## import strutils # To use cmpIgnoreCase +## import std/htmlparser +## import std/xmltree # To use '$' for XmlNode +## import std/strtabs # To access XmlAttributes +## import std/os # To use splitFile +## import std/strutils # To use cmpIgnoreCase ## ## proc transformHyperlinks() = ## let html = loadHtml("input.html") @@ -365,7 +365,7 @@ proc htmlTag*(s: string): HtmlTag = proc runeToEntity*(rune: Rune): string = ## converts a Rune to its numeric HTML entity equivalent. runnableExamples: - import unicode + import std/unicode doAssert runeToEntity(Rune(0)) == "" doAssert runeToEntity(Rune(-1)) == "" doAssert runeToEntity("Ü".runeAt(0)) == "#220" @@ -378,7 +378,7 @@ proc entityToRune*(entity: string): Rune = ## or `Ü` to its UTF-8 equivalent. ## Rune(0) is returned if the entity name is unknown. runnableExamples: - import unicode + import std/unicode doAssert entityToRune("") == Rune(0) doAssert entityToRune("a") == Rune(0) doAssert entityToRune("gt") == ">".runeAt(0) diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index 2b1672414..65e3dbd16 100644 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -17,7 +17,7 @@ ## `http://google.com`: ## ## .. code-block:: Nim -## import httpclient +## import std/httpclient ## var client = newHttpClient() ## echo client.getContent("http://google.com") ## @@ -25,7 +25,7 @@ ## `AsyncHttpClient`: ## ## .. code-block:: Nim -## import asyncdispatch, httpclient +## import std/[asyncdispatch, httpclient] ## ## proc asyncProc(): Future[string] {.async.} = ## var client = newAsyncHttpClient() @@ -74,7 +74,7 @@ ## and uses a json object for the body ## ## .. code-block:: Nim -## import httpclient, json +## import std/[httpclient, json] ## ## let client = newHttpClient() ## client.headers = newHttpHeaders({ "Content-Type": "application/json" }) @@ -92,7 +92,7 @@ ## progress of the HTTP request. ## ## .. code-block:: Nim -## import asyncdispatch, httpclient +## import std/[asyncdispatch, httpclient] ## ## proc onProgressChanged(total, progress, speed: BiggestInt) {.async.} = ## echo("Downloaded ", progress, " of ", total) @@ -149,7 +149,7 @@ ## Here is how to set a timeout when creating an `HttpClient` instance: ## ## .. code-block:: Nim -## import httpclient +## import std/httpclient ## ## let client = newHttpClient(timeout = 42) ## @@ -163,7 +163,7 @@ ## Some examples on how to configure a Proxy for `HttpClient`: ## ## .. code-block:: Nim -## import httpclient +## import std/httpclient ## ## let myProxy = newProxy("http://myproxy.network") ## let client = newHttpClient(proxy = myProxy) @@ -171,7 +171,7 @@ ## Get Proxy URL from environment variables: ## ## .. code-block:: Nim -## import httpclient +## import std/httpclient ## ## var url = "" ## try: @@ -195,7 +195,7 @@ ## Here you can see an example about how to set the `maxRedirects` of `HttpClient`: ## ## .. code-block:: Nim -## import httpclient +## import std/httpclient ## ## let client = newHttpClient(maxRedirects = 0) ## @@ -573,7 +573,7 @@ proc newHttpClient*(userAgent = defUserAgent, maxRedirects = 5, ## ## `headers` specifies the HTTP Headers. runnableExamples: - import asyncdispatch, httpclient, strutils + import std/[asyncdispatch, httpclient, strutils] proc asyncProc(): Future[string] {.async.} = var client = newAsyncHttpClient() diff --git a/lib/pure/json.nim b/lib/pure/json.nim index d610edcbf..6d94de9ac 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -34,7 +34,7 @@ ## the ``[]`` operator. The following example shows how to do this: ## ## .. code-block:: Nim -## import json +## import std/json ## ## let jsonNode = parseJson("""{"key": 3.14}""") ## @@ -55,7 +55,7 @@ ## To retrieve the value of ``"key"`` you can do the following: ## ## .. code-block:: Nim -## import json +## import std/json ## ## let jsonNode = parseJson("""{"key": 3.14}""") ## @@ -72,7 +72,7 @@ ## type's default value when called on ``nil``. ## ## .. code-block:: Nim -## import json +## import std/json ## ## let jsonNode = parseJson("{}") ## @@ -88,7 +88,7 @@ ## you to fallback to a default value should the key's values be ``null``: ## ## .. code-block:: Nim -## import json +## import std/json ## ## let jsonNode = parseJson("""{"key": 3.14, "key2": null}""") ## @@ -106,8 +106,8 @@ ## responses, and backticks around keys with a reserved keyword as name. ## ## .. code-block:: Nim -## import json -## import options +## import std/json +## import std/options ## ## type ## User = object @@ -127,7 +127,7 @@ ## operator: ## ## .. code-block:: nim -## import json +## import std/json ## ## var hisName = "John" ## let herAge = 31 diff --git a/lib/pure/logging.nim b/lib/pure/logging.nim index 06987d395..ee07cd8f3 100644 --- a/lib/pure/logging.nim +++ b/lib/pure/logging.nim @@ -18,7 +18,7 @@ ## To get started, first create a logger: ## ## .. code-block:: -## import logging +## import std/logging ## ## var logger = newConsoleLogger() ## @@ -60,7 +60,7 @@ ## in the following example: ## ## .. code-block:: -## import logging +## import std/logging ## ## var consoleLog = newConsoleLogger() ## var fileLog = newFileLogger("errors.log", levelThreshold=lvlError) @@ -118,7 +118,7 @@ ## The following example illustrates how to use format strings: ## ## .. code-block:: -## import logging +## import std/logging ## ## var logger = newConsoleLogger(fmtStr="[$time] - $levelname: ") ## logger.log(lvlInfo, "this is a message") diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 00dc907e0..a4d8409d7 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -1593,7 +1593,7 @@ proc execCmdEx*(command: string, options: set[ProcessOption] = { ## ## .. code-block:: Nim ## var result = execCmdEx("nim r --hints:off -", options = {}, input = "echo 3*4") - ## import strutils, strtabs + ## import std/[strutils, strtabs] ## stripLineEnd(result[0]) ## portable way to remove trailing newline, if any ## doAssert result == ("12", 0) ## doAssert execCmdEx("ls --nonexistant").exitCode != 0 diff --git a/lib/pure/parsecfg.nim b/lib/pure/parsecfg.nim index df08135f7..23bb09ac4 100644 --- a/lib/pure/parsecfg.nim +++ b/lib/pure/parsecfg.nim @@ -22,7 +22,7 @@ ## ## .. code-block:: nim ## -## import os, parsecfg, strutils, streams +## import std/[os, parsecfg, strutils, streams] ## ## var f = newFileStream(paramStr(1), fmRead) ## if f != nil: @@ -66,7 +66,7 @@ ## ----------------------------- ## .. code-block:: nim ## -## import parsecfg +## import std/parsecfg ## var dict=newConfig() ## dict.setSectionKey("","charset","utf-8") ## dict.setSectionKey("Package","name","hello") @@ -80,7 +80,7 @@ ## ---------------------------- ## .. code-block:: nim ## -## import parsecfg +## import std/parsecfg ## var dict = loadConfig("config.ini") ## var charset = dict.getSectionValue("","charset") ## var threads = dict.getSectionValue("Package","--threads") @@ -94,7 +94,7 @@ ## ------------------------------ ## .. code-block:: nim ## -## import parsecfg +## import std/parsecfg ## var dict = loadConfig("config.ini") ## dict.setSectionKey("Author","name","lhf") ## dict.writeConfig("config.ini") @@ -103,7 +103,7 @@ ## ---------------------------------------------- ## .. code-block:: nim ## -## import parsecfg +## import std/parsecfg ## var dict = loadConfig("config.ini") ## dict.delSectionKey("Author","email") ## dict.writeConfig("config.ini") @@ -115,7 +115,7 @@ # taken from https://docs.python.org/3/library/configparser.html#supported-ini-file-structure runnableExamples: - import streams + import std/streams var dict = loadConfig(newStringStream("""[Simple Values] key=value diff --git a/lib/pure/parsecsv.nim b/lib/pure/parsecsv.nim index 4a7117dc5..1e34f3649 100644 --- a/lib/pure/parsecsv.nim +++ b/lib/pure/parsecsv.nim @@ -14,9 +14,9 @@ ## =========== ## ## .. code-block:: nim -## import parsecsv -## from os import paramStr -## from streams import newFileStream +## import std/parsecsv +## from std/os import paramStr +## from std/streams import newFileStream ## ## var s = newFileStream(paramStr(1), fmRead) ## if s == nil: @@ -34,7 +34,7 @@ ## reference for item access with `rowEntry <#rowEntry,CsvParser,string>`_: ## ## .. code-block:: nim -## import parsecsv +## import std/parsecsv ## ## # Prepare a file ## let content = """One,Two,Three,Four @@ -120,7 +120,7 @@ proc open*(my: var CsvParser, input: Stream, filename: string, ## * `open proc <#open,CsvParser,string,char,char,char>`_ which creates the ## file stream for you runnableExamples: - import streams + import std/streams var strm = newStringStream("One,Two,Three\n1,2,3\n10,20,30") var parser: CsvParser parser.open(strm, "tmp.csv") @@ -142,7 +142,7 @@ proc open*(my: var CsvParser, filename: string, ## Similar to the `other open proc<#open,CsvParser,Stream,string,char,char,char>`_, ## but creates the file stream for you. runnableExamples: - from os import removeFile + from std/os import removeFile writeFile("tmp.csv", "One,Two,Three\n1,2,3\n10,20,300") var parser: CsvParser parser.open("tmp.csv") @@ -203,7 +203,7 @@ proc processedRows*(my: var CsvParser): int = ## But even if `readRow <#readRow,CsvParser,int>`_ arrived at EOF then ## processed rows counter is incremented. runnableExamples: - import streams + import std/streams var strm = newStringStream("One,Two,Three\n1,2,3") var parser: CsvParser @@ -229,7 +229,7 @@ proc readRow*(my: var CsvParser, columns = 0): bool = ## ## Blank lines are skipped. runnableExamples: - import streams + import std/streams var strm = newStringStream("One,Two,Three\n1,2,3\n\n10,20,30") var parser: CsvParser parser.open(strm, "tmp.csv") @@ -296,7 +296,7 @@ proc readHeaderRow*(my: var CsvParser) = ## See also: ## * `rowEntry proc <#rowEntry,CsvParser,string>`_ runnableExamples: - import streams + import std/streams var strm = newStringStream("One,Two,Three\n1,2,3") var parser: CsvParser @@ -325,7 +325,7 @@ proc rowEntry*(my: var CsvParser, entry: string): var string = ## ## If specified `entry` does not exist, raises KeyError. runnableExamples: - import streams + import std/streams var strm = newStringStream("One,Two,Three\n1,2,3\n\n10,20,30") var parser: CsvParser parser.open(strm, "tmp.csv") diff --git a/lib/pure/parseopt.nim b/lib/pure/parseopt.nim index e79e53bd8..9de7402d6 100644 --- a/lib/pure/parseopt.nim +++ b/lib/pure/parseopt.nim @@ -49,7 +49,7 @@ ## Here is an example: ## ## .. code-block:: -## import parseopt +## import std/parseopt ## ## var p = initOptParser("-ab -e:5 --foo --bar=20 file.txt") ## while true: @@ -99,7 +99,7 @@ ## arguments for those two parameters: ## ## .. code-block:: -## import parseopt +## import std/parseopt ## ## proc printToken(kind: CmdLineKind, key: string, val: string) = ## case kind diff --git a/lib/pure/parseutils.nim b/lib/pure/parseutils.nim index 5ceff26a0..64949428f 100644 --- a/lib/pure/parseutils.nim +++ b/lib/pure/parseutils.nim @@ -26,7 +26,7 @@ ## ## .. code-block:: nim ## :test: -## from strutils import Digits, parseInt +## from std/strutils import Digits, parseInt ## ## let ## input1 = "2019 school start" diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim index fd22cb165..06a77af57 100644 --- a/lib/pure/pegs.nim +++ b/lib/pure/pegs.nim @@ -941,7 +941,7 @@ template eventParser*(pegAst, handlers: untyped): (proc(s: string): int) = ## evaluates an arithmetic expression defined by a simple PEG: ## ## .. code-block:: nim - ## import strutils, pegs + ## import std/[strutils, pegs] ## ## let ## pegAst = """ diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 88def695d..eb1c9cc14 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -29,7 +29,7 @@ ## ## .. code-block:: Nim ## -## import streams +## import std/streams ## ## var strm = newStringStream("""The first line ## the second line @@ -54,7 +54,7 @@ ## ## .. code-block:: Nim ## -## import streams +## import std/streams ## ## var strm = newFileStream("somefile.txt", fmWrite) ## var line = "" @@ -74,7 +74,7 @@ ## ## .. code-block:: Nim ## -## import streams +## import std/streams ## ## var strm = newFileStream("somefile.txt", fmRead) ## var line = "" @@ -144,7 +144,7 @@ proc flush*(s: Stream) = ## See also: ## * `close proc <#close,Stream>`_ runnableExamples: - from os import removeFile + from std/os import removeFile var strm = newFileStream("somefile.txt", fmWrite) @@ -1387,7 +1387,7 @@ proc newFileStream*(filename: string, mode: FileMode = fmRead, ## * `openFileStream proc <#openFileStream,string,FileMode,int>`_ creates a ## file stream from the file name and the mode. runnableExamples: - from os import removeFile + from std/os import removeFile var strm = newFileStream("somefile.txt", fmWrite) if not isNil(strm): strm.writeLine("The first line") diff --git a/lib/pure/streamwrapper.nim b/lib/pure/streamwrapper.nim index b457e1be1..7a501760b 100644 --- a/lib/pure/streamwrapper.nim +++ b/lib/pure/streamwrapper.nim @@ -89,7 +89,7 @@ proc newPipeOutStream*[T](s: sink (ref T)): owned PipeOutStream[T] = ## Example: ## ## .. code-block:: Nim - ## import osproc, streamwrapper + ## import std/[osproc, streamwrapper] ## var ## p = startProcess(exePath) ## outStream = p.outputStream().newPipeOutStream() diff --git a/lib/pure/strscans.nim b/lib/pure/strscans.nim index 9c55bf3e3..6bedf2de2 100644 --- a/lib/pure/strscans.nim +++ b/lib/pure/strscans.nim @@ -175,7 +175,7 @@ overloaded to handle both single characters and sets of character. .. code-block:: nim - import streams + import std/streams template atom(input: Stream; idx: int; c: char): bool = ## Used in scanp for the matching of atoms (usually chars). diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index d04c972d4..ba1c78479 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -38,7 +38,7 @@ runnableExamples: ## `method call syntax<manual.html#procedures-method-call-syntax>`_: runnableExamples: - from sequtils import map + from std/sequtils import map let jenny = "867-5309" assert jenny.split('-').map(parseInt) == @[867, 5309] diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 35dda131b..dc55c34ce 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -21,7 +21,7 @@ ======== .. code-block:: nim - import times, os + import std/[times, os] # Simple benchmarking let time = cpuTime() sleep(100) # Replace this with something to be timed |