Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Update string formatters to new style #552

Merged
merged 1 commit into from Jul 19, 2016

Conversation

pferate
Copy link
Contributor

@pferate pferate commented Jul 18, 2016

Changing % style string formatters to .format().
Leaving logging strings in old style for Python 2 compatibility.

Resolves: Issue #541

raise TypeError('Property %s must be convertible to a flow '
'instance; received: %s.' % (self._name,
value))
raise TypeError('Property {0} must be convertible to a flow '

This comment was marked as spam.

@theacodes
Copy link
Contributor

This looks good to me with some minor style nits. Thanks for doing this @pferate.

@nathanielmanistaatgoogle any reservations?

@pferate pferate force-pushed the string_format branch 3 times, most recently from cd198d6 to 57e3f17 Compare July 18, 2016 20:10
@pferate
Copy link
Contributor Author

pferate commented Jul 18, 2016

@jonparrott: Style changes have been fixed. I also rebased onto @waprin's commit from today, so that all the Travis tests pass.

@theacodes
Copy link
Contributor

@pferate great. I'll let @nathanielmanistaatgoogle take a look and merge when he's happy. :)

@@ -122,8 +122,8 @@ def open_and_lock(self, timeout, delay):
CredentialsFileSymbolicLinkError if the file is a symbolic link.
"""
if self._locked:
raise AlreadyLockedException('File %s is already locked' %
self._filename)
raise AlreadyLockedException('File {0} is already locked'.format(

This comment was marked as spam.

This comment was marked as spam.

@nathanielmanistaatgoogle
Copy link
Contributor

In your commit message where you say "Leaving logging strings in old style for Python 2 compatibility.", is it actually legal in Python 3 to use format-style strings in calls to logging methods?

@pferate
Copy link
Contributor Author

pferate commented Jul 19, 2016

Yes, in 3.2 they introduced the style parameter, which will let you use %, { or $ styled string templates.

I don't think it has been backported to python 2, unless it's in a different library or with a different name.

Changing `%` style string formatters to `.format()`.
Leaving `logging` strings in old style for Python 2 compatibility.

Resolves: Issue googleapis#541
@theacodes
Copy link
Contributor

Woohoo. Thank you, @pferate for your contributions that help improve the consistency and health of this project.

Thanks, @nathanielmanistaatgoogle for reviewing. :)

@theacodes theacodes mentioned this pull request Jul 28, 2016
@pferate pferate deleted the string_format branch July 29, 2016 22:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants