mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 03:34:49 -04:00
Add types to synapse.util. (#10601)
This commit is contained in:
parent
ceab5a4bfa
commit
524b8ead77
41 changed files with 400 additions and 253 deletions
|
@ -11,11 +11,12 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
from typing import Any
|
||||
|
||||
from frozendict import frozendict
|
||||
|
||||
|
||||
def freeze(o):
|
||||
def freeze(o: Any) -> Any:
|
||||
if isinstance(o, dict):
|
||||
return frozendict({k: freeze(v) for k, v in o.items()})
|
||||
|
||||
|
@ -33,7 +34,7 @@ def freeze(o):
|
|||
return o
|
||||
|
||||
|
||||
def unfreeze(o):
|
||||
def unfreeze(o: Any) -> Any:
|
||||
if isinstance(o, (dict, frozendict)):
|
||||
return {k: unfreeze(v) for k, v in o.items()}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue