Skip to content

Commit

Permalink
ref: Remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
iamareebjamal committed Jan 24, 2020
1 parent bd29c81 commit 87d3f58
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/api/attendees.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy import and_, or_

from app.api.bootstrap import api
from app.api.helpers.db import get_count, safe_query
from app.api.helpers.db import safe_query
from app.api.helpers.exceptions import (
ConflictException,
ForbiddenException,
Expand Down
2 changes: 1 addition & 1 deletion app/api/events.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime

import pytz
from flask import current_app, request
from flask import request
from flask_jwt_extended import current_user, verify_jwt_in_request
from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
from flask_rest_jsonapi.exceptions import ObjectNotFound
Expand Down
8 changes: 4 additions & 4 deletions app/api/helpers/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import PIL
import requests
from flask import current_app as app
from flask import current_app
from PIL import Image
from sqlalchemy.orm.exc import NoResultFound
from xhtml2pdf import pisa
Expand Down Expand Up @@ -98,7 +98,7 @@ def create_save_resized_image(image_file, basewidth=None, maintain_aspect=None,
img = img.resize((basewidth, height_size), PIL.Image.ANTIALIAS)

temp_file_relative_path = 'static/media/temp/' + generate_hash(str(image_file)) + get_file_name() + '.jpg'
temp_file_path = app.config['BASE_DIR'] + '/' + temp_file_relative_path
temp_file_path = current_app.config['BASE_DIR'] + '/' + temp_file_relative_path
dir_path = temp_file_path.rsplit('/', 1)[0]

# create dirs if not present
Expand Down Expand Up @@ -213,7 +213,7 @@ def create_system_image(image_file=None, upload_path=None, unique_identifier=Non
image_file = io.BytesIO(img_data.read())
else:
file_relative_path = 'static/default_system_image.png'
image_file = app.config['BASE_DIR'] + '/' + file_relative_path
image_file = current_app.config['BASE_DIR'] + '/' + file_relative_path
try:
im = Image.open(image_file)
except IOError:
Expand All @@ -226,7 +226,7 @@ def create_system_image(image_file=None, upload_path=None, unique_identifier=Non
img = im

temp_file_relative_path = 'static/media/temp/' + generate_hash(str(image_file)) + get_file_name() + '.jpg'
temp_file_path = app.config['BASE_DIR'] + '/' + temp_file_relative_path
temp_file_path = current_app.config['BASE_DIR'] + '/' + temp_file_relative_path
dir_path = temp_file_path.rsplit('/', 1)[0]

# create dirs if not present
Expand Down
2 changes: 1 addition & 1 deletion app/api/helpers/scheduled_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
send_notif_after_event,
send_notif_monthly_fee_payment,
)
from app.api.helpers.query import get_upcoming_events, get_user_event_roles_by_role_name
from app.api.helpers.query import get_user_event_roles_by_role_name
from app.api.helpers.storage import UPLOAD_PATHS
from app.api.helpers.utilities import monthdelta
from app.instance import celery
Expand Down
1 change: 0 additions & 1 deletion app/api/helpers/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import json
import logging
import os
import traceback
import urllib.error
import uuid

Expand Down
1 change: 0 additions & 1 deletion app/api/modules.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from flask_rest_jsonapi import ResourceDetail

from app.api.bootstrap import api
from app.api.helpers.exceptions import ConflictException
from app.api.schema.modules import ModuleSchema
from app.models import db
from app.models.module import Module
Expand Down
2 changes: 1 addition & 1 deletion app/api/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from app.api.helpers.utilities import dasherize, require_relationship
from app.api.schema.orders import OrderSchema
from app.models import db
from app.models.discount_code import TICKET, DiscountCode
from app.models.discount_code import DiscountCode
from app.models.order import Order, OrderTicket, get_updatable_fields
from app.models.ticket_holder import TicketHolder
from app.models.user import User
Expand Down
3 changes: 1 addition & 2 deletions app/api/tickets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import current_app, request
from flask import request
from flask_jwt_extended import current_user, verify_jwt_in_request
from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
from flask_rest_jsonapi.exceptions import ObjectNotFound
Expand All @@ -8,7 +8,6 @@
from app.api.helpers.db import get_count, safe_query
from app.api.helpers.exceptions import (
ConflictException,
MethodNotAllowed,
UnprocessableEntity,
)
from app.api.helpers.permission_manager import has_access
Expand Down
1 change: 0 additions & 1 deletion app/api/user_favourite_events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from flask import current_app as app
from flask import request
from flask_jwt_extended import current_user, jwt_required, verify_jwt_in_request
from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
Expand Down
1 change: 0 additions & 1 deletion app/api/users.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import base64
import urllib.error

from flask import Blueprint, abort, jsonify, make_response, request
from flask_jwt_extended import current_user, verify_fresh_jwt_in_request
Expand Down
1 change: 0 additions & 1 deletion app/factories/user_favourite_events.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import factory

from app.factories.event import EventFactoryBasic
from app.factories.user import UserFactory
from app.models.user import User
from app.models.user_favourite_event import UserFavouriteEvent, db

Expand Down
3 changes: 0 additions & 3 deletions app/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import sentry_sdk
import sqlalchemy as sa
import stripe
from apscheduler.schedulers.background import BackgroundScheduler
from celery.signals import after_task_publish
from elasticsearch_dsl.connections import connections
from envparse import env
from flask import Flask, json, make_response
from flask_cors import CORS
Expand All @@ -35,7 +33,6 @@
from app.models.event import Event
from app.models.role_invite import RoleInvite
from app.models.utils import add_engine_pidguard, sqlite_datetime_fix
from app.settings import get_settings, get_setts
from app.templates.flask_ext.jinja.filters import init_filters
from app.views.blueprints import BlueprintsManager
from app.views.elastic_search import client
Expand Down
3 changes: 0 additions & 3 deletions app/models/event_topic.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import urllib.parse
import uuid

from flask import current_app as app
from flask import request

from app.api.helpers.db import get_count
from app.models import db
from app.models.base import SoftDeletionModel
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from app.api.helpers.db import get_count
from app.models import db
from app.models.base import SoftDeletionModel
from app.models.custom_system_role import CustomSysRole, UserSystemRole
from app.models.custom_system_role import UserSystemRole
from app.models.helpers.versioning import clean_html, clean_up_string
from app.models.notification import Notification
from app.models.panel_permission import PanelPermission
Expand Down
2 changes: 1 addition & 1 deletion populate_db.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from envparse import env

from app.api.helpers.db import get_or_create, save_to_db # , save_to_db
from app.api.helpers.db import get_or_create
# Admin message settings
from app.api.helpers.system_mails import MAILS
from app.instance import current_app
Expand Down
4 changes: 2 additions & 2 deletions tests/hook_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import dredd_hooks as hooks
import requests

# DO NOT REMOVE THIS. This adds the project root for successful imports. Imports from the project directory should be
# placed only below this
# DO NOT REMOVE THIS. This adds the project root for successful imports.
# Imports from the project directory should be placed only below this
sys.path.insert(1, path.abspath(path.join(__file__, "../..")))

from flask_migrate import Migrate
Expand Down

0 comments on commit 87d3f58

Please sign in to comment.