velocity-python 0.0.199__tar.gz → 0.0.201__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.
Files changed (152) hide show
  1. {velocity_python-0.0.199 → velocity_python-0.0.201}/PKG-INFO +1 -1
  2. {velocity_python-0.0.199 → velocity_python-0.0.201}/pyproject.toml +32 -4
  3. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/__init__.py +1 -1
  4. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/orders.py +0 -2
  5. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/amplify.py +5 -5
  6. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/base_handler.py +8 -6
  7. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/context.py +9 -10
  8. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/lambda_handler.py +26 -18
  9. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/mixins/__init__.py +5 -1
  10. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/mixins/data_service.py +82 -71
  11. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/mixins/web_handler.py +68 -45
  12. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/sqs_handler.py +1 -1
  13. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/tests/test_lambda_handler_json_serialization.py +24 -22
  14. velocity_python-0.0.201/src/velocity/db/__init__.py +56 -0
  15. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/decorators.py +5 -5
  16. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/engine.py +11 -15
  17. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/result.py +2 -2
  18. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/table.py +41 -11
  19. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/base/__init__.py +1 -0
  20. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/base/initializer.py +18 -11
  21. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/base/operators.py +11 -10
  22. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/base/sql.py +51 -39
  23. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/base/types.py +22 -21
  24. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/mysql/__init__.py +15 -13
  25. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/mysql/reserved.py +1 -1
  26. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/mysql/sql.py +69 -66
  27. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/mysql/types.py +7 -3
  28. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/postgres/__init__.py +32 -14
  29. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/postgres/sql.py +36 -31
  30. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/postgres/types.py +0 -85
  31. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/sqlite/__init__.py +14 -12
  32. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/sqlite/operators.py +1 -1
  33. velocity_python-0.0.201/src/velocity/db/servers/sqlite/reserved.py +126 -0
  34. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/sqlite/sql.py +63 -51
  35. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/sqlite/types.py +12 -4
  36. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/sqlserver/__init__.py +18 -14
  37. velocity_python-0.0.201/src/velocity/db/servers/sqlserver/reserved.py +187 -0
  38. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/sqlserver/sql.py +91 -76
  39. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/sqlserver/types.py +2 -2
  40. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/common.py +7 -4
  41. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_column.py +2 -2
  42. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_connections.py +2 -1
  43. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_engine.py +6 -4
  44. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_general_usage.py +1 -1
  45. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_result.py +2 -1
  46. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_row.py +2 -1
  47. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_row_comprehensive.py +170 -135
  48. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_schema_locking.py +148 -135
  49. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_schema_locking_unit.py +30 -28
  50. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_sequence.py +2 -2
  51. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_sql_comprehensive.py +132 -71
  52. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_table.py +3 -1
  53. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_table_comprehensive.py +227 -150
  54. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_transaction.py +4 -2
  55. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/sql/common.py +1 -1
  56. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_postgres.py +15 -6
  57. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_postgres_unchanged.py +34 -16
  58. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_schema_locking_initializers.py +51 -51
  59. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_schema_locking_simple.py +16 -16
  60. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/logging.py +2 -1
  61. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/conv/iconv.py +25 -0
  62. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/payment/__init__.py +10 -12
  63. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/payment/base_adapter.py +85 -69
  64. velocity_python-0.0.201/src/velocity/payment/braintree_adapter.py +576 -0
  65. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/payment/router.py +114 -100
  66. velocity_python-0.0.201/src/velocity/payment/stripe_adapter.py +573 -0
  67. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity_python.egg-info/PKG-INFO +1 -1
  68. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity_python.egg-info/SOURCES.txt +1 -0
  69. {velocity_python-0.0.199 → velocity_python-0.0.201}/tests/test_decorators.py +1 -3
  70. velocity_python-0.0.201/tests/test_iconv_money_to_cents.py +20 -0
  71. {velocity_python-0.0.199 → velocity_python-0.0.201}/tests/test_lambda_handler.py +3 -1
  72. {velocity_python-0.0.199 → velocity_python-0.0.201}/tests/test_lambda_handler_auth.py +18 -5
  73. {velocity_python-0.0.199 → velocity_python-0.0.201}/tests/test_sys_modified_count_postgres_demo.py +5 -3
  74. {velocity_python-0.0.199 → velocity_python-0.0.201}/tests/test_table_alter.py +9 -3
  75. {velocity_python-0.0.199 → velocity_python-0.0.201}/tests/test_where_clause_validation.py +41 -39
  76. velocity_python-0.0.199/src/velocity/db/__init__.py +0 -31
  77. velocity_python-0.0.199/src/velocity/db/servers/sqlite/reserved.py +0 -20
  78. velocity_python-0.0.199/src/velocity/db/servers/sqlserver/reserved.py +0 -32
  79. velocity_python-0.0.199/src/velocity/payment/braintree_adapter.py +0 -539
  80. velocity_python-0.0.199/src/velocity/payment/stripe_adapter.py +0 -553
  81. {velocity_python-0.0.199 → velocity_python-0.0.201}/LICENSE +0 -0
  82. {velocity_python-0.0.199 → velocity_python-0.0.201}/README.md +0 -0
  83. {velocity_python-0.0.199 → velocity_python-0.0.201}/setup.cfg +0 -0
  84. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/__init__.py +0 -0
  85. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/invoices.py +0 -0
  86. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/payments.py +0 -0
  87. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/purchase_orders.py +0 -0
  88. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/tests/__init__.py +0 -0
  89. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/tests/test_email_processing.py +0 -0
  90. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/tests/test_payment_profile_sorting.py +0 -0
  91. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/app/tests/test_spreadsheet_functions.py +0 -0
  92. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/__init__.py +0 -0
  93. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/__init__.py +0 -0
  94. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/context_factory.py +0 -0
  95. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/exceptions.py +0 -0
  96. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/perf.py +0 -0
  97. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/handlers/response.py +0 -0
  98. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/tests/__init__.py +0 -0
  99. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/aws/tests/test_response.py +0 -0
  100. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/__init__.py +0 -0
  101. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/column.py +0 -0
  102. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/database.py +0 -0
  103. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/row.py +0 -0
  104. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/sequence.py +0 -0
  105. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/core/transaction.py +0 -0
  106. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/exceptions.py +0 -0
  107. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/__init__.py +0 -0
  108. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/mysql/operators.py +0 -0
  109. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/postgres/operators.py +0 -0
  110. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/postgres/reserved.py +0 -0
  111. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/sqlserver/operators.py +0 -0
  112. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/servers/tablehelper.py +0 -0
  113. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/__init__.py +0 -0
  114. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/common_db_test.py +0 -0
  115. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/__init__.py +0 -0
  116. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_database.py +0 -0
  117. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/postgres/test_imports.py +0 -0
  118. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/sql/__init__.py +0 -0
  119. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/sql/test_postgres_select_advanced.py +0 -0
  120. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/sql/test_postgres_select_variances.py +0 -0
  121. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_cursor_rowcount_fix.py +0 -0
  122. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_db_utils.py +0 -0
  123. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_process_error_robustness.py +0 -0
  124. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_result_caching.py +0 -0
  125. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_result_sql_aware.py +0 -0
  126. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_row_get_missing_column.py +0 -0
  127. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_sql_builder.py +0 -0
  128. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/tests/test_tablehelper.py +0 -0
  129. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/db/utils.py +0 -0
  130. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/__init__.py +0 -0
  131. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/conv/__init__.py +0 -0
  132. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/conv/oconv.py +0 -0
  133. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/db.py +0 -0
  134. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/export.py +0 -0
  135. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/format.py +0 -0
  136. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/mail.py +0 -0
  137. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/merge.py +0 -0
  138. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/__init__.py +0 -0
  139. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/test_db.py +0 -0
  140. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/test_fix.py +0 -0
  141. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/test_format.py +0 -0
  142. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/test_iconv.py +0 -0
  143. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/test_merge.py +0 -0
  144. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/test_oconv.py +0 -0
  145. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/test_original_error.py +0 -0
  146. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tests/test_timer.py +0 -0
  147. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/timer.py +0 -0
  148. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity/misc/tools.py +0 -0
  149. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity_python.egg-info/dependency_links.txt +0 -0
  150. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity_python.egg-info/requires.txt +0 -0
  151. {velocity_python-0.0.199 → velocity_python-0.0.201}/src/velocity_python.egg-info/top_level.txt +0 -0
  152. {velocity_python-0.0.199 → velocity_python-0.0.201}/tests/test_mixins_import.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: velocity-python
