pytorch/tools/test/set_linter_testdata/python_code.py.txt

48 lines
766 B
Plaintext

# Basic tests
import tempfile
print(f"{tempfile.gettempdir()}/memory_snapshot.pickle")
ignored = set() # noqa: set_linter
a = set()
b = "set()"
c = set
d = c.set
f = (
set(
)
)
ignored = (
set( # noqa: set_linter
)
)
# Non-sets
d = {}
long_string = """ set()
set() set x.set set()
\""""
class A:
def set(self, x):
self.x = x
set = A().set
# An f string as in https://github.com/pytorch/pytorch/issues/159056
f_string = f" {h:{w}} "
# Braced sets
set1 = {1}
set2 = {1, 2}
iterator_set = {i for i in range(10)}
# A dict with two sets.
dict_set = {"a": {2, 3}, "b": {i for i in range(3)}}
# A set containing an object constructed with a dict and a set
sos_set = {Something({i: i + 1 for i in range(3)}, {i + 1 for i in range(3)})}