Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions demo_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ def limits(self):

def get_number(self, min_max=[1, 10]):
"""Get a random number between min and max."""
assert all([isinstance(i, int) for i in min_max])
if not all([isinstance(i, int) for i in min_max]):
raise AssertionError
return random.randint(*min_max)


import pdb
import tempfile

def main(options: dict = {}) -> str:
pdb.set_trace()
if "run" in options:
Expand All @@ -54,9 +58,10 @@ def main(options: dict = {}) -> str:

sorted(value, key=lambda k: len(k))

f = open("/tmp/.deepsource.toml", "r")
f.write("config file.")
f.close()
with tempfile.TemporaryFile(mode="w+t") as tmp:
tmp.write("config file.")
tmp.seek(0)
tmp.read()


def moon_chooser(moon, moons=["europa", "callisto", "phobos"]):
Expand All @@ -71,10 +76,6 @@ def get_users():
return User.objects.annotate(val=RawSQL(raw, []))


def tar_something():
os.tempnam("dir1")
subprocess.Popen("/bin/chown *", shell=True)
o.system("/bin/tar xvzf *")


def bad_isinstance(initial_condition, object, other_obj, foo, bar, baz):
Expand Down
68 changes: 5 additions & 63 deletions hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ def limits(self):

def get_number(self, min_max=[1, 10]):
"""Get a random number between min and max."""
assert all([isinstance(i, int) for i in min_max])
if not all([isinstance(i, int) for i in min_max]):
raise AssertionError()
return random.randint(*min_max)


import tempfile
def main(options: dict = {}) -> str:
pdb.set_trace()
if "run" in options:
Expand All @@ -56,9 +58,8 @@ def main(options: dict = {}) -> str:

sorted(value, key=lambda k: len(k))

f = open("/tmp/.deepsource.toml", "r")
f.write("config file.")
f.close()
with tempfile.TemporaryFile(mode="w+t") as tmp:
tmp.write("config file.")


def moon_chooser(moon, moons=["europa", "callisto", "phobos"]):
Expand All @@ -68,62 +69,3 @@ def moon_chooser(moon, moons=["europa", "callisto", "phobos"]):
return random.choice(moons)


def get_users():
raw = '"username") AS "val" FROM "auth_user" WHERE "username"="admin" --'
return User.objects.annotate(val=RawSQL(raw, []))


def tar_something():
os.tempnam("dir1")
subprocess.Popen("/bin/chown *", shell=True)
o.system("/bin/tar xvzf *")


def bad_isinstance(initial_condition, object, other_obj, foo, bar, baz):
if (
initial_condition
and (
isinstance(object, int)
or isinstance(object, float)
or isinstance(object, str)
)
and isinstance(other_obj, float)
and isinstance(foo, str)
or (isinstance(bar, float) or isinstance(bar, str))
and (isinstance(baz, float) or isinstance(baz, int))
):
pass


def check(x):
if x == 1 or x == 2 or x == 3:
print("Yes")
elif x != 2 or x != 3:
print("also true")

elif x in (2, 3) or x in (5, 4):
print("Here")

elif x == 10 or x == 20 or x == 30 and x == 40:
print("Sweet!")

elif x == 10 or x == 20 or x == 30:
print("Why even?")

def chained_comparison():
a = 1
b = 2
c = 3
return a < b and b < c

if __name__ == "__main__":
args = ["--disable", "all"]
f = open("/tmp/.deepsource.toml", "r")
f.write("config file.")
f.close()
assert args is not None
for i in range(len(args)):
has_truthy = True if args[i] else False
assert has_truthy is not None
if has_truthy:
break
Loading