ask-yi-i-ching 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ask_yi_i_ching-2.0.0/LICENSE +32 -0
- ask_yi_i_ching-2.0.0/PKG-INFO +94 -0
- ask_yi_i_ching-2.0.0/README.md +73 -0
- ask_yi_i_ching-2.0.0/pyproject.toml +34 -0
- ask_yi_i_ching-2.0.0/src/ask_yi_i_ching/__init__.py +111 -0
- ask_yi_i_ching-2.0.0/src/ask_yi_i_ching/__main__.py +47 -0
- ask_yi_i_ching-2.0.0/src/ask_yi_i_ching/iching.json +4122 -0
- ask_yi_i_ching-2.0.0/src/ask_yi_i_ching/py.typed +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
This package has two parts under two licenses.
|
|
2
|
+
|
|
3
|
+
1. The translation (iching.json): The Ask Yi I Ching, translated by manpo.
|
|
4
|
+
https://askyi.app
|
|
5
|
+
Licensed under the Creative Commons Attribution 4.0 International License
|
|
6
|
+
(CC BY 4.0). You may share and adapt it for any purpose, including
|
|
7
|
+
commercial use, as long as you give appropriate credit, link to the
|
|
8
|
+
license, and indicate if changes were made.
|
|
9
|
+
Credit: The Ask Yi I Ching, translated by manpo (askyi.app)
|
|
10
|
+
License text: https://creativecommons.org/licenses/by/4.0/legalcode
|
|
11
|
+
|
|
12
|
+
2. The code (__init__.py, __main__.py): MIT License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2026 manpo
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
in the Software without restriction, including without limitation the rights
|
|
19
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
SOFTWARE.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: ask-yi-i-ching
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: The I Ching in Chinese and English (The Ask Yi I Ching, translated by manpo) as data, with a three-coin cast.
|
|
5
|
+
Project-URL: Homepage, https://askyi.app/i-ching-pdf/
|
|
6
|
+
Project-URL: Source, https://github.com/manpoai/ask-yi-i-ching
|
|
7
|
+
Project-URL: Dataset, https://huggingface.co/datasets/manpoai/ask-yi-i-ching
|
|
8
|
+
Project-URL: DOI, https://doi.org/10.5281/zenodo.24358845
|
|
9
|
+
Author-email: manpo <manpo@askyi.app>
|
|
10
|
+
License-Expression: MIT AND CC-BY-4.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: book of changes,chinese classics,dataset,divination,hexagram,i ching,translation,yijing,zhouyi
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Natural Language :: Chinese (Simplified)
|
|
15
|
+
Classifier: Natural Language :: English
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Religion
|
|
18
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# ask-yi-i-ching
|
|
23
|
+
|
|
24
|
+
The I Ching (Book of Changes, 周易) in Chinese and English, as data you can import, with a three-coin cast.
|
|
25
|
+
|
|
26
|
+
All 64 hexagrams, each with its Judgment and six line texts, plus the extra texts for hexagrams 1 and 2: 450 passages from **The Ask Yi I Ching, translated by manpo**. The translation is free to use, including commercially, under CC BY 4.0.
|
|
27
|
+
|
|
28
|
+
- Read it online or as a PDF: https://askyi.app/i-ching-pdf/
|
|
29
|
+
- Same data on GitHub, Hugging Face and Zenodo: https://github.com/manpoai/ask-yi-i-ching · DOI [10.5281/zenodo.24358845](https://doi.org/10.5281/zenodo.24358845)
|
|
30
|
+
- JavaScript version: `npm install ask-yi-i-ching`
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
pip install ask-yi-i-ching
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
From the command line:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
ask-yi-i-ching # cast a hexagram
|
|
42
|
+
ask-yi-i-ching 11 # show hexagram 11
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Use
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from ask_yi_i_ching import get_hexagram, cast, from_lines, attribution
|
|
49
|
+
|
|
50
|
+
h = get_hexagram(1)
|
|
51
|
+
h["name"] # "The Creative"
|
|
52
|
+
h["judgment_zh"] # "元,亨,利,贞。"
|
|
53
|
+
h["judgment"] # "Supreme. Successful. Favorable. Steadfast."
|
|
54
|
+
h["lines"][0]["text"] # "Hidden dragon. Do not act."
|
|
55
|
+
|
|
56
|
+
from_lines("111000")["name"] # "Peace": lines bottom to top, 1 = yang
|
|
57
|
+
|
|
58
|
+
r = cast()
|
|
59
|
+
r["values"] # e.g. [7, 8, 9, 7, 6, 8], bottom to top
|
|
60
|
+
r["primary"] # the hexagram you cast
|
|
61
|
+
r["changing_lines"] # texts of the 6s and 9s
|
|
62
|
+
r["resulting"] # the hexagram it changes to, or None
|
|
63
|
+
|
|
64
|
+
print(attribution)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## What's in it
|
|
68
|
+
|
|
69
|
+
| Name | What it is |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `hexagrams` | All 64 hexagrams in King Wen order |
|
|
72
|
+
| `get_hexagram(n)` | One hexagram, 1 to 64 |
|
|
73
|
+
| `from_lines(lines)` | Hexagram from six lines, bottom to top: a string like `"101010"`, booleans, or cast values 6/7/8/9 |
|
|
74
|
+
| `cast(random=None)` | A three-coin cast. Heads count 3, tails 2, so each line is 6, 7, 8 or 9. Uses the `secrets` module unless you pass your own function |
|
|
75
|
+
| `reading(values)` | The same result as `cast`, from six values you already have |
|
|
76
|
+
| `hexagram_url(n)` | The askyi.app page for that hexagram, with every line explained |
|
|
77
|
+
| `attribution` | The credit line to show with the text |
|
|
78
|
+
| `meta` | Title, translator, version, license |
|
|
79
|
+
|
|
80
|
+
Each hexagram has `number`, `symbol`, `name`, `name_zh`, `pinyin`, `binary`, `lower_trigram`, `upper_trigram`, `judgment_zh`, `judgment` and `lines`. Each line has `position` (1 is the bottom), `yang`, `label`, `label_zh`, `text_zh` and `text`. Hexagrams 1 and 2 also have `all_lines`.
|
|
81
|
+
|
|
82
|
+
This covers the core text only. The Ten Wings commentaries are not included.
|
|
83
|
+
|
|
84
|
+
## Credit
|
|
85
|
+
|
|
86
|
+
The translation is licensed CC BY 4.0. Wherever you show the text, credit it, for example:
|
|
87
|
+
|
|
88
|
+
> The Ask Yi I Ching, translated by manpo (askyi.app)
|
|
89
|
+
|
|
90
|
+
In an app or on a web page, a line such as "I Ching text: the Ask Yi translation by manpo (askyi.app)" is enough. If you changed the text, say so.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
The translation in `iching.json`: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The code: MIT. See `LICENSE`.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# ask-yi-i-ching
|
|
2
|
+
|
|
3
|
+
The I Ching (Book of Changes, 周易) in Chinese and English, as data you can import, with a three-coin cast.
|
|
4
|
+
|
|
5
|
+
All 64 hexagrams, each with its Judgment and six line texts, plus the extra texts for hexagrams 1 and 2: 450 passages from **The Ask Yi I Ching, translated by manpo**. The translation is free to use, including commercially, under CC BY 4.0.
|
|
6
|
+
|
|
7
|
+
- Read it online or as a PDF: https://askyi.app/i-ching-pdf/
|
|
8
|
+
- Same data on GitHub, Hugging Face and Zenodo: https://github.com/manpoai/ask-yi-i-ching · DOI [10.5281/zenodo.24358845](https://doi.org/10.5281/zenodo.24358845)
|
|
9
|
+
- JavaScript version: `npm install ask-yi-i-ching`
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pip install ask-yi-i-ching
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
From the command line:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
ask-yi-i-ching # cast a hexagram
|
|
21
|
+
ask-yi-i-ching 11 # show hexagram 11
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Use
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from ask_yi_i_ching import get_hexagram, cast, from_lines, attribution
|
|
28
|
+
|
|
29
|
+
h = get_hexagram(1)
|
|
30
|
+
h["name"] # "The Creative"
|
|
31
|
+
h["judgment_zh"] # "元,亨,利,贞。"
|
|
32
|
+
h["judgment"] # "Supreme. Successful. Favorable. Steadfast."
|
|
33
|
+
h["lines"][0]["text"] # "Hidden dragon. Do not act."
|
|
34
|
+
|
|
35
|
+
from_lines("111000")["name"] # "Peace": lines bottom to top, 1 = yang
|
|
36
|
+
|
|
37
|
+
r = cast()
|
|
38
|
+
r["values"] # e.g. [7, 8, 9, 7, 6, 8], bottom to top
|
|
39
|
+
r["primary"] # the hexagram you cast
|
|
40
|
+
r["changing_lines"] # texts of the 6s and 9s
|
|
41
|
+
r["resulting"] # the hexagram it changes to, or None
|
|
42
|
+
|
|
43
|
+
print(attribution)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## What's in it
|
|
47
|
+
|
|
48
|
+
| Name | What it is |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `hexagrams` | All 64 hexagrams in King Wen order |
|
|
51
|
+
| `get_hexagram(n)` | One hexagram, 1 to 64 |
|
|
52
|
+
| `from_lines(lines)` | Hexagram from six lines, bottom to top: a string like `"101010"`, booleans, or cast values 6/7/8/9 |
|
|
53
|
+
| `cast(random=None)` | A three-coin cast. Heads count 3, tails 2, so each line is 6, 7, 8 or 9. Uses the `secrets` module unless you pass your own function |
|
|
54
|
+
| `reading(values)` | The same result as `cast`, from six values you already have |
|
|
55
|
+
| `hexagram_url(n)` | The askyi.app page for that hexagram, with every line explained |
|
|
56
|
+
| `attribution` | The credit line to show with the text |
|
|
57
|
+
| `meta` | Title, translator, version, license |
|
|
58
|
+
|
|
59
|
+
Each hexagram has `number`, `symbol`, `name`, `name_zh`, `pinyin`, `binary`, `lower_trigram`, `upper_trigram`, `judgment_zh`, `judgment` and `lines`. Each line has `position` (1 is the bottom), `yang`, `label`, `label_zh`, `text_zh` and `text`. Hexagrams 1 and 2 also have `all_lines`.
|
|
60
|
+
|
|
61
|
+
This covers the core text only. The Ten Wings commentaries are not included.
|
|
62
|
+
|
|
63
|
+
## Credit
|
|
64
|
+
|
|
65
|
+
The translation is licensed CC BY 4.0. Wherever you show the text, credit it, for example:
|
|
66
|
+
|
|
67
|
+
> The Ask Yi I Ching, translated by manpo (askyi.app)
|
|
68
|
+
|
|
69
|
+
In an app or on a web page, a line such as "I Ching text: the Ask Yi translation by manpo (askyi.app)" is enough. If you changed the text, say so.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
The translation in `iching.json`: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The code: MIT. See `LICENSE`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.25"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ask-yi-i-ching"
|
|
7
|
+
version = "2.0.0"
|
|
8
|
+
description = "The I Ching in Chinese and English (The Ask Yi I Ching, translated by manpo) as data, with a three-coin cast."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT AND CC-BY-4.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "manpo", email = "manpo@askyi.app" }]
|
|
14
|
+
keywords = ["i ching", "yijing", "zhouyi", "book of changes", "hexagram", "divination", "chinese classics", "translation", "dataset"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Natural Language :: English",
|
|
18
|
+
"Natural Language :: Chinese (Simplified)",
|
|
19
|
+
"Topic :: Religion",
|
|
20
|
+
"Topic :: Text Processing :: Linguistic",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://askyi.app/i-ching-pdf/"
|
|
26
|
+
Source = "https://github.com/manpoai/ask-yi-i-ching"
|
|
27
|
+
Dataset = "https://huggingface.co/datasets/manpoai/ask-yi-i-ching"
|
|
28
|
+
DOI = "https://doi.org/10.5281/zenodo.24358845"
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
ask-yi-i-ching = "ask_yi_i_ching.__main__:main"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.wheel]
|
|
34
|
+
packages = ["src/ask_yi_i_ching"]
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""The Ask Yi I Ching (Chinese–English) as data, plus a three-coin cast.
|
|
2
|
+
|
|
3
|
+
Translation © 2026 manpo, CC BY 4.0. Credit: "The Ask Yi I Ching, translated by manpo (askyi.app)".
|
|
4
|
+
Code: MIT.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import secrets
|
|
11
|
+
from importlib.resources import files
|
|
12
|
+
from typing import Callable, Iterable, Optional, Union
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"meta",
|
|
16
|
+
"hexagrams",
|
|
17
|
+
"attribution",
|
|
18
|
+
"get_hexagram",
|
|
19
|
+
"from_lines",
|
|
20
|
+
"cast",
|
|
21
|
+
"reading",
|
|
22
|
+
"hexagram_url",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
__version__ = "2.0.0"
|
|
26
|
+
|
|
27
|
+
_data = json.loads(files(__package__).joinpath("iching.json").read_text(encoding="utf-8"))
|
|
28
|
+
|
|
29
|
+
meta: dict = _data["meta"]
|
|
30
|
+
hexagrams: list = _data["hexagrams"]
|
|
31
|
+
|
|
32
|
+
#: Credit line to show wherever you use the translation (required by CC BY 4.0).
|
|
33
|
+
attribution = "The Ask Yi I Ching, translated by manpo (askyi.app), CC BY 4.0"
|
|
34
|
+
|
|
35
|
+
_by_number = {h["number"]: h for h in hexagrams}
|
|
36
|
+
_by_binary = {h["binary"]: h for h in hexagrams}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def get_hexagram(number: int) -> dict:
|
|
40
|
+
"""Hexagram by King Wen number, 1 to 64."""
|
|
41
|
+
try:
|
|
42
|
+
return _by_number[int(number)]
|
|
43
|
+
except (KeyError, ValueError, TypeError):
|
|
44
|
+
raise ValueError(f"No hexagram {number!r}: use 1 to 64") from None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _bit(v) -> str:
|
|
48
|
+
if isinstance(v, bool):
|
|
49
|
+
return "1" if v else "0"
|
|
50
|
+
if v in (1, 7, 9):
|
|
51
|
+
return "1"
|
|
52
|
+
if v in (0, 6, 8):
|
|
53
|
+
return "0"
|
|
54
|
+
raise ValueError(f"Unknown line value: {v!r}")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def from_lines(lines: Union[str, Iterable]) -> dict:
|
|
58
|
+
"""Hexagram from six lines, bottom to top.
|
|
59
|
+
|
|
60
|
+
Accepts a binary string ("111111"), booleans (True = yang),
|
|
61
|
+
or cast values (6, 7, 8, 9).
|
|
62
|
+
"""
|
|
63
|
+
if isinstance(lines, str):
|
|
64
|
+
b = lines
|
|
65
|
+
else:
|
|
66
|
+
b = "".join(_bit(v) for v in lines)
|
|
67
|
+
if len(b) != 6 or set(b) - {"0", "1"}:
|
|
68
|
+
raise ValueError("Need exactly six lines, bottom to top")
|
|
69
|
+
return _by_binary[b]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def cast(random: Optional[Callable[[], float]] = None) -> dict:
|
|
73
|
+
"""Cast a hexagram with the three-coin method.
|
|
74
|
+
|
|
75
|
+
Each toss of three coins: heads 3, tails 2, so each line is 6, 7, 8 or 9.
|
|
76
|
+
7 and 9 are yang, 6 and 8 are yin; 6 and 9 are changing lines.
|
|
77
|
+
``random`` returns a float in [0, 1); by default the ``secrets`` module is used.
|
|
78
|
+
"""
|
|
79
|
+
if random is None:
|
|
80
|
+
rnd = secrets.SystemRandom().random
|
|
81
|
+
else:
|
|
82
|
+
rnd = random
|
|
83
|
+
values = [sum(3 if rnd() < 0.5 else 2 for _ in range(3)) for _ in range(6)]
|
|
84
|
+
return reading(values)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def reading(values: list) -> dict:
|
|
88
|
+
"""Build a reading from six cast values (6, 7, 8 or 9), bottom to top."""
|
|
89
|
+
values = list(values)
|
|
90
|
+
if len(values) != 6 or any(v not in (6, 7, 8, 9) for v in values):
|
|
91
|
+
raise ValueError("Need six values, each 6, 7, 8 or 9, bottom to top")
|
|
92
|
+
primary = from_lines(values)
|
|
93
|
+
changing = [i + 1 for i, v in enumerate(values) if v in (6, 9)]
|
|
94
|
+
resulting = (
|
|
95
|
+
from_lines([7 if v == 6 else 8 if v == 9 else v for v in values]) if changing else None
|
|
96
|
+
)
|
|
97
|
+
return {
|
|
98
|
+
"values": values,
|
|
99
|
+
"primary": primary,
|
|
100
|
+
"changing": changing,
|
|
101
|
+
"changing_lines": [primary["lines"][p - 1] for p in changing],
|
|
102
|
+
"all_lines_text": primary.get("all_lines") if len(changing) == 6 else None,
|
|
103
|
+
"resulting": resulting,
|
|
104
|
+
"attribution": attribution,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def hexagram_url(number: int) -> str:
|
|
109
|
+
"""The askyi.app page for a hexagram, with each line explained."""
|
|
110
|
+
h = get_hexagram(number)
|
|
111
|
+
return f"https://askyi.app/i-ching-hexagram-{h['number']}/"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""python -m ask_yi_i_ching cast a hexagram with three coins
|
|
2
|
+
python -m ask_yi_i_ching 11 show hexagram 11"""
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from . import attribution, cast, get_hexagram, hexagram_url
|
|
7
|
+
|
|
8
|
+
NAMES = {6: "old yin, changing", 7: "young yang", 8: "young yin", 9: "old yang, changing"}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _show(h):
|
|
12
|
+
print(f"\n{h['symbol']} Hexagram {h['number']} · {h['name']} {h['name_zh']} ({h['pinyin']})")
|
|
13
|
+
print(f"\n {h['judgment_zh']}\n “{h['judgment']}”")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _line(l):
|
|
17
|
+
print(f"\n Line {l['position']} {l['text_zh']}\n “{l['text']}”")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def main(argv=None):
|
|
21
|
+
argv = sys.argv[1:] if argv is None else argv
|
|
22
|
+
if argv and argv[0].isdigit():
|
|
23
|
+
h = get_hexagram(int(argv[0]))
|
|
24
|
+
_show(h)
|
|
25
|
+
for l in h["lines"]:
|
|
26
|
+
_line(l)
|
|
27
|
+
print(f"\n {hexagram_url(h['number'])}")
|
|
28
|
+
else:
|
|
29
|
+
r = cast()
|
|
30
|
+
print("\nLines, bottom to top:")
|
|
31
|
+
for i, v in enumerate(r["values"]):
|
|
32
|
+
print(f" {i + 1} {v} {'———' if v % 2 else '— —'} {NAMES[v]}")
|
|
33
|
+
_show(r["primary"])
|
|
34
|
+
for l in r["changing_lines"]:
|
|
35
|
+
_line(l)
|
|
36
|
+
if r["all_lines_text"]:
|
|
37
|
+
a = r["all_lines_text"]
|
|
38
|
+
print(f"\n All lines {a['text_zh']}\n “{a['text']}”")
|
|
39
|
+
if r["resulting"]:
|
|
40
|
+
t = r["resulting"]
|
|
41
|
+
print(f"\nChanges to Hexagram {t['number']} · {t['name']} {t['name_zh']}")
|
|
42
|
+
print(f"\n {hexagram_url(r['primary']['number'])}")
|
|
43
|
+
print(f"\n{attribution}\n")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if __name__ == "__main__":
|
|
47
|
+
main()
|