math-spec-mapping 0.3.16__tar.gz → 0.3.17__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {math_spec_mapping-0.3.16/src/math_spec_mapping.egg-info → math_spec_mapping-0.3.17}/PKG-INFO +1 -1
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/pyproject.toml +1 -1
- math_spec_mapping-0.3.17/src/math_spec_mapping/Convenience/__init__.py +8 -0
- math_spec_mapping-0.3.17/src/math_spec_mapping/Convenience/github.py +108 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/markdown.py +6 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/__init__.py +7 -1
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17/src/math_spec_mapping.egg-info}/PKG-INFO +1 -1
- math_spec_mapping-0.3.16/src/math_spec_mapping/Convenience/__init__.py +0 -3
- math_spec_mapping-0.3.16/src/math_spec_mapping/Convenience/github.py +0 -34
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/LICENSE +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/README.md +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/setup.cfg +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/ActionTransmissionChannel.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Block.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/BoundaryAction.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/ControlAction.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Entity.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/MathSpec.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Mechanism.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Metric.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Parameter.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Policy.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Space.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/State.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/StateUpdateTransmissionChannel.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/StatefulMetric.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Type.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/__init__.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Convenience/documentation.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Convenience/starter.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/__init__.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/action_transmission_channel.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/boundary_actions.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/control_actions.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/displays.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/entities.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/general.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/implementations.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/load.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/mechanism.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/metrics.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/parameters.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/policy.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/spaces.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/state_update_transmission_channels.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/stateful_metrics.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/states.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/type.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/wiring.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/__init__.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/boundary_actions.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/control_actions.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/general.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/html.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/mechanisms.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/node_map.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/parameters.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/policies.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/spaces.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/state.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/tables.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/wiring.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/schema.py +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/schema.schema.json +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping.egg-info/SOURCES.txt +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping.egg-info/dependency_links.txt +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping.egg-info/requires.txt +0 -0
- {math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping.egg-info/top_level.txt +0 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
import os
|
2
|
+
import requests
|
3
|
+
from github import Github, Auth
|
4
|
+
import pandas as pd
|
5
|
+
from dotenv import load_dotenv
|
6
|
+
|
7
|
+
|
8
|
+
def write_scaffold_to_github_issues(
|
9
|
+
scaffolder_folder, repo_owner, repository_name, access_token
|
10
|
+
):
|
11
|
+
folders = [
|
12
|
+
x
|
13
|
+
for x in os.listdir(scaffolder_folder)
|
14
|
+
if os.path.isdir(scaffolder_folder + "/" + x)
|
15
|
+
]
|
16
|
+
headers = {
|
17
|
+
"Accept": "application/vnd.github+json",
|
18
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
19
|
+
"Authorization": "Bearer {}".format(access_token),
|
20
|
+
}
|
21
|
+
for folder in folders:
|
22
|
+
issue_name = "Write {} from MSML Scaffold".format(folder)
|
23
|
+
checklist = [
|
24
|
+
x[:-3]
|
25
|
+
for x in os.listdir(scaffolder_folder + "/" + folder)
|
26
|
+
if x.endswith(".md")
|
27
|
+
]
|
28
|
+
checklist = ["- [ ] " + x for x in checklist]
|
29
|
+
checklist = "\n".join(checklist)
|
30
|
+
|
31
|
+
requests.post(
|
32
|
+
"https://api.github.com/repos/{}/{}/issues".format(
|
33
|
+
repo_owner, repository_name
|
34
|
+
),
|
35
|
+
headers=headers,
|
36
|
+
json={"title": issue_name, "body": checklist},
|
37
|
+
)
|
38
|
+
|
39
|
+
|
40
|
+
def find_open_issues():
|
41
|
+
load_dotenv()
|
42
|
+
g = Github(auth=Auth.Token(os.getenv("GITHUB_TOKEN")))
|
43
|
+
repo = g.get_repo("BlockScience/MSML")
|
44
|
+
open_issues = repo.get_issues(state="open")
|
45
|
+
open_issues = list(open_issues)
|
46
|
+
|
47
|
+
df = pd.DataFrame(
|
48
|
+
[[x.title, x.labels, x.html_url, x.milestone] for x in open_issues],
|
49
|
+
columns=["Name", "Labels", "URL", "Milestone"],
|
50
|
+
)
|
51
|
+
df["Milestone"] = df["Milestone"].apply(lambda x: x.title if x else None)
|
52
|
+
df = df.join(
|
53
|
+
df["Labels"]
|
54
|
+
.apply(lambda x: {y.name: True for y in x})
|
55
|
+
.apply(pd.Series)
|
56
|
+
.fillna(False)
|
57
|
+
)
|
58
|
+
|
59
|
+
empty = df[df["Labels"].apply(lambda x: len(x)) == 0]
|
60
|
+
empty = empty[~empty["URL"].str.contains("MSML/pull")]
|
61
|
+
assert len(empty) == 0, "Some issues do not have labels"
|
62
|
+
|
63
|
+
return df, open_issues
|
64
|
+
|
65
|
+
|
66
|
+
def create_priority_label_matrix(df, exclude_milestones=None):
|
67
|
+
if exclude_milestones:
|
68
|
+
df = df[~df["Milestone"].isin(exclude_milestones)]
|
69
|
+
priority_labels = ["High Priority", "Medium Priority", "Low Priority"]
|
70
|
+
labels = list(df.columns[4:])
|
71
|
+
labels = sorted([x for x in labels if x not in priority_labels])
|
72
|
+
|
73
|
+
table = []
|
74
|
+
for label in labels:
|
75
|
+
row = []
|
76
|
+
for priority in priority_labels:
|
77
|
+
row.append(df[(df[priority]) & (df[label])])
|
78
|
+
table.append(row)
|
79
|
+
table = pd.DataFrame(table, index=labels, columns=priority_labels)
|
80
|
+
table = table.applymap(
|
81
|
+
lambda y: "\n".join(
|
82
|
+
y.apply(lambda x: "[{}]({})".format(x["Name"], x["URL"]), axis=1).values
|
83
|
+
)
|
84
|
+
)
|
85
|
+
return table
|
86
|
+
|
87
|
+
|
88
|
+
def create_milestone_label_matrix(df, exclude_milestones=None):
|
89
|
+
if exclude_milestones:
|
90
|
+
df = df[~df["Milestone"].isin(exclude_milestones)]
|
91
|
+
priority_labels = ["High Priority", "Medium Priority", "Low Priority"]
|
92
|
+
labels = list(df.columns[4:])
|
93
|
+
labels = sorted([x for x in labels if x not in priority_labels])
|
94
|
+
milestones = sorted(list(df[~pd.isnull(df["Milestone"])]["Milestone"].unique()))
|
95
|
+
|
96
|
+
table = []
|
97
|
+
for label in labels:
|
98
|
+
row = []
|
99
|
+
for milestone in milestones:
|
100
|
+
row.append(df[(df["Milestone"] == milestone) & (df[label])])
|
101
|
+
table.append(row)
|
102
|
+
table = pd.DataFrame(table, index=labels, columns=milestones)
|
103
|
+
table = table.applymap(
|
104
|
+
lambda y: "\n".join(
|
105
|
+
y.apply(lambda x: "[{}]({})".format(x["Name"], x["URL"]), axis=1).values
|
106
|
+
)
|
107
|
+
)
|
108
|
+
return table
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/markdown.py
RENAMED
@@ -788,6 +788,12 @@ def write_state_variables_markdown_reports(ms, path, state, add_metadata=True):
|
|
788
788
|
out += variable.domain
|
789
789
|
out += "\n\n"
|
790
790
|
|
791
|
+
out += "Updated By:\n"
|
792
|
+
for i, x in enumerate(sorted(variable.updated_by, key=lambda x: x.name)):
|
793
|
+
out += "{}. [[{}]]".format(i + 1, x.name)
|
794
|
+
out += "\n"
|
795
|
+
out += "\n"
|
796
|
+
|
791
797
|
with open(
|
792
798
|
"{}/State Variables/{}.md".format(
|
793
799
|
path, "{}-{}".format(state.name, variable.name)
|
@@ -30,6 +30,12 @@ from .Reports import (
|
|
30
30
|
write_parameter_table_markdown,
|
31
31
|
)
|
32
32
|
from .schema import schema
|
33
|
-
from .Convenience import
|
33
|
+
from .Convenience import (
|
34
|
+
remove_dummy_repo_components,
|
35
|
+
write_scaffold_to_github_issues,
|
36
|
+
find_open_issues,
|
37
|
+
create_priority_label_matrix,
|
38
|
+
create_milestone_label_matrix,
|
39
|
+
)
|
34
40
|
|
35
41
|
# from .Convenience import write_top_level_json_description
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import requests
|
3
|
-
|
4
|
-
|
5
|
-
def write_scaffold_to_github_issues(
|
6
|
-
scaffolder_folder, repo_owner, repository_name, access_token
|
7
|
-
):
|
8
|
-
folders = [
|
9
|
-
x
|
10
|
-
for x in os.listdir(scaffolder_folder)
|
11
|
-
if os.path.isdir(scaffolder_folder + "/" + x)
|
12
|
-
]
|
13
|
-
headers = {
|
14
|
-
"Accept": "application/vnd.github+json",
|
15
|
-
"X-GitHub-Api-Version": "2022-11-28",
|
16
|
-
"Authorization": "Bearer {}".format(access_token),
|
17
|
-
}
|
18
|
-
for folder in folders:
|
19
|
-
issue_name = "Write {} from MSML Scaffold".format(folder)
|
20
|
-
checklist = [
|
21
|
-
x[:-3]
|
22
|
-
for x in os.listdir(scaffolder_folder + "/" + folder)
|
23
|
-
if x.endswith(".md")
|
24
|
-
]
|
25
|
-
checklist = ["- [ ] " + x for x in checklist]
|
26
|
-
checklist = "\n".join(checklist)
|
27
|
-
|
28
|
-
requests.post(
|
29
|
-
"https://api.github.com/repos/{}/{}/issues".format(
|
30
|
-
repo_owner, repository_name
|
31
|
-
),
|
32
|
-
headers=headers,
|
33
|
-
json={"title": issue_name, "body": checklist},
|
34
|
-
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Block.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/ControlAction.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Entity.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/MathSpec.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Mechanism.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Metric.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Parameter.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Policy.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/Space.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/State.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Classes/__init__.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Convenience/starter.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/__init__.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/boundary_actions.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/control_actions.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/displays.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/entities.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/implementations.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/mechanism.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/parameters.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Load/stateful_metrics.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/general.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/mechanisms.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/node_map.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/parameters.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/policies.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/spaces.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/state.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/tables.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/Reports/wiring.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping/schema.schema.json
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping.egg-info/requires.txt
RENAMED
File without changes
|
{math_spec_mapping-0.3.16 → math_spec_mapping-0.3.17}/src/math_spec_mapping.egg-info/top_level.txt
RENAMED
File without changes
|