Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove unwanted elements from cells when saving. #11164

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

Merged
merged 3 commits into from
Apr 15, 2020

Conversation

rchiodo
Copy link

@rchiodo rchiodo commented Apr 14, 2020

For #11151

The support of transient data broke our saving of a notebook cell. Make sure to prune all unwanted data when saving.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@DavidKutu
Copy link

This should also solve #10855

@codecov-io
Copy link

codecov-io commented Apr 14, 2020

Codecov Report

Merging #11164 into master will increase coverage by 0.02%.
The diff coverage is 96.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11164      +/-   ##
==========================================
+ Coverage   61.41%   61.43%   +0.02%     
==========================================
  Files         596      596              
  Lines       32848    32873      +25     
  Branches     4655     4659       +4     
==========================================
+ Hits        20173    20195      +22     
+ Misses      12465    11659     -806     
- Partials      210     1019     +809     
Impacted Files Coverage Δ
...tascience/interactive-ipynb/nativeEditorStorage.ts 48.93% <50.00%> (+0.45%) ⬆️
src/client/datascience/common.ts 100.00% <100.00%> (ø)
src/datascience-ui/react-common/arePathsSame.ts 75.00% <0.00%> (-12.50%) ⬇️
src/client/common/utils/platform.ts 64.70% <0.00%> (-11.77%) ⬇️
src/client/linters/pydocstyle.ts 86.66% <0.00%> (-2.23%) ⬇️
src/client/datascience/debugLocationTracker.ts 76.56% <0.00%> (-1.57%) ⬇️
...client/datascience/kernel-launcher/kernelFinder.ts 75.70% <0.00%> (-0.94%) ⬇️
src/client/common/process/proc.ts 14.49% <0.00%> (-0.73%) ⬇️
...ient/interpreter/locators/services/condaService.ts 85.55% <0.00%> (-0.08%) ⬇️
src/client/testing/main.ts 14.38% <0.00%> (ø)
... and 167 more

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 eab579f...da2c514. Read the comment docs.

@@ -75,4 +77,169 @@ suite('Data Science Tests', () => {
assert.ok(onDidChangeActiveTextEditor.calledOnce);
});
});

suite('Cell pruning', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Now this is clearly a good function for unit test. Nice.

import { noop } from '../common/utils/misc';
import { Settings } from './constants';

// Can't figure out a better way to do this. Enumerate
// the allowed keys of different output formats.
const dummyStreamObj: nbformat.IStream = {
Copy link
Member

Choose a reason for hiding this comment

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

We only support notebook format 4, right? This check works, but seems like it could be broken by an older format or a new format change. I think ok for now though.

Copy link
Author

Choose a reason for hiding this comment

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

I believe it would be okay because the output is either

  • run by us, so format 4
  • pruned by us if format 3. So if you open a format 3 notebook, and changed it, we'd remove all of the output data that didn't match format 3 (assuming we could open it anywya, which we can't). If we ever supported this, we'd probably import and change to format 4 on open.

@rchiodo rchiodo merged commit bd8d32b into master Apr 15, 2020
@rchiodo rchiodo deleted the rchiodo/transient_removal branch April 15, 2020 00:19
rchiodo added a commit that referenced this pull request Apr 15, 2020
* Remove unwanted elements from cells when saving.

* Fix a sonar warning

* FIx another sonar warning
rchiodo added a commit that referenced this pull request Apr 15, 2020
* Remove unwanted elements from cells when saving. (#11164)

* Remove unwanted elements from cells when saving.

* Fix a sonar warning

* FIx another sonar warning

* Update changelog
@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants