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.
Files changed (81) hide show
  1. appier/__init__.py +333 -52
  2. appier/amqp.py +29 -30
  3. appier/api.py +214 -212
  4. appier/asgi.py +54 -55
  5. appier/async_neo.py +46 -35
  6. appier/async_old.py +55 -42
  7. appier/asynchronous.py +7 -13
  8. appier/base.py +1762 -1429
  9. appier/bus.py +51 -52
  10. appier/cache.py +99 -84
  11. appier/common.py +9 -11
  12. appier/component.py +17 -19
  13. appier/compress.py +25 -28
  14. appier/config.py +96 -73
  15. appier/controller.py +9 -15
  16. appier/crypt.py +25 -21
  17. appier/data.py +73 -57
  18. appier/defines.py +191 -226
  19. appier/exceptions.py +103 -63
  20. appier/execution.py +94 -88
  21. appier/export.py +90 -88
  22. appier/extra.py +6 -13
  23. appier/extra_neo.py +8 -11
  24. appier/extra_old.py +18 -16
  25. appier/geo.py +57 -47
  26. appier/git.py +101 -90
  27. appier/graph.py +23 -24
  28. appier/http.py +520 -398
  29. appier/legacy.py +373 -180
  30. appier/log.py +90 -97
  31. appier/meta.py +42 -42
  32. appier/mock.py +32 -34
  33. appier/model.py +793 -681
  34. appier/model_a.py +208 -183
  35. appier/mongo.py +183 -107
  36. appier/observer.py +39 -31
  37. appier/part.py +23 -24
  38. appier/preferences.py +44 -47
  39. appier/queuing.py +78 -96
  40. appier/redisdb.py +40 -35
  41. appier/request.py +227 -175
  42. appier/scheduler.py +13 -18
  43. appier/serialize.py +37 -31
  44. appier/session.py +161 -147
  45. appier/settings.py +2 -11
  46. appier/smtp.py +53 -49
  47. appier/storage.py +39 -33
  48. appier/structures.py +50 -45
  49. appier/test/__init__.py +2 -11
  50. appier/test/base.py +111 -108
  51. appier/test/cache.py +28 -35
  52. appier/test/config.py +10 -19
  53. appier/test/crypt.py +3 -12
  54. appier/test/data.py +3 -12
  55. appier/test/exceptions.py +8 -17
  56. appier/test/export.py +16 -33
  57. appier/test/graph.py +27 -60
  58. appier/test/http.py +42 -54
  59. appier/test/legacy.py +20 -30
  60. appier/test/log.py +14 -35
  61. appier/test/mock.py +27 -123
  62. appier/test/model.py +79 -91
  63. appier/test/part.py +5 -14
  64. appier/test/preferences.py +5 -13
  65. appier/test/queuing.py +29 -37
  66. appier/test/request.py +61 -73
  67. appier/test/serialize.py +12 -23
  68. appier/test/session.py +10 -19
  69. appier/test/smtp.py +8 -14
  70. appier/test/structures.py +20 -24
  71. appier/test/typesf.py +14 -28
  72. appier/test/util.py +480 -438
  73. appier/typesf.py +251 -171
  74. appier/util.py +578 -407
  75. appier/validation.py +280 -143
  76. {appier-1.31.4.dist-info → appier-1.32.0.dist-info}/METADATA +6 -1
  77. appier-1.32.0.dist-info/RECORD +86 -0
  78. appier-1.31.4.dist-info/RECORD +0 -86
  79. {appier-1.31.4.dist-info → appier-1.32.0.dist-info}/LICENSE +0 -0
  80. {appier-1.31.4.dist-info → appier-1.32.0.dist-info}/WHEEL +0 -0
  81. {appier-1.31.4.dist-info → appier-1.32.0.dist-info}/top_level.txt +0 -0
appier/test/queuing.py CHANGED
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  # Hive Appier Framework
5
- # Copyright (c) 2008-2022 Hive Solutions Lda.
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
- __version__ = "1.0.0"
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"
@@ -41,8 +32,8 @@ import unittest
41
32
 
