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

Data Save and Load Structure #63

Merged
merged 36 commits into from Oct 28, 2021
Merged

Data Save and Load Structure #63

merged 36 commits into from Oct 28, 2021

Conversation

sadrasabouri
Copy link
Collaborator

Reference Issues/PRs

#33

What does this implement/fix? Explain your changes.

  • load_data function
  • save_data_file function
  • save_data method
  • and minor error, warning handling

@sadrasabouri sadrasabouri added the enhancement New feature or request label Oct 22, 2021
@sadrasabouri sadrasabouri added this to the samila v0.3 milestone Oct 22, 2021
@sadrasabouri sadrasabouri self-assigned this Oct 22, 2021
@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2021

Codecov Report

Merging #63 (5bed09b) into dev (9a83d1f) will increase coverage by 0.65%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##              dev       #63      +/-   ##
===========================================
+ Coverage   99.36%   100.00%   +0.65%     
===========================================
  Files           4         4              
  Lines         155       199      +44     
  Branches       18        23       +5     
===========================================
+ Hits          154       199      +45     
+ Misses          1         0       -1     
Impacted Files Coverage Δ
samila/errors.py 100.00% <100.00%> (+100.00%) ⬆️
samila/functions.py 100.00% <100.00%> (ø)
samila/genimage.py 100.00% <100.00%> (ø)
samila/params.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a83d1f...5bed09b. Read the comment docs.

Copy link
Owner

@sepandhaghighi sepandhaghighi left a comment

Choose a reason for hiding this comment

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

@sadrasabouri Thanks for your efforts 💯

  1. Take a look at my comments
  2. Add an example of save_data method to README.md


def save_data(self, file_adr='data.json'):
"""
Save datas into a file.
Copy link
Owner

Choose a reason for hiding this comment

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

data

samila/params.py Outdated
DATA_TYPE_ERROR = "Provided data file is not supported. It should be either file or io.IOBase."
DATA_PARSING_ERROR = "Provided data format is wrong. It should be in JSON format including data1 and data2 fields."
NO_FUNCTION_ERROR = "At least one of the given functions are None."
JUST_DATA_WARNING = "Just data is provided you can't use generate function."
Copy link
Owner

Choose a reason for hiding this comment

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

Just data is provided, generate method is not available in this mode.

@sadrasabouri
Copy link
Collaborator Author

And what should we do for codecov failure?

README.md Outdated
So you can load it into a `GenerativeImage` instance later by

```pycon
>>> g = GenerativeImage(data=open('test.json', 'w'))
Copy link
Owner

Choose a reason for hiding this comment

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

Write mode? Are you sure?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're rigth.
My bad.

samila/errors.py Show resolved Hide resolved
samila/errors.py Show resolved Hide resolved
@sadrasabouri
Copy link
Collaborator Author

@sepandhaghighi Can you review it agian?
I think we should ignore the Codacy issue too.

@sepandhaghighi sepandhaghighi merged commit 53bd7be into dev Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants