Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: allow config params in scr.init #381

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

adammoody
Copy link
Contributor

@adammoody adammoody commented Jun 24, 2021

Just hacking around since python is cool. Not sure we want to support this, so I'll leave it hanging as WIP.

This extends scr.init() to accept SCR configuration parameters. One may specify a single parameter as a string, or a set of params using a list or dict. Those are internally passed to scr.config() before calling SCR_Init. For example, all of the following would be valid:

# as str
scr.init("SCR_DEBUG=")
scr.init("SCR_DEBUG=1")

# as list
scr.init(["SCR_DEBUG=1", "SCR_COPY_TYPE=SINGLE"])

params = list()
params.append("SCR_DEBUG=1")
params.append("SCR_CACHE_SIZE=2")
scr.init(params)

# as dict
scr.init({"SCR_DEBUG": 1, "SCR_COPY_TYPE": "SINGLE"})
scr.init({"SCR_DEBUG": None, "SCR_COPY_TYPE": "SINGLE"})

params = dict()
params["SCR_DEBUG"] = 1
params["SCR_CACHE_SIZE"] = 2
scr.init(params)

That feels more python-like, but I'm not sure it buys much over just calling scr.config several times, e.g.,:

scr.config("SCR_DEBUG=1")
scr.config("SCR_CACHE_SIZE=2")
scr.init()

Unless users really need something like this, it's probably not worth the extra effort to develop, test, maintain, and document. If it is requested, we could add similar logic to scr.config to take a set of params in one call.

@adammoody adammoody added the WIP label Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant