Package EasyExtend :: Package util :: Module hexobject :: Class Hex
[hide private]
[frames] | no frames]

Class Hex

object --+    
         |    
  HexOrBin --+
             |
            Hex

Generic hexadecimal object.

Hex() -> None HEX(0x7889) -> "78 89..." HEX("78FF...") -> "78 FF... HEX("78 FF...") -> "78 FF...

Instance Methods [hide private]
 
__init__(self, data=None, format=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
_trans_str(self, s)
 
_trans_int(self, n)
 
__call__(self)
 
ascii(self)
Returns hex object as ASCII - string.
 
num(self)
 
__len__(self)
 
buffer(self)
 
sc(self)
 
sw(self, n)
 
spath(self)
Returns:
 
bits(self)
 
binary(self)
 
reverse(self)
 
digits(self)
The digits method returns a generator that iterates over the digits of this Hex object.
 
swapped(self)
 
__nonzero__(self)
 
__neg__(self)
 
__radd__(self, hNbr)
 
__add__(self, hNbr)
 
__rmul__(self, hNbr)
 
__mul__(self, hNbr)
 
__rxor__(self, hNbr)
 
__xor__(self, hNbr)
 
__rsub__(self, hNbr)
 
__mod__(self, hNbr)
 
__rshift__(self, hNbr)
 
__lshift__(self, arg)
 
__sub__(self, hNbr)
 
__rdiv__(self, hNbr)
 
__div__(self, hNbr)
 
__floordiv__(self, hNbr)
 
__rfloordiv__(self, hNbr)
 
__or__(self, hNbr)
 
__and__(self, hNbr)
 
__eq__(self, hNbr)
 
__ne__(self, hNbr)
 
__lt__(self, other)
 
__gt__(self, other)
 
__le__(self, other)
 
__ge__(self, other)
 
__getitem__(self, i)
 
__getslice__(self, i, j)
 
__setitem__(self, i, val)
 
__setslice__(self, i, j, val)
 
split(self, part_len)
 
pad(self, n, value)
 
concat(self, hNbr, binoffset=0, bits=0)
 
rest(self, byteoffset, binoffset)
 
byte(self, byteoffset, binoffset)
 
section(self, byteoffset, binoffset, n, bit=False)
 
shuffle(self)
 
unshuffle(self)
 
xor_check(self)
 
__repr__(self)
repr(x)
 
__pos__(self)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Methods [hide private]
 
from_bytes(cls, *bytes)
 
from_string(cls, s)
 
as_decimal(cls, s)
 
from_decimal(cls, s)
Function converts from decimal into a hex.
Class Variables [hide private]
  F_STD = 0
  F_0x = 1
  F_OBJ = 2
  F_CP = 3
  F_CP_0x = 4
  F_ASCII = 5
  format = 1
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, data=None, format=None)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

from_decimal(cls, s)
Class Method

 

Function converts from decimal into a hex.

>>> Hex.from_decimal("255")
FF

from_decimal acts the same like Hex(int(s))

Parameters:
  • s (string/int.) - input string or int ( may contain only decimal digits )

spath(self)

 

__lshift__(self, arg)

 
Decorators:
  • @patch0

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)