Skip to content

Commit 5f656ad

Browse files
hallvictoriaVictoria Hall
and
Victoria Hall
authored
fix: allow source to be string and enum (#256)
* allowing both BlobSource and string source values * add test * using isinstance, removed extra if check * mypy fix --------- Co-authored-by: Victoria Hall <[email protected]>
1 parent c0e1748 commit 5f656ad

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

azure/functions/decorators/blob.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def __init__(self,
1717
**kwargs):
1818
self.path = path
1919
self.connection = connection
20-
self.source = source.value if source else None
20+
if isinstance(source, BlobSource):
21+
self.source = source.value
22+
else:
23+
self.source = source # type: ignore
2124
super().__init__(name=name, data_type=data_type)
2225

2326
@staticmethod

tests/decorators/test_blob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_blob_trigger_creation_with_source_as_string(self):
5050
trigger = BlobTrigger(name="req",
5151
path="dummy_path",
5252
connection="dummy_connection",
53-
source=BlobSource.EVENT_GRID,
53+
source="EventGrid",
5454
data_type=DataType.UNDEFINED,
5555
dummy_field="dummy")
5656

0 commit comments

Comments
 (0)