File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -115,3 +115,4 @@ venv.bak/
115115.rss-parser
116116.ruff_cache
117117.python-version
118+ .DS_Store
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " rss-parser"
3- version = " 2.1.0 "
3+ version = " 2.1.1 "
44description = " Typed pythonic RSS/Atom parser"
55authors = [
" dhvcc <[email protected] >" ]
66license = " GPL-3.0"
Original file line number Diff line number Diff line change 1- from typing import Union
1+ from typing import Generic , TypeVar , Union
22
33from rss_parser .pydantic_proxy import import_v1_pydantic
44
55pydantic_validators = import_v1_pydantic (".validators" )
66
7+ T = TypeVar ("T" )
78
8- class OnlyList (list ):
9+
10+ class OnlyList (list , Generic [T ]):
911 @classmethod
1012 def __get_validators__ (cls ):
1113 yield cls .validate
@@ -14,8 +16,8 @@ def __get_validators__(cls):
1416 @classmethod
1517 def validate (cls , v : Union [dict , list ]):
1618 if isinstance (v , list ):
17- return v
18- return [v ]
19+ return cls ( v )
20+ return cls ( [v ])
1921
2022 def __repr__ (self ):
2123 return f"OnlyList({ super ().__repr__ ()} )"
You can’t perform that action at this time.
0 commit comments