Skip to content

Commit 1122777

Browse files
Merge pull request #18 from suecharo/fix-docs
Fix docs
2 parents 4d6ada1 + 32dcc77 commit 1122777

File tree

3 files changed

+25
-30
lines changed

3 files changed

+25
-30
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ from ipython2cwl.iotypes import CWLFilePathInput, CWLFilePathOutput
1616
import csv
1717
input_filename: 'CWLFilePathInput' = 'data.csv'
1818
with open(input_filename) as f:
19-
csv_reader = csv.reader(f)
20-
data = [line for line in csv_reader]
19+
csv_reader = csv.reader(f)
20+
data = [line for line in csv_reader]
2121
number_of_lines = len(data)
2222
result_file: 'CWLFilePathOutput' = 'number_of_lines.txt'
2323
with open(result_file, 'w') as f:
24-
f.write(str(number_of_lines))
24+
f.write(str(number_of_lines))
2525
```
2626

2727
IPython2CWL is based on [repo2docker](https://github.com/jupyter/repo2docker), the same tool
@@ -37,7 +37,7 @@ pip install ipython2cwl
3737
```
3838

3939
### Example
40-
40+
4141
```
4242
jupyter repo2cwl https://github.com/giannisdoukas/cwl-annotated-jupyter-notebook.git -o .
4343
```

docs/index.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ IPython2CWL is a tool for converting `IPython <https://ipython.org/>`_ Jupyter N
2121
import csv
2222
input_filename: 'CWLFilePathInput' = 'data.csv'
2323
with open(input_filename) as f:
24-
csv_reader = csv.reader(f)
25-
data = [line for line in csv_reader]
24+
csv_reader = csv.reader(f)
25+
data = [line for line in csv_reader]
2626
number_of_lines = len(data)
2727
result_file: 'CWLFilePathOutput' = 'number_of_lines.txt'
2828
with open(result_file, 'w') as f:
29-
f.write(str(number_of_lines))
29+
f.write(str(number_of_lines))
3030
3131
3232
------------------------------------------------------------------------------------------
@@ -79,4 +79,3 @@ WHAT IF I WANT TO VALIDATE THAT THE GENERATED SCRIPTS ARE CORRECT?
7979

8080
All the generated scripts are stored in the docker image under the directory :code:`/app/cwl/bin`. You can see the list
8181
of the files by running :code:`docker run [IMAGE_ID] find /app/cwl/bin/ -type f`.
82-

ipython2cwl/iotypes.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ class CWLBooleanInput(_CWLInput):
6565

6666
class CWLStringInput(str, _CWLInput):
6767
"""Use that hint to annotate that a variable is a string input. You can use the typing annotation
68-
as a string by importing it. At the generated script a command line argument with the name of the variable
69-
will be created and the assignment of value will be generalised.
68+
as a string by importing it. At the generated script a command line argument with the name of the variable
69+
will be created and the assignment of value will be generalised.
7070
71-
>>> dataset1: CWLBooleanInput = 'this is a message input'
72-
>>> dataset2: 'CWLBooleanInput' = 'yet another message input'
71+
>>> dataset1: CWLStringInput = 'this is a message input'
72+
>>> dataset2: 'CWLStringInput' = 'yet another message input'
7373
74-
"""
74+
"""
7575
pass
7676

7777

@@ -80,8 +80,8 @@ class CWLIntInput(_CWLInput):
8080
as a string by importing it. At the generated script a command line argument with the name of the variable
8181
will be created and the assignment of value will be generalised.
8282
83-
>>> dataset1: CWLBooleanInput = 1
84-
>>> dataset2: 'CWLBooleanInput' = 2
83+
>>> dataset1: CWLIntInput = 1
84+
>>> dataset2: 'CWLIntInput' = 2
8585
8686
"""
8787
pass
@@ -95,7 +95,7 @@ class CWLFilePathOutput(str, _CWLOutput):
9595
"""Use that hint to annotate that a variable is a string-path to an output file. You can use the typing annotation
9696
as a string by importing it. The generated file will be mapped as a CWL output.
9797
98-
>>> filename: CWLBooleanInput = 'data.csv'
98+
>>> filename: CWLFilePathOutput = 'data.csv'
9999
100100
"""
101101
pass
@@ -111,7 +111,7 @@ def dump(cls, dumper: Callable, filename, *args, **kwargs):
111111
112112
>>> import pandas
113113
>>> d: CWLDumpable.dump(d.to_csv, "dumpable.csv", sep="\\t", index=False) = pandas.DataFrame(
114-
... [[1,2,3], [4,5,6], [7,8,9]]
114+
... [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
115115
... )
116116
117117
In that example the converter will add at the end of the script the following line:
@@ -132,14 +132,11 @@ class CWLDumpableFile(CWLDumpable):
132132
133133
>>> data: CWLDumpableFile = "this is text data"
134134
135-
136135
the converter will append at the end of the script the following lines:
137136
138-
139137
>>> with open('data', 'w') as f:
140138
... f.write(data)
141139
142-
143140
and at the CWL, the data, will be mapped as a output.
144141
"""
145142
pass
@@ -165,14 +162,14 @@ class CWLPNGPlot(CWLDumpable):
165162
be called.
166163
167164
>>> import matplotlib.pyplot as plt
168-
>>> data = [1,2,3]
169-
>>> new_data: 'CWLPNGPlot' = plt.plot(data)
165+
>>> data = [1, 2, 3]
166+
>>> new_data: CWLPNGPlot = plt.plot(data)
170167
171168
the converter will tranform these lines to
172169
173170
>>> import matplotlib.pyplot as plt
174-
>>> data = [1,2,3]
175-
>>> new_data: 'CWLPNGPlot' = plt.plot(data)
171+
>>> data = [1, 2, 3]
172+
>>> new_data: CWLPNGPlot = plt.plot(data)
176173
>>> plt.savefig('new_data.png')
177174
178175
@@ -181,9 +178,9 @@ class CWLPNGPlot(CWLDumpable):
181178
To do that in your notebook you have to create a new figure before the plot command or use the CWLPNGFigure.
182179
183180
>>> import matplotlib.pyplot as plt
184-
>>> data = [1,2,3]
181+
>>> data = [1, 2, 3]
185182
>>> plt.figure()
186-
>>> new_data: 'CWLPNGPlot' = plt.plot(data)
183+
>>> new_data: CWLPNGPlot = plt.plot(data)
187184
"""
188185
pass
189186

@@ -194,14 +191,13 @@ class CWLPNGFigure(CWLDumpable):
194191
195192
>>> import matplotlib.pyplot as plt
196193
>>> data = [1,2,3]
197-
>>> new_data: 'CWLPNGPlot' = plt.plot(data)
194+
>>> new_data: CWLPNGFigure = plt.plot(data)
198195
199196
the converter will tranform these lines to
200197
201198
>>> import matplotlib.pyplot as plt
202-
>>> data = [1,2,3]
199+
>>> data = [1, 2, 3]
203200
>>> plt.figure()
204-
>>> new_data: 'CWLPNGPlot' = plt.plot(data)
201+
>>> new_data: CWLPNGFigure = plt.plot(data)
205202
>>> plt.savefig('new_data.png')
206-
207203
"""

0 commit comments

Comments
 (0)