Skip to content

Add how to use as module to the README#157

Merged
bwendling merged 1 commit intogoogle:masterfrom
hayd:patch-1
Jun 17, 2015
Merged

Add how to use as module to the README#157
bwendling merged 1 commit intogoogle:masterfrom
hayd:patch-1

Conversation

@hayd
Copy link
Copy Markdown
Contributor

@hayd hayd commented Jun 16, 2015

Fix #148.

Note: IMO the FormatFile api is a little strange atm, in returning (source, encoding) or (diff, encoding). I think an in_place argument would be good... but I'm not sure what it ought to return in this case (None, encoding) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eurgh, this is a typo. Doh!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and fix it and then squash the result. :-)

@bwendling
Copy link
Copy Markdown
Member

Oops! I didn't catch this. I mentioned in the other pull request that it should probably return None, encoding. That seems the most logical thing to do, IMHO. But I could be wrong. :-)

@hayd
Copy link
Copy Markdown
Contributor Author

hayd commented Jun 16, 2015

I may cheekily wait for #158 and then update to include mention of in_place! :)

Like I said there, having looked a little, I'm not sure that (None, encoding) makes sense, because then you have the same result whether:

  • the file exists, is reformatted, writes out sucessfully
  • the file does not exist, and exits*

* for some reason currently this returns (None, encoding) rather than raising an exception of some sort... :s

Edit: The docstring was incorrect, so this isn't actually the case. FormatFile raises if there file is not found.

bwendling added a commit that referenced this pull request Jun 17, 2015
Add how to use as module to the README
@bwendling bwendling merged commit 8909364 into google:master Jun 17, 2015
hayd added a commit to hayd/yapf that referenced this pull request Jun 17, 2015
Also fix a typo from updating the README in google#157.

Note: in_place argument introduced in google#158.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants