Shopping Cart My Cart Account Log In Walkthrough IDE Integrations Contact Partner  
Polystyle
The Elegant, Intelligent Source Code Formatter

Click Here To Download A Free Trial!
C/C++   PerlPascal/Delphi
C#   CSSCMAC
Java Javascript   PHP 
JSP HTMLPython
ASP Visual BasicActionscript
Home Features Documentation Buy Polystyle Download  
Step 1: Unformatted Python Source

  • Overall Python Features
  • Step 1: Unformatted Source
  • Step 2: Example Source
  • Step 3: Formatted Source

    Let's start with a real life source file which is not well formatted:


    class bdist_rpm ( Command):
    
        user_options = [    ('bdist-base=', 
        None,
             "base directory for creating built distributions"),        ('rpm-base=', None,
             "base directory for creating RPMs (defaults to \"rpm\" under "
             "--bdist-base; must be specified for RPM 2)"),
            ( 'dist-dir=',   'd',
             "directory to put final RPM files in "
             "(and .spec files if --spec-only)") ,        ('source-only', None,         "only generate source RPM"),
            ('binary-only', None,
             "only generate binary RPM") ]
             
        def _format_changelog(self, changelog):
            if not changelog:
                return changelog
            new_changelog = []
            for line in string.split(string.strip(changelog), '\n'):
                line = string.strip(line)
                if line[0 ] =='*' :
                    new_changelog.extend ( [''  ])
                elif line[0] == '-':
                    new_changelog.append(line )
                else:
                    new_changelog.append('  '+ line)
             

    Next, in Step 2 we'll look at our example source which defines our style.

  • Home Features Documentation Buy Polystyle Download  

    Click Here To Download A Free Trial!

    Copyright © Flashbulb Studios. All rights reserved.