ssc_codegen 0.2.5__tar.gz → 0.2.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.
Files changed (41) hide show
  1. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/PKG-INFO +1 -1
  2. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/pyproject.toml +1 -1
  3. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/document.py +12 -2
  4. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/objects.py +7 -7
  5. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/LICENSE +0 -0
  6. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/README.md +0 -0
  7. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/__init__.py +0 -0
  8. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/_cli.py +0 -0
  9. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/converters/__init__.py +0 -0
  10. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/converters/base.py +0 -0
  11. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/converters/dart_universal_html.py +0 -0
  12. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/converters/py_bs4.py +0 -0
  13. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/converters/py_parsel.py +0 -0
  14. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/converters/py_scrapy.py +0 -0
  15. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/converters/py_selectolax.py +0 -0
  16. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/converters/utils.py +0 -0
  17. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/generator.py +0 -0
  18. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/queries.py +0 -0
  19. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/schemas.py +0 -0
  20. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/template.py +0 -0
  21. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/dart/universal_html/baseStruct.j2 +0 -0
  22. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/dart/universal_html/dictStruct.j2 +0 -0
  23. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/dart/universal_html/itemStruct.j2 +0 -0
  24. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/dart/universal_html/listStruct.j2 +0 -0
  25. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/bs4/baseStruct.j2 +0 -0
  26. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/bs4/dictStruct.j2 +0 -0
  27. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/bs4/itemStruct.j2 +0 -0
  28. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/bs4/listStruct.j2 +0 -0
  29. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/parsel/baseStruct.j2 +0 -0
  30. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/parsel/dictStruct.j2 +0 -0
  31. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/parsel/itemStruct.j2 +0 -0
  32. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/parsel/listStruct.j2 +0 -0
  33. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/scrapy/baseStruct.j2 +0 -0
  34. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/scrapy/dictStruct.j2 +0 -0
  35. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/scrapy/itemStruct.j2 +0 -0
  36. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/scrapy/listStruct.j2 +0 -0
  37. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/selectolax/baseStruct.j2 +0 -0
  38. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/selectolax/dictStruct.j2 +0 -0
  39. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/selectolax/itemStruct.j2 +0 -0
  40. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/templates/python/selectolax/listStruct.j2 +0 -0
  41. {ssc_codegen-0.2.5 → ssc_codegen-0.2.7}/ssc_codegen/validate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ssc_codegen
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: generate selector schemas classes from dsl-like language based on python
5
5
  License: MIT
6
6
  Author: vypivshiy
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ssc_codegen"
3
- version = "0.2.5"
3
+ version = "0.2.7"
4
4
  description = "generate selector schemas classes from dsl-like language based on python"
5
5
  authors = ["vypivshiy"]
6
6
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  import warnings
2
2
  from contextlib import contextmanager
3
- from typing import Optional
3
+ from typing import Optional, Union
4
4
 
5
5
  from ssc_codegen.objects import VariableState, Expression, TokenType
6
6
  from ssc_codegen.queries import (
@@ -373,4 +373,14 @@ class Document(
373
373
  ):
374
374
  """Base document-like attribute provide DSL parser logic for generating code"""
375
375
 
376
- pass
376
+ def __getitem__(self, item: Union[int, str]):
377
+ """if item str invoke HtmlOpDocument.attr(item)
378
+ if item int - ArrayOpDocument.index(item)
379
+ """
380
+ if isinstance(item, str):
381
+ return self.attr(item)
382
+ elif isinstance(item, int):
383
+ return self.index(item)
384
+ wrong_type = type(item).__name__
385
+ msg = f"should be str or int, not '{wrong_type}'"
386
+ raise TypeError(msg)
@@ -8,19 +8,19 @@ if TYPE_CHECKING:
8
8
 
9
9
 
10
10
  class VariableState(IntEnum):
11
- DOCUMENT = 0
12
- LIST_DOCUMENT = 1
13
- STRING = 2
14
- LIST_STRING = 3
15
- NONE = 4
16
- DOCSTRING = 5 # ///
11
+ DOCUMENT = 1
12
+ LIST_DOCUMENT = 2
13
+ STRING = 3
14
+ LIST_STRING = 4
15
+ NONE = 5
16
+ DOCSTRING = 6 # ///
17
17
 
18
18
 
19
19
  class TokenType(IntEnum):
20
20
  """all command enum representation"""
21
21
 
22
22
  # SELECTORS
23
- OP_XPATH = 0
23
+ OP_XPATH = 300
24
24
  OP_XPATH_ALL = 1
25
25
  OP_CSS = 2
26
26
  OP_CSS_ALL = 3
File without changes
File without changes