Skip to content

Commit

Permalink
⬆️ version 0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed May 19, 2024
1 parent d728c08 commit cf7129a
Show file tree
Hide file tree
Showing 12 changed files with 306 additions and 189 deletions.
2 changes: 1 addition & 1 deletion nepattern/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def validate(self, input_: Any, default: Union[TDefault, Empty] = Empty) -> Vali

def __calc_eq__(self, other): # pragma: no cover
return isinstance(other, DirectPattern) and self.target == other.target

def copy(self):
return DirectPattern(self.target, self.alias)

Expand Down
280 changes: 140 additions & 140 deletions nepattern/core.pyi

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion nepattern/i18n/.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"default": "zh-CN"
"default": "zh-CN",
"frozen": [],
"require": []
}
47 changes: 47 additions & 0 deletions nepattern/i18n/.lang.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"title": "Lang Schema",
"description": "Schema for lang file",
"type": "object",
"minProperties": 2,
"maxProperties": 2,
"properties": {
"nepattern": {
"title": "Nepattern",
"description": "Scope 'nepattern' of lang item",
"type": "object",
"additionalProperties": false,
"properties": {
"type_error": {
"title": "type_error",
"description": "value of lang item type 'type_error'",
"type": "string"
},
"content_error": {
"title": "content_error",
"description": "value of lang item type 'content_error'",
"type": "string"
},
"validate_error": {
"title": "validate_error",
"description": "value of lang item type 'validate_error'",
"type": "string"
},
"sequence_form_error": {
"title": "sequence_form_error",
"description": "value of lang item type 'sequence_form_error'",
"type": "string"
},
"validate_reject": {
"title": "validate_reject",
"description": "value of lang item type 'validate_reject'",
"type": "string"
},
"pattern_head_or_tail_error": {
"title": "pattern_head_or_tail_error",
"description": "value of lang item type 'pattern_head_or_tail_error'",
"type": "string"
}
}
}
}
}
17 changes: 17 additions & 0 deletions nepattern/i18n/.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

{
"$schema": "./.template.schema.json",
"scopes": [
{
"scope": "nepattern",
"types": [
"type_error",
"content_error",
"validate_error",
"sequence_form_error",
"validate_reject",
"pattern_head_or_tail_error"
]
}
]
}
34 changes: 34 additions & 0 deletions nepattern/i18n/.template.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

{
"title": "Template",
"description": "Template for lang items to generate schema for lang files",
"type": "object",
"properties": {
"scopes": {
"title": "Scopes",
"description": "All scopes of lang items",
"type": "array",
"uniqueItems": true,
"items": {
"title": "Scope",
"description": "First level of all lang items",
"type": "object",
"properties": {
"scope": {
"type": "string",
"description": "Scope name"
},
"types": {
"type": "array",
"description": "All types of lang items",
"uniqueItems": true,
"items": {
"type": "string",
"description": "Value of lang item"
}
}
}
}
}
}
}
10 changes: 10 additions & 0 deletions nepattern/i18n/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# This file is @generated by tarina.lang CLI tool
# It is not intended for manual editing.

from pathlib import Path

from tarina.lang import lang


lang.load(Path(__file__).parent)
1 change: 1 addition & 0 deletions nepattern/i18n/en-US.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "./.lang.schema.json",
"nepattern": {
"type_error": "type {type} of parameter {target} is incorrect; expected {expected}",
"content_error": "parameter {target} is incorrect; expected {expected}",
Expand Down
1 change: 1 addition & 0 deletions nepattern/i18n/zh-CN.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "./.lang.schema.json",
"nepattern": {
"type_error": "参数 {target!r} 的类型 {type} 不正确, 其应该是 {expected!r}",
"content_error": "参数 {target!r} 不正确, 其应该符合 {expected!r}",
Expand Down
6 changes: 1 addition & 5 deletions nepattern/util.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from __future__ import annotations

import dataclasses
from pathlib import Path
import sys
from typing import TYPE_CHECKING, List, Pattern, Union

from tarina.lang import lang
from .i18n import lang as lang

if sys.version_info >= (3, 9): # pragma: no cover
from types import GenericAlias as CGenericAlias # noqa
Expand Down Expand Up @@ -33,6 +32,3 @@
@dataclasses.dataclass
class RawStr:
value: str


lang.load(Path(__file__).parent / "i18n")
89 changes: 49 additions & 40 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "nepattern"
version = "0.7.2"
version = "0.7.3"
description = "a complex pattern, support typing"
authors = [
{name = "RF-Tar-Railt", email = "[email protected]"},
]
dependencies = [
"typing-extensions>=4.5.0",
"tarina>=0.4.1",
"tarina>=0.5.1",
]
requires-python = ">=3.8"
readme = "README.md"
Expand Down

0 comments on commit cf7129a

Please sign in to comment.