├── .backstage ├── database.json └── execution.log ├── .gitignore ├── LICENSE ├── MANIFEST.in ├── README.md ├── VERSION ├── backstage.tasks ├── docs └── modules │ ├── README.md │ └── content │ ├── jesth.box │ ├── README.md │ └── content │ │ ├── classes │ │ ├── BinInt.md │ │ ├── Comment.md │ │ ├── CommentID.md │ │ ├── HexInt.md │ │ ├── N.md │ │ ├── OctInt.md │ │ ├── RawString.md │ │ ├── RawText.md │ │ ├── Text.md │ │ ├── Whitespace.md │ │ └── WhitespaceID.md │ │ └── functions.md │ ├── jesth.const │ ├── README.md │ └── content │ │ └── functions.md │ ├── jesth.converter │ ├── README.md │ └── content │ │ ├── classes │ │ ├── BaseToDict.md │ │ ├── Context.md │ │ ├── DictToBase.md │ │ └── ValueConverter.md │ │ └── functions.md │ ├── jesth.dataformat.binary │ ├── README.md │ └── content │ │ └── functions.md │ ├── jesth.dataformat.text │ ├── README.md │ └── content │ │ └── functions.md │ ├── jesth.deserializer │ ├── README.md │ └── content │ │ ├── classes │ │ └── Deserializer.md │ │ └── functions.md │ ├── jesth.document │ ├── README.md │ └── content │ │ ├── classes │ │ └── Document.md │ │ └── functions.md │ ├── jesth.errors │ ├── README.md │ └── content │ │ ├── classes │ │ ├── ConversionError.md │ │ ├── Error.md │ │ └── IndentError.md │ │ └── functions.md │ ├── jesth.misc │ ├── README.md │ └── content │ │ ├── classes │ │ ├── FloatParts.md │ │ └── WriteToFile.md │ │ └── functions.md │ ├── jesth.parser │ ├── README.md │ └── content │ │ ├── classes │ │ └── Parser.md │ │ └── functions.md │ ├── jesth.renderer │ ├── README.md │ └── content │ │ └── functions.md │ ├── jesth.section │ ├── README.md │ └── content │ │ ├── classes │ │ └── Section.md │ │ └── functions.md │ ├── jesth.serializer │ ├── README.md │ └── content │ │ ├── classes │ │ └── Serializer.md │ │ └── functions.md │ ├── jesth.tagbyte │ ├── README.md │ └── content │ │ ├── classes │ │ └── TagByte.md │ │ └── functions.md │ ├── jesth.validator │ ├── README.md │ └── content │ │ ├── classes │ │ ├── Spec.md │ │ └── Validator.md │ │ └── functions.md │ └── jesth │ ├── README.md │ └── content │ ├── classes │ ├── Document.md │ ├── Parser.md │ ├── Section.md │ └── ValueConverter.md │ └── functions.md ├── jesth ├── __init__.py ├── __main__.py ├── box │ └── __init__.py ├── const │ └── __init__.py ├── converter │ └── __init__.py ├── dataformat │ ├── __init__.py │ ├── binary.py │ └── text.py ├── deserializer │ └── __init__.py ├── document │ └── __init__.py ├── errors │ └── __init__.py ├── misc │ └── __init__.py ├── parser │ └── __init__.py ├── renderer │ └── __init__.py ├── section │ └── __init__.py ├── serializer │ └── __init__.py ├── tagbyte │ └── __init__.py └── validator │ └── __init__.py ├── pyproject.toml ├── setup.cfg ├── setup.py └── tests ├── __init__.py ├── test_box.py ├── test_converter.py ├── test_document.py ├── test_misc.py ├── test_parser.py ├── test_renderer.py ├── test_root_imports.py ├── test_section.py └── test_validator.py /.backstage/database.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.backstage/execution.log: -------------------------------------------------------------------------------- 1 | 2024-03-14 00:05:08 (success) gitpush 2 | 2024-03-14 00:05:05 (startup) gitpush 3 | 2024-03-14 00:02:41 (success) gitpush 4 | 2024-03-14 00:02:25 (startup) gitpush 5 | 2024-03-14 00:02:22 (success) gitcommit 6 | 2024-03-14 00:02:21 (startup) gitcommit 7 | 2024-03-14 00:02:09 (success) upload2pypi 8 | 2024-03-14 00:01:49 (startup) upload2pypi 9 | 2024-03-14 00:01:44 (success) build 10 | 2024-03-14 00:01:43 (startup) build 11 | 2024-03-13 22:58:56 (success) upload2pypi 12 | 2024-03-13 22:58:48 (startup) upload2pypi 13 | 2024-03-13 22:58:36 (success) gitpush 14 | 2024-03-13 22:58:20 (startup) gitpush 15 | 2024-03-13 22:58:12 (success) gitcommit 16 | 2024-03-13 22:58:11 (startup) gitcommit 17 | 2024-03-13 22:57:55 (success) build 18 | 2024-03-13 22:57:52 (startup) build 19 | 2023-12-19 07:52:52 (success) gitpush 20 | 2023-12-19 07:52:40 (startup) gitpush 21 | 2023-12-19 07:52:36 (success) gitcommit 22 | 2023-12-19 07:52:35 (startup) gitcommit 23 | 2023-12-18 17:15:00 (success) gitpush 24 | 2023-12-18 17:14:56 (startup) gitpush 25 | 2023-12-18 17:14:52 (success) gitcommit 26 | 2023-12-18 17:14:51 (startup) gitcommit 27 | 2023-12-18 17:14:30 (success) upload2pypi 28 | 2023-12-18 17:14:19 (startup) upload2pypi 29 | 2023-12-18 17:14:12 (success) build 30 | 2023-12-18 17:14:11 (startup) build 31 | 2023-12-18 17:13:55 (success) gendoc 32 | 2023-12-18 17:13:53 (startup) gendoc 33 | 2023-05-30 12:04:47 (success) gitpush 34 | 2023-05-30 12:04:27 (startup) gitpush 35 | 2023-05-30 12:04:23 (success) gitcommit 36 | 2023-05-30 12:04:22 (startup) gitcommit 37 | 2023-05-29 23:16:24 (success) gitpush 38 | 2023-05-29 23:16:20 (startup) gitpush 39 | 2023-05-29 23:16:16 (success) gitcommit 40 | 2023-05-29 23:16:16 (startup) gitcommit 41 | 2023-05-29 23:09:56 (success) release 42 | 2023-05-29 23:09:56 (success) _looped_task 43 | 2023-05-29 23:09:56 (success) upload2pypi 44 | 2023-05-29 23:09:48 (startup) upload2pypi 45 | 2023-05-29 23:09:48 (startup) _looped_task 46 | 2023-05-29 23:09:48 (success) _looped_task 47 | 2023-05-29 23:09:48 (success) gitpush 48 | 2023-05-29 23:09:45 (startup) gitpush 49 | 2023-05-29 23:09:45 (startup) _looped_task 50 | 2023-05-29 23:09:45 (success) gitcommit 51 | 2023-05-29 23:09:45 (startup) gitcommit 52 | 2023-05-29 23:09:45 (success) build 53 | 2023-05-29 23:09:44 (startup) build 54 | 2023-05-29 23:09:44 (success) gitcommit 55 | 2023-05-29 23:09:43 (startup) gitcommit 56 | 2023-05-29 23:09:43 (success) gendoc 57 | 2023-05-29 23:09:42 (startup) gendoc 58 | 2023-05-29 23:09:42 (startup) release 59 | 2023-05-20 00:39:26 (success) gitpush 60 | 2023-05-20 00:39:22 (startup) gitpush 61 | 2023-05-20 00:39:20 (success) gitcommit 62 | 2023-05-20 00:39:20 (startup) gitcommit 63 | 2023-05-20 00:35:45 (success) gitpush 64 | 2023-05-20 00:35:42 (startup) gitpush 65 | 2023-05-20 00:35:40 (success) gitcommit 66 | 2023-05-20 00:35:40 (startup) gitcommit 67 | 2023-05-20 00:21:00 (success) gitpush 68 | 2023-05-20 00:20:34 (startup) gitpush 69 | 2023-05-20 00:20:30 (success) gitcommit 70 | 2023-05-20 00:20:30 (startup) gitcommit 71 | 2023-05-19 13:07:12 (success) gitpush 72 | 2023-05-19 13:07:09 (startup) gitpush 73 | 2023-05-19 13:07:06 (success) gitcommit 74 | 2023-05-19 13:07:06 (startup) gitcommit 75 | 2023-05-19 11:12:08 (success) gitpush 76 | 2023-05-19 11:12:05 (startup) gitpush 77 | 2023-05-19 11:12:03 (success) gitcommit 78 | 2023-05-19 11:12:03 (startup) gitcommit 79 | 2023-05-19 11:01:40 (success) gitpush 80 | 2023-05-19 11:01:37 (startup) gitpush 81 | 2023-05-19 11:01:36 (success) gitcommit 82 | 2023-05-19 11:01:36 (startup) gitcommit 83 | 2023-05-19 10:18:04 (success) gitpush 84 | 2023-05-19 10:17:55 (startup) gitpush 85 | 2023-05-19 10:17:44 (success) gitcommit 86 | 2023-05-19 10:17:43 (startup) gitcommit 87 | 2023-05-19 02:01:06 (success) gitpush 88 | 2023-05-19 02:01:03 (startup) gitpush 89 | 2023-05-19 02:01:01 (success) gitcommit 90 | 2023-05-19 02:01:01 (startup) gitcommit 91 | 2023-05-19 01:57:36 (success) gitpush 92 | 2023-05-19 01:57:19 (startup) gitpush 93 | 2023-05-19 01:57:11 (success) gitcommit 94 | 2023-05-19 01:57:11 (startup) gitcommit 95 | 2023-05-18 21:10:05 (success) gitpush 96 | 2023-05-18 21:10:01 (startup) gitpush 97 | 2023-05-18 21:09:56 (success) gitcommit 98 | 2023-05-18 21:09:56 (startup) gitcommit 99 | 2023-05-18 18:44:58 (success) gitpush 100 | 2023-05-18 18:44:55 (startup) gitpush 101 | 2023-05-18 18:44:53 (success) gitcommit 102 | 2023-05-18 18:44:53 (startup) gitcommit 103 | 2023-05-18 17:50:37 (success) gitpush 104 | 2023-05-18 17:50:33 (startup) gitpush 105 | 2023-05-18 17:50:32 (success) gitcommit 106 | 2023-05-18 17:50:32 (startup) gitcommit 107 | 2023-05-18 17:48:25 (success) gitpush 108 | 2023-05-18 17:48:22 (startup) gitpush 109 | 2023-05-18 17:48:20 (success) gitcommit 110 | 2023-05-18 17:48:20 (startup) gitcommit 111 | 2023-05-18 17:44:13 (success) gitpush 112 | 2023-05-18 17:44:10 (startup) gitpush 113 | 2023-05-18 17:44:08 (success) gitcommit 114 | 2023-05-18 17:44:08 (startup) gitcommit 115 | 2023-05-18 17:43:40 (success) gitpush 116 | 2023-05-18 17:43:36 (startup) gitpush 117 | 2023-05-18 17:43:35 (success) gitcommit 118 | 2023-05-18 17:43:35 (startup) gitcommit 119 | 2023-05-18 17:43:00 (success) gitpush 120 | 2023-05-18 17:42:57 (startup) gitpush 121 | 2023-05-18 17:42:55 (success) gitcommit 122 | 2023-05-18 17:42:55 (startup) gitcommit 123 | 2023-05-18 17:42:23 (success) gitpush 124 | 2023-05-18 17:42:20 (startup) gitpush 125 | 2023-05-18 17:42:14 (success) gitcommit 126 | 2023-05-18 17:42:14 (startup) gitcommit 127 | 2023-05-18 17:37:50 (success) release 128 | 2023-05-18 17:37:50 (success) _looped_task 129 | 2023-05-18 17:37:50 (success) upload2pypi 130 | 2023-05-18 17:37:42 (startup) upload2pypi 131 | 2023-05-18 17:37:42 (startup) _looped_task 132 | 2023-05-18 17:37:42 (success) _looped_task 133 | 2023-05-18 17:37:42 (success) gitpush 134 | 2023-05-18 17:37:22 (startup) gitpush 135 | 2023-05-18 17:37:22 (startup) _looped_task 136 | 2023-05-18 17:37:22 (success) gitcommit 137 | 2023-05-18 17:37:22 (startup) gitcommit 138 | 2023-05-18 17:37:22 (success) build 139 | 2023-05-18 17:37:21 (startup) build 140 | 2023-05-18 17:37:21 (success) gitcommit 141 | 2023-05-18 17:37:21 (startup) gitcommit 142 | 2023-05-18 17:37:21 (success) gendoc 143 | 2023-05-18 17:37:20 (startup) gendoc 144 | 2023-05-18 17:37:20 (startup) release 145 | 2023-02-25 02:39:36 (success) release 146 | 2023-02-25 02:39:36 (success) _looped_task 147 | 2023-02-25 02:39:36 (success) upload2pypi 148 | 2023-02-25 02:39:26 (startup) upload2pypi 149 | 2023-02-25 02:39:26 (startup) _looped_task 150 | 2023-02-25 02:39:26 (success) _looped_task 151 | 2023-02-25 02:39:26 (success) gitpush 152 | 2023-02-25 02:39:21 (startup) gitpush 153 | 2023-02-25 02:39:21 (startup) _looped_task 154 | 2023-02-25 02:39:21 (success) gitcommit 155 | 2023-02-25 02:39:20 (startup) gitcommit 156 | 2023-02-25 02:39:20 (success) build 157 | 2023-02-25 02:39:18 (startup) build 158 | 2023-02-25 02:39:18 (success) gitcommit 159 | 2023-02-25 02:39:17 (startup) gitcommit 160 | 2023-02-25 02:39:17 (success) gendoc 161 | 2023-02-25 02:39:15 (startup) gendoc 162 | 2023-02-25 02:39:15 (startup) release 163 | 2022-09-15 23:04:49 (success) release 164 | 2022-09-15 23:04:49 (success) _looped_task 165 | 2022-09-15 23:04:49 (success) upload2pypi 166 | 2022-09-15 23:04:40 (startup) upload2pypi 167 | 2022-09-15 23:04:40 (startup) _looped_task 168 | 2022-09-15 23:04:40 (success) _looped_task 169 | 2022-09-15 23:04:40 (success) gitpush 170 | 2022-09-15 23:04:36 (startup) gitpush 171 | 2022-09-15 23:04:36 (startup) _looped_task 172 | 2022-09-15 23:04:36 (success) gitcommit 173 | 2022-09-15 23:04:36 (startup) gitcommit 174 | 2022-09-15 23:04:36 (success) build 175 | 2022-09-15 23:04:34 (startup) build 176 | 2022-09-15 23:04:34 (success) gitcommit 177 | 2022-09-15 23:04:34 (startup) gitcommit 178 | 2022-09-15 23:04:34 (success) gendoc 179 | 2022-09-15 23:04:32 (startup) gendoc 180 | 2022-09-15 23:04:32 (startup) release 181 | 2022-09-08 12:28:45 (success) release 182 | 2022-09-08 12:28:45 (success) _pypi_release 183 | 2022-09-08 12:28:26 (startup) _pypi_release 184 | 2022-09-08 12:28:26 (success) _git_default_commit 185 | 2022-09-08 12:28:26 (startup) _git_default_commit 186 | 2022-09-08 12:28:26 (success) _git_push 187 | 2022-09-08 12:28:14 (startup) _git_push 188 | 2022-09-08 12:28:14 (success) _build_package 189 | 2022-09-08 12:28:09 (startup) _build_package 190 | 2022-09-08 12:28:09 (success) _git_tag 191 | 2022-09-08 12:28:09 (startup) _git_tag 192 | 2022-09-08 12:28:09 (success) _git_default_commit 193 | 2022-09-08 12:28:09 (startup) _git_default_commit 194 | 2022-09-08 12:28:08 (success) _build_doc 195 | 2022-09-08 12:28:01 (startup) _build_doc 196 | 2022-09-08 12:28:01 (startup) release 197 | 2022-09-08 00:06:44 (success) release 198 | 2022-09-08 00:06:44 (success) _pypi_release 199 | 2022-09-08 00:06:32 (startup) _pypi_release 200 | 2022-09-08 00:06:32 (success) _git_default_commit 201 | 2022-09-08 00:06:32 (startup) _git_default_commit 202 | 2022-09-08 00:06:32 (success) _git_push 203 | 2022-09-08 00:06:23 (startup) _git_push 204 | 2022-09-08 00:06:23 (success) _build_package 205 | 2022-09-08 00:06:21 (startup) _build_package 206 | 2022-09-08 00:06:21 (success) _git_tag 207 | 2022-09-08 00:06:21 (startup) _git_tag 208 | 2022-09-08 00:06:21 (success) _git_default_commit 209 | 2022-09-08 00:06:21 (startup) _git_default_commit 210 | 2022-09-08 00:06:21 (success) _build_doc 211 | 2022-09-08 00:06:20 (startup) _build_doc 212 | 2022-09-08 00:06:20 (startup) release 213 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # File generated by Setupinit 2 | 3 | # Python 4 | __pycache__/ 5 | *.py[cod] 6 | build/ 7 | dist/ 8 | *.egg-info/ 9 | 10 | # Environments 11 | venv/ 12 | env/ 13 | 14 | # PyCharm 15 | .idea/ 16 | 17 | # Databases 18 | *.db 19 | 20 | # Pyrustic local data 21 | .pyrustic/ 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022, 2023, 2024 Pyrustic Evangelist 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include jesth * 2 | global-exclude *.py[cod] 3 | include VERSION 4 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.0.12 -------------------------------------------------------------------------------- /backstage.tasks: -------------------------------------------------------------------------------- 1 | 2022-09-15 (Alex Rustic) 2 | This 'backstage.tasks' file is written for Python projects. 3 | Put this file in the root directory of your Python project. 4 | 5 | You will need to install 'backstage', 'setupinit', and 'buildver': 6 | $ pip install backstage 7 | $ pip install setupinit 8 | $ pip install buildver 9 | 10 | Once installed, run: 11 | $ cd /path/to/project 12 | $ backstage --help 13 | 14 | Visit https://github.com/pyrustic/backstage 15 | 16 | 17 | ------------------------------------------------------------------ 18 | 19 | 20 | [build] 21 | $ buildver build {ARGS} 22 | 23 | 24 | [build.test] 25 | assert 1 == 1 26 | 27 | 28 | ------------------------------------------------------------------ 29 | 30 | 31 | [check] 32 | $ buildver check 33 | 34 | 35 | [check.test] 36 | assert 1 == 1 37 | 38 | 39 | ------------------------------------------------------------------ 40 | 41 | 42 | [clean] 43 | pass 44 | 45 | 46 | [clean.test] 47 | assert 1 == 1 48 | 49 | 50 | ------------------------------------------------------------------ 51 | 52 | 53 | [gendoc] 54 | $ hyperdoc build 55 | 56 | 57 | [gendoc.test] 58 | assert 1 == 1 59 | 60 | 61 | ------------------------------------------------------------------ 62 | 63 | 64 | [gitcommit] 65 | default message 66 | set message = {ARGS[0]} 67 | if message == EMPTY 68 | set message = `Update` 69 | $ git add . 70 | $ git commit -m {message} 71 | 72 | 73 | [gitcommit.test] 74 | assert 1 == 1 75 | 76 | 77 | ------------------------------------------------------------------ 78 | 79 | 80 | [gitinit] 81 | default origin 82 | set origin = {ARGS[0]} 83 | if origin == EMPTY 84 | > origin : `Origin: ` 85 | $ git init 86 | $ git remote add origin {origin} 87 | 88 | 89 | [gitinit.test] 90 | assert 1 == 1 91 | 92 | 93 | ------------------------------------------------------------------ 94 | 95 | 96 | [gitpush] 97 | default project_version 98 | set project_version = {ARGS[0]} 99 | if project_version == EMPTY 100 | $ git push origin master 101 | else 102 | $ git push origin master tag {project_version} 103 | return R 104 | 105 | 106 | [gitpush.test] 107 | assert 1 == 1 108 | 109 | 110 | ------------------------------------------------------------------ 111 | 112 | 113 | [init] 114 | $ setupinit init 115 | 116 | 117 | [init.test] 118 | assert 1 == 1 119 | 120 | 121 | ------------------------------------------------------------------ 122 | 123 | 124 | [release] 125 | interface with buildver 126 | set project_dir = {CWD} 127 | call buildver.get_version(project_dir) 128 | set project_version = {R} 129 | if project_version == EMPTY 130 | : Failed to get the project version. 131 | : Release cancelled. 132 | return 133 | : Project version: {project_version} 134 | : 135 | : == Documentation generation == 136 | : 137 | & gendoc 138 | : 139 | : == Commit changes == 140 | : 141 | & gitcommit 142 | : 143 | : == Git tag == 144 | : 145 | $ git tag {project_version} 146 | : 147 | : == Build distribution package == 148 | : 149 | & build {ARGS} 150 | : 151 | : == Commit changes == 152 | : 153 | & gitcommit 154 | : 155 | : == Git push == 156 | : 157 | & _looped_task gitpush {project_version} 158 | : 159 | : == Upload package to PyPI == 160 | : 161 | & _looped_task upload2pypi 162 | : 163 | : Goodbye ! 164 | 165 | 166 | [release.test] 167 | assert 1 == 1 168 | 169 | 170 | ------------------------------------------------------------------ 171 | 172 | 173 | [test] 174 | $ python -m unittest discover -f -s tests -t . 175 | 176 | 177 | [test.test] 178 | assert 1 == 1 179 | 180 | 181 | ------------------------------------------------------------------ 182 | 183 | 184 | [upload2pypi] 185 | $ twine upload --skip-existing dist/* 186 | return R 187 | 188 | 189 | [upload2pypi.test] 190 | assert 1 == 1 191 | 192 | 193 | ------------------------------------------------------------------ 194 | 195 | 196 | [_looped_task] 197 | # take a task as argument 198 | # and ensure it exits with success 199 | # (if the user is ok with it) 200 | set success = {FALSE} 201 | while success == FALSE 202 | & {ARGS} 203 | if R == 0 204 | set success = {TRUE} 205 | else 206 | set success = {FALSE} 207 | if success == FALSE 208 | : 209 | & _ask_confirmation "Repeat the failed subtask (y/N): " 210 | : 211 | if R == 0 212 | break 213 | 214 | 215 | ------------------------------------------------------------------ 216 | 217 | 218 | [_ask_confirmation] 219 | # ask for confirmation 220 | # returns 1 if True, else 0 221 | default message 222 | set message = {ARGS[0]} 223 | > result : {message} 224 | set yes = `y` 225 | if result == yes 226 | return 1 227 | return 0 228 | 229 | 230 | ------------------------------------------------------------------ 231 | 232 | 233 | [build.help] 234 | Build the Python project 235 | 236 | Usage: 237 | backstage build 238 | backstage build then 239 | 240 | Example: 241 | backstage build then 3.0.0 242 | backstage build then +maj 243 | 244 | Under the hood, the package 'buildver' is used. 245 | 246 | 247 | ------------------------------------------------------------------ 248 | 249 | 250 | [check.help] 251 | Get the project version and latest build information 252 | 253 | Usage: 254 | backstage check 255 | 256 | Under the hood, the package 'buildver' is used. 257 | 258 | 259 | ------------------------------------------------------------------ 260 | 261 | 262 | [clean.help] 263 | Clean the project directory 264 | 265 | Usage: 266 | backstage clean 267 | 268 | 269 | ------------------------------------------------------------------ 270 | 271 | 272 | [gendoc.help] 273 | Generate the project documentation 274 | 275 | Usage: 276 | backstage gendoc 277 | 278 | 279 | ------------------------------------------------------------------ 280 | 281 | 282 | [gitcommit.help] 283 | Save your changes to the local repository 284 | 285 | Usage: 286 | backstage gitcommit 287 | backstage gitcommit 288 | 289 | Note: by default, the message is set to "Update". 290 | 291 | Under the hood, the program Git is used. 292 | 293 | 294 | ------------------------------------------------------------------ 295 | 296 | 297 | [gitinit.help] 298 | Initialize a new Git repository then create a new connection 299 | to the remote repository 300 | 301 | Usage: 302 | backstage gitinit 303 | 304 | Under the hood, the program Git is used. 305 | 306 | 307 | ------------------------------------------------------------------ 308 | 309 | 310 | [gitpush.help] 311 | Send the commits from your local Git repository to the remote repository 312 | 313 | Usage: 314 | backstage gitpush 315 | backstage gitpush 316 | 317 | Under the hood, the program Git is used. 318 | 319 | 320 | ------------------------------------------------------------------ 321 | 322 | 323 | [init.help] 324 | Initialize the Python project 325 | 326 | Usage: 327 | backstage init 328 | 329 | Under the hood, the package 'setupinit' is used. 330 | 331 | 332 | ------------------------------------------------------------------ 333 | 334 | 335 | [release.help] 336 | Release a new version of this project 337 | 338 | Usage: 339 | backstage release 340 | backstage release then 341 | 342 | Example: 343 | backstage release then 3.0.1 344 | backstage release then +maj 345 | 346 | Under the hood, 'Git', 'buildver' and 'twine' are used. 347 | 348 | 349 | ------------------------------------------------------------------ 350 | 351 | 352 | [test.help] 353 | Run tests 354 | 355 | Usage: 356 | backstage test 357 | 358 | Under the hood, the module 'unittest' is used. 359 | 360 | 361 | ------------------------------------------------------------------ 362 | 363 | 364 | [upload2pypi.help] 365 | Upload the recently built distribution package to PyPI 366 | 367 | Usage: 368 | backstage upload2pypi 369 | 370 | Under the hood, the package 'twine' is used. 371 | -------------------------------------------------------------------------------- /docs/modules/README.md: -------------------------------------------------------------------------------- 1 | # Modules Documentation 2 | 3 | [jesth](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/README.md#module-overview) 4 |
5 | For convenience, this module exposes main classes and functions of the library 6 | 7 | 8 | [jesth.box](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/README.md#module-overview) 9 |
10 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 11 | 12 | 13 | [jesth.const](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.const/README.md#module-overview) 14 |
15 | No description 16 | 17 | 18 | [jesth.converter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/README.md#module-overview) 19 |
20 | Classes and functions to convert a section body into a Python dict, or flatten a Python dict into a section body 21 | 22 | 23 | [jesth.dataformat.binary](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.dataformat.binary/README.md#module-overview) 24 |
25 | No description 26 | 27 | 28 | [jesth.dataformat.text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.dataformat.text/README.md#module-overview) 29 |
30 | No description 31 | 32 | 33 | [jesth.deserializer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/README.md#module-overview) 34 |
35 | No description 36 | 37 | 38 | [jesth.document](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.document/README.md#module-overview) 39 |
40 | Document class for creating model for Jesth data or to interacting with a Jesthfile 41 | 42 | 43 | [jesth.errors](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/README.md#module-overview) 44 |
45 | Errors classes 46 | 47 | 48 | [jesth.misc](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/README.md#module-overview) 49 |
50 | Private miscellaneous functions. Only "split\_key\_value" is public 51 | 52 | 53 | [jesth.parser](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/README.md#module-overview) 54 |
55 | This module exposes read and parse functions that return a document instance 56 | 57 | 58 | [jesth.renderer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.renderer/README.md#module-overview) 59 |
60 | This module exposes render and write functions 61 | 62 | 63 | [jesth.section](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.section/README.md#module-overview) 64 |
65 | Definition of the Section class 66 | 67 | 68 | [jesth.serializer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/README.md#module-overview) 69 |
70 | No description 71 | 72 | 73 | [jesth.tagbyte](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.tagbyte/README.md#module-overview) 74 |
75 | No description 76 | 77 | 78 | [jesth.validator](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/README.md#module-overview) 79 |
80 | No description 81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.box/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.box** 6 | 7 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 8 | 9 | > **Classes:**   [BinInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/BinInt.md#class-binint)    [Comment](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Comment.md#class-comment)    [CommentID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/CommentID.md#class-commentid)    [HexInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/HexInt.md#class-hexint)    [N](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/N.md#class-n)    [OctInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/OctInt.md#class-octint)    [RawString](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawString.md#class-rawstring)    [RawText](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawText.md#class-rawtext)    [Text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Text.md#class-text)    [Whitespace](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Whitespace.md#class-whitespace)    [WhitespaceID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/WhitespaceID.md#class-whitespaceid) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.box/content/classes/BinInt.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.box** 6 | 7 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 8 | 9 | > **Classes:**   [BinInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/BinInt.md#class-binint)    [Comment](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Comment.md#class-comment)    [CommentID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/CommentID.md#class-commentid)    [HexInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/HexInt.md#class-hexint)    [N](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/N.md#class-n)    [OctInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/OctInt.md#class-octint)    [RawString](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawString.md#class-rawstring)    [RawText](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawText.md#class-rawtext)    [Text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Text.md#class-text)    [Whitespace](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Whitespace.md#class-whitespace)    [WhitespaceID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/WhitespaceID.md#class-whitespaceid) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class BinInt 16 | Box to hold binary integer 17 | 18 | ## Base Classes 19 | int 20 | 21 | ## Class Attributes 22 | denominator (inherited from int)    imag (inherited from int)    numerator (inherited from int)    real (inherited from int) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [as\_integer\_ratio](#as_integer_ratio)    [bit\_length](#bit_length)    [from\_bytes](#from_bytes)    [to\_bytes](#to_bytes) 29 | 30 | ## as\_integer\_ratio 31 | Return integer ratio. 32 | 33 | Return a pair of integers, whose ratio is exactly equal to the original int 34 | and with a positive denominator. 35 | 36 | >>> (10).as_integer_ratio() 37 | (10, 1) 38 | >>> (-10).as_integer_ratio() 39 | (-10, 1) 40 | >>> (0).as_integer_ratio() 41 | (0, 1) 42 | 43 | **Inherited from:** int 44 | 45 | **Signature:** (self, /) 46 | 47 | 48 | 49 | 50 | 51 | **Return Value:** None 52 | 53 | [Back to Top](#module-overview) 54 | 55 | 56 | ## bit\_length 57 | Number of bits necessary to represent self in binary. 58 | 59 | >>> bin(37) 60 | '0b100101' 61 | >>> (37).bit_length() 62 | 6 63 | 64 | **Inherited from:** int 65 | 66 | **Signature:** (self, /) 67 | 68 | 69 | 70 | 71 | 72 | **Return Value:** None 73 | 74 | [Back to Top](#module-overview) 75 | 76 | 77 | ## from\_bytes 78 | Return the integer represented by the given array of bytes. 79 | 80 | bytes 81 | Holds the array of bytes to convert. The argument must either 82 | support the buffer protocol or be an iterable object producing bytes. 83 | Bytes and bytearray are examples of built-in objects that support the 84 | buffer protocol. 85 | byteorder 86 | The byte order used to represent the integer. If byteorder is 'big', 87 | the most significant byte is at the beginning of the byte array. If 88 | byteorder is 'little', the most significant byte is at the end of the 89 | byte array. To request the native byte order of the host system, use 90 | `sys.byteorder' as the byte order value. 91 | signed 92 | Indicates whether two's complement is used to represent the integer. 93 | 94 | **Inherited from:** int 95 | 96 | **Signature:** (type, /, bytes, byteorder, \*, signed=False) 97 | 98 | 99 | 100 | 101 | 102 | **Return Value:** None 103 | 104 | [Back to Top](#module-overview) 105 | 106 | 107 | ## to\_bytes 108 | Return an array of bytes representing an integer. 109 | 110 | length 111 | Length of bytes object to use. An OverflowError is raised if the 112 | integer is not representable with the given number of bytes. 113 | byteorder 114 | The byte order used to represent the integer. If byteorder is 'big', 115 | the most significant byte is at the beginning of the byte array. If 116 | byteorder is 'little', the most significant byte is at the end of the 117 | byte array. To request the native byte order of the host system, use 118 | `sys.byteorder' as the byte order value. 119 | signed 120 | Determines whether two's complement is used to represent the integer. 121 | If signed is False and a negative integer is given, an OverflowError 122 | is raised. 123 | 124 | **Inherited from:** int 125 | 126 | **Signature:** (self, /, length, byteorder, \*, signed=False) 127 | 128 | 129 | 130 | 131 | 132 | **Return Value:** None 133 | 134 | [Back to Top](#module-overview) 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.box/content/classes/CommentID.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.box** 6 | 7 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 8 | 9 | > **Classes:**   [BinInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/BinInt.md#class-binint)    [Comment](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Comment.md#class-comment)    [CommentID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/CommentID.md#class-commentid)    [HexInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/HexInt.md#class-hexint)    [N](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/N.md#class-n)    [OctInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/OctInt.md#class-octint)    [RawString](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawString.md#class-rawstring)    [RawText](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawText.md#class-rawtext)    [Text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Text.md#class-text)    [Whitespace](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Whitespace.md#class-whitespace)    [WhitespaceID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/WhitespaceID.md#class-whitespaceid) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class CommentID 16 | Box to hold an unique comment id 17 | 18 | ## Base Classes 19 | int 20 | 21 | ## Class Attributes 22 | denominator (inherited from int)    imag (inherited from int)    numerator (inherited from int)    real (inherited from int) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [as\_integer\_ratio](#as_integer_ratio)    [bit\_length](#bit_length)    [from\_bytes](#from_bytes)    [to\_bytes](#to_bytes) 29 | 30 | ## as\_integer\_ratio 31 | Return integer ratio. 32 | 33 | Return a pair of integers, whose ratio is exactly equal to the original int 34 | and with a positive denominator. 35 | 36 | >>> (10).as_integer_ratio() 37 | (10, 1) 38 | >>> (-10).as_integer_ratio() 39 | (-10, 1) 40 | >>> (0).as_integer_ratio() 41 | (0, 1) 42 | 43 | **Inherited from:** int 44 | 45 | **Signature:** (self, /) 46 | 47 | 48 | 49 | 50 | 51 | **Return Value:** None 52 | 53 | [Back to Top](#module-overview) 54 | 55 | 56 | ## bit\_length 57 | Number of bits necessary to represent self in binary. 58 | 59 | >>> bin(37) 60 | '0b100101' 61 | >>> (37).bit_length() 62 | 6 63 | 64 | **Inherited from:** int 65 | 66 | **Signature:** (self, /) 67 | 68 | 69 | 70 | 71 | 72 | **Return Value:** None 73 | 74 | [Back to Top](#module-overview) 75 | 76 | 77 | ## from\_bytes 78 | Return the integer represented by the given array of bytes. 79 | 80 | bytes 81 | Holds the array of bytes to convert. The argument must either 82 | support the buffer protocol or be an iterable object producing bytes. 83 | Bytes and bytearray are examples of built-in objects that support the 84 | buffer protocol. 85 | byteorder 86 | The byte order used to represent the integer. If byteorder is 'big', 87 | the most significant byte is at the beginning of the byte array. If 88 | byteorder is 'little', the most significant byte is at the end of the 89 | byte array. To request the native byte order of the host system, use 90 | `sys.byteorder' as the byte order value. 91 | signed 92 | Indicates whether two's complement is used to represent the integer. 93 | 94 | **Inherited from:** int 95 | 96 | **Signature:** (type, /, bytes, byteorder, \*, signed=False) 97 | 98 | 99 | 100 | 101 | 102 | **Return Value:** None 103 | 104 | [Back to Top](#module-overview) 105 | 106 | 107 | ## to\_bytes 108 | Return an array of bytes representing an integer. 109 | 110 | length 111 | Length of bytes object to use. An OverflowError is raised if the 112 | integer is not representable with the given number of bytes. 113 | byteorder 114 | The byte order used to represent the integer. If byteorder is 'big', 115 | the most significant byte is at the beginning of the byte array. If 116 | byteorder is 'little', the most significant byte is at the end of the 117 | byte array. To request the native byte order of the host system, use 118 | `sys.byteorder' as the byte order value. 119 | signed 120 | Determines whether two's complement is used to represent the integer. 121 | If signed is False and a negative integer is given, an OverflowError 122 | is raised. 123 | 124 | **Inherited from:** int 125 | 126 | **Signature:** (self, /, length, byteorder, \*, signed=False) 127 | 128 | 129 | 130 | 131 | 132 | **Return Value:** None 133 | 134 | [Back to Top](#module-overview) 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.box/content/classes/HexInt.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.box** 6 | 7 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 8 | 9 | > **Classes:**   [BinInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/BinInt.md#class-binint)    [Comment](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Comment.md#class-comment)    [CommentID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/CommentID.md#class-commentid)    [HexInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/HexInt.md#class-hexint)    [N](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/N.md#class-n)    [OctInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/OctInt.md#class-octint)    [RawString](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawString.md#class-rawstring)    [RawText](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawText.md#class-rawtext)    [Text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Text.md#class-text)    [Whitespace](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Whitespace.md#class-whitespace)    [WhitespaceID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/WhitespaceID.md#class-whitespaceid) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class HexInt 16 | Box to hold hexadecimal integer 17 | 18 | ## Base Classes 19 | int 20 | 21 | ## Class Attributes 22 | denominator (inherited from int)    imag (inherited from int)    numerator (inherited from int)    real (inherited from int) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [as\_integer\_ratio](#as_integer_ratio)    [bit\_length](#bit_length)    [from\_bytes](#from_bytes)    [to\_bytes](#to_bytes) 29 | 30 | ## as\_integer\_ratio 31 | Return integer ratio. 32 | 33 | Return a pair of integers, whose ratio is exactly equal to the original int 34 | and with a positive denominator. 35 | 36 | >>> (10).as_integer_ratio() 37 | (10, 1) 38 | >>> (-10).as_integer_ratio() 39 | (-10, 1) 40 | >>> (0).as_integer_ratio() 41 | (0, 1) 42 | 43 | **Inherited from:** int 44 | 45 | **Signature:** (self, /) 46 | 47 | 48 | 49 | 50 | 51 | **Return Value:** None 52 | 53 | [Back to Top](#module-overview) 54 | 55 | 56 | ## bit\_length 57 | Number of bits necessary to represent self in binary. 58 | 59 | >>> bin(37) 60 | '0b100101' 61 | >>> (37).bit_length() 62 | 6 63 | 64 | **Inherited from:** int 65 | 66 | **Signature:** (self, /) 67 | 68 | 69 | 70 | 71 | 72 | **Return Value:** None 73 | 74 | [Back to Top](#module-overview) 75 | 76 | 77 | ## from\_bytes 78 | Return the integer represented by the given array of bytes. 79 | 80 | bytes 81 | Holds the array of bytes to convert. The argument must either 82 | support the buffer protocol or be an iterable object producing bytes. 83 | Bytes and bytearray are examples of built-in objects that support the 84 | buffer protocol. 85 | byteorder 86 | The byte order used to represent the integer. If byteorder is 'big', 87 | the most significant byte is at the beginning of the byte array. If 88 | byteorder is 'little', the most significant byte is at the end of the 89 | byte array. To request the native byte order of the host system, use 90 | `sys.byteorder' as the byte order value. 91 | signed 92 | Indicates whether two's complement is used to represent the integer. 93 | 94 | **Inherited from:** int 95 | 96 | **Signature:** (type, /, bytes, byteorder, \*, signed=False) 97 | 98 | 99 | 100 | 101 | 102 | **Return Value:** None 103 | 104 | [Back to Top](#module-overview) 105 | 106 | 107 | ## to\_bytes 108 | Return an array of bytes representing an integer. 109 | 110 | length 111 | Length of bytes object to use. An OverflowError is raised if the 112 | integer is not representable with the given number of bytes. 113 | byteorder 114 | The byte order used to represent the integer. If byteorder is 'big', 115 | the most significant byte is at the beginning of the byte array. If 116 | byteorder is 'little', the most significant byte is at the end of the 117 | byte array. To request the native byte order of the host system, use 118 | `sys.byteorder' as the byte order value. 119 | signed 120 | Determines whether two's complement is used to represent the integer. 121 | If signed is False and a negative integer is given, an OverflowError 122 | is raised. 123 | 124 | **Inherited from:** int 125 | 126 | **Signature:** (self, /, length, byteorder, \*, signed=False) 127 | 128 | 129 | 130 | 131 | 132 | **Return Value:** None 133 | 134 | [Back to Top](#module-overview) 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.box/content/classes/N.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.box** 6 | 7 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 8 | 9 | > **Classes:**   [BinInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/BinInt.md#class-binint)    [Comment](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Comment.md#class-comment)    [CommentID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/CommentID.md#class-commentid)    [HexInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/HexInt.md#class-hexint)    [N](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/N.md#class-n)    [OctInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/OctInt.md#class-octint)    [RawString](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawString.md#class-rawstring)    [RawText](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawText.md#class-rawtext)    [Text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Text.md#class-text)    [Whitespace](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Whitespace.md#class-whitespace)    [WhitespaceID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/WhitespaceID.md#class-whitespaceid) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class N 16 | Private class to generate unique identifiers (thread-safe) 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | \_count    \_lock    generate\_id 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.box/content/classes/OctInt.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.box** 6 | 7 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 8 | 9 | > **Classes:**   [BinInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/BinInt.md#class-binint)    [Comment](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Comment.md#class-comment)    [CommentID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/CommentID.md#class-commentid)    [HexInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/HexInt.md#class-hexint)    [N](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/N.md#class-n)    [OctInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/OctInt.md#class-octint)    [RawString](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawString.md#class-rawstring)    [RawText](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawText.md#class-rawtext)    [Text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Text.md#class-text)    [Whitespace](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Whitespace.md#class-whitespace)    [WhitespaceID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/WhitespaceID.md#class-whitespaceid) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class OctInt 16 | Box to hold octal integer 17 | 18 | ## Base Classes 19 | int 20 | 21 | ## Class Attributes 22 | denominator (inherited from int)    imag (inherited from int)    numerator (inherited from int)    real (inherited from int) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [as\_integer\_ratio](#as_integer_ratio)    [bit\_length](#bit_length)    [from\_bytes](#from_bytes)    [to\_bytes](#to_bytes) 29 | 30 | ## as\_integer\_ratio 31 | Return integer ratio. 32 | 33 | Return a pair of integers, whose ratio is exactly equal to the original int 34 | and with a positive denominator. 35 | 36 | >>> (10).as_integer_ratio() 37 | (10, 1) 38 | >>> (-10).as_integer_ratio() 39 | (-10, 1) 40 | >>> (0).as_integer_ratio() 41 | (0, 1) 42 | 43 | **Inherited from:** int 44 | 45 | **Signature:** (self, /) 46 | 47 | 48 | 49 | 50 | 51 | **Return Value:** None 52 | 53 | [Back to Top](#module-overview) 54 | 55 | 56 | ## bit\_length 57 | Number of bits necessary to represent self in binary. 58 | 59 | >>> bin(37) 60 | '0b100101' 61 | >>> (37).bit_length() 62 | 6 63 | 64 | **Inherited from:** int 65 | 66 | **Signature:** (self, /) 67 | 68 | 69 | 70 | 71 | 72 | **Return Value:** None 73 | 74 | [Back to Top](#module-overview) 75 | 76 | 77 | ## from\_bytes 78 | Return the integer represented by the given array of bytes. 79 | 80 | bytes 81 | Holds the array of bytes to convert. The argument must either 82 | support the buffer protocol or be an iterable object producing bytes. 83 | Bytes and bytearray are examples of built-in objects that support the 84 | buffer protocol. 85 | byteorder 86 | The byte order used to represent the integer. If byteorder is 'big', 87 | the most significant byte is at the beginning of the byte array. If 88 | byteorder is 'little', the most significant byte is at the end of the 89 | byte array. To request the native byte order of the host system, use 90 | `sys.byteorder' as the byte order value. 91 | signed 92 | Indicates whether two's complement is used to represent the integer. 93 | 94 | **Inherited from:** int 95 | 96 | **Signature:** (type, /, bytes, byteorder, \*, signed=False) 97 | 98 | 99 | 100 | 101 | 102 | **Return Value:** None 103 | 104 | [Back to Top](#module-overview) 105 | 106 | 107 | ## to\_bytes 108 | Return an array of bytes representing an integer. 109 | 110 | length 111 | Length of bytes object to use. An OverflowError is raised if the 112 | integer is not representable with the given number of bytes. 113 | byteorder 114 | The byte order used to represent the integer. If byteorder is 'big', 115 | the most significant byte is at the beginning of the byte array. If 116 | byteorder is 'little', the most significant byte is at the end of the 117 | byte array. To request the native byte order of the host system, use 118 | `sys.byteorder' as the byte order value. 119 | signed 120 | Determines whether two's complement is used to represent the integer. 121 | If signed is False and a negative integer is given, an OverflowError 122 | is raised. 123 | 124 | **Inherited from:** int 125 | 126 | **Signature:** (self, /, length, byteorder, \*, signed=False) 127 | 128 | 129 | 130 | 131 | 132 | **Return Value:** None 133 | 134 | [Back to Top](#module-overview) 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.box/content/classes/WhitespaceID.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.box** 6 | 7 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 8 | 9 | > **Classes:**   [BinInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/BinInt.md#class-binint)    [Comment](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Comment.md#class-comment)    [CommentID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/CommentID.md#class-commentid)    [HexInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/HexInt.md#class-hexint)    [N](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/N.md#class-n)    [OctInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/OctInt.md#class-octint)    [RawString](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawString.md#class-rawstring)    [RawText](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawText.md#class-rawtext)    [Text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Text.md#class-text)    [Whitespace](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Whitespace.md#class-whitespace)    [WhitespaceID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/WhitespaceID.md#class-whitespaceid) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class WhitespaceID 16 | Box to hold an unique whitespace id 17 | 18 | ## Base Classes 19 | int 20 | 21 | ## Class Attributes 22 | denominator (inherited from int)    imag (inherited from int)    numerator (inherited from int)    real (inherited from int) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [as\_integer\_ratio](#as_integer_ratio)    [bit\_length](#bit_length)    [from\_bytes](#from_bytes)    [to\_bytes](#to_bytes) 29 | 30 | ## as\_integer\_ratio 31 | Return integer ratio. 32 | 33 | Return a pair of integers, whose ratio is exactly equal to the original int 34 | and with a positive denominator. 35 | 36 | >>> (10).as_integer_ratio() 37 | (10, 1) 38 | >>> (-10).as_integer_ratio() 39 | (-10, 1) 40 | >>> (0).as_integer_ratio() 41 | (0, 1) 42 | 43 | **Inherited from:** int 44 | 45 | **Signature:** (self, /) 46 | 47 | 48 | 49 | 50 | 51 | **Return Value:** None 52 | 53 | [Back to Top](#module-overview) 54 | 55 | 56 | ## bit\_length 57 | Number of bits necessary to represent self in binary. 58 | 59 | >>> bin(37) 60 | '0b100101' 61 | >>> (37).bit_length() 62 | 6 63 | 64 | **Inherited from:** int 65 | 66 | **Signature:** (self, /) 67 | 68 | 69 | 70 | 71 | 72 | **Return Value:** None 73 | 74 | [Back to Top](#module-overview) 75 | 76 | 77 | ## from\_bytes 78 | Return the integer represented by the given array of bytes. 79 | 80 | bytes 81 | Holds the array of bytes to convert. The argument must either 82 | support the buffer protocol or be an iterable object producing bytes. 83 | Bytes and bytearray are examples of built-in objects that support the 84 | buffer protocol. 85 | byteorder 86 | The byte order used to represent the integer. If byteorder is 'big', 87 | the most significant byte is at the beginning of the byte array. If 88 | byteorder is 'little', the most significant byte is at the end of the 89 | byte array. To request the native byte order of the host system, use 90 | `sys.byteorder' as the byte order value. 91 | signed 92 | Indicates whether two's complement is used to represent the integer. 93 | 94 | **Inherited from:** int 95 | 96 | **Signature:** (type, /, bytes, byteorder, \*, signed=False) 97 | 98 | 99 | 100 | 101 | 102 | **Return Value:** None 103 | 104 | [Back to Top](#module-overview) 105 | 106 | 107 | ## to\_bytes 108 | Return an array of bytes representing an integer. 109 | 110 | length 111 | Length of bytes object to use. An OverflowError is raised if the 112 | integer is not representable with the given number of bytes. 113 | byteorder 114 | The byte order used to represent the integer. If byteorder is 'big', 115 | the most significant byte is at the beginning of the byte array. If 116 | byteorder is 'little', the most significant byte is at the end of the 117 | byte array. To request the native byte order of the host system, use 118 | `sys.byteorder' as the byte order value. 119 | signed 120 | Determines whether two's complement is used to represent the integer. 121 | If signed is False and a negative integer is given, an OverflowError 122 | is raised. 123 | 124 | **Inherited from:** int 125 | 126 | **Signature:** (self, /, length, byteorder, \*, signed=False) 127 | 128 | 129 | 130 | 131 | 132 | **Return Value:** None 133 | 134 | [Back to Top](#module-overview) 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.box/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.box** 6 | 7 | Boxes to hold contents like Jesth Comments, raw texts, or whitespaces... 8 | 9 | > **Classes:**   [BinInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/BinInt.md#class-binint)    [Comment](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Comment.md#class-comment)    [CommentID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/CommentID.md#class-commentid)    [HexInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/HexInt.md#class-hexint)    [N](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/N.md#class-n)    [OctInt](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/OctInt.md#class-octint)    [RawString](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawString.md#class-rawstring)    [RawText](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/RawText.md#class-rawtext)    [Text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Text.md#class-text)    [Whitespace](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/Whitespace.md#class-whitespace)    [WhitespaceID](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.box/content/classes/WhitespaceID.md#class-whitespaceid) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.const/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.const** 6 | 7 | No description 8 | 9 | > **Classes:**   None 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   HOME    INDENT_WIDTH 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.const/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.const** 6 | 7 | No description 8 | 9 | > **Classes:**   None 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   HOME    INDENT_WIDTH 14 | 15 | # All Functions 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.converter/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.converter** 6 | 7 | Classes and functions to convert a section body into a Python dict, or flatten a Python dict into a section body 8 | 9 | > **Classes:**   [BaseToDict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/BaseToDict.md#class-basetodict)    [Context](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/Context.md#class-context)    [DictToBase](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/DictToBase.md#class-dicttobase)    [ValueConverter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/ValueConverter.md#class-valueconverter) 10 | > 11 | > **Functions:**   [create\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#create_dict)    [decode\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_bin)    [decode\_bool](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_bool)    [decode\_complex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_complex)    [decode\_date](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_date)    [decode\_datetime](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_datetime)    [decode\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_float)    [decode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_integer)    [decode\_null](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_null)    [decode\_raw](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_raw)    [decode\_string](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_string)    [decode\_text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_text)    [decode\_time](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_time)    [decode\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_value)    [encode\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_bin)    [encode\_bool](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_bool)    [encode\_complex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_complex)    [encode\_date](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_date)    [encode\_datetime](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_datetime)    [encode\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_float)    [encode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_integer)    [encode\_null](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_null)    [encode\_raw](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_raw)    [encode\_string](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_string)    [encode\_text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_text)    [encode\_time](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_time)    [encode\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_value)    [flatten\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#flatten_dict) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.converter/content/classes/BaseToDict.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.converter** 6 | 7 | Classes and functions to convert a section body into a Python dict, or flatten a Python dict into a section body 8 | 9 | > **Classes:**   [BaseToDict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/BaseToDict.md#class-basetodict)    [Context](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/Context.md#class-context)    [DictToBase](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/DictToBase.md#class-dicttobase)    [ValueConverter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/ValueConverter.md#class-valueconverter) 10 | > 11 | > **Functions:**   [create\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#create_dict)    [decode\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_bin)    [decode\_bool](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_bool)    [decode\_complex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_complex)    [decode\_date](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_date)    [decode\_datetime](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_datetime)    [decode\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_float)    [decode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_integer)    [decode\_null](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_null)    [decode\_raw](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_raw)    [decode\_string](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_string)    [decode\_text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_text)    [decode\_time](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_time)    [decode\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_value)    [encode\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_bin)    [encode\_bool](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_bool)    [encode\_complex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_complex)    [encode\_date](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_date)    [encode\_datetime](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_datetime)    [encode\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_float)    [encode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_integer)    [encode\_null](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_null)    [encode\_raw](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_raw)    [encode\_string](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_string)    [encode\_text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_text)    [encode\_time](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_time)    [encode\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_value)    [flatten\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#flatten_dict) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class BaseToDict 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | \_add\_whitespace\_to\_parent\_context    \_check\_container\_tag    \_cleanup\_stack    \_finalize\_bin    \_finalize\_raw    \_finalize\_root\_dict    \_finalize\_text    \_prepare\_line    \_process\_line    \_split\_block    \_update\_parent\_context    \_update\_stack    run 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.converter/content/classes/Context.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.converter** 6 | 7 | Classes and functions to convert a section body into a Python dict, or flatten a Python dict into a section body 8 | 9 | > **Classes:**   [BaseToDict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/BaseToDict.md#class-basetodict)    [Context](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/Context.md#class-context)    [DictToBase](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/DictToBase.md#class-dicttobase)    [ValueConverter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/ValueConverter.md#class-valueconverter) 10 | > 11 | > **Functions:**   [create\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#create_dict)    [decode\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_bin)    [decode\_bool](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_bool)    [decode\_complex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_complex)    [decode\_date](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_date)    [decode\_datetime](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_datetime)    [decode\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_float)    [decode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_integer)    [decode\_null](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_null)    [decode\_raw](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_raw)    [decode\_string](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_string)    [decode\_text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_text)    [decode\_time](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_time)    [decode\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_value)    [encode\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_bin)    [encode\_bool](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_bool)    [encode\_complex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_complex)    [encode\_date](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_date)    [encode\_datetime](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_datetime)    [encode\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_float)    [encode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_integer)    [encode\_null](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_null)    [encode\_raw](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_raw)    [encode\_string](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_string)    [encode\_text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_text)    [encode\_time](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_time)    [encode\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_value)    [flatten\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#flatten_dict) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Context 16 | Context(name, collection, indents) 17 | 18 | ## Base Classes 19 | tuple 20 | 21 | ## Class Attributes 22 | \_field\_defaults    \_fields    \_fields\_defaults    \_make    collection    indents    name 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [count](#count)    [index](#index)    [\_asdict](#_asdict)    [\_replace](#_replace) 29 | 30 | ## count 31 | Return number of occurrences of value. 32 | 33 | **Inherited from:** tuple 34 | 35 | **Signature:** (self, value, /) 36 | 37 | 38 | 39 | 40 | 41 | **Return Value:** None 42 | 43 | [Back to Top](#module-overview) 44 | 45 | 46 | ## index 47 | Return first index of value. 48 | 49 | Raises ValueError if the value is not present. 50 | 51 | **Inherited from:** tuple 52 | 53 | **Signature:** (self, value, start=0, stop=9223372036854775807, /) 54 | 55 | 56 | 57 | 58 | 59 | **Return Value:** None 60 | 61 | [Back to Top](#module-overview) 62 | 63 | 64 | ## \_asdict 65 | Return a new dict which maps field names to their values. 66 | 67 | 68 | 69 | **Signature:** (self) 70 | 71 | 72 | 73 | 74 | 75 | **Return Value:** None 76 | 77 | [Back to Top](#module-overview) 78 | 79 | 80 | ## \_replace 81 | Return a new Context object replacing specified fields with new values 82 | 83 | 84 | 85 | **Signature:** (self, /, \*\*kwds) 86 | 87 | 88 | 89 | 90 | 91 | **Return Value:** None 92 | 93 | [Back to Top](#module-overview) 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.converter/content/classes/DictToBase.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.converter** 6 | 7 | Classes and functions to convert a section body into a Python dict, or flatten a Python dict into a section body 8 | 9 | > **Classes:**   [BaseToDict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/BaseToDict.md#class-basetodict)    [Context](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/Context.md#class-context)    [DictToBase](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/DictToBase.md#class-dicttobase)    [ValueConverter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/classes/ValueConverter.md#class-valueconverter) 10 | > 11 | > **Functions:**   [create\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#create_dict)    [decode\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_bin)    [decode\_bool](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_bool)    [decode\_complex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_complex)    [decode\_date](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_date)    [decode\_datetime](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_datetime)    [decode\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_float)    [decode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_integer)    [decode\_null](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_null)    [decode\_raw](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_raw)    [decode\_string](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_string)    [decode\_text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_text)    [decode\_time](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_time)    [decode\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#decode_value)    [encode\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_bin)    [encode\_bool](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_bool)    [encode\_complex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_complex)    [encode\_date](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_date)    [encode\_datetime](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_datetime)    [encode\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_float)    [encode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_integer)    [encode\_null](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_null)    [encode\_raw](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_raw)    [encode\_string](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_string)    [encode\_text](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_text)    [encode\_time](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_time)    [encode\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#encode_value)    [flatten\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.converter/content/functions.md#flatten_dict) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class DictToBase 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | \_handle\_dict    \_handle\_list    \_loop    run 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.dataformat.binary/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.dataformat.binary** 6 | 7 | No description 8 | 9 | > **Classes:**   None 10 | > 11 | > **Functions:**   [deserialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.dataformat.binary/content/functions.md#deserialize)    [serialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.dataformat.binary/content/functions.md#serialize) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.dataformat.binary/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.dataformat.binary** 6 | 7 | No description 8 | 9 | > **Classes:**   None 10 | > 11 | > **Functions:**   [deserialize](#deserialize)    [serialize](#serialize) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [deserialize](#deserialize)    [serialize](#serialize) 17 | 18 | ## deserialize 19 | No description 20 | 21 | 22 | 23 | **Signature:** (raw, value\_converter=None) 24 | 25 | 26 | 27 | 28 | 29 | **Return Value:** None 30 | 31 | [Back to Top](#module-overview) 32 | 33 | 34 | ## serialize 35 | No description 36 | 37 | 38 | 39 | **Signature:** (data, value\_converter=None) 40 | 41 | 42 | 43 | 44 | 45 | **Return Value:** None 46 | 47 | [Back to Top](#module-overview) 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.dataformat.text/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.dataformat.text** 6 | 7 | No description 8 | 9 | > **Classes:**   None 10 | > 11 | > **Functions:**   [decode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.dataformat.text/content/functions.md#decode)    [dump](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.dataformat.text/content/functions.md#dump)    [encode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.dataformat.text/content/functions.md#encode)    [load](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.dataformat.text/content/functions.md#load) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.dataformat.text/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.dataformat.text** 6 | 7 | No description 8 | 9 | > **Classes:**   None 10 | > 11 | > **Functions:**   [decode](#decode)    [dump](#dump)    [encode](#encode)    [load](#load) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [decode](#decode)    [dump](#dump)    [encode](#encode)    [load](#load) 17 | 18 | ## decode 19 | No description 20 | 21 | 22 | 23 | **Signature:** (text, value\_converter=None) 24 | 25 | 26 | 27 | 28 | 29 | **Return Value:** None 30 | 31 | [Back to Top](#module-overview) 32 | 33 | 34 | ## dump 35 | No description 36 | 37 | 38 | 39 | **Signature:** (data, destination, value\_converter=None) 40 | 41 | 42 | 43 | 44 | 45 | **Return Value:** None 46 | 47 | [Back to Top](#module-overview) 48 | 49 | 50 | ## encode 51 | No description 52 | 53 | 54 | 55 | **Signature:** (data, value\_converter=None) 56 | 57 | 58 | 59 | 60 | 61 | **Return Value:** None 62 | 63 | [Back to Top](#module-overview) 64 | 65 | 66 | ## load 67 | Load data from a file or file object 68 | 69 | 70 | 71 | **Signature:** (source, value\_converter=None) 72 | 73 | 74 | 75 | 76 | 77 | **Return Value:** None 78 | 79 | [Back to Top](#module-overview) 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.deserializer/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.deserializer** 6 | 7 | No description 8 | 9 | > **Classes:**   [Deserializer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/classes/Deserializer.md#class-deserializer) 10 | > 11 | > **Functions:**   [deserialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/functions.md#deserialize)    [extract\_version](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/functions.md#extract_version)    [read\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/functions.md#read_integer)    [read\_tag](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/functions.md#read_tag) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.deserializer/content/classes/Deserializer.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.deserializer** 6 | 7 | No description 8 | 9 | > **Classes:**   [Deserializer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/classes/Deserializer.md#class-deserializer) 10 | > 11 | > **Functions:**   [deserialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/functions.md#deserialize)    [extract\_version](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/functions.md#extract_version)    [read\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/functions.md#read_integer)    [read\_tag](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/functions.md#read_tag) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Deserializer 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [\_\_init\_\_](#__init__)    [run](#run)    [\_check\_version](#_check_version)    [\_increment](#_increment)    [\_interpret\_tag](#_interpret_tag)    [\_run](#_run)    [\_setup](#_setup) 29 | 30 | ## \_\_init\_\_ 31 | Initialize self. See help(type(self)) for accurate signature. 32 | 33 | 34 | 35 | **Signature:** (self, raw) 36 | 37 | 38 | 39 | 40 | 41 | **Return Value:** None 42 | 43 | [Back to Top](#module-overview) 44 | 45 | 46 | ## run 47 | No description 48 | 49 | 50 | 51 | **Signature:** (self) 52 | 53 | 54 | 55 | 56 | 57 | **Return Value:** None 58 | 59 | [Back to Top](#module-overview) 60 | 61 | 62 | ## \_check\_version 63 | No description 64 | 65 | 66 | 67 | **Signature:** (self) 68 | 69 | 70 | 71 | 72 | 73 | **Return Value:** None 74 | 75 | [Back to Top](#module-overview) 76 | 77 | 78 | ## \_increment 79 | No description 80 | 81 | 82 | 83 | **Signature:** (self, n=1) 84 | 85 | 86 | 87 | 88 | 89 | **Return Value:** None 90 | 91 | [Back to Top](#module-overview) 92 | 93 | 94 | ## \_interpret\_tag 95 | No description 96 | 97 | 98 | 99 | **Signature:** (self, tag) 100 | 101 | 102 | 103 | 104 | 105 | **Return Value:** None 106 | 107 | [Back to Top](#module-overview) 108 | 109 | 110 | ## \_run 111 | No description 112 | 113 | 114 | 115 | **Signature:** (self, containers) 116 | 117 | 118 | 119 | 120 | 121 | **Return Value:** None 122 | 123 | [Back to Top](#module-overview) 124 | 125 | 126 | ## \_setup 127 | No description 128 | 129 | 130 | 131 | **Signature:** (self) 132 | 133 | 134 | 135 | 136 | 137 | **Return Value:** None 138 | 139 | [Back to Top](#module-overview) 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.deserializer/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.deserializer** 6 | 7 | No description 8 | 9 | > **Classes:**   [Deserializer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.deserializer/content/classes/Deserializer.md#class-deserializer) 10 | > 11 | > **Functions:**   [deserialize](#deserialize)    [extract\_version](#extract_version)    [read\_integer](#read_integer)    [read\_tag](#read_tag) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [deserialize](#deserialize)    [extract\_version](#extract_version)    [read\_integer](#read_integer)    [read\_tag](#read_tag) 17 | 18 | ## deserialize 19 | No description 20 | 21 | 22 | 23 | **Signature:** (raw) 24 | 25 | 26 | 27 | 28 | 29 | **Return Value:** None 30 | 31 | [Back to Top](#module-overview) 32 | 33 | 34 | ## extract\_version 35 | No description 36 | 37 | 38 | 39 | **Signature:** (raw) 40 | 41 | 42 | 43 | 44 | 45 | **Return Value:** None 46 | 47 | [Back to Top](#module-overview) 48 | 49 | 50 | ## read\_integer 51 | No description 52 | 53 | 54 | 55 | **Signature:** (raw, index) 56 | 57 | 58 | 59 | 60 | 61 | **Return Value:** None 62 | 63 | [Back to Top](#module-overview) 64 | 65 | 66 | ## read\_tag 67 | No description 68 | 69 | 70 | 71 | **Signature:** (raw, index) 72 | 73 | 74 | 75 | 76 | 77 | **Return Value:** None 78 | 79 | [Back to Top](#module-overview) 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.document/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.document** 6 | 7 | Document class for creating model for Jesth data or to interacting with a Jesthfile 8 | 9 | > **Classes:**   [Document](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.document/content/classes/Document.md#class-document) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.document/content/classes/Document.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.document** 6 | 7 | Document class for creating model for Jesth data or to interacting with a Jesthfile 8 | 9 | > **Classes:**   [Document](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.document/content/classes/Document.md#class-document) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Document 16 | Create a model for Jesth data or for interacting with a JesthFile 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | |Property|Type|Description|Inherited from| 26 | |---|---|---|---| 27 | |headers|getter|None|| 28 | |path|getter|None|| 29 | |path|setter|None|| 30 | |schema|getter|None|| 31 | |sections|getter|None|| 32 | |sections|setter|None|| 33 | |value_converter|getter|None|| 34 | 35 | 36 | 37 | # All Methods 38 | [\_\_init\_\_](#__init__)    [append](#append)    [bind\_schema](#bind_schema)    [count](#count)    [get](#get)    [get\_all](#get_all)    [insert](#insert)    [remove](#remove)    [remove\_all](#remove_all)    [render](#render)    [save](#save)    [save\_to](#save_to)    [set](#set)    [unbind\_schema](#unbind_schema)    [validate](#validate)    [\_create\_model](#_create_model)    [\_find\_section\_to\_remove](#_find_section_to_remove)    [\_insert](#_insert)    [\_setup](#_setup)    [\_update\_model](#_update_model) 39 | 40 | ## \_\_init\_\_ 41 | Init the document 42 | 43 | 44 | 45 | **Signature:** (self, path=None, sections=None, \*, value\_converter=None) 46 | 47 | |Parameter|Description| 48 | |---|---| 49 | |path|if the document is linked to a JesthFile,`path` contains the path to this file. Path might also be a pathlib.Path instance.| 50 | |sections|list of sections (or tuple)| 51 | |value\_converter|an instance of jesth.converter.ValueConverter| 52 | 53 | 54 | 55 | 56 | 57 | **Return Value:** None 58 | 59 | [Back to Top](#module-overview) 60 | 61 | 62 | ## append 63 | Create a new section then append it to the end of this document 64 | 65 | 66 | 67 | **Signature:** (self, header, body=None) 68 | 69 | |Parameter|Description| 70 | |---|---| 71 | |header|the header (string) of the new section| 72 | |body|the body of this section as a string or a list of strings| 73 | 74 | 75 | 76 | 77 | 78 | **Return Value:** None 79 | 80 | [Back to Top](#module-overview) 81 | 82 | 83 | ## bind\_schema 84 | No description 85 | 86 | 87 | 88 | **Signature:** (self) 89 | 90 | 91 | 92 | 93 | 94 | **Return Value:** None 95 | 96 | [Back to Top](#module-overview) 97 | 98 | 99 | ## count 100 | Count the number of sections whose headers match with the 101 | `header` parameter 102 | 103 | 104 | 105 | **Signature:** (self, header) 106 | 107 | |Parameter|Description| 108 | |---|---| 109 | |header|the header (string) of the sections| 110 | 111 | 112 | 113 | 114 | 115 | **Return Value:** Returns the integer number of sections matching with the `header` parameter 116 | 117 | [Back to Top](#module-overview) 118 | 119 | 120 | ## get 121 | Get X named section object located at Y index relatively to others sections with same header 122 | 123 | 124 | 125 | **Signature:** (self, header, sub\_index=0) 126 | 127 | |Parameter|Description| 128 | |---|---| 129 | |header|the header (string) of the section| 130 | |index|integer index, relatively to the section family (sections sharing this same header). Defaults to 0, thus will be returned, the first section with this header relatively to this header family.| 131 | 132 | 133 | 134 | 135 | 136 | **Return Value:** Returns a section or None 137 | 138 | [Back to Top](#module-overview) 139 | 140 | 141 | ## get\_all 142 | Get all sections sharing same header 143 | 144 | 145 | 146 | **Signature:** (self, header) 147 | 148 | |Parameter|Description| 149 | |---|---| 150 | |header|the header (string) of the sections| 151 | 152 | 153 | 154 | 155 | 156 | **Return Value:** Returns a list of sections whose headers match with the `header` parameter. 157 | 158 | [Back to Top](#module-overview) 159 | 160 | 161 | ## insert 162 | Create a new section then insert it in the document at a specific index 163 | 164 | 165 | 166 | **Signature:** (self, index, header, body=None) 167 | 168 | |Parameter|Description| 169 | |---|---| 170 | |index|integer index (absolute index). Accepts -1 to mimic the "append" method| 171 | |header|the header (string) of the new section| 172 | |body|the body of this section as a string or a list of strings| 173 | 174 | 175 | 176 | 177 | 178 | **Return Value:** None 179 | 180 | [Back to Top](#module-overview) 181 | 182 | 183 | ## remove 184 | Remove a section from this document 185 | 186 | 187 | 188 | **Signature:** (self, header, sub\_index=-1) 189 | 190 | |Parameter|Description| 191 | |---|---| 192 | |header|the header of the section to remove| 193 | |index|the index (integer) of the section relatively to its family (sections sharing same header). Defaults to -1, thus the last section of the given header family will be removed from the document| 194 | 195 | 196 | 197 | 198 | 199 | **Return Value:** None 200 | 201 | [Back to Top](#module-overview) 202 | 203 | 204 | ## remove\_all 205 | Remove all sections with this specific header 206 | 207 | 208 | 209 | **Signature:** (self, header) 210 | 211 | |Parameter|Description| 212 | |---|---| 213 | |header|the header of the section to remove| 214 | 215 | 216 | 217 | 218 | 219 | **Return Value:** None 220 | 221 | [Back to Top](#module-overview) 222 | 223 | 224 | ## render 225 | Render the entire document or a specific set of sections, i.e., 226 | returns a Jesth string that may be stored in a file. 227 | 228 | 229 | 230 | **Signature:** (self, \*headers, spacing=1) 231 | 232 | |Parameter|Description| 233 | |---|---| 234 | |\*headers|Headers of sections to render. Omitting this will render the entire section| 235 | |spacing|number of empty lines between two adjacent sections. Defaults to 1 empty line.| 236 | 237 | 238 | 239 | 240 | 241 | **Return Value:** Returns a string that contains sections (each made of square-brackets delimited header 242 | and associated body) 243 | 244 | [Back to Top](#module-overview) 245 | 246 | 247 | ## save 248 | Save the recent modifications if this document is linked to a JesthFile, 249 | i.e., the path parameter has been set. 250 | 251 | 252 | 253 | **Signature:** (self) 254 | 255 | 256 | 257 | 258 | 259 | **Return Value:** Returns True or False 260 | 261 | [Back to Top](#module-overview) 262 | 263 | 264 | ## save\_to 265 | Save the document in a specific filename 266 | 267 | 268 | 269 | **Signature:** (self, path) 270 | 271 | |Parameter|Description| 272 | |---|---| 273 | |path|path to filename. Path may be a pathlib.Path instance| 274 | 275 | 276 | 277 | 278 | 279 | **Return Value:** None 280 | 281 | [Back to Top](#module-overview) 282 | 283 | 284 | ## set 285 | Set a section at a specific index of the document 286 | 287 | 288 | 289 | **Signature:** (self, index, header, body=None) 290 | 291 | |Parameter|Description| 292 | |---|---| 293 | |index|the index integer| 294 | |header|the header string of the section| 295 | |body|the body of the section, may be a list of string, a dictionary, or a text string| 296 | 297 | 298 | 299 | 300 | 301 | **Return Value:** None 302 | 303 | [Back to Top](#module-overview) 304 | 305 | 306 | ## unbind\_schema 307 | No description 308 | 309 | 310 | 311 | **Signature:** (self) 312 | 313 | 314 | 315 | 316 | 317 | **Return Value:** None 318 | 319 | [Back to Top](#module-overview) 320 | 321 | 322 | ## validate 323 | Validate this document 324 | 325 | 326 | 327 | **Signature:** (self, \*headers) 328 | 329 | |Parameter|Description| 330 | |---|---| 331 | |\*headers|headers to validate. If you ignore this parameter, the document will be checked against the schema.| 332 | 333 | 334 | 335 | 336 | 337 | **Return Value:** Return true if the document is valid. Raise an exception if the schema is missing 338 | 339 | [Back to Top](#module-overview) 340 | 341 | 342 | ## \_create\_model 343 | No description 344 | 345 | 346 | 347 | **Signature:** (self) 348 | 349 | 350 | 351 | 352 | 353 | **Return Value:** None 354 | 355 | [Back to Top](#module-overview) 356 | 357 | 358 | ## \_find\_section\_to\_remove 359 | No description 360 | 361 | 362 | 363 | **Signature:** (self, index) 364 | 365 | 366 | 367 | 368 | 369 | **Return Value:** None 370 | 371 | [Back to Top](#module-overview) 372 | 373 | 374 | ## \_insert 375 | No description 376 | 377 | 378 | 379 | **Signature:** (self, index, header, body) 380 | 381 | 382 | 383 | 384 | 385 | **Return Value:** None 386 | 387 | [Back to Top](#module-overview) 388 | 389 | 390 | ## \_setup 391 | No description 392 | 393 | 394 | 395 | **Signature:** (self) 396 | 397 | 398 | 399 | 400 | 401 | **Return Value:** None 402 | 403 | [Back to Top](#module-overview) 404 | 405 | 406 | ## \_update\_model 407 | No description 408 | 409 | 410 | 411 | **Signature:** (self, header, index, section) 412 | 413 | 414 | 415 | 416 | 417 | **Return Value:** None 418 | 419 | [Back to Top](#module-overview) 420 | 421 | 422 | 423 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.document/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.document** 6 | 7 | Document class for creating model for Jesth data or to interacting with a Jesthfile 8 | 9 | > **Classes:**   [Document](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.document/content/classes/Document.md#class-document) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.errors/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.errors** 6 | 7 | Errors classes 8 | 9 | > **Classes:**   [ConversionError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/ConversionError.md#class-conversionerror)    [Error](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/Error.md#class-error)    [IndentError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/IndentError.md#class-indenterror) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.errors/content/classes/ConversionError.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.errors** 6 | 7 | Errors classes 8 | 9 | > **Classes:**   [ConversionError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/ConversionError.md#class-conversionerror)    [Error](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/Error.md#class-error)    [IndentError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/IndentError.md#class-indenterror) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class ConversionError 16 | Error class for issues during data conversion 17 | 18 | ## Base Classes 19 | jesth.errors.Error 20 | 21 | ## Class Attributes 22 | args (inherited from BaseException) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [\_\_init\_\_](#__init__) 29 | 30 | ## \_\_init\_\_ 31 | Initialize self. See help(type(self)) for accurate signature. 32 | 33 | **Inherited from:** Exception 34 | 35 | **Signature:** (self, /, \*args, \*\*kwargs) 36 | 37 | 38 | 39 | 40 | 41 | **Return Value:** None 42 | 43 | [Back to Top](#module-overview) 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.errors/content/classes/Error.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.errors** 6 | 7 | Errors classes 8 | 9 | > **Classes:**   [ConversionError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/ConversionError.md#class-conversionerror)    [Error](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/Error.md#class-error)    [IndentError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/IndentError.md#class-indenterror) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Error 16 | Root errors class for the Jesth Python library 17 | 18 | ## Base Classes 19 | Exception 20 | 21 | ## Class Attributes 22 | args (inherited from BaseException) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [\_\_init\_\_](#__init__) 29 | 30 | ## \_\_init\_\_ 31 | Initialize self. See help(type(self)) for accurate signature. 32 | 33 | **Inherited from:** Exception 34 | 35 | **Signature:** (self, /, \*args, \*\*kwargs) 36 | 37 | 38 | 39 | 40 | 41 | **Return Value:** None 42 | 43 | [Back to Top](#module-overview) 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.errors/content/classes/IndentError.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.errors** 6 | 7 | Errors classes 8 | 9 | > **Classes:**   [ConversionError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/ConversionError.md#class-conversionerror)    [Error](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/Error.md#class-error)    [IndentError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/IndentError.md#class-indenterror) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class IndentError 16 | Indent errors while parsing a section body 17 | 18 | ## Base Classes 19 | jesth.errors.Error 20 | 21 | ## Class Attributes 22 | args (inherited from BaseException) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [\_\_init\_\_](#__init__) 29 | 30 | ## \_\_init\_\_ 31 | Initialize self. See help(type(self)) for accurate signature. 32 | 33 | **Inherited from:** Exception 34 | 35 | **Signature:** (self, /, \*args, \*\*kwargs) 36 | 37 | 38 | 39 | 40 | 41 | **Return Value:** None 42 | 43 | [Back to Top](#module-overview) 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.errors/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.errors** 6 | 7 | Errors classes 8 | 9 | > **Classes:**   [ConversionError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/ConversionError.md#class-conversionerror)    [Error](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/Error.md#class-error)    [IndentError](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.errors/content/classes/IndentError.md#class-indenterror) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.misc/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.misc** 6 | 7 | Private miscellaneous functions. Only "split_key_value" is public 8 | 9 | > **Classes:**   [FloatParts](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/classes/FloatParts.md#class-floatparts)    [WriteToFile](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/classes/WriteToFile.md#class-writetofile) 10 | > 11 | > **Functions:**   [\_parse\_mantissa](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_parse_mantissa)    [\_prepare\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_prepare_float)    [\_tidy\_up\_right\_mantissa](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_tidy_up_right_mantissa)    [add\_leading\_backslashes](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#add_leading_backslashes)    [clean\_leading\_backslashes](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#clean_leading_backslashes)    [correct\_index](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#correct_index)    [count\_indents](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#count_indents)    [decode\_unicode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#decode_unicode)    [encode\_unicode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#encode_unicode)    [ensure\_parent\_dir](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#ensure_parent_dir)    [get\_headers](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#get_headers)    [parse\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#parse_float)    [split\_key\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#split_key_value)    [tidy\_up\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_bin)    [tidy\_up\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_float)    [tidy\_up\_hex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_hex)    [tidy\_up\_int](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_int)    [tidy\_up\_oct](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_oct)    [write\_to\_file](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#write_to_file) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.misc/content/classes/FloatParts.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.misc** 6 | 7 | Private miscellaneous functions. Only "split_key_value" is public 8 | 9 | > **Classes:**   [FloatParts](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/classes/FloatParts.md#class-floatparts)    [WriteToFile](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/classes/WriteToFile.md#class-writetofile) 10 | > 11 | > **Functions:**   [\_parse\_mantissa](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_parse_mantissa)    [\_prepare\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_prepare_float)    [\_tidy\_up\_right\_mantissa](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_tidy_up_right_mantissa)    [add\_leading\_backslashes](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#add_leading_backslashes)    [clean\_leading\_backslashes](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#clean_leading_backslashes)    [correct\_index](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#correct_index)    [count\_indents](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#count_indents)    [decode\_unicode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#decode_unicode)    [encode\_unicode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#encode_unicode)    [ensure\_parent\_dir](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#ensure_parent_dir)    [get\_headers](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#get_headers)    [parse\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#parse_float)    [split\_key\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#split_key_value)    [tidy\_up\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_bin)    [tidy\_up\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_float)    [tidy\_up\_hex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_hex)    [tidy\_up\_int](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_int)    [tidy\_up\_oct](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_oct)    [write\_to\_file](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#write_to_file) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class FloatParts 16 | FloatParts(left_mantissa, right_mantissa, exponent) 17 | 18 | ## Base Classes 19 | tuple 20 | 21 | ## Class Attributes 22 | \_field\_defaults    \_fields    \_fields\_defaults    \_make    exponent    left\_mantissa    right\_mantissa 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [count](#count)    [index](#index)    [\_asdict](#_asdict)    [\_replace](#_replace) 29 | 30 | ## count 31 | Return number of occurrences of value. 32 | 33 | **Inherited from:** tuple 34 | 35 | **Signature:** (self, value, /) 36 | 37 | 38 | 39 | 40 | 41 | **Return Value:** None 42 | 43 | [Back to Top](#module-overview) 44 | 45 | 46 | ## index 47 | Return first index of value. 48 | 49 | Raises ValueError if the value is not present. 50 | 51 | **Inherited from:** tuple 52 | 53 | **Signature:** (self, value, start=0, stop=9223372036854775807, /) 54 | 55 | 56 | 57 | 58 | 59 | **Return Value:** None 60 | 61 | [Back to Top](#module-overview) 62 | 63 | 64 | ## \_asdict 65 | Return a new dict which maps field names to their values. 66 | 67 | 68 | 69 | **Signature:** (self) 70 | 71 | 72 | 73 | 74 | 75 | **Return Value:** None 76 | 77 | [Back to Top](#module-overview) 78 | 79 | 80 | ## \_replace 81 | Return a new FloatParts object replacing specified fields with new values 82 | 83 | 84 | 85 | **Signature:** (self, /, \*\*kwds) 86 | 87 | 88 | 89 | 90 | 91 | **Return Value:** None 92 | 93 | [Back to Top](#module-overview) 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.misc/content/classes/WriteToFile.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.misc** 6 | 7 | Private miscellaneous functions. Only "split_key_value" is public 8 | 9 | > **Classes:**   [FloatParts](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/classes/FloatParts.md#class-floatparts)    [WriteToFile](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/classes/WriteToFile.md#class-writetofile) 10 | > 11 | > **Functions:**   [\_parse\_mantissa](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_parse_mantissa)    [\_prepare\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_prepare_float)    [\_tidy\_up\_right\_mantissa](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#_tidy_up_right_mantissa)    [add\_leading\_backslashes](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#add_leading_backslashes)    [clean\_leading\_backslashes](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#clean_leading_backslashes)    [correct\_index](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#correct_index)    [count\_indents](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#count_indents)    [decode\_unicode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#decode_unicode)    [encode\_unicode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#encode_unicode)    [ensure\_parent\_dir](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#ensure_parent_dir)    [get\_headers](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#get_headers)    [parse\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#parse_float)    [split\_key\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#split_key_value)    [tidy\_up\_bin](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_bin)    [tidy\_up\_float](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_float)    [tidy\_up\_hex](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_hex)    [tidy\_up\_int](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_int)    [tidy\_up\_oct](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#tidy_up_oct)    [write\_to\_file](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/functions.md#write_to_file) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class WriteToFile 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | \_write    full\_sync    sync\_dir    sync\_file    write 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.misc/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.misc** 6 | 7 | Private miscellaneous functions. Only "split_key_value" is public 8 | 9 | > **Classes:**   [FloatParts](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/classes/FloatParts.md#class-floatparts)    [WriteToFile](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.misc/content/classes/WriteToFile.md#class-writetofile) 10 | > 11 | > **Functions:**   [\_parse\_mantissa](#_parse_mantissa)    [\_prepare\_float](#_prepare_float)    [\_tidy\_up\_right\_mantissa](#_tidy_up_right_mantissa)    [add\_leading\_backslashes](#add_leading_backslashes)    [clean\_leading\_backslashes](#clean_leading_backslashes)    [correct\_index](#correct_index)    [count\_indents](#count_indents)    [decode\_unicode](#decode_unicode)    [encode\_unicode](#encode_unicode)    [ensure\_parent\_dir](#ensure_parent_dir)    [get\_headers](#get_headers)    [parse\_float](#parse_float)    [split\_key\_value](#split_key_value)    [tidy\_up\_bin](#tidy_up_bin)    [tidy\_up\_float](#tidy_up_float)    [tidy\_up\_hex](#tidy_up_hex)    [tidy\_up\_int](#tidy_up_int)    [tidy\_up\_oct](#tidy_up_oct)    [write\_to\_file](#write_to_file) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [\_parse\_mantissa](#_parse_mantissa)    [\_prepare\_float](#_prepare_float)    [\_tidy\_up\_right\_mantissa](#_tidy_up_right_mantissa)    [add\_leading\_backslashes](#add_leading_backslashes)    [clean\_leading\_backslashes](#clean_leading_backslashes)    [correct\_index](#correct_index)    [count\_indents](#count_indents)    [decode\_unicode](#decode_unicode)    [encode\_unicode](#encode_unicode)    [ensure\_parent\_dir](#ensure_parent_dir)    [get\_headers](#get_headers)    [parse\_float](#parse_float)    [split\_key\_value](#split_key_value)    [tidy\_up\_bin](#tidy_up_bin)    [tidy\_up\_float](#tidy_up_float)    [tidy\_up\_hex](#tidy_up_hex)    [tidy\_up\_int](#tidy_up_int)    [tidy\_up\_oct](#tidy_up_oct)    [write\_to\_file](#write_to_file) 17 | 18 | ## \_parse\_mantissa 19 | No description 20 | 21 | 22 | 23 | **Signature:** (s) 24 | 25 | 26 | 27 | 28 | 29 | **Return Value:** None 30 | 31 | [Back to Top](#module-overview) 32 | 33 | 34 | ## \_prepare\_float 35 | No description 36 | 37 | 38 | 39 | **Signature:** (s) 40 | 41 | 42 | 43 | 44 | 45 | **Return Value:** None 46 | 47 | [Back to Top](#module-overview) 48 | 49 | 50 | ## \_tidy\_up\_right\_mantissa 51 | No description 52 | 53 | 54 | 55 | **Signature:** (s, width) 56 | 57 | 58 | 59 | 60 | 61 | **Return Value:** None 62 | 63 | [Back to Top](#module-overview) 64 | 65 | 66 | ## add\_leading\_backslashes 67 | Add one leading backslash only when the immediately-or-lately first non-backlash 68 | character on the line is an opening square bracket. 69 | 70 | 71 | 72 | **Signature:** (line) 73 | 74 | 75 | 76 | 77 | 78 | **Return Value:** None 79 | 80 | [Back to Top](#module-overview) 81 | 82 | 83 | ## clean\_leading\_backslashes 84 | Remove one leading backslash only when the immediately-or-lately first non-backlash 85 | character on the line is an opening square bracket. 86 | 87 | 88 | 89 | **Signature:** (line) 90 | 91 | 92 | 93 | 94 | 95 | **Return Value:** None 96 | 97 | [Back to Top](#module-overview) 98 | 99 | 100 | ## correct\_index 101 | Correct an index given to access an item in a list 102 | 103 | 104 | 105 | **Signature:** (index, size, ignore\_upper\_bound=False) 106 | 107 | 108 | 109 | 110 | 111 | **Return Value:** Return a corrected index integer 112 | 113 | [Back to Top](#module-overview) 114 | 115 | 116 | ## count\_indents 117 | No description 118 | 119 | 120 | 121 | **Signature:** (line) 122 | 123 | 124 | 125 | 126 | 127 | **Return Value:** None 128 | 129 | [Back to Top](#module-overview) 130 | 131 | 132 | ## decode\_unicode 133 | Take in input some string that might have Unicode escape sequences. 134 | Output the same string with unicode escape sequences converted into 135 | the actual characters that they represent 136 | 137 | 138 | 139 | **Signature:** (text) 140 | 141 | 142 | 143 | 144 | 145 | **Return Value:** None 146 | 147 | [Back to Top](#module-overview) 148 | 149 | 150 | ## encode\_unicode 151 | Convert a string into another where non-latin characters are 152 | replaced with Unicode escape sequences 153 | 154 | 155 | 156 | **Signature:** (text, codec='latin-1') 157 | 158 | 159 | 160 | 161 | 162 | **Return Value:** None 163 | 164 | [Back to Top](#module-overview) 165 | 166 | 167 | ## ensure\_parent\_dir 168 | Make sure that parent dir exists (create it if isn't yet created) 169 | 170 | 171 | 172 | **Signature:** (path) 173 | 174 | 175 | 176 | 177 | 178 | **Return Value:** None 179 | 180 | [Back to Top](#module-overview) 181 | 182 | 183 | ## get\_headers 184 | returns the set of headers from this list of sections 185 | 186 | 187 | 188 | **Signature:** (sections) 189 | 190 | 191 | 192 | 193 | 194 | **Return Value:** None 195 | 196 | [Back to Top](#module-overview) 197 | 198 | 199 | ## parse\_float 200 | Parse a float number (string or decimal.Decimal or float), returns 201 | an instance of this namedtuple: 202 | FloatParts = namedtuple("FloatParts", ["left_mantissa", "right_mantissa", "exponent"]) 203 | 204 | 205 | 206 | **Signature:** (s) 207 | 208 | 209 | 210 | 211 | 212 | **Return Value:** None 213 | 214 | [Back to Top](#module-overview) 215 | 216 | 217 | ## split\_key\_value 218 | Split a line (string) into key and value parts. 219 | The string must have a separator (defaults to "="). 220 | An example of a valid string is "name = John Doe ". 221 | The return will be: ("name": "John Doe") 222 | 223 | 224 | 225 | **Signature:** (line, sep='=', strip\_whitespace=True) 226 | 227 | |Parameter|Description| 228 | |---|---| 229 | |line|the string to split| 230 | |sep|the separator, by default it is "="| 231 | |strip\_whitespace|boolean to tell whether you want whitespace at each side of the key and value to be stripped out or not. By default, the value is True.| 232 | 233 | 234 | 235 | |Exception|Description| 236 | |---|---| 237 | |errors.Error|if the separator, the key, or the value is missing,| 238 | 239 | 240 | 241 | **Return Value:** Returns a ("key", "value") tuple if everything is Ok 242 | 243 | [Back to Top](#module-overview) 244 | 245 | 246 | ## tidy\_up\_bin 247 | Tidy up some bin int number (str or int) 248 | Example: 0b10011101011 -> 0b100_1110_1011 249 | 250 | 251 | 252 | **Signature:** (s, width=4) 253 | 254 | 255 | 256 | 257 | 258 | **Return Value:** None 259 | 260 | [Back to Top](#module-overview) 261 | 262 | 263 | ## tidy\_up\_float 264 | Tidy up a float number (str or float or decimal.Decimal) 265 | Example: 3.141234 -> 3.141_234 266 | 267 | 268 | 269 | **Signature:** (s, width=3) 270 | 271 | 272 | 273 | 274 | 275 | **Return Value:** None 276 | 277 | [Back to Top](#module-overview) 278 | 279 | 280 | ## tidy\_up\_hex 281 | Tidy up some hex int number (str or int) 282 | Example: 0xA3001F12A34 -> 0xA30_01F1_2A34 283 | 284 | 285 | 286 | **Signature:** (s, width=4) 287 | 288 | 289 | 290 | 291 | 292 | **Return Value:** None 293 | 294 | [Back to Top](#module-overview) 295 | 296 | 297 | ## tidy\_up\_int 298 | Tidy up some int number (str or int) 299 | Example: 300141234 -> 300_141_234 300 | 301 | 302 | 303 | **Signature:** (s, width=3) 304 | 305 | 306 | 307 | 308 | 309 | **Return Value:** None 310 | 311 | [Back to Top](#module-overview) 312 | 313 | 314 | ## tidy\_up\_oct 315 | Tidy up some oct int number (str or int) 316 | Example: 0o45631456202 -> 0o456_3145_6202 317 | 318 | 319 | 320 | **Signature:** (s, width=4) 321 | 322 | 323 | 324 | 325 | 326 | **Return Value:** None 327 | 328 | [Back to Top](#module-overview) 329 | 330 | 331 | ## write\_to\_file 332 | Write to a file (TRY to do it atomically for GNU/Linux and MacOS) 333 | Check https://danluu.com/file-consistency/ 334 | 335 | 336 | 337 | **Signature:** (data, dest) 338 | 339 | |Parameter|Description| 340 | |---|---| 341 | |data|str, data to write to file| 342 | |dest|a pathlib.Path instance, or a path string| 343 | |binary\_mode|boolean to tell if data should be written in dest with binary mode on (mode="wb")| 344 | |encoding|defaults to "utf-8" and automatically set to None when binary mode is True| 345 | 346 | 347 | 348 | 349 | 350 | **Return Value:** None 351 | 352 | [Back to Top](#module-overview) 353 | 354 | 355 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.parser/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.parser** 6 | 7 | This module exposes read and parse functions that return a document instance 8 | 9 | > **Classes:**   [Parser](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/classes/Parser.md#class-parser) 10 | > 11 | > **Functions:**   [\_read\_file\_object](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/functions.md#_read_file_object)    [parse](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/functions.md#parse)    [read](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/functions.md#read) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.parser/content/classes/Parser.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.parser** 6 | 7 | This module exposes read and parse functions that return a document instance 8 | 9 | > **Classes:**   [Parser](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/classes/Parser.md#class-parser) 10 | > 11 | > **Functions:**   [\_read\_file\_object](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/functions.md#_read_file_object)    [parse](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/functions.md#parse)    [read](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/functions.md#read) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Parser 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | |Property|Type|Description|Inherited from| 26 | |---|---|---|---| 27 | |feedable|getter|Isn't anymore feedable when the `[[END]]` tag is encountered|| 28 | |sections|getter|None|| 29 | |value_converter|getter|None|| 30 | 31 | 32 | 33 | # All Methods 34 | [\_\_init\_\_](#__init__)    [feed](#feed)    [\_strip\_section\_spacing](#_strip_section_spacing)    [\_update](#_update) 35 | 36 | ## \_\_init\_\_ 37 | Initialize self. See help(type(self)) for accurate signature. 38 | 39 | 40 | 41 | **Signature:** (self, value\_converter=None) 42 | 43 | 44 | 45 | 46 | 47 | **Return Value:** None 48 | 49 | [Back to Top](#module-overview) 50 | 51 | 52 | ## feed 53 | No description 54 | 55 | 56 | 57 | **Signature:** (self, line) 58 | 59 | 60 | 61 | 62 | 63 | **Return Value:** None 64 | 65 | [Back to Top](#module-overview) 66 | 67 | 68 | ## \_strip\_section\_spacing 69 | No description 70 | 71 | 72 | 73 | **Signature:** (self, body) 74 | 75 | 76 | 77 | 78 | 79 | **Return Value:** None 80 | 81 | [Back to Top](#module-overview) 82 | 83 | 84 | ## \_update 85 | No description 86 | 87 | 88 | 89 | **Signature:** (self) 90 | 91 | 92 | 93 | 94 | 95 | **Return Value:** None 96 | 97 | [Back to Top](#module-overview) 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.parser/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.parser** 6 | 7 | This module exposes read and parse functions that return a document instance 8 | 9 | > **Classes:**   [Parser](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.parser/content/classes/Parser.md#class-parser) 10 | > 11 | > **Functions:**   [\_read\_file\_object](#_read_file_object)    [parse](#parse)    [read](#read) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [\_read\_file\_object](#_read_file_object)    [parse](#parse)    [read](#read) 17 | 18 | ## \_read\_file\_object 19 | No description 20 | 21 | 22 | 23 | **Signature:** (file, parser) 24 | 25 | 26 | 27 | 28 | 29 | **Return Value:** None 30 | 31 | [Back to Top](#module-overview) 32 | 33 | 34 | ## parse 35 | Parse a text, return a document 36 | 37 | 38 | 39 | **Signature:** (text, value\_converter=None) 40 | 41 | |Parameter|Description| 42 | |---|---| 43 | |text|text string| 44 | |value\_converter|instance of jesth.converter.ValueConverter to customize value encoding| 45 | 46 | 47 | 48 | 49 | 50 | **Return Value:** Returns an instance of jesth.document.Document 51 | 52 | [Back to Top](#module-overview) 53 | 54 | 55 | ## read 56 | Read a file, returns a document (jesth.document.Document) 57 | 58 | 59 | 60 | **Signature:** (source, value\_converter=None) 61 | 62 | |Parameter|Description| 63 | |---|---| 64 | |source|source is either a path string or a pathlib.Path object, or a binary file-like object| 65 | |value\_converter|instance of jesth.converter.ValueConverter to customize value encoding| 66 | 67 | 68 | 69 | 70 | 71 | **Return Value:** Returns an instance of jesth.document.Document 72 | 73 | [Back to Top](#module-overview) 74 | 75 | 76 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.renderer/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.renderer** 6 | 7 | This module exposes render and write functions 8 | 9 | > **Classes:**   None 10 | > 11 | > **Functions:**   [render](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.renderer/content/functions.md#render)    [write](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.renderer/content/functions.md#write) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.renderer/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.renderer** 6 | 7 | This module exposes render and write functions 8 | 9 | > **Classes:**   None 10 | > 11 | > **Functions:**   [render](#render)    [write](#write) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [render](#render)    [write](#write) 17 | 18 | ## render 19 | Convert a jesth document into plain text 20 | 21 | 22 | 23 | **Signature:** (document, \*headers, spacing=1) 24 | 25 | |Parameter|Description| 26 | |---|---| 27 | |document|an instance of jesth.document.Document| 28 | |\*headers|Headers of sections to render. Omitting this will render the entire section| 29 | |spacing|number of empty lines between two adjacent sections. Defaults to 1 empty line.| 30 | 31 | 32 | 33 | 34 | 35 | **Return Value:** Returns a string that contains sections (each made of square-brackets 36 | delimited header and associated body). This string can be stored in a file, 37 | thus creating a JesthFile 38 | 39 | [Back to Top](#module-overview) 40 | 41 | 42 | ## write 43 | Convert a jesth document into plain text then write it in a file 44 | 45 | 46 | 47 | **Signature:** (document, destination) 48 | 49 | |Parameter|Description| 50 | |---|---| 51 | |document|an instance of jesth.document.Document| 52 | |destination|path string, or pathlib.Path instance to a file in which the rendered Jesth text can be saved.| 53 | 54 | 55 | 56 | 57 | 58 | **Return Value:** Returns the rendered plain text 59 | 60 | [Back to Top](#module-overview) 61 | 62 | 63 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.section/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.section** 6 | 7 | Definition of the Section class 8 | 9 | > **Classes:**   [Section](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.section/content/classes/Section.md#class-section) 10 | > 11 | > **Functions:**   [ensure\_body](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.section/content/functions.md#ensure_body) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.section/content/classes/Section.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.section** 6 | 7 | Definition of the Section class 8 | 9 | > **Classes:**   [Section](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.section/content/classes/Section.md#class-section) 10 | > 11 | > **Functions:**   [ensure\_body](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.section/content/functions.md#ensure_body) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Section 16 | A section is the main unit of a jesthFile. It's composed of a header and a body 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | |Property|Type|Description|Inherited from| 26 | |---|---|---|---| 27 | |body|getter|The body in its base form, i.e., a list of strings !|| 28 | |header|getter|None|| 29 | |value_converter|getter|None|| 30 | 31 | 32 | 33 | # All Methods 34 | [\_\_init\_\_](#__init__)    [create\_dict](#create_dict)    [to\_dict](#to_dict)    [to\_text](#to_text)    [update](#update) 35 | 36 | ## \_\_init\_\_ 37 | Init a section 38 | 39 | 40 | 41 | **Signature:** (self, header, body=None, \*, value\_converter=None) 42 | 43 | |Parameter|Description| 44 | |---|---| 45 | |header|the header (string) of the section| 46 | |body|the body of the section is a string, a list of strings or a dict. Beware, if the body is a dict, instantiating this class may raise exceptions. For example, if the body contains circular references, an exception will be raised. Use the method ".update" if you want to submit a dict as body| 47 | |value\_converter|instance of ValueConverter to customize value encoding| 48 | 49 | 50 | 51 | 52 | 53 | **Return Value:** None 54 | 55 | [Back to Top](#module-overview) 56 | 57 | 58 | ## create\_dict 59 | Try to build a dict object out of the body of this section. 60 | Raise an exception if an errors occurs ! 61 | Return `default` if the body has been created but is empty 62 | 63 | 64 | 65 | **Signature:** (self, default=None, \*, strict=True) 66 | 67 | |Parameter|Description| 68 | |---|---| 69 | |default|Value to return if the body has been successfully converted into an empty dict. Note that `default` will be updated to contain an empty dict (from ValueConverter.dict_type) if you leave it set to None.| 70 | |strict|set True if you don't want to preserve comments and whitespaces| 71 | 72 | 73 | 74 | 75 | 76 | **Return Value:** If everything is ok, a dict will be returned or the value of `default` 77 | Exceptions will be raised whenever a problem will arise ! 78 | 79 | [Back to Top](#module-overview) 80 | 81 | 82 | ## to\_dict 83 | Try to convert the body of this section to a dict. 84 | Return a fallback value if failed to convert 85 | 86 | 87 | 88 | **Signature:** (self, default=None, fallback=None, \*, strict=True) 89 | 90 | |Parameter|Description| 91 | |---|---| 92 | |default|Value to return if the body has been successfully converted into a dict but empty. Note that `default` will be updated to contain an empty dict (from ValueConverter.dict_type) if you leave it set to None.| 93 | |fallback|Value to return if the attempt to convert the body into a dict failed| 94 | |strict|set True if you don't want to preserve comments and whitespaces| 95 | 96 | 97 | 98 | 99 | 100 | **Return Value:** If everything is ok, a dict will be returned. 101 | Else the value of `default` or `fallback` will be returned. 102 | 103 | [Back to Top](#module-overview) 104 | 105 | 106 | ## to\_text 107 | Return the body (list of lines) as a text string. 108 | 109 | [return] 110 | Return a string built with: `" 111 | ".join(self._body)` 112 | 113 | 114 | 115 | **Signature:** (self) 116 | 117 | 118 | 119 | 120 | 121 | **Return Value:** None 122 | 123 | [Back to Top](#module-overview) 124 | 125 | 126 | ## update 127 | Update the entire body. The new body may be string, list of strings or a dict. 128 | Beware, if the body is a dict, instantiating this class may raise exceptions. 129 | For example, if the body contains circular references, an exception will be raised. 130 | 131 | 132 | 133 | **Signature:** (self, body) 134 | 135 | 136 | 137 | 138 | 139 | **Return Value:** None 140 | 141 | [Back to Top](#module-overview) 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.section/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.section** 6 | 7 | Definition of the Section class 8 | 9 | > **Classes:**   [Section](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.section/content/classes/Section.md#class-section) 10 | > 11 | > **Functions:**   [ensure\_body](#ensure_body) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [ensure\_body](#ensure_body) 17 | 18 | ## ensure\_body 19 | Convert the body in the canonical base form: a list of string. 20 | 21 | 22 | 23 | **Signature:** (body, value\_converter=None) 24 | 25 | 26 | 27 | 28 | 29 | **Return Value:** None 30 | 31 | [Back to Top](#module-overview) 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.serializer/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.serializer** 6 | 7 | No description 8 | 9 | > **Classes:**   [Serializer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/classes/Serializer.md#class-serializer) 10 | > 11 | > **Functions:**   [calc\_integer\_size](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#calc_integer_size)    [encode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#encode_integer)    [encode\_list\_head](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#encode_list_head)    [encode\_list\_tail](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#encode_list_tail)    [insert\_version](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#insert_version)    [serialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#serialize)    [write\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#write_integer) 12 | > 13 | > **Constants:**   VERSION 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.serializer/content/classes/Serializer.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.serializer** 6 | 7 | No description 8 | 9 | > **Classes:**   [Serializer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/classes/Serializer.md#class-serializer) 10 | > 11 | > **Functions:**   [calc\_integer\_size](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#calc_integer_size)    [encode\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#encode_integer)    [encode\_list\_head](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#encode_list_head)    [encode\_list\_tail](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#encode_list_tail)    [insert\_version](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#insert_version)    [serialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#serialize)    [write\_integer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/functions.md#write_integer) 12 | > 13 | > **Constants:**   VERSION 14 | 15 | # Class Serializer 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [\_\_init\_\_](#__init__)    [run](#run)    [\_encode\_integer](#_encode_integer)    [\_encode\_list](#_encode_list)    [\_run](#_run)    [\_setup](#_setup) 29 | 30 | ## \_\_init\_\_ 31 | Initialize self. See help(type(self)) for accurate signature. 32 | 33 | 34 | 35 | **Signature:** (self, data, value\_converter=None) 36 | 37 | 38 | 39 | 40 | 41 | **Return Value:** None 42 | 43 | [Back to Top](#module-overview) 44 | 45 | 46 | ## run 47 | No description 48 | 49 | 50 | 51 | **Signature:** (self) 52 | 53 | 54 | 55 | 56 | 57 | **Return Value:** None 58 | 59 | [Back to Top](#module-overview) 60 | 61 | 62 | ## \_encode\_integer 63 | No description 64 | 65 | 66 | 67 | **Signature:** (self, data) 68 | 69 | 70 | 71 | 72 | 73 | **Return Value:** None 74 | 75 | [Back to Top](#module-overview) 76 | 77 | 78 | ## \_encode\_list 79 | No description 80 | 81 | 82 | 83 | **Signature:** (self, data) 84 | 85 | 86 | 87 | 88 | 89 | **Return Value:** None 90 | 91 | [Back to Top](#module-overview) 92 | 93 | 94 | ## \_run 95 | No description 96 | 97 | 98 | 99 | **Signature:** (self, data) 100 | 101 | 102 | 103 | 104 | 105 | **Return Value:** None 106 | 107 | [Back to Top](#module-overview) 108 | 109 | 110 | ## \_setup 111 | No description 112 | 113 | 114 | 115 | **Signature:** (self) 116 | 117 | 118 | 119 | 120 | 121 | **Return Value:** None 122 | 123 | [Back to Top](#module-overview) 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.serializer/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.serializer** 6 | 7 | No description 8 | 9 | > **Classes:**   [Serializer](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.serializer/content/classes/Serializer.md#class-serializer) 10 | > 11 | > **Functions:**   [calc\_integer\_size](#calc_integer_size)    [encode\_integer](#encode_integer)    [encode\_list\_head](#encode_list_head)    [encode\_list\_tail](#encode_list_tail)    [insert\_version](#insert_version)    [serialize](#serialize)    [write\_integer](#write_integer) 12 | > 13 | > **Constants:**   VERSION 14 | 15 | # All Functions 16 | [calc\_integer\_size](#calc_integer_size)    [encode\_integer](#encode_integer)    [encode\_list\_head](#encode_list_head)    [encode\_list\_tail](#encode_list_tail)    [insert\_version](#insert_version)    [serialize](#serialize)    [write\_integer](#write_integer) 17 | 18 | ## calc\_integer\_size 19 | Return the number of bytes needed for a given integer 20 | 21 | 22 | 23 | **Signature:** (x) 24 | 25 | 26 | 27 | 28 | 29 | **Return Value:** None 30 | 31 | [Back to Top](#module-overview) 32 | 33 | 34 | ## encode\_integer 35 | No description 36 | 37 | 38 | 39 | **Signature:** (data) 40 | 41 | 42 | 43 | 44 | 45 | **Return Value:** None 46 | 47 | [Back to Top](#module-overview) 48 | 49 | 50 | ## encode\_list\_head 51 | No description 52 | 53 | 54 | 55 | **Signature:** () 56 | 57 | 58 | 59 | 60 | 61 | **Return Value:** None 62 | 63 | [Back to Top](#module-overview) 64 | 65 | 66 | ## encode\_list\_tail 67 | No description 68 | 69 | 70 | 71 | **Signature:** () 72 | 73 | 74 | 75 | 76 | 77 | **Return Value:** None 78 | 79 | [Back to Top](#module-overview) 80 | 81 | 82 | ## insert\_version 83 | No description 84 | 85 | 86 | 87 | **Signature:** (buffer, n) 88 | 89 | 90 | 91 | 92 | 93 | **Return Value:** None 94 | 95 | [Back to Top](#module-overview) 96 | 97 | 98 | ## serialize 99 | No description 100 | 101 | 102 | 103 | **Signature:** (data) 104 | 105 | 106 | 107 | 108 | 109 | **Return Value:** None 110 | 111 | [Back to Top](#module-overview) 112 | 113 | 114 | ## write\_integer 115 | No description 116 | 117 | 118 | 119 | **Signature:** (buffer) 120 | 121 | 122 | 123 | 124 | 125 | **Return Value:** None 126 | 127 | [Back to Top](#module-overview) 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.tagbyte/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.tagbyte** 6 | 7 | No description 8 | 9 | > **Classes:**   [TagByte](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.tagbyte/content/classes/TagByte.md#class-tagbyte) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.tagbyte/content/classes/TagByte.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.tagbyte** 6 | 7 | No description 8 | 9 | > **Classes:**   [TagByte](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.tagbyte/content/classes/TagByte.md#class-tagbyte) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # Class TagByte 16 | An enumeration. 17 | 18 | ## Base Classes 19 | enum.Enum 20 | 21 | ## Class Attributes 22 | DICT\_KEYS\_HEAD    DICT\_KEYS\_TAIL    INTEGER    LIST\_HEAD    LIST\_TAIL    STRING    \_member\_map\_    \_member\_names\_    \_missing\_ (inherited from enum.Enum)    \_value2member\_map\_    name (inherited from enum.Enum)    value (inherited from enum.Enum) 23 | 24 | ## Class Properties 25 | 26 | 27 | # All Methods 28 | [\_generate\_next\_value\_](#_generate_next_value_)    [\_member\_type\_](#_member_type_) 29 | 30 | ## \_generate\_next\_value\_ 31 | No description 32 | 33 | 34 | 35 | **Signature:** (name, start, count, last\_values) 36 | 37 | 38 | 39 | 40 | 41 | **Return Value:** None 42 | 43 | [Back to Top](#module-overview) 44 | 45 | 46 | ## \_member\_type\_ 47 | The base class of the class hierarchy. 48 | 49 | When called, it accepts no arguments and returns a new featureless 50 | instance that has no instance attributes and cannot be given any. 51 | 52 | 53 | 54 | **Signature:** () 55 | 56 | 57 | 58 | 59 | 60 | **Return Value:** None 61 | 62 | [Back to Top](#module-overview) 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.tagbyte/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.tagbyte** 6 | 7 | No description 8 | 9 | > **Classes:**   [TagByte](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.tagbyte/content/classes/TagByte.md#class-tagbyte) 10 | > 11 | > **Functions:**   None 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.validator/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.validator** 6 | 7 | No description 8 | 9 | > **Classes:**   [Spec](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/classes/Spec.md#class-spec)    [Validator](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/classes/Validator.md#class-validator) 10 | > 11 | > **Functions:**   [validate](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/functions.md#validate) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.validator/content/classes/Spec.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.validator** 6 | 7 | No description 8 | 9 | > **Classes:**   [Spec](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/classes/Spec.md#class-spec)    [Validator](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/classes/Validator.md#class-validator) 10 | > 11 | > **Functions:**   [validate](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/functions.md#validate) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Spec 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | |Property|Type|Description|Inherited from| 26 | |---|---|---|---| 27 | |checker|getter|None|| 28 | |datatype|getter|None|| 29 | 30 | 31 | 32 | # All Methods 33 | [\_\_init\_\_](#__init__) 34 | 35 | ## \_\_init\_\_ 36 | Initialize self. See help(type(self)) for accurate signature. 37 | 38 | 39 | 40 | **Signature:** (self, datatype, checker=None) 41 | 42 | 43 | 44 | 45 | 46 | **Return Value:** None 47 | 48 | [Back to Top](#module-overview) 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.validator/content/classes/Validator.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.validator** 6 | 7 | No description 8 | 9 | > **Classes:**   [Spec](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/classes/Spec.md#class-spec)    [Validator](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/classes/Validator.md#class-validator) 10 | > 11 | > **Functions:**   [validate](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/functions.md#validate) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Validator 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | |Property|Type|Description|Inherited from| 26 | |---|---|---|---| 27 | |schema|getter|None|| 28 | |value_converter|getter|None|| 29 | 30 | 31 | 32 | # All Methods 33 | [\_\_init\_\_](#__init__)    [validate](#validate)    [\_ensure\_spec](#_ensure_spec)    [\_validate](#_validate)    [\_validate\_datatype](#_validate_datatype)    [\_validate\_dict](#_validate_dict)    [\_validate\_list](#_validate_list) 34 | 35 | ## \_\_init\_\_ 36 | Initialize self. See help(type(self)) for accurate signature. 37 | 38 | 39 | 40 | **Signature:** (self, schema, value\_converter=None) 41 | 42 | 43 | 44 | 45 | 46 | **Return Value:** None 47 | 48 | [Back to Top](#module-overview) 49 | 50 | 51 | ## validate 52 | No description 53 | 54 | 55 | 56 | **Signature:** (self, target) 57 | 58 | 59 | 60 | 61 | 62 | **Return Value:** None 63 | 64 | [Back to Top](#module-overview) 65 | 66 | 67 | ## \_ensure\_spec 68 | No description 69 | 70 | 71 | 72 | **Signature:** (self, target, spec) 73 | 74 | 75 | 76 | 77 | 78 | **Return Value:** None 79 | 80 | [Back to Top](#module-overview) 81 | 82 | 83 | ## \_validate 84 | No description 85 | 86 | 87 | 88 | **Signature:** (self, target, schema) 89 | 90 | 91 | 92 | 93 | 94 | **Return Value:** None 95 | 96 | [Back to Top](#module-overview) 97 | 98 | 99 | ## \_validate\_datatype 100 | No description 101 | 102 | 103 | 104 | **Signature:** (self, target, datatype) 105 | 106 | 107 | 108 | 109 | 110 | **Return Value:** None 111 | 112 | [Back to Top](#module-overview) 113 | 114 | 115 | ## \_validate\_dict 116 | No description 117 | 118 | 119 | 120 | **Signature:** (self, target, schema) 121 | 122 | 123 | 124 | 125 | 126 | **Return Value:** None 127 | 128 | [Back to Top](#module-overview) 129 | 130 | 131 | ## \_validate\_list 132 | Schema SHOULD be a list 133 | 134 | 135 | 136 | **Signature:** (self, target, schema) 137 | 138 | 139 | 140 | 141 | 142 | **Return Value:** None 143 | 144 | [Back to Top](#module-overview) 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /docs/modules/content/jesth.validator/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth.validator** 6 | 7 | No description 8 | 9 | > **Classes:**   [Spec](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/classes/Spec.md#class-spec)    [Validator](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth.validator/content/classes/Validator.md#class-validator) 10 | > 11 | > **Functions:**   [validate](#validate) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [validate](#validate) 17 | 18 | ## validate 19 | No description 20 | 21 | 22 | 23 | **Signature:** (data, schema, value\_converter=None) 24 | 25 | 26 | 27 | 28 | 29 | **Return Value:** None 30 | 31 | [Back to Top](#module-overview) 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/modules/content/jesth/README.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth** 6 | 7 | For convenience, this module exposes main classes and functions of the library 8 | 9 | > **Classes:**   [Document](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Document.md#class-document)    [Parser](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Parser.md#class-parser)    [Section](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Section.md#class-section)    [ValueConverter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/ValueConverter.md#class-valueconverter) 10 | > 11 | > **Functions:**   [create\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#create_dict)    [decode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#decode)    [deserialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#deserialize)    [dump](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#dump)    [encode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#encode)    [flatten\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#flatten_dict)    [load](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#load)    [parse](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#parse)    [read](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#read)    [render](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#render)    [serialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#serialize)    [split\_key\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#split_key_value)    [write](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#write)    [write\_to\_file](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#write_to_file) 12 | > 13 | > **Constants:**   None 14 | -------------------------------------------------------------------------------- /docs/modules/content/jesth/content/classes/Parser.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth** 6 | 7 | For convenience, this module exposes main classes and functions of the library 8 | 9 | > **Classes:**   [Document](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Document.md#class-document)    [Parser](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Parser.md#class-parser)    [Section](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Section.md#class-section)    [ValueConverter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/ValueConverter.md#class-valueconverter) 10 | > 11 | > **Functions:**   [create\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#create_dict)    [decode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#decode)    [deserialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#deserialize)    [dump](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#dump)    [encode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#encode)    [flatten\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#flatten_dict)    [load](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#load)    [parse](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#parse)    [read](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#read)    [render](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#render)    [serialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#serialize)    [split\_key\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#split_key_value)    [write](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#write)    [write\_to\_file](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#write_to_file) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Parser 16 | No description. 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | |Property|Type|Description|Inherited from| 26 | |---|---|---|---| 27 | |feedable|getter|Isn't anymore feedable when the `[[END]]` tag is encountered|| 28 | |sections|getter|None|| 29 | |value_converter|getter|None|| 30 | 31 | 32 | 33 | # All Methods 34 | [\_\_init\_\_](#__init__)    [feed](#feed)    [\_strip\_section\_spacing](#_strip_section_spacing)    [\_update](#_update) 35 | 36 | ## \_\_init\_\_ 37 | Initialize self. See help(type(self)) for accurate signature. 38 | 39 | 40 | 41 | **Signature:** (self, value\_converter=None) 42 | 43 | 44 | 45 | 46 | 47 | **Return Value:** None 48 | 49 | [Back to Top](#module-overview) 50 | 51 | 52 | ## feed 53 | No description 54 | 55 | 56 | 57 | **Signature:** (self, line) 58 | 59 | 60 | 61 | 62 | 63 | **Return Value:** None 64 | 65 | [Back to Top](#module-overview) 66 | 67 | 68 | ## \_strip\_section\_spacing 69 | No description 70 | 71 | 72 | 73 | **Signature:** (self, body) 74 | 75 | 76 | 77 | 78 | 79 | **Return Value:** None 80 | 81 | [Back to Top](#module-overview) 82 | 83 | 84 | ## \_update 85 | No description 86 | 87 | 88 | 89 | **Signature:** (self) 90 | 91 | 92 | 93 | 94 | 95 | **Return Value:** None 96 | 97 | [Back to Top](#module-overview) 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /docs/modules/content/jesth/content/classes/Section.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth** 6 | 7 | For convenience, this module exposes main classes and functions of the library 8 | 9 | > **Classes:**   [Document](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Document.md#class-document)    [Parser](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Parser.md#class-parser)    [Section](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Section.md#class-section)    [ValueConverter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/ValueConverter.md#class-valueconverter) 10 | > 11 | > **Functions:**   [create\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#create_dict)    [decode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#decode)    [deserialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#deserialize)    [dump](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#dump)    [encode](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#encode)    [flatten\_dict](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#flatten_dict)    [load](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#load)    [parse](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#parse)    [read](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#read)    [render](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#render)    [serialize](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#serialize)    [split\_key\_value](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#split_key_value)    [write](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#write)    [write\_to\_file](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/functions.md#write_to_file) 12 | > 13 | > **Constants:**   None 14 | 15 | # Class Section 16 | A section is the main unit of a jesthFile. It's composed of a header and a body 17 | 18 | ## Base Classes 19 | object 20 | 21 | ## Class Attributes 22 | No class attributes. 23 | 24 | ## Class Properties 25 | |Property|Type|Description|Inherited from| 26 | |---|---|---|---| 27 | |body|getter|The body in its base form, i.e., a list of strings !|| 28 | |header|getter|None|| 29 | |value_converter|getter|None|| 30 | 31 | 32 | 33 | # All Methods 34 | [\_\_init\_\_](#__init__)    [create\_dict](#create_dict)    [to\_dict](#to_dict)    [to\_text](#to_text)    [update](#update) 35 | 36 | ## \_\_init\_\_ 37 | Init a section 38 | 39 | 40 | 41 | **Signature:** (self, header, body=None, \*, value\_converter=None) 42 | 43 | |Parameter|Description| 44 | |---|---| 45 | |header|the header (string) of the section| 46 | |body|the body of the section is a string, a list of strings or a dict. Beware, if the body is a dict, instantiating this class may raise exceptions. For example, if the body contains circular references, an exception will be raised. Use the method ".update" if you want to submit a dict as body| 47 | |value\_converter|instance of ValueConverter to customize value encoding| 48 | 49 | 50 | 51 | 52 | 53 | **Return Value:** None 54 | 55 | [Back to Top](#module-overview) 56 | 57 | 58 | ## create\_dict 59 | Try to build a dict object out of the body of this section. 60 | Raise an exception if an errors occurs ! 61 | Return `default` if the body has been created but is empty 62 | 63 | 64 | 65 | **Signature:** (self, default=None, \*, strict=True) 66 | 67 | |Parameter|Description| 68 | |---|---| 69 | |default|Value to return if the body has been successfully converted into an empty dict. Note that `default` will be updated to contain an empty dict (from ValueConverter.dict_type) if you leave it set to None.| 70 | |strict|set True if you don't want to preserve comments and whitespaces| 71 | 72 | 73 | 74 | 75 | 76 | **Return Value:** If everything is ok, a dict will be returned or the value of `default` 77 | Exceptions will be raised whenever a problem will arise ! 78 | 79 | [Back to Top](#module-overview) 80 | 81 | 82 | ## to\_dict 83 | Try to convert the body of this section to a dict. 84 | Return a fallback value if failed to convert 85 | 86 | 87 | 88 | **Signature:** (self, default=None, fallback=None, \*, strict=True) 89 | 90 | |Parameter|Description| 91 | |---|---| 92 | |default|Value to return if the body has been successfully converted into a dict but empty. Note that `default` will be updated to contain an empty dict (from ValueConverter.dict_type) if you leave it set to None.| 93 | |fallback|Value to return if the attempt to convert the body into a dict failed| 94 | |strict|set True if you don't want to preserve comments and whitespaces| 95 | 96 | 97 | 98 | 99 | 100 | **Return Value:** If everything is ok, a dict will be returned. 101 | Else the value of `default` or `fallback` will be returned. 102 | 103 | [Back to Top](#module-overview) 104 | 105 | 106 | ## to\_text 107 | Return the body (list of lines) as a text string. 108 | 109 | [return] 110 | Return a string built with: `" 111 | ".join(self._body)` 112 | 113 | 114 | 115 | **Signature:** (self) 116 | 117 | 118 | 119 | 120 | 121 | **Return Value:** None 122 | 123 | [Back to Top](#module-overview) 124 | 125 | 126 | ## update 127 | Update the entire body. The new body may be string, list of strings or a dict. 128 | Beware, if the body is a dict, instantiating this class may raise exceptions. 129 | For example, if the body contains circular references, an exception will be raised. 130 | 131 | 132 | 133 | **Signature:** (self, body) 134 | 135 | 136 | 137 | 138 | 139 | **Return Value:** None 140 | 141 | [Back to Top](#module-overview) 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /docs/modules/content/jesth/content/functions.md: -------------------------------------------------------------------------------- 1 | Back to [All Modules](https://github.com/pyrustic/jesth/blob/master/docs/modules/README.md#readme) 2 | 3 | # Module Overview 4 | 5 | **jesth** 6 | 7 | For convenience, this module exposes main classes and functions of the library 8 | 9 | > **Classes:**   [Document](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Document.md#class-document)    [Parser](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Parser.md#class-parser)    [Section](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/Section.md#class-section)    [ValueConverter](https://github.com/pyrustic/jesth/blob/master/docs/modules/content/jesth/content/classes/ValueConverter.md#class-valueconverter) 10 | > 11 | > **Functions:**   [create\_dict](#create_dict)    [decode](#decode)    [deserialize](#deserialize)    [dump](#dump)    [encode](#encode)    [flatten\_dict](#flatten_dict)    [load](#load)    [parse](#parse)    [read](#read)    [render](#render)    [serialize](#serialize)    [split\_key\_value](#split_key_value)    [write](#write)    [write\_to\_file](#write_to_file) 12 | > 13 | > **Constants:**   None 14 | 15 | # All Functions 16 | [create\_dict](#create_dict)    [decode](#decode)    [deserialize](#deserialize)    [dump](#dump)    [encode](#encode)    [flatten\_dict](#flatten_dict)    [load](#load)    [parse](#parse)    [read](#read)    [render](#render)    [serialize](#serialize)    [split\_key\_value](#split_key_value)    [write](#write)    [write\_to\_file](#write_to_file) 17 | 18 | ## create\_dict 19 | Convert a section body into a Python dict 20 | 21 | 22 | 23 | **Signature:** (body, value\_converter=None, strict=True) 24 | 25 | |Parameter|Description| 26 | |---|---| 27 | |body|string or list of strings| 28 | |value\_converter|instance of ValueConverter to customize value encoding| 29 | |strict|when strict is True, comments and whitespaces aren't preserved| 30 | 31 | 32 | 33 | |Exception|Description| 34 | |---|---| 35 | |jesth.errors.ConversionError|raised when an errors occured while doing conversion| 36 | 37 | 38 | 39 | **Return Value:** Returns a Python dict (type customizable with ValueConverter) 40 | 41 | [Back to Top](#module-overview) 42 | 43 | 44 | ## decode 45 | No description 46 | 47 | 48 | 49 | **Signature:** (text, value\_converter=None) 50 | 51 | 52 | 53 | 54 | 55 | **Return Value:** None 56 | 57 | [Back to Top](#module-overview) 58 | 59 | 60 | ## deserialize 61 | No description 62 | 63 | 64 | 65 | **Signature:** (raw, value\_converter=None) 66 | 67 | 68 | 69 | 70 | 71 | **Return Value:** None 72 | 73 | [Back to Top](#module-overview) 74 | 75 | 76 | ## dump 77 | No description 78 | 79 | 80 | 81 | **Signature:** (data, destination, value\_converter=None) 82 | 83 | 84 | 85 | 86 | 87 | **Return Value:** None 88 | 89 | [Back to Top](#module-overview) 90 | 91 | 92 | ## encode 93 | No description 94 | 95 | 96 | 97 | **Signature:** (data, value\_converter=None) 98 | 99 | 100 | 101 | 102 | 103 | **Return Value:** None 104 | 105 | [Back to Top](#module-overview) 106 | 107 | 108 | ## flatten\_dict 109 | Convert a Python dict into a list of strings (section body in the base form) 110 | 111 | 112 | 113 | **Signature:** (data, value\_converter=None) 114 | 115 | |Parameter|Description| 116 | |---|---| 117 | |data|Python dict| 118 | |value\_converter|instance of ValueConverter to customize value encoding| 119 | 120 | 121 | 122 | 123 | 124 | **Return Value:** Returns a list of strings 125 | 126 | [Back to Top](#module-overview) 127 | 128 | 129 | ## load 130 | Load data from a file or file object 131 | 132 | 133 | 134 | **Signature:** (source, value\_converter=None) 135 | 136 | 137 | 138 | 139 | 140 | **Return Value:** None 141 | 142 | [Back to Top](#module-overview) 143 | 144 | 145 | ## parse 146 | Parse a text, return a document 147 | 148 | 149 | 150 | **Signature:** (text, value\_converter=None) 151 | 152 | |Parameter|Description| 153 | |---|---| 154 | |text|text string| 155 | |value\_converter|instance of jesth.converter.ValueConverter to customize value encoding| 156 | 157 | 158 | 159 | 160 | 161 | **Return Value:** Returns an instance of jesth.document.Document 162 | 163 | [Back to Top](#module-overview) 164 | 165 | 166 | ## read 167 | Read a file, returns a document (jesth.document.Document) 168 | 169 | 170 | 171 | **Signature:** (source, value\_converter=None) 172 | 173 | |Parameter|Description| 174 | |---|---| 175 | |source|source is either a path string or a pathlib.Path object, or a binary file-like object| 176 | |value\_converter|instance of jesth.converter.ValueConverter to customize value encoding| 177 | 178 | 179 | 180 | 181 | 182 | **Return Value:** Returns an instance of jesth.document.Document 183 | 184 | [Back to Top](#module-overview) 185 | 186 | 187 | ## render 188 | Convert a jesth document into plain text 189 | 190 | 191 | 192 | **Signature:** (document, \*headers, spacing=1) 193 | 194 | |Parameter|Description| 195 | |---|---| 196 | |document|an instance of jesth.document.Document| 197 | |\*headers|Headers of sections to render. Omitting this will render the entire section| 198 | |spacing|number of empty lines between two adjacent sections. Defaults to 1 empty line.| 199 | 200 | 201 | 202 | 203 | 204 | **Return Value:** Returns a string that contains sections (each made of square-brackets 205 | delimited header and associated body). This string can be stored in a file, 206 | thus creating a JesthFile 207 | 208 | [Back to Top](#module-overview) 209 | 210 | 211 | ## serialize 212 | No description 213 | 214 | 215 | 216 | **Signature:** (data, value\_converter=None) 217 | 218 | 219 | 220 | 221 | 222 | **Return Value:** None 223 | 224 | [Back to Top](#module-overview) 225 | 226 | 227 | ## split\_key\_value 228 | Split a line (string) into key and value parts. 229 | The string must have a separator (defaults to "="). 230 | An example of a valid string is "name = John Doe ". 231 | The return will be: ("name": "John Doe") 232 | 233 | 234 | 235 | **Signature:** (line, sep='=', strip\_whitespace=True) 236 | 237 | |Parameter|Description| 238 | |---|---| 239 | |line|the string to split| 240 | |sep|the separator, by default it is "="| 241 | |strip\_whitespace|boolean to tell whether you want whitespace at each side of the key and value to be stripped out or not. By default, the value is True.| 242 | 243 | 244 | 245 | |Exception|Description| 246 | |---|---| 247 | |errors.Error|if the separator, the key, or the value is missing,| 248 | 249 | 250 | 251 | **Return Value:** Returns a ("key", "value") tuple if everything is Ok 252 | 253 | [Back to Top](#module-overview) 254 | 255 | 256 | ## write 257 | Convert a jesth document into plain text then write it in a file 258 | 259 | 260 | 261 | **Signature:** (document, destination) 262 | 263 | |Parameter|Description| 264 | |---|---| 265 | |document|an instance of jesth.document.Document| 266 | |destination|path string, or pathlib.Path instance to a file in which the rendered Jesth text can be saved.| 267 | 268 | 269 | 270 | 271 | 272 | **Return Value:** Returns the rendered plain text 273 | 274 | [Back to Top](#module-overview) 275 | 276 | 277 | ## write\_to\_file 278 | Write to a file (TRY to do it atomically for GNU/Linux and MacOS) 279 | Check https://danluu.com/file-consistency/ 280 | 281 | 282 | 283 | **Signature:** (data, dest) 284 | 285 | |Parameter|Description| 286 | |---|---| 287 | |data|str, data to write to file| 288 | |dest|a pathlib.Path instance, or a path string| 289 | |binary\_mode|boolean to tell if data should be written in dest with binary mode on (mode="wb")| 290 | |encoding|defaults to "utf-8" and automatically set to None when binary mode is True| 291 | 292 | 293 | 294 | 295 | 296 | **Return Value:** None 297 | 298 | [Back to Top](#module-overview) 299 | 300 | 301 | -------------------------------------------------------------------------------- /jesth/__init__.py: -------------------------------------------------------------------------------- 1 | """For convenience, this module exposes main classes and functions of the library""" 2 | from jesth.document import Document 3 | from jesth.section import Section 4 | from jesth.parser import read, parse, Parser 5 | from jesth.renderer import render, write 6 | from jesth.converter import create_dict, flatten_dict, ValueConverter 7 | from jesth.misc import split_key_value, write_to_file 8 | from jesth.dataformat.text import load, dump, encode, decode 9 | from jesth.dataformat.binary import serialize, deserialize 10 | 11 | 12 | __all__ = ["Document", "Section", 13 | "Parser", "ValueConverter", 14 | "read", "write", 15 | "parse", "render", 16 | "create_dict", "flatten_dict", 17 | "load", "dump", 18 | "encode", "decode", 19 | "serialize", "deserialize", 20 | "write_to_file", "split_key_value"] 21 | -------------------------------------------------------------------------------- /jesth/__main__.py: -------------------------------------------------------------------------------- 1 | # "__main__.py" generated by Backstage 2 | 3 | 4 | def main(): 5 | print("https://github.com/pyrustic/jesth") 6 | 7 | 8 | if __name__ == "__main__": 9 | main() 10 | -------------------------------------------------------------------------------- /jesth/box/__init__.py: -------------------------------------------------------------------------------- 1 | """Boxes to hold contents like Jesth Comments, raw texts, or whitespaces...""" 2 | import threading 3 | 4 | 5 | class RawString(str): 6 | """Box to hold raw string, i.e., string between two single quotes""" 7 | pass 8 | 9 | 10 | class Text(str): 11 | """Box to hold Text, i.e., multiline string with unicode escape sequences support""" 12 | pass 13 | 14 | 15 | class RawText(str): 16 | """Box to hold raw Text, i.e., multiline string without unicode escape sequences support""" 17 | pass 18 | 19 | 20 | class HexInt(int): 21 | """Box to hold hexadecimal integer""" 22 | pass 23 | 24 | 25 | class OctInt(int): 26 | """Box to hold octal integer""" 27 | pass 28 | 29 | 30 | class BinInt(int): 31 | """Box to hold binary integer""" 32 | pass 33 | 34 | 35 | class CommentID(int): 36 | """Box to hold an unique comment id""" 37 | def __new__(cls, *args, **kwargs): 38 | return super().__new__(cls, N.generate_id()) 39 | 40 | 41 | class Comment(str): 42 | """Box to hold a Jesth comment""" 43 | pass 44 | 45 | 46 | class WhitespaceID(int): 47 | """Box to hold an unique whitespace id""" 48 | def __new__(cls, *args, **kwargs): 49 | return super().__new__(cls, N.generate_id()) 50 | 51 | 52 | class Whitespace(str): 53 | """Box to hold a whitespace""" 54 | pass 55 | 56 | 57 | class N: 58 | """Private class to generate unique identifiers (thread-safe)""" 59 | _lock = threading.Lock() 60 | _count = 0 61 | 62 | @classmethod 63 | def generate_id(cls): 64 | """Generate an unique integer identifier (thread-safe)""" 65 | with cls._lock: 66 | cls._count += 1 67 | return cls._count 68 | -------------------------------------------------------------------------------- /jesth/const/__init__.py: -------------------------------------------------------------------------------- 1 | import os.path 2 | 3 | 4 | # general constants 5 | HOME = os.path.join(os.path.expanduser("~"), "PyrusticHome", "jesth") 6 | INDENT_WIDTH = 4 # Four spaces 7 | -------------------------------------------------------------------------------- /jesth/dataformat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pyrustic/jesth/b753534eeaf7bf2c05b08fb3f353d9e758c7b13f/jesth/dataformat/__init__.py -------------------------------------------------------------------------------- /jesth/dataformat/binary.py: -------------------------------------------------------------------------------- 1 | import zlib 2 | from jesth.dataformat.text import encode as jesth_encode, decode as jesth_decode 3 | 4 | 5 | def serialize(data, value_converter=None): 6 | data = jesth_encode(data).encode("utf-8") 7 | return zlib.compress(data, 6) 8 | 9 | 10 | def deserialize(raw, value_converter=None): 11 | data = zlib.decompress(raw).decode("utf-8") 12 | return jesth_decode(data) 13 | -------------------------------------------------------------------------------- /jesth/dataformat/text.py: -------------------------------------------------------------------------------- 1 | from jesth.parser import read 2 | from jesth import misc 3 | from jesth.converter import flatten_dict, create_dict 4 | 5 | 6 | def load(source, value_converter=None): 7 | """ 8 | Load data from a file or file object 9 | """ 10 | doc = read(source, value_converter) 11 | if not doc.sections: 12 | return None 13 | section = doc.sections[0] 14 | if section.header != "": 15 | return None 16 | body = section.to_dict() 17 | if not body: 18 | return None 19 | return body.get("data") 20 | 21 | 22 | def dump(data, destination, value_converter=None): 23 | body = encode(data, value_converter) 24 | misc.write_to_file(body, destination) 25 | 26 | 27 | def encode(data, value_converter=None): 28 | body = {"data": data} 29 | body = flatten_dict(body, value_converter=value_converter) 30 | return "\n".join(body) 31 | 32 | 33 | def decode(text, value_converter=None): 34 | data = create_dict(text, value_converter=value_converter) 35 | return data.get("data") 36 | -------------------------------------------------------------------------------- /jesth/deserializer/__init__.py: -------------------------------------------------------------------------------- 1 | import struct 2 | from jesth.tagbyte import TagByte 3 | from jesth import errors 4 | 5 | 6 | def deserialize(raw): 7 | deserializer = Deserializer(raw) 8 | return deserializer.run() 9 | 10 | 11 | class Deserializer: 12 | def __init__(self, raw): 13 | self._raw = raw 14 | self._buffer = bytearray() 15 | self._data = None 16 | self._index = 0 17 | self._length = len(raw) 18 | self._setup() 19 | 20 | def run(self): 21 | containers = list() 22 | self._run(containers) 23 | return containers[0] 24 | 25 | def _setup(self): 26 | self._check_version() 27 | self._index = 1 28 | 29 | def _run(self, containers): 30 | length = len(self._raw) 31 | while self._index < length: 32 | tag = read_tag(self._raw, self._index) 33 | self._increment() 34 | size = 0 35 | if tag == TagByte.LIST_HEAD.value: 36 | new_container = list() 37 | if len(containers) != 0: 38 | containers[-1].append(new_container) 39 | containers.append(new_container) 40 | elif tag == TagByte.LIST_TAIL.value: 41 | if len(containers) > 1: 42 | del containers[-1] 43 | else: 44 | data, size = self._interpret_tag(tag) 45 | if containers: 46 | containers[-1].append(data) 47 | self._increment(size) 48 | 49 | def _increment(self, n=1): 50 | self._index += n 51 | 52 | def _interpret_tag(self, tag): 53 | if tag == TagByte.INTEGER.value: 54 | data, size = read_integer(self._raw, self._index) 55 | elif tag == TagByte.LIST_HEAD.value: 56 | pass 57 | else: 58 | msg = "Unknown tag byte '{}'".format(tag) 59 | raise errors.Error(msg) 60 | return data, size 61 | 62 | def _check_version(self): 63 | version = extract_version(self._raw) 64 | if version == 1: 65 | pass 66 | else: 67 | msg = "This library can't deserialize this version of Jesth Binary Format" 68 | raise errors.Error(msg) 69 | 70 | 71 | def read_tag(raw, index): 72 | spec = "= 0 else 1 102 | n_bits = sign_bit + x.bit_length() 103 | return math.ceil(n_bits / 8.0) 104 | -------------------------------------------------------------------------------- /jesth/tagbyte/__init__.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class TagByte(Enum): 5 | LIST_HEAD = b"\x01" 6 | LIST_TAIL = b"\x02" 7 | DICT_KEYS_HEAD = b"\x03" 8 | DICT_KEYS_TAIL = b"\x04" 9 | INTEGER = b"\x05" 10 | STRING = b"\x06" 11 | -------------------------------------------------------------------------------- /jesth/validator/__init__.py: -------------------------------------------------------------------------------- 1 | from jesth.errors import Error 2 | from jesth.converter import ValueConverter 3 | from collections import OrderedDict 4 | 5 | 6 | def validate(data, schema, value_converter=None): 7 | value_converter = value_converter if value_converter else ValueConverter() 8 | validator = Validator(schema, value_converter=value_converter) 9 | return validator.validate(data) 10 | 11 | 12 | class Spec: 13 | def __init__(self, datatype, checker=None): 14 | self._datatype = datatype 15 | self._checker = checker 16 | 17 | @property 18 | def datatype(self): 19 | return self._datatype 20 | 21 | @property 22 | def checker(self): 23 | return self._checker 24 | 25 | 26 | class Validator: 27 | def __init__(self, schema, value_converter=None): 28 | self._schema = schema 29 | self._value_converter = value_converter if value_converter else ValueConverter() 30 | 31 | @property 32 | def schema(self): 33 | return self._schema 34 | 35 | @property 36 | def value_converter(self): 37 | return self._value_converter 38 | 39 | def validate(self, target): 40 | return self._validate(target, self._schema) 41 | 42 | def _validate(self, target, schema): 43 | if target is None: 44 | return True 45 | if isinstance(schema, str): 46 | return self._validate_datatype(target, schema) 47 | if isinstance(schema, Spec): 48 | return self._ensure_spec(target, schema) 49 | if isinstance(schema, list) or isinstance(schema, tuple): 50 | return self._validate_list(target, schema) 51 | if isinstance(schema, dict) or isinstance(schema, OrderedDict): 52 | return self._validate_dict(target, schema) 53 | msg = "Invalid schema" 54 | raise Error(msg) 55 | 56 | def _validate_list(self, target, schema): 57 | """Schema SHOULD be a list""" 58 | if type(target) not in self._value_converter.list_types: 59 | return False 60 | if not schema: 61 | return True 62 | for item in target: 63 | matched = False 64 | for expected_type in schema: 65 | if self._validate(item, expected_type): 66 | matched = True 67 | break 68 | if not matched: 69 | return False 70 | return True 71 | 72 | def _validate_dict(self, target, schema): 73 | if type(target) not in self._value_converter.dict_types: 74 | return False 75 | if not schema: 76 | return True 77 | for key, val in target.items(): 78 | try: 79 | r = self._validate(val, schema[key]) 80 | except KeyError as e: 81 | return False 82 | else: 83 | if not r: 84 | return False 85 | return True 86 | 87 | def _validate_datatype(self, target, datatype): 88 | valid_types_map = {"dict": self._value_converter.dict_types, 89 | "list": self._value_converter.list_types, 90 | "bin": self._value_converter.bin_types, 91 | "bool": self._value_converter.bool_types, 92 | "complex": self._value_converter.complex_types, 93 | "date": self._value_converter.date_types, 94 | "datetime": self._value_converter.datetime_types, 95 | "float": self._value_converter.float_types, 96 | "int": self._value_converter.integer_types, 97 | "str": (tuple(self._value_converter.string_types) 98 | + tuple(self._value_converter.raw_types) 99 | + tuple(self._value_converter.text_types)), 100 | "time": self._value_converter.time_types} 101 | try: 102 | valid_types = valid_types_map[datatype] 103 | except KeyError as e: 104 | msg = "Unknown data type '{}'".format(datatype) 105 | raise Error(msg) 106 | for valid_type in valid_types: 107 | if type(target) == valid_type: 108 | return True 109 | return False 110 | 111 | def _ensure_spec(self, target, spec): 112 | if not self._validate_datatype(target, spec.datatype): 113 | return False 114 | if not spec.checker: 115 | return True 116 | try: 117 | return bool(spec.checker(target)) 118 | except Exception as e: 119 | msg = "Error while running a checker" 120 | raise Error(msg) -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools", 4 | "wheel" 5 | ] 6 | build-backend = "setuptools.build_meta" 7 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = jesth 3 | version = file: VERSION 4 | url = https://github.com/pyrustic/jesth 5 | author = Pyrustic Evangelist 6 | author_email = rusticalex@yahoo.com 7 | maintainer = Pyrustic Evangelist 8 | maintainer_email = rusticalex@yahoo.com 9 | description = Human-readable versatile data format 10 | long_description = file: README.md 11 | long_description_content_type = text/markdown 12 | license = MIT 13 | keywords = 14 | serialization 15 | library 16 | format 17 | collections 18 | data 19 | markup 20 | parser 21 | config 22 | configuration 23 | renderer 24 | language 25 | typed 26 | data-structure 27 | pyrustic 28 | classifiers = 29 | Programming Language :: Python :: 3 30 | License :: OSI Approved :: MIT License 31 | Operating System :: OS Independent 32 | 33 | [options] 34 | python_requires = >=3.5 35 | packages = find: 36 | include_package_data = true 37 | zip_safe = false 38 | 39 | [options.entry_points] 40 | console_scripts = 41 | jesth = jesth.__main__:main 42 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # File generated by Setupinit 2 | import setuptools 3 | 4 | 5 | if __name__ == "__main__": 6 | setuptools.setup() 7 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pyrustic/jesth/b753534eeaf7bf2c05b08fb3f353d9e758c7b13f/tests/__init__.py -------------------------------------------------------------------------------- /tests/test_box.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from jesth import box 3 | 4 | 5 | class TestBoxesClasses(unittest.TestCase): 6 | 7 | def test_raw_string(self): 8 | r = box.RawString("hello world") 9 | self.assertIsInstance(r, str) 10 | 11 | def test_text(self): 12 | r = box.Text("hello world") 13 | self.assertIsInstance(r, str) 14 | 15 | def test_raw_text(self): 16 | r = box.RawText("hello world") 17 | self.assertIsInstance(r, str) 18 | 19 | def test_hex_int(self): 20 | r = box.HexInt(420) 21 | self.assertIsInstance(r, int) 22 | 23 | def test_oct_int(self): 24 | r = box.OctInt(42) 25 | self.assertIsInstance(r, int) 26 | 27 | def test_bin_int(self): 28 | r = box.BinInt(4) 29 | self.assertIsInstance(r, int) 30 | 31 | def test_comment_id(self): 32 | r1 = box.CommentID() 33 | r2 = box.CommentID() 34 | self.assertIsInstance(r1, int) 35 | self.assertIsInstance(r2, int) 36 | self.assertNotEqual(r1, r2) 37 | 38 | def test_comment(self): 39 | r = box.Comment("# this is a comment") 40 | self.assertIsInstance(r, str) 41 | 42 | def test_whitespace_id(self): 43 | r1 = box.WhitespaceID() 44 | r2 = box.WhitespaceID() 45 | self.assertIsInstance(r1, int) 46 | self.assertIsInstance(r2, int) 47 | self.assertNotEqual(r1, r2) 48 | 49 | def test_whitespace(self): 50 | r = box.Whitespace() 51 | self.assertIsInstance(r, str) 52 | 53 | 54 | if __name__ == '__main__': 55 | unittest.main() 56 | -------------------------------------------------------------------------------- /tests/test_parser.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import tempfile 3 | import pathlib 4 | from decimal import Decimal 5 | from jesth import Parser, parse, read 6 | from jesth.converter import ValueConverter 7 | 8 | 9 | TEXT = """\ 10 | Anonymous 11 | section 12 | here. 13 | 14 | [section2] 15 | hello 16 | \\[world 17 | """ 18 | 19 | 20 | TEXT_WITH_END = """\ 21 | [section1] 22 | first 23 | section 24 | 25 | [[END]] 26 | 27 | [section2] 28 | second 29 | section 30 | """ 31 | 32 | 33 | class TestReadFunc(unittest.TestCase): 34 | 35 | def setUp(self): 36 | file = tempfile.NamedTemporaryFile(delete=False) 37 | file.write(TEXT.encode("utf-8")) 38 | file.close() 39 | self._path_str = file.name 40 | self._path_obj = pathlib.Path(self._path_str) 41 | 42 | def tearDown(self): 43 | self._path_obj.unlink() 44 | 45 | def test_read_from_file(self): 46 | with open(self._path_str, mode="rb") as file: 47 | document = read(file) 48 | test_document(document, self) 49 | 50 | def test_read_from_path_str(self): 51 | document = read(self._path_str) 52 | test_document(document, self) 53 | 54 | def test_read_from_path_obj(self): 55 | document = read(self._path_obj) 56 | test_document(document, self) 57 | 58 | def test_read_with_custom_value_converter(self): 59 | custom_float_decoder = Decimal 60 | custom_value_converter = ValueConverter(float_decoder=custom_float_decoder) 61 | document = read(self._path_obj, value_converter=custom_value_converter) 62 | section1 = document.sections[0] 63 | section2 = document.sections[1] 64 | expected = custom_float_decoder 65 | self.assertEqual(expected, section1.value_converter.float_decoder) 66 | self.assertEqual(expected, section2.value_converter.float_decoder) 67 | 68 | 69 | class TestParseFunc(unittest.TestCase): 70 | 71 | def test_with_default_args(self): 72 | document = parse(TEXT) 73 | test_document(document, self) 74 | 75 | def test_with_custom_value_converter(self): 76 | custom_float_decoder = Decimal 77 | custom_value_converter = ValueConverter(float_decoder=custom_float_decoder) 78 | document = parse(TEXT, value_converter=custom_value_converter) 79 | section1 = document.sections[0] 80 | section2 = document.sections[1] 81 | expected = custom_float_decoder 82 | self.assertEqual(expected, section1.value_converter.float_decoder) 83 | self.assertEqual(expected, section2.value_converter.float_decoder) 84 | 85 | 86 | class TestParserClass(unittest.TestCase): 87 | 88 | def test(self): 89 | parser = Parser() 90 | self.assertTrue(parser.feedable) 91 | for line in TEXT_WITH_END.split("\n"): 92 | parser.feed(line) 93 | if line.lower() == "[[end]]": 94 | self.assertFalse(parser.feedable) 95 | self.assertEqual(1, len(parser.sections)) 96 | 97 | 98 | def test_document(document, test_case): 99 | test_case.assertEqual(2, len(document.sections)) 100 | section1, section2 = document.sections 101 | # section1 102 | expected_header = "" 103 | expected_body = ["Anonymous", "section", "here."] 104 | test_case.assertEqual(expected_header, section1.header) 105 | test_case.assertEqual(expected_body, section1.body) 106 | # section2 107 | expected_header = "section2" 108 | expected_body = ["hello", "[world"] 109 | test_case.assertEqual(expected_header, section2.header) 110 | test_case.assertEqual(expected_body, section2.body) 111 | 112 | 113 | if __name__ == "__main__": 114 | unittest.main() 115 | -------------------------------------------------------------------------------- /tests/test_renderer.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import tempfile 3 | import pathlib 4 | from jesth.parser import parse 5 | from jesth.renderer import render, write 6 | 7 | 8 | TEXT = """\ 9 | [section1] 10 | first 11 | section 12 | 13 | 14 | [section2] 15 | second 16 | section\ 17 | """ 18 | 19 | 20 | class TestRenderFunc(unittest.TestCase): 21 | 22 | def test_render_all_sections(self): 23 | document = parse(TEXT) 24 | r = render(document, spacing=2) 25 | expected = TEXT 26 | self.assertEqual(expected, r) 27 | 28 | def test_render_only_one_section(self): 29 | document = parse(TEXT) 30 | r = render(document, "section2") 31 | expected = "[section2]\nsecond\nsection" 32 | self.assertEqual(expected, r) 33 | 34 | 35 | class TestWriteFunc(unittest.TestCase): 36 | 37 | def setUp(self): 38 | file = tempfile.NamedTemporaryFile(delete=False) 39 | file.close() 40 | self._path_str = file.name 41 | self._path_obj = pathlib.Path(self._path_str) 42 | self._document = parse(TEXT) 43 | 44 | def tearDown(self): 45 | self._path_obj.unlink() 46 | 47 | def test_write_to_path_obj(self): 48 | expected = write(self._document, self._path_obj) 49 | _check_file_contents(self, self._path_str, expected) 50 | 51 | def test_write_to_path_str(self): 52 | expected = write(self._document, self._path_str) 53 | _check_file_contents(self, self._path_str, expected) 54 | 55 | def test_write_to_file(self): 56 | with open(self._path_str, "wb") as file: 57 | expected = write(self._document, file) 58 | _check_file_contents(self, self._path_str, expected) 59 | 60 | 61 | def _check_file_contents(test_case, path_str, expected_contents): 62 | with open(path_str, "r") as file: 63 | contents = file.read() 64 | test_case.assertEqual(expected_contents, contents) 65 | 66 | 67 | if __name__ == '__main__': 68 | unittest.main() 69 | -------------------------------------------------------------------------------- /tests/test_root_imports.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import jesth 3 | 4 | 5 | class TestRootImports(unittest.TestCase): 6 | 7 | def test_wrong_import(self): 8 | with self.assertRaises(AttributeError): 9 | jesth.abracadabra 10 | 11 | def test(self): 12 | jesth.Document 13 | jesth.Section 14 | jesth.parse 15 | jesth.render 16 | jesth.read 17 | jesth.write 18 | jesth.create_dict 19 | jesth.flatten_dict 20 | jesth.ValueConverter 21 | jesth.split_key_value 22 | jesth.Parser 23 | self.assertTrue(True) 24 | 25 | 26 | if __name__ == '__main__': 27 | unittest.main() 28 | -------------------------------------------------------------------------------- /tests/test_section.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from collections import OrderedDict 3 | from decimal import Decimal 4 | from jesth import box, errors 5 | from jesth.section import Section 6 | from jesth.converter import ValueConverter 7 | 8 | 9 | TEXT_BODY = """\ 10 | # welcome 11 | project = 'Jesth' 12 | author = 'alex rustic' 13 | pi = 3.141_592_653_589_793_238_46E0\ 14 | """ 15 | 16 | DICT_BODY = OrderedDict([(box.CommentID(), box.Comment("# welcome")), 17 | ("project", box.RawString("Jesth")), 18 | ("author", box.RawString("alex rustic")), 19 | ("pi", Decimal("3.141_592_653_589_793_238_46E0"))]) 20 | 21 | 22 | BASE_BODY = ["# welcome", 23 | "project = 'Jesth'", 24 | "author = 'alex rustic'", 25 | "pi = 3.141_592_653_589_793_238_46E0"] 26 | 27 | 28 | class TestSectionClass(unittest.TestCase): 29 | 30 | def test_default_init(self): 31 | section = Section("header") 32 | self.assertEqual("header", section.header) 33 | self.assertEqual(list(), section.body) 34 | self.assertIsNotNone(section.value_converter) 35 | 36 | def test_init_with_dict_body(self): 37 | section = Section("header", DICT_BODY) 38 | r = section.body 39 | expected = BASE_BODY 40 | self.assertEqual(expected, r) 41 | 42 | def test_init_with_text_body(self): 43 | section = Section("header", TEXT_BODY) 44 | r = section.body 45 | expected = BASE_BODY 46 | self.assertEqual(expected, r) 47 | 48 | def test_init_with_base_body(self): 49 | section = Section("header", BASE_BODY) 50 | r = section.body 51 | expected = BASE_BODY 52 | self.assertEqual(expected, r) 53 | 54 | def test_init_with_custom_value_converter(self): 55 | value_converter = ValueConverter(float_decoder=Decimal) 56 | section = Section("", value_converter=value_converter) 57 | self.assertIs(Decimal, section.value_converter.float_decoder) 58 | 59 | def test_update_body(self): 60 | section = Section("header") 61 | invalid_base_body = 3.14 62 | with self.assertRaises(errors.ConversionError): 63 | # body should be a list of string, a dict, or a string 64 | section.update(invalid_base_body) 65 | 66 | def test_create_dict(self): 67 | # test with empty body 68 | section = Section("") 69 | r = section.create_dict() 70 | self.assertEqual(OrderedDict(), r) 71 | # empty body + default parameter set 72 | default = {"is_empty": True} 73 | r = section.create_dict(default) 74 | self.assertIs(default, r) 75 | # == test with existent and compatible body 76 | section.update(BASE_BODY) 77 | # compact_mode = true 78 | r = section.create_dict(strict=True) 79 | self.assertIsNotNone(r) 80 | self.assertFalse(_find_comment(r)) 81 | # compact_mode = false 82 | r = section.create_dict(strict=False) 83 | self.assertIsNotNone(r) 84 | self.assertTrue(_find_comment(r)) 85 | 86 | def test_create_dict_with_incompatible_body(self): 87 | section = Section("", ["hello world"]) 88 | with self.assertRaises(Exception): 89 | section.create_dict() 90 | 91 | def test_to_text(self): 92 | # non-empty body 93 | section = Section("", ["hello", "world"]) 94 | r = section.to_text() 95 | expected = "hello\nworld" 96 | self.assertEqual(expected, r) 97 | 98 | def test_to_text_with_empty_body(self): 99 | # empty body 100 | section = Section("") 101 | r = section.to_text() 102 | expected = "" 103 | self.assertEqual(expected, r) 104 | 105 | def test_to_dict(self): 106 | # test with empty body 107 | section = Section("") 108 | r = section.to_dict() 109 | self.assertEqual(OrderedDict(), r) 110 | # empty body + default parameter set 111 | default = {"is_empty": True} 112 | r = section.to_dict(default) 113 | self.assertIs(default, r) 114 | # == test with existent and compatible body 115 | section.update(BASE_BODY) 116 | # compact_mode = true 117 | r = section.to_dict(strict=True) 118 | self.assertIsNotNone(r) 119 | self.assertFalse(_find_comment(r)) 120 | # compact_mode = false 121 | r = section.to_dict(strict=False) 122 | self.assertIsNotNone(r) 123 | self.assertTrue(_find_comment(r)) 124 | 125 | def test_to_dict_with_incompatible_body(self): 126 | section = Section("", ["hello world"]) 127 | fallback = {"something_wrong": True} 128 | r = section.to_dict(fallback=fallback) 129 | self.assertEqual(fallback, r) 130 | 131 | 132 | def _find_comment(body, comment="# welcome"): 133 | for key, val in body.items(): 134 | if val == comment: 135 | return True 136 | return False 137 | 138 | 139 | if __name__ == '__main__': 140 | unittest.main() 141 | --------------------------------------------------------------------------------