Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename data_model to data_models #274

Merged
merged 3 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/authentication/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from app.authentication.no_token_exception import NoTokenException
from app.authentication.user import User
from app.data_model.session_data import SessionData
from app.data_models.session_data import SessionData
from app.globals import create_session_store, get_questionnaire_store, get_session_store
from app.keys import KEY_PURPOSE_AUTHENTICATION
from app.settings import EQ_SESSION_ID, USER_IK
Expand Down
2 changes: 1 addition & 1 deletion app/authentication/jti_claim_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from flask import current_app
from structlog import get_logger

from app.data_model.app_models import UsedJtiClaim
from app.data_models.app_models import UsedJtiClaim
from app.storage.errors import ItemAlreadyExistsError

logger = get_logger()
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Dict, List, Optional

from app.data_model.answer import Answer
from app.data_models.answer import Answer


class AnswerStore:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import astuple, dataclass
from typing import Iterable, List, Mapping, MutableMapping, Optional

from app.data_model.progress import Progress
from app.data_models.progress import Progress
from app.questionnaire.location import Location


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import simplejson as json

from app.data_model.answer_store import AnswerStore
from app.data_model.list_store import ListStore
from app.data_model.progress_store import ProgressStore
from app.data_models.answer_store import AnswerStore
from app.data_models.list_store import ListStore
from app.data_models.progress_store import ProgressStore


class QuestionnaireStore:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from jwcrypto.common import base64url_decode
from structlog import get_logger

from app.data_model.app_models import EQSession
from app.data_model.session_data import SessionData
from app.data_models.app_models import EQSession
from app.data_models.session_data import SessionData
from app.storage.storage_encryption import StorageEncryption

logger = get_logger()
Expand Down
2 changes: 1 addition & 1 deletion app/forms/field_handlers/field_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from wtforms import Field, validators

from app.data_model.answer_store import AnswerStore
from app.data_models.answer_store import AnswerStore
from app.forms.validators import ResponseRequired, format_message_with_title
from app.questionnaire import Location
from app.questionnaire.rules import get_answer_value
Expand Down
2 changes: 1 addition & 1 deletion app/forms/field_handlers/number_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from wtforms import DecimalField, IntegerField

from app.data_model.answer_store import AnswerStore
from app.data_models.answer_store import AnswerStore
from app.forms.field_handlers.field_handler import FieldHandler
from app.forms.fields import DecimalFieldWithSeparator, IntegerFieldWithSeparator
from app.forms.validators import DecimalPlaces, NumberCheck, NumberRange
Expand Down
6 changes: 3 additions & 3 deletions app/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from flask import session as cookie_session
from structlog import get_logger

from app.data_model.questionnaire_store import QuestionnaireStore
from app.data_models.questionnaire_store import QuestionnaireStore
from app.settings import EQ_SESSION_ID, USER_IK

logger = get_logger()
Expand All @@ -31,7 +31,7 @@ def get_questionnaire_store(user_id, user_ik):

# pylint: disable=import-outside-toplevel
def get_session_store():
from app.data_model.session_store import SessionStore
from app.data_models.session_store import SessionStore

if USER_IK not in cookie_session or EQ_SESSION_ID not in cookie_session:
return None
Expand Down Expand Up @@ -68,7 +68,7 @@ def get_session_timeout_in_seconds(schema):

# pylint: disable=import-outside-toplevel
def create_session_store(eq_session_id, user_id, user_ik, session_data):
from app.data_model.session_store import SessionStore
from app.data_models.session_store import SessionStore

