Skip to content

Commit ae11264

Browse files
Onyieefacebook-github-bot
authored andcommitted
Fixed type checking errors in node.py (pytorch#68124)
Summary: Fixes [issue#67](MLH-Fellowship/pyre-check#67) This PR fixes the type checking errors in Pytorch torch/fx/node.py . The variable types in 363:20 and 364:20 were declared to have type `List[str]` but were assigned a value of `None`. This caused an incompatitble variable type error. I changed the type from `List[str]` to `Optional[List[str]` . This therefore fixed the incompatitble variable type error. Signed-off-by: Onyemowo Agbo onionymous 0xedward Pull Request resolved: pytorch#68124 Reviewed By: gmagogsfm Differential Revision: D32322414 Pulled By: onionymous fbshipit-source-id: be11bbbd463715ddf28a5ba78fb4adbf62878c80
1 parent 6baaec3 commit ae11264

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/expect/TestFXAPIBackwardCompatibility.test_function_back_compat-fx_backcompat_function_signatures.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ torch.fx.interpreter.Transformer.placeholder(self, target: 'Target', args: Tuple
5151
torch.fx.interpreter.Transformer.transform(self) -> torch.fx.graph_module.GraphModule
5252
torch.fx.node.Node.__init__(self, graph: 'Graph', name: str, op: str, target: 'Target', args: Tuple[Argument, ...], kwargs: Dict[str, Argument], return_type: Optional[Any] = None) -> None
5353
torch.fx.node.Node.append(self, x: 'Node') -> None
54-
torch.fx.node.Node.format_node(self, placeholder_names: List[str] = None, maybe_return_typename: List[str] = None) -> Optional[str]
54+
torch.fx.node.Node.format_node(self, placeholder_names: Optional[List[str]] = None, maybe_return_typename: Optional[List[str]] = None) -> Optional[str]
5555
torch.fx.node.Node.prepend(self, x: 'Node') -> None
5656
torch.fx.node.Node.replace_all_uses_with(self, replace_with: 'Node') -> List[Node]
5757
torch.fx.node.Node.replace_input_with(self, old_input: 'Node', new_input: 'Node')

torch/fx/node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ def _pretty_print_target(self, target):
407407

408408
@compatibility(is_backward_compatible=True)
409409
def format_node(self,
410-
placeholder_names: List[str] = None,
411-
maybe_return_typename: List[str] = None) -> Optional[str]:
410+
placeholder_names: Optional[List[str]] = None,
411+
maybe_return_typename: Optional[List[str]] = None) -> Optional[str]:
412412
"""
413413
Return a descriptive string representation of ``self``.
414414

0 commit comments

Comments
 (0)