X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=collect%2Fshared_dict.py;h=3207927ed2f550b6516bce0c1b72fd96d7581ba4;hb=532df2c5b57c7517dfb3dddd8c1358fbadf8baf3;hp=ec76138b393955d47f3850bf2a91d425ada563b1;hpb=eb1c6392095947b3205c4d52cd9b1507e6cd776b;p=python_utils.git diff --git a/collect/shared_dict.py b/collect/shared_dict.py index ec76138..3207927 100644 --- a/collect/shared_dict.py +++ b/collect/shared_dict.py @@ -4,7 +4,7 @@ The MIT License (MIT) Copyright (c) 2020 LuizaLabs -Additions Copyright (c) 2022 Scott Gasch +Additions/Modifications Copyright (c) 2022 Scott Gasch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,6 @@ This class is based on https://github.com/luizalabs/shared-memory-dict import pickle from contextlib import contextmanager -from functools import wraps from multiprocessing import RLock, shared_memory from typing import ( Any, @@ -42,8 +41,6 @@ from typing import ( ValuesView, ) -from decorator_utils import synchronized - class PickleSerializer: def dumps(self, obj: dict) -> bytes: @@ -94,9 +91,7 @@ class SharedDict(object): return shared_memory.SharedMemory(name=name, create=True, size=size_bytes) def _ensure_memory_initialization(self): - memory_is_empty = ( - bytes(self.shared_memory.buf).split(SharedDict.NULL_BYTE, 1)[0] == b'' - ) + memory_is_empty = bytes(self.shared_memory.buf).split(SharedDict.NULL_BYTE, 1)[0] == b'' if memory_is_empty: self.clear()