pepper = current_app.eq["secret_store"].get_secret_by_name(
"EQ_SERVER_SIDE_STORAGE_ENCRYPTION_USER_PEPPER"
Expand Down
6 changes: 3 additions & 3 deletions app/questionnaire/path_finder.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import List, Mapping, Optional

from app.data_model.answer_store import AnswerStore
from app.data_model.list_store import ListStore
from app.data_model.progress_store import ProgressStore
from app.data_models.answer_store import AnswerStore
from app.data_models.list_store import ListStore
from app.data_models.progress_store import ProgressStore
from app.questionnaire.location import Location
from app.questionnaire.questionnaire_schema import QuestionnaireSchema
from app.questionnaire.routing_path import RoutingPath
Expand Down
2 changes: 1 addition & 1 deletion app/questionnaire/placeholder_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from jinja2 import escape

from app.data_model.answer_store import AnswerStore
from app.data_models.answer_store import AnswerStore
from app.questionnaire import QuestionnaireSchema
from app.questionnaire.placeholder_transforms import PlaceholderTransforms

Expand Down
2 changes: 1 addition & 1 deletion app/questionnaire/placeholder_renderer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from jsonpointer import resolve_pointer, set_pointer

from app.data_model.answer_store import AnswerStore
from app.data_models.answer_store import AnswerStore
from app.questionnaire import QuestionnaireSchema
from app.questionnaire.placeholder_parser import PlaceholderParser
from app.questionnaire.plural_forms import get_plural_form_key
Expand Down
2 changes: 1 addition & 1 deletion app/questionnaire/questionnaire_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from flask_babel import force_locale
from werkzeug.datastructures import ImmutableDict

from app.data_model.answer import Answer
from app.data_models.answer import Answer
from app.forms import error_messages
from app.questionnaire.schema_utils import get_values_for_key

Expand Down
6 changes: 3 additions & 3 deletions app/questionnaire/questionnaire_store_updater.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from itertools import combinations
from typing import Iterable, List, Optional, Tuple, Union

from app.data_model.answer_store import Answer
from app.data_model.progress_store import CompletionStatus
from app.data_model.relationship_store import Relationship, RelationshipStore
from app.data_models.answer_store import Answer
from app.data_models.progress_store import CompletionStatus
from app.data_models.relationship_store import Relationship, RelationshipStore
from app.questionnaire.location import Location


Expand Down
4 changes: 2 additions & 2 deletions app/storage/encrypted_questionnaire_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from flask import current_app
from structlog import get_logger

from app.data_model.app_models import QuestionnaireState
from app.data_model.questionnaire_store import QuestionnaireStore
from app.data_models.app_models import QuestionnaireState
from app.data_models.questionnaire_store import QuestionnaireStore
from app.storage.storage_encryption import StorageEncryption

logger = get_logger()
Expand Down
2 changes: 1 addition & 1 deletion app/storage/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from flask import current_app

from app.data_model import app_models
from app.data_models import app_models


class StorageModel:
Expand Down
2 changes: 1 addition & 1 deletion app/submitter/convert_payload_0_0_3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Dict, List

from app.data_model.answer_store import AnswerStore
from app.data_models.answer_store import AnswerStore


def convert_answers_to_payload_0_0_3(
Expand Down
6 changes: 3 additions & 3 deletions app/views/contexts/context.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from abc import ABC
from typing import Mapping

from app.data_model.answer_store import AnswerStore
from app.data_model.list_store import ListStore
from app.data_model.progress_store import ProgressStore
from app.data_models.answer_store import AnswerStore
from app.data_models.list_store import ListStore
from app.data_models.progress_store import ProgressStore
from app.questionnaire.placeholder_renderer import PlaceholderRenderer
from app.questionnaire.questionnaire_schema import QuestionnaireSchema
from app.questionnaire.router import Router
Expand Down
2 changes: 1 addition & 1 deletion app/views/contexts/hub_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from flask import url_for
from flask_babel import lazy_gettext

from app.data_model.progress_store import CompletionStatus
from app.data_models.progress_store import CompletionStatus
from app.views.contexts import Context


Expand Down
2 changes: 1 addition & 1 deletion app/views/contexts/thank_you_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from flask import url_for

from app.data_model.session_data import SessionData
from app.data_models.session_data import SessionData
from app.libs.utils import convert_tx_id


Expand Down
2 changes: 1 addition & 1 deletion app/views/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from flask import url_for

from app.data_model.questionnaire_store import QuestionnaireStore
from app.data_models.questionnaire_store import QuestionnaireStore

from .individual_response import (
IndividualResponseHandler,
Expand Down
2 changes: 1 addition & 1 deletion app/views/handlers/individual_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from itsdangerous import URLSafeSerializer
from werkzeug.exceptions import NotFound

from app.data_model.progress_store import CompletionStatus
from app.data_models.progress_store import CompletionStatus
from app.forms.questionnaire_form import generate_form
from app.helpers.template_helpers import render_template
from app.questionnaire.placeholder_renderer import PlaceholderRenderer
Expand Down
2 changes: 1 addition & 1 deletion app/views/handlers/relationship_collector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from functools import cached_property

from app.data_model.relationship_store import RelationshipStore
from app.data_models.relationship_store import RelationshipStore
from app.questionnaire.location import Location
from app.questionnaire.relationship_router import RelationshipRouter
from app.views.handlers.question import Question
Expand Down
2 changes: 1 addition & 1 deletion app/views/handlers/thank_you.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from flask import session as cookie_session
from werkzeug.exceptions import NotFound

from app.data_model.session_data import SessionData
from app.data_models.session_data import SessionData
from app.globals import get_session_store
from app.views.contexts.thank_you_context import (
build_census_thank_you_context,
Expand Down
4 changes: 2 additions & 2 deletions tests/app/authentication/test_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from mock import patch

from app.authentication.authenticator import load_user, request_load_user, user_loader
from app.data_model.session_data import SessionData
from app.data_model.session_store import SessionStore
from app.data_models.session_data import SessionData
from app.data_models.session_store import SessionStore
from app.settings import USER_IK
from tests.app.app_context_test_case import AppContextTestCase

Expand Down
2 changes: 1 addition & 1 deletion tests/app/data_model/test_answer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app.data_model.answer_store import Answer
from app.data_models.answer_store import Answer


def test_from_dict():
Expand Down
2 changes: 1 addition & 1 deletion tests/app/data_model/test_answer_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
import simplejson as json

from app.data_model.answer_store import Answer, AnswerStore
from app.data_models.answer_store import Answer, AnswerStore


@pytest.fixture()
Expand Down
2 changes: 1 addition & 1 deletion tests/app/data_model/test_app_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from dateutil.tz import tzutc

from app.data_model.app_models import EQSession, QuestionnaireState, UsedJtiClaim
from app.data_models.app_models import EQSession, QuestionnaireState, UsedJtiClaim
from app.storage.storage import StorageModel
from tests.app.app_context_test_case import AppContextTestCase

Expand Down
6 changes: 3 additions & 3 deletions tests/app/data_model/test_list_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from app.data_model.list_store import ListModel, ListStore
from app.data_models.list_store import ListModel, ListStore


def test_list_serialisation():
Expand Down Expand Up @@ -43,9 +43,9 @@ def test_unique_id_generation():
"""
Ensure that every id generated is unique per questionnaire.
"""
# Mock the app.data_model.list_store.random_string method to return duplicates.
# Mock the app.data_models.list_store.random_string method to return duplicates.
with patch(
"app.data_model.list_store.random_string",
"app.data_models.list_store.random_string",
side_effect=["first", "first", "second"],
):
list_store = ListStore()
Expand Down
4 changes: 2 additions & 2 deletions tests/app/data_model/test_progress_store.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from app.data_model.progress import Progress
from app.data_model.progress_store import CompletionStatus, ProgressStore
from app.data_models.progress import Progress
from app.data_models.progress_store import CompletionStatus, ProgressStore
from app.questionnaire.location import Location


Expand Down
6 changes: 3 additions & 3 deletions tests/app/data_model/test_questionnaire_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import simplejson as json

from app.data_model.answer_store import AnswerStore
from app.data_model.progress_store import CompletionStatus, ProgressStore
from app.data_model.questionnaire_store import QuestionnaireStore
from app.data_models.answer_store import AnswerStore
from app.data_models.progress_store import CompletionStatus, ProgressStore
from app.data_models.questionnaire_store import QuestionnaireStore


def get_basic_input():
Expand Down
2 changes: 1 addition & 1 deletion tests/app/data_model/test_relationship_store.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app.data_model.relationship_store import Relationship, RelationshipStore
from app.data_models.relationship_store import Relationship, RelationshipStore

relationships = [
{
Expand Down
6 changes: 3 additions & 3 deletions tests/app/data_model/test_session_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from jwcrypto import jwe
from jwcrypto.common import base64url_encode

from app.data_model.app_models import EQSession
from app.data_model.session_data import SessionData
from app.data_model.session_store import SessionStore
from app.data_models.app_models import EQSession
from app.data_models.session_data import SessionData
from app.data_models.session_store import SessionStore
from app.storage import storage_encryption
from tests.app.app_context_test_case import AppContextTestCase

Expand Down
4 changes: 2 additions & 2 deletions tests/app/forms/field_handlers/test_date_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from mock import patch
from wtforms import Form

from app.data_model.answer import Answer
from app.data_model.answer_store import AnswerStore
from app.data_models.answer import Answer
from app.data_models.answer_store import AnswerStore
from app.forms.field_handlers import DateHandler
from app.forms.fields import date_field
from app.questionnaire.location import Location
Expand Down
2 changes: 1 addition & 1 deletion tests/app/forms/field_handlers/test_field_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from wtforms import validators

from app.data_model.answer_store import AnswerStore
from app.data_models.answer_store import AnswerStore
from app.forms.field_handlers.string_handler import StringHandler
from app.forms.validators import ResponseRequired

Expand Down
4 changes: 2 additions & 2 deletions tests/app/forms/field_handlers/test_number_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from werkzeug.datastructures import MultiDict
from wtforms import Form

from app.data_model.answer import Answer
from app.data_model.answer_store import AnswerStore
from app.data_models.answer import Answer
from app.data_models.answer_store import AnswerStore
from app.forms import error_messages
from app.forms.field_handlers.number_handler import NumberHandler
from app.forms.fields import DecimalFieldWithSeparator, IntegerFieldWithSeparator
Expand Down
2 changes: 1 addition & 1 deletion tests/app/forms/field_handlers/test_text_area_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from wtforms import Form

from app.data_model.answer_store import AnswerStore
from app.data_models.answer_store import AnswerStore
from app.forms.field_handlers import TextAreaHandler
from app.forms.fields import MaxTextAreaField

Expand Down
2 changes: 1 addition & 1 deletion tests/app/forms/test_field_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app.data_model.answer_store import AnswerStore
from app.data_models.answer_store import AnswerStore
from app.forms import error_messages
from app.forms.field_handlers import get_field_handler
from tests.app.app_context_test_case import AppContextTestCase
Expand Down
Loading