Skip to content
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ repos:
alias: ruff-format-docs
args: ["--language", "python", "--no-pad-file", "--no-pad-groups", "--command", "ruff format", "docs/"]
additional_dependencies:
- ruff==0.15.1
- ruff==0.15.2
- id: doccmd
name: Ruff check fix docs
language: python
alias: ruff-check-fix-docs
args: ["--language", "python", "--no-pad-file", "--no-pad-groups", "--command", "ruff check --fix", "docs/"]
additional_dependencies:
- ruff==0.15.1
- ruff==0.15.2
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Documentation

- Fixed some examples [#116](https://github.com/python-backoff/backoff/pull/116) (from [@edgarrmondragon](https://github.com/edgarrmondragon))

### Internal

- Apply the Ruff `RET` rules [#92](https://github.com/python-backoff/backoff/pull/92) (from [@edgarrmondragon](https://github.com/edgarrmondragon))
Expand Down
7 changes: 4 additions & 3 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ def execute_transaction(session, operation):
try:
result = operation(session)
session.commit()
return result
except Exception:
session.rollback()
raise
else:
return result
```

## Async/Await
Expand Down Expand Up @@ -266,7 +267,7 @@ logger = logging.getLogger(__name__)

def log_retry(details):
logger.warning(
"Backing off %s:%.1fs after %d tries calling %s",
"Backing off %.1fs after %d tries calling %s",
details["wait"],
details["tries"],
details["target"].__name__,
Expand Down Expand Up @@ -387,7 +388,7 @@ def check_circuit(e):
)
def protected_api_call(url):
if not circuit_breaker.should_attempt():
raise Exception("Circuit breaker is open")
raise RuntimeError("Circuit breaker is open")
return requests.get(url)
```

Expand Down
Loading