-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[i3] Record our adjustments to the type stub files
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
diff -ruN typings/i3ipc/aio/__init__.pyi typings.patched/i3ipc/aio/__init__.pyi | ||
--- typings/i3ipc/aio/__init__.pyi 2022-11-30 21:30:26.454203922 +0200 | ||
+++ typings.patched/i3ipc/aio/__init__.pyi 2022-11-30 21:30:25.458199758 +0200 | ||
@@ -3,3 +3,5 @@ | ||
""" | ||
|
||
from .connection import Con, Connection | ||
+ | ||
+__all__ = ["Con", "Connection"] | ||
diff -ruN typings/i3ipc/con.pyi typings.patched/i3ipc/con.pyi | ||
--- typings/i3ipc/con.pyi 2022-11-30 21:30:26.474204005 +0200 | ||
+++ typings.patched/i3ipc/con.pyi 2022-11-30 21:30:25.458199758 +0200 | ||
@@ -86,6 +86,11 @@ | ||
:vartype ipc_data: dict | ||
""" | ||
|
||
+ name: str | ||
+ nodes: List[Con] | ||
+ type: str | ||
+ window_class: str | ||
+ | ||
def __init__(self, data, parent, conn) -> None: ... | ||
def __iter__(self): # -> Generator[Unknown, None, None]: | ||
"""Iterate through the descendents of this node (breadth-first tree traversal)""" | ||
diff -ruN typings/i3ipc/events.pyi typings.patched/i3ipc/events.pyi | ||
--- typings/i3ipc/events.pyi 2022-11-30 21:30:26.478204021 +0200 | ||
+++ typings.patched/i3ipc/events.pyi 2022-11-30 21:30:25.458199758 +0200 | ||
@@ -4,6 +4,7 @@ | ||
|
||
from enum import Enum | ||
|
||
+from .con import Con | ||
from .replies import BarConfigReply | ||
|
||
class IpcBaseEvent: | ||
@@ -111,6 +112,7 @@ | ||
:vartype ipc_data: dict | ||
""" | ||
|
||
+ container: Con | ||
def __init__(self, data, conn, _Con=...) -> None: ... | ||
|
||
class BarconfigUpdateEvent(IpcBaseEvent, BarConfigReply): | ||
diff -ruN typings/i3ipc/__init__.pyi typings.patched/i3ipc/__init__.pyi | ||
--- typings/i3ipc/__init__.pyi 2022-11-30 21:30:26.462203956 +0200 | ||
+++ typings.patched/i3ipc/__init__.pyi 2022-11-30 21:30:25.458199758 +0200 | ||
@@ -2,16 +2,6 @@ | ||
This type stub file was generated by pyright. | ||
""" | ||
|
||
-from .__version__ import ( | ||
- __author__, | ||
- __author_email__, | ||
- __copyright__, | ||
- __description__, | ||
- __license__, | ||
- __title__, | ||
- __url__, | ||
- __version__, | ||
-) | ||
from .con import Con | ||
from .connection import Connection | ||
from .events import ( | ||
@@ -39,3 +29,5 @@ | ||
VersionReply, | ||
WorkspaceReply, | ||
) | ||
+ | ||
+__all__ = ["Con", "Event", "WindowEvent"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Create a patch to record our changes of the pyright-generate type stubs. | ||
|
||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")") | ||
|
||
cd "$SCRIPT_DIR/.." || exit | ||
|
||
cp -r typings typings.patched | ||
rm -rf typings | ||
pyright --createstub i3ipc | ||
isort typings | ||
black typings | ||
|
||
diff -ruN typings typings.patched > typings.patch | ||
|
||
rm -rf typings.patched | ||
git restore typings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Re-generate type stubs with pyright and re-apply our adjustments. | ||
# If the patch doesn't apply cleanly, consider skipping the "patch" step and | ||
# using git resolve the conflicts. Don't forget to re-create the patch file with | ||
# create-typestub-diff.sh. | ||
|
||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")") | ||
|
||
cd "$SCRIPT_DIR/.." || exit | ||
|
||
rm -rf typings | ||
pyright --createstub i3ipc | ||
isort typings | ||
black typings | ||
|
||
patch -s -p0 < typings.patch | ||
|