Use aiofiles for image provider file writes
This commit is contained in:
		
							
								
								
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							@@ -13,6 +13,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
- Refactoring
 | 
					- Refactoring
 | 
				
			||||||
  - Use .mjs modules
 | 
					  - Use .mjs modules
 | 
				
			||||||
 | 
					  - SignIn/RememberAccount screens
 | 
				
			||||||
  - Don't bake in size properties for components
 | 
					  - Don't bake in size properties for components
 | 
				
			||||||
  - Unfinished work in button-refactor branch
 | 
					  - Unfinished work in button-refactor branch
 | 
				
			||||||
    - Button can get "hoverEnabled: false" to let HoverHandlers work
 | 
					    - Button can get "hoverEnabled: false" to let HoverHandlers work
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ from pathlib import Path
 | 
				
			|||||||
from typing import Tuple
 | 
					from typing import Tuple
 | 
				
			||||||
from urllib.parse import urlparse
 | 
					from urllib.parse import urlparse
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from atomicfile import AtomicFile
 | 
					import aiofiles
 | 
				
			||||||
from dataclasses import dataclass, field
 | 
					from dataclasses import dataclass, field
 | 
				
			||||||
from PIL import Image as PILImage
 | 
					from PIL import Image as PILImage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -108,8 +108,8 @@ class Thumbnail:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        self.local_path.parent.mkdir(parents=True, exist_ok=True)
 | 
					        self.local_path.parent.mkdir(parents=True, exist_ok=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with AtomicFile(str(self.local_path), "wb") as file:
 | 
					        async with aiofiles.open(self.local_path, "wb") as file:
 | 
				
			||||||
            file.write(body)
 | 
					            await file.write(body)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return body
 | 
					        return body
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user