ssc_codegen 0.28.0__tar.gz → 0.29.1__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.28.0 → ssc_codegen-0.29.1}/PKG-INFO +1 -1
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/pyproject.toml +1 -1
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/js_pure.py +6 -1
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/py_bs4.py +6 -2
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/kdl/reader.py +0 -1
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/main.py +16 -5
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/.gitignore +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/LICENSE +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/README.md +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/__init__.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/_logging.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/__init__.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/array.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/base.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/cast.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/control.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/extract.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/helpers.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/jsondef.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/module.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/predicate_containers.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/predicate_ops.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/regex.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/selectors.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/string.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/struct.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/transform.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/typedef.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/ast/types.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/base.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/helpers.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/py_lxml.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/py_parsel.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/py_render.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/py_slax.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/converters/request_spec.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/__init__.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/adapter.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/contexts.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/expressions.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/format.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/linting.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/module_handler.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/predicates.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/reader.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/struct_parser.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/core/type_checking.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/document_utils.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/exceptions.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/health.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/kdl/__init__.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/kdl/dict_reader.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/kdl/parser.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/parsers/__init__.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/parsers/curl.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/parsers/http.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/pseudo_selectors.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/regex_utils.py +0 -0
- {ssc_codegen-0.28.0 → ssc_codegen-0.29.1}/ssc_codegen/selector_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ssc_codegen
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.29.1
|
|
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
|
|
@@ -419,14 +419,17 @@ def pre_struct_item(node: a.StructItem, ctx: ConverterContext):
|
|
|
419
419
|
def pre_struct_list(node: a.StructList, ctx: ConverterContext):
|
|
420
420
|
return _js_struct_header(node, ctx)
|
|
421
421
|
|
|
422
|
+
|
|
422
423
|
@JS_CONVERTER(a.StructFlatList, post_callback="}")
|
|
423
424
|
def pre_struct_flatlist(node: a.StructFlatList, ctx: ConverterContext):
|
|
424
425
|
return _js_struct_header(node, ctx)
|
|
425
426
|
|
|
427
|
+
|
|
426
428
|
@JS_CONVERTER(a.StructDict, post_callback="}")
|
|
427
429
|
def pre_struct_dict(node: a.StructDict, ctx: ConverterContext):
|
|
428
430
|
return _js_struct_header(node, ctx)
|
|
429
431
|
|
|
432
|
+
|
|
430
433
|
@JS_CONVERTER(a.StructTable, post_callback="}")
|
|
431
434
|
def pre_struct_table(node: a.StructTable, ctx: ConverterContext):
|
|
432
435
|
return _js_struct_header(node, ctx)
|
|
@@ -1964,7 +1967,9 @@ def _js_rest_method(node: a.RequestConfig, ctx: ConverterContext) -> list[str]:
|
|
|
1964
1967
|
|
|
1965
1968
|
# Shared response extraction + dispatch
|
|
1966
1969
|
parser_fn = (
|
|
1967
|
-
"sscParseResponseAxios"
|
|
1970
|
+
"sscParseResponseAxios"
|
|
1971
|
+
if http_client == "axios"
|
|
1972
|
+
else "sscParseResponse"
|
|
1968
1973
|
)
|
|
1969
1974
|
parse_prefix = "" if http_client == "axios" else "await "
|
|
1970
1975
|
lines.append(
|
|
@@ -1824,8 +1824,12 @@ def _emit_rest_methods(
|
|
|
1824
1824
|
lines.append(f"{i3})")
|
|
1825
1825
|
lines.append(f"{i2}except httpx.HTTPError as _exc:")
|
|
1826
1826
|
lines.append(f"{i3}return TransportErr(cause=repr(_exc))")
|
|
1827
|
-
lines.append(
|
|
1828
|
-
|
|
1827
|
+
lines.append(
|
|
1828
|
+
f"{i2}_status, _headers, _body = ssc_parse_response(_resp)"
|
|
1829
|
+
)
|
|
1830
|
+
lines.append(
|
|
1831
|
+
f"{i2}_err = cls.ssc_dispatch_err(_status, _headers, _body)"
|
|
1832
|
+
)
|
|
1829
1833
|
lines.append(f"{i2}if _err is not None:")
|
|
1830
1834
|
lines.append(f"{i3}return _err")
|
|
1831
1835
|
lines.append(
|
|
@@ -260,7 +260,7 @@ def generate(
|
|
|
260
260
|
register_runtime_file(converter, _runtime_name)
|
|
261
261
|
|
|
262
262
|
# Phase 1: parse all KDL files
|
|
263
|
-
from ssc_codegen.ast import Module,
|
|
263
|
+
from ssc_codegen.ast import Module, StructRest
|
|
264
264
|
|
|
265
265
|
parsed: list[tuple[Path, Module]] = []
|
|
266
266
|
for kdl_file in kdl_files:
|
|
@@ -280,6 +280,7 @@ def generate(
|
|
|
280
280
|
parsed.append((kdl_file, ast))
|
|
281
281
|
except Exception as exc:
|
|
282
282
|
if verbose:
|
|
283
|
+
typer.echo(f"ERROR {kdl_file}:", err=True)
|
|
283
284
|
typer.echo(traceback.format_exc(), err=True)
|
|
284
285
|
else:
|
|
285
286
|
typer.echo(f" ERROR {kdl_file}: {exc}", err=True)
|
|
@@ -295,7 +296,7 @@ def generate(
|
|
|
295
296
|
(
|
|
296
297
|
ast
|
|
297
298
|
for _, ast in parsed
|
|
298
|
-
if any(isinstance(n,
|
|
299
|
+
if any(isinstance(n, StructRest) for n in ast.body)
|
|
299
300
|
),
|
|
300
301
|
parsed[0][1],
|
|
301
302
|
)
|
|
@@ -320,6 +321,7 @@ def generate(
|
|
|
320
321
|
typer.echo(f" {kdl_file} -> {out_file}")
|
|
321
322
|
except Exception as exc:
|
|
322
323
|
if verbose:
|
|
324
|
+
typer.echo(f"ERROR {kdl_file}:", err=True)
|
|
323
325
|
typer.echo(traceback.format_exc(), err=True)
|
|
324
326
|
else:
|
|
325
327
|
typer.echo(f" ERROR {kdl_file}: {exc}", err=True)
|
|
@@ -395,9 +397,18 @@ def check(
|
|
|
395
397
|
total_errors = 0
|
|
396
398
|
|
|
397
399
|
for kdl_file in kdl_files:
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
400
|
+
try:
|
|
401
|
+
_, errs = parse_module(
|
|
402
|
+
kdl_file.read_text(encoding="utf-8"), source_path=kdl_file
|
|
403
|
+
)
|
|
404
|
+
except Exception as exc:
|
|
405
|
+
if verbose:
|
|
406
|
+
typer.echo(f"ERROR {kdl_file}:", err=True)
|
|
407
|
+
typer.echo(traceback.format_exc(), err=True)
|
|
408
|
+
else:
|
|
409
|
+
typer.echo(f" ERROR {kdl_file}: {exc}", err=True)
|
|
410
|
+
total_errors += 1
|
|
411
|
+
continue
|
|
401
412
|
all_results.extend(errs)
|
|
402
413
|
|
|
403
414
|
if errs:
|
|
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
|
|
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
|