Skip to content

[chore] Add pylintrc and formatted using black formatter#93

Closed
Unmask06 wants to merge 0 commit intoCalebBell:masterfrom
Unmask06:master
Closed

[chore] Add pylintrc and formatted using black formatter#93
Unmask06 wants to merge 0 commit intoCalebBell:masterfrom
Unmask06:master

Conversation

@Unmask06
Copy link

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!!

Copilot AI review requested due to automatic review settings January 13, 2026 11:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .pylintrc file with disabled Pylint rules for invalid-name, too-many-arguments, and too-many-positional-arguments
  • Reformatted fluids/control_valve.py using 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.

Comment on lines 1030 to 1048
# 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()
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to contain commented-out code.

Suggested change
# 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.

Copilot uses AI. Check for mistakes.
# 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
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to contain commented-out code.

Suggested change
# fi_turb_ratio = fi*f_p_turb_inv
# Note: an earlier formulation used fi * f_p_turb_inv for fi_turb_ratio.

Copilot uses AI. Check for mistakes.
Comment on lines 2075 to 2076
# elif regime == 5:
# pass
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to contain commented-out code.

Suggested change
# elif regime == 5:
# pass
# Regime 5 requires no additional Mach number calculation beyond the above.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable P2 is not used.

Suggested change
ans = P2 = P1 * (-5.0 * gamma * xT + 7.0) / 7.0
ans = P1 * (-5.0 * gamma * xT + 7.0) / 7.0

Copilot uses AI. Check for mistakes.
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)
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable P1 is not used.

Copilot uses AI. Check for mistakes.
if (Rev > 10000 or not allow_laminar) and (D1 != d or D2 != d):
# gas, using xTP and FLP
FP = 1.
FP = 1.0
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable FP is not used.

Suggested change
FP = 1.0

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant