Skip to content

Commit

Permalink
Feature/metadata creation enhancement (#83)
Browse files Browse the repository at this point in the history
* change to_dict methods to ignore client
  • Loading branch information
georgiannajames authored Nov 1, 2024
1 parent 93196a9 commit 02d0897
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyfusion"
version = "2.0.0"
version = "2.0.1-dev0"
edition = "2021"


Expand Down
2 changes: 1 addition & 1 deletion py_src/fusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Fusion Devs"""
__email__ = "[email protected]"
__version__ = "2.0.0"
__version__ = "2.0.1-dev0"

from fusion._fusion import FusionCredentials
from fusion.fs_sync import fsync
Expand Down
5 changes: 2 additions & 3 deletions py_src/fusion/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from dataclasses import asdict, dataclass, field, fields
from dataclasses import dataclass, field, fields
from typing import TYPE_CHECKING, Any, cast

import numpy as np
Expand Down Expand Up @@ -280,10 +280,9 @@ def to_dict(self: Attribute) -> dict[str, Any]:
>>> attribute_dict = attribute.to_dict()
"""
result = asdict(self)
result = {k: v for k, v in self.__dict__.items() if not k.startswith("_")}
result["unit"] = str(self.unit) if self.unit is not None else None
result["dataType"] = self.dataType.name
result.pop("_client")
return result

def create(
Expand Down
6 changes: 3 additions & 3 deletions py_src/fusion/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import json as js
from dataclasses import asdict, dataclass, field, fields
from dataclasses import dataclass, field, fields
from typing import TYPE_CHECKING, Any

import pandas as pd
Expand Down Expand Up @@ -426,9 +426,9 @@ def to_dict(self) -> dict[str, Any]:
>>> dataset_dict = dataset.to_dict()
"""
dataset_dict = asdict(self)
dataset_dict = {k: v for k, v in self.__dict__.items() if not k.startswith("_")}

dataset_dict["type"] = dataset_dict.pop("type_")
dataset_dict.pop("_client")
return dataset_dict

def create(
Expand Down
5 changes: 2 additions & 3 deletions py_src/fusion/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import json as js
from dataclasses import asdict, dataclass, field, fields
from dataclasses import dataclass, field, fields
from typing import TYPE_CHECKING, Any

import pandas as pd
Expand Down Expand Up @@ -364,8 +364,7 @@ def to_dict(self: Product) -> dict[str, Any]:
>>> product_dict = product.to_dict()
"""
product_dict = asdict(self)
product_dict.pop("_client")
product_dict = {k: v for k, v in self.__dict__.items() if not k.startswith("_")}
return product_dict

def create(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pyfusion"
version = "2.0.0"
version = "2.0.1-dev0"

homepage = "https://github.com/jpmorganchase/fusion"
description = "JPMC Fusion Developer Tools"
Expand Down Expand Up @@ -237,7 +237,7 @@ exclude_lines = [


[tool.bumpversion]
current_version = "2.0.0"
current_version = "2.0.1-dev0"
parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?:-(?P<release>[a-z]+)(?P<candidate>\d+))?'
serialize = [
'{major}.{minor}.{patch}-{release}{candidate}',
Expand Down

0 comments on commit 02d0897

Please sign in to comment.