Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#!python
#cython: language_level = 3, cdivision = True, nonecheck = False
#distutils: language = c++
Expand All @@ -14,6 +13,7 @@
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

from libcpp.vector cimport vector

# Numeric layout --------------------------------------------------------------
Expand Down
16 changes: 12 additions & 4 deletions tools/verify_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Utility script to verify qiskit copyright file headers"""

import argparse
import multiprocessing
import os
Expand All @@ -22,6 +24,7 @@


def discover_files(code_paths):
"""Find all .py, .pyx, .pxd files in a list of trees"""
out_paths = []
for path in code_paths:
if os.path.isfile(path):
Expand All @@ -30,12 +33,17 @@ def discover_files(code_paths):
for directory in os.walk(path):
dir_path = directory[0]
for subfile in directory[2]:
if subfile.endswith(".py") or subfile.endswith(".pyx"):
if (
subfile.endswith(".py")
or subfile.endswith(".pyx")
or subfile.endswith(".pxd")
):
out_paths.append(os.path.join(dir_path, subfile))
return out_paths


def validate_header(file_path):
"""Validate the header for a single file"""
header = """# This code is part of Qiskit.
#
"""
Expand Down Expand Up @@ -70,7 +78,7 @@ def validate_header(file_path):
return (file_path, True, None)


def main():
def _main():
default_path = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "qiskit"
)
Expand All @@ -80,7 +88,7 @@ def main():
type=str,
nargs="*",
default=[default_path],
help="Paths to scan by default uses ../qiskit from the" " script",
help="Paths to scan by default uses ../qiskit from the script",
)
args = parser.parse_args()
files = discover_files(args.paths)
Expand All @@ -96,4 +104,4 @@ def main():


if __name__ == "__main__":
main()
_main()