ssc_codegen 0.7.6__tar.gz → 0.7.7__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.6 → ssc_codegen-0.7.7}/PKG-INFO +1 -1
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/pyproject.toml +1 -1
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/__init__.py +1 -1
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/ast_build_utils.py +8 -3
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/ast_builder.py +10 -8
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/.gitignore +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/LICENSE +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/README.md +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/_compat.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/ast_ssc.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/cli/__init__.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/cli/cli_callbacks.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/cli/cli_utils.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/cli/code_callbacks.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/cli/consts.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/cli/main.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/cli/runtime_parse_runners.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/compiler.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/consts.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/__init__.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/ast_utils.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/base.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/dart_universal_html.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/go_goquery.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/js_pure.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/json_to_schema.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/py_base.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/py_bs4.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/py_parsel.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/py_scrapy.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/py_selectolax.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/templates/dart.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/templates/go.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/templates/js.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/templates/py.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/converters/templates/template_bindings.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/document.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/document_utlis.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/json_struct.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/schema.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/selector_utils.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/str_utils.py +0 -0
- {ssc_codegen-0.7.6 → ssc_codegen-0.7.7}/ssc_codegen/tokens.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.7
|
|
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
|
|
@@ -216,10 +216,10 @@ def cast_ret_type_to_optional(ret_type: VariableType) -> VariableType:
|
|
|
216
216
|
return ret_type
|
|
217
217
|
|
|
218
218
|
|
|
219
|
-
def
|
|
219
|
+
def scan_field_stack_expr(field: BaseDocument) -> None:
|
|
220
220
|
"""validate correct type expressions pass.
|
|
221
221
|
|
|
222
|
-
raise TypeError if not passed
|
|
222
|
+
raise TypeError if not scan passed
|
|
223
223
|
"""
|
|
224
224
|
var_cursor = VariableType.DOCUMENT
|
|
225
225
|
for expr in field.stack:
|
|
@@ -246,8 +246,13 @@ def assert_field_document_variable_types(field: BaseDocument) -> None:
|
|
|
246
246
|
# end token operation, ignore
|
|
247
247
|
elif expr.kind == TokenType.EXPR_DEFAULT_END:
|
|
248
248
|
continue
|
|
249
|
+
# end operations
|
|
249
250
|
elif var_cursor == VariableType.NESTED:
|
|
250
|
-
raise TypeError("sub_parser not allowed next instructions")
|
|
251
|
+
raise TypeError(".sub_parser() not allowed next instructions")
|
|
252
|
+
elif var_cursor == VariableType.JSON:
|
|
253
|
+
raise TypeError(".jsonify() not allowed next instructions")
|
|
254
|
+
elif var_cursor == VariableType.OPTIONAL_JSON:
|
|
255
|
+
raise TypeError(".jsonify() not allowed next instructions")
|
|
251
256
|
|
|
252
257
|
# not covered cases
|
|
253
258
|
msg = f"'{expr.kind.name}' expected type '{expr.accept_type.name}', got '{var_cursor.name}'"
|
|
@@ -14,7 +14,7 @@ from .ast_build_utils import (
|
|
|
14
14
|
unwrap_default_expr,
|
|
15
15
|
assert_split_doc_ret_type_is_list_document,
|
|
16
16
|
cast_ret_type_to_optional,
|
|
17
|
-
|
|
17
|
+
scan_field_stack_expr,
|
|
18
18
|
extract_json_structs_from_module,
|
|
19
19
|
)
|
|
20
20
|
from .ast_ssc import (
|
|
@@ -60,15 +60,17 @@ def fill_variables_stack_expr(
|
|
|
60
60
|
# set DefaultEnd ret_type as DefaultStartToken
|
|
61
61
|
tmp_stack[-1].ret_type = ret_type
|
|
62
62
|
elif isinstance(first_expr.value, str): # type: ignore[attr-defined]
|
|
63
|
-
tmp_stack[-1].ret_type = VariableType.STRING
|
|
64
|
-
if ret_type != VariableType.STRING:
|
|
65
|
-
msg = f"wrong default type passed (should be a STRING or NULL, got {ret_type.name})"
|
|
66
|
-
raise TypeError(msg)
|
|
67
|
-
elif isinstance(first_expr.value, float): # type: ignore[attr-defined]
|
|
68
63
|
tmp_stack[-1].ret_type = VariableType.FLOAT
|
|
69
64
|
if ret_type != VariableType.FLOAT:
|
|
70
65
|
msg = f"wrong default type passed (should be a FLOAT or NULL, got {ret_type.name})"
|
|
71
66
|
raise TypeError(msg)
|
|
67
|
+
|
|
68
|
+
elif isinstance(first_expr.value, bool): # type: ignore[attr-defined]
|
|
69
|
+
tmp_stack[-1].ret_type = VariableType.BOOL
|
|
70
|
+
if ret_type != VariableType.BOOL:
|
|
71
|
+
msg = f"wrong default type passed (should be a BOOL or NULL, got {ret_type.name})"
|
|
72
|
+
raise TypeError(msg)
|
|
73
|
+
|
|
72
74
|
elif isinstance(first_expr.value, int): # type: ignore[attr-defined]
|
|
73
75
|
tmp_stack[-1].ret_type = VariableType.INT
|
|
74
76
|
if ret_type != VariableType.INT:
|
|
@@ -152,11 +154,11 @@ def build_ast_struct(
|
|
|
152
154
|
start_parse_body: list[CallStructFunctionExpression] = []
|
|
153
155
|
struct_parse_functions: list[BaseAstNode] = []
|
|
154
156
|
for name, field in fields.items():
|
|
155
|
-
|
|
157
|
+
scan_field_stack_expr(field)
|
|
156
158
|
|
|
157
159
|
# not allowed empty stack exprs
|
|
158
160
|
if len(field.stack) == 0:
|
|
159
|
-
msg = f"{schema.__name__}.{name} has
|
|
161
|
+
msg = f"{schema.__name__}.{name} has empty expressions"
|
|
160
162
|
raise SyntaxError(msg)
|
|
161
163
|
|
|
162
164
|
if css_to_xpath:
|
|
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.6 → ssc_codegen-0.7.7}/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
|
|
File without changes
|