complete std prefixes for stdlib (#22887)

follow up https://github.com/nim-lang/Nim/pull/22851
follow up https://github.com/nim-lang/Nim/pull/22873
This commit is contained in:
ringabout
2023-10-31 00:03:04 +08:00
committed by GitHub
parent 403e0118ae
commit 4d11d0619d
142 changed files with 277 additions and 275 deletions

View File

@@ -30,9 +30,9 @@ const weirdTarget = defined(nimscript) or defined(js)
when weirdTarget:
discard
elif defined(windows):
import winlean
import std/winlean
elif defined(posix):
import posix
import std/posix
else:
{.error: "The cmdline module has not been implemented for the target platform.".}

View File

@@ -1,6 +1,6 @@
## This module implements syntax sugar for some declarations.
import macros
import std/macros
macro byaddr*(sect) =
## Allows a syntax for l-value references, being an exact analog to

View File

@@ -1,6 +1,6 @@
## This module implements directory handling.
from paths import Path, ReadDirEffect, WriteDirEffect
from std/paths import Path, ReadDirEffect, WriteDirEffect
from std/private/osdirs import dirExists, createDir, existsOrCreateDir, removeDir,
moveDir, walkDir, setCurrentDir,

View File

@@ -10,7 +10,7 @@
## This module implements an algorithm to compute the
## `edit distance`:idx: between two Unicode strings.
import unicode
import std/unicode
proc editDistance*(a, b: string): int {.noSideEffect.} =
## Returns the **unicode-rune** edit distance between `a` and `b`.

View File

@@ -14,7 +14,7 @@
## One can test for the existence of this standard module
## via `defined(nimHasEffectTraitsModule)`.
import macros
import std/macros
proc getRaisesListImpl(n: NimNode): NimNode = discard "see compiler/vmops.nim"
proc getTagsListImpl(n: NimNode): NimNode = discard "see compiler/vmops.nim"

View File

@@ -11,7 +11,7 @@
## macro system.
import std/private/since
import macros
import std/macros
macro enumerate*(x: ForLoopStmt): untyped {.since: (1, 3).} =

View File

@@ -7,8 +7,8 @@
# distribution, for details about the copyright.
#
import macros
from typetraits import OrdinalEnum, HoleyEnum
import std/macros
from std/typetraits import OrdinalEnum, HoleyEnum
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -60,7 +60,7 @@ when not defined(nimscript):
when defined(windows):
proc c_putenv(envstring: cstring): cint {.importc: "_putenv", header: "<stdlib.h>".}
from std/private/win_setenv import setEnvImpl
import winlean
import std/winlean
when defined(nimPreviewSlimSystem):
import std/widestrs

View File

@@ -9,7 +9,7 @@
## This module allows adding hooks to program exit.
import locks
import std/locks
when defined(js) and not defined(nodejs):
import std/assertions

View File

@@ -3,7 +3,7 @@
## **See also:**
## * `paths module <paths.html>`_ for path manipulation
from paths import Path, ReadDirEffect, WriteDirEffect
from std/paths import Path, ReadDirEffect, WriteDirEffect
from std/private/osfiles import fileExists, removeFile,
moveFile

View File

@@ -1,6 +1,6 @@
## This module implements AST generation using captured variables for macros.
import macros
import std/macros
type GenAstOpt* = enum
kDirtyTemplate,

View File

@@ -16,7 +16,7 @@ runnableExamples:
assert 0.0.toJson.kind == JFloat
assert Inf.toJson.kind == JString
import json, strutils, tables, sets, strtabs, options, strformat
import std/[json, strutils, tables, sets, strtabs, options, strformat]
#[
Future directions:
@@ -30,9 +30,9 @@ add a way to customize serialization, for e.g.:
objects.
]#
import macros
from enumutils import symbolName
from typetraits import OrdinalEnum, tupleLen
import std/macros
from std/enumutils import symbolName
from std/typetraits import OrdinalEnum, tupleLen
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -36,7 +36,7 @@ See also
* `times module <times.html>`_
]##
import times
import std/times
type
MonoTime* = object ## Represents a monotonic timestamp.
@@ -74,7 +74,7 @@ when defined(js):
{.pop.}
elif defined(posix) and not defined(osx):
import posix
import std/posix
when defined(zephyr):
proc k_uptime_ticks(): int64 {.importc: "k_uptime_ticks", header: "<kernel.h>".}

View File

@@ -15,7 +15,7 @@ type
when not defined(nimscript):
when defined(windows):
import winlean
import std/winlean
when defined(nimPreviewSlimSystem):
import std/widestrs
else:

View File

@@ -9,7 +9,7 @@
## `outParamsAt` macro for easy writing code that works with both 2.0 and 1.x.
import macros
import std/macros
macro outParamsAt*(positions: static openArray[int]; n: untyped): untyped =
## Use this macro to annotate `out` parameters in a portable way.

View File

@@ -17,7 +17,7 @@
## * `sets module <sets.html>`_ for more general hash sets
import std/private/since
import hashes
import std/hashes
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -9,7 +9,7 @@ export osseps
import std/envvars
import std/private/osappdirs
import pathnorm
import std/pathnorm
from std/private/ospaths2 import joinPath, splitPath,
ReadDirEffect, WriteDirEffect,

View File

@@ -4,9 +4,9 @@ this can eventually be moved to std/os and `walkDirRec` can be implemented in te
to avoid duplication
]##
import os
import std/os
when defined(windows):
from strutils import replace
from std/strutils import replace
when defined(nimPreviewSlimSystem):
import std/[assertions, objectdollar]
@@ -65,6 +65,6 @@ proc nativeToUnixPath*(path: string): string =
result = replace(result, '\\', '/')
when isMainModule:
import sugar
import std/sugar
for a in walkDirRecFilter(".", follow = a=>a.path.lastPathPart notin ["nimcache", ".git", "csources_v1", "csources", "bin"]):
echo a