42
33
  import appier
43
34
 
44
- class QueuingTest(unittest.TestCase):
45
35
 
36
+ class QueuingTest(unittest.TestCase):
46
37
  def test_memory(self):
47
38
  queue = appier.MemoryQueue()
48
39
  queue.clear()
@@ -58,25 +49,25 @@ class QueuingTest(unittest.TestCase):
58
49
  self.assertEqual(identifier, None)
59
50
  self.assertEqual(result, "hello")
60
51
 
61
- identifier = queue.push("hello", identify = True)
52
+ identifier = queue.push("hello", identify=True)
62
53
 
63
54
  self.assertNotEqual(identifier, None)
64
55
 
65
- priority, _identifier, result = queue.pop(full = True)
56
+ priority, _identifier, result = queue.pop(full=True)
66
57
 
67
58
  self.assertEqual(priority, None)
68
59
  self.assertEqual(_identifier, identifier)
69
60
  self.assertEqual(result, "hello")
70
61
 
71
- identifier_1 = queue.push("hello 1", priority = 3, identify = True)
72
- identifier_2 = queue.push("hello 2", priority = 1, identify = True)
73
- identifier_3 = queue.push("hello 3", priority = 5, identify = True)
62
+ identifier_1 = queue.push("hello 1", priority=3, identify=True)
63
+ identifier_2 = queue.push("hello 2", priority=1, identify=True)
64
+ identifier_3 = queue.push("hello 3", priority=5, identify=True)
74
65
 
75
66
  self.assertEqual(queue.length(), 3)
76
67
 
77
- _priority, _identifier_3, _result_3 = queue.pop(full = True)
78
- _priority, _identifier_1, _result_1 = queue.pop(full = True)
79
- _priority, _identifier_2, _result_2 = queue.pop(full = True)
68
+ _priority, _identifier_3, _result_3 = queue.pop(full=True)
69
+ _priority, _identifier_1, _result_1 = queue.pop(full=True)
70
+ _priority, _identifier_2, _result_2 = queue.pop(full=True)
80
71
 
81
72
  self.assertEqual(_result_1, "hello 1")
82
73
  self.assertEqual(_result_2, "hello 2")
@@ -100,25 +91,25 @@ class QueuingTest(unittest.TestCase):
100
91
  self.assertEqual(identifier, None)
101
92
  self.assertEqual(result, "hello")
102
93
 
103
- identifier = queue.push("hello", identify = True)
94
+ identifier = queue.push("hello", identify=True)
104
95
 
105
96
  self.assertNotEqual(identifier, None)
106
97
 
107
- priority, _identifier, result = queue.pop(full = True)
98
+ priority, _identifier, result = queue.pop(full=True)
108
99
 
109
100
  self.assertEqual(priority, None)
110
101
  self.assertEqual(_identifier, identifier)
111
102
  self.assertEqual(result, "hello")
112
103
 
113
- identifier_1 = queue.push("hello 1", priority = 3, identify = True)
114
- identifier_2 = queue.push("hello 2", priority = 1, identify = True)
115
- identifier_3 = queue.push("hello 3", priority = 5, identify = True)
104
+ identifier_1 = queue.push("hello 1", priority=3, identify=True)
105
+ identifier_2 = queue.push("hello 2", priority=1, identify=True)
106
+ identifier_3 = queue.push("hello 3", priority=5, identify=True)
116
107
 
117
108
  self.assertEqual(queue.length(), 3)
118
109
 
119
- _priority, _identifier_3, _result_3 = queue.pop(full = True)
120
- _priority, _identifier_1, _result_1 = queue.pop(full = True)
121
- _priority, _identifier_2, _result_2 = queue.pop(full = True)
110
+ _priority, _identifier_3, _result_3 = queue.pop(full=True)
111
+ _priority, _identifier_1, _result_1 = queue.pop(full=True)
112
+ _priority, _identifier_2, _result_2 = queue.pop(full=True)
122
113
 
