Urgent.News

What's breaking now, across thousands of outlets.

Tech

cast(bool, x) is a promise to the type checker. At runtime it is the identity function.

In google/adk-python , the value that decides whether a tool call needs human confirmation reaches its caller through cast(bool, await ...) . typing.cast returns its second argument. That is the entire implementation: def cast ( typ , val ): """ Cast a value to a type. This returns the value unchanged. """ return val It exists so a static checker will stop complaining, and it does nothing at all…

The cast(bool, x) function in google/adk-python serves a specific purpose. It is a promise to the type checker, indicating that a tool call may require human confirmation. However, at runtime, cast(bool, x) behaves as the identity function, returning its second argument unchanged. This implementation is simple: def cast(typ, val): return val.

The sole purpose of cast is to eliminate warnings from static type checkers. When the awaited expression yields None, the function returns None, allowing the caller to test it for truth and bypass the confirmation process. The issue arose because the source code contained a multi-line cast statement that appeared separate when formatted, making it challenging for grep to detect.

The writer discovered that the location of the code was irrelevant, as the safe branch contained the return bool(...) statement. The writer also pointed out that the claim of a defect in cast(bool, x) was incorrect; rather, the defect was in the unchecked value. The investigation did not cover whether any caller in adk-python passed a None value, nor did the writer measure the prevalence of this issue across the ecosystem.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Hard Spend Ceilings, Budget Alerts, and Node.js Runaway Workload Drills

A budget alert tells a person that a limit is close. A hard spend cap changes what the workload is allowed to do. In a fintech leaked-key drill, that difference decides whether the incident ends in a…

  • Hard spend cap stops further work after enforcement
  • Budget alert alerts before cap, not after
  • Audit trail records key revocation and state changes

Restart-Python Class-1

How to use python in Linux? First open a terminal in your linux machine then type python3 . How to find a version of software? Enter the software name space double hyphen version.

  • Use python3 command in terminal to run Python
  • Clear screen with clear command after exit()
  • Function overloading not built-in in Python

Why your OpenGraph tags break on LinkedIn (and how to actually fix it)

Last week someone asked me why their React app showed an empty card when shared on LinkedIn, even though their tags were right there in the code.

  • LinkedIn scrapers don't execute client-side JavaScript, leading to empty cards
  • Meta tags injected post-client-side hydration, missing by the time crawler finishes
  • ogcraft.dev offers HTML visualizer and crawl-back image engine for LinkedIn optimization

More from Saturday 12 September →