Skip to content

Commit 7ebc552

Browse files
authored
Merge pull request #651 from opsmill/pog-ruff-ret504
Unnecessary assignment to `data` before `return` statement
2 parents 13b3acb + 3cddbac commit 7ebc552

File tree

4 files changed

+11
-25
lines changed

4 files changed

+11
-25
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ max-complexity = 17
280280
# Review and change the below later #
281281
##################################################################################################
282282
"ANN001", # Missing type annotation for function argument
283-
"RET504", # Unnecessary assignment to `data` before `return` statement
284283
]
285284

286285
"tasks.py" = [

tests/helpers/fixtures.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ def read_fixture(file_name: str, fixture_subdir: str = ".") -> str:
1111
"""Read the contents of a fixture."""
1212
file_path = get_fixtures_dir() / fixture_subdir / file_name
1313
with file_path.open("r", encoding="utf-8") as fhd:
14-
fixture_contents = fhd.read()
15-
16-
return fixture_contents
14+
return fhd.read()

tests/unit/ctl/test_repository_app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
@pytest.fixture
2020
def mock_client() -> mock.Mock:
2121
"""Fixture for a mocked InfrahubClient."""
22-
client = mock.create_autospec(InfrahubClient)
23-
return client
22+
return mock.create_autospec(InfrahubClient)
2423

2524

2625
# ---------------------------------------------------------

tests/unit/sdk/conftest.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ async def client_sync() -> InfrahubClientSync:
4040

4141
@pytest.fixture
4242
async def clients() -> BothClients:
43-
both = BothClients(
43+
return BothClients(
4444
standard=InfrahubClient(config=Config(address="http://mock", insert_tracker=True, pagination_size=3)),
4545
sync=InfrahubClientSync(config=Config(address="http://mock", insert_tracker=True, pagination_size=3)),
4646
)
47-
return both
4847

4948

5049
@pytest.fixture
@@ -2244,7 +2243,7 @@ async def mock_query_infrahub_user(httpx_mock: HTTPXMock) -> HTTPXMock:
22442243
@pytest.fixture
22452244
def query_01() -> str:
22462245
"""Simple query with one document"""
2247-
query = """
2246+
return """
22482247
query {
22492248
TestPerson {
22502249
edges {
@@ -2266,12 +2265,11 @@ def query_01() -> str:
22662265
}
22672266
}
22682267
"""
2269-
return query
22702268

22712269

22722270
@pytest.fixture
22732271
def query_02() -> str:
2274-
query = """
2272+
return """
22752273
query {
22762274
TestPerson {
22772275
edges {
@@ -2312,13 +2310,12 @@ def query_02() -> str:
23122310
}
23132311
}
23142312
"""
2315-
return query
23162313

23172314

23182315
@pytest.fixture
23192316
def query_03() -> str:
23202317
"""Advanced Query with 2 documents"""
2321-
query = """
2318+
return """
23222319
query FirstQuery {
23232320
TestPerson {
23242321
edges {
@@ -2352,13 +2349,12 @@ def query_03() -> str:
23522349
}
23532350
}
23542351
"""
2355-
return query
23562352

23572353

23582354
@pytest.fixture
23592355
def query_04() -> str:
23602356
"""Simple query with variables"""
2361-
query = """
2357+
return """
23622358
query ($person: String!){
23632359
TestPerson(name__value: $person) {
23642360
edges {
@@ -2371,12 +2367,11 @@ def query_04() -> str:
23712367
}
23722368
}
23732369
"""
2374-
return query
23752370

23762371

23772372
@pytest.fixture
23782373
def query_05() -> str:
2379-
query = """
2374+
return """
23802375
query MyQuery {
23812376
CoreRepository {
23822377
edges {
@@ -2405,13 +2400,11 @@ def query_05() -> str:
24052400
}
24062401
"""
24072402

2408-
return query
2409-
24102403

24112404
@pytest.fixture
24122405
def query_06() -> str:
24132406
"""Simple query with variables"""
2414-
query = """
2407+
return """
24152408
query (
24162409
$str1: String,
24172410
$str2: String = "default2",
@@ -2434,12 +2427,11 @@ def query_06() -> str:
24342427
}
24352428
}
24362429
"""
2437-
return query
24382430

24392431

24402432
@pytest.fixture
24412433
def bad_query_01() -> str:
2442-
query = """
2434+
return """
24432435
query {
24442436
TestPerson {
24452437
edges {
@@ -2459,12 +2451,11 @@ def bad_query_01() -> str:
24592451
}
24602452
}
24612453
"""
2462-
return query
24632454

24642455

24652456
@pytest.fixture
24662457
def query_introspection() -> str:
2467-
query = """
2458+
return """
24682459
query IntrospectionQuery {
24692460
__schema {
24702461
queryType {
@@ -2565,7 +2556,6 @@ def query_introspection() -> str:
25652556
}
25662557
}
25672558
"""
2568-
return query
25692559

25702560

25712561
@pytest.fixture

0 commit comments

Comments
 (0)