Source code for pysqllike.generic.others_types

"""
defines custom types


:githublink:`%|py|5`
"""


[docs]class long: """ Defines the long type as int. :githublink:`%|py|11` """
[docs] def __init__(self, v): self._v = int(v)
[docs] def __mul__(self, y): return long(self._v * y._v)
[docs] def __add__(self, y): return long(self._v + y._v)
[docs] def __sub__(self, y): return long(self._v - y._v)
[docs] def __div__(self, y): return long(self._v / y._v)
[docs] def __str__(self): return "%d" % self._v
[docs] def __int__(self): return self._v
[docs] def __float__(self): return float(self._v)
[docs]class NA: """ Defines the missing type. :githublink:`%|py|42` """
[docs] def __init__(self): pass
[docs] def __mul__(self, y): return NA()
[docs] def __add__(self, y): return NA()
[docs] def __sub__(self, y): return NA()
[docs] def __div__(self, y): return NA()
[docs]class EmptyGroup: """ defines an empty group :githublink:`%|py|64` """
[docs] def __init__(self): pass
[docs]class NoSortClass: """ Container which overloads the sort operator to return 0 all the times. :githublink:`%|py|74` """
[docs] def __init__(self, value): """ any value :githublink:`%|py|79` """ self.value = value
[docs] def __lt__(self, o): """ operator __lt__ :githublink:`%|py|85` """ return -1
[docs] def __str__(self): """ usual :githublink:`%|py|91` """ return "NSC:{0}".format(str(self.value))
[docs]class GroupByContainer (list): """ to differiate between a list and a list introduced by a groupby :githublink:`%|py|99` """ pass