mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
### `set_linter` only
* Fix gnarly [bug](dbed747aae/tools/test/set_linter_testdata/python_code.py.txt.python (L42)) which would have garbled Python files involving sets contained in sets.
* Better handling of new Python3.12 token types
### Both linters.
* Recover from and report on unparseable Python files
* Remove `ParseError.check()` (it made it harder to read the code)
* FileLinter is now generic on `PythonFile`
### Notes
As I started working on new docstring features, I found a nasty bug and an edge case bug in set linter, and realized both the linters crash when there is a badly-formed Python file in the repo.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/144620
Approved by: https://github.com/amjames, https://github.com/jansel
27 lines
558 B
Plaintext
27 lines
558 B
Plaintext
# mypy: ignore-errors
|
|
|
|
import collections
|
|
import types
|
|
from typing import Any, Dict, List, Optional, TYPE_CHECKING
|
|
|
|
import torch
|
|
import torch.fx
|
|
from torch._guards import Source
|
|
|
|
from ..utils import (
|
|
namedtuple_fields,
|
|
odict_values,
|
|
# OrderedSet,
|
|
set_example_value,
|
|
)
|
|
from .base import MutableLocal, VariableTracker, VariableTrackerContainer
|
|
from torch.utils._ordered_set import OrderedSet
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
from torch._dynamo.codegen import PyCodegen
|
|
|
|
|
|
class BaseListVariable(VariableTrackerContainer):
|
|
our_container = OrderedSet
|