Skip to content

Commit

Permalink
Use f-string in custom operator docs (apache#16250)
Browse files Browse the repository at this point in the history
Use f-string formatting to support good practices
  • Loading branch information
turbaszek authored Jun 4, 2021
1 parent 014edbc commit 879e5d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/apache-airflow/howto/custom-operator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Let's implement an example ``HelloOperator`` in a new file ``hello_operator.py``
self.name = name
def execute(self, context):
message = "Hello {}".format(self.name)
message = f"Hello {self.name}"
print(message)
return message
Expand Down Expand Up @@ -117,7 +117,7 @@ Let's extend our previous example to fetch name from MySQL:
hook = MySqlHook(mysql_conn_id=self.mysql_conn_id, schema=self.database)
sql = "select name from user"
result = hook.get_first(sql)
message = "Hello {}".format(result["name"])
message = f"Hello {result['name']}"
print(message)
return message
Expand Down Expand Up @@ -160,7 +160,7 @@ the operator.
self.name = name
def execute(self, context):
message = "Hello from {}".format(self.name)
message = f"Hello from {self.name}"
print(message)
return message
Expand Down

0 comments on commit 879e5d2

Please sign in to comment.