ssc_codegen 0.7.5__tar.gz → 0.7.6__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.
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/PKG-INFO +1 -1
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/pyproject.toml +1 -1
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/__init__.py +1 -1
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/ast_build_utils.py +18 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/ast_ssc.py +1 -6
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/tokens.py +4 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/.gitignore +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/LICENSE +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/README.md +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/_compat.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/ast_builder.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/cli/__init__.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/cli/cli_callbacks.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/cli/cli_utils.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/cli/code_callbacks.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/cli/consts.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/cli/main.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/cli/runtime_parse_runners.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/compiler.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/consts.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/__init__.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/ast_utils.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/base.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/dart_universal_html.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/go_goquery.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/js_pure.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/json_to_schema.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/py_base.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/py_bs4.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/py_parsel.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/py_scrapy.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/py_selectolax.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/templates/dart.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/templates/go.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/templates/js.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/templates/py.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/templates/template_bindings.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/document.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/document_utlis.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/json_struct.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/schema.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/selector_utils.py +0 -0
- {ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/str_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ssc_codegen
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.6
|
|
4
4
|
Summary: Python-dsl code converter to html parser for web scraping
|
|
5
5
|
Project-URL: Documentation, https://github.com/vypivshiy/selector_schema_codegen#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/vypivshiy/selector_schema_codegen/issues
|
|
@@ -126,6 +126,10 @@ def extract_json_structs_from_module(module: ModuleType) -> list[Type[Json]]:
|
|
|
126
126
|
def assert_ret_type_not_document(
|
|
127
127
|
field: "BaseDocument", name: str, schema: Type[BaseSchema]
|
|
128
128
|
) -> None:
|
|
129
|
+
# always ret nil, skip
|
|
130
|
+
if name == "__PRE_VALIDATE__":
|
|
131
|
+
return
|
|
132
|
+
|
|
129
133
|
if field.stack_last_ret == VariableType.DOCUMENT:
|
|
130
134
|
msg = f"{schema.__name__}.{name} cannot return type {VariableType.DOCUMENT.name}"
|
|
131
135
|
raise TypeError(msg)
|
|
@@ -222,6 +226,19 @@ def assert_field_document_variable_types(field: BaseDocument) -> None:
|
|
|
222
226
|
if var_cursor == expr.accept_type:
|
|
223
227
|
var_cursor = expr.ret_type
|
|
224
228
|
continue
|
|
229
|
+
# currently used in to_len() operation
|
|
230
|
+
elif expr.accept_type == VariableType.LIST_ANY:
|
|
231
|
+
if var_cursor in (
|
|
232
|
+
VariableType.LIST_STRING,
|
|
233
|
+
VariableType.LIST_DOCUMENT,
|
|
234
|
+
VariableType.LIST_FLOAT,
|
|
235
|
+
VariableType.LIST_INT,
|
|
236
|
+
):
|
|
237
|
+
var_cursor = expr.ret_type
|
|
238
|
+
continue
|
|
239
|
+
msg = f".to_len() expected LIST_ANY type, got '{var_cursor.name}'"
|
|
240
|
+
raise TypeError(msg)
|
|
241
|
+
|
|
225
242
|
# this type always first (naive, used in DEFAULT and RETURN expr)
|
|
226
243
|
elif expr.accept_type == VariableType.ANY:
|
|
227
244
|
var_cursor = VariableType.DOCUMENT
|
|
@@ -232,5 +249,6 @@ def assert_field_document_variable_types(field: BaseDocument) -> None:
|
|
|
232
249
|
elif var_cursor == VariableType.NESTED:
|
|
233
250
|
raise TypeError("sub_parser not allowed next instructions")
|
|
234
251
|
|
|
252
|
+
# not covered cases
|
|
235
253
|
msg = f"'{expr.kind.name}' expected type '{expr.accept_type.name}', got '{var_cursor.name}'"
|
|
236
254
|
raise TypeError(msg)
|
|
@@ -427,12 +427,7 @@ class JoinExpression(BaseExpression):
|
|
|
427
427
|
@dataclass(kw_only=True)
|
|
428
428
|
class ArrayLengthExpression(BaseExpression):
|
|
429
429
|
kind: ClassVar[TokenType] = TokenType.EXPR_LIST_LEN
|
|
430
|
-
accept_type: VariableType =
|
|
431
|
-
VariableType.LIST_STRING
|
|
432
|
-
| VariableType.LIST_DOCUMENT
|
|
433
|
-
| VariableType.LIST_INT
|
|
434
|
-
| VariableType.LIST_FLOAT
|
|
435
|
-
)
|
|
430
|
+
accept_type: VariableType = VariableType.LIST_ANY
|
|
436
431
|
ret_type: VariableType = VariableType.INT
|
|
437
432
|
|
|
438
433
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ssc_codegen-0.7.5 → ssc_codegen-0.7.6}/ssc_codegen/converters/templates/template_bindings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|