[ 
https://issues.apache.org/jira/browse/BEAM-2774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286311#comment-16286311
 ] 

ASF GitHub Bot commented on BEAM-2774:
--------------------------------------

aaltay closed pull request #4242: [BEAM-2774] Ensure temp file is closed before 
returning.
URL: https://github.com/apache/beam/pull/4242
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/python/apache_beam/testing/test_utils.py 
b/sdks/python/apache_beam/testing/test_utils.py
index c28b6926e63..5676186b752 100644
--- a/sdks/python/apache_beam/testing/test_utils.py
+++ b/sdks/python/apache_beam/testing/test_utils.py
@@ -62,14 +62,13 @@ def create_temp_file(self, suffix='', lines=None):
     Returns:
       The name of the temporary file created.
     """
-    f = tempfile.NamedTemporaryFile(delete=False,
-                                    dir=self._tempdir,
-                                    suffix=suffix)
-    if lines:
-      for line in lines:
-        f.write(line)
-
-    return f.name
+    with tempfile.NamedTemporaryFile(
+        delete=False, dir=self._tempdir, suffix=suffix) as f:
+      if lines:
+        for line in lines:
+          f.write(line)
+
+      return f.name
 
 
 def compute_hash(content, hashing_alg=DEFAULT_HASHING_ALG):


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> Add I/O source for VCF files (python)
> -------------------------------------
>
>                 Key: BEAM-2774
>                 URL: https://issues.apache.org/jira/browse/BEAM-2774
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-core
>            Reporter: Asha Rostamianfar
>            Assignee: Miles Saul
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
> A new I/O source for reading (and eventually writing) VCF files [1] for 
> Python. The design doc is available at 
> https://docs.google.com/document/d/1jsdxOPALYYlhnww2NLURS8NKXaFyRSJrcGbEDpY9Lkw/edit
> [1] http://samtools.github.io/hts-specs/VCFv4.3.pdf



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to