Commit Graph

23 Commits

Author SHA1 Message Date
Max Desiatov
c7f348fabc utils: Python 3 is required, avoid using old Python (#61525)
On both macOS and Linux `python` is not symlinked to `python3` by default. To avoid confusion, we should update our documentation that instructs users to run scripts with `python` to use `python3` instead.
2022-10-11 00:06:36 +01:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Graydon Hoare
71da5ec519 Fix flake8 warning W605 invalid escape sequence. 2018-11-06 11:38:39 -08:00
practicalswift
ee871c7938 [python] Bring code base in line with PEP-8 again 2016-09-16 19:33:04 +02:00
Jordan Rose
ae69ffb2b7 Fix python-lint violations in previous commit. (#4284) 2016-08-12 23:25:54 -07:00
Jordan Rose
ca14c36936 [docs] Fix syntax highlighting issues to support newer Sphinxes. (#4283)
- Update the Pygments lexer we use for parsing Swift-like code.
- State more explicitly which highlighting should be used in which
  code blocks.
- Disable highlighting altogether in certain cases (such as SIL.rst,
  which has equal amounts grammar and SIL excerpts).

This should fix the warnings-as-error issues coming from Sphinx > 1.3.4.

Based on a patch by Jeremy Fergason!

https://bugs.swift.org/browse/SR-620
2016-08-12 22:59:11 -07:00
practicalswift
1edb62dc38 [Python] Make flake8 linting pass without errors/warning (w/ default rules) 2016-03-13 20:19:51 +01:00
practicalswift
0796eaad1f [Python] Fix 80-column violations 2016-03-09 23:52:11 +01:00
practicalswift
04afd6e640 [Python] Improve consistency: "block comment should start with '# '" (PEP-8) 2016-03-05 14:03:16 +01:00
practicalswift
1cd4d4e9c9 [gardening] Fix violations of non-controversial PEP8 rules
Fixes:
* multiple statements on one line (colon) (E701)
* missing whitespace around arithmetic operator (E226)
* missing whitespace around operator (E225)
* closing bracket does not match visual indentation (E124)
* blank line contains whitespace (W293)
* continuation line missing indentation or outdented (E122)
* continuation line over-indented for hanging indent (E126)
* missing expected blank line (E301)
* trailing whitespace (W291)
* unexpected spaces around keyword / parameter equals (E251)
* whitespace after '(', '[' or '{' (E201)
* whitespace before ')', ']' or '}' (E202)
* whitespace before ',' or ':' (E203)
2016-01-23 09:23:33 +01:00
practicalswift
22d043fcc0 [gardening] Fix violations of non-controversial PEP8 rules.
Fixes:
* blank line at end of file
* closing bracket does not match indentation of opening bracket's line
* continuation line over-indented for hanging indent
* continuation line over-indented for visual indent
* continuation line unaligned for hanging indent
* inline comment should start with '# '
* missing whitespace around arithmetic operator
* missing whitespace around bitwise or shift operator
* multiple imports on one line
* multiple spaces after ':'
* multiple spaces after operator
2016-01-16 00:47:43 +01:00
practicalswift
1c6308648f Use explicit imports. 2015-12-24 00:31:54 +01:00
eeckstein
369554b963 Revert "[Python] Use explicit imports" 2015-12-23 14:35:04 -08:00
practicalswift
f54d795d87 Use explicit imports. 2015-12-23 23:27:27 +01:00
practicalswift
cd337dc83b Remove unused imports. 2015-12-21 10:24:08 +01:00
James McLaughlin
9da5899652 Consistently use env(1) to resolve bash and python paths 2015-12-03 20:55:27 +00:00
Dave Abrahams
31e804a7d1 [Pygments] allow whitespace in generic param lists
It used to be confusing our lexer, so syntax highlighting would often be
mysteriously dropped.

Swift SVN r31097
2015-08-08 18:02:37 +00:00
Dave Abrahams
e6c2402e69 Docs: Trivial fixups for the pygments lexer
Swift SVN r25300
2015-02-15 22:51:36 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Joe Pamer
8aff44fa56 Revert accidental commit of utils/pygments/swift.pyc from r16837
Swift SVN r16839
2014-04-25 20:08:02 +00:00
Joe Pamer
86b79d6bd3 Some code cleanup for array upcast conversions. (Part 2 of the fix for rdar://problem/16540403)
Swift SVN r16837
2014-04-25 19:52:06 +00:00
Dave Abrahams
05eeba93f4 Turn on ReST error checking in CMake documentation builds
(it was already on in Makefile builds)

Also, fix the ReST errors it found.

Also, monkeypatch pygments so it can see our lexers when we build
documentation.  This keeps all doc builds from producing heaps of
warnings.

Swift SVN r6023
2013-07-05 22:33:50 +00:00
Tim Isted
2b45f0af7b Utils: Add basic pygments lexer
Treat this as something to be replaced as soon as possible; it works for the white paper, with the odd issue, but may not be so great for more complex code. Your mileage may vary.
Originally written never to be seen by anyone but me, I commit this against my better judgement; may y'all have mercy on my soul.

Swift SVN r4113
2013-02-20 19:09:51 +00:00