123
114
  self.assertEqual(_result_1, "hello 1")
124
115
  self.assertEqual(_result_2, "hello 2")
@@ -131,7 +122,8 @@ class QueuingTest(unittest.TestCase):
131
122
  try:
132
123
  queue = appier.AMQPQueue()
133
124
  except Exception:
134
- if not hasattr(self, "skipTest"): return
125
+ if not hasattr(self, "skipTest"):
126
+ return
135
127
  self.skipTest("No AMQP server present")
136
128
 
137
129
  queue.clear()
@@ -146,23 +138,23 @@ class QueuingTest(unittest.TestCase):
146
138
  self.assertEqual(identifier, None)
147
139
  self.assertEqual(result, "hello")
148
140
 
149
- identifier = queue.push("hello", identify = True)
141
+ identifier = queue.push("hello", identify=True)
150
142
 
151
143
  self.assertNotEqual(identifier, None)
152
144
 
153
- priority, _identifier, result = queue.pop(full = True)
145
+ priority, _identifier, result = queue.pop(full=True)
154
146
 
155
147
  self.assertEqual(priority, None)
156
148
  self.assertEqual(_identifier, identifier)
157
149
  self.assertEqual(result, "hello")
158
150
 
159
- identifier_1 = queue.push("hello 1", priority = 3, identify = True)
160
- identifier_2 = queue.push("hello 2", priority = 1, identify = True)
161
- identifier_3 = queue.push("hello 3", priority = 5, identify = True)
151
+ identifier_1 = queue.push("hello 1", priority=3, identify=True)
152
+ identifier_2 = queue.push("hello 2", priority=1, identify=True)
153
+ identifier_3 = queue.push("hello 3", priority=5, identify=True)
162
154
 
163
- _priority, _identifier_3, _result_3 = queue.pop(full = True)
164
- _priority, _identifier_1, _result_1 = queue.pop(full = True)
165
- _priority, _identifier_2, _result_2 = queue.pop(full = True)
155
+ _priority, _identifier_3, _result_3 = queue.pop(full=True)
156
+ _priority, _identifier_1, _result_1 = queue.pop(full=True)
157
+ _priority, _identifier_2, _result_2 = queue.pop(full=True)
166
158
 
167
159
  self.assertEqual(_result_1, "hello 1")
168
160
  self.assertEqual(_result_2, "hello 2")
appier/test/request.py CHANGED
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  # Hive Appier Framework
5
- # Copyright (c) 2008-2022 Hive Solutions Lda.
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
- __version__ = "1.0.0"
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"
@@ -41,14 +32,11 @@ import unittest
41
32
 
42
33
  import appier
43
34
 
44
- class RequestTest(unittest.TestCase):
45
35
 
36
+ class RequestTest(unittest.TestCase):
46
37
  def test_mock(self):
47
38
  request = appier.Request(
48
- "GET",
49
- "/",
50
- address = "127.0.0.1",
51
- session_c = appier.FileSession
39
+ "GET", "/", address="127.0.0.1", session_c=appier.FileSession
52
40
  )
53
41
  request.load_session()
54
42
 
@@ -70,11 +58,7 @@ class RequestTest(unittest.TestCase):
70
58
  appier.FileSession.close()
71
59
 
72
60
  def test_query_s(self):
73
- request = appier.Request(
74
- "GET",
75
- "/",
76
- query = "x-message=hello&message=world"
77
- )
61
+ request = appier.Request("GET", "/", query="x-message=hello&message=world")
78
62
  request.resolve_query_s()
79
63
 
80
64
  self.assertEqual(request.query, "x-message=hello&message=world")
@@ -83,7 +67,7 @@ class RequestTest(unittest.TestCase):
83
67
  self.assertEqual(request.location_f, "/?message=world")
84
68
 
85
69
  def test_get_address(self):
86
- request = appier.Request("GET", "/", address = "127.0.0.1")
70
+ request = appier.Request("GET", "/", address="127.0.0.1")
87
71
 
