<commit_before>from django.contrib.sitemaps import Sitemap
from web.nodes.models import Node
from datetime import datetime
import re
from django.conf import settings
from django.core.urlresolvers import reverse

class HttpsSitemap(Sitemap):
  http_match = re.compile(r"^http://")

  def get_urls(self, page=1):
    urls = super(HttpsSitemap, self).get_urls(page)
    if getattr(settings, 'SITEMAPS_USE_HTTPS', None):
      for url in urls:
        url['location'] = self.http_match.sub("https://", url['location'])
    return urls

class NodeSitemap(HttpsSitemap):
  priority = "0.8"

  def items(self):
    return Node.objects.all()

  def lastmod(self, node):
    return node.last_seen

  def location(self, node):
    return node.get_absolute_url()

class StaticSitemap(HttpsSitemap):
  priority = "0.9"
  locations = []
  
  def __init__(self, *args, **kwargs):
    super(StaticSitemap, self).__init__(*args, **kwargs)
    self.locations = [
      reverse('network_statistics'),
      reverse('network_clients'),
      reverse('network_map')
    ]

  def items(self):
    return self.locations

  def lastmod(self, obj):
    return datetime.now()

  def location(self, obj):
    return obj

class RootPageSitemap(StaticSitemap):
  priority = "1.0"
  locations = [
    '/'
  ]

  def items(self):
    return self.locations

  def lastmod(self, obj):
    return datetime.now()

  def location(self, obj):
    return obj
<commit_msg>Fixed parameter passing to get_urls function of sitemap superclass.<commit_after>from django.contrib.sitemaps import Sitemap
from web.nodes.models import Node
from datetime import datetime
import re
from django.conf import settings
from django.core.urlresolvers import reverse

class HttpsSitemap(Sitemap):
  http_match = re.compile(r"^http://")

  def get_urls(self, *args, **kwargs):
    urls = super(HttpsSitemap, self).get_urls(*args, **kwargs)
    if getattr(settings, 'SITEMAPS_USE_HTTPS', None):
      for url in urls:
        url['location'] = self.http_match.sub("https://", url['location'])
    return urls

class NodeSitemap(HttpsSitemap):
  priority = "0.8"

  def items(self):
    return Node.objects.all()

  def lastmod(self, node):
    return node.last_seen

  def location(self, node):
    return node.get_absolute_url()

class StaticSitemap(HttpsSitemap):
  priority = "0.9"
  locations = []
  
  def __init__(self, *args, **kwargs):
    super(StaticSitemap, self).__init__(*args, **kwargs)
    self.locations = [
      reverse('network_statistics'),
      reverse('network_clients'),
      reverse('network_map')
    ]

  def items(self):
    return self.locations

  def lastmod(self, obj):
    return datetime.now()

  def location(self, obj):
    return obj

class RootPageSitemap(StaticSitemap):
  priority = "1.0"
  locations = [
    '/'
  ]

  def items(self):
    return self.locations

  def lastmod(self, obj):
    return datetime.now()

  def location(self, obj):
    return obj

{'fraction_non_alphanumeric': 0.1230455472467709, 'fraction_numerical': 0.004418762746430999, 'mean_word_length': 3.7315112540192925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2249506', 'n_tokens_mistral': 1003, 'n_tokens_neox': 977, 'n_words': 234}