dycw-utilities 0.126.9__py3-none-any.whl → 0.126.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.126.9
3
+ Version: 0.126.10
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
7
7
  Requires-Dist: typing-extensions<4.14,>=4.13.1
8
8
  Provides-Extra: test
9
9
  Requires-Dist: dycw-pytest-only<2.2,>=2.1.1; extra == 'test'
10
- Requires-Dist: hypothesis<6.133,>=6.132.0; extra == 'test'
10
+ Requires-Dist: hypothesis<6.134,>=6.133.0; extra == 'test'
11
11
  Requires-Dist: pytest-asyncio<1.1,>=1.0.0; extra == 'test'
12
12
  Requires-Dist: pytest-cov<6.2,>=6.1.1; extra == 'test'
13
13
  Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
@@ -77,7 +77,7 @@ Provides-Extra: zzz-test-hypothesis
77
77
  Requires-Dist: aiosqlite<0.22,>=0.21.0; extra == 'zzz-test-hypothesis'
78
78
  Requires-Dist: asyncpg<0.31,>=0.30.0; extra == 'zzz-test-hypothesis'
79
79
  Requires-Dist: greenlet<3.3,>=3.2.0; extra == 'zzz-test-hypothesis'
80
- Requires-Dist: hypothesis<6.133,>=6.132.0; extra == 'zzz-test-hypothesis'
80
+ Requires-Dist: hypothesis<6.134,>=6.133.0; extra == 'zzz-test-hypothesis'
81
81
  Requires-Dist: luigi<3.7,>=3.6.0; extra == 'zzz-test-hypothesis'
82
82
  Requires-Dist: numpy<2.3,>=2.2.6; extra == 'zzz-test-hypothesis'
83
83
  Requires-Dist: pathvalidate<3.3,>=3.2.3; extra == 'zzz-test-hypothesis'
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=aVKs1kn02xCyHOT2ZG3T7fvbEh9r8Eu-f2_9scWzbPI,60
1
+ utilities/__init__.py,sha256=_LTfJC5B-XkbCDy-opJNk2Pu2qwhA3B84Baq2rX5bbA,61
2
2
  utilities/altair.py,sha256=Gpja-flOo-Db0PIPJLJsgzAlXWoKUjPU1qY-DQ829ek,9156
3
3
  utilities/asyncio.py,sha256=phbGti22VSe9cu-SwM1vP8kyUg8AUDHvvciMvE6JnCg,51842
4
4
  utilities/atomicwrites.py,sha256=geFjn9Pwn-tTrtoGjDDxWli9NqbYfy3gGL6ZBctiqSo,5393
@@ -23,7 +23,7 @@ utilities/getpass.py,sha256=DfN5UgMAtFCqS3dSfFHUfqIMZX2shXvwphOz_6J6f6A,103
23
23
  utilities/git.py,sha256=wpt5dZ5Oi5931pN24_VLZYaQOvmR0OcQuVtgHzFUN1k,2359
24
24
  utilities/hashlib.py,sha256=SVTgtguur0P4elppvzOBbLEjVM3Pea0eWB61yg2ilxo,309
25
25
  utilities/http.py,sha256=WcahTcKYRtZ04WXQoWt5EGCgFPcyHD3EJdlMfxvDt-0,946
26
- utilities/hypothesis.py,sha256=tgUQ3egBETjo_A8xzEmfuYMGYf8o30PtZD8FqBfwsPM,45267
26
+ utilities/hypothesis.py,sha256=snJ35u9-dXKn3Unac4IPW2V4JtRUg5B7SsDBrQHIx9g,44834
27
27
  utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
28
28
  utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
29
29
  utilities/iterables.py,sha256=mDqw2_0MUVp-P8FklgcaVTi2TXduH0MxbhTDzzhSBho,44915
@@ -77,7 +77,7 @@ utilities/string.py,sha256=XmU-s04qIV_tODnKl2pQiwmHaxzgOqRKU-RyzdrfvSE,620
77
77
  utilities/sys.py,sha256=h0Xr7Vj86wNalvwJVP1wj5Y0kD_VWm1vzuXZ_jw94mE,2743
78
78
  utilities/tempfile.py,sha256=VqmZJAhTJ1OaVywFzk5eqROV8iJbW9XQ_QYAV0bpdRo,1384
79
79
  utilities/tenacity.py,sha256=1PUvODiBVgeqIh7G5TRt5WWMSqjLYkEqP53itT97WQc,4914
80
- utilities/text.py,sha256=Fo12N4aA7k2rnb4W4vH9iiDh88Q5_nvRssTkfNsvVM8,10965
80
+ utilities/text.py,sha256=ymBFlP_cA8OgNnZRVNs7FAh7OG8HxE6YkiLEMZv5g_A,11297
81
81
  utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
82
82
  utilities/timer.py,sha256=Rkc49KSpHuC8s7vUxGO9DU55U9I6yDKnchsQqrUCVBs,4075
83
83
  utilities/traceback.py,sha256=p9WATV-e4_5AW6SvyRBiU-MY8XnEFcKgrFNUoFzalXI,27521
