Skip to content

Commit

Permalink
fix Pylance warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vorostamas committed Nov 2, 2023
1 parent 10f6d9f commit 4b92e7e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lidgrosyncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def create_new_product(name):
)
if not get_product_by_name:
_LOGGER.info(name + " is not in product names, creating new product")
return grocy.add_generic(entity_type=EntityType.PRODUCTS, data=payload)[
"created_object_id"
]
response = grocy.add_generic(entity_type=EntityType.PRODUCTS, data=payload)
if response is not None:
return response["created_object_id"]
else:
return get_product_by_name[0]["id"]

Expand All @@ -140,9 +140,11 @@ def add_barcode(product_id, barcode):
"qu_id": "1",
}
try:
return grocy.add_generic(entity_type=EntityType.PRODUCT_BARCODES, data=payload)[
"created_object_id"
]
response = grocy.add_generic(
entity_type=EntityType.PRODUCT_BARCODES, data=payload
)
if response is not None:
return response["created_object_id"]
except GrocyError as error:
_LOGGER.error("Error during barcode creation, message: %s", error.message)
raise Exception("Barcode creation exception: ", error)
Expand Down

0 comments on commit 4b92e7e

Please sign in to comment.