Conversation
I skipped heuristics, tests, and anything from the repo's top level.
|
The E203 error in the linting step can be ignore- E203 is not PEP8 compatible and flake8 is in the wrong on this. |
smoia
left a comment
There was a problem hiding this comment.
I went through half of the files and I saw many cases that need fixing - I know, you whised it was as simple as just running black.
Can I ask you to look at the changes? I will continue later on.
| @@ -22,136 +22,186 @@ def _get_parser(): | |||
| """ | |||
| parser = argparse.ArgumentParser() | |||
There was a problem hiding this comment.
Some of the parser helps got weird. we should probably manually edit them after black - unless I missed the part in which black doesn't substitute ' with " if " is contained in the string, but then it becomes incredibly ugly and confusing.
There was a problem hiding this comment.
I've gone through and cleaned up the strings. Some switches between ' and " are necessary, although the internal double-quotes could be changed to single-quotes to eliminate them.
There was a problem hiding this comment.
Sounds reasonable! In fact, I think they were double quote for a similar reason (not to confuse them with the external single quotes).
There was a problem hiding this comment.
Awesome. I've switched them.
phys2bids/cli/run.py
Outdated
| type=str, | ||
| help="Folder where output should be placed. " | ||
| "Default is current folder. " | ||
| 'If "-heur" is used, it\'ll become ' |
phys2bids/interfaces/txt.py
Outdated
| orig_units.append(item.split(" ")[1]) | ||
| units = [ | ||
| "s", | ||
| ] |
There was a problem hiding this comment.
I know why black is formatting this list in this way throughout the whole file, but it's awful. can we add a #fmt: off (or whatever it was) here?
There was a problem hiding this comment.
This is fixed by just not including the trailing commas in the lists (not sure why they're there). black won't reformat units = ["s"], so I'll just revert those.
There was a problem hiding this comment.
After digging a bit, it turns out that trailing commas are there to make lists easily extensible, so it actually makes sense to expand any list with a comma at the end to multiple lines because you expect that list to grow and you want minimal diffs when that happens. In any case, these lists aren't likely to grow, so I just removed the trailing commas and put them on single lines.
| LGR.warning('While "-heur" was specified, option "-sub" was not.\n' | ||
| 'Skipping BIDS formatting.') | ||
| LGR.warning( | ||
| 'While "-heur" was specified, option "-sub" was not.\n' |
There was a problem hiding this comment.
Do you mean the new line is odd, or the fact that this line uses single quotes and the next uses double quotes?
| # kelvin: thermodynamic temperature | ||
| "kelvin": "K", "kelvins": "K", | ||
| # mole: amount of substance | ||
| "mol": "mol", "mole": "mol", | ||
| # newton: force, weight | ||
| "newton": "N", "newtons": "N", | ||
| # pascal: pressure, stress | ||
| "pascal": "Pa", "pascals": "Pa", "pa": "Pa", | ||
| # volt: voltage (electrical potential), emf | ||
| "volt": "V", "volts": "V", | ||
| # degree Celsius: temperature relative to 273.15 K | ||
| "°c": "°C", "°celsius": "°C", "celsius": "°C", | ||
| # ampere: electric current | ||
| "ampere": "A", "amp": "A", "amps": "A", | ||
| # second: time and hertzs: frequency | ||
| # siemens: electric conductance (e.g. EDA) | ||
| "siemens": "S", | ||
| # second: time and hertzs | ||
| "1/hz": "s", "1/hertz": "s", "hz": "Hz", | ||
| "1/s": "Hz", "1/second": "Hz", "1/seconds": "Hz", | ||
| "1/sec": "Hz", "1/secs": "Hz", "hertz": "Hz", | ||
| "second": "s", "seconds": "s", "sec": "s", | ||
| "secs": "s", | ||
| # All the aliases with one letter (to avoid issues) | ||
| "k": "K", "n": "N", "v": "V", "c": "°C", "a": "A", "s": "s", |
| f"The given unit prefix {unit} does not " | ||
| "have aliases, passing it as is" | ||
| ) | ||
| prefix = orig_unit[: len(unit)] |
There was a problem hiding this comment.
Well this is new to me.
There was a problem hiding this comment.
I was referring to the space after the colon.
There was a problem hiding this comment.
Yes, it takes some getting used to. The PEP8 rules for colons are annoyingly complicated, but this more in line with them than what flake8 enforces.
| 'call phys2bids using both "-ntp" and "-tr" arguments') | ||
| LGR.warning( | ||
| "Skipping trigger pulse count. If you want to run it, " | ||
| 'call phys2bids using both "-ntp" and "-tr" arguments' |
References issue #324 and PR #327. This should probably be merged before #327, so that the linting CI step passes in that PR.
Proposed Changes
blackon the package, skipping heuristics, tests, and anything from the repo's top level.