88
72
  self.assertEqual(request.get_address(), "127.0.0.1")
89
73
 
@@ -96,25 +80,22 @@ class RequestTest(unittest.TestCase):
96
80
  request.in_headers["X-Real-Ip"] = "3.3.3.3"
97
81
  self.assertEqual(request.get_address(), "3.3.3.3")
98
82
 
99
- result = request.get_address(resolve = False)
83
+ result = request.get_address(resolve=False)
100
84
  self.assertEqual(result, "127.0.0.1")
101
85
 
102
- request = appier.Request("GET", "/", address = "::ffff:127.0.0.1")
86
+ request = appier.Request("GET", "/", address="::ffff:127.0.0.1")
103
87
 
104
88
  self.assertEqual(request.get_address(), "127.0.0.1")
105
89
 
106
- result = request.get_address(cleanup = False)
90
+ result = request.get_address(cleanup=False)
107
91
  self.assertEqual(result, "::ffff:127.0.0.1")
108
92
 
109
93
  def test_get_host(self):
110
94
  request = appier.Request(
111
95
  "GET",
112
96
  "/",
113
- address = "127.0.0.1",
114
- environ = dict(
115
- SERVER_NAME = "local.com",
116
- SERVER_PORT = "80"
117
- )
97
+ address="127.0.0.1",
98
+ environ=dict(SERVER_NAME="local.com", SERVER_PORT="80"),
118
99
  )
119
100
 
120
101
  self.assertEqual(request.get_host(), "local.com:80")
@@ -122,29 +103,26 @@ class RequestTest(unittest.TestCase):
122
103
  request = appier.Request(
123
104
  "GET",
124
105
  "/",
125
- address = "127.0.0.1",
126
- environ = dict(
127
- SERVER_NAME = "local.com",
128
- SERVER_PORT = "80",
129
- HTTP_HOST = "forward.example.com",
130
- HTTP_X_FORWARDED_HOST = "example.com"
131
- )
106
+ address="127.0.0.1",
107
+ environ=dict(
108
+ SERVER_NAME="local.com",
109
+ SERVER_PORT="80",
110
+ HTTP_HOST="forward.example.com",
111
+ HTTP_X_FORWARDED_HOST="example.com",
112
+ ),
132
113
  )
133
114
  request.load_headers()
134
115
 
135
116
  self.assertEqual(request.get_host(), "example.com")
136
- self.assertEqual(request.get_host(resolve = False), "forward.example.com")
117
+ self.assertEqual(request.get_host(resolve=False), "forward.example.com")
137
118
 
138
119
  def test_get_url(self):
139
120
  request = appier.Request(
140
121
  "GET",
141
122
  "/",
142
- scheme = "http",
143
- address = "127.0.0.1",
144
- environ = dict(
145
- SERVER_NAME = "local.com",
146
- SERVER_PORT = "80"
147
- )
123
+ scheme="http",
124
+ address="127.0.0.1",
125
+ environ=dict(SERVER_NAME="local.com", SERVER_PORT="80"),
148
126
  )
149
127
 
150
128
  self.assertEqual(request.get_url(), "http://local.com:80/")
@@ -152,29 +130,31 @@ class RequestTest(unittest.TestCase):
152
130
  request = appier.Request(
153
131
  "GET",
154
132
  "/",
155
- query = "hello=world&world=hello",
156
- scheme = "http",
157
- address = "127.0.0.1",
158
- environ = dict(
159
- SERVER_NAME = "local.com",
160
- SERVER_PORT = "80",
161
- HTTP_HOST = "forward.example.com",
162
- HTTP_X_FORWARDED_HOST = "example.com"
163
- )
133
+ query="hello=world&world=hello",
134
+ scheme="http",
135
+ address="127.0.0.1",
136
+ environ=dict(
137
+ SERVER_NAME="local.com",
138
+ SERVER_PORT="80",
139
+ HTTP_HOST="forward.example.com",
140
+ HTTP_X_FORWARDED_HOST="example.com",
141
+ ),
164
142
  )
165
143
  request.load_headers()
