Skip to content

Commit

Permalink
Merge pull request #1084 from hackforla/mattyweb/issue1083
Browse files Browse the repository at this point in the history
Add auto-formatting, import reodering and pre-commit to dash project
  • Loading branch information
mattyweb authored Apr 12, 2021
2 parents b0717ad + 3c631d7 commit 456d037
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 85 deletions.
20 changes: 20 additions & 0 deletions server/dash/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.4.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: 'v1.5.6' # Use the sha / tag you want to point at
hooks:
- id: autopep8
- repo: https://github.com/pycqa/flake8
rev: 'v3.9.0' # pick a git hash / tag to point to
hooks:
- id: flake8
3 changes: 3 additions & 0 deletions server/dash/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
autopep8 = "*"
reorder-python-imports = "*"
pre-commit = "*"

[packages]
dash = "*"
Expand Down
290 changes: 233 additions & 57 deletions server/dash/Pipfile.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions server/dash/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import urllib
import json
import pandas as pd
import urllib

import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd


external_stylesheets = ['/static/reports.css']
Expand Down
13 changes: 9 additions & 4 deletions server/dash/dashboards/neighborhood.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import textwrap
import pandas as pd
import plotly.express as px

import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
import plotly.express as px
from dash.dependencies import Input
from dash.dependencies import Output

from app import app
from design import CONFIG_OPTIONS, DISCRETE_COLORS, LABELS, apply_figure_style
from config import API_HOST
from design import apply_figure_style
from design import CONFIG_OPTIONS
from design import DISCRETE_COLORS
from design import LABELS


# TITLE
Expand Down
15 changes: 10 additions & 5 deletions server/dash/dashboards/neighborhood_recent.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import datetime
import textwrap
import pandas as pd

import dash_table
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_table
import pandas as pd
import plotly.express as px
from dash.dependencies import Input
from dash.dependencies import Output
from flask import request

from app import app, batch_get_data
from app import app
from app import batch_get_data
from config import API_HOST
from design import CONFIG_OPTIONS, DISCRETE_COLORS, LABELS, apply_figure_style
from design import apply_figure_style
from design import CONFIG_OPTIONS
from design import DISCRETE_COLORS
from design import LABELS


pretty_columns = {
Expand Down
10 changes: 7 additions & 3 deletions server/dash/dashboards/overview.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import textwrap

import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import dash_core_components as dcc
import dash_html_components as html

from config import API_HOST
from design import CONFIG_OPTIONS, DISCRETE_COLORS, LABELS, apply_figure_style
from design import apply_figure_style
from design import CONFIG_OPTIONS
from design import DISCRETE_COLORS
from design import LABELS


# TITLE
Expand Down
9 changes: 6 additions & 3 deletions server/dash/dashboards/recent.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import datetime
import textwrap

import pandas as pd
import plotly.express as px
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.express as px

from design import CONFIG_OPTIONS, DISCRETE_COLORS, LABELS, apply_figure_style
from config import API_HOST
from design import apply_figure_style
from design import CONFIG_OPTIONS
from design import DISCRETE_COLORS
from design import LABELS


# TITLE
Expand Down
16 changes: 10 additions & 6 deletions server/dash/dashboards/types_map.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
from urllib.request import urlopen
import json
import datetime
import pandas as pd
import plotly.express as px
import json
from urllib.request import urlopen

import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
import plotly.express as px
from dash.dependencies import Input
from dash.dependencies import Output

from app import app
from config import API_HOST
from design import CONFIG_OPTIONS, LABELS, apply_figure_style
from design import apply_figure_style
from design import CONFIG_OPTIONS
from design import LABELS


# TITLE
Expand Down
12 changes: 7 additions & 5 deletions server/dash/index.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import os
import signal
import re
import glob
import importlib
import logging
import os
import re
import signal

import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from dash.dependencies import Input
from dash.dependencies import Output

from app import app
from config import PRELOAD, DASH_FILES
from config import DASH_FILES
from config import PRELOAD


server = app.server
Expand Down

0 comments on commit 456d037

Please sign in to comment.