From 3a3b4e7f43f50e7d5fe51f4bbd093cb3de667d9c Mon Sep 17 00:00:00 2001
From: Dmitry Selyutin <ghostmansd@gmail.com>
Date: Sun, 22 Oct 2017 23:55:25 +0300
Subject: [PATCH] generator: __enter__ and __exit__ methods

---
 pygnulib/generator.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/pygnulib/generator.py b/pygnulib/generator.py
index eb8fc9bd8d..9274eae561 100644
--- a/pygnulib/generator.py
+++ b/pygnulib/generator.py
@@ -39,14 +39,25 @@ class Generator:
         "# Generated by gnulib-tool.",
     )
 
+
     def __repr__(self):
         module = self.__class__.__module__
         name = self.__class__.__name__
         return "{0}.{1}".format(module, name)
 
+
     def __str__(self):
         return "\n".join([_ for _ in self])
 
+
+    def __enter__(self):
+        return self
+
+
+    def __exit__(self, exctype, excval, exctrace):
+        pass
+
+
     def __iter__(self):
         for line in Generator._TEMPLATE:
             yield line
@@ -96,6 +107,8 @@ class POMakefile(Generator):
         "# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.",
         "USE_MSGCTXT = no"
     )
+
+
     def __init__(self, config):
         _type_assert("config", config, _BaseConfig)
         super().__init__()
@@ -319,6 +332,7 @@ class InitMacroHeader(InitMacro):
         "  gl_COMMON",
     )
 
+
     def __init__(self, config, macro_prefix=None):
         """
         config: gnulib configuration
-- 
2.39.5