Skip to content

Commit

Permalink
upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdboom committed Jul 4, 2024
1 parent f97941f commit 43dc06c
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 250 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ jobs:
df -h
- name: Check out source repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up pdm
uses: pdm-project/setup-pdm@v4
with:
Expand Down
3 changes: 1 addition & 2 deletions atom/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,7 @@ def stats(self, _vb: Int = -2, /):
duplicates = None
self._log(
"Unable to calculate the number of duplicate "
"rows because a column is unhashable.",
3,
"rows because a column is unhashable.", 3,
)

if not self.branch.X.empty:
Expand Down
2 changes: 1 addition & 1 deletion docs_sources/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ And operating systems:
ATOM is built on top of several existing Python libraries. These
packages are necessary for its correct functioning.

* **[beartype](https://beartype.readthedocs.io/en/latest/)** (>=0.18.0)
* **[beartype](https://beartype.readthedocs.io/en/latest/)** (>=0.18.5)
* **[category-encoders](https://contrib.scikit-learn.org/categorical-encoding/index.html)** (>=2.6.3)
* **[dill](https://pypi.org/project/dill/)** (>=0.3.6)
* **[featuretools](https://www.featuretools.com/)** (>=1.28.0)
Expand Down
59 changes: 15 additions & 44 deletions docs_sources/scripts/autorun.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,6 @@
cached_last_value = None


class StreamOut:
"""Override stdout to fetch the code's output."""

def __init__(self):
self.old = sys.stdout
self.stdout = StringIO()
sys.stdout = self.stdout

def read(self):
"""Read the stringIO buffer."""
value = ""
if self.stdout is not None:
self.stdout.flush()
value = self.stdout.getvalue()
self.stdout = StringIO()
sys.stdout = self.stdout

return value

def __enter__(self):
"""Enter the context manager."""
return self

def __exit__(self, type, value, traceback):
"""Exit the context manager."""
sys.stdout = self.old
self.old = None
self.stdout = None


def execute(src: str) -> tuple[list[list[str]], list[str]]:
"""Get the code with output.
Expand Down Expand Up @@ -133,7 +103,7 @@ def get_latest_file() -> str | None:
# Get complete code block
block = lines[node.lineno - 1: end_line]

if "# hide" not in line:
if not line.endswith("# hide"):
output[-1].extend([draw(code) for code in block])

# Add filename parameter to plot call to save the figure
Expand All @@ -157,19 +127,20 @@ def get_latest_file() -> str | None:

if code is None:
raise ValueError("Code block is incomplete.")
else:
try:
# Capture anything sent to stdout
with StreamOut() as stream:
exec(code, ipy.locals) # type: ignore[arg-type]

if text := stream.read():
# Omit plot's output
if not text.startswith(("{'application/pdf'", "<pandas.io.formats")):
output[-1].append(f"\n{text}")
except Exception:
ipy.showtraceback()
raise

sys.stdout = StringIO()
try:
exec(code, ipy.locals) # type: ignore[arg-type]
except Exception:
ipy.showtraceback()
raise
finally:
if text := sys.stdout.getvalue():
# Omit plot's output
if not text.startswith(("{'application/pdf'", "<pandas.io.formats")):
output[-1].append(f"\n{text[:-1]}") # Remove last newline

sys.stdout = sys.__stdout__

value = ipy.locals["__builtins__"].get("_")
if cached_last_value is not value and isinstance(value, Styler):
Expand Down
4 changes: 2 additions & 2 deletions examples/multioutput_regression.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 43dc06c

Please sign in to comment.