166
144
 
167
- self.assertEqual(request.get_url(), "http://example.com/?hello=world&world=hello")
168
- self.assertEqual(request.get_url(resolve = False), "http://forward.example.com/?hello=world&world=hello")
145
+ self.assertEqual(
146
+ request.get_url(), "http://example.com/?hello=world&world=hello"
147
+ )
148
+ self.assertEqual(
149
+ request.get_url(resolve=False),
150
+ "http://forward.example.com/?hello=world&world=hello",
151
+ )
169
152
 
170
153
  def test_get_header(self):
171
154
  request = appier.Request(
172
155
  "GET",
173
156
  "/",
174
- environ = dict(
175
- HTTP_CONTENT_TYPE = "text/plain",
176
- HTTP_X_REAL_IP = "1.1.1.1"
177
- )
157
+ environ=dict(HTTP_CONTENT_TYPE="text/plain", HTTP_X_REAL_IP="1.1.1.1"),
178
158
  )
179
159
  request.load_headers()
180
160
 
@@ -184,9 +164,11 @@ class RequestTest(unittest.TestCase):
184
164
  self.assertEqual(request.get_header("Content-TYPE"), "text/plain")
185
165
  self.assertEqual(request.get_header("Content_Type"), None)
186
166
  self.assertEqual(request.get_header("CONTENT_TYPE"), None)
187
- self.assertEqual(request.get_header("Content-Type", normalize = False), "text/plain")
188
- self.assertEqual(request.get_header("content-type", normalize = False), None)
189
- self.assertEqual(request.get_header("CONTENT-TYPE", normalize = False), None)
167
+ self.assertEqual(
168
+ request.get_header("Content-Type", normalize=False), "text/plain"
169
+ )
170
+ self.assertEqual(request.get_header("content-type", normalize=False), None)
171
+ self.assertEqual(request.get_header("CONTENT-TYPE", normalize=False), None)
190
172
 
191
173
  self.assertEqual(request.get_header("X-Real-IP"), "1.1.1.1")
192
174
  self.assertEqual(request.get_header("X-Real-Ip"), "1.1.1.1")
@@ -195,30 +177,36 @@ class RequestTest(unittest.TestCase):
195
177
  self.assertEqual(request.get_header("X-Real-IP"), "1.1.1.1")
196
178
  self.assertEqual(request.get_header("X_Real_Ip"), None)
197
179
  self.assertEqual(request.get_header("X_REAL_IP"), None)
198
- self.assertEqual(request.get_header("X-Real-Ip", normalize = False), "1.1.1.1")
199
- self.assertEqual(request.get_header("X-Real-IP", normalize = False), None)
200
- self.assertEqual(request.get_header("x-real-ip", normalize = False), None)
201
- self.assertEqual(request.get_header("X-REAL-IP", normalize = False), None)
180
+ self.assertEqual(request.get_header("X-Real-Ip", normalize=False), "1.1.1.1")
181
+ self.assertEqual(request.get_header("X-Real-IP", normalize=False), None)
182
+ self.assertEqual(request.get_header("x-real-ip", normalize=False), None)
183
+ self.assertEqual(request.get_header("X-REAL-IP", normalize=False), None)
202
184
 
203
185
  def test_data(self):
204
186
  request = appier.Request("GET", "/")
205
- request.set_data(appier.legacy.bytes("hello world", encoding = "utf-8"))
187
+ request.set_data(appier.legacy.bytes("hello world", encoding="utf-8"))
206
188
 
207
189
  self.assertEqual(type(request.get_data()), bytes)
208
- self.assertEqual(request.get_data(), appier.legacy.bytes("hello world", encoding = "utf-8"))
190
+ self.assertEqual(
191
+ request.get_data(), appier.legacy.bytes("hello world", encoding="utf-8")
192
+ )
209
193
  self.assertEqual(type(request.get_encoded()), appier.legacy.UNICODE)
210
194
  self.assertEqual(request.get_encoded(), appier.legacy.u("hello world"))
