Home / Function/ _get_numeric() — anthropic-sdk-python Function Reference

_get_numeric() — anthropic-sdk-python Function Reference

Architecture documentation for the _get_numeric() function in _datetime_parse.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  813d6b44_1cbd_4a3f_a26b_fb9725d76e1e["_get_numeric()"]
  c8b41cc2_db36_3062_f709_8c907f559cd4["_datetime_parse.py"]
  813d6b44_1cbd_4a3f_a26b_fb9725d76e1e -->|defined in| c8b41cc2_db36_3062_f709_8c907f559cd4
  f5a1b8d9_7ad8_89db_b3ec_43eb707e866a["parse_datetime()"]
  f5a1b8d9_7ad8_89db_b3ec_43eb707e866a -->|calls| 813d6b44_1cbd_4a3f_a26b_fb9725d76e1e
  d22b7d0c_b83e_0078_9b77_bde2723d7864["parse_date()"]
  d22b7d0c_b83e_0078_9b77_bde2723d7864 -->|calls| 813d6b44_1cbd_4a3f_a26b_fb9725d76e1e
  style 813d6b44_1cbd_4a3f_a26b_fb9725d76e1e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_utils/_datetime_parse.py lines 33–41

def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]:
    if isinstance(value, (int, float)):
        return value
    try:
        return float(value)
    except ValueError:
        return None
    except TypeError:
        raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None

Subdomains

Frequently Asked Questions

What does _get_numeric() do?
_get_numeric() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_datetime_parse.py.
Where is _get_numeric() defined?
_get_numeric() is defined in src/anthropic/_utils/_datetime_parse.py at line 33.
What calls _get_numeric()?
_get_numeric() is called by 2 function(s): parse_date, parse_datetime.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free