Skip to content

Commit

Permalink
Move class at the top
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyvelich committed Jan 10, 2024
1 parent a04756b commit 54b6269
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions sdk/python/kubeflow/training/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ def __init__(self, obj):
self.data = json.dumps(obj)


class SetEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, set):
return list(obj)
if isinstance(obj, type):
return obj.__name__
return json.JSONEncoder.default(self, obj)


def is_running_in_k8s():
return os.path.isdir("/var/run/secrets/kubernetes.io/")

Expand Down Expand Up @@ -369,15 +378,6 @@ def get_pvc_spec(
return pvc_spec


class SetEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, set):
return list(obj)
if isinstance(obj, type):
return obj.__name__
return json.JSONEncoder.default(self, obj)


def add_event_to_dict(
events_dict: Dict[str, List[str]],
event: models.CoreV1Event,
Expand Down

0 comments on commit 54b6269

Please sign in to comment.