-
Notifications
You must be signed in to change notification settings - Fork 4.4k
chore: development to master #1490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
c1f279d
2b650cb
23d3f72
c7c4974
134af13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
""" | ||
Clipboard manager. | ||
""" | ||
|
||
from .tool import Clipboardtool |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""Clipboard actions.""" | ||
|
||
from .files import CopyFilePaths, PasteFilePaths | ||
from .image import CopyImage, PasteImage | ||
from .text import CopyText, PasteText | ||
|
||
|
||
__all__ = [ | ||
"CopyText", | ||
"PasteText", | ||
"CopyImage", | ||
"PasteImage", | ||
"CopyFilePaths", | ||
"PasteFilePaths", | ||
] |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,46 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
"""Base classes for clipboard actions.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
from typing import Any, Dict, TypedDict | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
from pydantic import BaseModel, Field | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
class ClipboardState(TypedDict, total=False): | ||||||||||||||||||||||||||||||||||||||||||||||||||
"""Type definition for clipboard state.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
text_data: str | ||||||||||||||||||||||||||||||||||||||||||||||||||
image_data: str | ||||||||||||||||||||||||||||||||||||||||||||||||||
file_paths: list[str] | ||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+8
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 📝 Committable Code Suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
class BaseClipboardRequest(BaseModel): | ||||||||||||||||||||||||||||||||||||||||||||||||||
"""Base request for clipboard actions.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
pass | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
class BaseClipboardResponse(BaseModel): | ||||||||||||||||||||||||||||||||||||||||||||||||||
"""Base response for clipboard actions.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
message: str = Field( | ||||||||||||||||||||||||||||||||||||||||||||||||||
default="", | ||||||||||||||||||||||||||||||||||||||||||||||||||
description="Message describing the result of the action", | ||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||
error: str = Field( | ||||||||||||||||||||||||||||||||||||||||||||||||||
default="", | ||||||||||||||||||||||||||||||||||||||||||||||||||
description="Error message if the action failed", | ||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
def get_clipboard_state(metadata: Dict[str, Any]) -> ClipboardState: | ||||||||||||||||||||||||||||||||||||||||||||||||||
"""Get clipboard state from metadata. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Args: | ||||||||||||||||||||||||||||||||||||||||||||||||||
metadata: The metadata dictionary containing clipboard state | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Returns: | ||||||||||||||||||||||||||||||||||||||||||||||||||
The clipboard state dictionary, initialized if it doesn't exist | ||||||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||||||
if "clipboard_state" not in metadata: | ||||||||||||||||||||||||||||||||||||||||||||||||||
metadata["clipboard_state"] = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||
return metadata["clipboard_state"] # type: ignore | ||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+35
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 📝 Committable Code Suggestion
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using
bytes
type forimage_data
instead ofstr
since it's storing binary image data that's base64 encoded. This would make the type hint more accurate and explicit about the expected data type.