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

scope3data / scope3ai-py / 12593246423

03 Jan 2025 05:27AM UTC coverage: 92.904% (+12.3%) from 80.557%
12593246423

push

github

329c1c
kevdevg
fix: triying to wrap async headers

10 of 30 new or added lines in 3 files covered. (33.33%)

20 existing lines in 3 files now uncovered.

1414 of 1522 relevant lines covered (92.9%)

3.71 hits per line

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

93.1
/scope3ai/tracers/huggingface/utils.py
1
import contextlib
4✔
2
import contextvars
4✔
3

4
HFRS_BASEKEY = "scope3ai__huggingface__hf_raise_for_status"
4✔
5
HFRS_ENABLED = contextvars.ContextVar(f"{HFRS_BASEKEY}__enabled", default=None)
4✔
6
HFRS_VALUE = contextvars.ContextVar(f"{HFRS_BASEKEY}__value", default=None)
4✔
7

8

9
def hf_raise_for_status_enabled():
4✔
10
    return HFRS_ENABLED.get() is True
4✔
11

12

13
def hf_raise_for_status_wrapper(wrapped, instance, args, kwargs):
4✔
14
    try:
4✔
15
        result = wrapped(*args, **kwargs)
4✔
16
        response = args[0]
4✔
17
        HFRS_VALUE.set(response)
4✔
18
        return result
4✔
19
    except Exception as e:
4✔
20
        raise e
4✔
21

22

23
@contextlib.contextmanager
4✔
24
def hf_raise_for_status_capture():
4✔
25
    try:
4✔
26
        HFRS_VALUE.set(None)
4✔
27
        HFRS_ENABLED.set(True)
4✔
28
        yield HFRS_VALUE
4✔
29
    finally:
30
        HFRS_ENABLED.set(False)
4✔
31

32

33
def get_client_session_async(wrapped, instance, args, kwargs):
4✔
34
    try:
4✔
35
        result = wrapped(*args, **kwargs)
4✔
36
        print("session", result.__dir__())
4✔
37
        return result
4✔
NEW
38
    except Exception as e:
×
NEW
39
        raise e
×
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