AdvancedTagScript 3.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- advancedtagscript-3.2.4/AdvancedTagScript.egg-info/PKG-INFO +99 -0
- advancedtagscript-3.2.4/AdvancedTagScript.egg-info/SOURCES.txt +64 -0
- advancedtagscript-3.2.4/AdvancedTagScript.egg-info/dependency_links.txt +1 -0
- advancedtagscript-3.2.4/AdvancedTagScript.egg-info/requires.txt +9 -0
- advancedtagscript-3.2.4/AdvancedTagScript.egg-info/top_level.txt +1 -0
- advancedtagscript-3.2.4/LICENSE +1 -0
- advancedtagscript-3.2.4/MANIFEST.in +2 -0
- advancedtagscript-3.2.4/PKG-INFO +99 -0
- advancedtagscript-3.2.4/README.md +64 -0
- advancedtagscript-3.2.4/TagScriptEngine/__init__.py +227 -0
- advancedtagscript-3.2.4/TagScriptEngine/_warnings.py +88 -0
- advancedtagscript-3.2.4/TagScriptEngine/adapter/__init__.py +50 -0
- advancedtagscript-3.2.4/TagScriptEngine/adapter/discordadapters.py +596 -0
- advancedtagscript-3.2.4/TagScriptEngine/adapter/functionadapter.py +23 -0
- advancedtagscript-3.2.4/TagScriptEngine/adapter/intadapter.py +22 -0
- advancedtagscript-3.2.4/TagScriptEngine/adapter/objectadapter.py +35 -0
- advancedtagscript-3.2.4/TagScriptEngine/adapter/redbotadapters.py +161 -0
- advancedtagscript-3.2.4/TagScriptEngine/adapter/stringadapter.py +47 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/__init__.py +130 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/allowedmentions.py +60 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/assign.py +43 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/breakblock.py +41 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/case.py +63 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/command.py +141 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/comment.py +29 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/control.py +149 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/cooldown.py +95 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/count.py +68 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/embedblock.py +306 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/fiftyfifty.py +34 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/helpers.py +164 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/loosevariablegetter.py +40 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/mathblock.py +164 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/randomblock.py +51 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/range.py +56 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/redirect.py +42 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/replaceblock.py +110 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/require_blacklist.py +79 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/shortcutredirect.py +23 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/stopblock.py +38 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/strf.py +70 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/strictvariablegetter.py +38 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/substr.py +25 -0
- advancedtagscript-3.2.4/TagScriptEngine/block/urlencodeblock.py +41 -0
- advancedtagscript-3.2.4/TagScriptEngine/exceptions.py +105 -0
- advancedtagscript-3.2.4/TagScriptEngine/interface/__init__.py +14 -0
- advancedtagscript-3.2.4/TagScriptEngine/interface/adapter.py +75 -0
- advancedtagscript-3.2.4/TagScriptEngine/interface/block.py +124 -0
- advancedtagscript-3.2.4/TagScriptEngine/interpreter.py +502 -0
- advancedtagscript-3.2.4/TagScriptEngine/py.typed +0 -0
- advancedtagscript-3.2.4/TagScriptEngine/utils.py +71 -0
- advancedtagscript-3.2.4/TagScriptEngine/verb.py +160 -0
- advancedtagscript-3.2.4/pyproject.toml +26 -0
- advancedtagscript-3.2.4/setup.cfg +60 -0
- advancedtagscript-3.2.4/setup.py +3 -0
- advancedtagscript-3.2.4/tests/test_adapters.py +43 -0
- advancedtagscript-3.2.4/tests/test_basic.py +21 -0
- advancedtagscript-3.2.4/tests/test_edgecase.py +159 -0
- advancedtagscript-3.2.4/tests/test_escapes.py +33 -0
- advancedtagscript-3.2.4/tests/test_verbs.py +117 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: AdvancedTagScript
|
|
3
|
+
Version: 3.2.4
|
|
4
|
+
Summary: An easy drop in user-provided Templating system.
|
|
5
|
+
Home-page: https://github.com/cool-aid-man/TagScriptEngine
|
|
6
|
+
Author: cool-aid-man, inthedark.org, PhenoM4n4n
|
|
7
|
+
Author-email: coolaid@duskybot.xyz
|
|
8
|
+
License: Creative Commons Attribution 4.0 International License
|
|
9
|
+
Keywords: tagscript,string-templating,discord.py
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: Freely Distributable
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Topic :: Internet
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: pyparsing
|
|
28
|
+
Requires-Dist: typing_extensions
|
|
29
|
+
Provides-Extra: discord
|
|
30
|
+
Requires-Dist: discord.py>=2.4.0; extra == "discord"
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: orjson; extra == "all"
|
|
33
|
+
Requires-Dist: discord.py>=2.4.0; extra == "all"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
## Information
|
|
37
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
38
|
+
<img src="https://img.shields.io/pypi/pyversions/AdvancedTagScript" alt="AdvancedTagScript" />
|
|
39
|
+
</a>
|
|
40
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
41
|
+
<img src="https://img.shields.io/pypi/v/AdvancedTagScript" alt="PyPI - Version">
|
|
42
|
+
</a>
|
|
43
|
+
<a href="https://advancedtagscript.readthedocs.io/en/latest/?badge=latest">
|
|
44
|
+
<img src="https://readthedocs.org/projects/tagscriptengine/badge/?version=latest" alt="Documentation Status" />
|
|
45
|
+
</a>
|
|
46
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
47
|
+
<img src="https://img.shields.io/pypi/dm/AdvancedTagScript" alt="PyPI - Downloads" />
|
|
48
|
+
|
|
49
|
+
</a>
|
|
50
|
+
|
|
51
|
+
This repository is a fork of JonSnowbd's [TagScript](https://github.com/JonSnowbd/TagScript), a string templating language.
|
|
52
|
+
This fork adds support for Discord object adapters and a couple Discord related blocks, as
|
|
53
|
+
well as multiple utility blocks. Additionally, several tweaks have been made to the engine's
|
|
54
|
+
behavior.
|
|
55
|
+
|
|
56
|
+
This TagScriptEngine is used on [Dusky, a Discord bot](https://duskybot.xyz/invite).
|
|
57
|
+
An example implementation can be found in the [Tags cog](https://github.com/cool-aid-man/cool-cogs/tree/main/tags).
|
|
58
|
+
|
|
59
|
+
Additional documentation on the TagScriptEngine library can be [found here](https://advancedtagscript.readthedocs.io/en/latest/).
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
Download the latest version through pip:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
pip(3) install AdvancedTagScript
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Download from a commit:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
pip(3) install git+https://github.com/cool-aid-man/TagScriptEngine.git@<COMMIT_HASH>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Install for editing/development:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
git clone https://github.com/cool-aid-man/TagScriptEngine.git
|
|
79
|
+
pip(3) install -e ./TagScriptEngine
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## What?
|
|
83
|
+
|
|
84
|
+
AdvancedTagScript is a drop in easy to use string interpreter that lets you provide users with ways of
|
|
85
|
+
customizing their profiles or chat rooms with interactive text.
|
|
86
|
+
|
|
87
|
+
For example TagScript comes out of the box with a random block that would let users provide
|
|
88
|
+
a template that produces a new result each time its ran, or assign math and variables for later
|
|
89
|
+
use.
|
|
90
|
+
|
|
91
|
+
## Dependencies
|
|
92
|
+
|
|
93
|
+
`Python 3.8+`
|
|
94
|
+
|
|
95
|
+
`pyparsing`
|
|
96
|
+
|
|
97
|
+
`discord.py`
|
|
98
|
+
|
|
99
|
+
`Red-DiscordBot` [optional]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.cfg
|
|
6
|
+
setup.py
|
|
7
|
+
AdvancedTagScript.egg-info/PKG-INFO
|
|
8
|
+
AdvancedTagScript.egg-info/SOURCES.txt
|
|
9
|
+
AdvancedTagScript.egg-info/dependency_links.txt
|
|
10
|
+
AdvancedTagScript.egg-info/requires.txt
|
|
11
|
+
AdvancedTagScript.egg-info/top_level.txt
|
|
12
|
+
AdvancedTagscript.egg-info/PKG-INFO
|
|
13
|
+
AdvancedTagscript.egg-info/SOURCES.txt
|
|
14
|
+
AdvancedTagscript.egg-info/dependency_links.txt
|
|
15
|
+
AdvancedTagscript.egg-info/requires.txt
|
|
16
|
+
AdvancedTagscript.egg-info/top_level.txt
|
|
17
|
+
TagScriptEngine/__init__.py
|
|
18
|
+
TagScriptEngine/_warnings.py
|
|
19
|
+
TagScriptEngine/exceptions.py
|
|
20
|
+
TagScriptEngine/interpreter.py
|
|
21
|
+
TagScriptEngine/py.typed
|
|
22
|
+
TagScriptEngine/utils.py
|
|
23
|
+
TagScriptEngine/verb.py
|
|
24
|
+
TagScriptEngine/adapter/__init__.py
|
|
25
|
+
TagScriptEngine/adapter/discordadapters.py
|
|
26
|
+
TagScriptEngine/adapter/functionadapter.py
|
|
27
|
+
TagScriptEngine/adapter/intadapter.py
|
|
28
|
+
TagScriptEngine/adapter/objectadapter.py
|
|
29
|
+
TagScriptEngine/adapter/redbotadapters.py
|
|
30
|
+
TagScriptEngine/adapter/stringadapter.py
|
|
31
|
+
TagScriptEngine/block/__init__.py
|
|
32
|
+
TagScriptEngine/block/allowedmentions.py
|
|
33
|
+
TagScriptEngine/block/assign.py
|
|
34
|
+
TagScriptEngine/block/breakblock.py
|
|
35
|
+
TagScriptEngine/block/case.py
|
|
36
|
+
TagScriptEngine/block/command.py
|
|
37
|
+
TagScriptEngine/block/comment.py
|
|
38
|
+
TagScriptEngine/block/control.py
|
|
39
|
+
TagScriptEngine/block/cooldown.py
|
|
40
|
+
TagScriptEngine/block/count.py
|
|
41
|
+
TagScriptEngine/block/embedblock.py
|
|
42
|
+
TagScriptEngine/block/fiftyfifty.py
|
|
43
|
+
TagScriptEngine/block/helpers.py
|
|
44
|
+
TagScriptEngine/block/loosevariablegetter.py
|
|
45
|
+
TagScriptEngine/block/mathblock.py
|
|
46
|
+
TagScriptEngine/block/randomblock.py
|
|
47
|
+
TagScriptEngine/block/range.py
|
|
48
|
+
TagScriptEngine/block/redirect.py
|
|
49
|
+
TagScriptEngine/block/replaceblock.py
|
|
50
|
+
TagScriptEngine/block/require_blacklist.py
|
|
51
|
+
TagScriptEngine/block/shortcutredirect.py
|
|
52
|
+
TagScriptEngine/block/stopblock.py
|
|
53
|
+
TagScriptEngine/block/strf.py
|
|
54
|
+
TagScriptEngine/block/strictvariablegetter.py
|
|
55
|
+
TagScriptEngine/block/substr.py
|
|
56
|
+
TagScriptEngine/block/urlencodeblock.py
|
|
57
|
+
TagScriptEngine/interface/__init__.py
|
|
58
|
+
TagScriptEngine/interface/adapter.py
|
|
59
|
+
TagScriptEngine/interface/block.py
|
|
60
|
+
tests/test_adapters.py
|
|
61
|
+
tests/test_basic.py
|
|
62
|
+
tests/test_edgecase.py
|
|
63
|
+
tests/test_escapes.py
|
|
64
|
+
tests/test_verbs.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TagScriptEngine
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: AdvancedTagScript
|
|
3
|
+
Version: 3.2.4
|
|
4
|
+
Summary: An easy drop in user-provided Templating system.
|
|
5
|
+
Home-page: https://github.com/cool-aid-man/TagScriptEngine
|
|
6
|
+
Author: cool-aid-man, inthedark.org, PhenoM4n4n
|
|
7
|
+
Author-email: coolaid@duskybot.xyz
|
|
8
|
+
License: Creative Commons Attribution 4.0 International License
|
|
9
|
+
Keywords: tagscript,string-templating,discord.py
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: Freely Distributable
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Topic :: Internet
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: pyparsing
|
|
28
|
+
Requires-Dist: typing_extensions
|
|
29
|
+
Provides-Extra: discord
|
|
30
|
+
Requires-Dist: discord.py>=2.4.0; extra == "discord"
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: orjson; extra == "all"
|
|
33
|
+
Requires-Dist: discord.py>=2.4.0; extra == "all"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
## Information
|
|
37
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
38
|
+
<img src="https://img.shields.io/pypi/pyversions/AdvancedTagScript" alt="AdvancedTagScript" />
|
|
39
|
+
</a>
|
|
40
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
41
|
+
<img src="https://img.shields.io/pypi/v/AdvancedTagScript" alt="PyPI - Version">
|
|
42
|
+
</a>
|
|
43
|
+
<a href="https://advancedtagscript.readthedocs.io/en/latest/?badge=latest">
|
|
44
|
+
<img src="https://readthedocs.org/projects/tagscriptengine/badge/?version=latest" alt="Documentation Status" />
|
|
45
|
+
</a>
|
|
46
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
47
|
+
<img src="https://img.shields.io/pypi/dm/AdvancedTagScript" alt="PyPI - Downloads" />
|
|
48
|
+
|
|
49
|
+
</a>
|
|
50
|
+
|
|
51
|
+
This repository is a fork of JonSnowbd's [TagScript](https://github.com/JonSnowbd/TagScript), a string templating language.
|
|
52
|
+
This fork adds support for Discord object adapters and a couple Discord related blocks, as
|
|
53
|
+
well as multiple utility blocks. Additionally, several tweaks have been made to the engine's
|
|
54
|
+
behavior.
|
|
55
|
+
|
|
56
|
+
This TagScriptEngine is used on [Dusky, a Discord bot](https://duskybot.xyz/invite).
|
|
57
|
+
An example implementation can be found in the [Tags cog](https://github.com/cool-aid-man/cool-cogs/tree/main/tags).
|
|
58
|
+
|
|
59
|
+
Additional documentation on the TagScriptEngine library can be [found here](https://advancedtagscript.readthedocs.io/en/latest/).
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
Download the latest version through pip:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
pip(3) install AdvancedTagScript
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Download from a commit:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
pip(3) install git+https://github.com/cool-aid-man/TagScriptEngine.git@<COMMIT_HASH>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Install for editing/development:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
git clone https://github.com/cool-aid-man/TagScriptEngine.git
|
|
79
|
+
pip(3) install -e ./TagScriptEngine
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## What?
|
|
83
|
+
|
|
84
|
+
AdvancedTagScript is a drop in easy to use string interpreter that lets you provide users with ways of
|
|
85
|
+
customizing their profiles or chat rooms with interactive text.
|
|
86
|
+
|
|
87
|
+
For example TagScript comes out of the box with a random block that would let users provide
|
|
88
|
+
a template that produces a new result each time its ran, or assign math and variables for later
|
|
89
|
+
use.
|
|
90
|
+
|
|
91
|
+
## Dependencies
|
|
92
|
+
|
|
93
|
+
`Python 3.8+`
|
|
94
|
+
|
|
95
|
+
`pyparsing`
|
|
96
|
+
|
|
97
|
+
`discord.py`
|
|
98
|
+
|
|
99
|
+
`Red-DiscordBot` [optional]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
## Information
|
|
2
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
3
|
+
<img src="https://img.shields.io/pypi/pyversions/AdvancedTagScript" alt="AdvancedTagScript" />
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
6
|
+
<img src="https://img.shields.io/pypi/v/AdvancedTagScript" alt="PyPI - Version">
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://advancedtagscript.readthedocs.io/en/latest/?badge=latest">
|
|
9
|
+
<img src="https://readthedocs.org/projects/tagscriptengine/badge/?version=latest" alt="Documentation Status" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
12
|
+
<img src="https://img.shields.io/pypi/dm/AdvancedTagScript" alt="PyPI - Downloads" />
|
|
13
|
+
|
|
14
|
+
</a>
|
|
15
|
+
|
|
16
|
+
This repository is a fork of JonSnowbd's [TagScript](https://github.com/JonSnowbd/TagScript), a string templating language.
|
|
17
|
+
This fork adds support for Discord object adapters and a couple Discord related blocks, as
|
|
18
|
+
well as multiple utility blocks. Additionally, several tweaks have been made to the engine's
|
|
19
|
+
behavior.
|
|
20
|
+
|
|
21
|
+
This TagScriptEngine is used on [Dusky, a Discord bot](https://duskybot.xyz/invite).
|
|
22
|
+
An example implementation can be found in the [Tags cog](https://github.com/cool-aid-man/cool-cogs/tree/main/tags).
|
|
23
|
+
|
|
24
|
+
Additional documentation on the TagScriptEngine library can be [found here](https://advancedtagscript.readthedocs.io/en/latest/).
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Download the latest version through pip:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
pip(3) install AdvancedTagScript
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Download from a commit:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
pip(3) install git+https://github.com/cool-aid-man/TagScriptEngine.git@<COMMIT_HASH>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Install for editing/development:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
git clone https://github.com/cool-aid-man/TagScriptEngine.git
|
|
44
|
+
pip(3) install -e ./TagScriptEngine
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## What?
|
|
48
|
+
|
|
49
|
+
AdvancedTagScript is a drop in easy to use string interpreter that lets you provide users with ways of
|
|
50
|
+
customizing their profiles or chat rooms with interactive text.
|
|
51
|
+
|
|
52
|
+
For example TagScript comes out of the box with a random block that would let users provide
|
|
53
|
+
a template that produces a new result each time its ran, or assign math and variables for later
|
|
54
|
+
use.
|
|
55
|
+
|
|
56
|
+
## Dependencies
|
|
57
|
+
|
|
58
|
+
`Python 3.8+`
|
|
59
|
+
|
|
60
|
+
`pyparsing`
|
|
61
|
+
|
|
62
|
+
`discord.py`
|
|
63
|
+
|
|
64
|
+
`Red-DiscordBot` [optional]
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Final, NamedTuple, Tuple
|
|
4
|
+
|
|
5
|
+
from .adapter import (
|
|
6
|
+
SafeObjectAdapter as SafeObjectAdapter,
|
|
7
|
+
StringAdapter as StringAdapter,
|
|
8
|
+
IntAdapter as IntAdapter,
|
|
9
|
+
FunctionAdapter as FunctionAdapter,
|
|
10
|
+
DiscordAttributeAdapter as DiscordAttributeAdapter,
|
|
11
|
+
UserAdapter as UserAdapter,
|
|
12
|
+
MemberAdapter as MemberAdapter,
|
|
13
|
+
DMChannelAdapter as DMChannelAdapter,
|
|
14
|
+
ChannelAdapter as ChannelAdapter,
|
|
15
|
+
GuildAdapter as GuildAdapter,
|
|
16
|
+
RoleAdapter as RoleAdapter,
|
|
17
|
+
AttributeAdapter as AttributeAdapter,
|
|
18
|
+
DiscordObjectAdapter as DiscordObjectAdapter,
|
|
19
|
+
RedCommandAdapter as RedCommandAdapter,
|
|
20
|
+
RedBotAdapter as RedBotAdapter,
|
|
21
|
+
)
|
|
22
|
+
from .block import (
|
|
23
|
+
implicit_bool as implicit_bool,
|
|
24
|
+
helper_parse_if as helper_parse_if,
|
|
25
|
+
helper_parse_list_if as helper_parse_list_if,
|
|
26
|
+
helper_split as helper_split,
|
|
27
|
+
AllowedMentionsBlock as AllowedMentionsBlock,
|
|
28
|
+
AllBlock as AllBlock,
|
|
29
|
+
AnyBlock as AnyBlock,
|
|
30
|
+
AssignmentBlock as AssignmentBlock,
|
|
31
|
+
BlacklistBlock as BlacklistBlock,
|
|
32
|
+
BreakBlock as BreakBlock,
|
|
33
|
+
SequentialGather as SequentialGather,
|
|
34
|
+
CommandBlock as CommandBlock,
|
|
35
|
+
EmbedBlock as EmbedBlock,
|
|
36
|
+
FiftyFiftyBlock as FiftyFiftyBlock,
|
|
37
|
+
IfBlock as IfBlock,
|
|
38
|
+
LooseVariableGetterBlock as LooseVariableGetterBlock,
|
|
39
|
+
MathBlock as MathBlock,
|
|
40
|
+
OverrideBlock as OverrideBlock,
|
|
41
|
+
PythonBlock as PythonBlock,
|
|
42
|
+
RandomBlock as RandomBlock,
|
|
43
|
+
RangeBlock as RangeBlock,
|
|
44
|
+
RedirectBlock as RedirectBlock,
|
|
45
|
+
ReplaceBlock as ReplaceBlock,
|
|
46
|
+
RequireBlock as RequireBlock,
|
|
47
|
+
ShortCutRedirectBlock as ShortCutRedirectBlock,
|
|
48
|
+
StopBlock as StopBlock,
|
|
49
|
+
StrfBlock as StrfBlock,
|
|
50
|
+
StrictVariableGetterBlock as StrictVariableGetterBlock,
|
|
51
|
+
SubstringBlock as SubstringBlock,
|
|
52
|
+
URLEncodeBlock as URLEncodeBlock,
|
|
53
|
+
UpperBlock as UpperBlock,
|
|
54
|
+
LowerBlock as LowerBlock,
|
|
55
|
+
CountBlock as CountBlock,
|
|
56
|
+
LengthBlock as LengthBlock,
|
|
57
|
+
CooldownBlock as CooldownBlock,
|
|
58
|
+
)
|
|
59
|
+
from .interface import (
|
|
60
|
+
Adapter as Adapter,
|
|
61
|
+
SimpleAdapter as SimpleAdapter,
|
|
62
|
+
Block as Block,
|
|
63
|
+
verb_required_block as verb_required_block,
|
|
64
|
+
)
|
|
65
|
+
from ._warnings import (
|
|
66
|
+
TagScriptEngineDeprecationWarning as TagScriptEngineDeprecationWarning,
|
|
67
|
+
)
|
|
68
|
+
from .exceptions import (
|
|
69
|
+
TagScriptError as TagScriptError,
|
|
70
|
+
WorkloadExceededError as WorkloadExceededError,
|
|
71
|
+
ProcessError as ProcessError,
|
|
72
|
+
EmbedParseError as EmbedParseError,
|
|
73
|
+
BadColourArgument as BadColourArgument,
|
|
74
|
+
StopError as StopError,
|
|
75
|
+
CooldownExceeded as CooldownExceeded,
|
|
76
|
+
)
|
|
77
|
+
from .interpreter import (
|
|
78
|
+
Interpreter as Interpreter,
|
|
79
|
+
AsyncInterpreter as AsyncInterpreter,
|
|
80
|
+
Context as Context,
|
|
81
|
+
Response as Response,
|
|
82
|
+
Node as Node,
|
|
83
|
+
build_node_tree as build_node_tree,
|
|
84
|
+
)
|
|
85
|
+
from .utils import (
|
|
86
|
+
truncate as truncate,
|
|
87
|
+
escape_content as escape_content,
|
|
88
|
+
maybe_await as maybe_await,
|
|
89
|
+
)
|
|
90
|
+
from .verb import (
|
|
91
|
+
Verb as Verb,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
__all__: Tuple[str, ...] = (
|
|
96
|
+
"implicit_bool",
|
|
97
|
+
"helper_parse_if",
|
|
98
|
+
"helper_parse_list_if",
|
|
99
|
+
"helper_split",
|
|
100
|
+
"AllBlock",
|
|
101
|
+
"AnyBlock",
|
|
102
|
+
"AssignmentBlock",
|
|
103
|
+
"BlacklistBlock",
|
|
104
|
+
"BreakBlock",
|
|
105
|
+
"SequentialGather",
|
|
106
|
+
"CommandBlock",
|
|
107
|
+
"CooldownBlock",
|
|
108
|
+
"EmbedBlock",
|
|
109
|
+
"FiftyFiftyBlock",
|
|
110
|
+
"IfBlock",
|
|
111
|
+
"LooseVariableGetterBlock",
|
|
112
|
+
"MathBlock",
|
|
113
|
+
"OverrideBlock",
|
|
114
|
+
"PythonBlock",
|
|
115
|
+
"RandomBlock",
|
|
116
|
+
"RangeBlock",
|
|
117
|
+
"RedirectBlock",
|
|
118
|
+
"ReplaceBlock",
|
|
119
|
+
"RequireBlock",
|
|
120
|
+
"ShortCutRedirectBlock",
|
|
121
|
+
"StopBlock",
|
|
122
|
+
"StrfBlock",
|
|
123
|
+
"StrictVariableGetterBlock",
|
|
124
|
+
"SubstringBlock",
|
|
125
|
+
"URLEncodeBlock",
|
|
126
|
+
"UpperBlock",
|
|
127
|
+
"LowerBlock",
|
|
128
|
+
"CountBlock",
|
|
129
|
+
"LengthBlock",
|
|
130
|
+
"SafeObjectAdapter",
|
|
131
|
+
"StringAdapter",
|
|
132
|
+
"IntAdapter",
|
|
133
|
+
"FunctionAdapter",
|
|
134
|
+
"RedCommandAdapter",
|
|
135
|
+
"RedBotAdapter",
|
|
136
|
+
"AttributeAdapter",
|
|
137
|
+
"DiscordAttributeAdapter",
|
|
138
|
+
"UserAdapter",
|
|
139
|
+
"MemberAdapter",
|
|
140
|
+
"DMChannelAdapter",
|
|
141
|
+
"ChannelAdapter",
|
|
142
|
+
"GuildAdapter",
|
|
143
|
+
"RoleAdapter",
|
|
144
|
+
"DiscordObjectAdapter",
|
|
145
|
+
"Adapter",
|
|
146
|
+
"SimpleAdapter",
|
|
147
|
+
"Block",
|
|
148
|
+
"verb_required_block",
|
|
149
|
+
"TagScriptEngineDeprecationWarning",
|
|
150
|
+
"TagScriptError",
|
|
151
|
+
"WorkloadExceededError",
|
|
152
|
+
"ProcessError",
|
|
153
|
+
"EmbedParseError",
|
|
154
|
+
"BadColourArgument",
|
|
155
|
+
"StopError",
|
|
156
|
+
"CooldownExceeded",
|
|
157
|
+
"Interpreter",
|
|
158
|
+
"AsyncInterpreter",
|
|
159
|
+
"Context",
|
|
160
|
+
"Response",
|
|
161
|
+
"Node",
|
|
162
|
+
"build_node_tree",
|
|
163
|
+
"truncate",
|
|
164
|
+
"escape_content",
|
|
165
|
+
"maybe_await",
|
|
166
|
+
"Verb",
|
|
167
|
+
"__version__",
|
|
168
|
+
"VersionInfo",
|
|
169
|
+
"version_info",
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
__version__: Final[str] = "3.2.4"
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class VersionNamedTuple(NamedTuple):
|
|
177
|
+
major: int
|
|
178
|
+
minor: int
|
|
179
|
+
micro: int
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class VersionInfo(VersionNamedTuple):
|
|
183
|
+
"""
|
|
184
|
+
Version information.
|
|
185
|
+
|
|
186
|
+
Attributes
|
|
187
|
+
----------
|
|
188
|
+
major: int
|
|
189
|
+
Major version number.
|
|
190
|
+
minor: int
|
|
191
|
+
Minor version number.
|
|
192
|
+
micro: int
|
|
193
|
+
Micro version number.
|
|
194
|
+
"""
|
|
195
|
+
|
|
196
|
+
__slots__: Tuple[str, ...] = ()
|
|
197
|
+
|
|
198
|
+
def __str__(self) -> str:
|
|
199
|
+
"""
|
|
200
|
+
Returns a string representation of the version information.
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
str
|
|
205
|
+
String representation of the version information.
|
|
206
|
+
"""
|
|
207
|
+
return "{major}.{minor}.{micro}".format(**self._asdict())
|
|
208
|
+
|
|
209
|
+
@classmethod
|
|
210
|
+
def from_str(cls, version: str) -> "VersionInfo":
|
|
211
|
+
"""
|
|
212
|
+
Returns a VersionInfo instance from a string.
|
|
213
|
+
|
|
214
|
+
Parameters
|
|
215
|
+
----------
|
|
216
|
+
version: str
|
|
217
|
+
String representation of the version information.
|
|
218
|
+
|
|
219
|
+
Returns
|
|
220
|
+
-------
|
|
221
|
+
VersionInfo
|
|
222
|
+
Version information.
|
|
223
|
+
"""
|
|
224
|
+
return cls(*map(int, version.split(".")))
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
version_info: VersionInfo = VersionInfo.from_str(__version__)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
import functools
|
|
3
|
+
from typing import Callable, Optional, Tuple, TypeVar
|
|
4
|
+
from typing_extensions import ParamSpec
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
_P = ParamSpec("_P")
|
|
8
|
+
_T = TypeVar("_T")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
__all__: Tuple[str, ...] = (
|
|
12
|
+
"TagScriptEngineDeprecationWarning",
|
|
13
|
+
"TagScriptEngineAttributeRemovalWarning",
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TagScriptEngineAttributeRemovalWarning(Warning):
|
|
18
|
+
"""A class for issuing removal warning for TagScriptEngine class attributes."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TagScriptEngineDeprecationWarning(DeprecationWarning):
|
|
22
|
+
"""A class for issuing deprecation warnings for TagScriptEngine modules."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def remove(
|
|
26
|
+
name: str, *, reason: Optional[str] = None, version: Optional[str] = None, level: int = 2
|
|
27
|
+
) -> None:
|
|
28
|
+
warnings.warn(
|
|
29
|
+
"Removal: {name}.{reason}{version}".format(
|
|
30
|
+
name=name,
|
|
31
|
+
reason=" ({})".format(reason) if reason else "",
|
|
32
|
+
version=" -- Removal scheduled since version v{}".format(version) if version else "",
|
|
33
|
+
),
|
|
34
|
+
category=TagScriptEngineAttributeRemovalWarning,
|
|
35
|
+
stacklevel=level,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def removal(
|
|
40
|
+
*,
|
|
41
|
+
name: Optional[str] = None,
|
|
42
|
+
reason: Optional[str] = None,
|
|
43
|
+
version: Optional[str] = None,
|
|
44
|
+
level: int = 3,
|
|
45
|
+
) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]:
|
|
46
|
+
def decorator(func: Callable[_P, _T]) -> Callable[_P, _T]:
|
|
47
|
+
functools.wraps(func)
|
|
48
|
+
|
|
49
|
+
def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _T:
|
|
50
|
+
remove(name or func.__name__, reason=reason, version=version, level=level)
|
|
51
|
+
return func(*args, **kwargs)
|
|
52
|
+
|
|
53
|
+
return wrapper
|
|
54
|
+
|
|
55
|
+
return decorator
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def depricate(
|
|
59
|
+
name: str, *, reason: Optional[str] = None, version: Optional[str] = None, level: int = 2
|
|
60
|
+
) -> None:
|
|
61
|
+
warnings.warn(
|
|
62
|
+
"Deprecated: {name}.{reason}{version}".format(
|
|
63
|
+
name=name,
|
|
64
|
+
reason=" ({})".format(reason) if reason else "",
|
|
65
|
+
version=" -- Deprecated since version v{}.".format(version) if version else "",
|
|
66
|
+
),
|
|
67
|
+
category=TagScriptEngineDeprecationWarning,
|
|
68
|
+
stacklevel=level,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def deprecated(
|
|
73
|
+
*,
|
|
74
|
+
name: Optional[str] = None,
|
|
75
|
+
reason: Optional[str] = None,
|
|
76
|
+
version: Optional[str] = None,
|
|
77
|
+
level: int = 3,
|
|
78
|
+
) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]:
|
|
79
|
+
def decorator(func: Callable[_P, _T]) -> Callable[_P, _T]:
|
|
80
|
+
functools.wraps(func)
|
|
81
|
+
|
|
82
|
+
def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _T:
|
|
83
|
+
depricate(name or func.__name__, reason=reason, version=version, level=level)
|
|
84
|
+
return func(*args, **kwargs)
|
|
85
|
+
|
|
86
|
+
return wrapper
|
|
87
|
+
|
|
88
|
+
return decorator
|