Removed unnecessary `open`

This commit is contained in:
niten 2023-01-09 11:14:25 -08:00
parent e71fdd6977
commit cdc033f541
1 changed files with 2 additions and 2 deletions

View File

@ -114,10 +114,10 @@ def result_to_dict(res, base_url):
def analyze_image(request: Request, image: UploadFile): def analyze_image(request: Request, image: UploadFile):
print("Initiating file receipt, url: " + str(request.url)) print("Initiating file receipt, url: " + str(request.url))
base_url = re.sub(r'\/images\/?$', '/analyzed_images/', str(request.url)) base_url = re.sub(r'\/images\/?$', '/analyzed_images/', str(request.url))
infile = open(incoming_dir / image.filename) infile = incoming_dir / image.filename
file_hash = hashlib.sha256() file_hash = hashlib.sha256()
file_hash.update(image) file_hash.update(image)
with open(infile, "wxb") as f: with open(infile, "w") as f:
chunk = image.read(buffer_size) chunk = image.read(buffer_size)
while chunk: while chunk:
print ("writing " + buffer_size + " bytes") print ("writing " + buffer_size + " bytes")