Commit Graph

363 Commits

Author SHA1 Message Date
narimiran
28708e0b8e [bugfix] fix #11588, don't check if SharedTable is initialized
(cherry picked from commit 326e3ad09d)
2019-06-27 20:59:46 +02:00
Charles Blake
464142683f [bugfix] fix #11430, strutils rfind (#11487) 2019-06-16 17:44:06 +02:00
Kaushal Modi
2334680b3d Use TMPDIR env var if available to get the temp dir name (#11443) [bugfix]
Additionally, use normalizePathEnd to suffix the dir name with "/" or
"\" as appropriate for the current OS.

Fixes https://github.com/nim-lang/Nim/issues/11439.
2019-06-10 19:59:51 +02:00
Arne Döring
cfeb9d2c50 Bit operator names 2 (#11413)
* add bit operator names

* add test for bitop alias
2019-06-06 08:36:20 +02:00
Andreas Rumpf
5eb47f8ed9 fixes #11369 (#11381) 2019-06-02 14:24:38 +02:00
jcosborn
433ce7bea2 move test for #7632 above import strformat (#11270) 2019-05-20 10:17:56 +02:00
Miran
8f198db2ca fixes #10952, UNC paths (#11260) 2019-05-16 21:06:04 +02:00
Andreas Rumpf
e26545797e fixes #7816 (#11261) 2019-05-15 21:12:07 +02:00
Matt Haggard
8180d443b9 Allow for locale-based parsing/formatting of dates (#11170)
* Allow for locale-based parsing/formatting of dates

* Updates based on review feedback of PR 11170

DateTimeLocale arrays are now indexed by Month and WeekDay enums.
More sane date used for testing.
Documentation newline.
Case change of DefaultLocale (and make it public)

* Add changelog entry for DateTimeLocale addition to times module

* Use pattern symbols for DateTimeLocale attribute names
2019-05-08 13:48:04 +02:00
Araq
a517a9985b fixes another regression; the behaviour of 'array' formatting was changed 2019-04-15 08:20:28 +02:00
Araq
59ccaa43c7 fixes #11012 2019-04-15 08:20:28 +02:00
Miran
1494d88fa2 rst: parse brackets individually, fixes #10475 (#10997) 2019-04-10 15:55:57 +02:00
Arne Döring
3a5a0f6d46 Strformat symbol binding (#10927) 2019-04-05 15:27:04 +02:00
Andreas Rumpf
f8e720fda9 fixes json.nim regression 2019-03-29 08:01:59 +01:00
Tomohiro
cd3a58d7b0 bitops: add reverseBits and test (#10835) 2019-03-13 15:53:40 +01:00
Arne Döring
1102b8ac6e StringStream and parseJson, parseCfg, parseSql et al for the vm (#10746) 2019-02-28 22:57:57 +01:00
Federico Ceratto
28a83a8388 Handle IPv6 in bindAddr #7633
Add test
2019-02-23 13:06:26 +00:00
Oscar Nihlgård
1a771a8248 Replace the duration conversion procs with new improved ones (#10710) 2019-02-19 19:12:44 +01:00
Arne Döring
28394153ab 32 bit fixes (#10608) 2019-02-13 23:30:14 +01:00
Oscar Nihlgård
bfb2ad5078 New implementation of times.between (#10523)
* Refactor ttimes

* New implementation of times.between

* Deprecate times.toTimeInterval
2019-02-06 20:13:29 +01:00
Arne Döring
824f39b32e Vm bitops fixes (#10520) 2019-02-05 09:31:37 +01:00
narimiran
f0be575ed1 move tests from tospaths to tos, fixes #9671
Also, change some of `echo`s to `doAssert`.
2019-01-23 22:04:00 +01:00
Ico Doornekamp
0d480bfe22 Added basic bit manipulation procs to bitops (#10338) 2019-01-23 09:16:14 +01:00
Federico Ceratto
095eaacf21 Fix spelling errors (#10379) 2019-01-19 16:01:27 +01:00
Timothee Cour
b8454327c5 json: support tuple (#10010) 2019-01-16 10:16:14 +01:00
Arne Döring
b78af990b8 Fixes #10065 (#10260)
CountTable now returns 0 instead of 'key not found' for get requests.
2019-01-14 17:16:17 +01:00
Araq
d69a7842fa fixes #7878 2019-01-14 12:36:34 +01:00
Araq
796432ff94 make tests more robust; tests should be deterministic, no randomize() calls in tests 2019-01-13 13:54:44 +01:00
Timothee Cour
9af85fb69f fixes #10273 execShellCmd now returns nonzero when child killed with signal + other fixes (#10274)
* s/exitStatus(...)/exitStatusLikeShell(...)/
* fix #10273 execShellCmd now returns nonzero when child exits with signal
* test case for #10249 and explanation for the bug
* fix test failure
* add tests/nim.cfg
2019-01-13 09:00:39 +01:00
alaviss
6737634d88 os.execShellCmd: fixes #10231 (#10232)
Darwin has long deprecated the wait union, but their macros still assume
it unless you define _POSIX_C_SOURCE. This trips up C++ compilers.

This commit duplicates the behavior of WEXITSTATUS when _POSIX_C_SOURCE
is defined.
2019-01-08 12:41:15 +01:00
Federico Ceratto
2fa35126b0 Fix getAddrInfo, add IPPROTO_ICMPV6 Closes #10198 2019-01-06 20:23:44 +00:00
c-blake
7ac1fc81fd Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ? (#10084)
* Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ?
CDF is a standard ident in all things related to random numbers/sampling,
and full words "cumulativeDistributionFunction" would be silly long, in
this case, IMO.  We use lowercase `cdf` to make it not look like a type,
remove all looping from `sample` letting callers do it.  Besides just
side-stepping any `sampleSize` name choice, callers may want to filter
out samples anyway which this makes slightly simpler.

Also add two variants of `cumsum`, value return and in-place update
distinguished by the var-ness of the first argument.  Add tests for
`int` and `float` for both `cumsum` and the new `sample`.  (The sample
tests exercise the value return mode of `cumsum`.)

Functionality pre-this-PR `sample(a, w)` is now the almost as simple
`for i in 0..<n: sample(a, w.cumsum)`, but this new code factoring is
almost surely better.  The statistical tests pass, as before.

* Address Araq comment in https://github.com/nim-lang/Nim/pull/10084
We can always add in some `var` version later if desired to save
memory, but this change now at least firms up the `sample` interface.

* Rename `cumsum` -> `cumsummed` to honor NEP1 style.  Re-instate `cumsum` as
the in-place transformation.  Test both in `tests/stdlib/tmath.nim` and use
`cumsummed` in the example code for sample since that's a simpler example.

* Fix requests from https://github.com/nim-lang/Nim/pull/10084 :
  example in lib/pure/math.nim and comment whitespace in lib/pure/random.nim
2018-12-31 14:52:51 +01:00
c-blake
e1d5356ae9 Add ability to sample elements from openArray according to a weight array (#10072)
* Add the ability to sample elements from an openArray according to a parallel
array of weights/unnormalized probabilities (any sort of histogram, basically).
Also add a non-thread safe version for convenience.

* Address Araq comments on https://github.com/nim-lang/Nim/pull/10072

* import at top of file and space after '#'.

* Put in a check for non-zero total weight.

* Clarify constraint on `w`.

* Rename `rand(openArray[T])` to `sample(openArray[T])` to `sample`, deprecating
old name and name new (openArray[T], openArray[U]) variants `sample`.

* Rename caller-provided state version of rand(openArray[T]) and also clean
up doc comments.

* Add test for new non-uniform array sampler.  3 sd bound makes it 99% likely
that it will still pass in the future if the random number generator changes.
We cannot both have a tight bound to check distribution *and* loose check to
ensure resilience to RNG changes.  (We cannot *guarantee* resilience, anyway.
There's always a small chance any test hits a legitimate random fluctuation.)
2018-12-23 12:23:20 +00:00
Oscar Nihlgård
2539363851 Don't use parseutils.parseInt in the times module (#10028) 2018-12-22 10:41:54 +01:00
alaviss
b6257f3f21 os.walkDir: correctly evaluate paths when relative = true (#10057) [backport] 2018-12-21 14:12:48 +01:00
Timothee Cour
fc7df3283c fix test failure 2018-12-19 16:11:23 -08:00
Timothee Cour
656770402c fix #8255 numerous issues with splitFile 2018-12-19 16:11:23 -08:00
Timothee Cour
25d3539da7 [os] fix #10017 regression, fix #10025 regression (#10018)
* [os] fix #10017 regression
* [os] fix #10025 regression
2018-12-18 12:43:25 +01:00
Araq
ce9815bcf5 os.nim: use the new pathnorm.normalizePath implementation 2018-12-14 08:57:55 +01:00
Araq
5b39c7aca9 fixes joinPath regressions 2018-12-13 16:19:00 +01:00
Araq
9cc4a57768 os.nim: big refactoring, use the new pathnorm that was extracted by compiler/pathutils.nim; added os.relativePath 2018-12-13 12:05:50 +01:00
Flaviu Tamas
c0a47f7e22 Rework nil/option for nre in light of ""==nil
Fixes #9243
2018-12-11 22:15:57 +00:00
Flaviu Tamas
22b3e9df27 Revert 7f49364fd0 for nre 2018-12-11 22:15:02 +00:00
Andreas Rumpf
239846a528 Merge pull request #9805 from pacien/181126-list-append
add SinglyLinkedList.append procs
2018-12-11 22:18:40 +01:00
Andreas Rumpf
ac785b0623 testament: joinable is now an explicit concept of a test spec 2018-12-11 21:23:24 +01:00
Arne Döring
a5ecbf823f lots of small changes 2018-12-11 21:23:22 +01:00
Arne Döring
3859878db8 megatest checks output and nimout 2018-12-11 21:23:22 +01:00
Arne Döring
2a4c09ff88 megatest can be executed 2018-12-11 21:23:21 +01:00
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
Andreas Rumpf
160a034643 Merge pull request #9803 from GULPF/walkdirrec-relative
Add `relative` parameter to walkDirRec
2018-12-06 09:29:35 +01:00