Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit16a30f7

Browse files
committed
Only count code cells in trust indicator.
This is because in the current Jupyter trust modelonly cells with outputs can be marked as (un)trusted.Further, since nbformat does not like `trusted`metadata on non-code cells we have to remove it,and on our side `.trusted` is always undefinedfor non-code cells.
1 parentf31af67 commit16a30f7

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

‎packages/notebook/src/truststatus.tsx‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function cellTrust(
2727
if(props.trustedCells===props.totalCells){
2828
return[
2929
trans.__(
30-
'Notebook trusted: %1 of %2 cells trusted.',
30+
'Notebook trusted: %1 of %2codecells trusted.',
3131
props.trustedCells,
3232
props.totalCells
3333
),
@@ -36,7 +36,7 @@ function cellTrust(
3636
}elseif(props.activeCellTrusted){
3737
return[
3838
trans.__(
39-
'Active cell trusted: %1 of %2 cells trusted.',
39+
'Active cell trusted: %1 of %2codecells trusted.',
4040
props.trustedCells,
4141
props.totalCells
4242
),
@@ -45,7 +45,7 @@ function cellTrust(
4545
}else{
4646
return[
4747
trans.__(
48-
'Notebook not trusted: %1 of %2 cells trusted.',
48+
'Notebook not trusted: %1 of %2codecells trusted.',
4949
props.trustedCells,
5050
props.totalCells
5151
),
@@ -90,12 +90,12 @@ namespace NotebookTrustComponent {
9090
activeCellTrusted:boolean;
9191

9292
/**
93-
* The total number of cells for the current notebook.
93+
* The total number ofcodecells for the current notebook.
9494
*/
9595
totalCells:number;
9696

9797
/**
98-
* The number of trusted cells for the current notebook.
98+
* The number of trustedcodecells for the current notebook.
9999
*/
100100
trustedCells:number;
101101
}
@@ -145,14 +145,14 @@ export namespace NotebookTrustStatus {
145145
*/
146146
exportclassModelextendsVDomModel{
147147
/**
148-
* The number of trusted cells in the current notebook.
148+
* The number of trustedcodecells in the current notebook.
149149
*/
150150
gettrustedCells():number{
151151
returnthis._trustedCells;
152152
}
153153

154154
/**
155-
* The total number of cells in the current notebook.
155+
* The total number ofcodecells in the current notebook.
156156
*/
157157
gettotalCells():number{
158158
returnthis._totalCells;
@@ -240,7 +240,7 @@ export namespace NotebookTrustStatus {
240240
}
241241

242242
/**
243-
* Given a notebook model, figure out how many of the cells are trusted.
243+
* Given a notebook model, figure out how many of thecodecells are trusted.
244244
*/
245245
private_deriveCellTrustState(model:INotebookModel|null):{
246246
total:number;
@@ -249,13 +249,18 @@ export namespace NotebookTrustStatus {
249249
if(model===null){
250250
return{total:0,trusted:0};
251251
}
252+
lettotal=0;
252253
lettrusted=0;
253254
for(constcellofmodel.cells){
255+
if(cell.type!=='code'){
256+
continue;
257+
}
258+
total++;
254259
if(cell.trusted){
255260
trusted++;
256261
}
257262
}
258-
return{total:model.cells.length, trusted};
263+
return{ total, trusted};
259264
}
260265

261266
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp