Skip to content

Commit

Permalink
Add constants to search plugin, with good lint (#1125)
Browse files Browse the repository at this point in the history
* Add constants to search plugin, with good lint
  • Loading branch information
mahaloz authored Nov 16, 2023
1 parent 9bc1722 commit 49ceae6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions angrmanagement/plugins/value_search/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
import math

# Error computation
MACHINE_EPSILON_DOUBLE_PRECISION = 2.2204460493E-16
MACHINE_EPSILON_SINGLE_PRECISION = 1.1920928955E-07
MACHINE_EPSILON_DOUBLE_PRECISION = 2.2204460493e-16
MACHINE_EPSILON_SINGLE_PRECISION = 1.1920928955e-07

# Math
PI = math.pi
E = math.e

# Physics
SPEED_OF_LIGHT = 299792458
PLANCK_CONSTANT = 6.62607004E-34
GRAVITATIONAL_CONSTANT = 6.67408E-11
ELEMENTARY_CHARGE = 1.6021766208E-19
BOLTZMANN_CONSTANT = 1.38064852E-23
AVOGADRO_CONSTANT = 6.022140857E23
PLANCK_CONSTANT = 6.62607004e-34
GRAVITATIONAL_CONSTANT = 6.67408e-11
ELEMENTARY_CHARGE = 1.6021766208e-19
BOLTZMANN_CONSTANT = 1.38064852e-23
AVOGADRO_CONSTANT = 6.022140857e23

# Computation
MAX_INT32 = 2147483647
MAX_INT64 = 9223372036854775807
MAX_UINT32 = 4294967295
MAX_UINT64 = 18446744073709551615
MAX_FLOAT32 = 3.40282347E38
MAX_FLOAT64 = 1.7976931348623157E308

MAX_FLOAT32 = 3.40282347e38
MAX_FLOAT64 = 1.7976931348623157e308

# All consts
CONSTANTS_BY_NAME = {
"": None,
"Machine Epsilon (Double Precision)": MACHINE_EPSILON_DOUBLE_PRECISION,
Expand All @@ -39,4 +39,4 @@
"Speed of Light": SPEED_OF_LIGHT,
"Pi": PI,
"E": E,
}
}
4 changes: 2 additions & 2 deletions angrmanagement/plugins/value_search/search_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from angrmanagement.ui.views.view import BaseView

from .qsearch_table import QSearchTable
from .constants import CONSTANTS_BY_NAME
from .qsearch_table import QSearchTable

if TYPE_CHECKING:
from angr.knowledge_plugins.cfg.memory_data import MemoryData
Expand Down Expand Up @@ -116,4 +116,4 @@ def _init_widgets(self):
def _on_constants_changed(self, value):
constant_val = CONSTANTS_BY_NAME.get(value, None)
if constant_val is not None:
self._filter_string.setText(str(constant_val))
self._filter_string.setText(str(constant_val))

0 comments on commit 49ceae6

Please sign in to comment.