Skip to content

Commit

Permalink
complete std prefixes for stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout committed Oct 30, 2023
1 parent 403e011 commit 9ca90eb
Show file tree
Hide file tree
Showing 137 changed files with 265 additions and 263 deletions.
2 changes: 1 addition & 1 deletion lib/core/hotcodereloading.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

when defined(hotcodereloading):
import
macros
std/macros

template beforeCodeReload*(body: untyped) =
hcrAddEventHandler(true, proc = body) {.executeOnReload.}
Expand Down
2 changes: 1 addition & 1 deletion lib/deprecated/pure/future.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

{.deprecated: "Use the new 'sugar' module instead".}

import sugar
import std/sugar
export sugar
2 changes: 1 addition & 1 deletion lib/deprecated/pure/ospaths.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

{.deprecated: "use `std/os` instead".}

import os
import std/os
export ReadEnvEffect, WriteEnvEffect, ReadDirEffect, WriteDirEffect, OSErrorCode,
doslikeFileSystem, CurDir, ParDir, DirSep, AltSep, PathSep, FileSystemCaseSensitive,
ExeExt, ScriptExt, DynlibFormat, ExtSep, joinPath, `/`, splitPath, parentDir,
Expand Down
6 changes: 3 additions & 3 deletions lib/deprecated/pure/oswalkdir.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# distribution, for details about the copyright.
#

