cwcwidth 0.1.10__cp313-cp313-win_amd64.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.
cwcwidth/__init__.py ADDED
@@ -0,0 +1,38 @@
1
+ # Copyright 2021-2025 Sebastian Ramacher <sebastian@ramacher.at>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ """Bindings for wcwidth(3) and wcswidth(3)
22
+
23
+ This module computes the number of cells a unicode string is expected to occupy
24
+ on the screen. On systems conforming to POSIX.1-2001 to POSIX.1-2008, this
25
+ module calls wcwidth(3) and wcswidth(3) provided by C library. On systems where
26
+ these functions are not available, a compatible implementation is included in
27
+ the module.
28
+
29
+ This module provides the same interface as the wcwidth module.
30
+ """
31
+
32
+ from ._impl import wcwidth, wcswidth
33
+
34
+ __version__ = "0.1.10"
35
+ __author__ = "Sebastian Ramacher"
36
+ __license__ = "Expat"
37
+ __copyright__ = f"(C) 2021-2025 {__author__}"
38
+ __all__ = ("wcwidth", "wcswidth")
Binary file
cwcwidth/_impl.pyi ADDED
@@ -0,0 +1,24 @@
1
+ # Copyright 2021-2025 Sebastian Ramacher <sebastian@ramacher.at>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ from typing import Optional
22
+
23
+ def wcwidth(wc: str) -> int: ...
24
+ def wcswidth(pwcs: str, n: Optional[int] = None) -> int: ...
cwcwidth/py.typed ADDED
File without changes
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2021-2025 Sebastian Ramacher
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the ""Software""), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.2
2
+ Name: cwcwidth
3
+ Version: 0.1.10
4
+ Summary: Python bindings for wc(s)width
5
+ Home-page: https://github.com/sebastinas/cwcwidth
6
+ Author: Sebastian Ramacher
7
+ Author-email: sebastian@ramacher.at
8
+ License: MIT
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+
18
+ # Python bindings for wc(s)width
19
+
20
+ `cwcwidth` provides Python bindings for `wcwidth` and `wcswidth` functions defined in POSIX.1-2001
21
+ and POSIX.1-2008 based on [Cython](https://cython.org/). These functions compute the printable
22
+ length of a unicode character/string on a terminal. The module provides the same functions as
23
+ [wcwidth](https://pypi.org/project/wcwidth/) and its behavior is compatible.
24
+
25
+ On systems not conforming to POSIX.1-2001 and POSIX.1-2008, Markus Kuhn's
26
+ [implementation](https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c) is used to provide the
27
+ functionality.
28
+
29
+ ## Dependencies
30
+
31
+ * `Cython >= 0.28` (optional, only for building). If Cython is not available, the C files are not
32
+ regenerated from their source.
33
+
34
+ ## Quick installation guide
35
+
36
+ `cwcwidth` can be installed via `pip`:
37
+ ```sh
38
+ pip install cwcwidth
39
+ ```
40
+ or by running:
41
+ ```sh
42
+ python3 setup.py install
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ```python3
48
+ >>> import cwcwidth
49
+ >>> cwcwidth.wcwidth("a")
50
+ 1
51
+ >>> cwcwidth.wcswidth("コ")
52
+ 2
53
+ >>> cwcwidth.wcswidth("コンニチハ, セカイ!")
54
+ 19
55
+ >>> cwcwidth.wcswidth("コンニチハ, セカイ!", 5)
56
+ 10
57
+ ```
58
+
59
+ ## Comparison with `wcwidth`
60
+
61
+ ```python3
62
+ >>> import wcwidth, cwcwidth, timeit
63
+ >>> timeit.timeit(lambda: wcwidth.wcswidth("コンニチハ, セカイ!"))
64
+ 19.14463168097427
65
+ >>> timeit.timeit(lambda: cwcwidth.wcswidth("コンニチハ, セカイ!"))
66
+ 0.16294104099506512
67
+ ```
68
+
69
+ ## License
70
+
71
+ The code is licensed under the MIT license.
72
+
@@ -0,0 +1,9 @@
1
+ cwcwidth/__init__.py,sha256=jLV4bjZRNzE3MnBdiQKASdA-k3nBh6msHn2Qz1eWoss,1800
2
+ cwcwidth/_impl.cp313-win_amd64.pyd,sha256=VgFAYLrq-5l68hVELkzDeNCbP__CMRK1iRfI6kA6RZ0,42496
3
+ cwcwidth/_impl.pyi,sha256=SaMgLKF0IINiQdslUQ8SuaMRz-ZJT_kshf8PJlyV1Eo,1274
4
+ cwcwidth/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ cwcwidth-0.1.10.dist-info/LICENSE,sha256=rTzCHingLOyK6ee_iFptTXoGXiZ0H4ewFDXvaYDwg0U,1088
6
+ cwcwidth-0.1.10.dist-info/METADATA,sha256=NFxBygzdsxgX_5C60a1YcOVcn9K25IGZDBqCPrSzBs4,2074
7
+ cwcwidth-0.1.10.dist-info/WHEEL,sha256=6bXTkCllrWLYPW3gCPkeRA91N4604g9hqNhQqZWsUzQ,101
8
+ cwcwidth-0.1.10.dist-info/top_level.txt,sha256=CAWRtKz1q0QOhaWlYsca-hr0f0Jf8L-vfBoJd5JLFHA,9
9
+ cwcwidth-0.1.10.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-win_amd64
5
+
@@ -0,0 +1 @@
1
+ cwcwidth