Ejemplo n.º 1
0
    def concurrent_dict_pop_impl(self, key, default=None):
        _key = key if cast_key == False else _cast(key, dict_key_type)  # noqa
        found, res = hashmap_pop(self, _key)

        if not found:
            if no_default == False:  # noqa
                return _cast(default, dict_value_type)
            else:
                return None
        return res
Ejemplo n.º 2
0
    def concurrent_dict_get_impl(self, key, default=None):
        _key = key if cast_key == False else _cast(key, dict_key_type)  # noqa
        found, res = hashmap_lookup(self, _key)

        if not found:
            # just to make obvious that return type is types.Optional(dict.value_type)
            if no_default == False:  # noqa
                return _cast(default, dict_value_type)
            else:
                return None
        return res
Ejemplo n.º 3
0
    def concurrent_dict_lookup_impl(self, key):
        _key = key if cast_key == False else _cast(key, dict_key_type)  # noqa
        found, res = hashmap_lookup(self, _key)

        # Note: this function raises exception so expect no scaling if you use it in prange
        if not found:
            raise KeyError("ConcurrentDict key not found")
        return res
Ejemplo n.º 4
0
 def concurrent_dict_contains_impl(self, key):
     _key = key if cast_key == False else _cast(key, dict_key_type)  # noqa
     return hashmap_contains(self, _key)
Ejemplo n.º 5
0
 def concurrent_dict_set_impl(self, key, value):
     _key = key if cast_key == False else _cast(key, dict_key_type)  # noqa
     _value = value if cast_value == False else _cast(
         value, dict_value_type)  # noqa
     return hashmap_set(self, _key, _value)