-
Notifications
You must be signed in to change notification settings - Fork 294
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
Add slice data functional tests #5057
Changes from all commits
7291c03
6f305bb
bcaa20e
c61d60b
6b2979b
472e344
0708089
b50180b
b92a73f
89ca95d
f7cc25a
62ac48d
eae618e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add tests for data viewer slice data functionality. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,14 +91,14 @@ def _VSCODE_convertTensorToDataFrame(tensor, start=None, end=None): | |
def _VSCODE_convertToDataFrame(df, start=None, end=None): | ||
vartype = type(df) | ||
if isinstance(df, list): | ||
df = _VSCODE_pd.DataFrame(df) | ||
df = _VSCODE_pd.DataFrame(df).iloc[start:end] | ||
elif isinstance(df, _VSCODE_pd.Series): | ||
df = _VSCODE_pd.Series.to_frame(df) | ||
df = _VSCODE_pd.Series.to_frame(df).iloc[start:end] | ||
elif isinstance(df, dict): | ||
df = _VSCODE_pd.Series(df) | ||
df = _VSCODE_pd.Series.to_frame(df) | ||
df = _VSCODE_pd.Series.to_frame(df).iloc[start:end] | ||
elif hasattr(df, "toPandas"): | ||
df = df.toPandas() | ||
df = df.toPandas().iloc[start:end] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broke chunking in #4951 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, but the comment doesn't make sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a tiny bit confused as well. This is merging into more-styles and currently there is also a PR open for more-styles into main? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this PR depends on the Checkbox change in more-styles. But I'm merging the style changes into main, then this into main. And yes this is a bug fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, that works for me. I think that personally I would just park it until style was into main and then PR against main so I could see test runs and what not. But small enough change that I'm down with approving now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somehow I thought we used to get test runs even on PRs not going into main... That's totally fair, my bad. Can't wait for GitHub to add stacked diffs 😭 |
||
elif ( | ||
hasattr(vartype, "__name__") and vartype.__name__ in _VSCODE_allowedTensorTypes | ||
): | ||
|
@@ -109,7 +109,7 @@ def _VSCODE_convertToDataFrame(df, start=None, end=None): | |
"""Disabling bandit warning for try, except, pass. We want to swallow all exceptions here to not crash on | ||
variable fetching""" | ||
try: | ||
temp = _VSCODE_pd.DataFrame(df) | ||
temp = _VSCODE_pd.DataFrame(df).iloc[start:end] | ||
df = temp | ||
except: # nosec | ||
pass | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,10 +164,6 @@ export class KernelVariables implements IJupyterVariables { | |
// Import the data frame script directory if we haven't already | ||
await this.importDataFrameScripts(notebook); | ||
|
||
if (targetVariable.rowCount) { | ||
end = Math.min(end, targetVariable.rowCount); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The row start and end however are already evaluated relative to the slice variable info, so this check is unnecessary. |
||
|
||
let expression = targetVariable.name; | ||
if (sliceExpression) { | ||
expression = `${targetVariable.name}${sliceExpression}`; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these work if start and end are none?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that corresponds to no slice i.e. it returns the full variable