Пример #1
0
 def test_impl(keys1, values1, keys2, values2):
     a_dict = ConcurrentDict.from_arrays(keys1, values1)
     other_dict = ConcurrentDict.from_arrays(keys2, values2)
     r1 = len(a_dict)
     a_dict.update(other_dict)
     r2 = len(a_dict)
     check_keys = np.array([k in a_dict for k in keys2])
     return r1, r2, np.all(check_keys)
Пример #2
0
        def test_impl(keys1, values1, keys2, values2):
            a_dict = ConcurrentDict.fromkeys(keys1, values1[0])
            for k, v in zip(keys1, values1):
                a_dict[k] = v

            other_dict = ConcurrentDict.fromkeys(keys2, values2[0])
            for k, v in zip(keys2, values2):
                other_dict[k] = v

            r1 = len(a_dict)
            a_dict.update(other_dict)
            r2 = len(a_dict)
            check_keys = np.array([k in a_dict for k in keys2])

            return r1, r2, np.all(check_keys)
Пример #3
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     dict_iter = iter(a_dict)
     r1 = next(dict_iter)
     r2 = next(dict_iter)
     r3 = next(dict_iter)
     return r1, r2, r3
Пример #4
0
        def test_impl(key_type, value_type, keys, values):
            a_dict = ConcurrentDict.empty(key_type, value_type)
            for i in prange(len(keys)):
                a_dict[keys[i]] = values[i]

            res = list(a_dict.items())  # this relies on working iterator
            return res
Пример #5
0
        def test_impl(tdict, key_type, value_type):
            a_dict = ConcurrentDict.empty(key_type, value_type)
            for k, v in tdict.items():
                a_dict[k] = v

            res = list(a_dict.items())  # this relies on working iterator
            return res
Пример #6
0
        def test_impl(keys, values):
            a_dict = ConcurrentDict.fromkeys(keys, values[0])
            for k, v in zip(keys, values):
                a_dict[k] = v

            res = []
            for k in a_dict:
                res.append(k)
            return res
Пример #7
0
 def test_impl(key, value):
     a_dict = ConcurrentDict.from_arrays(
         np.array([
             key,
         ]),
         np.array([
             value,
         ]),
     )
     return key in a_dict, 2 * key in a_dict
Пример #8
0
        def test_impl(keys, values):
            a_dict = ConcurrentDict.fromkeys(keys, values[0])
            for k, v in zip(keys, values):
                a_dict[k] = v

            dict_iter = iter(a_dict)
            r1 = next(dict_iter)
            r2 = next(dict_iter)
            r3 = next(dict_iter)
            return r1, r2, r3
Пример #9
0
 def test_impl(key, value):
     a_dict = ConcurrentDict.from_arrays(
         np.array([
             key,
         ]),
         np.array([
             value,
         ]),
     )
     a_dict.pop(key)
     return len(a_dict), a_dict.get(key, None)
Пример #10
0
        def test_impl(key, value, new_value):
            a_dict = ConcurrentDict.from_arrays(
                np.array([
                    key,
                ]),
                np.array([
                    value,
                ]),
            )

            a_dict[key] = new_value
            return a_dict[key]
Пример #11
0
 def test_impl(key, value, default):
     a_dict = ConcurrentDict.from_arrays(
         np.array([
             key,
         ]),
         np.array([
             value,
         ]),
     )
     r1 = a_dict.get(key, None)
     r2 = a_dict.get(2 * key, default)
     r3 = a_dict.get(2 * key)
     return r1, r2, r3
Пример #12
0
 def test_impl(keys, value):
     a_dict = ConcurrentDict.fromkeys(keys, value)
     check_keys = np.array([k in a_dict for k in keys])
     return len(a_dict), np.all(check_keys)
Пример #13
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     res = list(a_dict.items())  # this relies on working iterator
     return res
Пример #14
0
 def test_impl(key, value, default):
     a_dict = ConcurrentDict.fromkeys([key], value)
     r1 = a_dict.get(key, None)
     r2 = a_dict.get(2 * key, default)
     r3 = a_dict.get(2 * key)
     return r1, r2, r3
Пример #15
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.fromkeys(keys, values[0])
     r1 = len(a_dict)
     a_dict.clear()
     r2 = len(a_dict)
     return r1, r2
Пример #16
0
 def test_impl(key, value):
     a_dict = ConcurrentDict.fromkeys([key], value)
     r1 = a_dict.pop(2 * key)
     r2 = a_dict.pop(2 * key, 2 * value)
     return r1, r2
Пример #17
0
 def concurrent_dict_fromkeys_impl(cls, keys, value):
     res = ConcurrentDict.empty(dict_key_type, dict_value_type)
     for k in keys:
         res[k] = value
     return res
Пример #18
0
        def test_impl(key, value, new_value):
            a_dict = ConcurrentDict.fromkeys([key], value)

            a_dict[key] = new_value
            return a_dict[key]
Пример #19
0
 def test_impl(key_type, value_type, key, value):
     a_dict = ConcurrentDict.empty(key_type, value_type)
     a_dict[key] = value
     return len(a_dict), a_dict[key]
Пример #20
0
 def concurrent_dict_fromkeys_impl(cls, keys, value):
     res = ConcurrentDict.empty(dict_key_type, dict_value_type)
     for i in numba.prange(len(keys)):
         res[keys[i]] = value
     return res
Пример #21
0
 def test_impl(key_type, value_type):
     a_dict = ConcurrentDict.empty(key_type, value_type)
     return len(a_dict)
Пример #22
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     res = []
     for k, v in a_dict.items():
         res.append((k, v))
     return res
Пример #23
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     res = []
     for k in a_dict.keys():
         res.append(k)
     return res
Пример #24
0
 def test_impl(keys, value):
     a_dict = ConcurrentDict.empty(types.int64, types.float64)
     res = a_dict.fromkeys(keys, value)
     check_keys = np.array([k in res for k in keys])
     return len(res), np.all(check_keys), len(a_dict)
Пример #25
0
 def test_impl(key_type, value_type, keys, values):
     a_dict = ConcurrentDict.empty(key_type, value_type)
     for k, v in zip(keys, values):
         a_dict[k] = v
     return len(a_dict)
Пример #26
0
 def test_impl(key, value):
     a_dict = ConcurrentDict.fromkeys([key], value)
     return key in a_dict, 2 * key in a_dict
Пример #27
0
 def wrapper_impl(self, keys, value):
     return ConcurrentDict.fromkeys(keys, value)
Пример #28
0
 def test_impl(key, value):
     a_dict = ConcurrentDict.fromkeys([key], value)
     r1 = a_dict.pop(key)
     return r1, len(a_dict), a_dict.get(key, None)