This repository was archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 107
Add asPercent function #966
Merged
+1,592
−82
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
58f3c4b
wip: Initial asPercent function. works with no arguments
stivenbb e32031f
added arg that accepts different types of args
stivenbb c434121
Bug fix: make ArgIn work properly with series AND allow series to be …
stivenbb cf3b879
fixed nodes parameter and added tests
stivenbb c01bb11
more tests
stivenbb 79aeebe
modified readme
stivenbb 6d8ae12
made requested changes
stivenbb 1a17f36
changed comment
stivenbb 2b147d2
removed unnecessary _
stivenbb 8ff0653
sort output series in tests
stivenbb 653c0ba
ensure that series don't get modified and added tests
stivenbb 79d81bd
copy tags as well
stivenbb f5ed45b
split up Exec
stivenbb d690235
unit tests for ArgIn (based on asPercent)
Dieterbe 863a454
Added Series.Copy; Fixed ArgIn kwarg error; changed behavior for empt…
stivenbb c90b4ac
copy only where necessary.
stivenbb f66913c
add old unit tests
Dieterbe 36392d1
PR changes
stivenbb 63c4513
formatting
stivenbb 8fd0832
removed unused
stivenbb 309c999
check if None is used for non-optional argument
stivenbb cc24e21
skip arg if optional None
stivenbb 9171b99
it shouldn't be up to caller of consumeKwarg to provide half-consumed…
Dieterbe bd84f57
alphabetical ordering of cases
Dieterbe b476724
PR changes
stivenbb d350e37
format
stivenbb c480969
refactored tests and merged into one file
stivenbb 172dccb
move pool recycling close to pool getting + bugfix
Dieterbe b6abd38
can use pool to source none slice
Dieterbe 54afde0
better comments
Dieterbe 22870b9
fix scoping issue
stivenbb 2b34f46
don't sum unneeded totals
stivenbb 7555e2b
Merge branch 'master' into asPercent
Dieterbe 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
changed comment
commit 1a17f367a11712031f528b7ebaf2d63684802573
There are no files selected for viewing
This file contains 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.
same problem as before AFAICT.
totals
can be zero length, in which case we should return an error here.or am i missing something?
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.
If totals is zero length, it is not an error. Instead, it will return a bunch of empty series with names something like
asPercent(foo.*,MISSING)
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.
Ohhh I see what you mean. Because the totalsSeries has to be either
== 1
or== len(series)
But the error will get triggered at a later check. Plus, if the series is empty as well, then it should trigger an error technically
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.
Generally I think it's better to return the error early when we can. So when reasoning about the code we have fewer special cases that complicate things further down.
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.
Ok, I moved up the validation like you suggested, so the check for proper length of totals is right after it. (Gonna push soon just looking at one more thing)
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.
why can't we just check the len of totals right after
?
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.
@stivenbb ^^ why can't we just return an error here if
len(totals)
is 0 ? this case still slips through into theif s.nodes != ni
case for exampleThere 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.
When
nodes != nil
andlen(totals) == 0
, it shouldn't fail. Instead, all targets will beasPercent(foo,MISSING)
(Which is what Graphite would do)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.
aha! ok thx