[ 
https://issues.apache.org/jira/browse/BEAM-8280?focusedWorklogId=381168&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-381168
 ]

ASF GitHub Bot logged work on BEAM-8280:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Feb/20 19:50
            Start Date: 03/Feb/20 19:50
    Worklog Time Spent: 10m 
      Work Description: udim commented on pull request #10735: 
[BEAM-8280][BEAM-8629] Make IOTypeHints immutable
URL: https://github.com/apache/beam/pull/10735#discussion_r374305378
 
 

 ##########
 File path: sdks/python/apache_beam/typehints/decorators.py
 ##########
 @@ -228,18 +234,30 @@ class IOTypeHints(object):
       May be None. The list and dict correspond to args and kwargs.
     output_types: (tuple, dict) List of typing types, and an optional 
dictionary
       (unused). Only the first element of the list is used. May be None.
+    origin: (List[str]) Stack of tracebacks of method calls used to create this
+      instance.
   """
-  __slots__ = ('input_types', 'output_types')
 
-  def __init__(self,
-               input_types=None,  # type: Optional[Tuple[Tuple[Any, ...], 
Dict[str, Any]]]
-               output_types=None  # type: Optional[Tuple[Tuple[Any, ...], 
Dict[str, Any]]]
-              ):
-    self.input_types = input_types
-    self.output_types = output_types
+  traceback_limit = 5
 
-  @staticmethod
-  def from_callable(fn):
+  @classmethod
+  def _make_traceback(cls, base):  # type: (Optional[IOTypeHints]) -> List[str]
+    # Omit this method and the IOTypeHints method that called it.
+    num_frames_skip = 2
+    tb = traceback.format_stack(limit=cls.traceback_limit + num_frames_skip)
+    tb_lines = 'TH>' + ''.join(tb[:-num_frames_skip]).replace('\n', '\nTH>')
+
+    res = [tb_lines + '\nbased on: ' + str(base)]
+    if base is not None:
+      res += base.origin
+    return res
+
+  @classmethod
+  def empty(cls):
+    return IOTypeHints(None, None, [])
 
 Review comment:
   done
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 381168)
    Time Spent: 3h 10m  (was: 3h)

> re-enable IOTypeHints.from_callable
> -----------------------------------
>
>                 Key: BEAM-8280
>                 URL: https://issues.apache.org/jira/browse/BEAM-8280
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Udi Meiri
>            Assignee: Udi Meiri
>            Priority: Major
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> See https://issues.apache.org/jira/browse/BEAM-8279



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to