3
- Version: 0.0.199
3
+ Version: 0.0.201
4
4
  Summary: A rapid application development library for interfacing with data storage
5
5
  Author-email: Velocity Team <info@codeclubs.org>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "velocity-python"
7
- version = "0.0.199"
7
+ version = "0.0.201"
8
8
  authors = [
9
9
  { name="Velocity Team", email="info@codeclubs.org" },
10
10
  ]
@@ -101,23 +101,51 @@ line_length = 88
101
101
  known_first_party = ["velocity"]
102
102
 
103
103
  [tool.mypy]
104
- python_version = "3.7"
105
- warn_return_any = true
104
+ python_version = "3.9"
105
+ mypy_path = "src"
106
+ explicit_package_bases = true
107
+ exclude = "(?x)(^src/velocity/.*/tests/)"
108
+ ignore_missing_imports = true
109
+ local_partial_types = false
110
+ no_implicit_optional = false
111
+ warn_return_any = false
106
112
  warn_unused_configs = true
107
- check_untyped_defs = true
113
+ check_untyped_defs = false
108
114
  warn_redundant_casts = true
109
115
  warn_unused_ignores = true
110
116
  strict_equality = true
111
117
 
112
118
  [[tool.mypy.overrides]]
113
119
  module = [
120
+ "braintree.*",
121
+ "botocore.*",
114
122
  "boto3.*",
123
+ "env",
124
+ "pytds.*",
115
125
  "psycopg2.*",
126
+ "requests.*",
127
+ "sqlparse.*",
128
+ "stripe.*",
129
+ "support.*",
116
130
  "xlrd.*",
117
131
  "openpyxl.*",
118
132
  ]
