Beispiel #1
0
	def saturation(this):
		sat = 0
		saturations = Csv.loadall("csv/saturation.csv")
		for items in saturations:
			if int(items["saturation"]) == 1:
				sat += int(this.acideGras[items["acidegras"]])
		return sat
Beispiel #2
0
def importIngredients(filename):
	"""Importer les ingredients depuis un fichier csv. Opération destructrice."""
	cursor.execute("DELETE FROM Ingredients")
	connection.commit()

	cursor.execute("INSERT INTO Ingredients VALUES (NULL, ?, ?, ?)", Csv.loadall("csv/ingredients.csv"))
	connection.commit()
Beispiel #3
0
def importSaturation(filename):
	"""Importer la saturation depuis un fichier csv."""
	cursor.execute("DELETE FROM Saturation")
	connection.commit()

	for d in Csv.loadall(filename):
		cursor.execute("INSERT INTO Saturation VALUES (?, ?)", (d["acidegras"], d["saturation"]))
		connection.commit()
Beispiel #4
0
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
#
SECRET_KEY = config('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=False, cast=bool)

ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv())


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # Apps propias
    'core',
    'concursos',
Beispiel #5
0
# -*- coding: utf-8 -*-
# @author   : Vitaliy Charnou <*****@*****.**>

from subprocess import check_output
import json, os, sys

params = os.getcwd() + '/../../../../../../app/etc/env.php'
config = check_output(
    ['php', '-r', 'echo json_encode(include "' + params + '");'])
config = json.loads(config)

sys.path.append('../Model/')
sys.path.append('../Model/Writer')
import Log, Export, Csv
from Log import *
from Export import *
from Csv import *

log = Log()
csv = Csv()
log.setBeginTime()
export = Export(config)
data = export.getData()
log.writeln(u'count: %.2f' % len(data))
headers = [i[0] for i in export.getDescription()]
csv.setFile('pupsik2.csv')
csv.setHeaders(headers)
csv.setInFile(data)
log.outEndTime()
Beispiel #6
0
	def load(this, nom):
		loader = Csv.load("csv/acidegras.csv", "nom", nom)
		this.update(loader)
Beispiel #7
0
	def load(this, ref):
		loader = Csv.load("csv/ingredients.csv", "ref", ref)
		if loader is not None:
			this.ref = loader["ref"]
			this.famille = loader["famille"]
			this.nom = loader["nom"]