index
int64 0
731k
| package
stringlengths 2
98
⌀ | name
stringlengths 1
76
| docstring
stringlengths 0
281k
⌀ | code
stringlengths 4
1.07M
⌀ | signature
stringlengths 2
42.8k
⌀ |
---|---|---|---|---|---|
43,336 |
mo_dots.objects
|
DataObject
|
TREAT AN OBJECT LIKE DATA
|
class DataObject(Mapping):
"""
TREAT AN OBJECT LIKE DATA
"""
__slots__ = [SLOT]
def __init__(self, obj):
_set(self, SLOT, obj)
def __getattr__(self, item):
obj = _get(self, SLOT)
output = get_attr(obj, item)
return object_to_data(output)
def __setattr__(self, key, value):
obj = _get(self, SLOT)
set_attr(obj, key, value)
def __getitem__(self, item):
obj = _get(self, SLOT)
output = get_attr(obj, item)
return object_to_data(output)
def __or__(self, other):
return set_default({}, self, other)
def __ror__(self, other):
return to_data(other) | self
def __add__(self, other):
return to_data(_iadd(_iadd({}, self), other))
def __radd__(self, other):
return to_data(_iadd(_iadd({}, other), self))
def get(self, item):
obj = _get(self, SLOT)
output = get_attr(obj, item)
return object_to_data(output)
def keys(self):
return get_keys(self)
def items(self):
keys = self.keys()
try:
for k in keys:
yield k, self[k]
except Exception as cause:
get_logger().error("problem with items", cause=cause)
def __deepcopy__(self, memodict={}):
output = {}
for k, v in self.items():
output[k] = from_data(deepcopy(v))
return dict_to_data(output)
def __data__(self):
return self
def __iter__(self):
return (k for k in self.keys())
def __str__(self):
obj = _get(self, SLOT)
return str(obj)
def __len__(self):
obj = _get(self, SLOT)
return len(obj)
def __call__(self, *args, **kwargs):
obj = _get(self, SLOT)
return obj(*args, **kwargs)
|
(obj)
|
43,337 |
mo_dots.objects
|
__add__
| null |
def __add__(self, other):
return to_data(_iadd(_iadd({}, self), other))
|
(self, other)
|
43,338 |
mo_dots.objects
|
__call__
| null |
def __call__(self, *args, **kwargs):
obj = _get(self, SLOT)
return obj(*args, **kwargs)
|
(self, *args, **kwargs)
|
43,340 |
mo_dots.objects
|
__data__
| null |
def __data__(self):
return self
|
(self)
|
43,341 |
mo_dots.objects
|
__deepcopy__
| null |
def __deepcopy__(self, memodict={}):
output = {}
for k, v in self.items():
output[k] = from_data(deepcopy(v))
return dict_to_data(output)
|
(self, memodict={})
|
43,343 |
mo_dots.objects
|
__getattr__
| null |
def __getattr__(self, item):
obj = _get(self, SLOT)
output = get_attr(obj, item)
return object_to_data(output)
|
(self, item)
|
43,344 |
mo_dots.objects
|
__getitem__
| null |
def __getitem__(self, item):
obj = _get(self, SLOT)
output = get_attr(obj, item)
return object_to_data(output)
|
(self, item)
|
43,345 |
mo_dots.objects
|
__init__
| null |
def __init__(self, obj):
_set(self, SLOT, obj)
|
(self, obj)
|
43,346 |
mo_dots.objects
|
__iter__
| null |
def __iter__(self):
return (k for k in self.keys())
|
(self)
|
43,347 |
mo_dots.objects
|
__len__
| null |
def __len__(self):
obj = _get(self, SLOT)
return len(obj)
|
(self)
|
43,348 |
mo_dots.objects
|
__or__
| null |
def __or__(self, other):
return set_default({}, self, other)
|
(self, other)
|
43,349 |
mo_dots.objects
|
__radd__
| null |
def __radd__(self, other):
return to_data(_iadd(_iadd({}, other), self))
|
(self, other)
|
43,350 |
mo_dots.objects
|
__ror__
| null |
def __ror__(self, other):
return to_data(other) | self
|
(self, other)
|
43,351 |
mo_dots.objects
|
__setattr__
| null |
def __setattr__(self, key, value):
obj = _get(self, SLOT)
set_attr(obj, key, value)
|
(self, key, value)
|
43,352 |
mo_dots.objects
|
__str__
| null |
def __str__(self):
obj = _get(self, SLOT)
return str(obj)
|
(self)
|
43,353 |
mo_dots.objects
|
get
| null |
def get(self, item):
obj = _get(self, SLOT)
output = get_attr(obj, item)
return object_to_data(output)
|
(self, item)
|
43,354 |
mo_dots.objects
|
items
| null |
def items(self):
keys = self.keys()
try:
for k in keys:
yield k, self[k]
except Exception as cause:
get_logger().error("problem with items", cause=cause)
|
(self)
|
43,355 |
mo_dots.objects
|
keys
| null |
def keys(self):
return get_keys(self)
|
(self)
|
43,358 |
mo_dots.lists
|
FlatList
|
ENCAPSULATES HANDING OF Nulls BY wrapING ALL MEMBERS AS NEEDED
ENCAPSULATES FLAT SLICES ([::]) FOR USE IN WINDOW FUNCTIONS
https://github.com/klahnakoski/mo-dots/tree/dev/docs#flatlist-is-flat
|
class FlatList(object):
"""
ENCAPSULATES HANDING OF Nulls BY wrapING ALL MEMBERS AS NEEDED
ENCAPSULATES FLAT SLICES ([::]) FOR USE IN WINDOW FUNCTIONS
https://github.com/klahnakoski/mo-dots/tree/dev/docs#flatlist-is-flat
"""
__slots__ = [SLOT]
def __init__(self, vals=None):
""" USE THE vals, NOT A COPY """
# list.__init__(self)
if is_null(vals):
_set(self, SLOT, [])
elif _get(vals, CLASS) is FlatList:
_set(self, SLOT, vals.list)
else:
_set(self, SLOT, vals)
def __getitem__(self, index):
if index == ".":
return self
if _get(index, CLASS) is slice:
# IMPLEMENT FLAT SLICES (for i not in range(0, len(self)): assert self[i]==None)
if index.step is not None:
Log.error("slice step must be None, do not know how to deal with values")
length = len(_get(self, SLOT))
i = index.start
if i is None:
i = 0
else:
i = min(max(i, 0), length)
j = index.stop
if j is None:
j = length
else:
j = max(min(j, length), 0)
return FlatList(_get(self, SLOT)[i:j])
if not isinstance(index, int) or index < 0 or len(_get(self, SLOT)) <= index:
return Null
return to_data(_get(self, SLOT)[index])
def __setitem__(self, key, value):
_list = _get(self, SLOT)
if isinstance(key, int):
if key >= len(_list):
_list.extend([None] * (key - len(_list) + 1))
_list[key] = from_data(value)
return
for v in _list:
to_data(v)[key] = value
return
def __setattr__(self, key, value):
_list = _get(self, SLOT)
for v in _list:
to_data(v)[key] = value
return
def __getattr__(self, key):
if key in ["__json__", "__call__"]:
raise AttributeError()
return FlatList.get(self, key)
def get(self, key):
"""
simple `select`
"""
if key == ".":
output = []
for v in _get(self, SLOT):
if is_many(v):
element = from_data(object_to_data(v).get(key))
output.extend(element)
else:
output.append(from_data(v))
return list_to_data(output)
output = []
for v in _get(self, SLOT):
element = from_data(get_attr(to_data(v), key))
if is_missing(element):
continue
elif is_many(element):
output.extend(element)
else:
output.append(element)
return list_to_data(output)
def select(self, key):
Log.error("Not supported. Use `get()`")
def filter(self, _filter):
return list_to_data([from_data(u) for u in _get(self, SLOT) if _filter(to_data(u))])
def map(self, oper, includeNone=True):
if includeNone:
return FlatList([oper(v) for v in _get(self, SLOT)])
else:
return FlatList([oper(v) for v in _get(self, SLOT) if v != None])
def to_list(self):
return _get(self, SLOT)
def __delitem__(self, i):
del _get(self, SLOT)[i]
def clear(self):
_set(self, SLOT, [])
def __iter__(self):
temp = [to_data(v) for v in _get(self, SLOT)]
return iter(temp)
def __contains__(self, item):
return list.__contains__(_get(self, SLOT), item)
def append(self, val):
_get(self, SLOT).append(from_data(val))
return self
def __str__(self):
return str(_get(self, SLOT))
def __repr__(self):
return f"to_data({repr(_get(self, SLOT))})"
def __len__(self):
return _get(self, SLOT).__len__()
def copy(self):
return FlatList(list(_get(self, SLOT)))
def __copy__(self):
return FlatList(list(_get(self, SLOT)))
def __deepcopy__(self, memo):
d = _get(self, SLOT)
return to_data(deepcopy(d, memo))
def remove(self, x):
_get(self, SLOT).remove(x)
return self
def extend(self, values):
lst = _get(self, SLOT)
for v in values:
lst.append(from_data(v))
return self
def pop(self, index=None):
if index is None:
return to_data(_get(self, SLOT).pop())
else:
return to_data(_get(self, SLOT).pop(index))
def __hash__(self):
lst = _get(self, SLOT)
if not lst:
return _null_hash
return hash_value(lst[0])
def __eq__(self, other):
lst = _get(self, SLOT)
if other is None:
return False
try:
if len(lst) != len(other):
return False
return all([s == o for s, o in zip(lst, other)])
except Exception:
return False
def __ne__(self, other):
return not self.__eq__(other)
def __add__(self, other):
output = list(_get(self, SLOT))
if is_null(other):
return self
elif is_many(other):
output.extend(from_data(other))
else:
output.append(other)
return FlatList(vals=output)
__or__ = __add__
def __radd__(self, other):
output = list(_get(self, SLOT))
if is_null(other):
return self
elif is_many(other):
output = list(from_data(other)) + output
else:
output = [other] + output
return FlatList(vals=output)
def __iadd__(self, other):
if is_null(other):
return self
elif is_many(other):
self.extend(from_data(other))
else:
self.append(other)
return self
def right(self, num):
"""
WITH SLICES BEING FLAT, WE NEED A SIMPLE WAY TO SLICE FROM THE RIGHT [-num:]
"""
if is_null(num):
return self
if num <= 0:
return Null
return FlatList(_get(self, SLOT)[-num:])
def limit(self, num):
"""
NOT REQUIRED, BUT EXISTS AS OPPOSITE OF right()
"""
if is_null(num):
return self
if num <= 0:
return Null
return FlatList(_get(self, SLOT)[:num])
left = limit
def not_right(self, num):
"""
WITH SLICES BEING FLAT, WE NEED A SIMPLE WAY TO SLICE FROM THE LEFT [:-num:]
"""
if not num:
return self
if num < 0:
return self
return FlatList(_get(self, SLOT)[:-num:])
def not_left(self, num):
"""
NOT REQUIRED, EXISTS AS OPPOSITE OF not_right()
"""
if not num:
return self
if num < 0:
return self
return FlatList(_get(self, SLOT)[num::])
def last(self):
"""
RETURN LAST ELEMENT IN FlatList [-1]
"""
lst = _get(self, SLOT)
if lst:
return to_data(lst[-1])
return Null
|
(vals=None)
|
43,359 |
mo_dots.lists
|
__add__
| null |
def __add__(self, other):
output = list(_get(self, SLOT))
if is_null(other):
return self
elif is_many(other):
output.extend(from_data(other))
else:
output.append(other)
return FlatList(vals=output)
|
(self, other)
|
43,360 |
mo_dots.lists
|
__contains__
| null |
def __contains__(self, item):
return list.__contains__(_get(self, SLOT), item)
|
(self, item)
|
43,361 |
mo_dots.lists
|
__copy__
| null |
def __copy__(self):
return FlatList(list(_get(self, SLOT)))
|
(self)
|
43,363 |
mo_dots.lists
|
__delitem__
| null |
def __delitem__(self, i):
del _get(self, SLOT)[i]
|
(self, i)
|
43,364 |
mo_dots.lists
|
__eq__
| null |
def __eq__(self, other):
lst = _get(self, SLOT)
if other is None:
return False
try:
if len(lst) != len(other):
return False
return all([s == o for s, o in zip(lst, other)])
except Exception:
return False
|
(self, other)
|
43,365 |
mo_dots.lists
|
__getattr__
| null |
def __getattr__(self, key):
if key in ["__json__", "__call__"]:
raise AttributeError()
return FlatList.get(self, key)
|
(self, key)
|
43,366 |
mo_dots.lists
|
__getitem__
| null |
def __getitem__(self, index):
if index == ".":
return self
if _get(index, CLASS) is slice:
# IMPLEMENT FLAT SLICES (for i not in range(0, len(self)): assert self[i]==None)
if index.step is not None:
Log.error("slice step must be None, do not know how to deal with values")
length = len(_get(self, SLOT))
i = index.start
if i is None:
i = 0
else:
i = min(max(i, 0), length)
j = index.stop
if j is None:
j = length
else:
j = max(min(j, length), 0)
return FlatList(_get(self, SLOT)[i:j])
if not isinstance(index, int) or index < 0 or len(_get(self, SLOT)) <= index:
return Null
return to_data(_get(self, SLOT)[index])
|
(self, index)
|
43,367 |
mo_dots.lists
|
__hash__
| null |
def __hash__(self):
lst = _get(self, SLOT)
if not lst:
return _null_hash
return hash_value(lst[0])
|
(self)
|
43,368 |
mo_dots.lists
|
__iadd__
| null |
def __iadd__(self, other):
if is_null(other):
return self
elif is_many(other):
self.extend(from_data(other))
else:
self.append(other)
return self
|
(self, other)
|
43,369 |
mo_dots.lists
|
__init__
|
USE THE vals, NOT A COPY
|
def __init__(self, vals=None):
""" USE THE vals, NOT A COPY """
# list.__init__(self)
if is_null(vals):
_set(self, SLOT, [])
elif _get(vals, CLASS) is FlatList:
_set(self, SLOT, vals.list)
else:
_set(self, SLOT, vals)
|
(self, vals=None)
|
43,370 |
mo_dots.lists
|
__iter__
| null |
def __iter__(self):
temp = [to_data(v) for v in _get(self, SLOT)]
return iter(temp)
|
(self)
|
43,371 |
mo_dots.lists
|
__len__
| null |
def __len__(self):
return _get(self, SLOT).__len__()
|
(self)
|
43,374 |
mo_dots.lists
|
__radd__
| null |
def __radd__(self, other):
output = list(_get(self, SLOT))
if is_null(other):
return self
elif is_many(other):
output = list(from_data(other)) + output
else:
output = [other] + output
return FlatList(vals=output)
|
(self, other)
|
43,375 |
mo_dots.lists
|
__repr__
| null |
def __repr__(self):
return f"to_data({repr(_get(self, SLOT))})"
|
(self)
|
43,376 |
mo_dots.lists
|
__setattr__
| null |
def __setattr__(self, key, value):
_list = _get(self, SLOT)
for v in _list:
to_data(v)[key] = value
return
|
(self, key, value)
|
43,377 |
mo_dots.lists
|
__setitem__
| null |
def __setitem__(self, key, value):
_list = _get(self, SLOT)
if isinstance(key, int):
if key >= len(_list):
_list.extend([None] * (key - len(_list) + 1))
_list[key] = from_data(value)
return
for v in _list:
to_data(v)[key] = value
return
|
(self, key, value)
|
43,379 |
mo_dots.lists
|
append
| null |
def append(self, val):
_get(self, SLOT).append(from_data(val))
return self
|
(self, val)
|
43,380 |
mo_dots.lists
|
clear
| null |
def clear(self):
_set(self, SLOT, [])
|
(self)
|
43,381 |
mo_dots.lists
|
copy
| null |
def copy(self):
return FlatList(list(_get(self, SLOT)))
|
(self)
|
43,382 |
mo_dots.lists
|
extend
| null |
def extend(self, values):
lst = _get(self, SLOT)
for v in values:
lst.append(from_data(v))
return self
|
(self, values)
|
43,383 |
mo_dots.lists
|
filter
| null |
def filter(self, _filter):
return list_to_data([from_data(u) for u in _get(self, SLOT) if _filter(to_data(u))])
|
(self, _filter)
|
43,384 |
mo_dots.lists
|
get
|
simple `select`
|
def get(self, key):
"""
simple `select`
"""
if key == ".":
output = []
for v in _get(self, SLOT):
if is_many(v):
element = from_data(object_to_data(v).get(key))
output.extend(element)
else:
output.append(from_data(v))
return list_to_data(output)
output = []
for v in _get(self, SLOT):
element = from_data(get_attr(to_data(v), key))
if is_missing(element):
continue
elif is_many(element):
output.extend(element)
else:
output.append(element)
return list_to_data(output)
|
(self, key)
|
43,385 |
mo_dots.lists
|
last
|
RETURN LAST ELEMENT IN FlatList [-1]
|
def last(self):
"""
RETURN LAST ELEMENT IN FlatList [-1]
"""
lst = _get(self, SLOT)
if lst:
return to_data(lst[-1])
return Null
|
(self)
|
43,386 |
mo_dots.lists
|
limit
|
NOT REQUIRED, BUT EXISTS AS OPPOSITE OF right()
|
def limit(self, num):
"""
NOT REQUIRED, BUT EXISTS AS OPPOSITE OF right()
"""
if is_null(num):
return self
if num <= 0:
return Null
return FlatList(_get(self, SLOT)[:num])
|
(self, num)
|
43,388 |
mo_dots.lists
|
map
| null |
def map(self, oper, includeNone=True):
if includeNone:
return FlatList([oper(v) for v in _get(self, SLOT)])
else:
return FlatList([oper(v) for v in _get(self, SLOT) if v != None])
|
(self, oper, includeNone=True)
|
43,389 |
mo_dots.lists
|
not_left
|
NOT REQUIRED, EXISTS AS OPPOSITE OF not_right()
|
def not_left(self, num):
"""
NOT REQUIRED, EXISTS AS OPPOSITE OF not_right()
"""
if not num:
return self
if num < 0:
return self
return FlatList(_get(self, SLOT)[num::])
|
(self, num)
|
43,390 |
mo_dots.lists
|
not_right
|
WITH SLICES BEING FLAT, WE NEED A SIMPLE WAY TO SLICE FROM THE LEFT [:-num:]
|
def not_right(self, num):
"""
WITH SLICES BEING FLAT, WE NEED A SIMPLE WAY TO SLICE FROM THE LEFT [:-num:]
"""
if not num:
return self
if num < 0:
return self
return FlatList(_get(self, SLOT)[:-num:])
|
(self, num)
|
43,391 |
mo_dots.lists
|
pop
| null |
def pop(self, index=None):
if index is None:
return to_data(_get(self, SLOT).pop())
else:
return to_data(_get(self, SLOT).pop(index))
|
(self, index=None)
|
43,392 |
mo_dots.lists
|
remove
| null |
def remove(self, x):
_get(self, SLOT).remove(x)
return self
|
(self, x)
|
43,393 |
mo_dots.lists
|
right
|
WITH SLICES BEING FLAT, WE NEED A SIMPLE WAY TO SLICE FROM THE RIGHT [-num:]
|
def right(self, num):
"""
WITH SLICES BEING FLAT, WE NEED A SIMPLE WAY TO SLICE FROM THE RIGHT [-num:]
"""
if is_null(num):
return self
if num <= 0:
return Null
return FlatList(_get(self, SLOT)[-num:])
|
(self, num)
|
43,394 |
mo_dots.lists
|
select
| null |
def select(self, key):
Log.error("Not supported. Use `get()`")
|
(self, key)
|
43,395 |
mo_dots.lists
|
to_list
| null |
def to_list(self):
return _get(self, SLOT)
|
(self)
|
43,413 |
mo_dots.nones
|
NullType
|
Structural Null provides closure under the dot (.) operator
Null[x] == Null
Null.x == Null
Null INSTANCES WILL TRACK THEIR OWN DEREFERENCE PATH SO
ASSIGNMENT CAN BE DONE
|
class NullType(object):
"""
Structural Null provides closure under the dot (.) operator
Null[x] == Null
Null.x == Null
Null INSTANCES WILL TRACK THEIR OWN DEREFERENCE PATH SO
ASSIGNMENT CAN BE DONE
"""
__slots__ = [SLOT, KEY]
def __init__(self, obj=None, key=None):
"""
obj - VALUE BEING DEREFERENCED
key - THE dict ITEM REFERENCE (DOT(.) IS NOT ESCAPED)
"""
_set(self, SLOT, obj)
_set(self, KEY, key)
def __bool__(self):
return False
__nonzero__ = __bool__
def __add__(self, other):
if is_sequence(other):
return other
return Null
def __radd__(self, other):
if is_sequence(other):
return other
return Null
def __call__(self, *args, **kwargs):
return Null
def __iadd__(self, other):
o = _get(self, SLOT)
if o is None:
return self
key = _get(self, KEY)
_assign_to_null(o, [key], other)
return other
def __sub__(self, other):
return Null
def __rsub__(self, other):
return Null
def __neg__(self):
return Null
def __mul__(self, other):
return Null
def __rmul__(self, other):
return Null
def __int__(self):
return None
def __float__(self):
return float("nan")
def __div__(self, other):
return Null
def __itruediv__(self, other):
return Null
def __rdiv__(self, other):
return Null
def __truediv__(self, other):
return Null
def __floordiv__(self, other):
return Null
def __rfloordiv__(self, other):
return Null
def __rtruediv__(self, other):
return Null
def __gt__(self, other):
return Null
def __ge__(self, other):
return Null
def __le__(self, other):
return Null
def __lt__(self, other):
return Null
def __eq__(self, other):
if is_sequence(other) and not other:
return True
if is_null(other):
return True
else:
return Null
def __ne__(self, other):
if is_missing(other):
return False
else:
return Null
def __or__(self, other):
return other
def __ror__(self, other):
return other
def __and__(self, other):
if other is False:
return False
return Null
def __rand__(self, other):
if other is False:
return False
return Null
def __xor__(self, other):
return Null
def __rxor__(self, other):
return Null
def __len__(self):
return 0
def __iter__(self):
return _zero_list.__iter__()
def __copy__(self):
return Null
def __deepcopy__(self, memo):
return Null
def __getitem__(self, key):
if isinstance(key, slice):
return Null
elif isinstance(key, int):
return NullType(self, key)
path = _split_field(key)
output = self
for p in path:
output = NullType(output, p)
return output
def __getattr__(self, key):
key = str(key)
o = to_data(_get(self, SLOT))
k = _get(self, KEY)
if is_null(o):
return NullType(self, key)
v = o.get(k)
if is_null(v):
return NullType(self, key)
try:
return v.get(key)
except Exception as e:
from mo_logs import Log
Log.error("not expected", cause=e)
def __setattr__(self, key, value):
key = str(key)
o = _get(self, SLOT)
k = _get(self, KEY)
seq = [k] + [key]
_assign_to_null(o, seq, value)
def __setitem__(self, key, value):
o = _get(self, SLOT)
if o is None:
return
k = _get(self, KEY)
if o is None:
return
elif isinstance(key, int):
seq = [k] + [key]
_assign_to_null(o, seq, value)
else:
seq = [k] + _split_field(key)
_assign_to_null(o, seq, value)
def keys(self):
return set()
def items(self):
return []
def pop(self, key, default=None):
return Null
def __str__(self):
return "None"
def __repr__(self):
return "Null"
def __hash__(self):
return _null_hash
|
(obj=None, key=None)
|
43,414 |
mo_dots.nones
|
__add__
| null |
def __add__(self, other):
if is_sequence(other):
return other
return Null
|
(self, other)
|
43,415 |
mo_dots.nones
|
__and__
| null |
def __and__(self, other):
if other is False:
return False
return Null
|
(self, other)
|
43,416 |
mo_dots.nones
|
__bool__
| null |
def __bool__(self):
return False
|
(self)
|
43,417 |
mo_dots.nones
|
__call__
| null |
def __call__(self, *args, **kwargs):
return Null
|
(self, *args, **kwargs)
|
43,418 |
mo_dots.nones
|
__copy__
| null |
def __copy__(self):
return Null
|
(self)
|
43,419 |
mo_dots.nones
|
__deepcopy__
| null |
def __deepcopy__(self, memo):
return Null
|
(self, memo)
|
43,420 |
mo_dots.nones
|
__div__
| null |
def __div__(self, other):
return Null
|
(self, other)
|
43,421 |
mo_dots.nones
|
__eq__
| null |
def __eq__(self, other):
if is_sequence(other) and not other:
return True
if is_null(other):
return True
else:
return Null
|
(self, other)
|
43,422 |
mo_dots.nones
|
__float__
| null |
def __float__(self):
return float("nan")
|
(self)
|
43,423 |
mo_dots.nones
|
__floordiv__
| null |
def __floordiv__(self, other):
return Null
|
(self, other)
|
43,424 |
mo_dots.nones
|
__ge__
| null |
def __ge__(self, other):
return Null
|
(self, other)
|
43,425 |
mo_dots.nones
|
__getattr__
| null |
def __getattr__(self, key):
key = str(key)
o = to_data(_get(self, SLOT))
k = _get(self, KEY)
if is_null(o):
return NullType(self, key)
v = o.get(k)
if is_null(v):
return NullType(self, key)
try:
return v.get(key)
except Exception as e:
from mo_logs import Log
Log.error("not expected", cause=e)
|
(self, key)
|
43,426 |
mo_dots.nones
|
__getitem__
| null |
def __getitem__(self, key):
if isinstance(key, slice):
return Null
elif isinstance(key, int):
return NullType(self, key)
path = _split_field(key)
output = self
for p in path:
output = NullType(output, p)
return output
|
(self, key)
|
43,427 |
mo_dots.nones
|
__gt__
| null |
def __gt__(self, other):
return Null
|
(self, other)
|
43,428 |
mo_dots.nones
|
__hash__
| null |
def __hash__(self):
return _null_hash
|
(self)
|
43,429 |
mo_dots.nones
|
__iadd__
| null |
def __iadd__(self, other):
o = _get(self, SLOT)
if o is None:
return self
key = _get(self, KEY)
_assign_to_null(o, [key], other)
return other
|
(self, other)
|
43,430 |
mo_dots.nones
|
__init__
|
obj - VALUE BEING DEREFERENCED
key - THE dict ITEM REFERENCE (DOT(.) IS NOT ESCAPED)
|
def __init__(self, obj=None, key=None):
"""
obj - VALUE BEING DEREFERENCED
key - THE dict ITEM REFERENCE (DOT(.) IS NOT ESCAPED)
"""
_set(self, SLOT, obj)
_set(self, KEY, key)
|
(self, obj=None, key=None)
|
43,431 |
mo_dots.nones
|
__int__
| null |
def __int__(self):
return None
|
(self)
|
43,432 |
mo_dots.nones
|
__iter__
| null |
def __iter__(self):
return _zero_list.__iter__()
|
(self)
|
43,433 |
mo_dots.nones
|
__itruediv__
| null |
def __itruediv__(self, other):
return Null
|
(self, other)
|
43,434 |
mo_dots.nones
|
__le__
| null |
def __le__(self, other):
return Null
|
(self, other)
|
43,435 |
mo_dots.nones
|
__len__
| null |
def __len__(self):
return 0
|
(self)
|
43,436 |
mo_dots.nones
|
__lt__
| null |
def __lt__(self, other):
return Null
|
(self, other)
|
43,437 |
mo_dots.nones
|
__mul__
| null |
def __mul__(self, other):
return Null
|
(self, other)
|
43,438 |
mo_dots.nones
|
__ne__
| null |
def __ne__(self, other):
if is_missing(other):
return False
else:
return Null
|
(self, other)
|
43,439 |
mo_dots.nones
|
__neg__
| null |
def __neg__(self):
return Null
|
(self)
|
43,441 |
mo_dots.nones
|
__or__
| null |
def __or__(self, other):
return other
|
(self, other)
|
43,442 |
mo_dots.nones
|
__radd__
| null |
def __radd__(self, other):
if is_sequence(other):
return other
return Null
|
(self, other)
|
43,443 |
mo_dots.nones
|
__rand__
| null |
def __rand__(self, other):
if other is False:
return False
return Null
|
(self, other)
|
43,444 |
mo_dots.nones
|
__rdiv__
| null |
def __rdiv__(self, other):
return Null
|
(self, other)
|
43,445 |
mo_dots.nones
|
__repr__
| null |
def __repr__(self):
return "Null"
|
(self)
|
43,446 |
mo_dots.nones
|
__rfloordiv__
| null |
def __rfloordiv__(self, other):
return Null
|
(self, other)
|
43,447 |
mo_dots.nones
|
__rmul__
| null |
def __rmul__(self, other):
return Null
|
(self, other)
|
43,448 |
mo_dots.nones
|
__ror__
| null |
def __ror__(self, other):
return other
|
(self, other)
|
43,449 |
mo_dots.nones
|
__rsub__
| null |
def __rsub__(self, other):
return Null
|
(self, other)
|
43,450 |
mo_dots.nones
|
__rtruediv__
| null |
def __rtruediv__(self, other):
return Null
|
(self, other)
|
43,451 |
mo_dots.nones
|
__rxor__
| null |
def __rxor__(self, other):
return Null
|
(self, other)
|
43,452 |
mo_dots.nones
|
__setattr__
| null |
def __setattr__(self, key, value):
key = str(key)
o = _get(self, SLOT)
k = _get(self, KEY)
seq = [k] + [key]
_assign_to_null(o, seq, value)
|
(self, key, value)
|
43,453 |
mo_dots.nones
|
__setitem__
| null |
def __setitem__(self, key, value):
o = _get(self, SLOT)
if o is None:
return
k = _get(self, KEY)
if o is None:
return
elif isinstance(key, int):
seq = [k] + [key]
_assign_to_null(o, seq, value)
else:
seq = [k] + _split_field(key)
_assign_to_null(o, seq, value)
|
(self, key, value)
|
43,454 |
mo_dots.nones
|
__str__
| null |
def __str__(self):
return "None"
|
(self)
|
43,455 |
mo_dots.nones
|
__sub__
| null |
def __sub__(self, other):
return Null
|
(self, other)
|
43,456 |
mo_dots.nones
|
__truediv__
| null |
def __truediv__(self, other):
return Null
|
(self, other)
|
43,457 |
mo_dots.nones
|
__xor__
| null |
def __xor__(self, other):
return Null
|
(self, other)
|
43,458 |
mo_dots.nones
|
items
| null |
def items(self):
return []
|
(self)
|
43,459 |
mo_dots.nones
|
keys
| null |
def keys(self):
return set()
|
(self)
|
43,460 |
mo_dots.nones
|
pop
| null |
def pop(self, key, default=None):
return Null
|
(self, key, default=None)
|
43,462 |
mo_dots
|
_DeferDataTypes
| null |
class _DeferDataTypes:
@cache
def warning(self):
get_logger().warning("DEPRECATED: Use mo_dots.utils._data_types", stack_depth=2)
def __iter__(self):
self.warning()
yield from utils._data_types
|
()
|
43,463 |
mo_dots
|
__iter__
| null |
def __iter__(self):
self.warning()
yield from utils._data_types
|
(self)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.