Skip to content

Commit f319a14

Browse files
committed
add docs
1 parent b91d977 commit f319a14

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,7 @@ dataset_1.pkl
109109
ex.pickle
110110

111111
.VSCodeCounter/
112+
113+
model_save_json.txt
114+
115+
model_save_pkl.pkl

forms/Corporate CLA.pdf

214 KB
Binary file not shown.

forms/Individual CLA.pdf

150 KB
Binary file not shown.

license.pdf

92.4 KB
Binary file not shown.

scripts/test_copyright.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright © 2021 United States Government as represented by the Administrator of the
2+
# National Aeronautics and Space Administration. All Rights Reserved.
3+
4+
import os
5+
COPYRIGHT_TAG = "Copyright © 2021 United States Government as represented by the Administrator" # String to check file lines for
6+
7+
def check_copyright(directory: str, invalid_files: list) -> bool:
8+
result = True
9+
10+
for filename in os.listdir(directory):
11+
path = os.path.join(directory, filename)
12+
13+
# If path is subdirectory, recursively check files/subdirectories within
14+
if os.path.isdir(path):
15+
result = result and check_copyright(path, invalid_files)
16+
# If path is a file, ensure it is of type py and check for copyright
17+
elif os.path.isfile(path) and path.split(".")[-1] in ("py", "pyw", "py3"):
18+
file = open(path, 'r')
19+
copyright_met = False
20+
# Iterate over lines in file, check each line against COPYRIGHT_TAG
21+
for line in file:
22+
if COPYRIGHT_TAG in line:
23+
# File contains copyright, skip rest of lines
24+
file.close()
25+
copyright_met = True
26+
if copyright_met:
27+
break
28+
if not copyright_met:
29+
result = False
30+
invalid_files.append(path)
31+
file.close()
32+
33+
return result
34+
35+
def main():
36+
print("\n\nTesting Files for Copyright Information")
37+
38+
root = '../prog_models'
39+
invalid_files = []
40+
copyright_confirmed = check_copyright(root, invalid_files)
41+
42+
if not copyright_confirmed:
43+
raise Exception(f"Failed test\nFiles missing copyright information: {invalid_files}")
44+
45+
if __name__ == '__main__':
46+
main()

0 commit comments

Comments
 (0)