Skip to content

Commit 23a285c

Browse files
committed
add copyright to java files
Signed-off-by: Michael Robinson <merobi@gmail.com>
1 parent 3fbe2f9 commit 23a285c

280 files changed

Lines changed: 671 additions & 0 deletions

File tree

Some content is hidden

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

add-copyright.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
def add_copyright():
2+
3+
import os
4+
import sys
5+
6+
project = str(sys.argv[1])
7+
file_type = str(sys.argv[2])
8+
print(project)
9+
print(file_type)
10+
11+
# Create an array of paths mirroring structure of current directory
12+
# while ignoring this script and problematic file types
13+
paths = []
14+
for (root, dirs, files) in os.walk('.', topdown=True):
15+
for f in files:
16+
if f == 'add-copyright.py':
17+
continue
18+
elif '.data' in f:
19+
continue
20+
elif '.png' in f:
21+
continue
22+
elif '.jar' in f:
23+
continue
24+
elif '.' not in f:
25+
continue
26+
elif '.pack' in f:
27+
continue
28+
elif '.idx' in f:
29+
continue
30+
else:
31+
path = os.path.join(root, f)
32+
paths.append(path)
33+
# print(paths)
34+
35+
# Iterate through file paths, adding a copyright line to each file
36+
for p in paths:
37+
if '.circleci' in p:
38+
continue
39+
elif '.github' in p:
40+
continue
41+
elif '.gitignore' in p:
42+
continue
43+
else:
44+
if file_type == 'java':
45+
if p[-4:] == 'java':
46+
with open(p, 'r') as t:
47+
contents = t.readlines()
48+
line = f'/* Copyright 2018-2022 contributors to the {project} project */\n\n'
49+
contents.insert(0, line)
50+
with open(p, 'w') as t:
51+
contents = ''.join(contents)
52+
t.write(contents)
53+
elif file_type == 'py':
54+
if p[-2:] == 'py':
55+
with open(p, 'r') as t:
56+
contents = t.readlines()
57+
line = f'# Copyright 2018-2022 contributors to the {project} project\n\n'
58+
contents.insert(0, line)
59+
with open(p, 'w') as t:
60+
contents = ''.join(contents)
61+
t.write(contents)
62+
elif file_type == 'md':
63+
if p[-2:] == 'md':
64+
with open(p, 'r') as t:
65+
contents = t.readlines()
66+
line = f'<!-- Copyright 2018-2022 contributors to the {project} project -->\n\n'
67+
contents.insert(0, line)
68+
with open(p, 'w') as t:
69+
contents = ''.join(contents)
70+
t.write(contents)
71+
elif file_type == 'html':
72+
if p[-2:] == 'html':
73+
with open(p, 'r') as t:
74+
contents = t.readlines()
75+
line = f'<!-- Copyright 2018-2022 contributors to the {project} project -->\n\n'
76+
contents.insert(0, line)
77+
with open(p, 'w') as t:
78+
contents = ''.join(contents)
79+
t.write(contents)
80+
elif file_type == 'txt':
81+
if p[-3:] == 'txt':
82+
with open(p, 'r') as t:
83+
contents = t.readlines()
84+
line = f'Copyright 2018-2022 contributors to the {project} project\n\n'
85+
contents.insert(0, line)
86+
with open(p, 'w') as t:
87+
contents = ''.join(contents)
88+
t.write(contents)
89+
elif file_type == 'rs':
90+
if p[-2:] == 'rs':
91+
with open(p, 'r') as t:
92+
contents = t.readlines()
93+
line = f'// Copyright 2018-2022 contributors to the {project} project\n\n'
94+
contents.insert(0, line)
95+
with open(p, 'w') as t:
96+
contents = ''.join(contents)
97+
t.write(contents)
98+
elif file_type == 'sh':
99+
if p[-2:] == 'sh':
100+
with open(p, 'a') as t:
101+
line = f'\n# Copyright 2018-2022 contributors to the {project} project'
102+
t.write(line)
103+
elif file_type == 'ts':
104+
if p[-2:] == 'ts':
105+
with open(p, 'r') as t:
106+
contents = t.readlines()
107+
line = f'// Copyright 2018-2022 contributors to the {project} project\n\n'
108+
contents.insert(0, line)
109+
with open(p, 'w') as t:
110+
contents = ''.join(contents)
111+
t.write(contents)
112+
113+
add_copyright()

api/src/main/java/marquez/MarquezApp.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez;

api/src/main/java/marquez/MarquezConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez;

api/src/main/java/marquez/MarquezContext.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez;

api/src/main/java/marquez/api/BaseResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez.api;

api/src/main/java/marquez/api/DatasetResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez.api;

api/src/main/java/marquez/api/JobResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez.api;

api/src/main/java/marquez/api/NamespaceResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez.api;

api/src/main/java/marquez/api/OpenLineageResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez.api;

api/src/main/java/marquez/api/RunResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Copyright 2018-2022 contributors to the Marquez project */
2+
13
/* SPDX-License-Identifier: Apache-2.0 */
24

35
package marquez.api;

0 commit comments

Comments
 (0)