View File

@@ -22,9 +22,9 @@ type
when weirdTarget:
discard
elif defined(windows):
import winlean, times
import std/[winlean, times]
elif defined(posix):
import posix
import std/posix
proc c_rename(oldname, newname: cstring): cint {.
importc: "rename", header: "<stdio.h>".}
else:

View File

@@ -16,9 +16,9 @@ when defined(nimPreviewSlimSystem):
when weirdTarget:
discard
elif defined(windows):
import winlean, times
import std/[winlean, times]
elif defined(posix):
import posix, times
import std/[posix, times]
else:
{.error: "OS module not ported to your operating system!".}

View File

@@ -15,9 +15,9 @@ when defined(nimPreviewSlimSystem):
when weirdTarget:
discard
elif defined(windows):
import winlean
import std/winlean
elif defined(posix):
import posix, times
import std/[posix, times]
proc toTime(ts: Timespec): times.Time {.inline.} =
result = initTime(ts.tv_sec.int64, ts.tv_nsec.int)

View File

@@ -1,7 +1,7 @@
include system/inclrtl
import std/private/since
import strutils, pathnorm
import std/[strutils, pathnorm]
import std/oserrors
import oscommon
@@ -17,9 +17,9 @@ const weirdTarget = defined(nimscript) or defined(js)
when weirdTarget:
discard
elif defined(windows):
import winlean
import std/winlean
elif defined(posix):
import posix, system/ansi_c
import std/posix, system/ansi_c
else:
{.error: "OS module not ported to your operating system!".}

View File

@@ -10,9 +10,9 @@ when defined(nimPreviewSlimSystem):
when weirdTarget:
discard
elif defined(windows):
import winlean, times
import std/[winlean, times]
elif defined(posix):
import posix
import std/posix
else:
{.error: "OS module not ported to your operating system!".}

View File

@@ -10,7 +10,7 @@
## This is an internal helper module. Do not use.
import macros
import std/macros
proc underscoredCalls*(result, calls, arg0: NimNode)

View File

@@ -14,7 +14,7 @@
## * `std/packedsets <packedsets.html>`_
## * `std/sets <sets.html>`_
import typetraits, macros
import std/[typetraits, macros]
#[
type SetElement* = char|byte|bool|int16|uint16|enum|uint8|int8

View File

@@ -29,8 +29,8 @@ runnableExamples("-r:off"):
{.deprecated: "use command `nimble install checksums` and import `checksums/sha1` instead".}
import strutils
from endians import bigEndian32, bigEndian64
import std/strutils
from std/endians import bigEndian32, bigEndian64
when defined(nimPreviewSlimSystem):
import std/syncio

View File

@@ -64,7 +64,7 @@
## sendStream.write "I" # Throws an error as we can't write into an already sent buffer
## ```
import net, streams
import std/[net, streams]
type
ReadSocketStream* = ref ReadSocketStreamObj

View File

@@ -2,7 +2,7 @@
## .. importdoc:: os.nim
from paths import Path, ReadDirEffect
from std/paths import Path, ReadDirEffect
from std/private/ossymlinks import symlinkExists, createSymlink, expandSymlink

View File

@@ -363,7 +363,7 @@ elif someGcc or defined(tcc):
elif defined(icl):
proc cpuRelax* {.importc: "_mm_pause", header: "xmmintrin.h".}
elif false:
from os import sleep
from std/os import sleep
proc cpuRelax* {.inline.} = os.sleep(1)

View File

@@ -60,7 +60,7 @@ when not defined(js):
import std/oserrors
when defined(posix):
import posix
import std/posix
when defined(nimPreviewSlimSystem):
import std/assertions

View File

@@ -29,7 +29,7 @@ const
when defined(windows):
import winlean
import std/winlean
when defined(nimPreviewSlimSystem):
import std/widestrs
@@ -46,7 +46,7 @@ when defined(windows):
proc close_osfandle(fd: cint): cint {.
importc: "_close", header: "<io.h>".}
else:
import posix
import std/posix
proc c_fdopen(
filehandle: cint,

View File

@@ -19,5 +19,5 @@ elif defined(windows):
# newest version of Visual C++ defines time_t to be of 64 bits
type Time* {.importc: "time_t", header: "<time.h>".} = distinct int64
elif defined(posix):
import posix
import std/posix
export posix.Time

View File

@@ -14,7 +14,7 @@
##
## **Since:** version 1.2.
import macros, private / underscored_calls
import std/[macros, private / underscored_calls]
macro with*(arg: typed; calls: varargs[untyped]): untyped =
## This macro provides `chaining`:idx: of function calls.

View File

@@ -9,7 +9,7 @@
## This module contains an algorithm to wordwrap a Unicode string.
import strutils, unicode
import std/[strutils, unicode]
proc olen(s: string; start, lastExclusive: int): int =
var i = start

View File

@@ -13,7 +13,7 @@ consider handling indexing operations, eg:
doAssert ?.default(seq[int])[3] == default(int)
]#
import macros
import std/macros
runnableExamples:
type Foo = ref object
@@ -122,7 +122,7 @@ macro `?.`*(a: typed): auto =
`lhs`
# the code below is not needed for `?.`
from options import Option, isSome, get, option, unsafeGet, UnpackDefect
from std/options import Option, isSome, get, option, unsafeGet, UnpackDefect
macro `??.`*(a: typed): Option =
## Same as `?.` but returns an `Option`.