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.1.tar.gz (3.9 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.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: katso-0.6.1.tar.gz
  • Upload date:
  • Size: 3.9 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.1.tar.gz
Algorithm Hash digest
SHA256 4f7c63bb0aa6de2945d599e0f2488c52e7bc2a50a0eb6239e49aa3bea8c7a653
MD5 b95d41f7f64ebb99a120a839e8aa0c1e
BLAKE2b-256 923d091626874789a39ecc72c0178a90918c10edf7a2f043a50cbe89b5c238c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: katso-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80d9ceae5fbdeb79c12080469303232c8dd9beceda16c7eba561bae646248045
MD5 648eb5ab16a293d71d71f0a4df63aec5
BLAKE2b-256 5d0cb5f48321c4c3af6077c3f51e171574d176462ba78423043895640c92cda9

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