Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mishamsk committed Dec 3, 2023
1 parent ba0483e commit bf8ec15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mashumaro/core/meta/code/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@
substitute_type_params,
type_name,
)
from mashumaro.core.meta.types.common import FieldContext, NoneType, ValueSpec, clean_id
from mashumaro.core.meta.types.common import (
FieldContext,
NoneType,
ValueSpec,
clean_id,
)
from mashumaro.core.meta.types.pack import PackerRegistry
from mashumaro.core.meta.types.unpack import (
SubtypeUnpackerBuilder,
Expand Down
2 changes: 2 additions & 0 deletions mashumaro/core/meta/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,11 @@ def is_literal(typ: Type) -> bool:
return type(typ) is typing._LiteralGenericAlias # type: ignore
return False


def is_local_type(typ: Type) -> bool:
return "<locals>" in getattr(typ, "__qualname__", "")


def not_none_type_arg(
type_args: Tuple[Type, ...],
resolved_type_params: Optional[Dict[Type, Type]] = None,
Expand Down
2 changes: 2 additions & 0 deletions mashumaro/core/meta/types/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ def expr_or_maybe_none(spec: ValueSpec, new_expr: Expression) -> Expression:
def random_hex() -> str:
return str(uuid.uuid4().hex)


_PY_VALID_ID_RE = re.compile(r"\W|^(?=\d)")


def clean_id(value: str) -> str:
if not value:
return "_"
Expand Down

0 comments on commit bf8ec15

Please sign in to comment.