Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Move the WatchEvent type to module-level #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pykube/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def response(self):
return self.query_cache["response"]


WatchEvent = namedtuple("WatchEvent", "type object")


class WatchQuery(BaseQuery):

def __init__(self, *args, **kwargs):
Expand All @@ -158,7 +161,6 @@ def object_stream(self):
kwargs["version"] = self.api_obj_class.version
r = self.api.get(**kwargs)
self.api.raise_for_status(r)
WatchEvent = namedtuple("WatchEvent", "type object")
for line in r.iter_lines():
we = json.loads(line.decode("utf-8"))
yield WatchEvent(type=we["type"], object=self.api_obj_class(self.api, we["object"]))
Expand Down