Conversation
sudeeprp
left a comment
There was a problem hiding this comment.
Good effort @LaserTrajectory 👍
Most of my comments are around readability. Have a look below.
statistics.py
Outdated
| if len(numbers) == 0: | ||
|
|
||
| vals = [math.nan for i in keys] # is_nan test | ||
| # print(vals) |
statistics.py
Outdated
|
|
||
| else: | ||
|
|
||
| vals = [ round((sum(numbers) / len(numbers)), 3), max(numbers), min(numbers) ] # min_max_report test |
There was a problem hiding this comment.
Hard to read this code and correlate the order of the statistics. Will get harder to read when we add more statistics.
If the intended return is a dictionary, why not initialize it as a dictionary itself, instead of two arrays?
statistics.py
Outdated
|
|
||
| if stats["max"] > self.maxThresh: | ||
|
|
||
| self.alertArrs[0].emailSent = True |
There was a problem hiding this comment.
The meaning of the indexes [0] and [1] are hidden in the implementation, which a caller of this code will need to understand. This means the caller will need to see the implementation of the function.
Find a way to make this explicit by naming the function parameters (instead of an implicit order inside alertArrs)
| self.assertTrue(isnan(computedStats["max"])) | ||
| self.assertTrue(isnan(computedStats["min"])) | ||
|
|
||
| def test_invalid_arg_returns_None(self): |
statistics.py
Outdated
|
|
||
| # below: alerts tests | ||
|
|
||
| class EmailAlert: |
There was a problem hiding this comment.
Does 'alerting' responsibility belong in statistics.py?
It would be hard for someone to guess that statistics.py contains the alerting stubs as well
statistics.py
Outdated
|
|
||
| else: | ||
|
|
||
| return # invalid_arg test |
There was a problem hiding this comment.
Took me a while to trace back the else here. This function will tend to grow more complex as more conditions are imposed on the inputs and outputs. You can watch out for this by limiting the cyclomatic complexity. Take a look at that link and we'll talk about tooling related to that quantification later.
👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to
mainsince the assignment started. Your teacher can see this too.Notes for teachers
Use this PR to leave feedback. Here are some tips: - Click the **Files changed** tab to see all of the changes pushed to `main` since the assignment started. To leave comments on specific lines of code, put your cursor over a line of code and click the blue **+** (plus sign). To learn more about comments, read “[Commenting on a pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request)”. - Click the **Commits** tab to see the commits pushed to `main`. Click a commit to see specific changes. - If you turned on autograding, then click the **Checks** tab to see the results. - This page is an overview. It shows commits, line comments, and general comments. You can leave a general comment below. For more information about this pull request, read “[Leaving assignment feedback in GitHub](https://docs.github.com/education/manage-coursework-with-github-classroom/leave-feedback-with-pull-requests)”.Subscribed: @LaserTrajectory