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

Move models to its own package #963

Merged
merged 40 commits into from
Jul 10, 2023
Merged

Move models to its own package #963

merged 40 commits into from
Jul 10, 2023

Conversation

michplunkett
Copy link
Collaborator

@michplunkett michplunkett commented Jul 6, 2023

Fixes issue

#959

Description of Changes

Move models to its own package to prevent circular dependencies and address straggling relative imports.

Tests and linting

  • This branch is up-to-date with the develop branch.
  • pytest passes on my local development environment.
  • pre-commit passes on my local development environment.

@michplunkett michplunkett self-assigned this Jul 6, 2023
@michplunkett michplunkett linked an issue Jul 6, 2023 that may be closed by this pull request
@michplunkett
Copy link
Collaborator Author

Once the linked PR is done, I can submit this one: #944

Comment on lines -619 to -622
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved to prevent a circular import error.

@michplunkett michplunkett changed the title Move models to its own package Move models to its own package Jul 7, 2023
@michplunkett michplunkett marked this pull request as ready for review July 7, 2023 16:09
Comment on lines -99 to +30
BaseConfig.OO_SERVICE_EMAIL
current_app.config["OO_SERVICE_EMAIL"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@abandoned-prototype abandoned-prototype left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Definitely nice how many local imports you could get rid of.
The only thing that stands out to me is the formatting of some commands. Did you run a different command? Maybe you could undo that, or take a quick look and fix the cases where moving a newline made the sentence less readable

OpenOversight/tests/conftest.py Outdated Show resolved Hide resolved
OpenOversight/app/commands.py Outdated Show resolved Hide resolved
@michplunkett
Copy link
Collaborator Author

If anything breached the 88-character limit (the one that we used in Black), I then broke it at the closest point that made sense. I can adjust those so that it doesn't produce the issues you brought up! Thanks for takin' a look and I'll take care of that now!

@@ -62,8 +78,9 @@ def pick_birth_date():


def pick_date(seed: bytes = None, start_year=2000, end_year=2020):
# source: https://stackoverflow.com/questions/40351791/how-to-hash-strings-into-a-float-in-01
# Wanted to deterministically create a date from a seed string (e.g. the hash or uuid on an officer object)
# source: https://stackoverflow.com/q/40351791
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the small link from the Share option, and now we have less link gore:
Screenshot 2023-07-10 at 10 16 04 AM

cc: @abandoned-prototype

Comment on lines -102 to +114
(HTTPStatus.FORBIDDEN, "Forbidden", "403.html"),
(HTTPStatus.NOT_FOUND, "Not found", "404.html"),
(HTTPStatus.REQUEST_ENTITY_TOO_LARGE, "File too large", "413.html"),
(HTTPStatus.TOO_MANY_REQUESTS, "Too many requests", "429.html"),
(HTTPStatus.INTERNAL_SERVER_ERROR, "Internal Server Error", "500.html"),
(HTTPStatus.FORBIDDEN, HTTPStatus.FORBIDDEN.phrase, "403.html"),
(HTTPStatus.NOT_FOUND, HTTPStatus.NOT_FOUND.phrase, "404.html"),
(
HTTPStatus.REQUEST_ENTITY_TOO_LARGE,
HTTPStatus.REQUEST_ENTITY_TOO_LARGE.phrase,
"413.html",
),
(HTTPStatus.TOO_MANY_REQUESTS, HTTPStatus.TOO_MANY_REQUESTS.phrase, "429.html"),
(
HTTPStatus.INTERNAL_SERVER_ERROR,
HTTPStatus.INTERNAL_SERVER_ERROR.phrase,
"500.html",
),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michplunkett michplunkett merged commit 7aaf991 into develop Jul 10, 2023
@michplunkett michplunkett deleted the create_models_package branch July 10, 2023 16:08
sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Sep 6, 2023
lucyparsons#959

Move `models` to its own package to prevent circular dependencies and
address straggling relative imports.

 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.
sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Sep 25, 2023
lucyparsons#959

Move `models` to its own package to prevent circular dependencies and
address straggling relative imports.

 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.
sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Oct 5, 2023
lucyparsons#959

Move `models` to its own package to prevent circular dependencies and
address straggling relative imports.

 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.
AetherUnbound pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Oct 9, 2023
lucyparsons#959

Move `models` to its own package to prevent circular dependencies and
address straggling relative imports.

 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move the models.py file to its own package
2 participants