Skip to main content

katso

# lib/am.py

from dataclasses import dataclass
from typing import Optional

import katso

with katso:
  from lib import am, bm
assert isinstance(bm.B, str)


@dataclass(kw_only=True)
class A:
  a: int
  b: Optional[bm.B] = None

  @property
  def _b(self: am.A) -> bm.B:
    assert isinstance(self, am.A)
    assert isinstance(bm.B, type)
    return bm.B(a=self, b=str(self.a))


# lib/bm.py

from dataclasses import dataclass
from typing import Optional

import katso

with katso:
  from lib import am


@dataclass(kw_only=True)
class B:
  a: Optional[am.A] = None
  b: str


# bin/cm.py

from dataclasses import dataclass

from lib import am, bm


@dataclass
class C:
  a: am.A
  b: bm.B

  def __post_init__(self):
    self.a.b = self.b
    self.b.a = self.a
    # def __init__

  # class C


c = C(am.A(a=42), bm.B(b='spam'))
assert str(c) == "C(a=A(a=42, b=B(a=..., b='spam')), b=B(a=A(a=42, b=...), b='spam'))"

assert isinstance(am.A(a=42)._b, bm.B)
assert str(am.A(a=42)._b) == "B(a=A(a=42, b=None), b='42')"

Metadata

Release files for katso 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for katso 0.6.1
File Size Uploaded
katso-0.6.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for katso 0.6.1
File Interpreter ABI Platform
katso-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / katso-0.6.1.tar.gz

Download URL katso-0.6.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4f7c63bb0aa6de2945d599e0f2488c52e7bc2a50a0eb6239e49aa3bea8c7a653
BLAKE2b-256 checksum
How to use checksums
923d091626874789a39ecc72c0178a90918c10edf7a2f043a50cbe89b5c238c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.0

Release files / katso-0.6.1-py3-none-any.whl

Download URL katso-0.6.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80d9ceae5fbdeb79c12080469303232c8dd9beceda16c7eba561bae646248045
BLAKE2b-256 checksum
How to use checksums
5d0cb5f48321c4c3af6077c3f51e171574d176462ba78423043895640c92cda9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6

2 release files

0.5.1

2 release files

0.5

2 release files

0.4

2 release files

0.3.1

2 release files

0.3

2 release files

0.2.1

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page