Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 5 additions & 4 deletions marimo/_runtime/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ def _url_to_dict(url: URL) -> dict[str, Encodable]:
query_params[k].append(str(v))

# Convert headers to dict, remove all marimo-specific headers
headers: dict[str, str] = {}
for k, v in request.headers.items():
if not k.startswith(("marimo", "x-marimo")):
headers[k] = v
headers: dict[str, str] = {
k: v
for k, v in request.headers.items()
if not k.startswith(("marimo", "x-marimo"))
}

return HTTPRequest(
url=url_dict,
Expand Down
9 changes: 5 additions & 4 deletions marimo/_runtime/reload/module_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def _check_modules(
sys_modules: dict[str, types.ModuleType],
) -> dict[str, types.ModuleType]:
"""Returns the set of modules used by the graph that have been modified"""
stale_modules: dict[str, types.ModuleType] = {}
modified_modules = reloader.check(modules=sys_modules, reload=False)
# TODO(akshayka): could also exclude modules part of the standard library;
# haven't found a reliable way to do this, however.
Expand All @@ -136,15 +135,17 @@ def _check_modules(
t.__file__ for t in target_modules if hasattr(t, "__file__")
}

for modname, module in modules.items():
stale_modules: dict[str, types.ModuleType] = {
modname: module
for modname, module in modules.items()
if _depends_on(
src_module=module,
target_modules=target_modules,
target_filenames=target_filenames,
excludes=excludes,
reloader=reloader,
):
stale_modules[modname] = module
)
}
return stale_modules


Expand Down
3 changes: 1 addition & 2 deletions marimo/_runtime/utils/set_ui_element_request_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def _merge_ui_commands(
merged: dict[UIElementId, Any] = {}
last_cmd = cmds[-1]
for cmd in cmds:
for ui_id, value in cmd.ids_and_values:
merged[ui_id] = value
merged.update(cmd.ids_and_values)

return [
UpdateUIElementCommand(
Expand Down
9 changes: 5 additions & 4 deletions marimo/_session/state/session_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,11 @@ def add_notification(self, notification: NotificationMessage) -> None:
}

# Remove any variable values that are no longer in scope.
next_values: dict[str, VariableValue] = {}
for name, value in self.variable_values.items():
if name in variable_names:
next_values[name] = value
next_values: dict[str, VariableValue] = {
name: value
for name, value in self.variable_values.items()
if name in variable_names
}
self.variable_values = next_values

# Remove any table values that are no longer in scope.
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ ignore = [
"TC006", # Add quotes to type expression in typing.cast()
"PERF203", # try-except within a loop incurs performance overhead; not always possible
"PERF401", # Use {message_str} to create a transformed list; at the cost of readability
"PERF403", # Use a dictionary comprehension instead of a for-loop; at the cost of readability
# TODO: we should fix these, and enable this rule
"PT011", # `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
"E501", # Line too long, we still trim
Expand Down
Loading