about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/openpyxl/comments/comments.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/openpyxl/comments/comments.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-4a52a71956a8d46fcb7294ac71734504bb09bcc2.tar.gz
two version of R2R are here HEAD master
Diffstat (limited to '.venv/lib/python3.12/site-packages/openpyxl/comments/comments.py')
-rw-r--r--.venv/lib/python3.12/site-packages/openpyxl/comments/comments.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/openpyxl/comments/comments.py b/.venv/lib/python3.12/site-packages/openpyxl/comments/comments.py
new file mode 100644
index 00000000..192bbc46
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/openpyxl/comments/comments.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2010-2024 openpyxl
+
+
+class Comment:
+
+    _parent = None
+
+    def __init__(self, text, author, height=79, width=144):
+        self.content = text
+        self.author = author
+        self.height = height
+        self.width = width
+
+
+    @property
+    def parent(self):
+        return self._parent
+
+
+    def __eq__(self, other):
+        return (
+            self.content == other.content
+            and self.author == other.author
+        )
+
+    def __repr__(self):
+        return "Comment: {0} by {1}".format(self.content, self.author)
+
+
+    def __copy__(self):
+        """Create a detached copy of this comment."""
+        clone = self.__class__(self.content, self.author, self.height, self.width)
+        return clone
+
+
+    def bind(self, cell):
+        """
+        Bind comment to a particular cell
+        """
+        if cell is not None and self._parent is not None and self._parent != cell:
+            fmt = "Comment already assigned to {0} in worksheet {1}. Cannot assign a comment to more than one cell"
+            raise AttributeError(fmt.format(cell.coordinate, cell.parent.title))
+        self._parent = cell
+
+
+    def unbind(self):
+        """
+        Unbind a comment from a cell
+        """
+        self._parent = None
+
+
+    @property
+    def text(self):
+        """
+        Any comment text stripped of all formatting.
+        """
+        return self.content
+
+    @text.setter
+    def text(self, value):
+        self.content = value