commit | 2e9e5d1dc33837a6b870e6e11759f2a90c24515e | [log] [tgz] |
---|---|---|
author | Abseil Team <absl-team@google.com> | Wed Dec 04 10:25:12 2019 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Wed Dec 04 10:25:39 2019 -0800 |
tree | d937bb872638b53b95a90307b6bbe95c6cc58c28 | |
parent | 5a1e57e323874dfb4d1aceb2d1521bd731c465b5 [diff] |
Fix an upcoming pytype error in absltest. I'm working on an improvement to pytype's type-checking of function type comments, which exposes an annotation error in absltest. _TempFile._open() was annotated as returning Union[TextIO, BinaryIO] but is used as: def open_text(...) -> ContextManager[TextIO]: ... return self._open(...) which will cause pytype to complain about open_text returning bytes when text is expected. The proper way to fix this issue would be to use typing.overload and typing.Literal to define multiple signatures for _open(), but pytype doesn't fully support Literal yet, so I've added type comments with the right types in open_text() and open_bytes(). This change also fixes a mistake in the return annotation on _open() and alphabetically orders all typing imports. PiperOrigin-RevId: 283783117 Change-Id: I4d78a9eb1c98218e62a9b0662931213f7c5c1668
This repository is a collection of Python library code for building Python applications. The code is collected from Google's own Python code base, and has been extensively tested and used in production.
To install the package, simply run:
pip install absl-py
Or install from source:
python setup.py install
To run Abseil tests, you can clone the git repo and run bazel:
git clone https://github.com/abseil/abseil-py.git cd abseil-py bazel test absl/...
Please refer to smoke_tests/sample_app.py as an example to get started.
See the Abseil Python Developer Guide.
The current repository includes an initial set of libraries for early adoption. More components and interoperability with Abseil C++ Common Libraries will come in future releases.
The Abseil Python library is licensed under the terms of the Apache license. See LICENSE for more information.