Comments (8)
The problem is that the original code isn't correct. "rb" isn't accepted by "br" is. One of the limitations of lib2to3 (and therefore YAPF) is that it requires the code to be well-formed. Here's what I saw:
>>> rb'hello world'
File "<stdin>", line 1
rb'hello world'
^
SyntaxError: invalid syntax
>>> br'hello world'
'hello world'
>>>
from yapf.
$ python3
Python 3.4.3 (default, Mar 1 2015, 15:44:16)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> rb'this is valid python3 syntax'
b'this is valid python3 syntax'
Useful for e.g. not having to escape backslashes in bytestrings.
from yapf.
Ah! My mistake. I was using 2.7.
from yapf.
Marking this as a bug, but I'm not sure what we can do here. Might be the same issue as yield from
?
from yapf.
Yeah, I'll have to see what we do about places where lib2to3 fails. Maybe deeper monkey-patching will help
from yapf.
This is an upstream lib2to3 bug. Reported http://bugs.python.org/issue23894
Monkey patching this in lib2to3 is pretty complex -- I don't see this as very high priority at this time.
from yapf.
Adding a lib2to3 bug label.
from yapf.
Python 3 seems to have fixed this.
from yapf.
Related Issues (20)
- [Bug] Some space out of range strip when using `-l` argument. HOT 2
- The NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS format option doesn't work correctly.
- Remove the blank line between docstring and function head
- Improve error reporting when `yapf` encounters unsupported Python syntax
- Set specific options for keywords
- Function call without arguments.
- Yapf not formatting python generic
- dedent_closing_brackets not working for Annotations[]
- yapf is failing `pre-commit` with `tool.yapfignore` configured: `yapf: input filenames did not match any python files`
- [BUG] yapf with split_all_top_level_comma_separated_values set to true fails to split lines with tuple LHS HOT 1
- [Bug] [Crash][Reproducible] `EOFError: Ran out of input` when import yapf with multiprocess
- assert formatting
- Strange inconsistent behaviour HOT 3
- Is there a each_dict_entry_on_separate_line for lists? HOT 2
- Try to keep list literals in tuples aligned
- yapf-diff inconsistent with yapf on multiline strings with backslashes
- Ternary conditionals within F Strings Raise IndexError
- Split type hints with trailing comma
- yapf adds spaces before backslash with every run
- Split first and only argument into separate line
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yapf.