ashb edited a comment on pull request #12512:
URL: https://github.com/apache/airflow/pull/12512#issuecomment-732227408


   > > I think this is all we'd have to change to remove the `yaml.safe_load` 
from in the generated provieer_info.
   > > It won't be the prettiest, but we can fix that by running black on it 
after generating the template.
   > 
   > I tested this and this is what the provider info for amazon package looks 
okay, if horrible without black formatting.
   
   Formatting with black is quite straight forward:
   
   ```
   +    import black
        with open(get_provider_file_path, "wt") as get_provider_file:
   -        get_provider_file.write(get_provider_content)
   +        get_provider_file.write(black.format_str(get_provider_content, 
mode=black.FileMode()))
    
   ```
   
   (In  black >= 0.20.8b0, that has been renamed to just `Mode`, but the 
version in my container was older than that.)
   
   It now looks like:
   
   ```
   def get_provider_info():
       {
           "package-name": "apache-airflow-providers-amazon",
           "name": "Amazon",
           "description": "Amazon integration (including `Amazon Web Services 
(AWS) <https://aws.amazon.com/>`__).\n",
           "versions": ["1.0.0b2"],
           "integrations": [
               {
   ```


----------------------------------------------------------------
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:
[email protected]


Reply via email to