Skip to content

Commit 1fae0d1

Browse files
author
Max Moiseev
committed
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2 parents 7fe6916 + 4b86ad2 commit 1fae0d1

File tree

144 files changed

+3098
-2092
lines changed

Some content is hidden

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

144 files changed

+3098
-2092
lines changed

.pep8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[flake8]
22
filename = *.py,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,gyb,line-directive,ns-html2rst,recursive-lipo,rth,submit-benchmark-results,update-checkout,viewcfg
3-
ignore = E101,E111,E128,E265,E302,E402,E501,W191
3+
ignore = D100,D101,D102,D103,D104,D105,E101,E111,E128,E302,E402,E501,W191

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
Swift 3
33
-------
44

5+
* Generic typealiases are now supported, e.g.:
6+
typealias StringDictionary<T> = Dictionary<String, T>
7+
typealias IntFunction<T> = (T) -> Int
8+
typealias MatchingTriple<T> = (T, T, T)
9+
typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)
10+
11+
etc.
12+
513
* The @noescape attribute has been extended to be a more general type attribute.
614
You can now declare values of @noescape function type, e.g. in manually
715
curried function signatures. You can now also declare local variables of

benchmark/scripts/Benchmark_DTrace.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
#
1313
# ===----------------------------------------------------------------------===//
1414

15+
import argparse
1516
import os
16-
import sys
1717
import subprocess
18-
import argparse
18+
import sys
1919

2020
DRIVER_LIBRARY_PATH = "@PATH_TO_DRIVER_LIBRARY@"
2121
sys.path.append(DRIVER_LIBRARY_PATH)

benchmark/scripts/Benchmark_Driver

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
#
1414
# ===----------------------------------------------------------------------===//
1515

16-
import subprocess
17-
import sys
16+
import argparse
17+
import datetime
18+
import glob
19+
import json
1820
import os
1921
import re
20-
import json
21-
import urllib2
22-
import urllib
23-
import datetime
24-
import argparse
22+
import subprocess
23+
import sys
2524
import time
26-
import glob
25+
import urllib
26+
import urllib2
2727

2828
DRIVER_DIR = os.path.dirname(os.path.realpath(__file__))
2929

