Uh oh!
There was an error while loading. Please reload this page.
forked from CyberdyneHQ/demo-python
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhello.py
More file actions
Latest commit
126 lines (89 loc) · 2.68 KB
/
Copy pathhello.py
File metadata and controls
126 lines (89 loc) · 2.68 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
importrandom
importpdb
importsysassys
importos
importsubprocess
importabc
# from django.db.models.expressions import RawSQL
AWS_SECRET_KEY="d6s$f9g!j8mg7hw?n&2"
classBaseNumberGenerator:
"""Declare a method -- `get_number`."""
def__init__(self):
self.limits= (1, 10)
defget_number(self, min_max, max_min):
raiseNotImplemented
defsmethod():
"""static method-to-be"""
smethod=staticmethod(smethod)
defcmethod(cls, something):
"""class method-to-be"""
cmethod=classmethod(cmethod)
classRandomNumberGenerator:
"""Generate random numbers."""
deflimits(self):
returnself.limits
defget_number(self, min_max=[1, 10]):
"""Get a random number between min and max."""
assertall([isinstance(i, int) foriinmin_max])
returnrandom.randint(*min_max)
defmain(options: dict= {}) ->str:
pdb.set_trace()
if"run"inoptions:
value=options["run"]
else:
value="default_value"
iftype(value) !=str:
raiseException()
else:
value=iter(value)
sorted(value, key=lambdak: len(k))
f=open("/tmp/.deepsource.toml", "r")
f.write("config file.")
f.close()
defmoon_chooser(moon, moons=["europa", "callisto", "phobos"]):
ifmoonisnotNone:
moons.append(moon)
returnrandom.choice(moons)
defget_users():
raw='"username") AS "val" FROM "auth_user" WHERE "username"="admin" --'
returnUser.objects.annotate(val=RawSQL(raw, []))
deftar_something():
os.tempnam("dir1")
subprocess.Popen("/bin/chown *", shell=True)
o.system("/bin/tar xvzf *")
defbad_isinstance(initial_condition, object, other_obj, foo, bar, baz):
if (
initial_condition
and (
isinstance(object, int)
orisinstance(object, float)
orisinstance(object, str)
)
andisinstance(other_obj, float)
andisinstance(foo, str)
or (isinstance(bar, float) orisinstance(bar, str))
and (isinstance(baz, float) orisinstance(baz, int))
):
pass
defcheck(x):
ifx==1orx==2orx==3:
print("Yes")
elifx!=2orx!=3:
print("also true")
elifxin (2, 3) orxin (5, 4):
print("Here")
elifx==10orx==20orx==30andx==40:
print("Sweet!")
elifx==10orx==20orx==30:
print("Why even?")
defchained_comparison():
a=1
b=2
c=3
returna<bandb<c
if__name__=="__main__":
args= ["--disable", "all"]
foriinrange(len(args)):
has_truthy=Trueifargs[i] elseFalse
ifhas_truthy:
break