Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rusty-hektor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grady Corp.
rusty-hektor
Commits
9604fd09
Commit
9604fd09
authored
4 years ago
by
Dominik Seeger
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-python-issues' into 'master'
Fix python issues Closes
#11
See merge request
!4
parents
6599d2e0
68fcd64c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!4
Fix python issues
Pipeline
#134063
passed with warnings
4 years ago
Stage: test
Stage: docs
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
src/input_types/ipynb.rs
+28
-1
28 additions, 1 deletion
src/input_types/ipynb.rs
src/transform/submissions.rs
+1
-1
1 addition, 1 deletion
src/transform/submissions.rs
with
31 additions
and
2 deletions
.gitignore
+
2
−
0
View file @
9604fd09
/target
/target
**/*.rs.bk
**/*.rs.bk
*.json
*.json
.idea
This diff is collapsed.
Click to expand it.
src/input_types/ipynb.rs
+
28
−
1
View file @
9604fd09
...
@@ -158,6 +158,8 @@ pub struct CodeCell {
...
@@ -158,6 +158,8 @@ pub struct CodeCell {
pub
execution_count
:
Option
<
i64
>
,
pub
execution_count
:
Option
<
i64
>
,
}
}
const
MAX_OUTPUT_LINES
:
usize
=
50
;
impl
Display
for
CodeCell
{
impl
Display
for
CodeCell
{
fn
fmt
(
&
self
,
f
:
&
mut
Formatter
<
'_
>
)
->
fmt
::
Result
{
fn
fmt
(
&
self
,
f
:
&
mut
Formatter
<
'_
>
)
->
fmt
::
Result
{
let
exec_count_as_str
=
self
let
exec_count_as_str
=
self
...
@@ -168,8 +170,33 @@ impl Display for CodeCell {
...
@@ -168,8 +170,33 @@ impl Display for CodeCell {
writeln!
(
f
,
"{}
\n
"
,
self
.source
)
?
;
writeln!
(
f
,
"{}
\n
"
,
self
.source
)
?
;
writeln!
(
f
,
"# Out[{}]:
\n
"
,
exec_count_as_str
)
?
;
writeln!
(
f
,
"# Out[{}]:
\n
"
,
exec_count_as_str
)
?
;
let
mut
has_stream_output
=
false
;
for
output
in
&
self
.outputs
{
for
output
in
&
self
.outputs
{
writeln!
(
f
,
"{}"
,
comment_out
(
output
.to_string
()))
?
;
let
mut
out_str
=
output
.to_string
();
// IPython batches stream outputs if they are too long
// we only want to show the first batch of stream outputs.
// Also, we want to truncate too long output streams.
if
let
Output
::
Stream
(
stream
)
=
output
{
if
has_stream_output
{
continue
;
}
has_stream_output
=
true
;
out_str
=
stream
.to_string
()
.lines
()
.take
(
MAX_OUTPUT_LINES
)
.collect
::
<
Vec
<
_
>>
()
.join
(
"
\n
"
);
if
out_str
.lines
()
.count
()
==
MAX_OUTPUT_LINES
{
out_str
.push_str
(
"
\n
OUTPUT HAS BEEN TRUNCATED. SEE ORIGINAL NOTEBOOK FOR FULL OUTPUT."
);
}
}
writeln!
(
f
,
"{}"
,
comment_out
(
out_str
))
?
;
}
}
Ok
(())
Ok
(())
}
}
...
...
This diff is collapsed.
Click to expand it.
src/transform/submissions.rs
+
1
−
1
View file @
9604fd09
...
@@ -49,7 +49,7 @@ pub fn transform_submissions(
...
@@ -49,7 +49,7 @@ pub fn transform_submissions(
tests
:
vec!
[],
tests
:
vec!
[],
};
};
if
sub_type
.programming_language
==
ProgrammingLang
::
Python
{
if
sub_type
.programming_language
==
ProgrammingLang
::
Python
&&
submission
.code
.len
()
>
0
{
render_code
::
<
Notebook
>
(
&
mut
submission
)
?
;
render_code
::
<
Notebook
>
(
&
mut
submission
)
?
;
}
}
Ok
(
submission
)
Ok
(
submission
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment