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

Add support for --show history=config.foo.bar #25

Merged
merged 1 commit into from Oct 10, 2016

Conversation

r-owen
Copy link
Contributor

@r-owen r-owen commented Oct 10, 2016

The "config." is optional

Copy link
Contributor Author

@r-owen r-owen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice new feature but please make the code simpler

if mat:
pattern = mat.group(1)
matConfig = re.search(r"^config(?:=(?:config.)?(.+))?", what)
matHistory = None if matConfig else re.search(r"^history(?:=(?:config.)?(.+))?", what)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this too confusing. The search string "^history(?:=(?:config.)?(.+))?" seems far trickier than is required, and making matHistory use the results of matConfig seems needlessly complicated. It would be far clearer to keep the two independent of each other, even if it made the code a bit more verbose.

The number of options is large enough now that it may be worth a different approach, such as first testing all options that have no associated data, then using something like this for the remaining possibilities:

if what == "tasks":
   ....
elif what == "data":
    ....
...  # test all items that cannot have associated data first, then...
else:
    item, data = what.split("=", 1)
    if item == "config":
        configMatch = ...
    elif item == "history":
        historyMatch = ...


sys.exit(1)

import lsst.pex.config.history as pch
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please import this at the top along with all other imports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants