From e749128b16f534454ab3162d1dfc94bbd4e64706 Mon Sep 17 00:00:00 2001 From: Benjamin Sigonneau Date: Thu, 21 Jul 2022 00:32:59 +0200 Subject: [PATCH] Sort imports with isort --- config.py | 2 +- fioul.py | 7 ++++--- models.py | 16 ++++++++++------ pyproject.toml | 2 ++ webapp.py | 7 ++++--- 5 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 pyproject.toml diff --git a/config.py b/config.py index cce3d3f..46ea8e2 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,5 @@ -from configparser import ConfigParser import os +from configparser import ConfigParser conf = ConfigParser() ini_file = os.path.dirname(__file__) + "/fioul.ini" diff --git a/fioul.py b/fioul.py index 5a4daf9..f0dafc0 100755 --- a/fioul.py +++ b/fioul.py @@ -1,13 +1,14 @@ #! /usr/bin/env python3 +import json from argparse import ArgumentParser -from config import conf from datetime import date -from models import Price, IntegrityError import requests -import json + import webapp +from config import conf +from models import IntegrityError, Price def get_today_price_from_internet(): diff --git a/models.py b/models.py index 7ec3801..125e15e 100644 --- a/models.py +++ b/models.py @@ -1,10 +1,14 @@ -from config import conf -from peewee import MySQLDatabase -from peewee import SqliteDatabase -from peewee import Model -from peewee import AutoField, DateField, IntegerField +from peewee import ( + AutoField, + DateField, + IntegerField, + IntegrityError, + Model, + MySQLDatabase, + SqliteDatabase, +) -from peewee import IntegrityError +from config import conf backend = conf["db"].get("backend", None) if backend == "sqlite": diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5d7bf33 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.isort] +profile = "black" diff --git a/webapp.py b/webapp.py index edda04f..3d154bd 100644 --- a/webapp.py +++ b/webapp.py @@ -1,8 +1,9 @@ -from bottle import hook, request, route, run, static_file, view -import models -from models import Price import os +from bottle import hook, request, route, run, static_file, view + +import models +from models import Price # ---------------------------------------------------------------------- # Web application