def main(): """ main program: - checks if account and key is present; otherwise allows user to generate them - verifys user - displays the menu - calls appropirate function to either store or retrieve information """ account = False while account == False: if path.exists("key.txt") and path.exists("account.txt"): account = True else: generate_key() create_account() a = verify() while a is False: a = verify() x = menu() while x is not 3: if x == 1: key = getKey() info = getInfo(key) store(info) if x == 2: choice = list_services() result = retrieve(choice) display(result) x = menu()
def do_process(args): sc = SparkContext(appName="task") stop_words = get_stopwords(args.lang) sections_by_title = extract_sections(args.dump) dataset = [] for title, sections in sections_by_title.items(): for section in sections: key = generate_key(stop_words, title, section) value = "{}#{}".format(title, section) if key != "": dataset.append((key, value)) rdd = sc.parallelize(dataset) rdd.saveAsSequenceFile(args.output)
def map_preprocess_wikidata(record, lang, stop_words): line_stripped = record.rstrip(",\n") try: entity = json.loads(line_stripped) except: return qid = entity["id"] if qid.startswith("P"): return if is_orphan(lang, entity): label_main = entity["labels"][lang]["value"] aliases = [alias["value"] for alias in entity["aliases"].get(lang, [])] labels = [label_main] + aliases for label in labels: key = generate_key(stop_words, label) value = "{}#{}".format(qid, label_main) if key != "": yield key, value
For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os from generate_key import generate_key BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{}'.format(generate_key(40, 128)) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True TEMPLATE_DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions',
For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os from generate_key import generate_key BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = "{}".format(generate_key(40, 128)) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True TEMPLATE_DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = ( "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes",
https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) from generate_key import generate_key # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{}'.format(generate_key(40,128)) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True TEMPLATE_DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes',
) # List of finder classes that know how to find static files in # various locations. STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', # 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) # Make this unique, and don't share it with anybody. try: from secret_key import SECRET_KEY except ImportError: from generate_key import generate_key key = generate_key() with open(os.path.join(BASE_DIR, 'secret_key.py'), 'w') as key_file: key_file.write('SECRET_KEY = %s' % repr(key)) from secret_key import SECRET_KEY # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',