local-web-services-python-sdk 0.1.2__py3-none-any.whl → 0.1.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: local-web-services-python-sdk
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Python testing SDK for local-web-services — in-process pytest fixtures and boto3 helpers
5
5
  Project-URL: Homepage, https://local-web-services.github.io/www
6
6
  Project-URL: Repository, https://github.com/local-web-services/local-web-services-sdk-python
@@ -8,14 +8,14 @@ lws_testing/_builders/iam.py,sha256=WyFaeV3O2ErBEFMvs0CRuSNJKxPqc_RyqLGBb3KHHyw,
8
8
  lws_testing/_builders/mock.py,sha256=gGOUfbXrYKIOPUsKNETiqu4wS5fWmMuqRj0CvtqfUdw,3278
9
9
  lws_testing/_discovery/__init__.py,sha256=cLKqSotYqZfhK6PImCtn9dx7DqYytJxYfxNElsUKJ-Y,52
10
10
  lws_testing/_discovery/cdk.py,sha256=KoCDTHCh4qgpbiKrmlByhY3mW1UgSUm4Ks-yynSTNTw,3587
11
- lws_testing/_discovery/hcl.py,sha256=jC9kigxhXBJ2_aO3KBUINs-uYS4qt6SZ0HVjDYwqgOs,6705
11
+ lws_testing/_discovery/hcl.py,sha256=ovuL1xPpmYPzHpSqAixVI0tnCfOUxvC_mPUi8BSDeRU,7884
12
12
  lws_testing/_resources/__init__.py,sha256=omtQNKUO7jAlH1GhwgqYMgkkYTDI_BXr5RvfCl4JDFs,68
13
13
  lws_testing/_resources/dynamodb.py,sha256=dUBZ3hd3tGFpWUyLKrzcC6Zzkxi41USEv4cPJzpvKqo,2580
14
14
  lws_testing/_resources/s3.py,sha256=d9EQAIQ6qPw1jdF5A9arjskwmj9SehkzdE9OCWHgzkQ,2670
15
15
  lws_testing/_resources/sqs.py,sha256=Q8BS4oi40M8NXkXre1g58GHyjVzlfcIegov_HuMAvp8,2406
16
16
  lws_testing/_transport/__init__.py,sha256=o87a1hyGHtaDNaR8y9BRRbe5RiQqXjLj0zATpaNowqs,62
17
17
  lws_testing/_transport/inprocess.py,sha256=09D1nwHxd50k9dnNXDJrpWYtWKCC6uend_0b-3jLc1Q,11047
18
- local_web_services_python_sdk-0.1.2.dist-info/METADATA,sha256=h4UI4zbbzDR0ucyDBrS3wJEwb1JsvsIMsQ3tTAFkK2U,3082
19
- local_web_services_python_sdk-0.1.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
20
- local_web_services_python_sdk-0.1.2.dist-info/entry_points.txt,sha256=rL_6OHSdYlP7fXMZWJg1R_O_DfqSdbg2ZYaU6dLh4lM,46
21
- local_web_services_python_sdk-0.1.2.dist-info/RECORD,,
18
+ local_web_services_python_sdk-0.1.4.dist-info/METADATA,sha256=wvrbjpgvZbNe2uPAjKbLZOPCGWg5H1NMd89wRDyF9cQ,3082
19
+ local_web_services_python_sdk-0.1.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
20
+ local_web_services_python_sdk-0.1.4.dist-info/entry_points.txt,sha256=rL_6OHSdYlP7fXMZWJg1R_O_DfqSdbg2ZYaU6dLh4lM,46
21
+ local_web_services_python_sdk-0.1.4.dist-info/RECORD,,
@@ -14,6 +14,8 @@ _RESOURCE_HEADER = re.compile(
14
14
  _ATTR_STR = re.compile(r'^\s*(?P<key>\w+)\s*=\s*"(?P<value>[^"]*)"')
15
15
  # Matches a simple key = value (unquoted booleans / numbers)
16
16
  _ATTR_BARE = re.compile(r"^\s*(?P<key>\w+)\s*=\s*(?P<value>\S+)")
17
+ # Matches a heredoc opener: key = <<MARKER
18
+ _ATTR_HEREDOC = re.compile(r"^\s*(?P<key>\w+)\s*=\s*<<(?P<marker>\w+)\s*$")
17
19
 
18
20
  # Maps Terraform resource types to (collection_key, builder_function)
19
21
  _DISPATCH: dict[str, tuple[str, Any]] = {
@@ -103,6 +105,32 @@ def _parse_tf_file(path: Path) -> list[tuple[str, str, dict[str, str]]]:
103
105
  return results
104
106
 
105
107
 
108
+ def _try_heredoc(lines: list[str], i: int) -> tuple[str, str, int] | None:
109
+ """If line *i* is a heredoc opener, return *(key, value, next_i)*, else *None*."""
110
+ m = _ATTR_HEREDOC.match(lines[i])
111
+ if not m:
112
+ return None
113
+ key = m.group("key")
114
+ marker = m.group("marker")
115
+ i += 1
116
+ body: list[str] = []
117
+ while i < len(lines) and lines[i].rstrip() != marker:
118
+ body.append(lines[i])
119
+ i += 1
120
+ return key, "\n".join(body), i + 1 # i+1 advances past the closing marker
121
+
122
+
123
+ def _extract_attr(line: str) -> tuple[str, str] | None:
124
+ """Return *(key, value)* if *line* is a simple attribute assignment, else *None*."""
125
+ m = _ATTR_STR.match(line)
126
+ if m:
127
+ return m.group("key"), m.group("value")
128
+ m2 = _ATTR_BARE.match(line)
129
+ if m2:
130
+ return m2.group("key"), m2.group("value")
131
+ return None
132
+
133
+
106
134
  def _collect_block(lines: list[str], start: int) -> tuple[dict[str, str], int]:
107
135
  """Collect top-level key=value pairs until the matching closing brace."""
108
136
  attrs: dict[str, str] = {}
@@ -110,19 +138,25 @@ def _collect_block(lines: list[str], start: int) -> tuple[dict[str, str], int]:
110
138
  i = start
111
139
  while i < len(lines) and depth > 0:
112
140
  line = lines[i]
141
+
142
+ # Check for heredoc before adjusting depth so JSON braces inside
143
+ # the heredoc body do not corrupt the brace counter.
144
+ if depth == 1:
145
+ result = _try_heredoc(lines, i)
146
+ if result is not None:
147
+ key, value, i = result
148
+ attrs[key] = value
149
+ continue
150
+
113
151
  depth += line.count("{") - line.count("}")
114
152
  if depth > 1:
115
153
  i += 1
116
154
  continue
117
155
  if depth == 0:
118
156
  break
119
- m = _ATTR_STR.match(line)
120
- if m:
121
- attrs[m.group("key")] = m.group("value")
122
- else:
123
- m2 = _ATTR_BARE.match(line)
124
- if m2:
125
- attrs[m2.group("key")] = m2.group("value")
157
+ pair = _extract_attr(line)
158
+ if pair is not None:
159
+ attrs[pair[0]] = pair[1]
126
160
  i += 1
127
161
  return attrs, i + 1
128
162