Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit d0f90a7

Browse files
committed
Drop unused func in future.py
1 parent eb2e3f7 commit d0f90a7

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/typical/core/future.py

-32
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,6 @@ def transform_annotation(annotation: str, *, union: str = "Union") -> str:
2727
return unparsed
2828

2929

30-
def write_anno_expr(
31-
tree: ast.Expression | ast.Name | ast.Subscript | ast.Attribute | ast.expr,
32-
):
33-
expr = tree.body if isinstance(tree, ast.Expression) else tree
34-
if isinstance(expr, ast.Name):
35-
return expr.id
36-
if isinstance(expr, ast.Subscript):
37-
val = expr.slice.value # type: ignore[attr-defined]
38-
if isinstance(val, ast.Tuple):
39-
subscript = ", ".join(write_anno_expr(c) for c in val.elts)
40-
else:
41-
subscript = write_anno_expr(val)
42-
return f"{write_anno_expr(expr.value)}[{subscript}]"
43-
if isinstance(expr, ast.List):
44-
children = ", ".join(write_anno_expr(c) for c in expr.elts)
45-
return f"[{children}]"
46-
if isinstance(expr, ast.Constant):
47-
return str(expr.value)
48-
49-
if isinstance(expr, ast.Attribute):
50-
return expr.attr
51-
52-
raise ValueError(ast.dump(tree))
53-
54-
5530
class TransformUnion(ast.NodeTransformer):
5631
def visit_BinOp(self, node: ast.BinOp):
5732
if not isinstance(node.op, ast.BitOr):
@@ -82,13 +57,6 @@ def visit_Name(self, node: ast.Name):
8257
return new
8358

8459

85-
def contained_generic(string: str) -> tuple[bool, int]:
86-
opens = string.count("[")
87-
closes = string.count("]")
88-
hanging = opens - closes
89-
return hanging == 0, hanging
90-
91-
9260
_GENERICS = {
9361
"dict": "typing.Dict",
9462
"list": "typing.List",

0 commit comments

Comments
 (0)