generated from clean-code-craft-tcq-1/statisact-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Feedback #1
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
Open
github-classroom
wants to merge
10
commits into
feedback
Choose a base branch
from
main
base: feedback
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feedback #1
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2690322
Setting up GitHub Classroom Feedback
github-classroom[bot] 87fc25f
is_nan & alerts functionality & invalid_arg test
LaserTrajectory 1235fad
cleaning up + comments
LaserTrajectory ca52461
updated w.r.t. feedback
LaserTrajectory 4672a37
cache files updated
LaserTrajectory 68d8508
created alerts.py for alerting classes
LaserTrajectory 098a98b
updated imports from alerts.py
LaserTrajectory ef7a95d
create limit-size.yml
LaserTrajectory b89b0fa
fixed bug in invalid arg test
LaserTrajectory 841f134
updated to reduce CCN to 3
LaserTrajectory File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| name: Limit complexity | ||
|
|
||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Install lizard | ||
| run: pip install lizard | ||
|
|
||
| - name: Limit complexity | ||
| run: $HOME/.local/bin/lizard --CCN 3 |
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import statistics | ||
|
|
||
| # below: alerts tests | ||
|
|
||
| class EmailAlert: | ||
|
|
||
| def __init__(self): | ||
| self.emailSent = False # by default | ||
|
|
||
| class LEDAlert: | ||
|
|
||
| def __init__(self): | ||
| self.ledGlows = False # by default | ||
|
|
||
| class StatsAlerter: | ||
|
|
||
| def __init__(self, maxThresh, alertArrs): | ||
|
|
||
| self.maxThresh = maxThresh | ||
| self.alertArrs = alertArrs | ||
| self.emailAlert = self.alertArrs[0] | ||
| self.ledAlert = self.alertArrs[1] | ||
|
|
||
| def checkAndAlert(self, numbers): | ||
|
|
||
| stats = statistics.calculateStats(numbers) | ||
|
|
||
| if stats["max"] > self.maxThresh: | ||
|
|
||
| self.emailAlert.emailSent = True | ||
| self.ledAlert.ledGlows = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,18 @@ | ||
| import math | ||
| from turtle import st | ||
|
|
||
| def calculateStats(numbers): | ||
| return None | ||
|
|
||
| stats = dict(zip(["avg", "max", "min"], [math.nan, math.nan, math.nan])) | ||
|
|
||
| if type(numbers) != list: | ||
|
|
||
| return None | ||
|
|
||
| if len(numbers) != 0: | ||
|
|
||
| stats["avg"] = round((sum(numbers) / len(numbers)), 3) | ||
| stats["max"] = max(numbers) | ||
| stats["min"] = min(numbers) # min_max_report test | ||
|
|
||
| return stats |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test added 👍