@@ -128,7 +128,7 @@ def log_results(log_directory, driver, formatted_output, swift_repo=None):
128128
"""
129129
try:
130130
branch = get_current_git_branch(swift_repo)
131-
except:
131+
except (OSError, subprocess.CalledProcessError):
132132
branch = None
133133
timestamp = time.strftime("%Y%m%d%H%M%S", time.localtime())
134134
if branch:
@@ -138,7 +138,7 @@ def log_results(log_directory, driver, formatted_output, swift_repo=None):
138138
driver_name = os.path.basename(driver)
139139
try:
140140
os.makedirs(output_directory)
141-
except:
141+
except OSError:
142142
pass
143143
log_file = os.path.join(output_directory,
144144
driver_name + '-' + timestamp + '.log')

benchmark/scripts/Benchmark_GuardMalloc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# ===----------------------------------------------------------------------===//
1414

1515
import os
16-
import sys
1716
import subprocess
17+
import sys
1818

1919
sys.path.append("@PATH_TO_DRIVER_LIBRARY@")
2020

benchmark/scripts/Benchmark_RuntimeLeaksRunner.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
#
1313
# ===----------------------------------------------------------------------===//
1414

15-
import os
16-
import sys
1715
import json
16+
import os
1817
import subprocess
18+
import sys
1919

2020
sys.path.append("@PATH_TO_DRIVER_LIBRARY@")
2121

@@ -77,7 +77,7 @@ class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
7777
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
7878
p.wait()
7979
error_out = p.stderr.readlines()
80-
except:
80+
except OSError:
8181
print("Child Process Failed! (%s,%s)" % (data['path'], data['test_name']))
8282
return LeaksRunnerResult(test_name, True)
8383

@@ -94,7 +94,7 @@ class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
9494
d['objc_count'] -= FUNC_TO_GLOBAL_COUNTS[data['test_name']]['objc_count']
9595

9696
return LeaksRunnerResult(test_name, (d['objc_count'] + d['swift_count']) > 0)
97-
except:
97+
except (KeyError, ValueError):
9898
print "Failed parse output! (%s,%s)" % (data['path'], data['test_name'])
9999
return LeaksRunnerResult(test_name, True)
100100

benchmark/scripts/compare_perf_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
# repeat.sh 3 mypatch/bin/Benchmark_Driver run -o -O > mypatch.O.times
1919
# compare_perf_tests.py tot.O.times mypatch.O.times | sort -t, -n -k 6 | column -s, -t
2020

21-
import sys
2221
import re
22+
import sys
2323

2424
VERBOSE = 0
2525

@@ -38,7 +38,7 @@
3838
def parse_int(word):
3939
try:
4040
return int(word)
41-
except:
41+
except ValueError:
4242
raise Exception("Expected integer value, not " + word)
4343

4444
def get_scores(fname):

benchmark/scripts/generate_harness/generate_harness.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414

1515
# Generate CMakeLists.txt and utils/main.swift from templates.
1616

17-
import jinja2
18-
import os
1917
import glob
18+
import os
2019
import re
2120

21+
import jinja2
22+
2223
script_dir = os.path.dirname(os.path.realpath(__file__))
2324
perf_dir = os.path.realpath(os.path.join(script_dir, '../..'))
2425
single_source_dir = os.path.join(perf_dir, 'single-source')

benchmark/scripts/perf_test_driver/perf_test_driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
#
1313
# ===----------------------------------------------------------------------===//
1414

15-
import os
16-
import subprocess
1715
import multiprocessing
16+
import os
1817
import re
18+
import subprocess
1919

2020
class Result(object):
2121
def __init__(self, name, status, output, xfail_list):

benchmark/utils/convertToJSON.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@
5757
# ]
5858
# }
5959

60-
import sys
6160
import json
6261
import re
62+
import sys
63+
6364
# Parse lines like this
6465
# #,TEST,SAMPLES,MIN(ms),MAX(ms),MEAN(ms),SD(ms),MEDIAN(ms)
6566
SCORERE = re.compile(r"(\d+),[ \t]*(\w+),[ \t]*([\d.]+),[ \t]*([\d.]+)")

docs/conf.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
# If extensions (or modules to document with autodoc) are in another directory,
1717
# add these directories to sys.path here. If the directory is relative to the
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
#sys.path.insert(0, os.path.abspath('.'))
19+
# sys.path.insert(0, os.path.abspath('.'))
2020

2121
# -- General configuration -----------------------------------------------------
2222

2323
# If your documentation needs a minimal Sphinx version, state it here.
24-
#needs_sphinx = '1.0'
24+
# needs_sphinx = '1.0'
2525

2626
# Add any Sphinx extension module names here, as strings. They can be extensions
2727
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -34,7 +34,7 @@
3434
source_suffix = '.rst'
3535

3636
# The encoding of source files.
37-
#source_encoding = 'utf-8-sig'
37+
# source_encoding = 'utf-8-sig'
3838

3939
# The master toctree document.
4040
master_doc = 'contents'
@@ -54,11 +54,11 @@
5454

5555
# The language for content autogenerated by Sphinx. Refer to documentation
5656
# for a list of supported languages.
57-
#language = None
57+
# language = None
5858

5959
# There are two options for replacing |today|: either, you set today to some
6060
# non-false value, then it is used:
61-
#today = ''
61+
# today = ''
6262
# Else, today_fmt is used as the format for a strftime call.
6363
today_fmt = '%Y-%m-%d'
6464

@@ -67,14 +67,14 @@
6767
exclude_patterns = ['_build']
6868

6969
# The reST default role (used for this markup: `text`) to use for all documents.
70-
#default_role = None
70+
# default_role = None
7171

7272
# If true, '()' will be appended to :func: etc. cross-reference text.
73-
#add_function_parentheses = True
73+
# add_function_parentheses = True
7474

7575
# If true, the current module name will be prepended to all description
7676
# unit titles (such as .. function::).
77-
#add_module_names = True
77+
# add_module_names = True
7878

7979
# If true, sectionauthor and moduleauthor directives will be shown in the
8080
# output. They are ignored by default.
@@ -86,7 +86,7 @@
8686
highlight_language = 'swift'
8787

8888
# A list of ignored prefixes for module index sorting.
89-
#modindex_common_prefix = []
89+
# modindex_common_prefix = []
9090

9191

9292
# -- Options for HTML output ---------------------------------------------------
@@ -112,14 +112,14 @@
112112

113113
# The name for this set of Sphinx documents. If None, it defaults to
114114
# "<project> v<release> documentation".
115-
#html_title = None
115+
# html_title = None
116116

117117
# A shorter title for the navigation bar. Default is the same as html_title.
118-
#html_short_title = None
118+
# html_short_title = None
119119

120120
# The name of an image file (relative to this directory) to place at the top
121121
# of the sidebar.
122-
#html_logo = None
122+
# html_logo = None
123123

124124
# The name of an image file (within the static path) to use as favicon of the
125125
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -137,40 +137,40 @@
137137

138138
# If true, SmartyPants will be used to convert quotes and dashes to
139139
# typographically correct entities.
140-
#html_use_smartypants = True
140+
# html_use_smartypants = True
141141

142142
# Custom sidebar templates, maps document names to template names.
143-
#html_sidebars = {'index': 'indexsidebar.html'}
143+
# html_sidebars = {'index': 'indexsidebar.html'}
144144

145145
# Additional templates that should be rendered to pages, maps page names to
146146
# template names.
147147
html_additional_pages = {'LangRef': 'archive/LangRef.html'}
148148

149149
# If false, no module index is generated.
150-
#html_domain_indices = True
150+
# html_domain_indices = True
151151

152152
# If false, no index is generated.
153-
#html_use_index = True
153+
# html_use_index = True
154154

155155
# If true, the index is split into individual pages for each letter.
156-
#html_split_index = False
156+
# html_split_index = False
157157

158158
# If true, links to the reST sources are added to the pages.
159159
html_show_sourcelink = True
160160

161161
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
162-
#html_show_sphinx = True
162+
# html_show_sphinx = True
163163

164164
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
165-
#html_show_copyright = True
165+
# html_show_copyright = True
166166

167167
# If true, an OpenSearch description file will be output, and all pages will
168168
# contain a <link> tag referring to it. The value of this option must be the
169169
# base URL from which the finished HTML is served.
170-
#html_use_opensearch = ''
170+
# html_use_opensearch = ''
171171

172172
# This is the file name suffix for HTML files (e.g. ".xhtml").
173-
#html_file_suffix = None
173+
# html_file_suffix = None
174174

175175
# Output file base name for HTML help builder.
176176
htmlhelp_basename = 'Swiftdoc'
@@ -180,13 +180,13 @@
180180

181181
latex_elements = {
182182
# The paper size ('letterpaper' or 'a4paper').
183-
#'papersize': 'letterpaper',
183+
# 'papersize': 'letterpaper',
184184

185185
# The font size ('10pt', '11pt' or '12pt').
186-
#'pointsize': '10pt',
186+
# 'pointsize': '10pt',
187187

188188
# Additional stuff for the LaTeX preamble.
189-
#'preamble': '',
189+
# 'preamble': '',
190190
}
191191

192192
# Grouping the document tree into LaTeX files. List of tuples
@@ -198,23 +198,23 @@
198198

199199
# The name of an image file (relative to this directory) to place at the top of
200200
# the title page.
201-
#latex_logo = None
201+
# latex_logo = None
202202

203203
# For "manual" documents, if this is true, then toplevel headings are parts,
204204
# not chapters.
205-
#latex_use_parts = False
205+
# latex_use_parts = False
206206

207207
# If true, show page references after internal links.
208-
#latex_show_pagerefs = False
208+
# latex_show_pagerefs = False
209209

210210
# If true, show URL addresses after external links.
211-
#latex_show_urls = False
211+
# latex_show_urls = False
212212

213213
# Documents to append as an appendix to all manuals.
214-
#latex_appendices = []
214+
# latex_appendices = []
215215

216216
# If false, no module index is generated.
217-
#latex_domain_indices = True
217+
# latex_domain_indices = True
218218

219219

220220
# -- Options for manual page output --------------------------------------------
@@ -227,28 +227,28 @@
227227
]
228228

229229
# If true, show URL addresses after external links.
230-
#man_show_urls = False
230+
# man_show_urls = False
231231

232232

233233
# -- Options for Texinfo output ------------------------------------------------
234234

235235
# Grouping the document tree into Texinfo files. List of tuples
236236
# (source start file, target name, title, author,
237-
# dir menu entry, description, category)
237+
# dir menu entry, description, category)
238238
texinfo_documents = [
239239
('contents', 'Swift', u'Swift Documentation',
240240
u'LLVM project', 'Swift', 'One line description of project.',
241241
'Miscellaneous'),
242242
]
243243

244244
# Documents to append as an appendix to all manuals.
245-
#texinfo_appendices = []
245+
# texinfo_appendices = []
246246

247247
# If false, no module index is generated.
248-
#texinfo_domain_indices = True
248+
# texinfo_domain_indices = True
249249

250250
# How to display URL addresses: 'footnote', 'no', or 'inline'.
251-
#texinfo_show_urls = 'footnote'
251+
# texinfo_show_urls = 'footnote'
252252

253253

254254
# FIXME: Define intersphinx configuration.
@@ -265,7 +265,7 @@
265265
#
266266

267267
# Pull in the Swift lexers
268-
from os.path import dirname, abspath, join as join_paths
268+
from os.path import abspath, dirname, join as join_paths
269269
sys.path = [
270270
join_paths(dirname(dirname(abspath(__file__))), 'utils', 'pygments')
271271
] + sys.path

0 commit comments

Comments
 (0)