吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 6899|回复: 7
收起左侧

[Disassemblers] PyLingual - Python Decompiler for 3.6+

  [复制链接]
风吹屁屁凉 发表于 2025-4-22 12:17

PyLingual - Python Decompiler for 3.6+

PyLingual is a CPython bytecode decompiler supporting all released Python versions since 3.6. For information about the design and implementation of PyLingual, please refer to our research paper.

PyLingual can be run through our web service or run locally.

This codebase is optimized for readability and future extension, so there may initially be some control flow accuracy regression compared to the version hosted on the web service.

Requirements

  • Python 3.11 or higher

Compiling bytecode

Some parts of PyLingual require the ability to compile bytecode in a different Python version (equivalence check and model training). For this, you will need the following:

  • pyenv with all Python versions you want to compile to
  • Unix-like operating system (pyenv does not support Windows)

Setup

Install from source, using Poetry:

git clone https://github.com/syssec-utd/pylingual
cd pylingual
python -m venv venv
source venv/bin/activate
pip install poetry
poetry install

Usage

Usage: pylingual [OPTIONS] [FILES]...

  End to end pipeline to decompile Python bytecode into source code.

Options:
  -o, --out-dir PATH      The directory to export results to.
  -c, --config-file PATH  Config file for model information.
  -v, --version VERSION   Python version of the .pyc, default is auto
                          detection.
  -k, --top-k INT         Maximum number of additional segmentations to
                          consider.
  -q, --quiet             Suppress console output.
  --trust-lnotab          Use the lnotab for segmentation instead of the
                          segmentation model.
  --init-pyenv            Install pyenv before decompiling.
  -h, --help              Show this message and exit.

Support

If you have any issues for installing and using PyLingual, please create an issue or send your message via our support email at pylingual@gmail.com.

https://github.com/syssec-utd/pylingual

免费评分

参与人数 3吾爱币 +3 热心值 +3 收起 理由
yp17792351859 + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
gcode + 1 + 1 谢谢@Thanks!
杨辣子 + 1 + 1 热心回复!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

黄薛海 发表于 2025-4-25 08:37
在线版 https://pylingual.io/
测试了一下,可以反编译出3.12的大部份源码
[Python] 纯文本查看 复制代码
# Decompiled with PyLingual (https://pylingual.io)
# Internal filename: BoltTorque.py
# Bytecode version: 3.12.0rc2 (3531)
# Source timestamp: 1970-01-01 00:00:00 UTC (0)

import sys
import datetime
import urllib.request
from PyQt5 import uic
from PyQt5.QtNetwork import QNetworkInterface
from BOLTfunction import bolt_P, bolt_mechpop, bolt_geomsize, bolt_dh, nut_da
from PyQt5.QtGui import QDoubleValidator, QValidator
from SetParam import SetInitial
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
from PyQt5.QtCore import QDate
import torque_ui_gui

