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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2bb40ef  Add __init__ method to Variable class (#9470)
2bb40ef is described below

commit 2bb40ef996a9da5e4eb7f63cceeef9b03b51494e
Author: Kaxil Naik <[email protected]>
AuthorDate: Mon Jun 22 08:33:11 2020 +0100

    Add __init__ method to Variable class (#9470)
---
 airflow/models/variable.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/airflow/models/variable.py b/airflow/models/variable.py
index e876790..a306dcf 100644
--- a/airflow/models/variable.py
+++ b/airflow/models/variable.py
@@ -44,6 +44,11 @@ class Variable(Base, LoggingMixin):
     _val = Column('val', Text)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
+    def __init__(self, key=None, val=None):
+        super().__init__()
+        self.key = key
+        self.val = val
+
     def __repr__(self):
         # Hiding the value
         return '{} : {}'.format(self.key, self._val)
@@ -157,7 +162,7 @@ class Variable(Base, LoggingMixin):
             stored_value = str(value)
 
         Variable.delete(key, session=session)
-        session.add(Variable(key=key, val=stored_value))  # type: ignore  # 
pylint: disable=E1123
+        session.add(Variable(key=key, val=stored_value))
         session.flush()
 
     @classmethod

Reply via email to