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

Fixed _get_importances bug #73

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

Conversation

sbradnam
Copy link

Was attempting to convert an MCNP file, which had the word 'implicit' in one of the tally comment cards. This broke the _get_importances function in MCNPInputs so fixed with a startswith operation on the string.

@makeclean
Copy link
Owner

Sorry its taken me so long to look into this - there are instances where 'imp' occurs at the end of a string instead, which this would break I think. Would it make more sense to replace the line to search for 'imp:' instead?

@@ -98,7 +98,7 @@ def __get_importances(self, start_line):
return self.__process_importances()

# check for importance keyword
if "imp" in self.file_lines[idx]:
if self.file_lines[idx].startswith('imp'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about checking the start and end of the line

Suggested change
if self.file_lines[idx].startswith('imp'):
if self.file_lines[idx].startswith('imp') or self.file_lines[idx].endswith('imp') :

Copy link
Collaborator

Choose a reason for hiding this comment

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

having just had a similar issue i found we already had a pr to fix
endswith wont work,
changing the search to "imp:" makes the most sense

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if self.file_lines[idx].startswith('imp'):
if self.file_lines[idx].startswith('imp:'):

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.

4 participants