Correction in my previous email. pre-commit hook double-quote-string-fixer
too does not seem to work well for f-strings with a mix of double and
single quotes (meaning does not convert a f-string which has outer quotes
as double and inner quotes as single). It just skips it if the string is
like the below:
f"hello how are you, my name is 'Pankaj', I hope you're well"


Regards,



Pankaj Koti

*Senior Software Engineer, *OSS Engineering Team.
Location: Pune, India

Timezone: Indian Standard Time (IST)

Email: pankaj.k...@astronomer.io

Mobile: +91 9730079985


On Wed, Sep 21, 2022 at 12:15 PM Jeambrun Pierre <pierrejb...@gmail.com>
wrote:

> Definitely in favor of more consistency. (Hoping it will not make things
> too hard for people doing the cherry picking)
>
> Best Regards,
> Pierre
>
> Le mer. 21 sept. 2022 à 08:35, Pankaj Koti
> <pankaj.k...@astronomer.io.invalid> a écrit :
>
>> I'm in for normalizing.
>> Personally, I don't like a mix of both single and double quotes.
>>
>> In my opinion, we can enforce double-quotes with Black or also try the
>> pre-commit hook double-quote-string-fixer
>> https://github.com/pre-commit/pre-commit-hooks/blob/main/README.md#double-quote-string-fixer
>> which converts double quotes to single quotes. I believe the python
>> community prefers single quotes over double in general (
>> https://github.com/psf/black/issues/373) so we can consider the latter
>> option (double-quote-string-fixer pre-commit hook)? It normalizes f-strings
>> too.
>>
>>
>> Regards,
>>
>>
>>
>> Pankaj Koti
>>
>> *Senior Software Engineer, *OSS Engineering Team.
>> Location: Pune, India
>>
>> Timezone: Indian Standard Time (IST)
>>
>> Email: pankaj.k...@astronomer.io
>>
>> Mobile: +91 9730079985
>>
>>
>> On Wed, Sep 21, 2022 at 11:22 AM Felix Uellendall <felue...@pm.me.invalid>
>> wrote:
>>
>>> Totally for it!
>>>
>>> That’s not true actually. Black won’t reformat strings using f-string if
>>> you use single quotes for the string and double quotes within e.g.
>>> when passing a str.join statement as a value which uses double quotes. So
>>> you can still have a mixture of both in the codebase but it will be less. :)
>>> (I would have expected black to reformat this and turn the f-string
>>> quotes into double quotes and single quotes within, but it is a difficult
>>> decision.)
>>>
>>> Best,
>>> Felix
>>>
>>>
>>>
>>> Sent from Proton Mail for iOS
>>>
>>>
>>> On Wed, Sep 21, 2022 at 06:19, Daniel Standish <
>>> daniel.stand...@astronomer.io.INVALID> wrote:
>>>
>>> I'll weigh in on this most important of decisions
>>>
>>>
>>> :)
>>>
>>> OK but I must clear up one thing ... if we turn on string normalization,
>>> we do not get to choose single vs double -- with black, there is only one
>>> way, and it is double.
>>>
>>> Personally I have always liked single but yeah, I am in favor of turning
>>> on normalization, which means double (generally speaking). Black explains
>>> the reasoning for the choice here
>>> <https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#strings>
>>> .
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>

Reply via email to