Skip to content

Commit 1644523

Browse files
committed
sphinx docs added
1 parent 8a60697 commit 1644523

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

docs/source/fileformat.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
File formatting
2+
===============
3+
4+
.. automodule:: toolkit.fileformat
5+
:members:

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ If you are looking for information on a specific function, class, or method, thi
4646
imports
4747
logging
4848
signals
49+
fileformat

docs/source/utils.rst

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ Sample code ::
147147

148148
>>> from toolkit import Signal
149149
>>> signal_loggin = Signal("LoggedIn") # Creates a new signal
150-
>>> @signal_loggin.connect
151-
... def notify_user(username): # Connect the function to signal named signal_loggin
150+
>>> @signal_loggin.connect
151+
... def notify_user(username): # Connect the function to signal named signal_loggin
152152
... print("Notify user about new logging through mail")
153153
...
154154
>>> signal_loggin.send("test_user") # Send the signal from any where in the system
@@ -171,4 +171,34 @@ Sample Code ::
171171
>>> tables = schema.get_tables() # Get all the tables
172172
>>> enum_types = schema.get_enum_types() # Get all the enum types
173173
>>> table = schema.get_table('t1') # Get t1 table
174-
>>> table.get_indexes()
174+
>>> table.get_indexes()
175+
176+
fileformats
177+
-----------
178+
validate and transform the given data as per the fileformat specifications.
179+
180+
Given input data is passed through a pipeline of validators. These validators
181+
can check structure and schema, for example are their blank rows or columns, is the data of right type etc.
182+
183+
In return, the client receives a report on processing performed.
184+
185+
186+
Sample code ::
187+
188+
>>> from toolkit import FileFormat
189+
>>> formatter = FileFormat.from_file("fileformats/customer-master.yml")
190+
>>> formatter.process_file("master-files/customer-master/customer-master-20200601.csv")
191+
<Report:status=ACCEPTED #errors=0>
192+
193+
You can use command line tool as well for the validation (this comes along with the package).
194+
195+
Command line tool ::
196+
197+
$ validate-fileformat --help
198+
Usage: validate-fileformat [OPTIONS] FILE
199+
....
200+
$ validate-fileformat -f fileformats/customer-master.yml customer-master/customer-master-20200601.csv
201+
File validation status: ACCEPTED
202+
....
203+
$ validate-fileformat -f fileformats/customer-master.yml customer-master/customer-master-20200601.csv -o report.json
204+
File validation status: ACCEPTED

0 commit comments

Comments
 (0)