Closed MicahGale closed 8 months ago
changed target branch from main
to develop
added 2 commits
added 1 commit
added 2 commits
added 3 commits
In GitLab by @tjlaboss on Jan 24, 2022, 17:51
Commented on mcnpy/input_parser/input_syntax_reader.py line 65
def read_data(fh, block_type: int=None, recursion=False):
Docstring needs to include block_type
and recursion
.
In GitLab by @tjlaboss on Jan 24, 2022, 17:51
Commented on mcnpy/input_parser/input_syntax_reader.py line 143
I think this will work as written. Let's verify that with a test case at least 3 files deep.
In GitLab by @tjlaboss on Jan 24, 2022, 17:51
Commented on mcnpy/input_parser/mcnp_input.py line 39
self._words = words
self._block_type = block_type
Misuse of private variables. Only use double underscore if children should not have access to these attributes. Otherwise, use single-underscore for private variables.
In GitLab by @tjlaboss on Jan 24, 2022, 17:51
Commented on mcnpy/input_parser/mcnp_input.py line 74
self._words = card.words
self._block_type = card.block_type
Don't use name mangling except for debugging.
In GitLab by @tjlaboss on Jan 24, 2022, 17:51
Commented on mcnpy/input_parser/mcnp_input.py line 70
I don't understand the inheritance here: if ReadCard
is a Card
, why not keep its parent's __init__
?
In GitLab by @tjlaboss on Jan 24, 2022, 17:51
Commented on mcnpy/mcnp_problem.py line 250
self.__surfaces += surfaces
self.__materials += materials
self.__data_cards += materials
Do these need to be double-underscore privates?
In GitLab by @tjlaboss on Jan 24, 2022, 17:53
The recursive read function looks good on inspection. I'll have to play around with a test case and see if it behaves as expected.
The suggested changes are primarily on the use of private variables.
You mean having three levels of files having read cards?
I really need to start a testing plan. Is integration testing the main way to go?
Yes I learned this the hard way with subclassing. At this point it's just Protected right?
The goal with the init is to extract the filename. I'm not tackling this the best way I agree. Are you suggesting the same function signature and then using super?
You saw right through my first attempt at private variables ever.
In GitLab by @tjlaboss on Jan 25, 2022, 11:57
Commented on mcnpy/input_parser/mcnp_input.py line 70
Yes.
In GitLab by @tjlaboss on Jan 25, 2022, 12:01
Commented on mcnpy/input_parser/mcnp_input.py line 39
Essentially yes. Python doesn't officially use Private/Protected terminology.
In GitLab by @tjlaboss on Jan 25, 2022, 12:03
Generally speaking, I always use single-underscores for _private variables. It's pretty rare when something needs to be name-mangled __private.
In GitLab by @tjlaboss on Jan 25, 2022, 12:07
Commented on mcnpy/input_parser/input_syntax_reader.py line 143
Right. File 1 reads File 2, which reads File 3.
Good practice is to start with unit tests. I am ~sometimes~ usually lazy and start with just one big integration test, filling in the unit tests once it starts working.
marked this merge request as ready
block type is actually an enum, noted.
In GitLab by @tjlaboss on Feb 19, 2022, 11:20
This needs !6. Let's apply that and then merge.
This is covered by tests.test_integration.test_read_card_recursion
in !11.
And I think !6 needs !8 and !10 to merge safely. So I'm thinking: !10 + !8 -> !6 -> !4.
I think this should be covered now.
Covered by !6.
Should be included in !6
changed this line in version 7 of the diff
changed this line in version 7 of the diff
changed this line in version 7 of the diff
added 33 commits
added 29 commits
changed this line in version 9 of the diff
changed this line in version 9 of the diff
added 13 commits
added 1 commit
Is this resolved by: 6bda4b48?
Resolved by !6 and 3fb99a0.
mentioned in commit f5ba9b44bba752d4da5230e06f09107972ac7632
Merges issue5ReadCard -> develop