💚 Fix PEP8 warnings
All checks were successful
/ Python-PEP8 (push) Successful in 12s

This commit is contained in:
Finn Christiansen 2024-10-11 22:31:28 +02:00
parent 00b87b040e
commit c554194fb5
7 changed files with 10 additions and 18 deletions

1
.gitignore vendored
View file

@ -70,3 +70,4 @@ pip-selfcheck.json
# custom # custom
tags tags
.env .env
.mypy_cache

View file

@ -3,12 +3,10 @@ from flask_smorest import Api
from flask_marshmallow import Marshmallow from flask_marshmallow import Marshmallow
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate from flask_migrate import Migrate
#from flask_jwt_extended import JWTManager
db = SQLAlchemy() db = SQLAlchemy()
ma = Marshmallow() ma = Marshmallow()
#jwt = JWTManager()
def create_app(cfg='default'): def create_app(cfg='default'):
@ -26,9 +24,7 @@ def create_app(cfg='default'):
api.init_app(app) api.init_app(app)
db.init_app(app) db.init_app(app)
ma.init_app(app) ma.init_app(app)
#jwt.init_app(app)
Migrate(app, db) Migrate(app, db)
resources.register_blueprints(api) resources.register_blueprints(api)
return app return app

View file

@ -11,4 +11,3 @@ def register_blueprints(api):
api.register_blueprint(resource_blp, api.register_blueprint(resource_blp,
url_prefix=f'/{resource_blp.url_prefix}') url_prefix=f'/{resource_blp.url_prefix}')

View file

@ -32,4 +32,3 @@ class ImpulseById(MethodView):
impulse = Impulse.query.filter_by(id=impulse_id).first() impulse = Impulse.query.filter_by(id=impulse_id).first()
db.session.delete(impulse) db.session.delete(impulse)
db.session.commit() db.session.commit()

View file

@ -1,7 +1,6 @@
from marshmallow import SchemaOpts from marshmallow import SchemaOpts
from marshmallow import pre_load, post_dump from marshmallow import pre_load, post_dump
from marshmallow_sqlalchemy import ModelSchemaOpts, ModelConverter, ModelSchema from marshmallow_sqlalchemy import ModelSchemaOpts, ModelConverter, ModelSchema
from .. import ma
from .. import db from .. import db
@ -23,7 +22,6 @@ class NamespaceOpts(ModelSchemaOpts):
self.include_relationships = True self.include_relationships = True
#class NamespacedSchema(ma.SQLAlchemySchema):
class NamespacedSchema(ModelSchema): class NamespacedSchema(ModelSchema):
OPTIONS_CLASS = NamespaceOpts OPTIONS_CLASS = NamespaceOpts
@ -42,4 +40,3 @@ class NamespacedSchema(ModelSchema):
else: else:
key = self.opts.plural_name if many else self.opts.name key = self.opts.plural_name if many else self.opts.name
return {key: data} return {key: data}

View file

@ -4,8 +4,8 @@ import time
import datetime import datetime
import requests import requests
import influxdb_client, os import influxdb_client
from influxdb_client import InfluxDBClient, Point, WritePrecision import os
from influxdb_client.client.write_api import SYNCHRONOUS from influxdb_client.client.write_api import SYNCHRONOUS
@ -42,7 +42,7 @@ def flaskapp():
def influxdb(): def influxdb():
point = ( point = (
Point("electricity") influxdb_client.Point("electricity")
.field("consumption", 2) .field("consumption", 2)
) )
write_api.write(bucket=bucket, org="finn", record=point) write_api.write(bucket=bucket, org="finn", record=point)