Commit Graph

5 Commits

Author SHA1 Message Date
Joel Brobecker
a1ab32afb3 Remove assertion in type_conversions/to_tuple (Python3 prep)
This function starts by an assertion that the given parameter is
a string by checking its type. However, in Python 2, strings can
take 2 forms: type "str", or type "unicode". What we'd like to do
to help migrating this code to Python, is to start using unicode
strings throughout. But then, if we want to keep the assertion,
the problem becomes that we would need to change it to check for
type "unicode", which would be incompatible with Python 3, where
type "unicode" no longer exists.

Since the assertion is not really all that helpful and even
possibly unnecessarily restrictive, this commit simply removes it.

Change-Id: If9014c35b5f2107cfc0bb03338b9a977f44587ba
2021-05-03 05:17:41 -07:00
Joel Brobecker
a075b1653e reformat all the code using black
Change-Id: Idbc70777233ab2d40ab59765abb9cbbeeb88ec63
2021-04-18 14:59:01 +04:00
Joel Brobecker
119b998c85 hooks/type_conversions.py: Remove unnecessary call to tuple
This avoids a flake8 C408 error.

Change-Id: Ifce23d2dbfabba4301adac7e61b02bde26eb45c7
2021-04-18 14:53:37 +04:00
Joel Brobecker
1971e0326c Add support for tuple types in git config parameters.
The purpose is to allow config.git_config to handle the config
options which are comma-separated lists automatically.

This is just the framework part. Options will be converted
one by one.
2012-12-29 19:44:01 +04:00
Joel Brobecker
7db2fc25cc Add support for returning typed value by config.git_config.
This patch allows us to specify a given type to any git config
option, and have git_config config the option value (a string)
into that type, raising an InvalidUpdate error if the conversion
failed.

Currently no such option is taking advantage of this features.
Transition of the relevant options will be done piecemeal.

Part of LC27-007.
2012-12-28 13:47:05 +04:00