ome / omero-py

Python project containing Ice remoting code for OMERO
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
20 stars 33 forks source link

pass more options to `omero.util.import_candidates` #235

Open glyg opened 4 years ago

glyg commented 4 years ago

I would like to be able to pass more options to import_candidates, such as

Adding a **kwargs agument to the as_stdout could do the trick (or a more explicit extra_opts):

def as_stdout(path, readers="", extra_opts=None):
    if extra_opts is None:
        extra_opts = []
    path = _to_list(path)
    readers = str(readers)
    cli = CLI()
    cli.loadplugins()
    if readers:
        cli.invoke(["import",] + extra_opts + [ "-l", readers, "-f"] + path)
    else:
        cli.invoke(["import", "-f"]  + extra_opts + path)
  ...

There's no rush, as I'm anticipating on problems I haven't had yet ;-)

Thanks!

joshmoore commented 4 years ago
  • would the exluded files not appear in the output?

-f is a local-only operation where as --exclude requires a login so that won't do what you want.

Otherwise, :+1: for having other options like depth. Others that might make sense include:

but I'd be happy with a catch-all solution like you propose.

glyg commented 4 years ago

great (could have guessed for --exclude).

I can open a PR if you want (and can point me to the relevant tests to update / implement).

joshmoore commented 4 years ago

Sorry for the slow response, @glyg. When I went looking for such tests, I got lost. (i.e. they don't seem to exist)

glyg commented 4 years ago

Ha! Well it would not be bad for me as an exercise to get to know omero better to write those, would it? Maybe I can build on https://github.com/ome/omero-py/blob/master/test/unit/clitest/test_import.py ?

joshmoore commented 4 years ago

:) Indeed. There are a few that have -f options, but they aren't necessarily testing the functionality itself.