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

_from_unix_seconds() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

src/anthropic/_utils/_datetime_parse.py lines 44–53

def _from_unix_seconds(seconds: Union[int, float]) -> datetime:
    if seconds > MAX_NUMBER:
        return datetime.max
    elif seconds < -MAX_NUMBER:
        return datetime.min

    while abs(seconds) > MS_WATERSHED:
        seconds /= 1000
    dt = EPOCH + timedelta(seconds=seconds)
    return dt.replace(tzinfo=timezone.utc)

Subdomains

Frequently Asked Questions

What does _from_unix_seconds() do?
_from_unix_seconds() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_datetime_parse.py.
Where is _from_unix_seconds() defined?
_from_unix_seconds() is defined in src/anthropic/_utils/_datetime_parse.py at line 44.
What calls _from_unix_seconds()?
_from_unix_seconds() 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