Commit Graph

25 Commits

Author SHA1 Message Date
Sergii Tkachenko
de6ed9ba9f [Python] Migrate from yapf to black (#33138)
- Switched  from yapf to black
- Reconfigure isort for black
- Resolve black/pylint idiosyncrasies 

Note: I used `--experimental-string-processing` because black was
producing "implicit string concatenation", similar to what described
here: https://github.com/psf/black/issues/1837. While currently this
feature is experimental, it will be enabled by default:
https://github.com/psf/black/issues/2188. After running black with the
new string processing so that the generated code merges these `"hello" "
world"` strings concatenations, then I removed
`--experimental-string-processing` for stability, and regenerated the
code again.

To the reviewer: don't even try to open "Files Changed" tab 😄 It's
better to review commit-by-commit, and ignore `run black and isort`.
2023-06-09 15:08:55 -07:00
Richard Belleville
59693b7e72 Migrate Infrastructure Scripts to Python 3 (#27135)
* Run 2to3 on tools directory

* Delete github_stats_tracking

* Re-run 2to3

* Remove unused script

* Remove unused script

* Remove unused line count utility

* Yapf. Isort

* Remove accidentally included file

* Migrate tools/distrib directory to python 3

* Remove unnecessary shebang

* Restore line_count directory

* Immediately convert subprocess.check_output output to string

* Take care of Python 2 shebangs

* Invoke scripts using a Python 3 interpreter

* Yapf. Isort

* Try installing Python 3 first

* See if we have any Python 3 versions installed

* Add Python 3.7 to Windows path

* Try adding a symlink

* Try to symlink differently

* Install six for Python 3

* Run run_interop_tests with python 3

* Try installing six in python3.7 explicitly

* Revert "Try installing six in python3.7 explicitly"

This reverts commit 2cf60d72f388a95d642b2c99a775d88a6248f788.

* And debug some more

* Fix issue with jobset.py

* Add debug for CI failure

* Revert microbenchmark changes
2021-11-08 08:55:25 -08:00
Richard Belleville
b6cc72f129 Revert "Run 2to3 on tools directory (#26002)" (#27183)
This reverts commit a388361c3d.
2021-08-30 12:29:20 -07:00
Richard Belleville
a388361c3d Run 2to3 on tools directory (#26002)
* Run 2to3 on tools directory

* Delete github_stats_tracking

* Re-run 2to3

* Remove unused script

* Remove unused script

* Remove unused line count utility

* Yapf. Isort

* Remove accidentally included file

* Restore line_count directory
2021-08-30 09:25:21 -07:00
Lidi Zheng
2231c2ba77 Introduce Python import sorting to our sanity test suite (#26768)
* Add isort_code.sh to sanity tests

* Run tools/distrib/isort_code.sh

* Fine tune the import order for relative imports

* Make pylint and project generation happy

* Fix a few corner cases

* Use --check instead of --diff

* The import order impacts test result somehow

* Make isort print diff and check output at the same time

* Let tools/run_tests/python_utils be firstparty library

* Run isort against latest HEAD
2021-07-26 12:31:21 -07:00
Sergii Tkachenko
8db79e2e71 Python style: reformat code using updated yapf 0.30.0 2021-01-13 14:00:12 -05:00
Lidi Zheng
0e275f3d2b Change to explicitly encode 2020-11-13 12:07:45 -08:00
Lidi Zheng
e191e98f37 Unify the encoding to ascii 2020-11-13 12:07:44 -08:00
Lidi Zheng
892e7bacb1 Explicitly set encoding to ascii to prevent TypeError in 3.7+ 2020-11-13 12:07:44 -08:00
Jan Tattermusch
e329d1ddd0 bytes(string, encoding) is not supported in python2
results in error "TypeError: str() takes at most 1 argument (2 given)"
2020-07-14 17:46:27 +02:00
Jan Tattermusch
4847f85367 make port server python3 compatible 2020-07-13 11:35:07 +02:00
Esun Kim
7be821ac47 Yapf all target python sources 2020-01-03 09:25:10 -08:00
Richard Belleville
666fb1c5ee Make run_tests.py python-version agnostic 2018-11-02 14:18:58 -07:00
ncteisen
0cd6cfefa0 yapf tools/run_tests/sanity 2017-12-11 16:56:44 -08:00
ncteisen
05687c3da9 yapf tools/run_tests/python_utils 2017-12-11 16:54:47 -08:00
Muxi Yan
cd62e7d04c Exclude cronet restricted ports from port server pool 2017-12-07 14:16:39 -08:00
Jan Tattermusch
7897ae9308 auto-fix most of licenses 2017-06-08 11:22:41 +02:00
Craig Tiller
e21d2c1cd8 Bump version 2017-05-05 14:07:50 -07:00
Craig Tiller
ddc8a8243d Fix port server on Windows 2017-05-05 14:02:35 -07:00
Craig Tiller
e1f5302bc5 Port server fixes
- correct a couple of race conditions that could result in duplicated port assignments to different processes
- enhance detection code for 'is this port in use' to be much more robust
2017-05-04 19:53:19 +00:00
Craig Tiller
09ebed7bf4 Ensure port server can shutdown 2017-04-25 10:19:10 -07:00
Craig Tiller
ec49524269 Add a mutex around allocate_port 2017-04-24 20:55:43 +00:00
Craig Tiller
ea525ebd39 Threaded port_server 2017-04-24 17:50:32 +00:00
Siddharth Shukla
8e64d901fd Modify shebang on python scripts
Change shebangs to `#!/usr/bin/env python` instead of
`#!/usr/bin/env python2.7`.
2017-03-12 19:53:12 +01:00
Jan Tattermusch
5c79a3199c cleanup tools/run_tests directory 2016-12-22 10:47:52 +01:00