genocide 161__tar.gz → 170__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.
- {genocide-161 → genocide-170}/PKG-INFO +3 -3
- {genocide-161 → genocide-170}/README.rst +1 -1
- genocide-170/bin/genocide +1 -0
- genocide-170/bin/genocided +1 -0
- {genocide-161 → genocide-170}/docs/_templates/base.rst +1 -10
- {genocide-161 → genocide-170}/docs/conf.py +1 -1
- {genocide-161 → genocide-170}/docs/index.rst +1 -1
- {genocide-161 → genocide-170}/docs/manual.rst +3 -2
- genocide-170/genocide/__init__.py +4 -0
- genocide-170/genocide/__main__.py +168 -0
- genocide-170/genocide/cache.py +30 -0
- genocide-161/genocide/config.py → genocide-170/genocide/cfg.py +3 -2
- genocide-170/genocide/cli.py +44 -0
- genocide-161/genocide/commands.py → genocide-170/genocide/cmds.py +16 -17
- genocide-170/genocide/decode.py +74 -0
- genocide-161/genocide/errors.py → genocide-170/genocide/defer.py +3 -2
- genocide-161/genocide/default.py → genocide-170/genocide/dft.py +2 -1
- genocide-170/genocide/disk.py +162 -0
- genocide-170/genocide/encode.py +75 -0
- {genocide-161 → genocide-170}/genocide/event.py +6 -6
- genocide-170/genocide/face.py +78 -0
- genocide-170/genocide/fleet.py +39 -0
- genocide-161/genocide/handler.py → genocide-170/genocide/handle.py +5 -4
- genocide-161/genocide/thread.py → genocide-170/genocide/launch.py +9 -7
- genocide-170/genocide/lock.py +20 -0
- {genocide-161 → genocide-170}/genocide/log.py +3 -2
- genocide-170/genocide/main.py +78 -0
- {genocide-161 → genocide-170}/genocide/modules/__init__.py +4 -10
- genocide-170/genocide/modules/cmd.py +13 -0
- {genocide-161 → genocide-170}/genocide/modules/err.py +6 -2
- genocide-170/genocide/modules/hlp.py +36 -0
- {genocide-161 → genocide-170}/genocide/modules/irc.py +51 -62
- {genocide-161 → genocide-170}/genocide/modules/log.py +4 -4
- {genocide-161 → genocide-170}/genocide/modules/mod.py +10 -0
- {genocide-161 → genocide-170}/genocide/modules/rss.py +182 -36
- {genocide-161 → genocide-170}/genocide/modules/tdo.py +4 -4
- genocide-170/genocide/modules/upt.py +18 -0
- {genocide-161 → genocide-170}/genocide/object.py +7 -125
- genocide-170/genocide/ool.py +39 -0
- genocide-161/genocide/parser.py → genocide-170/genocide/parse.py +1 -1
- genocide-161/genocide/repeater.py → genocide-170/genocide/repeat.py +2 -2
- {genocide-161 → genocide-170}/genocide/run.py +4 -2
- genocide-170/genocide/term.py +36 -0
- {genocide-161 → genocide-170}/genocide/timer.py +4 -6
- {genocide-161 → genocide-170}/genocide/utils.py +40 -23
- {genocide-161 → genocide-170}/genocide.egg-info/PKG-INFO +3 -3
- {genocide-161 → genocide-170}/genocide.egg-info/SOURCES.txt +22 -16
- genocide-170/genocide.egg-info/entry_points.txt +2 -0
- {genocide-161 → genocide-170}/pyproject.toml +4 -3
- genocide-161/bin/genocide +0 -136
- genocide-161/bin/genocided +0 -83
- genocide-161/genocide/__init__.py +0 -4
- genocide-161/genocide/broker.py +0 -109
- genocide-161/genocide/classes.py +0 -57
- genocide-161/genocide/client.py +0 -92
- genocide-161/genocide/disk.py +0 -65
- genocide-161/genocide/find.py +0 -71
- genocide-161/genocide/iface.py +0 -78
- genocide-161/genocide/modules/cmd.py +0 -13
- genocide-161/genocide/modules/opm.py +0 -138
- genocide-161/genocide/modules/slg.py +0 -19
- genocide-161/genocide/modules/tmr.py +0 -229
- {genocide-161 → genocide-170}/docs/ECHAabilify.png +0 -0
- {genocide-161 → genocide-170}/docs/ECHAclozapine.png +0 -0
- {genocide-161 → genocide-170}/docs/ECHAhaldol.png +0 -0
- {genocide-161 → genocide-170}/docs/ECHAzyprexa.png +0 -0
- {genocide-161 → genocide-170}/docs/OTP111.png +0 -0
- {genocide-161 → genocide-170}/docs/OTP222.png +0 -0
- {genocide-161 → genocide-170}/docs/_static/genocide.css +0 -0
- {genocide-161 → genocide-170}/docs/_templates/class.rst +0 -0
- {genocide-161 → genocide-170}/docs/_templates/mine.rst +0 -0
- {genocide-161 → genocide-170}/docs/_templates/module.rst +0 -0
- {genocide-161 → genocide-170}/docs/about.rst +0 -0
- {genocide-161 → genocide-170}/docs/ack3.png +0 -0
- {genocide-161 → genocide-170}/docs/bevestigd.jpg +0 -0
- {genocide-161 → genocide-170}/docs/bylaw.png +0 -0
- {genocide-161 → genocide-170}/docs/evidence.rst +0 -0
- {genocide-161 → genocide-170}/docs/genocide.jpg +0 -0
- {genocide-161 → genocide-170}/docs/genocide.png +0 -0
- {genocide-161 → genocide-170}/docs/guilty.rst +0 -0
- {genocide-161 → genocide-170}/docs/informed.jpg +0 -0
- {genocide-161 → genocide-170}/docs/kamer2.png +0 -0
- {genocide-161 → genocide-170}/docs/pdf/EM_Ack_OTP-CR-117_19.pdf +0 -0
- {genocide-161 → genocide-170}/docs/pdf/EM_T04_OTP-CR-117_19.pdf +0 -0
- {genocide-161 → genocide-170}/docs/pdf/EM_T07_OTP-CR-117_19_001.pdf +0 -0
- {genocide-161 → genocide-170}/docs/pdf/Kamer.pdf +0 -0
- {genocide-161 → genocide-170}/docs/pdf/Rome-Statute.pdf +0 -0
- {genocide-161 → genocide-170}/docs/pdf/bevestigd.pdf +0 -0
- {genocide-161 → genocide-170}/docs/request.rst +0 -0
- {genocide-161 → genocide-170}/docs/robots.txt +0 -0
- {genocide-161 → genocide-170}/docs/skull3.png +0 -0
- {genocide-161 → genocide-170}/docs/verbatim7.png +0 -0
- {genocide-161 → genocide-170}/docs/writings.rst +0 -0
- {genocide-161 → genocide-170}/genocide/modules/req.py +0 -0
- {genocide-161 → genocide-170}/genocide/modules/thr.py +0 -0
- {genocide-161 → genocide-170}/genocide.egg-info/dependency_links.txt +0 -0
- {genocide-161 → genocide-170}/genocide.egg-info/requires.txt +0 -0
- {genocide-161 → genocide-170}/genocide.egg-info/top_level.txt +0 -0
- {genocide-161 → genocide-170}/genocide.egg-info/zip-safe +0 -0
- {genocide-161 → genocide-170}/setup.cfg +0 -0
- {genocide-161 → genocide-170}/setup.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: genocide
|
|
3
|
-
Version:
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 170
|
|
4
|
+
Summary: @KarimKhanQC reconsider OTP-CR-117/19. Elderly, Wicked, Criminals, Handicapped.
|
|
5
5
|
Author-email: Bart Thate <bthate@dds.nl>
|
|
6
6
|
License: Public Domain
|
|
7
7
|
Project-URL: home, https://pypi.org/project/genocide
|
|
@@ -72,5 +72,5 @@ prosecute the king for making the commiting of the above mentioned crimes
|
|
|
72
72
|
p.s.
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
1)
|
|
75
|
+
1) entered in the Communications Register of the Office on 4 march 2019
|
|
76
76
|
2) your reference ``OTP-CR-117/19``
|
|
@@ -55,5 +55,5 @@ prosecute the king for making the commiting of the above mentioned crimes
|
|
|
55
55
|
p.s.
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
1)
|
|
58
|
+
1) entered in the Communications Register of the Office on 4 march 2019
|
|
59
59
|
2) your reference ``OTP-CR-117/19``
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
python3 -m genocide $* ;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
python3 -m genocide -d
|
|
@@ -7,16 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
.. title:: {{ fullname }}
|
|
9
9
|
|
|
10
|
-
.. raw:: html
|
|
11
|
-
|
|
12
|
-
<center><b>
|
|
13
|
-
|
|
14
|
-
:ref:`home <home>` - :ref:`manual <manual>` - :ref:`source <source>`
|
|
15
|
-
|
|
16
|
-
.. raw: html
|
|
17
|
-
</b></center>
|
|
18
|
-
<br><br>
|
|
19
|
-
<center><b>
|
|
20
10
|
|
|
21
11
|
**{{ fullname }}**
|
|
22
12
|
|
|
@@ -32,4 +22,5 @@
|
|
|
32
22
|
.. raw:: html
|
|
33
23
|
|
|
34
24
|
<br><br>
|
|
25
|
+
|
|
35
26
|
'''
|
|
@@ -127,7 +127,7 @@ rst_epilog = '''.. raw:: html
|
|
|
127
127
|
<center>
|
|
128
128
|
<b>
|
|
129
129
|
|
|
130
|
-
:ref:`reconsider <reconsider>` - :ref:`evidence <evidence>` - :ref:`guilty <guilty>` - :ref:`correspondence <writings>`
|
|
130
|
+
:ref:`about <about>` - :ref:`reconsider <reconsider>` - :ref:`evidence <evidence>` - :ref:`guilty <guilty>` - :ref:`correspondence <writings>` - :ref:`manual <manual>` - :ref:`source <source>`
|
|
131
131
|
|
|
132
132
|
.. raw: html
|
|
133
133
|
|
|
@@ -65,7 +65,7 @@ prosecute the king for making the commiting of the above mentioned crimes
|
|
|
65
65
|
p.s.
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
1)
|
|
68
|
+
1) entered in the Communications Register of the Office on 4 march 2019
|
|
69
69
|
2) your reference ``OTP-CR-117/19``
|
|
70
70
|
|
|
71
71
|
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
**NAME**
|
|
11
11
|
|
|
12
|
-
**GENOCIDE** -
|
|
12
|
+
**GENOCIDE** - @KarimKhanQC reconsider OTP-CR-117/19.
|
|
13
|
+
Elderly, Wicked, Criminals, Handicapped.
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
**INSTALL**
|
|
@@ -165,7 +166,7 @@
|
|
|
165
166
|
User=<user>
|
|
166
167
|
Group=<user>
|
|
167
168
|
WorkingDirectory=/home/<user>/.genocide
|
|
168
|
-
ExecStart=/home/<user>/.local/pipx/venvs/genocide/bin/
|
|
169
|
+
ExecStart=/home/<user>/.local/pipx/venvs/genocide/bin/genocide -d
|
|
169
170
|
RemainAfterExit=yes
|
|
170
171
|
|
|
171
172
|
[Install]
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# This file is placed in the Public Domain.
|
|
2
|
+
# pylint: disable=C0413,W0212,W0401,W0614,W0718,E0401,E1121
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
"main"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import getpass
|
|
9
|
+
import os
|
|
10
|
+
import pwd
|
|
11
|
+
import sys
|
|
12
|
+
import readline
|
|
13
|
+
import termios
|
|
14
|
+
import time
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
from .face import *
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
from . import modules
|
|
21
|
+
from . import user
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
if os.path.exists("mods"):
|
|
25
|
+
import mods as MODS
|
|
26
|
+
else:
|
|
27
|
+
MODS = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Cfg = Config()
|
|
31
|
+
Cfg.dis = ""
|
|
32
|
+
Cfg.mod = "mod,cmd,err,thr"
|
|
33
|
+
Cfg.name = "genocide"
|
|
34
|
+
Cfg.opts = ""
|
|
35
|
+
Cfg.user = getpass.getuser()
|
|
36
|
+
Cfg.wdr = os.path.expanduser(f"~/.{Cfg.name}")
|
|
37
|
+
Cfg.pidfile = os.path.join(Cfg.wdr, f"{Cfg.name}.pid")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Persist.workdir = Cfg.wdr
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class CSL(Console):
|
|
44
|
+
|
|
45
|
+
"cSL"
|
|
46
|
+
|
|
47
|
+
def announce(self, txt):
|
|
48
|
+
"mask announce"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def daemon(verbose=False):
|
|
52
|
+
"switch to background."
|
|
53
|
+
pid = os.fork()
|
|
54
|
+
if pid != 0:
|
|
55
|
+
os._exit(0)
|
|
56
|
+
os.setsid()
|
|
57
|
+
pid2 = os.fork()
|
|
58
|
+
if pid2 != 0:
|
|
59
|
+
os._exit(0)
|
|
60
|
+
if not verbose:
|
|
61
|
+
with open('/dev/null', 'r', encoding="utf-8") as sis:
|
|
62
|
+
os.dup2(sis.fileno(), sys.stdin.fileno())
|
|
63
|
+
with open('/dev/null', 'a+', encoding="utf-8") as sos:
|
|
64
|
+
os.dup2(sos.fileno(), sys.stdout.fileno())
|
|
65
|
+
with open('/dev/null', 'a+', encoding="utf-8") as ses:
|
|
66
|
+
os.dup2(ses.fileno(), sys.stderr.fileno())
|
|
67
|
+
os.umask(0)
|
|
68
|
+
os.chdir("/")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def privileges(username):
|
|
72
|
+
"drop privileges."
|
|
73
|
+
pwnam = pwd.getpwnam(username)
|
|
74
|
+
os.setgid(pwnam.pw_gid)
|
|
75
|
+
os.setuid(pwnam.pw_uid)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def wrap(func):
|
|
79
|
+
"catch exceptions"
|
|
80
|
+
try:
|
|
81
|
+
func()
|
|
82
|
+
except (KeyboardInterrupt, EOFError):
|
|
83
|
+
print("")
|
|
84
|
+
except Exception as ex:
|
|
85
|
+
later(ex)
|
|
86
|
+
errors()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def basic():
|
|
90
|
+
"main"
|
|
91
|
+
enable(print)
|
|
92
|
+
parse(Cfg, " ".join(sys.argv[1:]))
|
|
93
|
+
if "h" in Cfg.opts:
|
|
94
|
+
return cmnd("hlp", print)
|
|
95
|
+
Cfg.dis = Cfg.sets.dis
|
|
96
|
+
Cfg.mod = ",".join(modnames(modules, user))
|
|
97
|
+
scan(Cfg.mod, modules, user)
|
|
98
|
+
return cmnd(Cfg.otxt, print)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def background():
|
|
102
|
+
"main"
|
|
103
|
+
daemon("-v" in sys.argv)
|
|
104
|
+
skel()
|
|
105
|
+
pidfile(Cfg.pidfile)
|
|
106
|
+
privileges(Cfg.user)
|
|
107
|
+
if "-v" in sys.argv:
|
|
108
|
+
enable(print)
|
|
109
|
+
Cfg.mod = ",".join(modnames(modules, user))
|
|
110
|
+
scan(Cfg.mod, modules, user)
|
|
111
|
+
init(Cfg.mod, modules, user)
|
|
112
|
+
forever()
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def console(func):
|
|
116
|
+
"reset terminal."
|
|
117
|
+
old3 = None
|
|
118
|
+
try:
|
|
119
|
+
old3 = termios.tcgetattr(sys.stdin.fileno())
|
|
120
|
+
except termios.error:
|
|
121
|
+
pass
|
|
122
|
+
try:
|
|
123
|
+
func()
|
|
124
|
+
except (KeyboardInterrupt, EOFError):
|
|
125
|
+
print("")
|
|
126
|
+
finally:
|
|
127
|
+
if old3:
|
|
128
|
+
termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, old3)
|
|
129
|
+
errors()
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def terminal():
|
|
133
|
+
"main"
|
|
134
|
+
readline.redisplay()
|
|
135
|
+
enable(print)
|
|
136
|
+
skel()
|
|
137
|
+
parse(Cfg, " ".join(sys.argv[1:]))
|
|
138
|
+
Cfg.dis = Cfg.sets.dis
|
|
139
|
+
Cfg.mod += "," + ",".join(modnames(modules, user, MODS))
|
|
140
|
+
if "v" in Cfg.opts:
|
|
141
|
+
dte = " ".join(time.ctime(time.time()).replace(" ", " ").split()[1:])
|
|
142
|
+
mods = ','.join(sorted({x.upper() for x in spl(Cfg.mod)}))
|
|
143
|
+
print(f'{dte} {Cfg.name.upper()} {Cfg.opts.upper()} {mods}'.replace(" ", " "))
|
|
144
|
+
scan(Cfg.mod, modules, user, MODS, Cfg.dis)
|
|
145
|
+
csl = CSL(print, input)
|
|
146
|
+
if "i" in Cfg.opts:
|
|
147
|
+
init(Cfg.mod, modules, user, MODS, Cfg.dis)
|
|
148
|
+
csl.start()
|
|
149
|
+
cmnd(Cfg.otxt, print)
|
|
150
|
+
forever()
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def wrapped():
|
|
154
|
+
"starting point."
|
|
155
|
+
if len(sys.argv) < 2:
|
|
156
|
+
return
|
|
157
|
+
if "-d" in sys.argv[1]:
|
|
158
|
+
background()
|
|
159
|
+
elif "-h" in sys.argv[1]:
|
|
160
|
+
cmnd("hlp", print)
|
|
161
|
+
elif "-c" in sys.argv[1]:
|
|
162
|
+
console(terminal)
|
|
163
|
+
else:
|
|
164
|
+
wrap(basic)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if __name__ == "__main__":
|
|
168
|
+
wrapped()
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This file is placed in the Public Domain.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
"caching"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
from .object import Object
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Broker:
|
|
11
|
+
|
|
12
|
+
"Broker"
|
|
13
|
+
|
|
14
|
+
def __init__(self):
|
|
15
|
+
self.objs = Object()
|
|
16
|
+
|
|
17
|
+
def get(self, orig):
|
|
18
|
+
"return object by origin (repr)"
|
|
19
|
+
return getattr(self.objs, orig, None)
|
|
20
|
+
|
|
21
|
+
def register(self, obj):
|
|
22
|
+
"add an object to the broker."
|
|
23
|
+
ids = object.__repr__(obj)
|
|
24
|
+
setattr(self.objs, ids, obj)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def __dir__():
|
|
28
|
+
return (
|
|
29
|
+
'Broker',
|
|
30
|
+
)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# This file is placed in the Public Domain.
|
|
2
|
+
# pylint: disable=R0902,R0903
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
"configuration"
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
from .
|
|
8
|
+
from .dft import Default
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
class Config(Default):
|
|
11
|
+
class Config(Default):
|
|
11
12
|
|
|
12
13
|
"Config"
|
|
13
14
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# This file is placed in the Public Domain.
|
|
2
|
+
# pylint: disable=W0125
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
"command line interface"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
from .cmds import command
|
|
9
|
+
from .handle import Handler
|
|
10
|
+
from .object import Object
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CLI(Handler):
|
|
14
|
+
|
|
15
|
+
"CLI"
|
|
16
|
+
|
|
17
|
+
cache = Object()
|
|
18
|
+
out = None
|
|
19
|
+
|
|
20
|
+
def __init__(self, outer=None):
|
|
21
|
+
Handler.__init__(self)
|
|
22
|
+
self.register("command", command)
|
|
23
|
+
self.out = outer
|
|
24
|
+
|
|
25
|
+
def say(self, _channel, txt):
|
|
26
|
+
"echo on verbose."
|
|
27
|
+
self.raw(txt)
|
|
28
|
+
|
|
29
|
+
def raw(self, txt):
|
|
30
|
+
"print to screen."
|
|
31
|
+
if self.out:
|
|
32
|
+
txt = txt.encode('utf-8', 'replace').decode()
|
|
33
|
+
self.out(txt)
|
|
34
|
+
|
|
35
|
+
def show(self, evt):
|
|
36
|
+
"show results into a channel."
|
|
37
|
+
for txt in evt.result:
|
|
38
|
+
self.say(evt.channel, txt)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def __dir__():
|
|
42
|
+
return (
|
|
43
|
+
'CLI',
|
|
44
|
+
)
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
# This file is placed in the Public Domain.
|
|
2
|
+
# pylint: disable=R0903
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
"
|
|
5
|
+
"commands"
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
import inspect
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
from .object import Object
|
|
11
|
-
from .
|
|
12
|
-
from .errors import later
|
|
12
|
+
from .parse import parse
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class Commands:
|
|
15
|
+
class Commands:
|
|
16
16
|
|
|
17
17
|
"Commands"
|
|
18
18
|
|
|
19
|
-
cmds
|
|
19
|
+
cmds = Object()
|
|
20
|
+
modnames = Object()
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
def add(func):
|
|
24
|
+
"add command."
|
|
25
|
+
setattr(Commands.cmds, func.__name__, func)
|
|
26
|
+
if func.__module__ != "__main__":
|
|
27
|
+
setattr(Commands.modnames, func.__name__, func.__module__)
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
def command(bot, evt):
|
|
@@ -30,11 +32,8 @@ def command(bot, evt):
|
|
|
30
32
|
parse(evt)
|
|
31
33
|
func = getattr(Commands.cmds, evt.cmd, None)
|
|
32
34
|
if func:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
except Exception as exc: # pylint: disable=W0718
|
|
36
|
-
later(exc)
|
|
37
|
-
bot.show(evt)
|
|
35
|
+
func(evt)
|
|
36
|
+
bot.show(evt)
|
|
38
37
|
evt.ready()
|
|
39
38
|
|
|
40
39
|
|
|
@@ -44,12 +43,12 @@ def scan(mod) -> None:
|
|
|
44
43
|
if key.startswith("cb"):
|
|
45
44
|
continue
|
|
46
45
|
if 'event' in cmd.__code__.co_varnames:
|
|
47
|
-
|
|
46
|
+
add(cmd)
|
|
48
47
|
|
|
49
48
|
|
|
50
49
|
def __dir__():
|
|
51
50
|
return (
|
|
52
51
|
'Commands',
|
|
53
|
-
'
|
|
54
|
-
'
|
|
52
|
+
'add',
|
|
53
|
+
'command'
|
|
55
54
|
)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# This file is placed in the Public Domain.
|
|
2
|
+
# pylint: disable=R0902,W0105
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
"object decoder"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
from .lock import lock
|
|
12
|
+
from .object import Object, construct, update
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ObjectDecoder(json.JSONDecoder):
|
|
16
|
+
|
|
17
|
+
"ObjectDecoder"
|
|
18
|
+
|
|
19
|
+
def __init__(self, *args, **kwargs):
|
|
20
|
+
json.JSONDecoder.__init__(self, *args, **kwargs)
|
|
21
|
+
|
|
22
|
+
def decode(self, s, _w=None):
|
|
23
|
+
"decoding string to object."
|
|
24
|
+
val = json.JSONDecoder.decode(self, s)
|
|
25
|
+
if not val:
|
|
26
|
+
val = {}
|
|
27
|
+
return hook(val)
|
|
28
|
+
|
|
29
|
+
def raw_decode(self, s, idx=0):
|
|
30
|
+
"decode partial string to object."
|
|
31
|
+
return json.JSONDecoder.raw_decode(self, s, idx)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def hook(objdict, typ=None):
|
|
35
|
+
"construct object from dict."
|
|
36
|
+
if typ:
|
|
37
|
+
obj = typ()
|
|
38
|
+
else:
|
|
39
|
+
obj = Object()
|
|
40
|
+
construct(obj, objdict)
|
|
41
|
+
return obj
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def load(fpt, *args, **kw):
|
|
45
|
+
"load object from file."
|
|
46
|
+
kw["cls"] = ObjectDecoder
|
|
47
|
+
kw["object_hook"] = hook
|
|
48
|
+
return json.load(fpt, *args, **kw)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def loads(string, *args, **kw):
|
|
52
|
+
"load object from string."
|
|
53
|
+
kw["cls"] = ObjectDecoder
|
|
54
|
+
kw["object_hook"] = hook
|
|
55
|
+
return json.loads(string, *args, **kw)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def read(obj, pth):
|
|
59
|
+
"read an object from file path."
|
|
60
|
+
with lock:
|
|
61
|
+
with open(pth, 'r', encoding='utf-8') as ofile:
|
|
62
|
+
update(obj, load(ofile))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
"interface"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def __dir__():
|
|
69
|
+
return (
|
|
70
|
+
'hook',
|
|
71
|
+
'load',
|
|
72
|
+
'loads',
|
|
73
|
+
'read'
|
|
74
|
+
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# This file is placed in the Public Domain.
|
|
2
|
+
# pylint: disable=W0125,E1102
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
"deferred exception handling."
|
|
@@ -8,7 +9,7 @@ import io
|
|
|
8
9
|
import traceback
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
class Errors:
|
|
12
|
+
class Errors:
|
|
12
13
|
|
|
13
14
|
"Errors"
|
|
14
15
|
|
|
@@ -34,7 +35,7 @@ class Errors: # pylint: disable=R0903
|
|
|
34
35
|
def output(exc):
|
|
35
36
|
"check if output function is set."
|
|
36
37
|
if Errors.out:
|
|
37
|
-
Errors.out(Errors.format(exc))
|
|
38
|
+
Errors.out(Errors.format(exc))
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
def errors():
|