Reformat using black

This commit is contained in:
cuom1999 2022-05-14 12:57:27 -05:00
parent efee4ad081
commit a87fb49918
221 changed files with 19127 additions and 7310 deletions

View file

@ -7,80 +7,83 @@ from judge.models import BlogPost, Contest, Organization, Problem, Solution
class ProblemSitemap(Sitemap):
changefreq = 'daily'
changefreq = "daily"
priority = 0.8
def items(self):
return Problem.get_public_problems().values_list('code')
return Problem.get_public_problems().values_list("code")
def location(self, obj):
return reverse('problem_detail', args=obj)
return reverse("problem_detail", args=obj)
class UserSitemap(Sitemap):
changefreq = 'hourly'
changefreq = "hourly"
priority = 0.5
def items(self):
return User.objects.values_list('username')
return User.objects.values_list("username")
def location(self, obj):
return reverse('user_page', args=obj)
return reverse("user_page", args=obj)
class ContestSitemap(Sitemap):
changefreq = 'hourly'
changefreq = "hourly"
priority = 0.5
def items(self):
return Contest.objects.filter(is_visible=True, is_private=False,
is_organization_private=False).values_list('key')
return Contest.objects.filter(
is_visible=True, is_private=False, is_organization_private=False
).values_list("key")
def location(self, obj):
return reverse('contest_view', args=obj)
return reverse("contest_view", args=obj)
class OrganizationSitemap(Sitemap):
changefreq = 'hourly'
changefreq = "hourly"
priority = 0.5
def items(self):
return Organization.objects.values_list('id', 'slug')
return Organization.objects.values_list("id", "slug")
def location(self, obj):
return reverse('organization_home', args=obj)
return reverse("organization_home", args=obj)
class BlogPostSitemap(Sitemap):
changefreq = 'hourly'
changefreq = "hourly"
priority = 0.7
def items(self):
return (BlogPost.objects.filter(visible=True, is_organization_private=False, publish_on__lte=timezone.now())
.values_list('id', 'slug'))
return BlogPost.objects.filter(
visible=True, is_organization_private=False, publish_on__lte=timezone.now()
).values_list("id", "slug")
def location(self, obj):
return reverse('blog_post', args=obj)
return reverse("blog_post", args=obj)
class SolutionSitemap(Sitemap):
changefreq = 'hourly'
changefreq = "hourly"
priority = 0.8
def items(self):
return (Solution.objects.filter(is_public=True, publish_on__lte=timezone.now(), problem__isnull=False)
.values_list('problem__code'))
return Solution.objects.filter(
is_public=True, publish_on__lte=timezone.now(), problem__isnull=False
).values_list("problem__code")
def location(self, obj):
return reverse('problem_editorial', args=obj)
return reverse("problem_editorial", args=obj)
class HomePageSitemap(Sitemap):
priority = 1.0
changefreq = 'daily'
changefreq = "daily"
def items(self):
return ['home']
return ["home"]
def location(self, obj):
return reverse(obj)
@ -94,10 +97,10 @@ class UrlSitemap(Sitemap):
return self.pages
def location(self, obj):
return obj['location'] if isinstance(obj, dict) else obj
return obj["location"] if isinstance(obj, dict) else obj
def priority(self, obj):
return obj.get('priority', 0.5) if isinstance(obj, dict) else 0.5
return obj.get("priority", 0.5) if isinstance(obj, dict) else 0.5
def changefreq(self, obj):
return obj.get('changefreq', 'daily') if isinstance(obj, dict) else 'daily'
return obj.get("changefreq", "daily") if isinstance(obj, dict) else "daily"