Skip to content

Commit

Permalink
Further simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
mhosken committed Dec 24, 2024
1 parent cfa196a commit 9e58361
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/simpleapp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

from simpleapp.argparse import ArgumentParser
from simpleapp.pipeline import Pipeline
from simpleapp.pipeline import Pipeline, f_, textinfile, textoutfile, jsoninfile, \
jsonoutfile, csvinfile, csvinfiledict, csvoutfile
from simpleapp.changes import Changes
5 changes: 2 additions & 3 deletions src/simpleapp/examples/nothing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import simpleapp
from simpleapp.pipeline import Pipeline, textinfile, textoutfile
from simpleapp import *

def process(txt, args):
return txt
Expand All @@ -10,7 +9,7 @@ def main(argv=None):
parser.add_argument("-o","--outfile",help="Output file")
args = parser.parse_args(argv)

Pipeline(args, textinfile, process, textoutfile, defaultext="_output")
Pipeline(args, textinfile, process, textoutfile)

if __name__ == "__main__":
main()
Expand Down
8 changes: 3 additions & 5 deletions src/simpleapp/examples/runregchanges.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/python3

from simpleapp import changes
from simpleapp.pipeline import Pipeline, textinfile, textoutfile
from simpleapp import Changes, Pipeline, textinfile, textoutfile

def main(argv=None):
parser = simpleapp.ArgumentParser(prog='runregchanges', logging=True)
Expand All @@ -10,9 +9,8 @@ def main(argv=None):
parser.add_argument("-o","--outfile",help="Output file")
args = parser.parse_args(argv)

c = changes.Changes(args.changes)
Pipeline(args.infiles, args.outfile, args, textinfile, c.runChanges,
textoutfile, defaultext="_changed")
c = Changes(args.changes)
Pipeline(args, textinfile, c.runChanges, textoutfile)

if __name__ == "__main__":
main()
1 change: 0 additions & 1 deletion src/simpleapp/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def __init__(self, args, *fns, **kw):
to the next fn, with args as the second parameter. The final function is
called with: data, outfile, args.
kw may take the following options:
logging: if not None, enables logging based on --logging, --logfile
multiprocessing: if true processes files in parallel based on --jobs
'''
self.args = args
Expand Down

0 comments on commit 9e58361

Please sign in to comment.