Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(framework:skip) Update PyLint to 3.3.1 #3990

Merged
merged 31 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9ba05d1
ci(framework:skip) Update PyLint and process stubs
charlesbvll Aug 11, 2024
afba01e
Fix pytint errors
charlesbvll Aug 11, 2024
8d47140
Refactor vce
charlesbvll Aug 11, 2024
542ee24
Fix formatting
charlesbvll Aug 11, 2024
bf2c842
Merge branch 'main' into update-pylint
charlesbvll Aug 11, 2024
dc8b83c
Fix arg
charlesbvll Aug 11, 2024
aa69c2e
Fix tests
charlesbvll Aug 11, 2024
b219df0
Merge branch 'main' into update-pylint
tanertopal Aug 13, 2024
66f0b92
Merge branch 'main' into update-pylint
charlesbvll Sep 9, 2024
d10b598
Fix unused variable
charlesbvll Sep 9, 2024
dff25a0
Update pylint
charlesbvll Sep 9, 2024
6d7531b
Merge branch 'main' into update-pylint
charlesbvll Sep 13, 2024
4174233
Merge branch 'main' into update-pylint
charlesbvll Sep 23, 2024
565625d
Use assertions instead of conditions
charlesbvll Sep 23, 2024
c88ce03
Merge branch 'main' into update-pylint
charlesbvll Sep 23, 2024
96f753a
Merge branch 'main' into update-pylint
danieljanes Sep 27, 2024
5ad958d
Merge branch 'main' of https://github.com/adap/flower into update-pylint
charlesbvll Sep 28, 2024
decf065
Fix assignement error
charlesbvll Sep 28, 2024
5235d9f
merge w/ main; adjusted driver_client_proxy_tests.py
jafermarq Oct 9, 2024
9b18658
Merge branch 'main' into update-pylint
charlesbvll Oct 10, 2024
7e570cc
Fix error
charlesbvll Oct 10, 2024
9ad077b
Fix unbound variables
charlesbvll Oct 10, 2024
5d80792
Merge branch 'main' into update-pylint
charlesbvll Oct 10, 2024
d32d29a
Fix unbound
charlesbvll Oct 10, 2024
ac7736a
Merge branch 'update-pylint' of https://github.com/adap/flower into u…
charlesbvll Oct 10, 2024
7e66600
Merge branch 'main' into update-pylint
danieljanes Oct 10, 2024
0f632fd
fix pylint error
panh99 Oct 10, 2024
e249806
Update pylint to latest
charlesbvll Oct 10, 2024
a5ff98e
Merge branch 'main' into update-pylint
danieljanes Oct 11, 2024
90f64f9
Ignore too-many-positional-arguments errors
charlesbvll Oct 11, 2024
52952af
Shorten lines
charlesbvll Oct 11, 2024
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ black = { version = "==24.2.0", extras = ["jupyter"] }
taplo = "==0.9.3"
docformatter = "==1.7.5"
mypy = "==1.8.0"
pylint = "==3.0.3"
pylint = "==3.2.7"
flake8 = "==5.0.4"
parameterized = "==0.9.0"
pytest = "==7.4.4"
Expand Down
9 changes: 4 additions & 5 deletions src/py/flwr/client/clientapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,10 @@ def run_clientapp( # pylint: disable=R0914
)

try:
if fab:
# Load ClientApp
client_app: ClientApp = load_client_app_fn(
run.fab_id, run.fab_version, fab.hash_str
)
# Load ClientApp
client_app: ClientApp = load_client_app_fn(
run.fab_id, run.fab_version, fab.hash_str if fab else ""
)

# Execute ClientApp
reply_message = client_app(message=message, context=context)
Expand Down
6 changes: 6 additions & 0 deletions src/py/flwr/common/record/configsrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def count_bytes(self) -> int:

def get_var_bytes(value: ConfigsScalar) -> int:
"""Return Bytes of value passed."""
var_bytes = 0
if isinstance(value, bool):
var_bytes = 1
elif isinstance(value, (int, float)):
Expand All @@ -136,6 +137,11 @@ def get_var_bytes(value: ConfigsScalar) -> int:
)
if isinstance(value, (str, bytes)):
var_bytes = len(value)
if var_bytes == 0:
raise ValueError(
"Config values must be either `bool`, `int`, `float`, "
"`str`, or `bytes`"
)
return var_bytes

