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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
katso-0.6-py3-none-any.whl
(4.0 kB
view details)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
330f51088b3169892527eca62080007984c27096d4763cb4ff76e781c43c43e9
|
|
| MD5 |
1b3914d79cbbb5a8033776a35c87f8f7
|
|
| BLAKE2b-256 |
f3272fd1208ca637e266e9802cd8fee97699f22b025a673e48c1534af9cdbe7b
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
417c1315e68a2f07fea12814607efcb9497c984468d01e828959a4b5d905a13e
|
|
| MD5 |
3e9ba9c1e4eabd1ec9ad0783f2d09608
|
|
| BLAKE2b-256 |
7c556cfecfeac6910135c5fb065291ff0284a594f8494652c2723c4d4fa6c66b
|