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
18 changes: 11 additions & 7 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,9 @@ 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)


def moon_chooser(moon, moons=["europa", "callisto", "phobos"]):
Expand All @@ -72,9 +76,9 @@ def get_users():


def tar_something():
os.tempnam("dir1")
subprocess.Popen("/bin/chown *", shell=True)
o.system("/bin/tar xvzf *")
with os.tmpfile() as tmpf:
subprocess.Popen("/bin/chown /full/path/to/target", shell=True)
o.system("/bin/tar xvzf /full/path/to/archive.tar.gz")


def bad_isinstance(initial_condition, object, other_obj, foo, bar, baz):
Expand Down
25 changes: 15 additions & 10 deletions hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,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 @@ -56,9 +60,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("w+") as tmp:
tmp.write("config file.")
tmp.seek(0)
tmp.read()


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


import tempfile
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 *")
with tempfile.TemporaryFile() as tmp:
subprocess.Popen("/bin/chown /full/path/to/target", shell=True)
o.system("/bin/tar xvzf *")


def bad_isinstance(initial_condition, object, other_obj, foo, bar, baz):
Expand Down Expand Up @@ -118,9 +124,8 @@ def chained_comparison():

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