@@ -298,9 +298,7 @@ def collect(
298
298
if value is None :
299
299
value = 0
300
300
301
- self ._previous_value = (
302
- value + self ._previous_value
303
- )
301
+ self ._previous_value = value + self ._previous_value
304
302
305
303
return NumberDataPoint (
306
304
attributes = self ._attributes ,
@@ -498,9 +496,7 @@ def collect(
498
496
value = self ._get_empty_bucket_counts ()
499
497
500
498
if self ._previous_value is None :
501
- self ._previous_value = (
502
- self ._get_empty_bucket_counts ()
503
- )
499
+ self ._previous_value = self ._get_empty_bucket_counts ()
504
500
505
501
self ._previous_value = [
506
502
value_element + previous_value_element
@@ -768,10 +764,7 @@ def collect(
768
764
is AggregationTemporality .DELTA
769
765
):
770
766
771
- if (
772
- value_positive is None and
773
- value_negative is None
774
- ):
767
+ if value_positive is None and value_negative is None :
775
768
return None
776
769
777
770
previous_collection_start_nano = (
@@ -791,15 +784,11 @@ def collect(
791
784
zero_count = zero_count ,
792
785
positive = BucketsPoint (
793
786
offset = value_positive .offset ,
794
- bucket_counts = (
795
- value_positive .get_offset_counts ()
796
- ),
787
+ bucket_counts = (value_positive .get_offset_counts ()),
797
788
),
798
789
negative = BucketsPoint (
799
790
offset = value_negative .offset ,
800
- bucket_counts = (
801
- value_negative .get_offset_counts ()
802
- ),
791
+ bucket_counts = (value_negative .get_offset_counts ()),
803
792
),
804
793
# FIXME: Find the right value for flags
805
794
flags = 0 ,
@@ -820,30 +809,26 @@ def collect(
820
809
# to the current buckets).
821
810
822
811
if (
823
- value_positive is None and
824
- self ._previous_value_positive is None
812
+ value_positive is None
813
+ and self ._previous_value_positive is None
825
814
):
826
815
# This happens if collect is called for the first time
827
816
# and aggregate has not yet been called.
828
817
value_positive = Buckets ()
829
- self ._previous_value_positive = (
830
- value_positive .copy_empty ()
831
- )
818
+ self ._previous_value_positive = value_positive .copy_empty ()
832
819
if (
833
- value_negative is None and
834
- self ._previous_value_negative is None
820
+ value_negative is None
821
+ and self ._previous_value_negative is None
835
822
):
836
823
value_negative = Buckets ()
837
- self ._previous_value_negative = (
838
- value_negative .copy_empty ()
839
- )
824
+ self ._previous_value_negative = value_negative .copy_empty ()
840
825
if scale is None and self ._previous_scale is None :
841
826
scale = self ._mapping .scale
842
827
self ._previous_scale = scale
843
828
844
829
if (
845
- value_positive is not None and
846
- self ._previous_value_positive is None
830
+ value_positive is not None
831
+ and self ._previous_value_positive is None
847
832
):
848
833
# This happens when collect is called the very first time
849
834
# and aggregate has been called before.
@@ -864,33 +849,25 @@ def collect(
864
849
# ones resulting in the current ones unchanged we need to
865
850
# generate empty buckets that have the same size and amount
866
851
# as the current ones, this is what copy_empty does.
867
- self ._previous_value_positive = (
868
- value_positive .copy_empty ()
869
- )
852
+ self ._previous_value_positive = value_positive .copy_empty ()
870
853
if (
871
- value_negative is not None and
872
- self ._previous_value_negative is None
854
+ value_negative is not None
855
+ and self ._previous_value_negative is None
873
856
):
874
- self ._previous_value_negative = (
875
- value_negative .copy_empty ()
876
- )
857
+ self ._previous_value_negative = value_negative .copy_empty ()
877
858
if scale is not None and self ._previous_scale is None :
878
859
self ._previous_scale = scale
879
860
880
861
if (
881
- value_positive is None and
882
- self ._previous_value_positive is not None
862
+ value_positive is None
863
+ and self ._previous_value_positive is not None
883
864
):
884
- value_positive = (
885
- self ._previous_value_positive .copy_empty ()
886
- )
865
+ value_positive = self ._previous_value_positive .copy_empty ()
887
866
if (
888
- value_negative is None and
889
- self ._previous_value_negative is not None
867
+ value_negative is None
868
+ and self ._previous_value_negative is not None
890
869
):
891
- value_negative = (
892
- self ._previous_value_negative .copy_empty ()
893
- )
870
+ value_negative = self ._previous_value_negative .copy_empty ()
894
871
if scale is None and self ._previous_scale is not None :
895
872
scale = self ._previous_scale
896
873
@@ -971,17 +948,13 @@ def collect(
971
948
positive = BucketsPoint (
972
949
offset = self ._previous_value_positive .offset ,
973
950
bucket_counts = (
974
- self .
975
- _previous_value_positive .
976
- get_offset_counts ()
951
+ self ._previous_value_positive .get_offset_counts ()
977
952
),
978
953
),
979
954
negative = BucketsPoint (
980
955
offset = self ._previous_value_negative .offset ,
981
956
bucket_counts = (
982
- self .
983
- _previous_value_negative .
984
- get_offset_counts ()
957
+ self ._previous_value_negative .get_offset_counts ()
985
958
),
986
959
),
987
960
# FIXME: Find the right value for flags
0 commit comments