## This module is deprecated, `import os` instead.
{.deprecated: "import os.nim instead".}
import os
## This module is deprecated, `import std/os` instead.
{.deprecated: "import 'std/os' instead".}
import std/os
export PathComponent, walkDir, walkDirRec
2 changes: 1 addition & 1 deletion lib/experimental/diff.nim
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jkl"""
# "An O(ND) Difference Algorithm and its Variations" by Eugene Myers
# Algorithmica Vol. 1 No. 2, 1986, p 251.

import tables, strutils
import std/[tables, strutils]

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
10 changes: 5 additions & 5 deletions lib/impure/nre.nim
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ runnableExamples:
assert find("uxabc", re"(?<=x|y)ab", start = 1).get.captures[-1] == "ab"
assert find("uxabc", re"ab", start = 3).isNone

from pcre import nil
from std/pcre import nil
import nre/private/util
import tables
from strutils import `%`
import options
from unicode import runeLenAt
import std/tables
from std/strutils import `%`
import std/options
from std/unicode import runeLenAt

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
2 changes: 1 addition & 1 deletion lib/impure/nre/private/util.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## INTERNAL FILE FOR USE ONLY BY nre.nim.
import tables
import std/tables

const Ident = {'a'..'z', 'A'..'Z', '0'..'9', '_', '\128'..'\255'}
const StartIdent = Ident - {'0'..'9'}
Expand Down
2 changes: 1 addition & 1 deletion lib/impure/rdstdin.nim
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ elif defined(genode):
stdin.readLine(line)

else:
import linenoise
import std/linenoise

proc readLineFromStdin*(prompt: string, line: var string): bool {.
tags: [ReadIOEffect, WriteIOEffect].} =
Expand Down
2 changes: 1 addition & 1 deletion lib/impure/re.nim
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ runnableExamples:
# can't match start of string since we're starting at 1

import
pcre, strutils, rtarrays
std/[pcre, strutils, rtarrays]

when defined(nimPreviewSlimSystem):
import std/syncio
Expand Down
2 changes: 1 addition & 1 deletion lib/nimhcr.nim
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ when defined(createNimHcr):
when system.appType != "lib":
{.error: "This file has to be compiled as a library!".}

import os, tables, sets, times, strutils, reservedmem, dynlib
import std/[os, tables, sets, times, strutils, reservedmem, dynlib]

template trace(args: varargs[untyped]) =
when defined(testNimHcr) or defined(traceHcr):
Expand Down
4 changes: 2 additions & 2 deletions lib/nimrtl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ when not defined(createNimRtl):
{.error: "This file has to be compiled with '-d:createNimRtl'".}

import
parseutils, strutils, parseopt, parsecfg, strtabs, unicode, pegs, ropes,
os, osproc, times, cstrutils
std/[parseutils, strutils, parseopt, parsecfg, strtabs, unicode, pegs, ropes,
os, osproc, times, cstrutils]
3 changes: 2 additions & 1 deletion lib/packages/docutils/dochelpers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
## `type LangSymbol`_ in ``rst.nim``, while `match(generated, docLink)`_
## matches it with `generated`, produced from `PNode` by ``docgen.rst``.

import rstast, strutils
import rstast
import std/strutils

when defined(nimPreviewSlimSystem):
import std/[assertions, syncio]
Expand Down
4 changes: 2 additions & 2 deletions lib/packages/docutils/highlite.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
## as program output.

import
strutils
from algorithm import binarySearch
std/strutils
from std/algorithm import binarySearch

when defined(nimPreviewSlimSystem):
import std/[assertions, syncio]
Expand Down
6 changes: 4 additions & 2 deletions lib/packages/docutils/rst.nim
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
## turned on by passing ``options:`` [RstParseOptions] to [proc rstParse].

import
os, strutils, rstast, dochelpers, std/enumutils, algorithm, lists, sequtils,
std/private/miscdollars, tables, strscans, rstidx
std/[os, strutils, enumutils, algorithm, lists, sequtils,
tables, strscans]
import dochelpers, rstidx, rstast
import std/private/miscdollars
from highlite import SourceLanguage, getSourceLanguage

when defined(nimPreviewSlimSystem):
Expand Down
2 changes: 1 addition & 1 deletion lib/packages/docutils/rstast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## This module implements an AST for the `reStructuredText`:idx: parser.

import strutils, json
import std/[strutils, json]

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
6 changes: 3 additions & 3 deletions lib/packages/docutils/rstgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
## No backreferences are generated since finding all references of a footnote
## can be done by simply searching for ``[footnoteName]``.

import strutils, os, hashes, strtabs, rstast, rst, rstidx,
highlite, tables, sequtils,
algorithm, parseutils, std/strbasics
import std/[strutils, os, hashes, strtabs, tables, sequtils,
algorithm, parseutils, strbasics]

import rstast, rst, rstidx, highlite

when defined(nimPreviewSlimSystem):
import std/[assertions, syncio, formatfloat]
Expand Down
4 changes: 2 additions & 2 deletions lib/packages/docutils/rstidx.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

## Nim `idx`:idx: file format related definitions.

import strutils, std/syncio, hashes
from os import splitFile
import std/[strutils, syncio, hashes]
from std/os import splitFile

type
IndexEntryKind* = enum ## discriminator tag
Expand Down
2 changes: 1 addition & 1 deletion lib/posix/epoll.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# distribution, for details about the copyright.
#

from posix import SocketHandle
from std/posix import SocketHandle

const
EPOLLIN* = 0x00000001
Expand Down
2 changes: 1 addition & 1 deletion lib/posix/kqueue.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# distribution, for details about the copyright.
#

from posix import Timespec
from std/posix import Timespec

when defined(macosx) or defined(freebsd) or defined(openbsd) or
defined(dragonfly):
Expand Down
2 changes: 1 addition & 1 deletion lib/posix/linux.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import posix
import std/posix

## Flags of `clone` syscall.
## See `clone syscall manual
Expand Down
2 changes: 1 addition & 1 deletion lib/posix/posix_utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Where possible, contribute OS-independent procs in `os <os.html>`_ instead.

import posix, parsecfg, os
import std/[posix, parsecfg, os]
import std/private/since

when defined(nimPreviewSlimSystem):
Expand Down
2 changes: 1 addition & 1 deletion lib/posix/termios.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# distribution, for details about the copyright.
#

import posix
import std/posix

type
Speed* = cuint
Expand Down
4 changes: 2 additions & 2 deletions lib/pure/async.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
## and [asyncjs](asyncjs.html) on the JS backend.

when defined(js):
import asyncjs
import std/asyncjs
export asyncjs
else:
import asyncmacro, asyncfutures
import std/[asyncmacro, asyncfutures]
export asyncmacro, asyncfutures
20 changes: 10 additions & 10 deletions lib/pure/asyncdispatch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@
## ``none`` can be used when a library supports both a synchronous and
## asynchronous API, to disable the latter.

import os, tables, strutils, times, heapqueue, options, asyncstreams
import options, math, std/monotimes
import asyncfutures except callSoon
import std/[os, tables, strutils, times, heapqueue, options, asyncstreams]
import std/[math, monotimes]
import std/asyncfutures except callSoon

import nativesockets, net, deques
import std/[nativesockets, net, deques]

when defined(nimPreviewSlimSystem):
import std/[assertions, syncio]
Expand Down Expand Up @@ -302,7 +302,7 @@ template implementSetInheritable() {.dirty.} =
fd.FileHandle.setInheritable(inheritable)

when defined(windows) or defined(nimdoc):
import winlean, sets, hashes
import std/[winlean, sets, hashes]
type
CompletionKey = ULONG_PTR

Expand Down Expand Up @@ -1166,11 +1166,11 @@ when defined(windows) or defined(nimdoc):

initAll()
else:
import selectors
from posix import EINTR, EAGAIN, EINPROGRESS, EWOULDBLOCK, MSG_PEEK,
import std/selectors
from std/posix import EINTR, EAGAIN, EINPROGRESS, EWOULDBLOCK, MSG_PEEK,
MSG_NOSIGNAL
when declared(posix.accept4):
from posix import accept4, SOCK_CLOEXEC
from std/posix import accept4, SOCK_CLOEXEC
when defined(genode):
import genode/env # get the implicit Genode env
import genode/signals
Expand Down Expand Up @@ -1994,7 +1994,7 @@ proc send*(socket: AsyncFD, data: string,
return retFuture

# -- Await Macro
import asyncmacro
import std/asyncmacro
export asyncmacro

proc readAll*(future: FutureStream[string]): owned(Future[string]) {.async.} =
Expand Down Expand Up @@ -2032,7 +2032,7 @@ proc activeDescriptors*(): int {.inline.} =
result = getGlobalDispatcher().selector.count

when defined(posix):
import posix
import std/posix

when defined(linux) or defined(windows) or defined(macosx) or defined(bsd) or
defined(solaris) or defined(zephyr) or defined(freertos) or defined(nuttx) or defined(haiku):
Expand Down
6 changes: 3 additions & 3 deletions lib/pure/asyncfile.nim
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
## waitFor main()
## ```

import asyncdispatch, os
import std/[asyncdispatch, os]

when defined(nimPreviewSlimSystem):
import std/[assertions, syncio]
Expand All @@ -33,9 +33,9 @@ when defined(nimPreviewSlimSystem):
# TODO: Fix duplication introduced by PR #4683.

when defined(windows) or defined(nimdoc):
import winlean
import std/winlean
else:
import posix
import std/posix

type
AsyncFile* = ref object
Expand Down
4 changes: 2 additions & 2 deletions lib/pure/asyncfutures.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# distribution, for details about the copyright.
#

import os, tables, strutils, times, heapqueue, options, deques, cstrutils
import std/[os, tables, strutils, times, heapqueue, options, deques, cstrutils]

import system/stacktraces

Expand Down Expand Up @@ -51,7 +51,7 @@ const
NimAsyncContinueSuffix* = "NimAsyncContinue" ## For internal usage. Do not use.

when isFutureLoggingEnabled:
import hashes
import std/hashes
type
FutureInfo* = object
stackTrace*: seq[StackTraceEntry]
Expand Down
6 changes: 3 additions & 3 deletions lib/pure/asynchttpserver.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ runnableExamples("-r:off"):

waitFor main()

import asyncnet, asyncdispatch, parseutils, uri, strutils
import httpcore
from nativesockets import getLocalAddr, Domain, AF_INET, AF_INET6
import std/[asyncnet, asyncdispatch, parseutils, uri, strutils]
import std/httpcore
from std/nativesockets import getLocalAddr, Domain, AF_INET, AF_INET6
import std/private/since

when defined(nimPreviewSlimSystem):
Expand Down
2 changes: 1 addition & 1 deletion lib/pure/asyncmacro.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Implements the `async` and `multisync` macros for `asyncdispatch`.

import macros, strutils, asyncfutures
import std/[macros, strutils, asyncfutures]

type
Context = ref object
Expand Down
4 changes: 2 additions & 2 deletions lib/pure/asyncnet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ import std/private/since
when defined(nimPreviewSlimSystem):
import std/[assertions, syncio]

import asyncdispatch, nativesockets, net, os
import std/[asyncdispatch, nativesockets, net, os]

export SOBool

Expand All @@ -110,7 +110,7 @@ const useNimNetLite = defined(nimNetLite) or defined(freertos) or defined(zephyr
defined(nuttx)

when defineSsl:
import openssl
import std/openssl

type
# TODO: I would prefer to just do:
Expand Down
4 changes: 2 additions & 2 deletions lib/pure/asyncstreams.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

## Unstable API.

import asyncfutures
import std/asyncfutures

when defined(nimPreviewSlimSystem):
import std/assertions

import deques
import std/deques

type
FutureStream*[T] = ref object ## Special future that acts as
Expand Down
2 changes: 1 addition & 1 deletion lib/pure/bitops.nim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
## At this time only `fastLog2`, `firstSetBit`, `countLeadingZeroBits` and `countTrailingZeroBits`
## may return undefined and/or platform dependent values if given invalid input.

import macros
import std/macros
import std/private/since
from std/private/bitops_utils import forwardImpl, castToUnsigned

Expand Down
Loading

0 comments on commit 9ca90eb

Please sign in to comment.