ocdiff 0.0.5__cp39-none-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.
- ocdiff/__init__.py +6 -0
- ocdiff/__init__.pyi +7 -0
- ocdiff/helpers.py +50 -0
- ocdiff/ocdiff.cp39-win_amd64.pyd +0 -0
- ocdiff-0.0.5.dist-info/METADATA +48 -0
- ocdiff-0.0.5.dist-info/RECORD +8 -0
- ocdiff-0.0.5.dist-info/WHEEL +4 -0
- ocdiff-0.0.5.dist-info/license_files/LICENSE +21 -0
ocdiff/__init__.py
ADDED
ocdiff/__init__.pyi
ADDED
ocdiff/helpers.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# From https://github.com/jeffkaufman/icdiff
|
|
6
|
+
def get_number_of_cols() -> int:
|
|
7
|
+
if os.name == "nt":
|
|
8
|
+
try:
|
|
9
|
+
import struct
|
|
10
|
+
from ctypes import windll, create_string_buffer # type: ignore[attr-defined]
|
|
11
|
+
|
|
12
|
+
fh = windll.kernel32.GetStdHandle(-12) # stderr is -12
|
|
13
|
+
csbi = create_string_buffer(22)
|
|
14
|
+
windll.kernel32.GetConsoleScreenBufferInfo(fh, csbi)
|
|
15
|
+
res = struct.unpack("hhhhHhhhhhh", csbi.raw)
|
|
16
|
+
# right - left + 1
|
|
17
|
+
return res[7] - res[5] + 1 # type: ignore[no-any-return]
|
|
18
|
+
|
|
19
|
+
except Exception:
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
else:
|
|
23
|
+
|
|
24
|
+
def ioctl_GWINSZ(fd: Any) -> tuple[Any, ...] | None:
|
|
25
|
+
try:
|
|
26
|
+
import fcntl
|
|
27
|
+
import termios
|
|
28
|
+
import struct
|
|
29
|
+
|
|
30
|
+
cr = struct.unpack(
|
|
31
|
+
"hh", fcntl.ioctl(fd, termios.TIOCGWINSZ, "1234") # type: ignore[call-overload]
|
|
32
|
+
)
|
|
33
|
+
except Exception:
|
|
34
|
+
return None
|
|
35
|
+
return cr
|
|
36
|
+
|
|
37
|
+
cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
|
|
38
|
+
if cr and cr[1] > 0:
|
|
39
|
+
return cr[1] # type: ignore[no-any-return]
|
|
40
|
+
|
|
41
|
+
return 80
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Other version...
|
|
45
|
+
# From: https://gist.github.com/jtriley/1108174
|
|
46
|
+
def get_terminal_width() -> int:
|
|
47
|
+
fd = os.open(os.ctermid(), os.O_RDONLY)
|
|
48
|
+
cr = struct.unpack("hh", fcntl.ioctl(fd, termios.TIOCGWINSZ, "1234")) # type: ignore
|
|
49
|
+
os.close(fd)
|
|
50
|
+
return int(cr[1])
|
|
Binary file
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: ocdiff
|
|
3
|
+
Version: 0.0.5
|
|
4
|
+
Classifier: Programming Language :: Python
|
|
5
|
+
Requires-Dist: maturin ==1.4.0 ; extra == 'dev'
|
|
6
|
+
Requires-Dist: pytest ==7.* ; extra == 'dev'
|
|
7
|
+
Requires-Dist: mypy ==1.6.* ; extra == 'dev'
|
|
8
|
+
Requires-Dist: pip ==24.0 ; extra == 'dev'
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Summary: difftastic Python wrapper
|
|
12
|
+
Keywords: diff
|
|
13
|
+
Author: Oliver Russell <ojhrussell@gmail.com>
|
|
14
|
+
Author-email: Oliver Russell <ojhrussell@gmail.com>
|
|
15
|
+
Maintainer-email: Oliver Russell <ojhrussell@gmail.com>
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
18
|
+
Project-URL: homepage, https://github.com/leontrolski/ocdiff
|
|
19
|
+
Project-URL: documentation, https://github.com/leontrolski/ocdiff
|
|
20
|
+
Project-URL: repository, https://github.com/leontrolski/ocdiff.git
|
|
21
|
+
|
|
22
|
+
# ocdiff
|
|
23
|
+
|
|
24
|
+
Fast diff library for Python - wraps [similar](https://crates.io/crates/similar).
|
|
25
|
+
|
|
26
|
+
# Install/Develop
|
|
27
|
+
|
|
28
|
+
```shell
|
|
29
|
+
uv pip install -e '.[dev]'
|
|
30
|
+
maturin develop
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
# Make release
|
|
34
|
+
|
|
35
|
+
- Add pypi token and user = `__token__` to settings (do this once).
|
|
36
|
+
- Upversion `pyproject.toml`.
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
git tag -a v0.0.x head -m v0.0.x
|
|
40
|
+
git push origin v0.0.x
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
# TODO
|
|
44
|
+
|
|
45
|
+
- Implement `column_limit` - should just be a function of `Vec<LinePartsDiff>` to `Vec<LinePartsDiff>`.
|
|
46
|
+
- Add console output with colours.
|
|
47
|
+
- Add pytest plugin magic that plays with `rich`.
|
|
48
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ocdiff-0.0.5.dist-info/METADATA,sha256=bBtr-wF3betWUmTPxWhtCcZUnvb6sO-h3bSf2uOAqfs,1385
|
|
2
|
+
ocdiff-0.0.5.dist-info/WHEEL,sha256=7Ui73pGgidyUA-5snShG0g3e0MxNIiYlCeND1YtcadQ,94
|
|
3
|
+
ocdiff-0.0.5.dist-info/license_files/LICENSE,sha256=5zQQFZP-viLN7FN6dhX3bqajrOGrZxMuEQl0wdfEeAw,1092
|
|
4
|
+
ocdiff/helpers.py,sha256=SoRWC12gjHqVCXL0FxCybk4Ph8TSDKB2Dfxor1D-tCo,1555
|
|
5
|
+
ocdiff/__init__.py,sha256=K3jbXDg-yhVzxLZEbphhYkDIcPs3pFC9f4X8i5pF3KE,145
|
|
6
|
+
ocdiff/__init__.pyi,sha256=fCw-DAW1co5GytvuhWOc3y6a3LQMOgzkc-cEMIraPUk,159
|
|
7
|
+
ocdiff/ocdiff.cp39-win_amd64.pyd,sha256=vcL7ByVHulmBYhCepowImc2t74XVSLIRsJ0eBanFKdM,349696
|
|
8
|
+
ocdiff-0.0.5.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Oliver Russell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|