119
133
  ignore_missing_imports = true
120
134
 
135
+ [[tool.mypy.overrides]]
136
+ module = [
137
+ "velocity.aws.amplify",
138
+ "velocity.db.utils",
139
+ "velocity.db.servers.tablehelper",
140
+ "velocity.logging",
141
+ "velocity.misc.conv.iconv",
142
+ "velocity.misc.conv.oconv",
143
+ "velocity.misc.mail",
144
+ "velocity.payment.braintree_adapter",
145
+ "velocity.payment.stripe_adapter",
146
+ ]
147
+ ignore_errors = true
148
+
121
149
  [tool.pytest.ini_options]
122
150
  testpaths = ["tests"]
123
151
  python_files = ["test_*.py", "*_test.py"]
@@ -1,4 +1,4 @@
1
- __version__ = version = "0.0.199"
1
+ __version__ = version = "0.0.201"
2
2
 
3
3
  from . import aws
4
4
  from . import db
@@ -1,5 +1,4 @@
1
1
  import datetime
2
- import support.app
3
2
  import pprint
4
3
  import velocity.db
5
4
 
@@ -116,7 +115,6 @@ class Order:
116
115
  if key not in target:
117
116
  target[key] = default() if callable(default) else default
118
117
 
119
-
120
118
  def _validate(self):
121
119
  self._apply_defaults()
122
120
 
@@ -74,25 +74,25 @@ class AmplifyProject:
74
74
  Filters by user:Application tag, checking both exact app name and sanitized version.
