You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by jr...@apache.org on 2023/08/23 19:24:22 UTC

[beam] branch master updated: Add type hint to CounterCell (#27522)

This is an automated email from the ASF dual-hosted git repository.

jrmccluskey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 52275ebddf7 Add type hint to CounterCell (#27522)
52275ebddf7 is described below

commit 52275ebddf7c4b3998740c27257b3155e39e799d
Author: Jack McCluskey <34...@users.noreply.github.com>
AuthorDate: Wed Aug 23 15:24:13 2023 -0400

    Add type hint to CounterCell (#27522)
    
    * [DO NOT MERGE] Add type hint to CounterCell
    
    * Tryt alt type hint format
    
    * Call out integer type in docstring
---
 sdks/python/apache_beam/metrics/cells.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sdks/python/apache_beam/metrics/cells.py b/sdks/python/apache_beam/metrics/cells.py
index 259f29b2f0e..53b6fc84959 100644
--- a/sdks/python/apache_beam/metrics/cells.py
+++ b/sdks/python/apache_beam/metrics/cells.py
@@ -99,9 +99,9 @@ class CounterCell(MetricCell):
 
   Tracks the current value and delta of a counter metric.
 
-  Each cell tracks the state of a metric independently per context per bundle.
-  Therefore, each metric has a different cell in each bundle, cells are
-  aggregated by the runner.
+  Each cell tracks the state of an integer metric independently per context
+  per bundle. Therefore, each metric has a different cell in each bundle,
+  cells are aggregated by the runner.
 
   This class is thread safe.
   """
@@ -126,6 +126,7 @@ class CounterCell(MetricCell):
     self.update(-n)
 
   def update(self, value):
+    # type: (int) -> None
     if cython.compiled:
       ivalue = value
       # Since We hold the GIL, no need for another lock.