Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Add some json serialization docstrings. #6880

Merged
merged 7 commits into from
Jan 27, 2023

Conversation

billdirks
Copy link
Contributor

@billdirks billdirks commented Jan 21, 2023

Add 36 public api docstrings. These are mostly for implementations of to_json_dict. Docstrings were also added to convert_to_json_serializable. I've also updated the return type of these methods except for 1 instance (see comment inline) where some implementation/typing work needs to be done that is distinct from docstring work.

Definition of Done

Please delete options that are not relevant.

  • My code follows the Great Expectations style guide
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added unit tests where applicable and made sure that new and existing tests are passing.
  • I have run any local integration tests and made sure that nothing is broken.

Thank you for submitting!

@netlify
Copy link

netlify bot commented Jan 21, 2023

Deploy Preview for niobium-lead-7998 ready!

Name Link
🔨 Latest commit 40663ca
🔍 Latest deploy log https://app.netlify.com/sites/niobium-lead-7998/deploys/63d45b2ce85d3c00088e851b
😎 Deploy Preview https://deploy-preview-6880--niobium-lead-7998.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ghost
Copy link

ghost commented Jan 21, 2023

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@billdirks billdirks requested a review from a team January 21, 2023 00:10
def to_json_dict(self) -> Optional[dict]:
"""Returns RenderedAtomicValueGraph as a json dictionary."""
@public_api
def to_json_dict(self) -> Optional[dict[str, JSONValues]]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a potential bug. @NathanFarmer should we be calling some serialization function on self.graph?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as it stands right now we just use Altair (vega-lite) for graphs, so this serializes them for rendering at the client.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have confirmed with @NathanFarmer that this is ok for renderers.

@@ -456,7 +464,13 @@ def __repr__(self):
def __str__(self):
return json.dumps(self.to_json_dict(), indent=2)

@public_api
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only function I didn't annotate the return type on. There is some more implementation/typing work that needs to be done to get this correct because of he current implementation.

@@ -236,12 +238,12 @@ def assert_valid_keys(keys: Set[str], purpose: str) -> None:


class SerializableDictDot(DictDot):
def to_json_dict(self) -> dict:
"""
def to_json_dict(self) -> Dict[str, JSONValues]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a method that needs to be implemented by subclasses. I didn't know if we considered that as public (it's not the spreadsheet) so I didn't add the decorator but I still wanted to add the docstring.

@billdirks billdirks force-pushed the d/dx-237/add-some-json-serialization-docstrings branch from 190122a to 259d477 Compare January 23, 2023 17:43
@anthonyburdi anthonyburdi enabled auto-merge (squash) January 27, 2023 23:22
@anthonyburdi anthonyburdi merged commit 6ab3bb8 into develop Jan 27, 2023
@anthonyburdi anthonyburdi deleted the d/dx-237/add-some-json-serialization-docstrings branch January 27, 2023 23:22
billdirks added a commit that referenced this pull request Jan 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants