Skip to content

Commit f19ef26

Browse files
committed
Fix lint
1 parent 0d35a3a commit f19ef26

File tree

4 files changed

+92
-213
lines changed

4 files changed

+92
-213
lines changed

Diff for: opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py

+25-52
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,7 @@ def collect(
298298
if value is None:
299299
value = 0
300300

301-
self._previous_value = (
302-
value + self._previous_value
303-
)
301+
self._previous_value = value + self._previous_value
304302

305303
return NumberDataPoint(
306304
attributes=self._attributes,
@@ -498,9 +496,7 @@ def collect(
498496
value = self._get_empty_bucket_counts()
499497

500498
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()
504500

505501
self._previous_value = [
506502
value_element + previous_value_element
@@ -768,10 +764,7 @@ def collect(
768764
is AggregationTemporality.DELTA
769765
):
770766

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:
775768
return None
776769

777770
previous_collection_start_nano = (
@@ -791,15 +784,11 @@ def collect(
791784
zero_count=zero_count,
792785
positive=BucketsPoint(
793786
offset=value_positive.offset,
794-
bucket_counts=(
795-
value_positive.get_offset_counts()
796-
),
787+
bucket_counts=(value_positive.get_offset_counts()),
797788
),
798789
negative=BucketsPoint(
799790
offset=value_negative.offset,
800-
bucket_counts=(
801-
value_negative.get_offset_counts()
802-
),
791+
bucket_counts=(value_negative.get_offset_counts()),
803792
),
804793
# FIXME: Find the right value for flags
805794
flags=0,
@@ -820,30 +809,26 @@ def collect(
820809
# to the current buckets).
821810

822811
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
825814
):
826815
# This happens if collect is called for the first time
827816
# and aggregate has not yet been called.
828817
value_positive = Buckets()
829-
self._previous_value_positive = (
830-
value_positive.copy_empty()
831-
)
818+
self._previous_value_positive = value_positive.copy_empty()
832819
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
835822
):
836823
value_negative = Buckets()
837-
self._previous_value_negative = (
838-
value_negative.copy_empty()
839-
)
824+
self._previous_value_negative = value_negative.copy_empty()
840825
if scale is None and self._previous_scale is None:
841826
scale = self._mapping.scale
842827
self._previous_scale = scale
843828

844829
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
847832
):
848833
# This happens when collect is called the very first time
849834
# and aggregate has been called before.
@@ -864,33 +849,25 @@ def collect(
864849
# ones resulting in the current ones unchanged we need to
865850
# generate empty buckets that have the same size and amount
866851
# 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()
870853
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
873856
):
874-
self._previous_value_negative = (
875-
value_negative.copy_empty()
876-
)
857+
self._previous_value_negative = value_negative.copy_empty()
877858
if scale is not None and self._previous_scale is None:
878859
self._previous_scale = scale
879860

880861
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
883864
):
884-
value_positive = (
885-
self._previous_value_positive.copy_empty()
886-
)
865+
value_positive = self._previous_value_positive.copy_empty()
887866
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
890869
):
891-
value_negative = (
892-
self._previous_value_negative.copy_empty()
893-
)
870+
value_negative = self._previous_value_negative.copy_empty()
894871
if scale is None and self._previous_scale is not None:
895872
scale = self._previous_scale
896873

@@ -971,17 +948,13 @@ def collect(
971948
positive=BucketsPoint(
972949
offset=self._previous_value_positive.offset,
973950
bucket_counts=(
974-
self.
975-
_previous_value_positive.
976-
get_offset_counts()
951+
self._previous_value_positive.get_offset_counts()
977952
),
978953
),
979954
negative=BucketsPoint(
980955
offset=self._previous_value_negative.offset,
981956
bucket_counts=(
982-
self.
983-
_previous_value_negative.
984-
get_offset_counts()
957+
self._previous_value_negative.get_offset_counts()
985958
),
986959
),
987960
# FIXME: Find the right value for flags

0 commit comments

Comments
 (0)