from primitive_pb2 import Amount, uint256

UINT64_NUMBER = int(18446744073709551616)

def amount_to_int(amount):
    """
    Translater Protobuf Amount -> python int type
    Args:
        amount ( `Amount` ) : protobuf amount type ( don't care precision )
    Returns:
        int: int value equal to arg amount.
    """
    logger.debug("amount2int")
    res = int(0)
    res += int(amount.value.first)
    res *= UINT64_NUMBER
    logger.debug(res)
    res += int(amount.value.second)
    res *= UINT64_NUMBER
    logger.debug(res)
    res += int(amount.value.third)
    res *= UINT64_NUMBER
    logger.debug(res)
    res += int(amount.value.fourth)
    return res


def int_to_amount(int_num,precision=0):
    """
    Translater python int type -> Protobuf Amount
    Args:
        int_num ( int ): integer amount value ( python supportes Multiple precision )
        precision (int): precision value ( if you are client-side, you don't care )
    Returns:
        `Amount`: protobuf Amount structure equal to int_num
    """
    logger.debug("int2amount")
    value = uint256()
    value.fourth = int(int_num % UINT64_NUMBER)
    int_num //= UINT64_NUMBER
    value.third = int(int_num % UINT64_NUMBER)
    int_num //= UINT64_NUMBER
    value.second = int(int_num % UINT64_NUMBER)
    int_num //= UINT64_NUMBER
    value.first = int(int_num)
    return Amount(
        value = value,
        precision = precision
    )


@@ -319,39 +319,8 @@
 %22%22%22%0A
-    logger.debug(%22amount2int%22)%0A
     
@@ -332,16 +332,16 @@
  int(0)%0A
+
     res 
@@ -392,38 +392,16 @@
 _NUMBER%0A
-    logger.debug(res)%0A
     res 
@@ -453,38 +453,16 @@
 _NUMBER%0A
-    logger.debug(res)%0A
     res 
@@ -488,16 +488,16 @@
 .third)%0A
+
     res 
@@ -517,30 +517,8 @@
 BER%0A
-    logger.debug(res)%0A
     
@@ -930,39 +930,8 @@
 %22%22%22%0A
-    logger.debug(%22int2amount%22)%0A
     

remove logger