Skip to content

Commit 91e40d5

Browse files
committed
Manual lint fixes
1 parent a22dc09 commit 91e40d5

File tree

20 files changed

+47
-46
lines changed

20 files changed

+47
-46
lines changed

pyproject.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ dev = [
5454
[tool.poe.tasks]
5555
build-develop = "uv run maturin develop --uv"
5656
build-develop-with-release = { cmd = "uv run maturin develop --release --uv" }
57-
format = [{cmd = "uv run ruff check --select I --fix"}, {cmd = "uv run ruff format"}, ]
57+
format = [{cmd = "uv run ruff check --fix"}, {cmd = "uv run ruff format"}, ]
5858
gen-docs = "uv run python scripts/gen_docs.py"
5959
gen-protos = "uv run python scripts/gen_protos.py"
6060
lint = [
61-
{cmd = "uv run ruff check --select I"},
61+
{cmd = "uv run ruff check"},
6262
{cmd = "uv run ruff format --check"},
6363
{ref = "lint-types"},
6464
{cmd = "uv run pyright"},
@@ -72,6 +72,11 @@ lint-types = "uv run mypy --namespace-packages --check-untyped-defs ."
7272
run-bench = "uv run python scripts/run_bench.py"
7373
test = "uv run pytest"
7474

75+
[tool.ruff]
76+
target-version = "py39"
77+
exclude = ["*_pb2.py"]
78+
lint.ignore = ["E741"]
79+
7580

7681
[tool.pytest.ini_options]
7782
asyncio_mode = "auto"
@@ -183,9 +188,6 @@ exclude = [
183188
"temporalio/bridge/testing.py",
184189
]
185190

186-
[tool.ruff]
187-
target-version = "py39"
188-
189191
[build-system]
190192
requires = ["maturin>=1.0,<2.0"]
191193
build-backend = "maturin"

temporalio/api/cloud/cloudservice/v1/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@
194194

195195
# gRPC is optional
196196
try:
197-
import grpc
197+
import grpc # noqa # type: ignore
198198

199-
from .service_pb2_grpc import (
199+
from .service_pb2_grpc import ( # noqa: F401
200200
CloudServiceServicer,
201201
CloudServiceStub,
202202
add_CloudServiceServicer_to_server,

temporalio/api/operatorservice/v1/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656

5757
# gRPC is optional
5858
try:
59-
import grpc
59+
import grpc # noqa # type: ignore
6060

61-
from .service_pb2_grpc import (
61+
from .service_pb2_grpc import ( # noqa: F401
6262
OperatorServiceServicer,
6363
OperatorServiceStub,
6464
add_OperatorServiceServicer_to_server,

temporalio/api/testservice/v1/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
# gRPC is optional
2424
try:
25-
import grpc
25+
import grpc # noqa # type: ignore
2626

27-
from .service_pb2_grpc import (
27+
from .service_pb2_grpc import ( # noqa: F401
2828
TestServiceServicer,
2929
TestServiceStub,
3030
add_TestServiceServicer_to_server,

temporalio/api/workflowservice/v1/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@
278278

279279
# gRPC is optional
280280
try:
281-
import grpc
281+
import grpc # noqa # type: ignore
282282

283-
from .service_pb2_grpc import (
283+
from .service_pb2_grpc import ( # noqa: F401
284284
WorkflowServiceServicer,
285285
WorkflowServiceStub,
286286
add_WorkflowServiceServicer_to_server,

temporalio/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
)
3131

3232
import google.protobuf.internal.containers
33-
from typing_extensions import ClassVar, NamedTuple, Self, TypeAlias, get_origin
33+
from typing_extensions import NamedTuple, Self, TypeAlias, get_origin
3434

3535
import temporalio.api.common.v1
3636
import temporalio.api.enums.v1

temporalio/converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ def from_failure(
926926
stack_trace = encoded_attributes.get("stack_trace")
927927
if isinstance(stack_trace, str):
928928
failure.stack_trace = stack_trace
929-
except:
929+
except Exception:
930930
pass
931931

932932
err: temporalio.exceptions.FailureError

temporalio/runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _on_logs(
207207
# just in case)
208208
try:
209209
message += f" {log.fields}"
210-
except:
210+
except Exception:
211211
pass
212212
record = self.logger.makeRecord(
213213
name,

temporalio/testing/_workflow.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ async def start_local(
215215
),
216216
server,
217217
)
218-
except:
218+
except Exception:
219219
try:
220220
await server.shutdown()
221-
except:
221+
except Exception:
222222
logger.warn(
223223
"Failed stopping local server on client connection failure",
224224
exc_info=True,
@@ -326,10 +326,10 @@ async def start_time_skipping(
326326
),
327327
server,
328328
)
329-
except:
329+
except Exception:
330330
try:
331331
await server.shutdown()
332-
except:
332+
except Exception:
333333
logger.warn(
334334
"Failed stopping test server on client connection failure",
335335
exc_info=True,
@@ -474,13 +474,13 @@ async def time_skipping_unlocked(self) -> AsyncIterator[None]:
474474
await self.client.test_service.lock_time_skipping(
475475
temporalio.api.testservice.v1.LockTimeSkippingRequest()
476476
)
477-
except:
477+
except Exception:
478478
# Lock it back, swallowing error
479479
try:
480480
await self.client.test_service.lock_time_skipping(
481481
temporalio.api.testservice.v1.LockTimeSkippingRequest()
482482
)
483-
except:
483+
except Exception:
484484
logger.exception("Failed locking time skipping after error")
485485
raise
486486

temporalio/worker/_activity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ async def _run_activity(
518518
if running_activity.last_heartbeat_task:
519519
try:
520520
await running_activity.last_heartbeat_task
521-
except:
521+
except Exception:
522522
# Should never happen because it's trapped in-task
523523
temporalio.activity.logger.exception(
524524
"Final heartbeat task didn't trap error"
@@ -750,7 +750,7 @@ def _execute_sync_activity(
750750
if isinstance(heartbeat, SharedHeartbeatSender):
751751
# To make mypy happy
752752
heartbeat_sender = heartbeat
753-
heartbeat_fn = lambda *details: heartbeat_sender.send_heartbeat(
753+
heartbeat_fn = lambda *details: heartbeat_sender.send_heartbeat( # noqa: E731
754754
info.task_token, *details
755755
)
756756
else:

0 commit comments

Comments
 (0)