Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoupdate pre-commit hooks #442

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.3.0'
rev: 'v5.0.0'
hooks:
- id: check-merge-conflict
exclude: "rst$"
- repo: https://github.com/asottile/yesqa
rev: v1.3.0
rev: v1.5.0
hooks:
- id: yesqa
- repo: https://github.com/sondrelg/pep585-upgrade
Expand All @@ -15,22 +15,21 @@ repos:
args:
- --futures=true
- repo: https://github.com/Zac-HD/shed
rev: 0.10.1
rev: 2024.10.1
hooks:
- id: shed
args:
- --refactor
- --py39-plus
types_or:
- python
- markdown
- rst
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.3.0'
rev: 'v5.0.0'
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -44,14 +43,14 @@ repos:
- id: debug-statements
# Another entry is required to apply file-contents-sorter to another file
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.3.0'
rev: 'v5.0.0'
hooks:
- id: file-contents-sorter
files: |
docs/spelling_wordlist.txt|
.gitignore
- repo: https://github.com/rhysd/actionlint
rev: v1.6.15
rev: v1.7.4
hooks:
- id: actionlint-docker
args:
Expand All @@ -62,7 +61,7 @@ repos:
- -ignore
- 'SC1004:'
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.17.1
rev: 0.30.0
hooks:
- id: check-github-actions
ci:
Expand Down
31 changes: 15 additions & 16 deletions neuro_logging/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,21 @@ async def sentry_trace_cm(
tags: Optional[Mapping[str, str]] = None,
data: Optional[Mapping[str, Any]] = None,
) -> AsyncIterator[Optional[sentry_sdk.tracing.Span]]:
with Hub(Hub.current) as hub:
with hub.start_span(op="call", description=name) as child:
if tags:
for key, value in tags.items():
child.set_tag(key, value)
if data:
for key, value in data.items():
child.set_data(key, value)
try:
yield child
except asyncio.CancelledError:
child.set_status("cancelled")
raise
except Exception as exc:
hub.capture_exception(error=exc)
raise
with Hub(Hub.current) as hub, hub.start_span(op="call", description=name) as child:
if tags:
for key, value in tags.items():
child.set_tag(key, value)
if data:
for key, value in data.items():
child.set_data(key, value)
try:
yield child
except asyncio.CancelledError:
child.set_status("cancelled")
raise
except Exception as exc:
hub.capture_exception(error=exc)
raise


@asynccontextmanager
Expand Down
10 changes: 6 additions & 4 deletions tests/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
def sentry_transaction() -> t.Iterator[None]:
sentry_sdk.init(traces_sample_rate=1.0)
hub = sentry_sdk.Hub.current
with sentry_sdk.Hub(hub) as hub:
with hub.start_transaction(
with (
sentry_sdk.Hub(hub) as hub,
hub.start_transaction(
Transaction(name="test", hub=hub, parent_sampled=True, sampled=True)
):
yield
),
):
yield


@pytest.mark.usefixtures("sentry_transaction")
Expand Down
Loading