File: err_143.py

package info (click to toggle)
python-refurb 1.27.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,700 kB
  • sloc: python: 9,468; makefile: 40; sh: 6
file content (48 lines) | stat: -rw-r--r-- 616 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
s = set()
f = frozenset()
l = []
d = {}
t = ()
t2 = tuple((1,))  # noqa: FURB123
r = ""
b = b""
n = False
i = 0

# these should match

_ = s or set()
_ = f or frozenset()
_ = l or []
_ = d or {}
_ = t or ()
_ = t2 or ()
_ = r or ""
_ = b or b""
_ = n or False
_ = i or 0


class C:
    x: int
    def __init__(self) -> None:
        # x could be anything here
        self.x = 123

c = C()

_ = c.x or 0


# these should not

_ = s or set((1, 2, 3))
_ = f or frozenset((1, 2, 3))
_ = l or [1, 2, 3]
_ = d or {"a": "b"}
_ = t or (1, 2, 3)
_ = t2 or (1, 2, 3)
_ = r or "abc"
_ = b or b"abc"
_ = n or True
_ = i or 123