# Path: domains/models.py
# MAX_NAME_LENGTH = 12
# DOMAIN_CHARS = 'abcdefghijklmnopqrstuvwxyz-0123456789'
# OBSOLETE_ATTRIBUTES = """
# scowl com net org dns_com dns_net dns_org dns_timestamp
# """.split()
# CACHE_ATTRIBUTES = """
# digits dashes
# english spanish french german
# prefix suffix score
# com net org biz info
# """.split()
# class Domain(db.Model):
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def before_put(self):
#     def delete_obsolete_attributes(self):
#     def update_counts(self):
#     def language_scores_need_update(self):
#     def update_language_scores(self):
#     def popularity_scores_need_update(self):
#     def update_popularity_scores(self):
#     def get_best_prefix(self):
#     def get_best_suffix(self):
#     def update_score(self):
#     def update_substrings(self):
#     def to_cache(self):
#     def from_cache(cls, key, values):


import os
import sys
import time
import getpass
import datetime
import ADNS
from common.appenginepatch.aecmd import setup_env
from adns import rr
from google.appengine.ext import db
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.api.datastore_errors import Timeout
from domains.models import Domain, Whois
    from optparse import OptionParser

def delete_batch(objects):
    if not objects:
        return
    for attempt in range(MAX_ATTEMPTS):
        if attempt:
            print "Attempt %d of %d will start in %d seconds." % (
                attempt + 1, MAX_ATTEMPTS, attempt)
            time.sleep(attempt)
        print "Deleting %d objects (%s to %s):" % (
            len(objects), objects[0].name(), objects[-1].name())
        try:
            db.delete(objects)
            break
        except Timeout:
            print "*** Timeout ***"
            if attempt + 1 == MAX_ATTEMPTS:
                sys.exit(1)
    del objects[:]


def main():
    parser = OptionParser()
    parser.add_option('--server', metavar='<hostname>',
                      default='scoretool.appspot.com',
                      help="connect to a different server")
    (options, args) = parser.parse_args()
    remote_api_stub.ConfigureRemoteDatastore(
        'scoretool', '/remote_api', auth_func, options.server)
    while True:

# Path: domains/models.py
# MAX_NAME_LENGTH = 12
# DOMAIN_CHARS = 'abcdefghijklmnopqrstuvwxyz-0123456789'
# OBSOLETE_ATTRIBUTES = """
# scowl com net org dns_com dns_net dns_org dns_timestamp
# """.split()
# CACHE_ATTRIBUTES = """
# digits dashes
# english spanish french german
# prefix suffix score
# com net org biz info
# """.split()
# class Domain(db.Model):
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def before_put(self):
#     def delete_obsolete_attributes(self):
#     def update_counts(self):
#     def language_scores_need_update(self):
#     def update_language_scores(self):
#     def popularity_scores_need_update(self):
#     def update_popularity_scores(self):
#     def get_best_prefix(self):
#     def get_best_suffix(self):
#     def update_score(self):
#     def update_substrings(self):
#     def to_cache(self):
#     def from_cache(cls, key, values):


# Path: tools/delete_whois.py
import os
import sys
import time
import getpass
import datetime
import ADNS
from common.appenginepatch.aecmd import setup_env
from adns import rr
from google.appengine.ext import db
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.api.datastore_errors import Timeout
from domains.models import Domain, Whois
    from optparse import OptionParser


def delete_batch(objects):
    if not objects:
        return
    for attempt in range(MAX_ATTEMPTS):
        if attempt:
            print "Attempt %d of %d will start in %d seconds." % (
                attempt + 1, MAX_ATTEMPTS, attempt)
            time.sleep(attempt)
        print "Deleting %d objects (%s to %s):" % (
            len(objects), objects[0].name(), objects[-1].name())
        try:
            db.delete(objects)
            break
        except Timeout:
            print "*** Timeout ***"
            if attempt + 1 == MAX_ATTEMPTS:
                sys.exit(1)
    del objects[:]


def main():
    parser = OptionParser()
    parser.add_option('--server', metavar='<hostname>',
                      default='scoretool.appspot.com',
                      help="connect to a different server")
    (options, args) = parser.parse_args()
    remote_api_stub.ConfigureRemoteDatastore(
        'scoretool', '/remote_api', auth_func, options.server)
    while True:

        whois_keys = Whois.all(keys_only=True).fetch(BATCH_SIZE)