Skip to main content

No project description provided

Project description

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')"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

katso-0.6.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

katso-0.6-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file katso-0.6.tar.gz.

File metadata

  • Download URL: katso-0.6.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for katso-0.6.tar.gz
Algorithm Hash digest
SHA256 330f51088b3169892527eca62080007984c27096d4763cb4ff76e781c43c43e9
MD5 1b3914d79cbbb5a8033776a35c87f8f7
BLAKE2b-256 f3272fd1208ca637e266e9802cd8fee97699f22b025a673e48c1534af9cdbe7b

See more details on using hashes here.

File details

Details for the file katso-0.6-py3-none-any.whl.

File metadata

  • Download URL: katso-0.6-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for katso-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 417c1315e68a2f07fea12814607efcb9497c984468d01e828959a4b5d905a13e
MD5 3e9ba9c1e4eabd1ec9ad0783f2d09608
BLAKE2b-256 7c556cfecfeac6910135c5fb065291ff0284a594f8494652c2723c4d4fa6c66b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page