• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

deepset-ai / haystack / 12914749879

22 Jan 2025 06:32PM UTC coverage: 91.333% (+0.03%) from 91.3%
12914749879

Pull #8763

github

web-flow
Merge 550b1dacb into f96839e13
Pull Request #8763: feat: support streaming_callback as run param for HF Chat generators

8852 of 9692 relevant lines covered (91.33%)

0.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
haystack/utils/jupyter.py
1
# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
2
#
3
# SPDX-License-Identifier: Apache-2.0
4

5

6
def is_in_jupyter() -> bool:
1✔
7
    """
8
    Returns `True` if in Jupyter or Google Colab, `False` otherwise.
9
    """
10
    # Inspired by:
11
    # https://github.com/explosion/spaCy/blob/e1249d3722765aaca56f538e830add7014d20e2a/spacy/util.py#L1079
12
    try:
1✔
13
        # We don't need to import `get_ipython` as it's always present in Jupyter notebooks
14
        if get_ipython().__class__.__name__ == "ZMQInteractiveShell":  # type: ignore[name-defined]
1✔
15
            return True  # Jupyter notebook or qtconsole
×
16
        if get_ipython().__class__.__module__ == "google.colab._shell":  # type: ignore[name-defined]
×
17
            return True  # Colab notebook
×
18
    except NameError:
1✔
19
        pass  # Probably standard Python interpreter
1✔
20
    return False
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc