commit | 4cf8859c18ef9bc68ff5fe7216bda6fd16a1e939 | [log] [tgz] |
---|---|---|
author | Petros Maniatis <maniatis@google.com> | Thu Dec 06 14:12:52 2018 -0800 |
committer | Copybara-Service <copybara-piper@google.com> | Thu Dec 06 14:13:05 2018 -0800 |
tree | 0e7c3a9caf20ad6cbe953e4bbbe8dc2301b14863 | |
parent | f24641ca72815e2643659cb7c8a966e5faa6e580 [diff] |
Add multi enum class flag to absl.flags. This change enables the use of enum.Enum objects in multi_* style labels. Previously the multi_enum flag in absl.flags only accepted strings. The new multi_enum_class flag accepts (lists of) Enum class members. The text format of lists of enums when serializing into XML differs from the list format in other multi_* types of flags. This is because all other multi_* types rely on repr() to turn a list into a string (since all other multi_* types have primitive contents). With multi_enum_class, repr() prints out a list of the repr()'s of Enum objects, which are rather unsightly for public consumption (e.g., they contain the integer value of the enum flags). This change does some acrobatics to ensure XML representation of flag usage looks reasonable for lists, but those rendered lists look a little different from repr()'ed lists. This change fixes the way multi_* flags are serialized when saved for future re-ingestion via a command line. It makes each flag value appear on a separate line, by modifying the list separator of all MultiFlag and subclasses to be '\n'. PiperOrigin-RevId: 224405076
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.
Full documentation is forthcoming on https://abseil.io. For now, please refer to the in-code Python docstrings.
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.