num_bytes = 0
Expand Down
9 changes: 5 additions & 4 deletions src/py/flwr/server/compat/driver_client_proxy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ def _exec_send_and_receive(

def generate_replies(messages: Iterable[Message]) -> Iterable[Message]:
msg = list(messages)[0]
recordset = None
if error_reply:
recordset = None
ret = msg.create_error_reply(ERROR_REPLY)
pass
elif isinstance(res, GetParametersRes):
recordset = compat.getparametersres_to_recordset(res, True)
elif isinstance(res, GetPropertiesRes):
Expand All @@ -248,10 +248,11 @@ def generate_replies(messages: Iterable[Message]) -> Iterable[Message]:
recordset = compat.fitres_to_recordset(res, True)
elif isinstance(res, EvaluateRes):
recordset = compat.evaluateres_to_recordset(res)
else:
raise ValueError(f"Unsupported type: {type(res)}")

if recordset is not None:
ret = msg.create_reply(recordset)
else:
ret = msg.create_error_reply(ERROR_REPLY)

# Reply messages given the push message
return [ret]
Expand Down
6 changes: 3 additions & 3 deletions src/py/flwr/server/strategy/bulyan_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_aggregate_fit() -> None:
actual_aggregated, _ = strategy.aggregate_fit(
server_round=1, results=results, failures=[]
)
if actual_aggregated:
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert actual_aggregated
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert (actual == expected[0]).all()
6 changes: 3 additions & 3 deletions src/py/flwr/server/strategy/fedadagrad_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_aggregate_fit() -> None:
actual_aggregated, _ = strategy.aggregate_fit(
server_round=1, results=results, failures=[]
)
if actual_aggregated:
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert actual_aggregated
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert (actual == expected[0]).all()
6 changes: 3 additions & 3 deletions src/py/flwr/server/strategy/fedmedian_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_aggregate_fit() -> None:
actual_aggregated, _ = strategy.aggregate_fit(
server_round=1, results=results, failures=[]
)
if actual_aggregated:
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert actual_aggregated
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert (actual == expected[0]).all()
6 changes: 3 additions & 3 deletions src/py/flwr/server/strategy/krum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def test_aggregate_fit() -> None:
actual_aggregated, _ = strategy.aggregate_fit(
server_round=1, results=results, failures=[]
)
if actual_aggregated:
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert actual_aggregated
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert (actual == expected[0]).all()
6 changes: 3 additions & 3 deletions src/py/flwr/server/strategy/multikrum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_aggregate_fit() -> None:
actual_aggregated, _ = strategy.aggregate_fit(
server_round=1, results=results, failures=[]
)
if actual_aggregated:
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert actual_aggregated
actual_list = parameters_to_ndarrays(actual_aggregated)
actual = actual_list[0]
assert (actual == expected[0]).all()
10 changes: 6 additions & 4 deletions src/py/flwr/server/superlink/fleet/vce/vce_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def start_vce(
existing_nodes_mapping: Optional[NodeToPartitionMapping] = None,
) -> None:
"""Start Fleet API with the Simulation Engine."""
nodes_mapping = {}

if client_app_attr is not None and client_app is not None:
raise ValueError(
"Both `client_app_attr` and `client_app` are provided, "
Expand Down Expand Up @@ -340,17 +342,17 @@ def backend_fn() -> Backend:
# Load ClientApp if needed
def _load() -> ClientApp:

if client_app:
return client_app
if client_app_attr:
app = get_load_client_app_fn(
return get_load_client_app_fn(
default_app_ref=client_app_attr,
app_path=app_dir,
flwr_dir=flwr_dir,
multi_app=False,
)(run.fab_id, run.fab_version, run.fab_hash)

if client_app:
app = client_app
return app
raise ValueError("Either `client_app_attr` or `client_app` must be provided")

app_fn = _load

Expand Down
12 changes: 6 additions & 6 deletions src/py/flwr/server/superlink/state/state_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ def test_task_res_store_and_retrieve_by_task_ins_id(self) -> None:
# Execute
task_res_uuid = state.store_task_res(task_res)

if task_ins_id is not None:
task_res_list = state.get_task_res(task_ids={task_ins_id})
assert task_ins_id
task_res_list = state.get_task_res(task_ids={task_ins_id})

# Assert
retrieved_task_res = task_res_list[0]
Expand Down Expand Up @@ -811,8 +811,8 @@ def test_get_task_res_not_return_expired(self) -> None:

with patch("time.time", side_effect=lambda: task_ins.task.created_at + 6.1):
# Execute
if task_id is not None:
task_res_list = state.get_task_res(task_ids={task_id})
assert task_id is not None
task_res_list = state.get_task_res(task_ids={task_id})

# Assert
assert len(task_res_list) == 0
Expand Down Expand Up @@ -865,8 +865,8 @@ def test_get_task_res_return_if_not_expired(self) -> None:

with patch("time.time", side_effect=lambda: task_ins.task.created_at + 6.1):
# Execute
if task_id is not None:
task_res_list = state.get_task_res(task_ids={task_id})
assert task_id is not None
task_res_list = state.get_task_res(task_ids={task_id})

# Assert
assert len(task_res_list) != 0
Expand Down
Loading