Skip to content

Commit

Permalink
Update pre-commit: check builtin literals (#1823)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkid15r authored Feb 24, 2024
1 parent 95d57be commit 6ea9296
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ repos:
rev: v4.5.0
hooks:
- id: check-ast
# Enable after the initial automated run results are accepted.
# - id: check-builtin-literals
- id: check-builtin-literals
- id: check-yaml
- id: fix-encoding-pragma
args:
Expand Down
4 changes: 2 additions & 2 deletions website/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ def filter(self, request, *args, **kwargs):
return Response("Invalid month or year passed", status=400)

queryset = global_leaderboard.get_leaderboard(month, year, api=True)
users = list()
users = []
rank_user = 1
for each in queryset:
temp = dict()
temp = {}
temp["rank"] = rank_user
temp["id"] = each["id"]
temp["User"] = each["username"]
Expand Down
30 changes: 15 additions & 15 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,9 @@ def company_dashboard(request, template="index_company.html"):
if not company_admin.is_active:
return HttpResponseRedirect("/")
hunts = Hunt.objects.filter(is_published=True, domain=company_admin.domain)
upcoming_hunt = list()
ongoing_hunt = list()
previous_hunt = list()
upcoming_hunt = []
ongoing_hunt = []
previous_hunt = []
for hunt in hunts:
if ((hunt.starts_on - datetime.now(timezone.utc)).total_seconds()) > 0:
upcoming_hunt.append(hunt)
Expand Down Expand Up @@ -472,9 +472,9 @@ def admin_dashboard(request, template="admin_home.html"):
@login_required(login_url="/accounts/login")
def user_dashboard(request, template="index_user.html"):
hunts = Hunt.objects.filter(is_published=True)
upcoming_hunt = list()
ongoing_hunt = list()
previous_hunt = list()
upcoming_hunt = []
ongoing_hunt = []
previous_hunt = []
for hunt in hunts:
if ((hunt.starts_on - datetime.now(timezone.utc)).total_seconds()) > 0:
upcoming_hunt.append(hunt)
Expand Down Expand Up @@ -2253,15 +2253,15 @@ def get_client_ip(request):


def get_score(request):
users = list()
users = []
temp_users = (
User.objects.annotate(total_score=Sum("points__score"))
.order_by("-total_score")
.filter(total_score__gt=0)
)
rank_user = 1
for each in temp_users.all():
temp = dict()
temp = {}
temp["rank"] = rank_user
temp["id"] = each.id
temp["User"] = each.username
Expand Down Expand Up @@ -2392,10 +2392,10 @@ def contributors(request):


def get_scoreboard(request):
scoreboard = list()
scoreboard = []
temp_domain = Domain.objects.all()
for each in temp_domain:
temp = dict()
temp = {}
temp["name"] = each.name
temp["open"] = len(each.open_issues)
temp["closed"] = len(each.closed_issues)
Expand All @@ -2407,13 +2407,13 @@ def get_scoreboard(request):
temp["top"] = each.top_tester.username
scoreboard.append(temp)
paginator = Paginator(scoreboard, 10)
domain_list = list()
domain_list = []
for data in scoreboard:
domain_list.append(data)
count = (Paginator(scoreboard, 10).count) % 10
for i in range(10 - count):
domain_list.append(None)
temp = dict()
temp = {}
temp["name"] = None
domain_list.append(temp)
paginator = Paginator(domain_list, 10)
Expand Down Expand Up @@ -2658,7 +2658,7 @@ def get(self, request, *args, **kwargs):
hunts = self.model.objects.filter(is_published=True)
else:
hunts = self.model.objects.filter(is_published=True, domain=domain_admin.domain)
new_hunt = list()
new_hunt = []
for hunt in hunts:
if ((hunt.starts_on - datetime.now(timezone.utc)).total_seconds()) > 0:
new_hunt.append(hunt)
Expand All @@ -2683,7 +2683,7 @@ def get(self, request, *args, **kwargs):
hunts = self.model.objects.filter(is_published=True)
else:
hunts = self.model.objects.filter(is_published=True, domain=domain_admin.domain)
new_hunt = list()
new_hunt = []
for hunt in hunts:
if ((hunt.starts_on - datetime.now(timezone.utc)).total_seconds()) > 0:
new_hunt.append(hunt)
Expand All @@ -2708,7 +2708,7 @@ def get(self, request, *args, **kwargs):
hunts = self.model.objects.filter(is_published=True)
else:
hunts = self.model.objects.filter(is_published=True, domain=domain_admin.domain)
new_hunt = list()
new_hunt = []
for hunt in hunts:
if ((hunt.starts_on - datetime.now(timezone.utc)).total_seconds()) > 0:
pass
Expand Down

0 comments on commit 6ea9296

Please sign in to comment.