Skip to content

Commit cd75c51

Browse files
committed
looooads of pre-commit fixes
1 parent 3ccb9ec commit cd75c51

File tree

103 files changed

+4070
-2721
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+4070
-2721
lines changed

Diff for: .dockerignore

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
1-
.git
2-
mpcontribs-ingester
3-
docs
1+
.git*
42
*.pyc
53
*.egg-info
4+
__pycache__
65
.ipynb_checkpoints
6+
.local
7+
.ipython
8+
.jupyter
9+
.DS_Store
10+
.dependabot
11+
.cache
12+
.tox
13+
14+
./cloudformation
15+
./src
16+
17+
docs
718
build
819
dist
920
static
1021
node_modules
22+
1123
mpcontribs-api/flasgger
1224
mpcontribs-api/flask-mongorest
1325
mpcontribs-api/marshmallow-mongoengine
26+
mpcontribs-api/mimerender
27+
mpcontribs-api/mpcontribs/api/swagger
28+
29+
mpcontribs-portal/mpcontribs/users/qmcdb
30+
mpcontribs-portal/mpcontribs/portal/templates/notebooks

Diff for: .github/workflows/mpcontribs-client-tox.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
python -m pip install --upgrade pip
2222
pip install tox tox-gh-actions
2323
- name: Test with tox
24-
run: tox
24+
run: cd mpcontribs-client && tox

Diff for: .github/workflows/mpcontribs-testing.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: MPContribs Testing
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches-ignore:
5+
- '**'
36
jobs:
47
test:
58
runs-on: ubuntu-latest

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.tox
12
.mypy_cache
23
__pycache__
34
*.swp

Diff for: .pre-commit-config.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
exclude: |
2+
(?x)(
3+
^mpcontribs-portal/mpcontribs/users/|
4+
^binder/|
5+
^mpcontribs-ingester/|
6+
^mpcontribs-api/mpcontribs/api/redox_thermo_csp/
7+
)
8+
9+
repos:
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v2.3.0
12+
hooks:
13+
- id: end-of-file-fixer
14+
- id: trailing-whitespace
15+
- id: check-added-large-files
16+
- id: check-merge-conflict
17+
- id: fix-encoding-pragma
18+
- id: forbid-new-submodules
19+
- id: requirements-txt-fixer
20+
21+
#- repo: https://gitlab.com/pycqa/flake8
22+
# rev: 3.7.9
23+
# hooks:
24+
# - id: flake8
25+
# args: [--max-line-length=99]
26+
27+
- repo: https://github.com/ambv/black
28+
rev: stable
29+
hooks:
30+
- id: black
31+
language_version: python3.7

