diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e6c86f3b9..241098f97 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,12 +24,12 @@ exclude: '^telemetry/ui|^burr/tracking/server/demo_data(/|$)' repos: - repo: https://github.com/ambv/black - rev: 23.11.0 + rev: 26.5.1 hooks: - id: black args: [--line-length=100] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v6.0.0 hooks: - id: trailing-whitespace # burr/examples is a symlink. trailing-whitespace would mangle the @@ -49,7 +49,7 @@ repos: - id: check-ast # isort python package import sorting - repo: https://github.com/pycqa/isort - rev: '5.12.0' + rev: '9.0.0b2' hooks: - id: isort args: @@ -65,7 +65,7 @@ repos: 'burr', ] - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.3.0 hooks: - id: flake8 - repo: local diff --git a/burr/core/action.py b/burr/core/action.py index a69db06c6..05ed19920 100644 --- a/burr/core/action.py +++ b/burr/core/action.py @@ -1809,8 +1809,7 @@ class FunctionRepresentingAction(Protocol[C]): action_function: FunctionBasedActionType __call__: C - def bind(self, **kwargs: Any) -> Self: - ... + def bind(self, **kwargs: Any) -> Self: ... def copy_func(f: types.FunctionType) -> types.FunctionType: diff --git a/burr/core/persistence.py b/burr/core/persistence.py index c32bf8e96..4bd3fd8bb 100644 --- a/burr/core/persistence.py +++ b/burr/core/persistence.py @@ -405,8 +405,7 @@ def set_serde_kwargs(self, serde_kwargs: dict): def create_table_if_not_exists(self, table_name: str): """Helper function to create the table where things are stored if it doesn't exist.""" cursor = self.connection.cursor() - cursor.execute( - f""" + cursor.execute(f""" CREATE TABLE IF NOT EXISTS {table_name} ( partition_key TEXT DEFAULT '{SQLitePersister.PARTITION_KEY_DEFAULT}', app_id TEXT NOT NULL, @@ -416,13 +415,10 @@ def create_table_if_not_exists(self, table_name: str): state TEXT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (partition_key, app_id, sequence_id, position) - )""" - ) - cursor.execute( - f""" + )""") + cursor.execute(f""" CREATE INDEX IF NOT EXISTS {table_name}_created_at_index ON {table_name} (created_at); - """ - ) + """) self.connection.commit() def initialize(self): diff --git a/burr/integrations/bedrock.py b/burr/integrations/bedrock.py index 780494e5a..f19cddd9a 100644 --- a/burr/integrations/bedrock.py +++ b/burr/integrations/bedrock.py @@ -68,8 +68,7 @@ def prompt_mapper(state): class StateToPromptMapper(Protocol): """Protocol for mapping Burr state to Bedrock prompt format.""" - def __call__(self, state: State) -> dict[str, Any]: - ... # noqa: E704 + def __call__(self, state: State) -> dict[str, Any]: ... # noqa: E704 def _text_from_content_blocks(content_blocks: list[Any]) -> str: diff --git a/burr/integrations/persisters/b_aiosqlite.py b/burr/integrations/persisters/b_aiosqlite.py index 8439b965b..580c08db3 100644 --- a/burr/integrations/persisters/b_aiosqlite.py +++ b/burr/integrations/persisters/b_aiosqlite.py @@ -146,8 +146,7 @@ async def __aexit__(self, exc_type, exc_value, traceback): async def create_table_if_not_exists(self, table_name: str): """Helper function to create the table where things are stored if it doesn't exist.""" cursor = await self.connection.cursor() - await cursor.execute( - f""" + await cursor.execute(f""" CREATE TABLE IF NOT EXISTS {table_name} ( partition_key TEXT DEFAULT '{AsyncSQLitePersister.PARTITION_KEY_DEFAULT}', app_id TEXT NOT NULL, @@ -157,13 +156,10 @@ async def create_table_if_not_exists(self, table_name: str): state TEXT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (partition_key, app_id, sequence_id, position) - )""" - ) - await cursor.execute( - f""" + )""") + await cursor.execute(f""" CREATE INDEX IF NOT EXISTS {table_name}_created_at_index ON {table_name} (created_at); - """ - ) + """) await self.connection.commit() async def initialize(self): diff --git a/burr/integrations/persisters/b_asyncpg.py b/burr/integrations/persisters/b_asyncpg.py index c694350d5..06067cff3 100644 --- a/burr/integrations/persisters/b_asyncpg.py +++ b/burr/integrations/persisters/b_asyncpg.py @@ -242,8 +242,7 @@ async def create_table(self, table_name: str): conn, acquired = await self._get_connection() try: async with conn.transaction(): - await conn.execute( - f""" + await conn.execute(f""" CREATE TABLE IF NOT EXISTS {table_name} ( partition_key TEXT DEFAULT '{self.PARTITION_KEY_DEFAULT}', app_id TEXT NOT NULL, @@ -253,13 +252,10 @@ async def create_table(self, table_name: str): state JSONB NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (partition_key, app_id, sequence_id, position) - )""" - ) - await conn.execute( - f""" + )""") + await conn.execute(f""" CREATE INDEX IF NOT EXISTS {table_name}_created_at_index ON {table_name} (created_at); - """ - ) + """) finally: await self._release_connection(conn, acquired) diff --git a/burr/integrations/persisters/b_psycopg2.py b/burr/integrations/persisters/b_psycopg2.py index 26425f805..4f785271c 100644 --- a/burr/integrations/persisters/b_psycopg2.py +++ b/burr/integrations/persisters/b_psycopg2.py @@ -110,8 +110,7 @@ def set_serde_kwargs(self, serde_kwargs: dict): def create_table(self, table_name: str): """Helper function to create the table where things are stored.""" cursor = self.connection.cursor() - cursor.execute( - f""" + cursor.execute(f""" CREATE TABLE IF NOT EXISTS {table_name} ( partition_key TEXT DEFAULT '{self.PARTITION_KEY_DEFAULT}', app_id TEXT NOT NULL, @@ -121,13 +120,10 @@ def create_table(self, table_name: str): state JSONB NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (partition_key, app_id, sequence_id, position) - )""" - ) - cursor.execute( - f""" + )""") + cursor.execute(f""" CREATE INDEX IF NOT EXISTS {table_name}_created_at_index ON {table_name} (created_at); - """ - ) + """) self.connection.commit() def initialize(self): diff --git a/burr/integrations/streamlit.py b/burr/integrations/streamlit.py index 71b63bce0..4da45f054 100644 --- a/burr/integrations/streamlit.py +++ b/burr/integrations/streamlit.py @@ -100,7 +100,7 @@ def load_state_from_log_file(jsonl_log_file: str, app: Application) -> AppState: record = Record( state=json_line["state"], action=json_line["action"], - result=json_line["result"] + result=json_line["result"], # TODO -- add start time, end time ) out.append(record) diff --git a/burr/lifecycle/internal.py b/burr/lifecycle/internal.py index 1043bd0a9..338f266bc 100644 --- a/burr/lifecycle/internal.py +++ b/burr/lifecycle/internal.py @@ -17,6 +17,7 @@ """Base tooling, internal-facing, for lifecycle hooks. This is stolen from the hamilton implementation, but significantly simplified.""" + import asyncio import collections import inspect diff --git a/burr/tracking/s3client.py b/burr/tracking/s3client.py index 2a822eb98..313da9d7d 100644 --- a/burr/tracking/s3client.py +++ b/burr/tracking/s3client.py @@ -341,12 +341,16 @@ def post_application_create( *metadata_path, data=metadata, metadata={ - "parent_pointer": json.dumps(dataclasses.asdict(parent_pointer)) - if parent_pointer is not None - else "None", - "spawning_parent_pointer": json.dumps(dataclasses.asdict(spawning_parent_pointer)) - if spawning_parent_pointer is not None - else "None", + "parent_pointer": ( + json.dumps(dataclasses.asdict(parent_pointer)) + if parent_pointer is not None + else "None" + ), + "spawning_parent_pointer": ( + json.dumps(dataclasses.asdict(spawning_parent_pointer)) + if spawning_parent_pointer is not None + else "None" + ), }, ) diff --git a/burr/tracking/server/s3/backend.py b/burr/tracking/server/s3/backend.py index 706411fc4..b1704f647 100644 --- a/burr/tracking/server/s3/backend.py +++ b/burr/tracking/server/s3/backend.py @@ -137,9 +137,7 @@ def from_path(cls, path: str, created_date: datetime.datetime) -> "DataFile": file_type = ( "graph" if filename.endswith("graph.json") - else "metadata" - if filename.endswith("_metadata.json") - else "log" + else "metadata" if filename.endswith("_metadata.json") else "log" ) # # Validate the date parts @@ -397,12 +395,14 @@ async def _query_metadata_file(metadata_file: DataFile) -> dict: spawning_parent_pointer_raw = response["Metadata"].get("spawning_parent_pointer") return dict( partition_key=metadata_file.partition_key, - parent_pointer=json.loads(parent_pointer_raw) - if parent_pointer_raw != "None" - else None, - spawning_parent_pointer=json.loads(spawning_parent_pointer_raw) - if spawning_parent_pointer_raw != "None" - else None, + parent_pointer=( + json.loads(parent_pointer_raw) if parent_pointer_raw != "None" else None + ), + spawning_parent_pointer=( + json.loads(spawning_parent_pointer_raw) + if spawning_parent_pointer_raw != "None" + else None + ), ) out = await utils.gather_with_concurrency( @@ -654,9 +654,11 @@ async def list_projects(self, request: fastapi.Request) -> Sequence[schema.Proje name=project.name, id=project.name, uri=project.uri if project.uri is not None else "TODO", - last_written=latest_logfile.created_at - if latest_logfile is not None - else project.created_at, + last_written=( + latest_logfile.created_at + if latest_logfile is not None + else project.created_at + ), created=project.created_at, num_apps=await Application.filter(project=project).count(), ) @@ -704,9 +706,9 @@ async def list_apps( partition_key=application.partition_key, first_written=application.created_at, last_written=last_written, - num_steps=application.logfile_count - if application.logfile_count is not None - else 0, + num_steps=( + application.logfile_count if application.logfile_count is not None else 0 + ), tags={}, ) ) @@ -871,12 +873,16 @@ async def indexing_jobs( status=indexing_job.status, records_processed=indexing_job.records_processed, metadata={ - "project": indexing_job.index_status.project.name - if indexing_job.index_status - else "unknown", - "s3_highwatermark": indexing_job.index_status.s3_highwatermark - if indexing_job.index_status - else "unknown", + "project": ( + indexing_job.index_status.project.name + if indexing_job.index_status + else "unknown" + ), + "s3_highwatermark": ( + indexing_job.index_status.s3_highwatermark + if indexing_job.index_status + else "unknown" + ), }, ) ) diff --git a/burr/tracking/server/schema.py b/burr/tracking/server/schema.py index 749f1e3a2..68c1e95b3 100644 --- a/burr/tracking/server/schema.py +++ b/burr/tracking/server/schema.py @@ -87,9 +87,9 @@ class PartialStep(pydantic.BaseModel): step_start_log: Optional[BeginEntryModel] = fields.Field(default_factory=lambda: None) step_end_log: Optional[EndEntryModel] = fields.Field(default_factory=lambda: None) spans: List[Span] = fields.Field(default_factory=list) - streaming_events: List[ - Union[InitializeStreamModel, FirstItemStreamModel, EndStreamModel] - ] = fields.Field(default_factory=list) + streaming_events: List[Union[InitializeStreamModel, FirstItemStreamModel, EndStreamModel]] = ( + fields.Field(default_factory=list) + ) class Step(pydantic.BaseModel): diff --git a/examples/conversational-rag/graph_db_example/application.py b/examples/conversational-rag/graph_db_example/application.py index aa1c0187a..648a76749 100644 --- a/examples/conversational-rag/graph_db_example/application.py +++ b/examples/conversational-rag/graph_db_example/application.py @@ -243,12 +243,10 @@ def build_application( if __name__ == "__main__": - print( - """Run + print("""Run > burr in another terminal to see the UI at http://localhost:7241 - """ - ) + """) _client = openai.OpenAI() _db_client = FalkorDB(host="localhost", port=6379) _graph_name = "UFC" diff --git a/examples/conversational-rag/graph_db_example/ingest_fighters.py b/examples/conversational-rag/graph_db_example/ingest_fighters.py index 66cd6542d..abfe40bf5 100644 --- a/examples/conversational-rag/graph_db_example/ingest_fighters.py +++ b/examples/conversational-rag/graph_db_example/ingest_fighters.py @@ -18,6 +18,7 @@ """ Hamilton pipeline to load fighter data into FalkorDB. """ + import falkordb import pandas as pd import utils diff --git a/examples/conversational-rag/graph_db_example/ingest_fights.py b/examples/conversational-rag/graph_db_example/ingest_fights.py index 5e5f71e91..f9360bf1a 100644 --- a/examples/conversational-rag/graph_db_example/ingest_fights.py +++ b/examples/conversational-rag/graph_db_example/ingest_fights.py @@ -18,6 +18,7 @@ """ Hamilton module to ingest fight data into FalkorDB. """ + import falkordb import pandas as pd import utils diff --git a/examples/conversational-rag/graph_db_example/utils.py b/examples/conversational-rag/graph_db_example/utils.py index 30b77bb35..df5c22d88 100644 --- a/examples/conversational-rag/graph_db_example/utils.py +++ b/examples/conversational-rag/graph_db_example/utils.py @@ -18,6 +18,7 @@ """ Code courtesy of the FalkorDB. """ + from datetime import datetime diff --git a/examples/custom-serde/run.py b/examples/custom-serde/run.py index 8b3260fcf..d27376d44 100644 --- a/examples/custom-serde/run.py +++ b/examples/custom-serde/run.py @@ -25,6 +25,7 @@ and then burr-test-case create --project-name serde-example --app-id APP_ID --sequence-id 3 --serde-module application.py """ + import pprint import uuid diff --git a/examples/deep-researcher/deep_researcher_utils.py b/examples/deep-researcher/deep_researcher_utils.py index 8f731457d..106572638 100644 --- a/examples/deep-researcher/deep_researcher_utils.py +++ b/examples/deep-researcher/deep_researcher_utils.py @@ -2,6 +2,7 @@ Based on code from https://github.com/langchain-ai/local-deep-researcher/tree/005db90331e116eb3edb4e9b43822136b211444e/src/ollama_deep_researcher Copied under the MIT License. """ + import logging logger = logging.getLogger(__name__) diff --git a/examples/deployment/vercel/api/counter.py b/examples/deployment/vercel/api/counter.py index dad85fa07..68cf816e5 100644 --- a/examples/deployment/vercel/api/counter.py +++ b/examples/deployment/vercel/api/counter.py @@ -19,6 +19,7 @@ Vercel Serverless Function for counter application Endpoint: /api/counter """ + import json from http.server import BaseHTTPRequestHandler diff --git a/examples/hello-world-counter/application_classbased.py b/examples/hello-world-counter/application_classbased.py index 73b1bb57b..340f27bed 100644 --- a/examples/hello-world-counter/application_classbased.py +++ b/examples/hello-world-counter/application_classbased.py @@ -18,6 +18,7 @@ """ Class based action example. """ + import logging from typing import List, Optional diff --git a/examples/image-telephone/application.py b/examples/image-telephone/application.py index fa5aaf773..ea17c7d0f 100644 --- a/examples/image-telephone/application.py +++ b/examples/image-telephone/application.py @@ -32,6 +32,7 @@ - https://hub.dagworks.io/docs/Users/elijahbenizzy/caption_images/ - https://hub.dagworks.io/docs/Users/elijahbenizzy/generate_images/ """ + import os import uuid diff --git a/examples/integrations/hamilton/image-telephone/application.py b/examples/integrations/hamilton/image-telephone/application.py index 4f7f5fa1d..d84dd91d4 100644 --- a/examples/integrations/hamilton/image-telephone/application.py +++ b/examples/integrations/hamilton/image-telephone/application.py @@ -22,6 +22,7 @@ plugin to provide some syntactic sugar for defining actions that run Hamilton DAGs. """ + import os import uuid diff --git a/examples/ml-training/application.py b/examples/ml-training/application.py index 4c9c2cc77..e9b269d15 100644 --- a/examples/ml-training/application.py +++ b/examples/ml-training/application.py @@ -25,6 +25,7 @@ Note: this example uses the class based API to define the actions. You could also use the function+decorator API. """ + import burr.core.application from burr.core import Action, Condition, State, default diff --git a/examples/multi-agent-collaboration/hamilton/application.py b/examples/multi-agent-collaboration/hamilton/application.py index ebb43b48c..c6728b099 100644 --- a/examples/multi-agent-collaboration/hamilton/application.py +++ b/examples/multi-agent-collaboration/hamilton/application.py @@ -21,6 +21,7 @@ This also adds a tracer to the Hamilton DAG to trace the execution of the nodes within the Action so that they also show up in the Burr UI. """ + import json from typing import Any, Dict, Optional diff --git a/examples/multi-agent-collaboration/lcel/application.py b/examples/multi-agent-collaboration/lcel/application.py index 187c1cf07..e22588c50 100644 --- a/examples/multi-agent-collaboration/lcel/application.py +++ b/examples/multi-agent-collaboration/lcel/application.py @@ -22,6 +22,7 @@ within the Action so that they also show up in the Burr UI. This is a very simple tracer, it could easily be extended to include more information. """ + import json import uuid from typing import Annotated, Any, Optional diff --git a/examples/pytest/some_actions.py b/examples/pytest/some_actions.py index a1108bd92..b9ded6fe3 100644 --- a/examples/pytest/some_actions.py +++ b/examples/pytest/some_actions.py @@ -20,6 +20,7 @@ It hypothetically transcribes audio and then runs a hypothesis on the transcription to determine a medical diagnosis. """ + from typing import Any, Callable, Dict, Generator, List, Tuple import openai diff --git a/examples/pytest/test_some_actions.py b/examples/pytest/test_some_actions.py index 82a5d5f2f..b5bcf849d 100644 --- a/examples/pytest/test_some_actions.py +++ b/examples/pytest/test_some_actions.py @@ -16,6 +16,7 @@ # under the License. """This module shows example tests for testing actions and agents.""" + import pytest import some_actions diff --git a/examples/templates/agent_supervisor.py b/examples/templates/agent_supervisor.py index 00b130eb8..ea776ffe4 100644 --- a/examples/templates/agent_supervisor.py +++ b/examples/templates/agent_supervisor.py @@ -21,6 +21,7 @@ This example is similar to the multi_agent_collaboration.py example, but that instead a supervisor agent is used to manage it all and whether to stop or continue. """ + from burr import core from burr.core import ApplicationBuilder, State, action, default from burr.tracking import client as burr_tclient diff --git a/examples/templates/hierarchical_agent_teams.py b/examples/templates/hierarchical_agent_teams.py index 9e15da665..cf65f3c4f 100644 --- a/examples/templates/hierarchical_agent_teams.py +++ b/examples/templates/hierarchical_agent_teams.py @@ -24,6 +24,7 @@ Note: you could unroll this into a single application. """ + import uuid import agent_supervisor diff --git a/examples/templates/multi_agent_collaboration.py b/examples/templates/multi_agent_collaboration.py index ed8616955..c779ac57c 100644 --- a/examples/templates/multi_agent_collaboration.py +++ b/examples/templates/multi_agent_collaboration.py @@ -21,6 +21,7 @@ This contains a simple example of how to set up a multi-agent collaboration. The functions are to be filled in with the actual code to run the agents. """ + from burr import core from burr.core import ApplicationBuilder, State, action, default from burr.tracking import client as burr_tclient diff --git a/examples/templates/multi_modal_agent.py b/examples/templates/multi_modal_agent.py index b515b3cc8..209d65630 100644 --- a/examples/templates/multi_modal_agent.py +++ b/examples/templates/multi_modal_agent.py @@ -23,6 +23,7 @@ Fill in the functions, and adjust/create new actions as needed. """ + from typing import Tuple from burr import tracking diff --git a/examples/test-case-creation/application.py b/examples/test-case-creation/application.py index 20a0a1a0f..909962d27 100644 --- a/examples/test-case-creation/application.py +++ b/examples/test-case-creation/application.py @@ -16,6 +16,7 @@ # under the License. """This file is truncated to just the relevant parts for the example.""" + from typing import Tuple import openai diff --git a/examples/test-case-creation/test_application.py b/examples/test-case-creation/test_application.py index 153b03fc5..f39eeee53 100644 --- a/examples/test-case-creation/test_application.py +++ b/examples/test-case-creation/test_application.py @@ -23,6 +23,7 @@ To use this approach you need to do `from burr.testing import pytest_generate_tests # noqa: F401`. """ + import pytest from application import prompt_for_more diff --git a/examples/youtube-to-social-media-post/application.py b/examples/youtube-to-social-media-post/application.py index 838d93063..20c3ada90 100644 --- a/examples/youtube-to-social-media-post/application.py +++ b/examples/youtube-to-social-media-post/application.py @@ -65,9 +65,7 @@ def display(self) -> str: formatted_concepts = "CONCEPTS\n" + "\n".join([c.display() for c in self.concepts]) link = f"link: {self.youtube_url}\n\n" if self.youtube_url else "" - return ( - textwrap.dedent( - f"""\ + return textwrap.dedent(f"""\ TOPIC: {self.topic} {self.hook} @@ -76,11 +74,7 @@ def display(self) -> str: {formatted_takeways} - """ - ) - + link - + formatted_concepts - ) + """) + link + formatted_concepts @action(reads=[], writes=["transcript"]) diff --git a/scripts/verify_apache_artifacts.py b/scripts/verify_apache_artifacts.py index 17b29f240..fb1465587 100755 --- a/scripts/verify_apache_artifacts.py +++ b/scripts/verify_apache_artifacts.py @@ -1004,8 +1004,7 @@ def render_vote_email(artifacts_dir: str, summary: VerificationSummary) -> str: f"- [{result.status}] {result.name}" + (f": {result.details}" if result.details else "") ) - return textwrap.dedent( - f"""\ + return textwrap.dedent(f"""\ Subject: [{vote}] Release Apache Burr (incubating) {version} I verified the Apache Burr (incubating) {version} release artifacts. @@ -1020,8 +1019,7 @@ def render_vote_email(artifacts_dir: str, summary: VerificationSummary) -> str: Vote: {vote} approve the release based on the checks above. - """ - ).strip() + """).strip() def _maybe_output_vote_email(args: argparse.Namespace, summary: VerificationSummary) -> None: diff --git a/tests/core/test_action.py b/tests/core/test_action.py index 0095bdafe..12f7e0ea0 100644 --- a/tests/core/test_action.py +++ b/tests/core/test_action.py @@ -1205,8 +1205,7 @@ async def callback(r: Optional[dict], s: State, e: Exception): def test_derive_inputs_from_fn_state_only(): - def fn(state): - ... + def fn(state): ... bound_params = {} required, optional = derive_inputs_from_fn(bound_params, fn) @@ -1215,8 +1214,7 @@ def fn(state): def test_derive_inputs_from_fn_state_and_required(): - def fn(state, a, b): - ... + def fn(state, a, b): ... bound_params = {"state": 1} required, optional = derive_inputs_from_fn(bound_params, fn) @@ -1225,8 +1223,7 @@ def fn(state, a, b): def test_derive_inputs_from_fn_state_required_and_optional(): - def fn(state, a, b=2): - ... + def fn(state, a, b=2): ... bound_params = {"state": 1} required, optional = derive_inputs_from_fn(bound_params, fn) @@ -1235,8 +1232,7 @@ def fn(state, a, b=2): def test_derive_inputs_from_fnh_state_and_all_bound_except_state(): - def fn(state, a, b): - ... + def fn(state, a, b): ... bound_params = {"a": 1, "b": 2} required, optional = derive_inputs_from_fn(bound_params, fn) @@ -1245,8 +1241,7 @@ def fn(state, a, b): def test_non_existent_bound_parameters(): - def fn(state, a): - ... + def fn(state, a): ... bound_params = {"a": 1, "non_existent": 2} required, optional = derive_inputs_from_fn(bound_params, fn) diff --git a/tests/core/test_parallelism.py b/tests/core/test_parallelism.py index 25d37cc24..e635b9a67 100644 --- a/tests/core/test_parallelism.py +++ b/tests/core/test_parallelism.py @@ -391,11 +391,9 @@ def test_map_actions_default_state(): class MapActionsAllApproaches(MapActions): def actions( self, state: State, inputs: Dict[str, Any], context: ApplicationContext - ) -> Generator[Union[Action, Callable, RunnableGraph], None, None]: - ... + ) -> Generator[Union[Action, Callable, RunnableGraph], None, None]: ... - def reduce(self, state: State, states: Generator[State, None, None]) -> State: - ... + def reduce(self, state: State, states: Generator[State, None, None]) -> State: ... @property def writes(self) -> list[str]: diff --git a/tests/integrations/test_burr_pydantic.py b/tests/integrations/test_burr_pydantic.py index 567f8be65..4aa67cbf3 100644 --- a/tests/integrations/test_burr_pydantic.py +++ b/tests/integrations/test_burr_pydantic.py @@ -178,32 +178,25 @@ def test_model_from_state(): assert model_to_dict(model) == state.get_all() -def _fn_without_state_arg(foo: OriginalModel) -> OriginalModel: - ... +def _fn_without_state_arg(foo: OriginalModel) -> OriginalModel: ... -def _fn_with_incorrect_state_arg(state: int) -> OriginalModel: - ... +def _fn_with_incorrect_state_arg(state: int) -> OriginalModel: ... -def _fn_with_incorrect_return_type(state: OriginalModel) -> int: - ... +def _fn_with_incorrect_return_type(state: OriginalModel) -> int: ... -def _fn_with_no_return_type(state: OriginalModel): - ... +def _fn_with_no_return_type(state: OriginalModel): ... -def _fn_with_untyped_state_arg(state) -> OriginalModel: - ... +def _fn_with_untyped_state_arg(state) -> OriginalModel: ... -def _fn_correct_same_itype_otype(state: OriginalModel, input_1: int) -> OriginalModel: - ... +def _fn_correct_same_itype_otype(state: OriginalModel, input_1: int) -> OriginalModel: ... -def _fn_correct_diff_itype_otype(state: OriginalModel, input_1: int) -> NestedModel: - ... +def _fn_correct_diff_itype_otype(state: OriginalModel, input_1: int) -> NestedModel: ... @pytest.mark.parametrize( @@ -385,16 +378,14 @@ async def act(state: StateModelIn, tld: str) -> StateModelOut: def test_pydantic_action_incorrect_reads(): - def act(state: StateModel, tld: str) -> StateModel: - ... + def act(state: StateModel, tld: str) -> StateModel: ... with pytest.raises(ValueError, match="are not present in the model"): pydantic_action(reads=["foo", "bar", "not_present"], writes=["baz", "qux"])(act) def test_pydantic_action_incorrect_writes(): - def act(state: StateModel, tld: str) -> StateModel: - ... + def act(state: StateModel, tld: str) -> StateModel: ... with pytest.raises(ValueError, match="are not present in the model"): pydantic_action(reads=["foo", "bar"], writes=["baz", "qux", "not_prsent"])(act) diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py index e5c1fa9b4..f5ea32c4f 100644 --- a/tests/test_end_to_end.py +++ b/tests/test_end_to_end.py @@ -19,6 +19,7 @@ but they're specifically meant to be a smoke-screen. If you ever see failures in these tests, you should make a unit test, demonstrate the failure there, then fix both in that test and the end-to-end test.""" + import asyncio import datetime import uuid diff --git a/tests/test_verify_apache_artifacts.py b/tests/test_verify_apache_artifacts.py index c8f15f362..9e4e67168 100644 --- a/tests/test_verify_apache_artifacts.py +++ b/tests/test_verify_apache_artifacts.py @@ -220,21 +220,17 @@ def test_load_rat_xml_root_ignores_trailing_summary_lines(): def test_rat_license_state_supports_old_and_new_xml_shapes(): - old_resource = verify.ET.fromstring( - """ + old_resource = verify.ET.fromstring(""" - """ - ) - new_resource = verify.ET.fromstring( - """ + """) + new_resource = verify.ET.fromstring(""" - """ - ) + """) assert verify._rat_license_state(old_resource) == ("false", "Unknown license") assert verify._rat_license_state(new_resource) == ("false", "Unknown license")