[chore] Add pylintrc and formatted using black formatter#93
[chore] Add pylintrc and formatted using black formatter#93Unmask06 wants to merge 0 commit intoCalebBell:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a .pylintrc configuration file and reformats the fluids/control_valve.py file using the Black code formatter to improve code consistency and developer experience.
Changes:
- Added
.pylintrcfile with disabled Pylint rules forinvalid-name,too-many-arguments, andtoo-many-positional-arguments - Reformatted
fluids/control_valve.pyusing Black formatter (spacing, line breaks, formatting of constants and lists)
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| .pylintrc | New configuration file for Pylint with disabled rules |
| fluids/control_valve.py | Code reformatted with Black formatter for consistent style |
Comments suppressed due to low confidence (1)
fluids/control_valve.py:1628
- This comment appears to contain commented-out code.
# for fi in fis_l_2015:
# fi_rt_inv = 1.0/sqrt(fi)
# fis_l_2015_inv.append(fi_rt_inv*fi_rt_inv)
# fis_l_2015_1_5.append(fi*fi*fi_rt_inv)
# fis_l_2015_n1_5.append(fi_rt_inv*fi_rt_inv*fi_rt_inv)
# fis_l_2015_3.append(fi*fi*fi)
# fis_l_2015_17.append(fi**1.7)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fluids/control_valve.py
Outdated
| # def err_piping_coeff(Ci): | ||
| # loss = loss_coefficient_piping(d, D1, D2) | ||
| # FP = (1. + loss/N2*(Ci/d**2)**2)**-0.5 | ||
| # loss_upstream = loss_coefficient_piping(d, D1) | ||
| # xTP = xT/FP**2/(1 + xT*loss_upstream/N5*(Ci/d**2)**2) | ||
| # choked = is_choked_turbulent_g(x, Fgamma, xTP=xTP) | ||
| # if choked: | ||
| # # Choked flow with piping, equation 17a | ||
| # C = Q/(N9*FP*P1*Y)*(MW*T*Z/xTP/Fgamma)**0.5 | ||
| # else: | ||
| # # Non-choked flow with piping, equation 11a | ||
| # C = Q/(N9*FP*P1*Y)*(MW*T*Z/x)**0.5 | ||
| # return C - Ci | ||
| # import matplotlib.pyplot as plt | ||
| # from fluids.numerics import linspace | ||
| # Cs = linspace(C/50, C*50, 5000) | ||
| # errs = [err_piping_coeff(C_test) for C_test in Cs] | ||
| # plt.plot(Cs, errs) | ||
| # plt.show() |
There was a problem hiding this comment.
This comment appears to contain commented-out code.
| # def err_piping_coeff(Ci): | |
| # loss = loss_coefficient_piping(d, D1, D2) | |
| # FP = (1. + loss/N2*(Ci/d**2)**2)**-0.5 | |
| # loss_upstream = loss_coefficient_piping(d, D1) | |
| # xTP = xT/FP**2/(1 + xT*loss_upstream/N5*(Ci/d**2)**2) | |
| # choked = is_choked_turbulent_g(x, Fgamma, xTP=xTP) | |
| # if choked: | |
| # # Choked flow with piping, equation 17a | |
| # C = Q/(N9*FP*P1*Y)*(MW*T*Z/xTP/Fgamma)**0.5 | |
| # else: | |
| # # Non-choked flow with piping, equation 11a | |
| # C = Q/(N9*FP*P1*Y)*(MW*T*Z/x)**0.5 | |
| # return C - Ci | |
| # import matplotlib.pyplot as plt | |
| # from fluids.numerics import linspace | |
| # Cs = linspace(C/50, C*50, 5000) | |
| # errs = [err_piping_coeff(C_test) for C_test in Cs] | |
| # plt.plot(Cs, errs) | |
| # plt.show() | |
| # Historical debugging code for piping coefficient and plotting has been | |
| # removed; refer to version control history if needed. |
fluids/control_valve.py
Outdated
| # for fi, fi_inv, fi_1_5, fi_1_5_inv, A in zip(fis_l_2015, fis_l_2015_inv, fis_l_2015_1_5, fis_l_2015_n1_5, A_weights_l_2015): | ||
| # fi_inv = 1.0/fi | ||
| # fi_turb_ratio = fis_l_2015[i]*f_p_turb_inv | ||
| # fi_turb_ratio = fi*f_p_turb_inv |
There was a problem hiding this comment.
This comment appears to contain commented-out code.
| # fi_turb_ratio = fi*f_p_turb_inv | |
| # Note: an earlier formulation used fi * f_p_turb_inv for fi_turb_ratio. |
fluids/control_valve.py
Outdated
| # elif regime == 5: | ||
| # pass |
There was a problem hiding this comment.
This comment appears to contain commented-out code.
| # elif regime == 5: | |
| # pass | |
| # Regime 5 requires no additional Mach number calculation beyond the above. |
fluids/control_valve.py
Outdated
| if P1 is None: | ||
| raise ValueError("Either P1 or P2 needs to be specified") | ||
| ans = P2 = P1*(-5.0*gamma*xT + 7.0)/7.0 | ||
| ans = P2 = P1 * (-5.0 * gamma * xT + 7.0) / 7.0 |
There was a problem hiding this comment.
Variable P2 is not used.
| ans = P2 = P1 * (-5.0 * gamma * xT + 7.0) / 7.0 | |
| ans = P1 * (-5.0 * gamma * xT + 7.0) / 7.0 |
fluids/control_valve.py
Outdated
| ans = P2 = P1 * (-5.0 * gamma * xT + 7.0) / 7.0 | ||
| elif P1 is None: | ||
| ans = P1 = -7.0*P2/(5.0*gamma*xT - 7.0) | ||
| ans = P1 = -7.0 * P2 / (5.0 * gamma * xT - 7.0) |
There was a problem hiding this comment.
Variable P1 is not used.
fluids/control_valve.py
Outdated
| if (Rev > 10000 or not allow_laminar) and (D1 != d or D2 != d): | ||
| # gas, using xTP and FLP | ||
| FP = 1. | ||
| FP = 1.0 |
There was a problem hiding this comment.
Variable FP is not used.
| FP = 1.0 |
Just a initial contribution.
let's use Pylint and Black formatter for better and consistent Developer Experience (DX).
In the subsequent PR i will further modularize and add feature related to Issue #92
Love to make Fluid better!!