Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Christophe Benz
observatoire-dash
Commits
9ecc4857
Commit
9ecc4857
authored
Jan 10, 2020
by
Christophe Benz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add flake8 with plugins, fix errors
parent
28329e45
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
7 deletions
+23
-7
README.md
README.md
+6
-0
app.py
app.py
+3
-3
app_data.py
app_data.py
+0
-4
requirements-dev.txt
requirements-dev.txt
+14
-0
No files found.
README.md
View file @
9ecc4857
...
...
@@ -8,6 +8,12 @@ Inside a virtualenv:
pip
install
-r
requirements.txt
```
While developing, install extra requirements (e.g. formatter, code style checkers...):
```
bash
pip
install
-r
requirements-dev.txt
```
## Run
```
...
...
app.py
View file @
9ecc4857
...
...
@@ -20,7 +20,7 @@ COLORS = [
]
def
none
IfE
mpty
(
val
):
def
none
_if_e
mpty
(
val
):
"""Return None if empty else original value."""
return
None
if
val
==
""
else
val
...
...
@@ -74,7 +74,7 @@ app.layout = html.Div(
)
def
update_dept_dropdown_options
(
reg_code
):
"""Update department list when a region has been chosen."""
return
compute_dept_dropdown_options
(
reg_code
=
none
IfE
mpty
(
reg_code
))
return
compute_dept_dropdown_options
(
reg_code
=
none
_if_e
mpty
(
reg_code
))
@
app
.
callback
(
...
...
@@ -96,7 +96,7 @@ def update_dep_dropdown_value(reg_code):
def
update_type_bar
(
reg_code
,
dep_code
):
"""Update bar chart when one dropdown value changes."""
return
compute_bar_figure
(
reg_code
=
none
IfE
mpty
(
reg_code
),
dep_code
=
none
IfE
mpty
(
dep_code
)
reg_code
=
none
_if_e
mpty
(
reg_code
),
dep_code
=
none
_if_e
mpty
(
dep_code
)
)
...
...
app_data.py
View file @
9ecc4857
...
...
@@ -36,19 +36,15 @@ reg_dep_set = {
}
COLL_TYPES
=
sorted
(
df
[
"type"
].
unique
().
tolist
())
# (reg_code, reg_nom) list
reg_set
=
{(
t
[
0
],
t
[
1
])
for
t
in
reg_dep_set
}
reg_list
=
sorted
(
reg_set
,
key
=
lambda
t
:
unaccentize
(
t
[
1
]))
# (reg_code, dep_code, dep_nom) list
reg_dep_list
=
[(
t
[
0
],
t
[
2
],
t
[
3
])
for
t
in
sorted
(
reg_dep_set
,
key
=
itemgetter
(
2
))]
# { reg_code : list of dep_code }
reg_dep_list_map
:
Dict
[
str
,
List
[
str
]]
=
defaultdict
(
list
)
for
t
in
reg_dep_set
:
reg_dep_list_map
[
t
[
0
]].
append
(
t
[
2
])
# { dep_code: reg_code }
dep_reg_map
=
{
t
[
1
]:
t
[
0
]
for
t
in
reg_dep_list
}
...
...
requirements-dev.txt
View file @
9ecc4857
black
flake8
flake8-black
flake8-blind-except
flake8-breakpoint
flake8-bugbear
flake8-builtins
flake8-comprehensions
flake8-eradicate
flake8-fixme
flake8-isort
flake8-logging-format
flake8-mutable
flake8-print
flake8-rst-docstrings
isort
mypy
pep8-naming
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment