Skip to content

Commit

Permalink
Autoupdate pre-commit hooks (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov authored Dec 19, 2024
1 parent 66b9049 commit ec022b1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
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

0 comments on commit ec022b1

Please sign in to comment.