-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathutilities.py
106 lines (79 loc) · 3.05 KB
/
utilities.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable-msg=line-too-long
"""Module to execute operations related to ISODB data handling"""
import click
import git
import isodbtools
@click.group()
def cli():
# pylint: disable=unnecessary-pass
"""Master for click"""
pass
@cli.command("tester")
def tester_fcn():
"""Test Platform for code reorganization"""
print("in tester function")
print(API_HOST)
print(canonical_keys)
@cli.command("clean_json")
@click.argument("filename", type=click.Path(exists=True), nargs=1)
def clean_json_runner(filename):
"""Run the clean json function"""
isodbtools.clean_json(filename)
@cli.command("download_isotherm")
@click.argument("isotherm", nargs=1)
def download_isotherm_runner(isotherm):
"""Run the download_isotherm function"""
isodbtools.download_isotherm(isotherm)
@cli.command("regenerate_library")
def regenerate_isotherm_library_runner():
"""Run the regenerate_isotherm_library function"""
isodbtools.regenerate_isotherm_library()
@cli.command("regenerate_adsorbents")
def regenerate_adsorbents_runner():
"""Run the regenerate adsorbents function"""
isodbtools.regenerate_adsorbents()
@cli.command("regenerate_adsorbates")
def regenerate_adsorbates_runner():
"""Run the regenerate adsorbates function"""
isodbtools.regenerate_adsorbates()
@cli.command("regenerate_bibliography")
def regenerate_bibliography_runner():
"""Run the regenerate bibliography function"""
isodbtools.regenerate_bibliography()
@cli.command("git_log")
def git_log():
"""parse the git log"""
print("parsing the git log")
repo = git.Repo(SCRIPT_PATH)
commits = list(repo.iter_commits("master", max_count=5))
for commit in commits:
print(commit.message)
@cli.command("post_process")
@click.argument("filename", type=click.Path(exists=True), nargs=1)
def post_process_isotherm_runner(filename):
"""Run the post_process function"""
isodbtools.post_process(filename)
# To Do:
# Post-Process Script:
# Do we want to deal with partial-pressure in the isotherm_data block ?
# (appears in composition area)
# DWS: not inclined to error check this block as it requires expert knowledge to compose
# Handling of new adsorbent materials
# Digitizer should include option to specify new adsorbent metadata
# Handling of new adsorbates
# Digitizer should include option to specify new adsorbate metadata
# Bibliographic entry generator
# collate data from isotherms
# if DOI exists, compare expected data to existing DB entry
# if missing in existing, provide instructions for adding
# if missing in expected, DO NOT add [old data in DB is structured this way]
# copy code from existing notebook for processing student data
@cli.command("generate_bibliography")
@click.argument("folder", type=click.Path(exists=True), nargs=1)
def generate_bibliography_runner(folder):
"""Run the bibliography generator"""
isodbtools.generate_bibliography(folder)
if __name__ == "__main__":
cli() # pylint: disable=no-value-for-parameter