Skip to content

Commit

Permalink
Remove typing shim in favour of typing.cast (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson authored Jun 28, 2024
1 parent 851c4d5 commit 99556dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
7 changes: 4 additions & 3 deletions kr8s/_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# SPDX-FileCopyrightText: Copyright (c) 2024, Kr8s Developers (See LICENSE for list)
# SPDX-License-Identifier: BSD 3-Clause License
import pathlib
import typing
from typing import Any, Dict, List, Optional, Protocol, Union

import anyio
import jsonpath
import yaml

import kr8s._jsonpath as jsonpath
from kr8s._data_utils import dict_list_pack, list_dict_unpack
from kr8s._types import PathType

Expand Down Expand Up @@ -318,13 +319,13 @@ async def set(
patch = jsonpath.JSONPatch().replace(pointer, value)
else:
patch = jsonpath.JSONPatch().add(pointer, value)
self._raw = patch.apply(self._raw)
self._raw = typing.cast(dict, patch.apply(self._raw))
await self.save()

async def unset(self, pointer: str) -> Any:
"""Remove a value using a JSON Pointer."""
patch = jsonpath.JSONPatch().remove(pointer)
self._raw = patch.apply(self._raw)
self._raw = typing.cast(dict, patch.apply(self._raw))
await self.save()

@property
Expand Down
18 changes: 0 additions & 18 deletions kr8s/_jsonpath.py

This file was deleted.

0 comments on commit 99556dd

Please sign in to comment.