211
195
 
212
196
  request = appier.Request("GET", "/")
213
- request.set_data(appier.legacy.bytes("你好世界", encoding = "utf-8"))
197
+ request.set_data(appier.legacy.bytes("你好世界", encoding="utf-8"))
214
198
 
215
199
  self.assertEqual(type(request.get_data()), bytes)
216
- self.assertEqual(request.get_data(), appier.legacy.bytes("你好世界", encoding = "utf-8"))
200
+ self.assertEqual(
201
+ request.get_data(), appier.legacy.bytes("你好世界", encoding="utf-8")
202
+ )
217
203
  self.assertEqual(type(request.get_encoded()), appier.legacy.UNICODE)
218
204
  self.assertEqual(request.get_encoded(), appier.legacy.u("你好世界"))
219
- self.assertEqual(type(request.get_encoded(encoding = "ascii")), bytes)
220
- self.assertEqual(request.get_data(), appier.legacy.bytes("你好世界", encoding = "utf-8"))
205
+ self.assertEqual(type(request.get_encoded(encoding="ascii")), bytes)
206
+ self.assertEqual(
207
+ request.get_data(), appier.legacy.bytes("你好世界", encoding="utf-8")
208
+ )
221
209
  self.assertRaises(
222
210
  UnicodeDecodeError,
223
- lambda: request.get_encoded(encoding = "ascii", safe = False)
211
+ lambda: request.get_encoded(encoding="ascii", safe=False),
224
212
  )
appier/test/serialize.py CHANGED
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  # Hive Appier Framework
5
- # Copyright (c) 2008-2022 Hive Solutions Lda.
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
- __version__ = "1.0.0"
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"
@@ -41,29 +32,27 @@ import unittest
41
32
 
42
33
  import appier
43
34
 
44
- class SerializeTest(unittest.TestCase):
45
35
 
36
+ class SerializeTest(unittest.TestCase):
46
37
  def test_csv(self):
47
38
  result = appier.serialize_csv([["item"], ["hello world"]])
48
39
  self.assertEqual(result, "item\r\nhello world\r\n")
49
40
 
50
- result = appier.serialize_csv([
51
- [appier.legacy.u("item")],
52
- [appier.legacy.u("hello world")]
53
- ])
41
+ result = appier.serialize_csv(
42
+ [[appier.legacy.u("item")], [appier.legacy.u("hello world")]]
43
+ )
54
44
  self.assertEqual(result, "item\r\nhello world\r\n")
55
45
 
56
- result = appier.serialize_csv([
57
- [appier.legacy.u("item")],
58
- [appier.legacy.u("你好世界")]
59
- ])
46
+ result = appier.serialize_csv(
47
+ [[appier.legacy.u("item")], [appier.legacy.u("你好世界")]]
48
+ )
60
49
  self.assertEqual(result, "item\r\n你好世界\r\n")
61
50
 
62
- result = appier.serialize_csv([dict(item = "hello world")])
51
+ result = appier.serialize_csv([dict(item="hello world")])
63
52
  self.assertEqual(result, "item\r\nhello world\r\n")
64
53
 
65
- result = appier.serialize_csv([dict(item = appier.legacy.u("hello world"))])
54
+ result = appier.serialize_csv([dict(item=appier.legacy.u("hello world"))])
66
55
  self.assertEqual(result, "item\r\nhello world\r\n")
67
56
 
68
- result = appier.serialize_csv([dict(item = appier.legacy.u("你好世界"))])
57
+ result = appier.serialize_csv([dict(item=appier.legacy.u("你好世界"))])
69
58
  self.assertEqual(result, "item\r\n你好世界\r\n")
appier/test/session.py CHANGED
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  # Hive Appier Framework
5
- # Copyright (c) 2008-2022 Hive Solutions Lda.
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
- __version__ = "1.0.0"
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"
@@ -42,8 +33,8 @@ import unittest
42
33
 
43
34
  import appier
44
35
 
45
- class SessionTest(unittest.TestCase):
46
36
 
