API - refactor imports
This commit is contained in:
parent
fdeaf54aa9
commit
d3ce0ad1e5
@ -9,7 +9,7 @@ from flask_dramatiq import Dramatiq
|
|||||||
from flask_migrate import Migrate
|
from flask_migrate import Migrate
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
|
||||||
from .email.email import Email
|
from fittrackee.emails.email import Email
|
||||||
|
|
||||||
db = SQLAlchemy()
|
db = SQLAlchemy()
|
||||||
bcrypt = Bcrypt()
|
bcrypt = Bcrypt()
|
||||||
|
@ -5,15 +5,16 @@ import shutil
|
|||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
import gunicorn.app.base
|
import gunicorn.app.base
|
||||||
|
from flask import Flask
|
||||||
|
from flask_dramatiq import worker
|
||||||
|
from flask_migrate import upgrade
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
from fittrackee import create_app, db
|
from fittrackee import create_app, db
|
||||||
from fittrackee.application.utils import init_config
|
from fittrackee.application.utils import init_config
|
||||||
from fittrackee.database_utils import init_database
|
from fittrackee.database_utils import init_database
|
||||||
from fittrackee.workouts.models import Workout
|
from fittrackee.workouts.models import Workout
|
||||||
from fittrackee.workouts.utils import update_workout
|
from fittrackee.workouts.utils import update_workout
|
||||||
from flask import Flask
|
|
||||||
from flask_dramatiq import worker
|
|
||||||
from flask_migrate import upgrade
|
|
||||||
from tqdm import tqdm
|
|
||||||
|
|
||||||
HOST = os.getenv('HOST', '0.0.0.0')
|
HOST = os.getenv('HOST', '0.0.0.0')
|
||||||
PORT = os.getenv('PORT', '5000')
|
PORT = os.getenv('PORT', '5000')
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
from typing import Dict, Union
|
from typing import Dict, Union
|
||||||
|
|
||||||
|
from flask import Blueprint, current_app, request
|
||||||
|
from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound
|
||||||
|
|
||||||
from fittrackee import db
|
from fittrackee import db
|
||||||
from fittrackee.responses import (
|
from fittrackee.responses import (
|
||||||
HttpResponse,
|
HttpResponse,
|
||||||
InvalidPayloadErrorResponse,
|
InvalidPayloadErrorResponse,
|
||||||
handle_error_and_return_response,
|
handle_error_and_return_response,
|
||||||
)
|
)
|
||||||
from flask import Blueprint, current_app, request
|
from fittrackee.users.decorators import authenticate_as_admin
|
||||||
from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound
|
|
||||||
|
|
||||||
from ..users.decorators import authenticate_as_admin
|
|
||||||
from .models import AppConfig
|
from .models import AppConfig
|
||||||
from .utils import update_app_config_from_database
|
from .utils import update_app_config_from_database
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from fittrackee import db
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from sqlalchemy.engine.base import Connection
|
from sqlalchemy.engine.base import Connection
|
||||||
from sqlalchemy.event import listens_for
|
from sqlalchemy.event import listens_for
|
||||||
@ -8,7 +7,8 @@ from sqlalchemy.ext.declarative import DeclarativeMeta
|
|||||||
from sqlalchemy.orm.mapper import Mapper
|
from sqlalchemy.orm.mapper import Mapper
|
||||||
from sqlalchemy.orm.session import Session
|
from sqlalchemy.orm.session import Session
|
||||||
|
|
||||||
from ..users.models import User
|
from fittrackee import db
|
||||||
|
from fittrackee.users.models import User
|
||||||
|
|
||||||
BaseModel: DeclarativeMeta = db.Model
|
BaseModel: DeclarativeMeta = db.Model
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee import db
|
from fittrackee import db
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
from .models import AppConfig
|
from .models import AppConfig
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class BaseConfig:
|
|||||||
)
|
)
|
||||||
PICTURE_ALLOWED_EXTENSIONS = {'jpg', 'png', 'gif'}
|
PICTURE_ALLOWED_EXTENSIONS = {'jpg', 'png', 'gif'}
|
||||||
WORKOUT_ALLOWED_EXTENSIONS = {'gpx', 'zip'}
|
WORKOUT_ALLOWED_EXTENSIONS = {'gpx', 'zip'}
|
||||||
TEMPLATES_FOLDER = os.path.join(current_app.root_path, 'email/templates')
|
TEMPLATES_FOLDER = os.path.join(current_app.root_path, 'emails/templates')
|
||||||
UI_URL = os.environ.get('UI_URL')
|
UI_URL = os.environ.get('UI_URL')
|
||||||
EMAIL_URL = os.environ.get('EMAIL_URL')
|
EMAIL_URL = os.environ.get('EMAIL_URL')
|
||||||
SENDER_EMAIL = os.environ.get('SENDER_EMAIL')
|
SENDER_EMAIL = os.environ.get('SENDER_EMAIL')
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee import db
|
from fittrackee import db
|
||||||
from fittrackee.application.utils import (
|
from fittrackee.application.utils import (
|
||||||
init_config,
|
init_config,
|
||||||
@ -5,7 +7,6 @@ from fittrackee.application.utils import (
|
|||||||
)
|
)
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport
|
from fittrackee.workouts.models import Sport
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
|
|
||||||
def init_database(app: Flask) -> None:
|
def init_database(app: Flask) -> None:
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
from json import dumps
|
from json import dumps
|
||||||
from typing import Dict, List, Optional, Union
|
from typing import Dict, List, Optional, Union
|
||||||
|
|
||||||
from fittrackee import appLog
|
|
||||||
from flask import Response
|
from flask import Response
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
|
||||||
|
from fittrackee import appLog
|
||||||
|
|
||||||
|
|
||||||
def get_empty_data_for_datatype(data_type: str) -> Union[str, List]:
|
def get_empty_data_for_datatype(data_type: str) -> Union[str, List]:
|
||||||
return '' if data_type in ['gpx', 'chart_data'] else []
|
return '' if data_type in ['gpx', 'chart_data'] else []
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
|
from fittrackee.users.models import User
|
||||||
|
|
||||||
|
|
||||||
class TestGetConfig:
|
class TestGetConfig:
|
||||||
def test_it_gets_application_config(
|
def test_it_gets_application_config(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from fittrackee.application.models import AppConfig
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
|
from fittrackee.application.models import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class TestConfigModel:
|
class TestConfigModel:
|
||||||
def test_application_config(self, app: Flask) -> None:
|
def test_application_config(self, app: Flask) -> None:
|
||||||
|
@ -3,6 +3,7 @@ import os
|
|||||||
from typing import Generator, Optional
|
from typing import Generator, Optional
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from fittrackee import create_app, db
|
from fittrackee import create_app, db
|
||||||
from fittrackee.application.models import AppConfig
|
from fittrackee.application.models import AppConfig
|
||||||
from fittrackee.application.utils import update_app_config_from_database
|
from fittrackee.application.utils import update_app_config_from_database
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
from fittrackee import email_service
|
|
||||||
from fittrackee.email.email import EmailMessage
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
from ..template_results.password_reset_request import expected_en_text_body
|
from fittrackee import email_service
|
||||||
|
from fittrackee.emails.email import EmailMessage
|
||||||
|
|
||||||
|
from .template_results.password_reset_request import expected_en_text_body
|
||||||
|
|
||||||
|
|
||||||
class TestEmailMessage:
|
class TestEmailMessage:
|
@ -1,8 +1,9 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from fittrackee.email.email import EmailTemplate
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
from ..template_results.password_reset_request import (
|
from fittrackee.emails.email import EmailTemplate
|
||||||
|
|
||||||
|
from .template_results.password_reset_request import (
|
||||||
expected_en_html_body,
|
expected_en_html_body,
|
||||||
expected_en_text_body,
|
expected_en_text_body,
|
||||||
expected_fr_html_body,
|
expected_fr_html_body,
|
@ -1,5 +1,9 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from fittrackee.email.utils_email import InvalidEmailUrlScheme, parse_email_url
|
|
||||||
|
from fittrackee.emails.utils_email import (
|
||||||
|
InvalidEmailUrlScheme,
|
||||||
|
parse_email_url,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestEmailUrlParser:
|
class TestEmailUrlParser:
|
@ -3,11 +3,12 @@ from datetime import datetime, timedelta
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
from freezegun import freeze_time
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.users.utils_token import get_user_token
|
from fittrackee.users.utils_token import get_user_token
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from flask import Flask
|
|
||||||
from freezegun import freeze_time
|
|
||||||
|
|
||||||
|
|
||||||
class TestUserRegistration:
|
class TestUserRegistration:
|
||||||
|
@ -3,9 +3,10 @@ from datetime import datetime, timedelta
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
|
|
||||||
class TestGetUser:
|
class TestGetUser:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from fittrackee.users.models import User
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
|
from fittrackee.users.models import User
|
||||||
|
|
||||||
|
|
||||||
class TestUserModel:
|
class TestUserModel:
|
||||||
def test_user_model(self, app: Flask, user_1: User) -> None:
|
def test_user_model(self, app: Flask, user_1: User) -> None:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
|
|
||||||
class TestGetRecords:
|
class TestGetRecords:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Record, Sport, Workout
|
from fittrackee.workouts.models import Record, Sport, Workout
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
|
|
||||||
class TestRecordModel:
|
class TestRecordModel:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
expected_sport_1_cycling_result = {
|
expected_sport_1_cycling_result = {
|
||||||
'id': 1,
|
'id': 1,
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
|
|
||||||
class TestSportModel:
|
class TestSportModel:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
|
|
||||||
class TestGetStatsByTime:
|
class TestGetStatsByTime:
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
from .utils import get_random_short_id
|
from .utils import get_random_short_id
|
||||||
|
|
||||||
|
@ -4,10 +4,11 @@ from datetime import datetime
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from fittrackee.workouts.utils_id import decode_short_id
|
from fittrackee.workouts.utils_id import decode_short_id
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
|
|
||||||
def assert_workout_data_with_gpx(data: Dict) -> None:
|
def assert_workout_data_with_gpx(data: Dict) -> None:
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import json
|
import json
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from fittrackee.workouts.utils_id import decode_short_id
|
from fittrackee.workouts.utils_id import decode_short_id
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
from .utils import get_random_short_id, post_an_workout
|
from .utils import get_random_short_id, post_an_workout
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from fittrackee.workouts.utils import get_absolute_file_path
|
from fittrackee.workouts.utils import get_absolute_file_path
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
from .utils import get_random_short_id, post_an_workout
|
from .utils import get_random_short_id, post_an_workout
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
from fittrackee.users.models import User
|
from fittrackee.users.models import User
|
||||||
from fittrackee.workouts.models import Sport, Workout
|
from fittrackee.workouts.models import Sport, Workout
|
||||||
from fittrackee.workouts.utils_id import decode_short_id
|
from fittrackee.workouts.utils_id import decode_short_id
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
|
|
||||||
class TestWorkoutModel:
|
class TestWorkoutModel:
|
||||||
|
@ -3,9 +3,10 @@ from io import BytesIO
|
|||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from fittrackee.workouts.utils_id import encode_uuid
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
|
from fittrackee.workouts.utils_id import encode_uuid
|
||||||
|
|
||||||
|
|
||||||
def get_random_short_id() -> str:
|
def get_random_short_id() -> str:
|
||||||
return encode_uuid(uuid4())
|
return encode_uuid(uuid4())
|
||||||
|
@ -3,6 +3,11 @@ import os
|
|||||||
from typing import Dict, Tuple, Union
|
from typing import Dict, Tuple, Union
|
||||||
|
|
||||||
import jwt
|
import jwt
|
||||||
|
from flask import Blueprint, current_app, request
|
||||||
|
from sqlalchemy import exc, or_
|
||||||
|
from werkzeug.exceptions import RequestEntityTooLarge
|
||||||
|
from werkzeug.utils import secure_filename
|
||||||
|
|
||||||
from fittrackee import appLog, bcrypt, db
|
from fittrackee import appLog, bcrypt, db
|
||||||
from fittrackee.responses import (
|
from fittrackee.responses import (
|
||||||
ForbiddenErrorResponse,
|
ForbiddenErrorResponse,
|
||||||
@ -13,12 +18,8 @@ from fittrackee.responses import (
|
|||||||
handle_error_and_return_response,
|
handle_error_and_return_response,
|
||||||
)
|
)
|
||||||
from fittrackee.tasks import reset_password_email
|
from fittrackee.tasks import reset_password_email
|
||||||
from flask import Blueprint, current_app, request
|
from fittrackee.workouts.utils_files import get_absolute_file_path
|
||||||
from sqlalchemy import exc, or_
|
|
||||||
from werkzeug.exceptions import RequestEntityTooLarge
|
|
||||||
from werkzeug.utils import secure_filename
|
|
||||||
|
|
||||||
from ..workouts.utils_files import get_absolute_file_path
|
|
||||||
from .decorators import authenticate
|
from .decorators import authenticate
|
||||||
from .models import User
|
from .models import User
|
||||||
from .utils import (
|
from .utils import (
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, Callable, Union
|
from typing import Any, Callable, Union
|
||||||
|
|
||||||
from fittrackee.responses import HttpResponse
|
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
|
from fittrackee.responses import HttpResponse
|
||||||
|
|
||||||
from .utils import verify_user
|
from .utils import verify_user
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,14 +2,15 @@ from datetime import datetime
|
|||||||
from typing import Dict, Optional, Union
|
from typing import Dict, Optional, Union
|
||||||
|
|
||||||
import jwt
|
import jwt
|
||||||
from fittrackee import bcrypt, db
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
from sqlalchemy.ext.declarative import DeclarativeMeta
|
from sqlalchemy.ext.declarative import DeclarativeMeta
|
||||||
from sqlalchemy.ext.hybrid import hybrid_property
|
from sqlalchemy.ext.hybrid import hybrid_property
|
||||||
from sqlalchemy.sql.expression import select
|
from sqlalchemy.sql.expression import select
|
||||||
|
|
||||||
from ..workouts.models import Workout
|
from fittrackee import bcrypt, db
|
||||||
|
from fittrackee.workouts.models import Workout
|
||||||
|
|
||||||
from .utils_token import decode_user_token, get_user_token
|
from .utils_token import decode_user_token, get_user_token
|
||||||
|
|
||||||
BaseModel: DeclarativeMeta = db.Model
|
BaseModel: DeclarativeMeta = db.Model
|
||||||
|
@ -2,6 +2,9 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
from typing import Any, Dict, Tuple, Union
|
from typing import Any, Dict, Tuple, Union
|
||||||
|
|
||||||
|
from flask import Blueprint, request, send_file
|
||||||
|
from sqlalchemy import exc
|
||||||
|
|
||||||
from fittrackee import db
|
from fittrackee import db
|
||||||
from fittrackee.responses import (
|
from fittrackee.responses import (
|
||||||
ForbiddenErrorResponse,
|
ForbiddenErrorResponse,
|
||||||
@ -11,10 +14,8 @@ from fittrackee.responses import (
|
|||||||
UserNotFoundErrorResponse,
|
UserNotFoundErrorResponse,
|
||||||
handle_error_and_return_response,
|
handle_error_and_return_response,
|
||||||
)
|
)
|
||||||
from flask import Blueprint, request, send_file
|
from fittrackee.workouts.utils_files import get_absolute_file_path
|
||||||
from sqlalchemy import exc
|
|
||||||
|
|
||||||
from ..workouts.utils_files import get_absolute_file_path
|
|
||||||
from .decorators import authenticate, authenticate_as_admin
|
from .decorators import authenticate, authenticate_as_admin
|
||||||
from .models import User, Workout
|
from .models import User, Workout
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ from datetime import timedelta
|
|||||||
from typing import Optional, Tuple, Union
|
from typing import Optional, Tuple, Union
|
||||||
|
|
||||||
import humanize
|
import humanize
|
||||||
|
from flask import Request, current_app
|
||||||
|
|
||||||
from fittrackee.responses import (
|
from fittrackee.responses import (
|
||||||
ForbiddenErrorResponse,
|
ForbiddenErrorResponse,
|
||||||
HttpResponse,
|
HttpResponse,
|
||||||
@ -10,7 +12,6 @@ from fittrackee.responses import (
|
|||||||
PayloadTooLargeErrorResponse,
|
PayloadTooLargeErrorResponse,
|
||||||
UnauthorizedErrorResponse,
|
UnauthorizedErrorResponse,
|
||||||
)
|
)
|
||||||
from flask import Request, current_app
|
|
||||||
|
|
||||||
from .models import User
|
from .models import User
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ import os
|
|||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict, Optional, Union
|
||||||
from uuid import UUID, uuid4
|
from uuid import UUID, uuid4
|
||||||
|
|
||||||
from fittrackee import db
|
|
||||||
from sqlalchemy.dialects import postgresql
|
from sqlalchemy.dialects import postgresql
|
||||||
from sqlalchemy.engine.base import Connection
|
from sqlalchemy.engine.base import Connection
|
||||||
from sqlalchemy.event import listens_for
|
from sqlalchemy.event import listens_for
|
||||||
@ -13,6 +12,8 @@ from sqlalchemy.orm.mapper import Mapper
|
|||||||
from sqlalchemy.orm.session import Session, object_session
|
from sqlalchemy.orm.session import Session, object_session
|
||||||
from sqlalchemy.types import JSON, Enum
|
from sqlalchemy.types import JSON, Enum
|
||||||
|
|
||||||
|
from fittrackee import db
|
||||||
|
|
||||||
from .utils_files import get_absolute_file_path
|
from .utils_files import get_absolute_file_path
|
||||||
from .utils_format import convert_in_duration, convert_value_to_integer
|
from .utils_format import convert_in_duration, convert_value_to_integer
|
||||||
from .utils_id import encode_uuid
|
from .utils_id import encode_uuid
|
||||||
|
@ -2,7 +2,8 @@ from typing import Dict
|
|||||||
|
|
||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
|
|
||||||
from ..users.decorators import authenticate
|
from fittrackee.users.decorators import authenticate
|
||||||
|
|
||||||
from .models import Record
|
from .models import Record
|
||||||
|
|
||||||
records_blueprint = Blueprint('records', __name__)
|
records_blueprint = Blueprint('records', __name__)
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
from typing import Dict, Union
|
from typing import Dict, Union
|
||||||
|
|
||||||
|
from flask import Blueprint, request
|
||||||
|
from sqlalchemy import exc
|
||||||
|
|
||||||
from fittrackee import db
|
from fittrackee import db
|
||||||
from fittrackee.responses import (
|
from fittrackee.responses import (
|
||||||
DataNotFoundErrorResponse,
|
DataNotFoundErrorResponse,
|
||||||
@ -7,11 +10,9 @@ from fittrackee.responses import (
|
|||||||
InvalidPayloadErrorResponse,
|
InvalidPayloadErrorResponse,
|
||||||
handle_error_and_return_response,
|
handle_error_and_return_response,
|
||||||
)
|
)
|
||||||
from flask import Blueprint, request
|
from fittrackee.users.decorators import authenticate, authenticate_as_admin
|
||||||
from sqlalchemy import exc
|
from fittrackee.users.models import User
|
||||||
|
|
||||||
from ..users.decorators import authenticate, authenticate_as_admin
|
|
||||||
from ..users.models import User
|
|
||||||
from .models import Sport
|
from .models import Sport
|
||||||
|
|
||||||
sports_blueprint = Blueprint('sports', __name__)
|
sports_blueprint = Blueprint('sports', __name__)
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Dict, Union
|
from typing import Dict, Union
|
||||||
|
|
||||||
|
from flask import Blueprint, request
|
||||||
|
from sqlalchemy import func
|
||||||
|
|
||||||
from fittrackee import db
|
from fittrackee import db
|
||||||
from fittrackee.responses import (
|
from fittrackee.responses import (
|
||||||
HttpResponse,
|
HttpResponse,
|
||||||
@ -9,11 +12,9 @@ from fittrackee.responses import (
|
|||||||
UserNotFoundErrorResponse,
|
UserNotFoundErrorResponse,
|
||||||
handle_error_and_return_response,
|
handle_error_and_return_response,
|
||||||
)
|
)
|
||||||
from flask import Blueprint, request
|
from fittrackee.users.decorators import authenticate, authenticate_as_admin
|
||||||
from sqlalchemy import func
|
from fittrackee.users.models import User
|
||||||
|
|
||||||
from ..users.decorators import authenticate, authenticate_as_admin
|
|
||||||
from ..users.models import User
|
|
||||||
from .models import Sport, Workout
|
from .models import Sport, Workout
|
||||||
from .utils import get_datetime_with_tz, get_upload_dir_size
|
from .utils import get_datetime_with_tz, get_upload_dir_size
|
||||||
from .utils_format import convert_timedelta_to_integer
|
from .utils_format import convert_timedelta_to_integer
|
||||||
|
@ -8,14 +8,15 @@ from uuid import UUID
|
|||||||
|
|
||||||
import gpxpy.gpx
|
import gpxpy.gpx
|
||||||
import pytz
|
import pytz
|
||||||
from fittrackee import appLog, db
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from sqlalchemy import exc
|
from sqlalchemy import exc
|
||||||
from staticmap import Line, StaticMap
|
from staticmap import Line, StaticMap
|
||||||
from werkzeug.datastructures import FileStorage
|
from werkzeug.datastructures import FileStorage
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
|
||||||
from ..users.models import User
|
from fittrackee import appLog, db
|
||||||
|
from fittrackee.users.models import User
|
||||||
|
|
||||||
from .exceptions import WorkoutException
|
from .exceptions import WorkoutException
|
||||||
from .models import Sport, Workout, WorkoutSegment
|
from .models import Sport, Workout, WorkoutSegment
|
||||||
from .utils_files import get_absolute_file_path
|
from .utils_files import get_absolute_file_path
|
||||||
|
@ -3,9 +3,10 @@ from typing import Dict, Optional
|
|||||||
|
|
||||||
import forecastio
|
import forecastio
|
||||||
import pytz
|
import pytz
|
||||||
from fittrackee import appLog
|
|
||||||
from gpxpy.gpx import GPXRoutePoint
|
from gpxpy.gpx import GPXRoutePoint
|
||||||
|
|
||||||
|
from fittrackee import appLog
|
||||||
|
|
||||||
API_KEY = os.getenv('WEATHER_API_KEY')
|
API_KEY = os.getenv('WEATHER_API_KEY')
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ from datetime import datetime, timedelta
|
|||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from flask import Blueprint, Response, current_app, request, send_file
|
||||||
|
from sqlalchemy import exc
|
||||||
|
|
||||||
from fittrackee import appLog, db
|
from fittrackee import appLog, db
|
||||||
from fittrackee.responses import (
|
from fittrackee.responses import (
|
||||||
DataInvalidPayloadErrorResponse,
|
DataInvalidPayloadErrorResponse,
|
||||||
@ -15,11 +18,13 @@ from fittrackee.responses import (
|
|||||||
NotFoundErrorResponse,
|
NotFoundErrorResponse,
|
||||||
handle_error_and_return_response,
|
handle_error_and_return_response,
|
||||||
)
|
)
|
||||||
from flask import Blueprint, Response, current_app, request, send_file
|
from fittrackee.users.decorators import authenticate
|
||||||
from sqlalchemy import exc
|
from fittrackee.users.utils import (
|
||||||
|
User,
|
||||||
|
can_view_workout,
|
||||||
|
verify_extension_and_size,
|
||||||
|
)
|
||||||
|
|
||||||
from ..users.decorators import authenticate
|
|
||||||
from ..users.utils import User, can_view_workout, verify_extension_and_size
|
|
||||||
from .models import Workout
|
from .models import Workout
|
||||||
from .utils import (
|
from .utils import (
|
||||||
WorkoutException,
|
WorkoutException,
|
||||||
|
@ -70,7 +70,6 @@ include = ".py$"
|
|||||||
exclude = "migrations"
|
exclude = "migrations"
|
||||||
|
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
known_third_party = "fittrackee"
|
|
||||||
multi_line_output = 3
|
multi_line_output = 3
|
||||||
include_trailing_comma = true
|
include_trailing_comma = true
|
||||||
force_grid_wrap = 0
|
force_grid_wrap = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user