Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback on formatting style #1526

Closed
geeanlooca opened this issue Jun 30, 2020 · 1 comment
Closed

Feedback on formatting style #1526

geeanlooca opened this issue Jun 30, 2020 · 1 comment
Labels
F: linebreak How should we split up lines? R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?

Comments

@geeanlooca
Copy link

Describe the bug Consider the following python class

class MZM:
    def output(self, laser, drive):
        if np.isfinite(self.extinction_ratio_dB):
            er = 10 ** (-self.extinction_ratio_dB / 20)
            modulated_laser_x = (1 - er) * modulated_laser_signal.iq[0] + er * laser.iq[0]

The line starting with modulated_laser_x = is longer than the 88-character limit, and is formatted as

class MZM:
    def output(self, laser, drive):
        if np.isfinite(self.extinction_ratio_dB):
            er = 10 ** (-self.extinction_ratio_dB / 20)
            modulated_laser_x = (1 - er) * modulated_laser_signal.iq[0] + er * laser.iq[
                0
            ]

Is this the correct behaviour?
This is what I want to know. I expected something along the lines of

class MZM:
    def output(self, laser, drive):
        if np.isfinite(self.extinction_ratio_dB):
            er = 10 ** (-self.extinction_ratio_dB / 20)
            modulated_laser_x = (
                (1 - er) * modulated_laser_signal.iq[0] 
                + er * laser.iq[0]
             )

To Reproduce Steps to reproduce the behavior:

  1. Take the first snippet above
  2. Run Black on it either without arguments or with these arguments: -t py36
  3. See the result in the second snippet above

Expected behavior A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • Version: 19.10b0
  • OS and Python version: Windows 10/Python 3.7.4

Does this bug also happen on master?
Yes, see this

@geeanlooca geeanlooca added the T: bug Something isn't working label Jun 30, 2020
@ichard26 ichard26 added T: style What do we want Blackened code to look like? and removed T: bug Something isn't working labels Aug 4, 2020
@JelleZijlstra JelleZijlstra added the F: linebreak How should we split up lines? label May 30, 2021
@JelleZijlstra
Copy link
Collaborator

JelleZijlstra commented Jan 29, 2022

Duplicate of #236

@JelleZijlstra JelleZijlstra marked this as a duplicate of #2364 Jan 29, 2022
@JelleZijlstra JelleZijlstra marked this as not a duplicate of #2364 Jan 29, 2022
@JelleZijlstra JelleZijlstra marked this as a duplicate of #236 Jan 29, 2022
@ichard26 ichard26 added the R: duplicate This issue or pull request already exists label Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: linebreak How should we split up lines? R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

3 participants