37
+ class SessionTest(unittest.TestCase):
47
38
  def test_memory(self):
48
39
  session = appier.MemorySession.new()
49
40
 
@@ -83,16 +74,16 @@ class SessionTest(unittest.TestCase):
83
74
  appier.FileSession.close()
84
75
 
85
76
  def test_expire(self):
86
- expire = datetime.timedelta(days = 0)
87
- session = appier.MemorySession.new(expire = expire)
77
+ expire = datetime.timedelta(days=0)
78
+ session = appier.MemorySession.new(expire=expire)
88
79
 
89
80
  self.assertEqual(session.is_expired(), True)
90
81
 
91
82
  session = appier.MemorySession.get_s(session.sid)
92
83
  self.assertEqual(session, None)
93
84
 
94
- expire = datetime.timedelta(days = 1)
95
- session = appier.MemorySession.new(expire = expire)
85
+ expire = datetime.timedelta(days=1)
86
+ session = appier.MemorySession.new(expire=expire)
96
87
 
97
88
  self.assertEqual(session.is_expired(), False)
98
89
  self.assertEqual(session.duration, 86400)
@@ -100,7 +91,7 @@ class SessionTest(unittest.TestCase):
100
91
  session = appier.MemorySession.get_s(session.sid)
101
92
  self.assertNotEqual(session, None)
102
93
 
103
- expire = session.extend(duration = 60)
94
+ expire = session.extend(duration=60)
104
95
 
105
96
  self.assertEqual(session.duration, 60)
106
97
  self.assertEqual(session.expire, expire)
@@ -125,7 +116,7 @@ class SessionTest(unittest.TestCase):
125
116
  sid = session["sid"]
126
117
  session.flush()
127
118
 
128
- session = appier.MemorySession.get_s(sid = sid)
119
+ session = appier.MemorySession.get_s(sid=sid)
129
120
  self.assertEqual(len(session), 2)
130
121
  self.assertEqual(session["first"], 1)
131
122
  self.assertRaises(KeyError, lambda: session["second"])
@@ -143,4 +134,4 @@ class SessionTest(unittest.TestCase):
143
134
  self.assertRaises(KeyError, lambda: session["second"])
144
135
 
145
136
  self.assertEqual(session.delete_t("second"), None)
146
- self.assertRaises(KeyError, lambda: session.delete_t("second", force = True))
137
+ self.assertRaises(KeyError, lambda: session.delete_t("second", force=True))
appier/test/smtp.py CHANGED
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  # Hive Appier Framework
5
- # Copyright (c) 2008-2022 Hive Solutions Lda.
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
- __version__ = "1.0.0"
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"
@@ -41,8 +32,8 @@ import unittest
41
32
 
42
33
  import appier
43
34
 
44
- class SMTPTest(unittest.TestCase):
45
35
 
36
+ class SMTPTest(unittest.TestCase):
46
37
  def test_plain(self):
47
38
  address_mime = appier.email_mime("João Magalhães <joamag@hive.pt>")
48
39
 
@@ -52,11 +43,14 @@ class SMTPTest(unittest.TestCase):
52
43
  mime["To"] = ", ".join([address_mime])
53
44
 
54
45
  result = mime.as_string()
55
- self.assertEqual(result, "Content-Type: text/plain; charset=\"utf-8\"\n\
46
+ self.assertEqual(
47
+ result,
48
+ 'Content-Type: text/plain; charset="utf-8"\n\
56
49
  MIME-Version: 1.0\n\
57
50
  Content-Transfer-Encoding: base64\n\
58
51
  Subject: Hello World\n\
59
52
  From: =?utf-8?q?Jo=C3=A3o_Magalh=C3=A3es?= <joamag@hive.pt>\n\
60
53
  To: =?utf-8?q?Jo=C3=A3o_Magalh=C3=A3es?= <joamag@hive.pt>\n\
61
54
  \n\
62
- SGVsbG8gV29ybGQ=\n")
55
+ SGVsbG8gV29ybGQ=\n',
56
+ )