Giter Club home page Giter Club logo

pyformat's People

Contributors

generalov avatar myint avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyformat's Issues

pep8 config is ignored

When pyformat is used, an existing pep8 configuration is not applied.

Example:

# test.py
l = ['a', 'really', 'really', 'really', 'long', 'line', 'that', 'violates', 'max-line', 'limit']
# .pep8
[pep8]
max-line-length=120

Running autopep8 -i test.py results in:

# test.py after running autopep8
l = ['a', 'really', 'really', 'really', 'long', 'line', 'that', 'violates', 'max-line', 'limit']

As expected the file was not changed because it is under the 120 max-line-length in the autopep8 config.

Running pyformat -i test.py results in:

# test.py after running pyformat
l = ['a', 'really', 'really', 'really', 'long',
     'line', 'that', 'violates', 'max-line', 'limit']

Support formatting code provided via stdin

yapf has very similar command line interface as pyformat but provides one additional one: pass a code via stdin and print result on stdout.

Such a feature makes it very easy for integrating e.g. into vim editor by adding following line into .vimrc file:

autocmd FileType python setlocal equalprg=yapf

and user may format the code of whole file:

gg=G

or in visual mode (multiple lines selected):

=

pyformat does not accept file on stdin thus it is not possible to use it in the same style. Adding such feature to pyformat would make use simpler.

Broken since docformatter 1.5

With newest docformatter version 1.5, pyformat fails with AttributeError: module 'docformatter' has no attribute 'format_code'

UnicodeEncodeError

$ cat unicode.py 
#!/usr/bin/python
# -*- coding: utf-8 -*-

'ö'
$ autopep8 -i unicode.py
$ pyformat -i unicode.py 
Traceback (most recent call last):
  File "/usr/local/bin/pyformat", line 42, in <module>
    standard_error=sys.stderr))
  File "/usr/local/lib/python2.7/dist-packages/pyformat.py", line 179, in main
    format_multiple_files(set(args.files), args, standard_out, standard_error)
  File "/usr/local/lib/python2.7/dist-packages/pyformat.py", line 126, in format_multiple_files
    _format_file((name, args, standard_out, standard_error))
  File "/usr/local/lib/python2.7/dist-packages/pyformat.py", line 104, in _format_file
    format_file(*parameters[:-1])
  File "/usr/local/lib/python2.7/dist-packages/pyformat.py", line 79, in format_file
    formatted_source = format_code(source, aggressive=args.aggressive)
  File "/usr/local/lib/python2.7/dist-packages/pyformat.py", line 64, in format_code
    formatted_source = fix(formatted_source)
  File "/usr/local/lib/python2.7/dist-packages/pyformat.py", line 54, in <lambda>
    yield lambda code: autopep8.fix_string(code, options=autopep8_options)
  File "/usr/local/lib/python2.7/dist-packages/autopep8.py", line 1941, in fix_string
    source = source.decode(locale.getpreferredencoding(False))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 44: ordinal not in range(128)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.