Comments (5)
I'm not sure I agree, but I could be missing something. If we auto-fill the values with None
s, how would we know if the user chose to not fill something out? Seems whether the values are present or not present you can use params.get("key"):
safely, but you'd in addition be able to check "key" in params
for the case where the user didn't even set that value.
In what way would you want to loop over the keys so that they should all be present but None
?
from openmicroscopy.
If a not filled option has a value of None
, the program will know which options were not filled in. If they are simply removed from the returned params, then it must also know the names of the options that went in. Note that getInputKeys()
will also not return their names.
None
is exactly what one would expect for a non-specified option. It makes sense to get None
when there is no value for an option. On the other hand, not having a key with that name means the option does not exist.
from openmicroscopy.
Sorry, but I'm still missing what you what do in a loop with these keys. Certainly, inputs.get("key")
will give you the None
you want without an extra check for key existence. Even better, you can pass a default which will be returned whether the user sets nothing or the value is None
anyway:
>>> {}.get(2, 3)
3
>>> {1:None}.get(2, 3)
3
from openmicroscopy.
To use inputs.get("key")
requires knowing what the key is. But the keys are defined once when constructing the UI and one should be able to not repeat their names through the rest of the code. In my specific case, the keys are commands for other programs and are all treated equally. I loop over all the keys and their values are the arguments. If the user sets no value for an option, the default is dependent on the image size, number of channels, and z-slices (so I can't make it non-optional).
I know how to work around this (I will have to so it works with 5.0.1). The simplest solution being to duplicate all the key names in a list and if they're missing after getInputs()
, fill them with None
. But the point is that one sets an option with a specific name, the user decides not to fill it (None), but when I get the list of options and values back, the option. An option without a value is different from a non-existing option. Or maybe I'm wrong. I've been reading a lot about the "pythonic" way and I'm still not sure what that would be in this case.
After creating the client, even forgetting about getting their values, I actually couldn't find a method that would give me the names all types that were used in its construction.
from openmicroscopy.
In my specific case, the keys are commands for other programs and are all treated equally.
That I can certainly understand. Thanks for the example. I'll see if I can add a workaround for what you want to #2460, or if there's not one, at least to record the requirement. Cheers, ~J.
from openmicroscopy.
Related Issues (20)
- failed upgrade to Omero5.5 - Ice 3.6 not found HOT 2
- More non-parallel test assumptions
- omero db script → psql: identifiers truncated
- Document Python logging properties
- Manage services from the omero settings HOT 1
- missing OMERO.insight-5.4.10-ice36-b105-linux.zip HOT 4
- AdminService load Experimenters and Groups options with GroupExperimenterMap
- Improve performance of graph operations. HOT 2
- Annotations displaced when opening saved qpdata file HOT 1
- Alternate gradle/maven artifactory location? HOT 3
- CZI file Exposure time HOT 4
- Fix JSON API JavaScript login example HOT 1
- Increase the usage of compound assignment operators HOT 1
- Release process review HOT 4
- Remove Pixels name, repo and path columns HOT 3
- OMERO.server: JDK 17 support HOT 1
- Update the OMERO model and API to represent and handle archived data
- Unpin numpy<2 HOT 2
- omero.LockTimeout exception on "omero admin email" HOT 7
- Distribution contents regression with Ivy 2.5.2 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openmicroscopy.