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

Consider version and daemon flag on base argparser. Closes #424 #437

Merged
merged 3 commits into from
Jul 13, 2018

Conversation

machawk1
Copy link
Member

The redundancy and hard-coding is not ideal, but this makes the version (and daemon) flags accessible again.

@machawk1 machawk1 requested a review from ibnesayeed July 13, 2018 19:11
@codecov
Copy link

codecov bot commented Jul 13, 2018

Codecov Report

Merging #437 into master will decrease coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #437      +/-   ##
==========================================
- Coverage   23.31%   23.29%   -0.03%     
==========================================
  Files           6        6              
  Lines        1111     1112       +1     
  Branches      169      169              
==========================================
  Hits          259      259              
- Misses        835      836       +1     
  Partials       17       17
Impacted Files Coverage Δ
ipwb/__main__.py 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 10474d6...7a7550f. Read the comment docs.

Copy link
Member

@ibnesayeed ibnesayeed left a comment

Choose a reason for hiding this comment

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

This whole technique looks hacky. I was not aware that Python's standard arg parser library does not support optional sub-commands. We might look for some third-party libraries for the task in future.

ipwb/__main__.py Outdated
cmdError_invalidCommand = argCount > 1 and argsIn[1] not in cmdList
cmdError_invalidCommand = argCount > 1 \
and argsIn[1] not in cmdList \
and argsIn[1] not in baseParserFlagList
Copy link
Member

Choose a reason for hiding this comment

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

These two lines can perhaps be simplified as:

and argsIn[1] not in cmdList + baseParserFlagList

Copy link
Member Author

Choose a reason for hiding this comment

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

It may but I recall running into some issues. Your suggestion has been applied, though a line break was still needed for pycodestyle compliance.

Copy link
Member

Choose a reason for hiding this comment

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

This was a non-blocking stylistic change. Please do make sure that it works as expected after making this change.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ibnesayeed I did so before applying the changes. Joining lists/arrays via + makes we wary but I suppose it's a standard Python construct.

@machawk1 machawk1 merged commit 3d68547 into master Jul 13, 2018
@machawk1 machawk1 deleted the issue-424 branch July 13, 2018 19:56
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.

2 participants