Skip to content

Commit

Permalink
🔖 version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Oct 26, 2024
1 parent da8c354 commit fb4f943
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions nepattern/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ def __init__(self, *base: Any):
self.for_validate.append(arg)
else:
self.for_equal.append(arg)
alias_content = "|".join([str(a) for a in self.for_validate] + [repr(a) for a in self.for_equal])
types = [i.origin for i in self.for_validate] + [type(i) for i in self.for_equal]
alias_content = "|".join([str(a) for a in self.for_validate] + [repr(a) for a in self.for_equal]) # pragma: no cover
types = [i.origin for i in self.for_validate] + [type(i) for i in self.for_equal] # pragma: no cover
super().__init__(Union.__getitem__(tuple(types)), alias=alias_content) # type: ignore

def match(self, input_: Any):
Expand All @@ -172,7 +172,7 @@ def match(self, input_: Any):
def of(cls, *types: type[_T1]) -> UnionPattern[_T1]:
from .main import parser

return cls(*[parser(i) for i in types]) # type: ignore
return cls(*[parser(i) for i in types]) # type: ignore # pragma: no cover

@classmethod
@overload
Expand Down
4 changes: 2 additions & 2 deletions nepattern/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ def _generic_parser(item: GenericAlias, extra: str) -> Pattern: # type: ignore
return SwitchPattern(switch)
if not isinstance(_o := parser(org, extra), Pattern): # type: ignore # pragma: no cover
raise TypeError(_o)
validators = [i for i in meta if callable(i)]
validators = [i for i in meta if callable(i)] # pragma: no cover
return combine(
_o,
alias=al[-1] if (al := [i for i in meta if isinstance(i, str)]) else _o.alias,
validator=(lambda x: all(i(x) for i in validators)) if validators else None,
)
if origin in _Contents:
_args = {parser(t, extra) for t in get_args(item)}
_args = {parser(t, extra) for t in get_args(item)} # pragma: no cover
return (_args.pop() if len(_args) == 1 else UnionPattern(*_args)) if _args else ANY
if origin in (list, tuple, set, dict, type, frozenset):
item = origin[get_args(item)]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nepattern"
version = "0.8.0"
version = "1.0.0"
description = "a complex pattern, support typing"
authors = [
{name = "RF-Tar-Railt", email = "[email protected]"},
Expand Down

0 comments on commit fb4f943

Please sign in to comment.