appier 1.31.4__py2.py3-none-any.whl → 1.32.0__py2.py3-none-any.whl
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.
- appier/__init__.py +333 -52
- appier/amqp.py +29 -30
- appier/api.py +214 -212
- appier/asgi.py +54 -55
- appier/async_neo.py +46 -35
- appier/async_old.py +55 -42
- appier/asynchronous.py +7 -13
- appier/base.py +1762 -1429
- appier/bus.py +51 -52
- appier/cache.py +99 -84
- appier/common.py +9 -11
- appier/component.py +17 -19
- appier/compress.py +25 -28
- appier/config.py +96 -73
- appier/controller.py +9 -15
- appier/crypt.py +25 -21
- appier/data.py +73 -57
- appier/defines.py +191 -226
- appier/exceptions.py +103 -63
- appier/execution.py +94 -88
- appier/export.py +90 -88
- appier/extra.py +6 -13
- appier/extra_neo.py +8 -11
- appier/extra_old.py +18 -16
- appier/geo.py +57 -47
- appier/git.py +101 -90
- appier/graph.py +23 -24
- appier/http.py +520 -398
- appier/legacy.py +373 -180
- appier/log.py +90 -97
- appier/meta.py +42 -42
- appier/mock.py +32 -34
- appier/model.py +793 -681
- appier/model_a.py +208 -183
- appier/mongo.py +183 -107
- appier/observer.py +39 -31
- appier/part.py +23 -24
- appier/preferences.py +44 -47
- appier/queuing.py +78 -96
- appier/redisdb.py +40 -35
- appier/request.py +227 -175
- appier/scheduler.py +13 -18
- appier/serialize.py +37 -31
- appier/session.py +161 -147
- appier/settings.py +2 -11
- appier/smtp.py +53 -49
- appier/storage.py +39 -33
- appier/structures.py +50 -45
- appier/test/__init__.py +2 -11
- appier/test/base.py +111 -108
- appier/test/cache.py +28 -35
- appier/test/config.py +10 -19
- appier/test/crypt.py +3 -12
- appier/test/data.py +3 -12
- appier/test/exceptions.py +8 -17
- appier/test/export.py +16 -33
- appier/test/graph.py +27 -60
- appier/test/http.py +42 -54
- appier/test/legacy.py +20 -30
- appier/test/log.py +14 -35
- appier/test/mock.py +27 -123
- appier/test/model.py +79 -91
- appier/test/part.py +5 -14
- appier/test/preferences.py +5 -13
- appier/test/queuing.py +29 -37
- appier/test/request.py +61 -73
- appier/test/serialize.py +12 -23
- appier/test/session.py +10 -19
- appier/test/smtp.py +8 -14
- appier/test/structures.py +20 -24
- appier/test/typesf.py +14 -28
- appier/test/util.py +480 -438
- appier/typesf.py +251 -171
- appier/util.py +578 -407
- appier/validation.py +280 -143
- {appier-1.31.4.dist-info → appier-1.32.0.dist-info}/METADATA +6 -1
- appier-1.32.0.dist-info/RECORD +86 -0
- appier-1.31.4.dist-info/RECORD +0 -86
- {appier-1.31.4.dist-info → appier-1.32.0.dist-info}/LICENSE +0 -0
- {appier-1.31.4.dist-info → appier-1.32.0.dist-info}/WHEEL +0 -0
- {appier-1.31.4.dist-info → appier-1.32.0.dist-info}/top_level.txt +0 -0
appier/extra.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Appier Framework
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2024 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Appier Framework.
|
|
8
8
|
#
|
|
@@ -22,20 +22,13 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2022 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
38
29
|
""" The license for the module """
|
|
39
30
|
|
|
40
|
-
from .extra_old import *
|
|
41
|
-
|
|
31
|
+
from .extra_old import * # @UnusedWildImport
|
|
32
|
+
|
|
33
|
+
if asynchronous.is_neo():
|
|
34
|
+
from .extra_neo import * # @UnusedWildImport
|
appier/extra_neo.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Appier Framework
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2024 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Appier Framework.
|
|
8
8
|
#
|
|
@@ -22,16 +22,7 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2022 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -40,31 +31,37 @@ __license__ = "Apache License, Version 2.0"
|
|
|
40
31
|
from . import http
|
|
41
32
|
from . import asynchronous
|
|
42
33
|
|
|
34
|
+
|
|
43
35
|
def get_a(*args, **kwargs):
|
|
44
36
|
kwargs["async"] = True
|
|
45
37
|
value = yield from asynchronous.to_coroutine(http.get, *args, **kwargs)
|
|
46
38
|
return value
|
|
47
39
|
|
|
40
|
+
|
|
48
41
|
def post_a(*args, **kwargs):
|
|
49
42
|
kwargs["async"] = True
|
|
50
43
|
value = yield from asynchronous.to_coroutine(http.post, *args, **kwargs)
|
|
51
44
|
return value
|
|
52
45
|
|
|
46
|
+
|
|
53
47
|
def put_a(*args, **kwargs):
|
|
54
48
|
kwargs["async"] = True
|
|
55
49
|
value = yield from asynchronous.to_coroutine(http.put, *args, **kwargs)
|
|
56
50
|
return value
|
|
57
51
|
|
|
52
|
+
|
|
58
53
|
def delete_a(*args, **kwargs):
|
|
59
54
|
kwargs["async"] = True
|
|
60
55
|
value = yield from asynchronous.to_coroutine(http.delete, *args, **kwargs)
|
|
61
56
|
return value
|
|
62
57
|
|
|
58
|
+
|
|
63
59
|
def patch_a(*args, **kwargs):
|
|
64
60
|
kwargs["async"] = True
|
|
65
61
|
value = yield from asynchronous.to_coroutine(http.patch, *args, **kwargs)
|
|
66
62
|
return value
|
|
67
63
|
|
|
64
|
+
|
|
68
65
|
get_w = lambda *args, **kwargs: asynchronous.await_wrap(get_a(*args, **kwargs))
|
|
69
66
|
post_w = lambda *args, **kwargs: asynchronous.await_wrap(post_w(*args, **kwargs))
|
|
70
67
|
put_w = lambda *args, **kwargs: asynchronous.await_wrap(put_w(*args, **kwargs))
|
appier/extra_old.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Appier Framework
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2024 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Appier Framework.
|
|
8
8
|
#
|
|
@@ -22,16 +22,7 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2022 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -40,25 +31,36 @@ __license__ = "Apache License, Version 2.0"
|
|
|
40
31
|
from . import http
|
|
41
32
|
from . import asynchronous
|
|
42
33
|
|
|
34
|
+
|
|
43
35
|
def get_a(*args, **kwargs):
|
|
44
36
|
kwargs["async"] = True
|
|
45
|
-
for value in asynchronous.to_coroutine(http.get, *args, **kwargs):
|
|
37
|
+
for value in asynchronous.to_coroutine(http.get, *args, **kwargs):
|
|
38
|
+
yield value
|
|
39
|
+
|
|
46
40
|
|
|
47
41
|
def post_a(*args, **kwargs):
|
|
48
42
|
kwargs["async"] = True
|
|
49
|
-
for value in asynchronous.to_coroutine(http.post, *args, **kwargs):
|
|
43
|
+
for value in asynchronous.to_coroutine(http.post, *args, **kwargs):
|
|
44
|
+
yield value
|
|
45
|
+
|
|
50
46
|
|
|
51
47
|
def put_a(*args, **kwargs):
|
|
52
48
|
kwargs["async"] = True
|
|
53
|
-
for value in asynchronous.to_coroutine(http.put, *args, **kwargs):
|
|
49
|
+
for value in asynchronous.to_coroutine(http.put, *args, **kwargs):
|
|
50
|
+
yield value
|
|
51
|
+
|
|
54
52
|
|
|
55
53
|
def delete_a(*args, **kwargs):
|
|
56
54
|
kwargs["async"] = True
|
|
57
|
-
for value in asynchronous.to_coroutine(http.delete, *args, **kwargs):
|
|
55
|
+
for value in asynchronous.to_coroutine(http.delete, *args, **kwargs):
|
|
56
|
+
yield value
|
|
57
|
+
|
|
58
58
|
|
|
59
59
|
def patch_a(*args, **kwargs):
|
|
60
60
|
kwargs["async"] = True
|
|
61
|
-
for value in asynchronous.to_coroutine(http.patch, *args, **kwargs):
|
|
61
|
+
for value in asynchronous.to_coroutine(http.patch, *args, **kwargs):
|
|
62
|
+
yield value
|
|
63
|
+
|
|
62
64
|
|
|
63
65
|
get_w = None
|
|
64
66
|
post_w = None
|
appier/geo.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Appier Framework
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2024 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Appier Framework.
|
|
8
8
|
#
|
|
@@ -22,16 +22,7 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2022 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2024 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -45,8 +36,8 @@ from . import http
|
|
|
45
36
|
from . import util
|
|
46
37
|
from . import legacy
|
|
47
38
|
|
|
48
|
-
class GeoResolver(object):
|
|
49
39
|
|
|
40
|
+
class GeoResolver(object):
|
|
50
41
|
DB_NAME = "GeoLite2-City.mmdb"
|
|
51
42
|
""" The name of the file that contains the GeoIP
|
|
52
43
|
information database (to be used in execution) """
|
|
@@ -69,19 +60,24 @@ class GeoResolver(object):
|
|
|
69
60
|
that is going to be used in the GeoIP resolution """
|
|
70
61
|
|
|
71
62
|
@classmethod
|
|
72
|
-
def resolve(cls, address, simplified
|
|
63
|
+
def resolve(cls, address, simplified=True):
|
|
73
64
|
db = cls._get_db()
|
|
74
|
-
if not db:
|
|
65
|
+
if not db:
|
|
66
|
+
return None
|
|
75
67
|
result = db.get(address)
|
|
76
|
-
if simplified:
|
|
68
|
+
if simplified:
|
|
69
|
+
result = cls._simplify(result)
|
|
77
70
|
return result
|
|
78
71
|
|
|
79
72
|
@classmethod
|
|
80
|
-
def _simplify(cls, result, locale
|
|
81
|
-
if not result:
|
|
73
|
+
def _simplify(cls, result, locale="en", valid=VALID):
|
|
74
|
+
if not result:
|
|
75
|
+
return result
|
|
82
76
|
for name, value in legacy.items(result):
|
|
83
|
-
if not name in valid:
|
|
84
|
-
|
|
77
|
+
if not name in valid:
|
|
78
|
+
del result[name]
|
|
79
|
+
if not "names" in value:
|
|
80
|
+
continue
|
|
85
81
|
names = value["names"]
|
|
86
82
|
value["name"] = names.get(locale, None)
|
|
87
83
|
del value["names"]
|
|
@@ -89,62 +85,76 @@ class GeoResolver(object):
|
|
|
89
85
|
|
|
90
86
|
@classmethod
|
|
91
87
|
def _get_db(cls):
|
|
92
|
-
if cls._db:
|
|
88
|
+
if cls._db:
|
|
89
|
+
return cls._db
|
|
93
90
|
maxminddb = util.import_pip("maxminddb")
|
|
94
|
-
if not maxminddb:
|
|
91
|
+
if not maxminddb:
|
|
92
|
+
return None
|
|
95
93
|
path = cls._try_all()
|
|
96
|
-
if not path:
|
|
94
|
+
if not path:
|
|
95
|
+
return None
|
|
97
96
|
cls._db = maxminddb.open_database(path)
|
|
98
97
|
return cls._db
|
|
99
98
|
|
|
100
99
|
@classmethod
|
|
101
|
-
def _try_all(cls, prefixes
|
|
100
|
+
def _try_all(cls, prefixes=PREFIXES):
|
|
102
101
|
for prefix in cls.PREFIXES:
|
|
103
|
-
path = cls._try_db(path
|
|
104
|
-
if path:
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
path = cls._try_db(path=prefix + cls.DB_NAME)
|
|
103
|
+
if path:
|
|
104
|
+
return path
|
|
105
|
+
path = cls._try_db(path=cls.DB_NAME, download=True)
|
|
106
|
+
if path:
|
|
107
|
+
return path
|
|
107
108
|
return None
|
|
108
109
|
|
|
109
110
|
@classmethod
|
|
110
|
-
def _try_db(cls, path
|
|
111
|
+
def _try_db(cls, path=DB_NAME, download=False):
|
|
111
112
|
path = os.path.expanduser(path)
|
|
112
113
|
path = os.path.normpath(path)
|
|
113
114
|
exists = os.path.exists(path)
|
|
114
|
-
if exists:
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
if exists:
|
|
116
|
+
return path
|
|
117
|
+
if not download:
|
|
118
|
+
return None
|
|
119
|
+
cls._download_db(path=path)
|
|
117
120
|
exists = os.path.exists(path)
|
|
118
|
-
if not exists:
|
|
121
|
+
if not exists:
|
|
122
|
+
return None
|
|
119
123
|
return path
|
|
120
124
|
|
|
121
125
|
@classmethod
|
|
122
|
-
def _download_db(cls, path
|
|
126
|
+
def _download_db(cls, path=DB_NAME):
|
|
123
127
|
contents = http.get(cls.DOWNLOAD_URL)
|
|
124
|
-
cls._store_db(contents, path
|
|
128
|
+
cls._store_db(contents, path=path)
|
|
125
129
|
|
|
126
130
|
@classmethod
|
|
127
|
-
def _store_db(cls, contents, path
|
|
131
|
+
def _store_db(cls, contents, path=DB_NAME):
|
|
128
132
|
path_gz = path + ".gz"
|
|
129
133
|
file = open(path_gz, "wb")
|
|
130
|
-
try:
|
|
131
|
-
|
|
134
|
+
try:
|
|
135
|
+
file.write(contents)
|
|
136
|
+
finally:
|
|
137
|
+
file.close()
|
|
132
138
|
file = gzip.open(path_gz, "rb")
|
|
133
|
-
try:
|
|
134
|
-
|
|
139
|
+
try:
|
|
140
|
+
contents = file.read()
|
|
141
|
+
finally:
|
|
142
|
+
file.close()
|
|
135
143
|
file = open(path, "wb")
|
|
136
|
-
try:
|
|
137
|
-
|
|
144
|
+
try:
|
|
145
|
+
file.write(contents)
|
|
146
|
+
finally:
|
|
147
|
+
file.close()
|
|
138
148
|
os.remove(path_gz)
|
|
139
149
|
return path
|
|
140
150
|
|
|
151
|
+
|
|
141
152
|
if __name__ == "__main__":
|
|
142
153
|
prefix = "~/"
|
|
143
|
-
if len(sys.argv) > 1:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
)
|
|
154
|
+
if len(sys.argv) > 1:
|
|
155
|
+
prefix = sys.argv[1]
|
|
156
|
+
if not prefix.endswith("/"):
|
|
157
|
+
prefix += "/"
|
|
158
|
+
GeoResolver._try_db(path=prefix + GeoResolver.DB_NAME, download=True)
|
|
149
159
|
else:
|
|
150
160
|
__path__ = []
|