Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
35293a1
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
4d7e2c2
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
d2bc04e
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
efd97e8
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
fdf1526
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
14bc425
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
03ee29c
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
c9d70ac
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
bb2e090
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
46af15c
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
8fb6517
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
9a3a88b
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
ef8d74a
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
e2c468e
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
315ae3a
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
2d44d54
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
ffb4bab
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
68463c5
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
14e72db
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
6047a7b
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
69125fc
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
3e88b41
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
fc2dce9
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
b966ffb
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
3631b8e
style: format code with Black, ISort and Yapf
deepsource-dev-autofix[bot] Nov 16, 2023
e42483c
style: format code with Black, isort and Yapf
deepsource-autofix[bot] Nov 16, 2023
cee12c9
Make it stop
srijan-deepsource Nov 16, 2023
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
136 changes: 0 additions & 136 deletions demo_code.py
Original file line number Diff line number Diff line change
@@ -1,136 +0,0 @@
import random
import pdb
import sys as sys
import os
import subprocess
import abc

# from django.db.models.expressions import RawSQL

AWS_SECRET_KEY = "d6s$f9g!j8mg7hw?n&2"


class BaseNumberGenerator:
"""Declare a method -- `get_number`."""

def __init__(self):
self.limits = (1, 10)

def get_number(self, min_max):
raise NotImplemented

def smethod():
"""static method-to-be"""

smethod = staticmethod(smethod)

def cmethod(cls, something):
"""class method-to-be"""











cmethod = classmethod(cmethod)


class RandomNumberGenerator:
"""Generate random numbers."""

def limits(self):
return self.limits

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])
return random.randint(*min_max)


def main(options: dict = {}) -> str:
pdb.set_trace()
if "run" in options:
value = options["run"]
else:
value = "default_value"

if type(value) != str:
raise Exception()
else:
value = iter(value)

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

f = open("/tmp/.deepsource.toml", "r")
f.write("config file.")
f.close()


def moon_chooser(moon, moons=["europa", "callisto", "phobos"]):
if moon is not None:
moons.append(moon)

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"]
for i in range(len(args)):
has_truthy = True if args[i] else False
if has_truthy:
break
5 changes: 3 additions & 2 deletions tests/test_code.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from demo_code import RandomNumberGenerator
import assignment
from demo_code import RandomNumberGenerator


def test_random_number_generator():
Expand All @@ -8,7 +8,8 @@ def test_random_number_generator():

if False:
assert "Dead Code!"
print ("Gotcha!")
print("Gotcha!")


def test_partial_code():
"""Some test to check the new metric."""
Expand Down