75
75
  """
76
76
  paginator = self.lambda_client.get_paginator("list_functions")
77
-
77
+
78
78
  # Create sanitized version (remove dots and special chars for tag comparison)
79
79
  sanitized_app_name = self.app_name.replace(".", "").replace("-", "")
80
-
80
+
81
81
  for page in paginator.paginate():
82
82
  for fn in page["Functions"]:
83
83
  name = fn["FunctionName"]
84
84
  arn = fn["FunctionArn"]
85
-
85
+
86
86
  # Check if function matches environment name
87
87
  if env_name not in name:
88
88
  continue
89
-
89
+
90
90
  # Try to get tags to verify this belongs to our app
91
91
  try:
92
92
  tags_response = self.lambda_client.list_tags(Resource=arn)
93
93
  tags = tags_response.get("Tags", {})
94
94
  app_tag = tags.get("user:Application", "")
95
-
95
+
96
96
  # Check if tag matches either exact or sanitized app name
97
97
  if app_tag == self.app_name or app_tag == sanitized_app_name:
98
98
  yield fn
@@ -13,6 +13,7 @@ from typing import Any, Dict, List, Optional
13
13
 
14
14
  from velocity.aws.handlers import context as VelocityContext
15
15
  from velocity.aws.handlers.context_factory import ContextFactory
16
+
16
17
  logger = logging.getLogger(__name__)
17
18
 
18
19
 
@@ -175,14 +176,14 @@ class BaseHandler:
175
176
  "action": action,
176
177
  "handler_class": self.__class__.__name__,
177
178
  }
178
-
179
+
179
180
  # Try to get payload/dataset information for debugging
180
181
  try:
181
- if hasattr(local_context, 'postdata'):
182
+ if hasattr(local_context, "postdata"):
182
183
  diagnostic_info["postdata"] = local_context.postdata()
183
- if hasattr(local_context, 'action'):
184
+ if hasattr(local_context, "action"):
184
185
  diagnostic_info["context_action"] = local_context.action()
185
- if hasattr(local_context, 'dataset'):
186
+ if hasattr(local_context, "dataset"):
186
187
  diagnostic_info["dataset"] = local_context.dataset()
187
188
  except Exception as e:
188
189
  diagnostic_info["diagnostic_error"] = str(e)
@@ -231,7 +232,9 @@ class BaseHandler:
231
232
  # Re-raise if no error handler is defined
232
233
  raise exception
233
234
 
234
- def log(self, tx, message: str, function: Optional[str] = None, level: str = "info"):
235
+ def log(
236
+ self, tx, message: str, function: Optional[str] = None, level: str = "info"
237
+ ):
235
238
  """Emit structured log output through the shared logger."""
236
239
  if not function:
237
240
  function = self.get_calling_function()
@@ -286,4 +289,3 @@ class BaseHandler:
286
289
  local_context.response().set_body(
287
290
  {"event": self.aws_event, "postdata": local_context.postdata()}
288
291
  )
289
-
@@ -1,7 +1,6 @@
1
1
  import json
2
2
  import os
3
3
  import re
4
- import time
5
4
  import boto3
6
5
  import uuid
7
6
  from velocity.misc.format import to_json
@@ -120,7 +119,9 @@ class Context:
120
119
  if normalize(postdata.get("log_performance_timing")):
121
120
  return True
122
121
  payload = postdata.get("payload")
123
- if isinstance(payload, dict) and normalize(payload.get("log_performance_timing")):
122
+ if isinstance(payload, dict) and normalize(
123
+ payload.get("log_performance_timing")
124
+ ):
124
125
  return True
125
126
  return False
126
127
 
@@ -459,14 +460,14 @@ class Context:
459
460
  # temp["controls"]["current_user"] = current_user
460
461
 
461
462
  return temp
462
-
463
+
463
464
  def get_logged_in_email(self):
464
465
  """Return the current user information from the session."""
465
466
  return self.session().get("email_address")
466
-
467
+
467
468
  def get_version_vars(self):
468
469
  """Return environment and layer information for controls.vars."""
469
-
470
+
470
471
  vars["velocity"] = velocity.__version__
471
472
  vars["layers"] = self.get_current_lambda_layers()
472
473
 
@@ -515,9 +516,7 @@ class Context:
515
516
 
516
517
  def merge_user_data(self, tx, base_data, email_address):
517
518
  """Merge stored user settings from the user_data table into base_data."""
518
- data = tx.table("user_data").select(
519
- ["key", "val"], {"userid": email_address}
520
- )
519
+ data = tx.table("user_data").select(["key", "val"], {"userid": email_address})
521
520
 
522
521
  for row in data:
523
522
  base_data = deep_merge(base_data, json.loads(row["val"]), update=True)
@@ -705,7 +704,7 @@ def _sanitize_tracking_value(value, depth=0):
705
704
 
706
705
  if isinstance(value, (list, tuple, set)):
707
706
  sanitized_list = []
708
- for item in list(value)[: _MAX_TRACKING_LIST_ITEMS]:
707
+ for item in list(value)[:_MAX_TRACKING_LIST_ITEMS]:
709
708
  sanitized_list.append(_sanitize_tracking_value(item, depth + 1))
710
709
  return sanitized_list
711
710
 
@@ -764,4 +763,4 @@ def tracking_table_name_for_email(email):
764
763
  if not normalized:
765
764
  return None
766
765
  table = f"CC_{hashlib.md5(normalized.encode('utf-8')).hexdigest()}".lower()
767
- return f"user_tracking.{table}"
766
+ return f"user_tracking.{table}"
@@ -1,7 +1,6 @@
1
1
  import copy
2
2
  import json
3
3
  import logging
4
- import os
5
4
  import pprint
6
5
  import time
7
6
  from typing import Optional
@@ -24,10 +23,11 @@ class LambdaHandler(BaseHandler):
24
23
  # - none: no Cognito lookup; no DB user lookup
25
24
  auth_mode: str = "required"
26
25
  require_db_user: bool = True
26
+
27
27
  def __init__(
28
- self,
29
- aws_event,
30
- aws_context,
28
+ self,
29
+ aws_event,
30
+ aws_context,
31
31
  context_factory: Optional[ContextFactory] = None,
32
32
  context_class: type = context.Context,
33
33
  ):
@@ -39,15 +39,13 @@ class LambdaHandler(BaseHandler):
39
39
  context_class=context_class,
40
40
  )
41
41
 
42
-
43
42
  def beforeAction(self, tx, context):
44
43
  # Enhanced activity tracking
45
44
  stop_processing = self._enhanced_before_action(tx, context)
46
45
  if stop_processing is True:
47
- return
46
+ return
48
47
  logger.debug("starting LamdaHandler.beforeAction")
49
48
 
50
-
51
49
  self.current_user = {}
52
50
 
53
51
  auth_mode = getattr(self, "auth_mode", "required") or "required"
@@ -99,14 +97,18 @@ class LambdaHandler(BaseHandler):
99
97
 
100
98
  if require_db_user:
101
99
  if not session.get("email_address"):
102
- raise Exception("A valid user is required to access this function [Auth]")
100
+ raise Exception(
101
+ "A valid user is required to access this function [Auth]"
102
+ )
103
103
 
104
104
  if not self.user_table:
105
105
  logger.warning(
106
106
  "user_table not configured; cannot validate user %s",
107
107
  session.get("email_address"),
108
108
  )
109
- raise Exception("User table not configured; cannot validate user [Config]")
109
+ raise Exception(
110
+ "User table not configured; cannot validate user [Config]"
111
+ )
110
112
 
111
113
  context.perf.start("user lookup")
112
114
  row = tx.table(self.user_table).find(
@@ -118,7 +120,7 @@ class LambdaHandler(BaseHandler):
118
120
  "A valid user with permission is required to access this function [DB]"
119
121
  )
120
122
  self.current_user = row.to_dict()
121
-
123
+
122
124
  temp = copy.deepcopy(context.postdata() or {})
123
125
  payload = temp.get("payload")
124
126
  if isinstance(payload, dict):
@@ -171,7 +173,7 @@ class LambdaHandler(BaseHandler):
171
173
  extra={"payload": pprint.pformat(temp), "traceback": tb},
172
174
  )
173
175
  logger.debug("Ending BackOfficeEvents.OnError Done")
174
-
176
+
175
177
  def serve(self, tx):
176
178
  response = Response()
177
179
  req_params = self.aws_event.get("queryStringParameters") or {}
@@ -189,10 +191,10 @@ class LambdaHandler(BaseHandler):
189
191
 
190
192
  # Determine action from postdata or query parameters
191
193
  action = postdata.get("action") or req_params.get("action")
192
-
194
+
193
195
  # Get the list of actions to execute
194
196
  actions = self.get_actions_to_execute(action)
195
-
197
+
196
198
  # Use BaseHandler's execute_actions method
197
199
  local_context.perf.start("execute_actions total (serve)")
198
200
  try:
@@ -225,17 +227,23 @@ class LambdaHandler(BaseHandler):
225
227
  if email:
226
228
  sanitized_payload["sys_modified_by"] = email
227
229
  elif not sanitized_payload.get("sys_modified_by"):
228
- sanitized_payload["sys_modified_by"] = session.get("email_address") or "system"
230
+ sanitized_payload["sys_modified_by"] = (
231
+ session.get("email_address") or "system"
232
+ )
229
233
 
230
234
  if not email:
231
235
  # Tracking should be best-effort and never break user flows.
232
- logger.warning("Tracking email could not be resolved; skipping tracking write")
236
+ logger.warning(
237
+ "Tracking email could not be resolved; skipping tracking write"
238
+ )
233
239
  return
234
240
 
235
241
  table_name = context_obj.get_tracking_table(email)
236
242
 
237
243
  if not table_name:
238
- logger.warning("Tracking table could not be resolved; skipping tracking write")
244
+ logger.warning(
245
+ "Tracking table could not be resolved; skipping tracking write"
246
+ )
239
247
  return
240
248
 
241
249
  try:
@@ -281,7 +289,7 @@ class LambdaHandler(BaseHandler):
281
289
  # Add size info
282
290
  try:
283
291
  summary["payload_size_bytes"] = len(json.dumps(postdata.get("payload", {})))
284
- except:
292
+ except Exception:
285
293
  summary["payload_size_bytes"] = 0
286
294
 
287
- return summary
295
+ return summary
@@ -10,4 +10,8 @@ This package provides mixins for common Lambda handler patterns:
10
10
  from .web_handler import WebHandler, ButtonHandler
11
11
  from .data_service import DataServiceMixin
12
12
 
13
- __all__ = ['WebHandler', 'ButtonHandler', 'DataServiceMixin',]
13
+ __all__ = [
14
+ "WebHandler",
15
+ "ButtonHandler",
16
+ "DataServiceMixin",
17
+ ]