-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81dc803
commit e215f06
Showing
3 changed files
with
76 additions
and
44 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
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
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,59 @@ | ||
import warnings | ||
|
||
|
||
class Table: | ||
def __init__(self): | ||
self._html = {} | ||
|
||
@property | ||
def html(self): | ||
return self._html | ||
|
||
|
||
class Html(Table): | ||
def __init__(self): | ||
super().__init__() | ||
self.html.setdefault("html", []) | ||
self._replace_log = False | ||
|
||
def __delitem__(self, key): | ||
# This means the log should be removed | ||
self._replace_log = True | ||
|
||
@property | ||
def replace_log(self): | ||
return self._replace_log | ||
|
||
def append(self, html): | ||
self.html["html"].append(html) | ||
|
||
|
||
class Cell(Table): | ||
def insert(self, index, html): | ||
# backwards-compat | ||
if not isinstance(html, str): | ||
if html.__module__.startswith("py."): | ||
warnings.warn( | ||
"The 'py' module is deprecated and support " | ||
"will be removed in a future release.", | ||
DeprecationWarning, | ||
) | ||
html = str(html) | ||
html = html.replace("col", "data-column-type") | ||
self._html[index] = html | ||
|
||
def pop(self, *args): | ||
warnings.warn( | ||
"'pop' is deprecated and no longer supported.", | ||
DeprecationWarning, | ||
) | ||
|
||
|
||
class Header(Cell): | ||
pass | ||
|
||
|
||
class Row(Cell): | ||
def __delitem__(self, key): | ||
# This means the item should be removed | ||
self._html = None |