Skip to content

Commit a45a426

Browse files
committed
[python] Use PEP-0008 compliant code headers
Running the Python style guide checker [`pep8`](https://pypi.python.org/pypi/pep8) on the Python code headers in this repository results in the following error being emitted: $ pep8 utils/build-script utils/build-script:1:1: E265 block comment should start with '# ' utils/build-script:3:1: E266 too many leading '#' for block comment utils/build-script:5:1: E266 too many leading '#' for block comment utils/build-script:6:1: E266 too many leading '#' for block comment utils/build-script:8:1: E266 too many leading '#' for block comment utils/build-script:9:1: E266 too many leading '#' for block comment utils/build-script:11:1: E265 block comment should start with '# ' utils/build-script:11:80: E501 line too long (80 > 79 characters) The problem is that the code header used in most Python files in the repository: 1. Do not place a space in between `#` and the rest of the comment. 2. Contains some lines that just barely exceed the recommend length limit. In addition, not all code headers in the repository follow the same template. This commit moves all Python code headers to the following template: # subfolder/file_name.py - Very brief description -*- python -*-- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See http://swift.org/LICENSE.txt for license information # See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors # # ----------------------------------------------------------------------------- # # This file contains stuff that I am describing here in the header and will # be sure to keep up to date. # # ----------------------------------------------------------------------------
1 parent 4a9a6a2 commit a45a426

File tree

11 files changed

+49
-57
lines changed

11 files changed

+49
-57
lines changed

stdlib/public/common/MirrorCommon.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
#//===--- MirrorCommon.py -------------------------------------*- python -*-===//
2-
#//
3-
#// This source file is part of the Swift.org open source project
4-
#//
5-
#// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
6-
#// Licensed under Apache License v2.0 with Runtime Library Exception
7-
#//
8-
#// See http://swift.org/LICENSE.txt for license information
9-
#// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10-
#//
11-
#//===----------------------------------------------------------------------===//
1+
# MirrorCommon.py -*- python -*-
2+
#
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See http://swift.org/LICENSE.txt for license information
9+
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
#
11+
# -----------------------------------------------------------------------------
12+
#
1213
# This file contains utility functions that are used by the gyb template files
1314
# that generate Mirrors for the Swift Standard Library.
1415
# If you edit this, make sure to also accordingly tweak the actual template files.
16+
#
17+
# -----------------------------------------------------------------------------
1518

1619
def getDisposition(disp=None):
1720
if disp is None:

test/Unit/lit.cfg

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
# -*- Python -*-
2-
3-
# Configuration file for the 'lit' test runner.
1+
# test/Unit/lit.cfg - Configuration for the 'lit' test runner. -*- python -*-
2+
#
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See http://swift.org/LICENSE.txt for license information
9+
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
410

511
import os
612

test/lit.cfg

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
##===--- lit.cfg ---------------------------------------------*- Python -*-===##
2-
##
3-
## This source file is part of the Swift.org open source project
4-
##
5-
## Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
6-
## Licensed under Apache License v2.0 with Runtime Library Exception
7-
##
8-
## See http://swift.org/LICENSE.txt for license information
9-
## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10-
##
11-
##===----------------------------------------------------------------------===##
1+
# swift/test/lit.cfg - Configuration for the 'lit' test runner -*- python -*-
2+
#
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See http://swift.org/LICENSE.txt for license information
9+
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
#
11+
# -----------------------------------------------------------------------------
1212
#
1313
# This is a configuration file for the 'lit' test runner.
1414
#
1515
# Refer to docs/Testing.rst for documentation.
1616
#
1717
# Update docs/Testing.rst when changing this file.
1818
#
19-
##===----------------------------------------------------------------------===##
19+
# -----------------------------------------------------------------------------
2020

2121
import os
2222
import platform

tools/SourceKit/bindings/python/sourcekitd/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#===- __init__.py - sourcekitd Python Bindings ---------------*- python -*--===#
1+
# __init__.py - sourcekitd Python Bindings -*- python -*-
22
#
33
# This source file is part of the Swift.org open source project
44
#
@@ -7,8 +7,6 @@
77
#
88
# See http://swift.org/LICENSE.txt for license information
99
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10-
#
11-
#===------------------------------------------------------------------------===#
1210

1311
r"""
1412
sourcekitd framework bindings

tools/SourceKit/bindings/python/sourcekitd/capi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#===- capi.py - sourcekitd Python Bindings -------------------*- python -*--===#
1+
# capi.py - sourcekitd Python Bindings -*- python -*-
22
#
33
# This source file is part of the Swift.org open source project
44
#
@@ -7,8 +7,6 @@
77
#
88
# See http://swift.org/LICENSE.txt for license information
99
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10-
#
11-
#===------------------------------------------------------------------------===#
1210

1311
from ctypes import (
1412
CFUNCTYPE,

tools/SourceKit/bindings/python/sourcekitd/request.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#===- request.py - sourcekitd Python Bindings ----------------*- python -*--===#
1+
# request.py - sourcekitd Python Bindings -*- python -*-
22
#
33
# This source file is part of the Swift.org open source project
44
#
@@ -7,8 +7,6 @@
77
#
88
# See http://swift.org/LICENSE.txt for license information
99
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10-
#
11-
#===------------------------------------------------------------------------===#
1210

1311
import capi
1412

utils/SwiftBuildSupport.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#===--- SwiftBuildSupport.py - Utilities for Swift build scripts -----------===#
1+
# utils/SwiftBuildSupport.py - Utilities for Swift build scripts -*- python -*-
22
#
33
# This source file is part of the Swift.org open source project
44
#
@@ -7,8 +7,6 @@
77
#
88
# See http://swift.org/LICENSE.txt for license information
99
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10-
#
11-
#===------------------------------------------------------------------------===#
1210

1311
from __future__ import print_function
1412

utils/apply-fixit-edits.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
2-
3-
#===--- apply-fixit-edits.py - Tool for applying edits from .remap files ---===#
2+
# utils/apply-fixit-edits.py - Apply edits from .remap files -*- python -*-
43
#
54
# This source file is part of the Swift.org open source project
65
#
@@ -9,8 +8,6 @@
98
#
109
# See http://swift.org/LICENSE.txt for license information
1110
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
12-
#
13-
#===------------------------------------------------------------------------===#
1411

1512
from __future__ import print_function
1613

utils/build-script

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#!/usr/bin/env python
2-
#===--- build-script - The ultimate tool for building Swift ----------------===#
2+
# utils/build-script - The ultimate tool for building Swift -*- python -*-
33
#
4-
## This source file is part of the Swift.org open source project
5-
##
6-
## Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
7-
## Licensed under Apache License v2.0 with Runtime Library Exception
8-
##
9-
## See http://swift.org/LICENSE.txt for license information
10-
## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
4+
# This source file is part of the Swift.org open source project
115
#
12-
#===------------------------------------------------------------------------===#
6+
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
7+
# Licensed under Apache License v2.0 with Runtime Library Exception
8+
#
9+
# See http://swift.org/LICENSE.txt for license information
10+
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1311

1412
from __future__ import print_function
1513

utils/sil-opt-verify-all-modules.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
#===------------------------------------------------------------------------===#
2+
# utils/sil-opt-verify-all-modules.py - Verifies Swift modules -*- python -*-
33
#
44
# This source file is part of the Swift.org open source project
55
#
@@ -8,8 +8,6 @@
88
#
99
# See http://swift.org/LICENSE.txt for license information
1010
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
11-
#
12-
#===------------------------------------------------------------------------===#
1311

1412
from __future__ import print_function
1513

0 commit comments

Comments
 (0)