Diff for: README.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/materialsproject/MPContribs?style=flat-square)
21
![LGTM Alerts](https://img.shields.io/lgtm/alerts/github/materialsproject/MPContribs?style=flat-square)
32
![Website](https://img.shields.io/website?down_color=red&down_message=down&label=API&style=flat-square&up_color=green&up_message=up&url=https%3A%2F%2Fapi.mpcontribs.org)
43
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/materialsproject/MPContribs?style=flat-square)

Diff for: binder/jupyterhub_config.py

+47-34
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,89 @@
11
import os
22
from jhub_remote_user_authenticator.remote_user_auth import RemoteUserLocalAuthenticator
3-
from fargatespawner import FargateSpawner#, FargateSpawnerECSRoleAuthentication
3+
from fargatespawner import FargateSpawner # , FargateSpawnerECSRoleAuthentication
44
from fargatespawner import FargateSpawnerSecretAccessKeyAuthentication
55

6-
RemoteUserLocalAuthenticator.header_name = 'X-Consumer-Username'
6+
RemoteUserLocalAuthenticator.header_name = "X-Consumer-Username"
77
c.JupyterHub.authenticator_class = RemoteUserLocalAuthenticator
8-
c.Authenticator.username_pattern = '^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$'
8+
c.Authenticator.username_pattern = "^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$"
99
c.Authenticator.create_system_users = True
10-
c.Authenticator.add_user_cmd = ['adduser', '-q', '--gecos', '""', '--disabled-password', '--force-badname']
10+
c.Authenticator.add_user_cmd = [
11+
"adduser",
12+
"-q",
13+
"--gecos",
14+
'""',
15+
"--disabled-password",
16+
"--force-badname",
17+
]
1118
c.Authenticator.whitelist = whitelist = set()
12-
c.Authenticator.admin_users = admin = {'[email protected]'}
19+
c.Authenticator.admin_users = admin = {"[email protected]"}
1320

14-
NODE_ENV = os.environ.get('NODE_ENV')
21+
NODE_ENV = os.environ.get("NODE_ENV")
1522

16-
if NODE_ENV == 'development':
23+
if NODE_ENV == "development":
1724
c.NotebookApp.open_browser = False
18-
c.JupyterHub.hub_ip = 'jhub'
25+
c.JupyterHub.hub_ip = "jhub"
1926

20-
#c.JupyterHub.spawner_class = 'simplespawner.SimpleLocalProcessSpawner'
21-
#c.Spawner.args = ['--allow-root']
22-
c.JupyterHub.spawner_class = 'repo2dockerspawner.Repo2DockerSpawner'
23-
c.Repo2DockerSpawner.repo = 'https://github.com/materialsproject/MPContribs'
27+
# c.JupyterHub.spawner_class = 'simplespawner.SimpleLocalProcessSpawner'
28+
# c.Spawner.args = ['--allow-root']
29+
c.JupyterHub.spawner_class = "repo2dockerspawner.Repo2DockerSpawner"
30+
c.Repo2DockerSpawner.repo = "https://github.com/materialsproject/MPContribs"
2431
c.DockerSpawner.http_timeout = 10 * 60
25-
network_name = os.environ['DOCKER_NETWORK_NAME']
32+
network_name = os.environ["DOCKER_NETWORK_NAME"]
2633
c.DockerSpawner.use_internal_ip = True
2734
c.DockerSpawner.network_name = network_name
28-
c.DockerSpawner.extra_host_config = {'network_mode': network_name}
29-
notebook_dir = os.environ.get('DOCKER_NOTEBOOK_DIR') or '/home/jovyan/work'
35+
c.DockerSpawner.extra_host_config = {"network_mode": network_name}
36+
notebook_dir = os.environ.get("DOCKER_NOTEBOOK_DIR") or "/home/jovyan/work"
3037
c.DockerSpawner.notebook_dir = notebook_dir
31-
c.DockerSpawner.volumes = {'mpcontribs_data-volume': notebook_dir}
38+
c.DockerSpawner.volumes = {"mpcontribs_data-volume": notebook_dir}
3239
c.DockerSpawner.remove_containers = True
3340
c.DockerSpawner.debug = True
3441
c.DockerSpawner.host_ip = "0.0.0.0"
35-
c.Spawner.env_keep.extend(['NODE_ENV', 'MAPI_KEY'])
36-
#c.JupyterHub.services = [
42+
c.Spawner.env_keep.extend(["NODE_ENV", "MAPI_KEY"])
43+
# c.JupyterHub.services = [
3744
# {
3845
# 'name': 'cull_idle',
3946
# 'admin': True,
4047
# 'command': 'python /srv/jupyterhub/cull_idle_servers.py --timeout=3600'.split(),
4148
# },
42-
#]
49+
# ]
4350
else:
4451
c.JupyterHub.spawner_class = FargateSpawner
45-
c.FargateSpawner.aws_region = 'us-east-1'
46-
c.FargateSpawner.aws_ecs_host = 'ecs.us-east-1.amazonaws.com'
47-
c.FargateSpawner.task_role_arn = os.environ['TASK_ROLE_ARN']
48-
c.FargateSpawner.task_cluster_name = os.environ['TASK_CLUSTER_NAME']
49-
c.FargateSpawner.task_container_name = 'singleuser'
50-
c.FargateSpawner.task_definition_arn = os.environ['TASK_DEFINITION_ARN']
51-
c.FargateSpawner.task_security_groups = os.environ['TASK_SECURITY_GROUPS'].split(',')
52-
c.FargateSpawner.task_subnets = os.environ['TASK_SUBNETS'].split(',')
52+
c.FargateSpawner.aws_region = "us-east-1"
53+
c.FargateSpawner.aws_ecs_host = "ecs.us-east-1.amazonaws.com"
54+
c.FargateSpawner.task_role_arn = os.environ["TASK_ROLE_ARN"]
55+
c.FargateSpawner.task_cluster_name = os.environ["TASK_CLUSTER_NAME"]
56+
c.FargateSpawner.task_container_name = "singleuser"
57+
c.FargateSpawner.task_definition_arn = os.environ["TASK_DEFINITION_ARN"]
58+
c.FargateSpawner.task_security_groups = os.environ["TASK_SECURITY_GROUPS"].split(
59+
","
60+
)
61+
c.FargateSpawner.task_subnets = os.environ["TASK_SUBNETS"].split(",")
5362
c.FargateSpawner.debug = True
5463
c.FargateSpawner.notebook_port = 8888
55-
c.FargateSpawner.notebook_scheme = 'http'
64+
c.FargateSpawner.notebook_scheme = "http"
5665
c.FargateSpawner.notebook_args = []
57-
#c.FargateSpawner.authentication_class = FargateSpawnerECSRoleAuthentication
66+
# c.FargateSpawner.authentication_class = FargateSpawnerECSRoleAuthentication
5867
c.FargateSpawner.authentication_class = FargateSpawnerSecretAccessKeyAuthentication
59-
c.FargateSpawnerSecretAccessKeyAuthentication.aws_access_key_id = os.environ['AWS_ACCESS_KEY_ID']
60-
c.FargateSpawnerSecretAccessKeyAuthentication.aws_secret_access_key = os.environ['AWS_SECRET_ACCESS_KEY']
68+
c.FargateSpawnerSecretAccessKeyAuthentication.aws_access_key_id = os.environ[
69+
"AWS_ACCESS_KEY_ID"
70+
]
71+
c.FargateSpawnerSecretAccessKeyAuthentication.aws_secret_access_key = os.environ[
72+
"AWS_SECRET_ACCESS_KEY"
73+
]
6174

6275
c.JupyterHub.admin_access = True
63-
c.JupyterHub.default_url = '/hub/home'
76+
c.JupyterHub.default_url = "/hub/home"
6477
c.JupyterHub.cleanup_proxy = False
6578
c.JupyterHub.cleanup_servers = False
6679
c.JupyterHub.active_server_limit = 10
6780
c.JupyterHub.concurrent_spawn_limit = 5
68-
#c.JupyterHub.db_url = 'sqlite:///jupyterhub.sqlite' # TODO https://github.com/uktrade/jupyters3
81+
# c.JupyterHub.db_url = 'sqlite:///jupyterhub.sqlite' # TODO https://github.com/uktrade/jupyters3
6982
c.JupyterHub.shutdown_on_logout = True
7083
c.JupyterHub.upgrade_db = True
7184

7285
c.Spawner.consecutive_failure_limit = 3
7386
c.Spawner.cpu_limit = 0.25
7487
c.Spawner.debug = True
75-
c.Spawner.mem_limit = '512M'
88+
c.Spawner.mem_limit = "512M"
7689
c.Spawner.start_timeout = 300

Diff for: binder/notebooks/convert.sh

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/bin/bash
22

3-
out=/app/mpcontribs/portal/templates/notebooks/
4-
[[ -d $out ]] && rm -rv $out && mkdir -pv $out
3+
if [ "$#" -ne 2 ]; then
4+
echo "Usage: $0 INDIR OUTDIR"
5+
exit 1
6+
fi
57

6-
for d in `ls -1d /app/notebooks/*/`; do
8+
indir=$1
9+
[[ ! -d $indir ]] && echo "$indir does not exist!" && exit 1
10+
outdir=$2
11+
[[ -d $outdir ]] && rm -rv $outdir && mkdir -pv $outdir
12+
13+
for d in `ls -1d $indir/*/`; do
714
name=`basename $d`
815
for i in `ls -1 $d*.ipynb`; do
916
echo $i
10-
/venv/bin/jupyter nbconvert --to html --template basic --output-dir=$out$name $i
17+
jupyter nbconvert --to html --template basic --output-dir=$outdir$name $i
1118
done
1219
done

Diff for: binder/notebooks/portal.mpcontribs.org/Fe3O4.cif

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#\#CIF1.1
22
##########################################################################
3-
# Crystallographic Information Format file
3+
# Crystallographic Information Format file
44
# Produced by PyCifRW module
5-
#
5+
#
66
# This is a CIF file. CIF has been adopted by the International
7-
# Union of Crystallography as the standard for data archiving and
7+
# Union of Crystallography as the standard for data archiving and
88
# transmission.
99
#
1010
# For information on this file format, follow the CIF links at
@@ -29,7 +29,7 @@ loop_
2929
_symmetry_equiv_pos_site_id
3030
_symmetry_equiv_pos_as_xyz
3131
1 'x, y, z'
32-
32+
3333
loop_
3434
_atom_site_type_symbol
3535
_atom_site_label
@@ -54,4 +54,3 @@ loop_
5454
Fe Fe12 1 0.132170 0.264340 0.924770 0 . 1
5555
Fe Fe13 1 0.617925 0.235849 0.250000 0 . 1
5656
Fe Fe14 1 0.382075 0.764150 0.750000 0 . 1
57-

Diff for: docs/portal.md

-2
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,3 @@ how to interact with a contribution programmatically along with the resulting ou
7979
navigation bar at the top provides links to jump to a respective component, toggle buttons
8080
to show/hide components, and a download button to retrieve the contribution in JSON
8181
format.
82-
83-

Diff for: docs/redox_thermo_csp/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ perovskites may be used for two-step thermochemical oxygen storage, pumping, or
1919
separation. Moreover, some of them can be used for water splitting or CO<sub>2</sub>
2020
splitting, allowing the generation of solar fuels. Our approach is based upon creating
2121
**solid solutions of perovskites** to tune their thermodynamic properties. These solid
22-
solutions, denoted by
22+
solutions, denoted by
2323

2424
(A</sup>'</sup><sub>x</sub>A</sup>''</sup><sub>1-x</sub>)<sup>(6-n)+</sup>(M</sup>'</sup><sub>y</sub>M</sup>''</sup><sub>1-y</sub>)<sup>(n-2δ)+</sup>O<sub>3-δ</sub>
2525

Diff for: mkdocs.yml

-1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,3 @@ extra:
5656
link: 'https://twitter.com/persson_group'
5757
- type: 'linkedin'
5858
link: 'https://linkedin.com/in/tschaume'
59-

0 commit comments

Comments
 (0)