@@ -91,7 +91,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
91
91
  utilities/whenever.py,sha256=jS31ZAY5OMxFxLja_Yo5Fidi87Pd-GoVZ7Vi_teqVDA,16743
92
92
  utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
93
93
  utilities/zoneinfo.py,sha256=-5j7IQ9nb7gR43rdgA7ms05im-XuqhAk9EJnQBXxCoQ,1874
94
- dycw_utilities-0.126.9.dist-info/METADATA,sha256=kgxJx1OLQSkOqyenGUbtVzwcPfk8bt0raQsEypd5FsE,12803
95
- dycw_utilities-0.126.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
96
- dycw_utilities-0.126.9.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
97
- dycw_utilities-0.126.9.dist-info/RECORD,,
94
+ dycw_utilities-0.126.10.dist-info/METADATA,sha256=3hajeWxg9om0FI0yM_fkaoFNZFG_j4slCdaV-NRNswU,12804
95
+ dycw_utilities-0.126.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
96
+ dycw_utilities-0.126.10.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
97
+ dycw_utilities-0.126.10.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.126.9"
3
+ __version__ = "0.126.10"
utilities/hypothesis.py CHANGED
@@ -8,12 +8,11 @@ from datetime import timezone
8
8
  from enum import Enum, auto
9
9
  from functools import partial
10
10
  from math import ceil, floor, inf, isclose, isfinite, nan
11
- from os import environ, getpid
11
+ from os import environ
12
12
  from pathlib import Path
13
13
  from re import search
14
14
  from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, printable
15
15
  from subprocess import check_call
16
- from threading import get_ident
17
16
  from typing import (
18
17
  TYPE_CHECKING,
19
18
  Any,
@@ -24,7 +23,6 @@ from typing import (
24
23
  overload,
25
24
  override,
26
25
  )
27
- from uuid import uuid4
28
26
 
29
27
  from hypothesis import HealthCheck, Phase, Verbosity, assume, settings
30
28
  from hypothesis.errors import InvalidArgument
@@ -89,7 +87,6 @@ from utilities.pathlib import temp_cwd
89
87
  from utilities.platform import IS_WINDOWS
90
88
  from utilities.sentinel import Sentinel, sentinel
91
89
  from utilities.tempfile import TEMP_DIR, TemporaryDirectory
92
- from utilities.tzlocal import get_now_local
93
90
  from utilities.version import Version
94
91
  from utilities.zoneinfo import UTC
95
92
 
@@ -1411,20 +1408,6 @@ def uint64s(
1411
1408
  ##
1412
1409
 
1413
1410
 
1414
- @composite
1415
- def unique_strs(draw: DrawFn, /) -> str:
1416
- """Strategy for generating unique strings."""
1417
- now = get_now_local()
1418
- pid = getpid()
1419
- ident = just(get_ident())
1420
- key = str(uuid4()).replace("-", "")
1421
- full = f"{now:%Y%m%d%H%M%S%f}_{pid}_{ident}_{key}"
1422
- return draw(just(full))
1423
-
1424
-
1425
- ##
1426
-
1427
-
1428
1411
  @composite
1429
1412
  def versions(draw: DrawFn, /, *, suffix: MaybeSearchStrategy[bool] = False) -> Version:
1430
1413
  """Strategy for generating versions."""
@@ -1553,7 +1536,6 @@ __all__ = [
1553
1536
  "triples",
1554
1537
  "uint32s",
1555
1538
  "uint64s",
1556
- "unique_strs",
1557
1539
  "versions",
1558
1540
  "zoned_datetimes",
1559
1541
  ]
utilities/text.py CHANGED
@@ -4,9 +4,13 @@ import re
4
4
  from collections import deque
5
5
  from dataclasses import dataclass
6
6
  from itertools import chain
7
+ from os import getpid
7
8
  from re import IGNORECASE, Match, escape, search
8
9
  from textwrap import dedent
10
+ from threading import get_ident
11
+ from time import time_ns
9
12
  from typing import TYPE_CHECKING, Any, Literal, overload, override
13
+ from uuid import uuid4
10
14
 
11
15
  from utilities.iterables import CheckDuplicatesError, check_duplicates, transpose
12
16
  from utilities.reprlib import get_repr
@@ -395,6 +399,18 @@ def strip_and_dedent(text: str, /, *, trailing: bool = False) -> str:
395
399
  return f"{result}\n" if trailing else result
396
400
 
397
401
 
402
+ ##
403
+
404
+
405
+ def unique_str() -> str:
406
+ """Generate at unique string."""
407
+ now = time_ns()
408
+ pid = getpid()
409
+ ident = get_ident()
410
+ key = str(uuid4()).replace("-", "")
411
+ return f"{now}_{pid}_{ident}_{key}"
412
+
413
+
398
414
  __all__ = [
399
415
  "BRACKETS",
400
416
  "DEFAULT_SEPARATOR",
@@ -413,4 +429,5 @@ __all__ = [
413
429
  "split_str",
414
430
  "str_encode",
415
431
  "strip_and_dedent",
432
+ "unique_str",
416
433
  ]