演算子 | 説明 |
---|---|
gt, > | より大きい |
lt, < | より小さい |
gte, >= | 以上 |
lte, <= | 以下 |
!=, <>, not | 比較した値が異なる |
in | 与えたシーケンスに含まれる |
notin | 与えたシーケンスに含まれない |
like, ilike | 文字列検索、 ilike は大文字小文字を区別しない。ワイルドカードは% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from datajuggler import iList | |
In [2]: l1 = iList([1,2,3,4,5,6]) | |
...: result = l1.without([3]) | |
...: assert result == [1,2,4,5,6] | |
In [3]: l1 = iList([1,2,3,4,5,6]) | |
...: result = l1.without([0]) | |
...: assert result == l1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from datajuggler import iList | |
In [2]: l1 = iList([1,2,3,4,5]) | |
...: l2 = iList([1,2,3,4,5]) | |
...: assert l1 == l2 | |
In [3]: l1 = iList([1,2,3,4,5]) | |
...: l2 = list([1,2,3,4,5]) | |
...: assert l1 == l2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n [1]: from datajuggler import serializer as io | |
In [2]: import decimal | |
In [3]: import datetime | |
In [4]: data = { | |
...: 'a': 1, | |
...: 'b': decimal.Decimal('2'), | |
...: 'c': datetime.datetime(2020, 5, 24, 8, 20), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from datajuggler.serializer.abstract import ( | |
AbstractClassSerializer, register_serializer | |
) | |
from datajuggler.validator import TypeValidator as _type | |
class DatetimeClassSerializer(io.AbstractClassSerializer): | |
def __init__(self, cls=datetime.datetime): | |
super().__init__(cls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datajuggler.serializer.abstract import ( | |
AbstractSerializer, register_serializer | |
) | |
try: | |
import cloudpickle | |
cloudpickle_enable = True | |
except ImportError: # pragma: no cover | |
cloudpickle_enable = False | |
cloudpickle = AbstractSerializer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from datajuggler import uDict, Keylist, Keypath | |
In [2]: data = { "a": 1, | |
...: "b": { "c": { "x": 2, "y": 3, }, | |
...: "d": { "x": 4, "y": 5, }, | |
...: "e": [ { "x": 1, "y": -1, "z": [101, 102, 103], }, | |
...: { "x": 2, "y": -2, "z": [201, 202, 203], }, | |
...: { "x": 3, "y": -3, "z": [301, 302, 303], }, | |
...: ], | |
...: }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [69]: i3 = i1.clone() | |
In [70]: i3 | |
Out[70]: iList([1, 2, 3]) | |
In [71]: i3._attrs | |
Out[71]: aDict({'python': 'Osaka'}) | |
In [72]: i3 = i1.clone(empty=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [63]: i1 | |
Out[63]: iList([1, 2, 3]) | |
In [64]: i2 = i1.copy() | |
In [65]: i2._attrs | |
Out[65]: aDict({}) | |
In [66]: i2 = i1.copy(freeze=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [60]: hash(i1) | |
Out[60]: -3783003762566077833 | |
In [61]: d = { i1: 'happy'} | |
In [62]: d | |
Out[62]: {iList([1, 2, 3]): 'happy'} | |
In [63]: |
NewerOlder