Skip to content

Commit c05bdfb

Browse files
authored
[script] fix license format for py files (#103)
1 parent efd1230 commit c05bdfb

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

python/gc_mlir/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#===-- __init__.py - DESC -------------------------------------*- Python -*-===#
2-
#
1+
# ===-- __init__.py - init ------------------------------------*- Python -*-===#
2+
#
33
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
44
# See https://llvm.org/LICENSE.txt for license information.
55
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
#
7-
#===------------------------------------------------------------------------===#
6+
#
7+
# ===-----------------------------------------------------------------------===#

python/gc_mlir/_mlir_libs/_site_initialize_0.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#===-- _site_initialize_0.py - DESC ---------------------------*- Python -*-===#
2-
#
1+
# ===-- _site_initialize_0.py - For site init -----------------*- Python -*-===#
2+
#
33
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
44
# See https://llvm.org/LICENSE.txt for license information.
55
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
#
7-
#===------------------------------------------------------------------------===#
6+
#
7+
# ===-----------------------------------------------------------------------===#
88

99

1010
def context_init_hook(context):

python/gc_mlir/dialects/OneDNNGraphOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- OneDNNGraphOps.td - DESC ---------------------------*- tablegen -*-===//
1+
//===-- OneDNNGraphOps.td - Entry point for bindings -------*- tablegen -*-===//
22
//
33
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

python/gc_mlir/dialects/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#===-- __init__.py - DESC -------------------------------------*- Python -*-===#
2-
#
1+
# ===-- __init__.py - init ------------------------------------*- Python -*-===#
2+
#
33
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
44
# See https://llvm.org/LICENSE.txt for license information.
55
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
#
7-
#===------------------------------------------------------------------------===#
6+
#
7+
# ===-----------------------------------------------------------------------===#
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#===-- onednn_graph.py - DESC ---------------------------------*- Python -*-===#
2-
#
1+
# ===-- onednn_graph.py - MLIR Python source -----------------*- Python -*-===#
2+
#
33
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
44
# See https://llvm.org/LICENSE.txt for license information.
55
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
#
7-
#===------------------------------------------------------------------------===#
6+
#
7+
# ===-----------------------------------------------------------------------===#
88

99
from ._onednn_graph_ops_gen import *
10-
from .._mlir_libs._gc_mlir.onednn_graph import *
10+
from .._mlir_libs._gc_mlir.onednn_graph import *

scripts/license.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Copyright (C) 2024 Intel Corporation
2-
#
2+
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
6-
#
6+
#
77
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
8+
#
99
# Unless required by applicable law or agreed to in writing,
1010
# software distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions
1313
# and limitations under the License.
14-
#
14+
#
1515
# SPDX-License-Identifier: Apache-2.0
1616

1717
import datetime, sys, re, argparse
@@ -73,7 +73,7 @@ def fix_intel_license(var: Dict[str, str]):
7373
cmt = "#"
7474
print('%s Copyright (C) %s Intel Corporation' % (cmt, var['$YEAR']))
7575
for i in range(1, len(intel_license)):
76-
print('%s %s' % (cmt, intel_license[i]))
76+
print((cmt + " " + intel_license[i]).rstrip())
7777
if var['$LANG'] == "C\\+\\+":
7878
print(" */")
7979
elif lang == "cmake" or lang == "Python":
@@ -87,27 +87,27 @@ def fix_llvm_license(var: Dict[str, str]):
8787
elif lang == "C\\+\\+":
8888
lang = "C++"
8989

90-
part1 = "%s===-- %s - DESC " % (cmt, var['$FILE'])
90+
part1 = "%s===-- %s - DESC " % ((cmt + " " if lang == "Python" else cmt), var['$FILE'])
9191
part3 = "-*- %s -*-===%s" % (lang, cmt)
9292
part2 = "-" * (WIDTH - len(part1) - len(part3))
9393

9494
print(part1 + part2 + part3)
9595
for i in range(1, len(llvm_license) - 1):
9696
print((cmt + " " + llvm_license[i]).rstrip())
97-
part1 = cmt + "==="
97+
part1 = (cmt + " " if lang == "Python" else cmt) + "==="
9898
part3 = "===" + cmt
9999
part2 = "-" * (WIDTH - len(part1) - len(part3))
100100
print(part1 + part2 + part3)
101-
101+
102102
def use_llvm_license(path: str) -> bool:
103103
for folder in ["lib/gc/", 'include/gc/', 'unittests/', 'python/gc_mlir']:
104104
if path.startswith(folder) or path.startswith('./' + folder):
105105
return True
106106
return False
107-
107+
108108
year: int = datetime.datetime.now().year
109109
success: bool = True
110-
110+
111111
parser = argparse.ArgumentParser(prog = "benchgc license checker")
112112
parser.add_argument("--files", required=True, type = str, help = "comma seperated file list")
113113
args = parser.parse_args()
@@ -160,5 +160,5 @@ def use_llvm_license(path: str) -> bool:
160160
fix_intel_license(var)
161161
else:
162162
print("Success : %s" % filepath)
163-
163+
164164
sys.exit(0 if success else 1)

0 commit comments

Comments
 (0)