class MyWindow(QMainWindow, torque_ui_gui.Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.init_ui()

    def init_ui(self):
        self.setupUi(self)
        self.setWindowIcon(QIcon('./ico/logo.png'))
        self.informat = QLabel('{:<110}'.format('   就绪'))
        self.username = QLabel('{:^20}'.format('青岛康思得'))
        self.status = QLabel('{:^20}'.format('程序启动正常'))
        self.statusBar.addWidget(self.informat, 1)
        self.statusBar.addWidget(self.username)
        self.statusBar.addWidget(self.status)
        self.comboBox.currentIndexChanged.connect(self.BoltSize)
        self.comboBox_2.currentIndexChanged.connect(self.BoltStandard)
        self.comboBox_3.currentIndexChanged.connect(self.BoltClass)
        self.comboBox_4.currentIndexChanged.connect(self.CalcuType)
        self.lineEdit.textChanged.connect(self.FricCoe_changed)
        self.lineEdit_2.textChanged.connect(self.FricCoe_changed)
        self.lineEdit_24.textChanged.connect(self.FricCoe_uGmax)
        self.lineEdit_25.textChanged.connect(self.FricCoe_uGmin)
        self.lineEdit_26.textChanged.connect(self.FricCoe_uKmax)
        self.lineEdit_27.textChanged.connect(self.FricCoe_uKmin)
        floatValidator_01 = FloatRangeValidator(0.02, 1.2)
        floatValidator_02 = FloatRangeValidator(1, 100)
        floatValidator_03 = FloatRangeValidator(0, 50)
        floatValidator_07 = FloatRangeValidator(0, 10000)
        floatValidator_15 = FloatRangeValidator(0.25, 8)
        floatValidator_16 = FloatRangeValidator(1, 100)
        floatValidator_23 = FloatRangeValidator(10, 10000)
        self.lineEdit.setValidator(floatValidator_01)
        self.lineEdit_2.setValidator(floatValidator_01)
        self.lineEdit_3.setValidator(floatValidator_02)
        self.lineEdit_4.setValidator(floatValidator_03)
        self.lineEdit_7.setValidator(floatValidator_07)
        self.lineEdit_15.setValidator(floatValidator_15)
        self.lineEdit_16.setValidator(floatValidator_16)
        self.lineEdit_17.setValidator(floatValidator_16)
        self.lineEdit_18.setValidator(floatValidator_16)
        self.lineEdit_19.setValidator(floatValidator_16)
        self.lineEdit_20.setValidator(floatValidator_16)
        self.lineEdit_21.setValidator(floatValidator_16)
        self.lineEdit_22.setValidator(floatValidator_16)
        self.lineEdit_23.setValidator(floatValidator_23)
        self.lineEdit_24.setValidator(floatValidator_01)
        self.lineEdit_25.setValidator(floatValidator_01)
        self.lineEdit_26.setValidator(floatValidator_01)
        self.lineEdit_27.setValidator(floatValidator_01)
        self.checkBox.stateChanged.connect(self.UserInput)
        self.checkBox_3.stateChanged.connect(self.UserInput)
        self.checkBox_4.stateChanged.connect(self.UserInput)
        self.checkBox_5.stateChanged.connect(self.UserInput)
        self.checkBox_6.stateChanged.connect(self.UserInput)
        self.checkBox_7.stateChanged.connect(self.UserInput)
        self.checkBox_8.stateChanged.connect(self.UserInput)
        self.checkBox_9.stateChanged.connect(self.UserInput_u)
        self.checkBox_10.stateChanged.connect(self.UserInput_u)
        self.checkBox_11.stateChanged.connect(self.UserInput_u)
        self.checkBox_12.stateChanged.connect(self.UserInput_u)
        self.comboBox_5.currentIndexChanged.connect(self.BoltHole)
        self.comboBox_6.currentIndexChanged.connect(self.NutHole)
        self.pushButton.clicked.connect(self.TorqueCalculation)
        self.pushButton_2.clicked.connect(self.ReSet)
        self.lineEdit_15.textChanged.connect(self.PChanged)
        try:
            url = 'http://www.baidu.com'
            response = urllib.request.urlopen(url)
            date_str = response.headers['Date']
            network_time = datetime.datetime.strptime(date_str, '%a, %d %b %Y %H:%M:%S %Z')
            define_value = QDate(2026, 1, 1)
            if network_time >= define_value:
                self.pushButton.setEnabled(False)
                self.informat.setText('     ERROR: 授权码异常,请与开发者联系!')
                self.status.setText('程序启动正常!')
        except:
            self.pushButton.setEnabled(False)
            self.informat.setText('     ERROR: 网络异常!')
            self.status.setText('程序启动正常!')

    def BoltSize(self):
        diam = self.comboBox.currentText()
        bolt_stand = self.comboBox_2.currentText()
        bolt_class = self.comboBox_3.currentText()
        bolt_hole = self.comboBox_5.currentText()
        nut_stand = self.comboBox_6.currentText()
        d = float(diam[1:])
        P = bolt_P(d)
        d1 = d - 1.0825 * P
        d2 = round(d - 0.6495 * P, 3)
        d3 = d1 - 0.1443 * P
        dS = round(0.5 * (d2 + d3), 3)
        self.lineEdit_15.setText(str(P))
        self.lineEdit_16.setText(str(d2))
        self.lineEdit_17.setText(str(dS))
        bolt_Geom = bolt_geomsize(bolt_stand, diam)
        da = bolt_Geom[1]
        dW = bolt_Geom[2]
        self.lineEdit_18.setText(str(dW))
        self.lineEdit_19.setText(str(da))
        bolt_stdar = self.comboBox_2.currentText()
        bolt_class = self.comboBox_3.currentText()
        dh = bolt_dh(diam, bolt_hole)
        self.lineEdit_20.setText(str(dh))
        self.lineEdit_21.setText(str(dh))
        Da = nut_da(nut_stand, diam)
        self.lineEdit_22.setText(str(Da))
        if bolt_class == '8.8':
            MechPop = bolt_mechpop(bolt_class, d)
            Rp = MechPop[1]
            self.lineEdit_23.setText(str(Rp))
        self.comboBox_4.setCurrentText('已知最大利用率')
        self.label_9.setText('屈服载荷最大利用率vmax [%]')
        self.lineEdit_3.setText('90')

    def BoltStandard(self):
        bolt_stand = self.comboBox_2.currentText()
        diam = self.comboBox.currentText()
        bolt_Geom = bolt_geomsize(bolt_stand, diam)
        da = bolt_Geom[1]
        dW = bolt_Geom[2]
        self.lineEdit_18.setText(str(dW))
        self.lineEdit_19.setText(str(da))

    def BoltClass(self):
        bolt_class = self.comboBox_3.currentText()
        diam = self.comboBox.currentText()
        d = float(diam[1:])
        MechPop = bolt_mechpop(bolt_class, d)
        Rp = MechPop[1]
        self.lineEdit_23.setText(str(Rp))
        self.comboBox_4.setCurrentText('已知最大利用率')
        self.label_9.setText('屈服载荷最大利用率vmax [%]')
        self.lineEdit_3.setText('90')

    def PChanged(self):
        try:
            P = float(self.lineEdit_15.text())
            diam = self.comboBox.currentText()
            d = float(diam[1:])
            d1 = d - 1.0825 * P
            d2 = round(d - 0.6495 * P, 3)
            d3 = d1 - 0.1443 * P
            dS = round(0.5 * (d2 + d3), 3)
            self.lineEdit_16.setText(str(d2))
            self.lineEdit_17.setText(str(dS))
        except:
            print('错误')
            return

    def FricCoe_changed(self):
        u_max = self.lineEdit.text()
        u_min = self.lineEdit_2.text()
        utotal_max = max(u_max, u_min)
        self.lineEdit_24.setText(utotal_max)
        self.lineEdit_26.setText(utotal_max)
        utotal_min = min(u_min, u_max)
        self.lineEdit_25.setText(utotal_min)
        self.lineEdit_27.setText(utotal_min)

    def FricCoe_uGmax(self):
        try:
            uGmax = float(self.lineEdit_24.text())
            uGmin = float(self.lineEdit_25.text())
            if uGmax < uGmin:
                self.lineEdit_24.setText(str(uGmin))
        except:
            print('Error')

    def FricCoe_uGmin(self):
        try:
            uGmax = self.lineEdit_24.text()
            uGmin = self.lineEdit_25.text()
            if float(uGmax) < float(uGmin):
                self.lineEdit_25.setText(uGmax)
        except:
            print('Error')

    def FricCoe_uKmax(self):
        try:
            uKmax = self.lineEdit_26.text()
            uKmin = self.lineEdit_27.text()
            if float(uKmax) < float(uKmin):
                self.lineEdit_26.setText(uKmin)
        except:
            print('Error')

    def FricCoe_uKmin(self):
        try:
            uKmax = self.lineEdit_26.text()
            uKmin = self.lineEdit_27.text()
            if float(uKmax) < float(uKmin):
                self.lineEdit_27.setText(uKmax)
        except:
            print('Error')

    def UserInput(self):
        stat_CB = self.checkBox.isChecked()
        stat_CB_3 = self.checkBox_3.isChecked()
        stat_CB_4 = self.checkBox_4.isChecked()
        stat_CB_5 = self.checkBox_5.isChecked()
        stat_CB_6 = self.checkBox_6.isChecked()
        stat_CB_7 = self.checkBox_7.isChecked()
        stat_CB_8 = self.checkBox_8.isChecked()
        self.lineEdit_15.setReadOnly(not stat_CB)
        self.lineEdit_17.setReadOnly(not stat_CB_3)
        self.lineEdit_18.setReadOnly(not stat_CB_4)
        self.lineEdit_19.setReadOnly(not stat_CB_5)
        self.lineEdit_20.setReadOnly(not stat_CB_6)
        self.lineEdit_22.setReadOnly(not stat_CB_7)
        self.lineEdit_23.setReadOnly(not stat_CB_8)
        if self.checkBox.isChecked() == False:
            diam = self.comboBox.currentText()
            d = float(diam[1:])
            P = bolt_P(d)
            self.lineEdit_15.setText(str(P))
        if self.checkBox_3.isChecked() == False:
            diam = self.comboBox.currentText()
            d = float(diam[1:])
            P = float(self.lineEdit_15.text())
            d1 = d - 1.0825 * P
            d2 = round(d - 0.6495 * P, 3)
            d3 = d1 - 0.1443 * P
            dS = round(0.5 * (d2 + d3), 3)
            self.lineEdit_17.setText(str(dS))
        if self.checkBox_4.isChecked() == False:
            diam = self.comboBox.currentText()
            bolt_stand = self.comboBox_2.currentText()
            bolt_Geom = bolt_geomsize(bolt_stand, diam)
            dW = bolt_Geom[2]
            self.lineEdit_18.setText(str(dW))
        if self.checkBox_5.isChecked() == False:
            diam = self.comboBox.currentText()
            bolt_stand = self.comboBox_2.currentText()
            bolt_Geom = bolt_geomsize(bolt_stand, diam)
            da = bolt_Geom[1]
            self.lineEdit_19.setText(str(da))
        if self.checkBox_6.isChecked() == False:
            diam = self.comboBox.currentText()
            bolt_hole = self.comboBox_5.currentText()
            dh = bolt_dh(diam, bolt_hole)
            self.lineEdit_20.setText(str(dh))
        if self.checkBox_7.isChecked() == False:
            diam = self.comboBox.currentText()
            nut_stand = self.comboBox_6.currentText()
            Da = nut_da(nut_stand, diam)
            self.lineEdit_22.setText(str(Da))
        if self.checkBox_8.isChecked() == False:
            diam = self.comboBox.currentText()
            d = float(diam[1:])
            bolt_class = self.comboBox_3.currentText()
            MechPop = bolt_mechpop(bolt_class, d)
            Rp = MechPop[1]
            self.lineEdit_23.setText(str(Rp))

    def UserInput_u(self):
        stat_CB_9 = self.checkBox_9.isChecked()
        stat_CB_10 = self.checkBox_10.isChecked()
        stat_CB_11 = self.checkBox_11.isChecked()
        stat_CB_12 = self.checkBox_12.isChecked()
        self.lineEdit_24.setReadOnly(not stat_CB_9)
        self.lineEdit_25.setReadOnly(not stat_CB_10)
        self.lineEdit_26.setReadOnly(not stat_CB_11)
        self.lineEdit_27.setReadOnly(not stat_CB_12)
        if self.checkBox_9.isChecked() == False:
            umax = self.lineEdit.text()
            umin = self.lineEdit_2.text()
            uGmax = max(umin, umax)
            self.lineEdit_24.setText(uGmax)
        if self.checkBox_10.isChecked() == False:
            umax = self.lineEdit.text()
            umin = self.lineEdit_2.text()
            uGmin = min(umin, umax)
            self.lineEdit_25.setText(uGmin)
        if self.checkBox_11.isChecked() == False:
            umax = self.lineEdit.text()
            umin = self.lineEdit_2.text()
            uKmax = max(umin, umax)
            self.lineEdit_26.setText(uKmax)
        if self.checkBox_12.isChecked() == False:
            umax = self.lineEdit.text()
            umin = self.lineEdit_2.text()
            uKmin = min(umin, umax)
            self.lineEdit_27.setText(uKmin)

    def BoltHole(self):
        diam = self.comboBox.currentText()
        hole = self.comboBox_5.currentText()
        dh = bolt_dh(diam, hole)
        self.lineEdit_20.setText(str(dh))
        self.lineEdit_21.setText(str(dh))

    def NutHole(self):
        diam = self.comboBox.currentText()
        nut_stand = self.comboBox_6.currentText()
        Da = nut_da(nut_stand, diam)
        self.lineEdit_22.setText(str(Da))

    def CalcuType(self):
        diam = self.comboBox.currentText()
        bolt_class = self.comboBox_3.currentText()
        paramper = SetInitial(diam, bolt_class)
        self_cal_type = self.comboBox_4.currentText()
        if self_cal_type == '已知最大利用率':
            self.label_9.setText('屈服载荷最大利用率vmax [%]')
            self.lineEdit_3.setText('90')
            self.lineEdit_3.setValidator(FloatRangeValidator(1, 100))
        else:  # inserted
            if self_cal_type == '已知最大扭矩':
                self.label_9.setText('最大扭矩MAmax [N.m]')
                MAmax = paramper[2]
                self.lineEdit_3.setText(str(MAmax))
                self.lineEdit_3.setValidator(FloatRangeValidator(1, 100000))
            else:  # inserted
                if self_cal_type == '已知最大预紧力':
                    self.label_9.setText('最大预紧力FMmax [kN]')
                    FMmax = paramper[5]
                    self.lineEdit_3.setText(str(FMmax))
                    self.lineEdit_3.setValidator(FloatRangeValidator(1, 100000))
                else:  # inserted
                    if self_cal_type == '已知额定扭矩':
                        self.label_9.setText('额定扭矩MA0 [N.m]')
                        MA0 = paramper[4]
                        self.lineEdit_3.setText(str(MA0))
                        self.lineEdit_3.setValidator(FloatRangeValidator(1, 100000))
                    else:  # inserted
                        if self_cal_type == '已知最小扭矩':
                            self.label_9.setText('最小扭矩MAmin [N.m]')
                            MAmin = paramper[3]
                            self.lineEdit_3.setText(str(MAmin))
                            self.lineEdit_3.setValidator(FloatRangeValidator(1, 100000))
                        else:  # inserted
                            if self_cal_type == '已知最小预紧力':
                                self.label_9.setText('最小预紧力FMmin [kN]')
                                FMmin = paramper[6]
                                self.lineEdit_3.setText(str(FMmin))
                                self.lineEdit_3.setValidator(FloatRangeValidator(1, 100000))
        if self_cal_type == '已知最小利用率':
            self.label_9.setText('屈服载荷最小利用率vmin [%]')
            v_min = paramper[8]
            self.lineEdit_3.setText(str(v_min))
            self.lineEdit_3.setValidator(FloatRangeValidator(1, 100))

    def get_mac_address(self):
        all_interfaces = QNetworkInterface.allInterfaces()
        for interface in all_interfaces:
            if not interface.flags() & QNetworkInterface.IsLoopBack:
                return interface.hardwareAddress()
        else:  # inserted
            return

    def ReSet(self):
        self.comboBox_2.setCurrentText('GB/T 5782B-2016')
        self.comboBox.setCurrentText('M8')
        self.comboBox_3.setCurrentText('8.8')
        self.lineEdit.setText('0.10')
        self.lineEdit_2.setText('0.10')
        self.comboBox_4.setCurrentText('已知最大利用率')
        self.lineEdit_3.setText('90')
        self.lineEdit_4.setText('10')
        self.label_9.setText('屈服载荷最大利用率vmax [%]')
        self.lineEdit_5.setText('')
        self.lineEdit_6.setText('')
        self.lineEdit_7.setText('0')
        self.lineEdit_8.setText('')
        self.lineEdit_9.setText('')
        self.lineEdit_11.setText('')
        self.lineEdit_12.setText('')
        self.lineEdit_14.setText('')
        self.lineEdit_15.setText('1.25')
        self.lineEdit_16.setText('7.188')
        self.lineEdit_17.setText('6.827')
        self.lineEdit_18.setText('11.47')
        self.lineEdit_19.setText('9.2')
        self.lineEdit_20.setText('9')
        self.lineEdit_21.setText('9')
        self.lineEdit_22.setText('8.75')
        self.lineEdit_23.setText('640')
        self.lineEdit_24.setText('0.10')
        self.lineEdit_25.setText('0.10')
        self.lineEdit_26.setText('0.10')
        self.lineEdit_27.setText('0.10')
        self.comboBox_5.setCurrentText('中等装配')
        self.comboBox_6.setCurrentText('GB/T 6170')
        self.checkBox.setChecked(False)
        self.checkBox_3.setChecked(False)
        self.checkBox_4.setChecked(False)
        self.checkBox_5.setChecked(False)
        self.checkBox_6.setChecked(False)
        self.checkBox_7.setChecked(False)
        self.checkBox_8.setChecked(False)
        self.checkBox_9.setChecked(False)
        self.checkBox_10.setChecked(False)
        self.checkBox_11.setChecked(False)
        self.checkBox_12.setChecked(False)

    def TorqueCalculation(self):
        flage = 1.0
        self_bolt_P = self.lineEdit_15.text()
        self_bolt_d2 = self.lineEdit_16.text()
        self_bolt_dS = self.lineEdit_17.text()
        self_bolt_dW = self.lineEdit_18.text()
        self_bolt_da = self.lineEdit_19.text()
        self_bolt_dh = self.lineEdit_20.text()
        self_bolt_dha = self.lineEdit_21.text()
        self_bolt_Da = self.lineEdit_22.text()
        self_bolt_Rp = self.lineEdit_23.text()
        self_uGmax = self.lineEdit_24.text()
        self_uGmin = self.lineEdit_25.text()
        self_uKmax = self.lineEdit_26.text()
        self_uKmin = self.lineEdit_27.text()
        self_cal_type = self.comboBox_4.currentText()
        self_condtion = self.lineEdit_3.text()
        self_tor_torq = self.lineEdit_4.text()
        P = float(self_bolt_P)
        d2 = float(self_bolt_d2)
        dS = float(self_bolt_dS)
        dW = float(self_bolt_dW)
        da = float(self_bolt_da)
        dh = float(self_bolt_dh)
        dha = float(self_bolt_dha)
        Da = float(self_bolt_Da)
        Rp = float(self_bolt_Rp)
        uGmax = float(self_uGmax)
        uGmin = float(self_uGmin)
        uKmax = float(self_uKmax)
        uKmin = float(self_uKmin)
        torque_add = float(self.lineEdit_7.text()) * 1000
        dM = float(self_tor_torq)
        AS = 0.7854 * dS ** 2
        xx_xx = (1 + (0.83 * P / dS + 3.0 * d2 * uGmin / dS) ** 2) ** 0.5
        dKi = max(Da, dha, dh, da)
        DKm = 0.5 * (dW + dKi)
        umax = (0.58 * d2 * uGmax + 0.5 * DKm * uKmax) / (0.58 * d2 + 0.5 * DKm)
        umin = (0.58 * d2 * uGmin + 0.5 * DKm * uKmin) / (0.58 * d2 + 0.5 * DKm)
        re_max = 0.16 * P + (0.58 * d2 + 0.5 * DKm) * umax
        re_min = 0.16 * P + (0.58 * d2 + 0.5 * DKm) * umin
        if self_cal_type == '已知最大利用率':
            v_max = float(self_condtion) * 0.01
            FMmax = v_max * AS * Rp / xx_xx
            MAmax = FMmax * re_min
            MA0 = MAmax * (1 - 0.01 * dM)
            MAmin = MAmax * (1 - 0.02 * dM)
            FMmin = MAmin / re_max
            v_min = FMmin * xx_xx / (AS * Rp)
            MAmax = MAmax + torque_add
            MAmin = MAmin + torque_add
            MA0 = MA0 + torque_add
        else:  # inserted
            if self_cal_type == '已知最大扭矩':
                MAmax = float(self_condtion) * 1000 - torque_add
                FMmax = MAmax / re_min
                v_max = FMmax * xx_xx / (AS * Rp)
                MA0 = MAmax / (1 + 0.01 * dM)
                MAmin = MA0 * (1 - 0.01 * dM)
                FMmin = MAmin / re_max
                v_min = FMmin * xx_xx / (AS * Rp)
                MAmax = MAmax + torque_add
                MAmin = MAmin + torque_add
                MA0 = MA0 + torque_add
            else:  # inserted
                if self_cal_type == '已知最大预紧力':
                    FMmax = float(self_condtion) * 1000
                    MAmax = FMmax * re_min
                    v_max = FMmax * xx_xx / (AS * Rp)
                    MA0 = MAmax * (1 - 0.01 * dM)
                    MAmin = MAmax * (1 - 0.02 * dM)
                    FMmin = MAmin / re_max
                    v_min = FMmin * xx_xx / (AS * Rp)
                    MAmax = MAmax + torque_add
                    MAmin = MAmin + torque_add
                    MA0 = MA0 + torque_add
                else:  # inserted
                    if self_cal_type == '已知额定扭矩':
                        MA0 = float(self_condtion) * 1000 - torque_add
                        MAmax = MA0 * (1 + 0.01 * dM)
                        FMmax = MAmax / re_min
                        v_max = FMmax * xx_xx / (AS * Rp)
                        MAmin = MA0 * (1 - 0.01 * dM)
                        FMmin = MAmin / re_max
                        v_min = FMmin * xx_xx / (AS * Rp)
                        MAmax = MAmax + torque_add
                        MAmin = MAmin + torque_add
                        MA0 = MA0 + torque_add
                    else:  # inserted
                        if self_cal_type == '已知最小扭矩':
                            MAmin = float(self_condtion) * 1000 - torque_add
                            MA0 = MAmin / (1 - 0.01 * dM)
                            MAmax = MA0 * (1 + 0.01 * dM)
                            FMmax = MAmax / re_min
                            v_max = FMmax * xx_xx / (AS * Rp)
                            FMmin = MAmin / re_max
                            v_min = FMmin * xx_xx / (AS * Rp)
                            MAmax = MAmax + torque_add
                            MAmin = MAmin + torque_add
                            MA0 = MA0 + torque_add
                        else:  # inserted
                            if self_cal_type == '已知最小预紧力':
                                FMmin = float(self_condtion) * 1000
                                MAmin = FMmin * re_max
                                MAmax = MAmin / (1 - 0.02 * dM)
                                FMmax = MAmax / re_min
                                v_max = FMmax * xx_xx / (AS * Rp)
                                MA0 = MAmax * (1 - 0.01 * dM)
                                v_min = FMmin * xx_xx / (AS * Rp)
                                MAmax = MAmax + torque_add
                                MAmin = MAmin + torque_add
                                MA0 = MA0 + torque_add
        if self_cal_type == '已知最小利用率':
            v_min = float(self_condtion) * 0.01
            FMmin = v_min * (AS * Rp) / xx_xx
            MAmin = FMmin * re_max
            MAmax = MAmin / (1 - 0.02 * dM)
            FMmax = MAmax / re_min
            MA0 = MAmax * (1 - 0.01 * dM)
            v_max = FMmax * xx_xx / (AS * Rp)
            MAmax = MAmax + torque_add
            MAmin = MAmin + torque_add
            MA0 = MA0 + torque_add
        self.lineEdit_5.setText(str(round(v_max * 100 * flage, 1)))
        self.lineEdit_8.setText(str(round(MAmax * 0.001 * flage, 2)))
        self.lineEdit_11.setText(str(round(FMmax * 0.001 * flage, 2)))
        self.lineEdit_6.setText(str(round(v_min * 100 * flage, 1)))
        self.lineEdit_9.setText(str(round(MAmin * 0.001 * flage, 2)))
        self.lineEdit_12.setText(str(round(FMmin * 0.001 * flage, 2)))
        if MA0 <= 50000:
            MA0_out = round(MA0 * 0.001, 1)
        else:  # inserted
            MA0_out = round(MA0 * 0.001)
        self.lineEdit_14.setText('  %s N.m ± %s %' % (str(MA0_out * flage), str(dM * flage)))

class FloatRangeValidator(QDoubleValidator):
    def __init__(self, bottom, top, parent=None):
        super().__init__()
        self.bottom = bottom
        self.top = top

    # def validate(self, input, pos):
    #     """\n        文本框设置了验证后,当内容发生改变时调用该方法\n        :param input: 文本框内容\n        :param pos: 光标位置\n        :return: 返回验证状态\n                 QValidator.Acceptable:验证通过\n                 QValidator.Intermediate:暂不验证,文本框失去焦点时调用fixup()方法进行验证\n                 QValidator.Invalid:验证不通过\n        """  # inserted
    #     try:
    #         if input == '-':
    #             return (QValidator.Intermediate, input, pos)
    #         if self.bottom <= float(input) <= self.top:
    #             if input[(-1)]!= '.':
    #                 return (QValidator.Acceptable, input, pos)
    #     except Exception as ep:
    #         else:  # inserted
    #             return (QValidator.Intermediate, input, pos)
    #         else:  # inserted
    #             if float(input) > self.top:
    #                 return (QValidator.Intermediate, input, pos)
    #         else:  # inserted
    #             return (QValidator.Intermediate, input, pos)
    #             if len(input) == 0:
    #                 return (QValidator.Intermediate, input, pos)
    #             return (QValidator.Invalid, input, pos)




    # def fixup(self, input: str):
    #     try:
    #         if float(input) > self.top:
    #             return str(self.top)
    #         if float(input) < self.bottom:
    #             return str(self.bottom)
    #     except:
    #         pass  # postinserted
    #     return str(self.bottom)
    #     else:  # inserted
    #         if input[(-1)] == '.':
    #             return input[:(-1)]

    def validate(self, input, pos):
    
        try:
            if input == '-':
                return (QValidator.Intermediate, input, pos)
            if self.bottom <= float(input) <= self.top:
                if input[-1] != '.':
                    return (QValidator.Acceptable, input, pos)
        except Exception as ep:
            return (QValidator.Intermediate, input, pos)
        else:
            if float(input) > self.top:
                return (QValidator.Intermediate, input, pos)
            elif float(input) < self.bottom:
                return (QValidator.Intermediate, input, pos)
            elif len(input) == 0:
                return (QValidator.Intermediate, input, pos)
            else:
                return (QValidator.Invalid, input, pos)

    def fixup(self, input: str):
        try:
            value = float(input)
            if value > self.top:
                return str(self.top)
            elif value < self.bottom:
                return str(self.bottom)
        except:
            pass  # 如果输入无法转换为浮点数,返回底部值
        return str(self.bottom) if input[-1] == '.' else input








if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon('./ico/bolttorque.png'))
    w = MyWindow()
    w.show()
    sys.exit(app.exec_())
moshouhot 发表于 2025-4-22 22:43
ycs 发表于 2025-4-23 10:08
这个工具需要cuda和torch支持,没有独立显卡的路过。
5151diy 发表于 2025-4-24 07:59
感谢楼主提供python 反编译哭喊,学习python好帮手
feiyuya 发表于 2025-4-24 21:25
感谢楼主,这个win系统怎么用
redapple2015 发表于 2025-12-11 09:53
ycs 发表于 2025-4-23 10:08
这个工具需要cuda和torch支持,没有独立显卡的路过。

我在windown下安装后无法翻译出代码
广东六少 发表于 2026-3-22 02:47
似乎不行编译出来的源码是0kb大的
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-10-24 03:18

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表