crytic_compile.platform.types
Handle the platform type
1""" 2Handle the platform type 3""" 4 5from enum import IntEnum 6 7 8class Type(IntEnum): 9 """ 10 Represent the different platform 11 """ 12 13 NOT_IMPLEMENTED = 0 14 SOLC = 1 15 TRUFFLE = 2 16 EMBARK = 3 17 DAPP = 4 18 ETHERLIME = 5 19 ETHERSCAN = 6 20 VYPER = 7 21 WAFFLE = 8 22 BROWNIE = 9 23 SOLC_STANDARD_JSON = 10 24 BUILDER = 11 25 HARDHAT = 11 26 FOUNDRY = 12 27 28 STANDARD = 100 29 ARCHIVE = 101 30 31 def __str__(self) -> str: # pylint: disable=too-many-branches 32 """Return a string representation 33 34 Raises: 35 ValueError: If the type is missing in __str__ (it should not happen) 36 37 Returns: 38 str: string representation 39 """ 40 if self == Type.SOLC: 41 return "solc" 42 if self == Type.SOLC_STANDARD_JSON: 43 return "solc_standard_json" 44 if self == Type.TRUFFLE: 45 return "Truffle" 46 if self == Type.EMBARK: 47 return "Embark" 48 if self == Type.DAPP: 49 return "Dapp" 50 if self == Type.ETHERLIME: 51 return "Etherlime" 52 if self == Type.ETHERSCAN: 53 return "Etherscan" 54 if self == Type.STANDARD: 55 return "Standard" 56 if self == Type.ARCHIVE: 57 return "Archive" 58 if self == Type.VYPER: 59 return "Vyper" 60 if self == Type.WAFFLE: 61 return "Waffle" 62 if self == Type.BUILDER: 63 return "Builder" 64 if self == Type.BROWNIE: 65 return "Browner" 66 if self == Type.FOUNDRY: 67 return "Foundry" 68 raise ValueError 69 70 def priority(self) -> int: 71 """Return the priority for a certain platform. 72 73 A lower priority means the platform is more preferable. This is used to 74 consistently select a platform when two or more are available. 75 76 Returns: 77 int: priority number 78 """ 79 80 if self == Type.FOUNDRY: 81 return 100 82 83 if self == Type.HARDHAT: 84 return 200 85 86 if self in [Type.TRUFFLE, Type.WAFFLE]: 87 return 300 88 89 return 1000
class
Type(enum.IntEnum):
9class Type(IntEnum): 10 """ 11 Represent the different platform 12 """ 13 14 NOT_IMPLEMENTED = 0 15 SOLC = 1 16 TRUFFLE = 2 17 EMBARK = 3 18 DAPP = 4 19 ETHERLIME = 5 20 ETHERSCAN = 6 21 VYPER = 7 22 WAFFLE = 8 23 BROWNIE = 9 24 SOLC_STANDARD_JSON = 10 25 BUILDER = 11 26 HARDHAT = 11 27 FOUNDRY = 12 28 29 STANDARD = 100 30 ARCHIVE = 101 31 32 def __str__(self) -> str: # pylint: disable=too-many-branches 33 """Return a string representation 34 35 Raises: 36 ValueError: If the type is missing in __str__ (it should not happen) 37 38 Returns: 39 str: string representation 40 """ 41 if self == Type.SOLC: 42 return "solc" 43 if self == Type.SOLC_STANDARD_JSON: 44 return "solc_standard_json" 45 if self == Type.TRUFFLE: 46 return "Truffle" 47 if self == Type.EMBARK: 48 return "Embark" 49 if self == Type.DAPP: 50 return "Dapp" 51 if self == Type.ETHERLIME: 52 return "Etherlime" 53 if self == Type.ETHERSCAN: 54 return "Etherscan" 55 if self == Type.STANDARD: 56 return "Standard" 57 if self == Type.ARCHIVE: 58 return "Archive" 59 if self == Type.VYPER: 60 return "Vyper" 61 if self == Type.WAFFLE: 62 return "Waffle" 63 if self == Type.BUILDER: 64 return "Builder" 65 if self == Type.BROWNIE: 66 return "Browner" 67 if self == Type.FOUNDRY: 68 return "Foundry" 69 raise ValueError 70 71 def priority(self) -> int: 72 """Return the priority for a certain platform. 73 74 A lower priority means the platform is more preferable. This is used to 75 consistently select a platform when two or more are available. 76 77 Returns: 78 int: priority number 79 """ 80 81 if self == Type.FOUNDRY: 82 return 100 83 84 if self == Type.HARDHAT: 85 return 200 86 87 if self in [Type.TRUFFLE, Type.WAFFLE]: 88 return 300 89 90 return 1000
Represent the different platform
NOT_IMPLEMENTED =
<Type.NOT_IMPLEMENTED: 0>
SOLC =
<Type.SOLC: 1>
TRUFFLE =
<Type.TRUFFLE: 2>
EMBARK =
<Type.EMBARK: 3>
DAPP =
<Type.DAPP: 4>
ETHERLIME =
<Type.ETHERLIME: 5>
ETHERSCAN =
<Type.ETHERSCAN: 6>
VYPER =
<Type.VYPER: 7>
WAFFLE =
<Type.WAFFLE: 8>
BROWNIE =
<Type.BROWNIE: 9>
SOLC_STANDARD_JSON =
<Type.SOLC_STANDARD_JSON: 10>
BUILDER =
<Type.BUILDER: 11>
HARDHAT =
<Type.BUILDER: 11>
FOUNDRY =
<Type.FOUNDRY: 12>
STANDARD =
<Type.STANDARD: 100>
ARCHIVE =
<Type.ARCHIVE: 101>
def
priority(self) -> int:
71 def priority(self) -> int: 72 """Return the priority for a certain platform. 73 74 A lower priority means the platform is more preferable. This is used to 75 consistently select a platform when two or more are available. 76 77 Returns: 78 int: priority number 79 """ 80 81 if self == Type.FOUNDRY: 82 return 100 83 84 if self == Type.HARDHAT: 85 return 200 86 87 if self in [Type.TRUFFLE, Type.WAFFLE]: 88 return 300 89 90 return 1000
Return the priority for a certain platform.
A lower priority means the platform is more preferable. This is used to consistently select a platform when two or more are available.
Returns: int: priority number
Inherited Members
- enum.Enum
- name
- value
- builtins.int
- conjugate
- bit_length
- to_bytes
- from_bytes
- as_integer_ratio
- real
- imag
- numerator
- denominator