Skip to content

Commit e0b550c

Browse files
authored
Merge branch 'dev' into wangbill/native-type-hint
2 parents 94739ae + b620229 commit e0b550c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3167
-302
lines changed

.ci/build.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.ci/run_tests.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/workflows/gh-tests-ci.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "PR Title Enforcer"
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
main:
15+
name: Validate PR title
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v5
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
# AZURE FUNCTIONS TEAM
1010
# For all file changes, github would automatically include the following people in the PRs.
1111
#
12-
* @vrdmr @gavin-aguiar @YunchuWang @pdthummar
12+
13+
* @vrdmr @gavin-aguiar @YunchuWang @pdthummar @hallvictoria

azure/functions/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
DecoratorApi, DataType, AuthLevel,
1111
Cardinality, AccessRights, HttpMethod,
1212
AsgiFunctionApp, WsgiFunctionApp,
13-
ExternalHttpFunctionApp)
13+
ExternalHttpFunctionApp, BlobSource)
1414
from ._durable_functions import OrchestrationContext, EntityContext
1515
from .decorators.function_app import (FunctionRegister, TriggerApi,
1616
BindingApi, SettingsApi)
@@ -94,7 +94,8 @@
9494
'AuthLevel',
9595
'Cardinality',
9696
'AccessRights',
97-
'HttpMethod'
97+
'HttpMethod',
98+
'BlobSource'
9899
)
99100

100-
__version__ = '1.18.0b4'
101+
__version__ = '1.21.0b2'

azure/functions/_abc.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ class ServiceBusMessage(abc.ABC):
447447
def get_body(self) -> typing.Union[str, bytes]:
448448
pass
449449

450+
@property
451+
@abc.abstractmethod
452+
def application_properties(self) -> typing.Dict[str, typing.Any]:
453+
pass
454+
450455
@property
451456
@abc.abstractmethod
452457
def content_type(self) -> typing.Optional[str]:
@@ -457,6 +462,16 @@ def content_type(self) -> typing.Optional[str]:
457462
def correlation_id(self) -> typing.Optional[str]:
458463
pass
459464

465+
@property
466+
@abc.abstractmethod
467+
def dead_letter_error_description(self) -> typing.Optional[str]:
468+
pass
469+
470+
@property
471+
@abc.abstractmethod
472+
def dead_letter_reason(self) -> typing.Optional[str]:
473+
pass
474+
460475
@property
461476
@abc.abstractmethod
462477
def dead_letter_source(self) -> typing.Optional[str]:
@@ -467,6 +482,11 @@ def dead_letter_source(self) -> typing.Optional[str]:
467482
def delivery_count(self) -> typing.Optional[int]:
468483
pass
469484

485+
@property
486+
@abc.abstractmethod
487+
def enqueued_sequence_number(self) -> typing.Optional[int]:
488+
pass
489+
470490
@property
471491
@abc.abstractmethod
472492
def enqueued_time_utc(self) -> typing.Optional[datetime.datetime]:
@@ -488,6 +508,11 @@ def expiration_time(self) -> typing.Optional[datetime.datetime]:
488508
def label(self) -> typing.Optional[str]:
489509
pass
490510

511+
@property
512+
@abc.abstractmethod
513+
def locked_until(self) -> typing.Optional[datetime.datetime]:
514+
pass
515+
491516
@property
492517
@abc.abstractmethod
493518
def lock_token(self) -> typing.Optional[str]:
@@ -534,6 +559,16 @@ def sequence_number(self) -> typing.Optional[int]:
534559
def session_id(self) -> typing.Optional[str]:
535560
pass
536561

562+
@property
563+
@abc.abstractmethod
564+
def state(self) -> typing.Optional[int]:
565+
pass
566+
567+
@property
568+
@abc.abstractmethod
569+
def subject(self) -> typing.Optional[str]:
570+
pass
571+
537572
@property
538573
@abc.abstractmethod
539574
def time_to_live(self) -> typing.Optional[datetime.timedelta]:
@@ -544,6 +579,11 @@ def time_to_live(self) -> typing.Optional[datetime.timedelta]:
544579
def to(self) -> typing.Optional[str]:
545580
pass
546581

582+
@property
583+
@abc.abstractmethod
584+
def transaction_partition_key(self) -> typing.Optional[str]:
585+
pass
586+
547587
@property
548588
@abc.abstractmethod
549589
def user_properties(self) -> typing.Dict[str, typing.Any]:

azure/functions/_http_asgi.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import asyncio
77
from asyncio import Event, Queue
8+
from urllib.parse import ParseResult, urlparse
89
from warnings import warn
910
from wsgiref.headers import Headers
1011

@@ -22,6 +23,8 @@ def __init__(self, func_req: HttpRequest,
2223
self.asgi_version = ASGI_VERSION
2324
self.asgi_spec_version = ASGI_SPEC_VERSION
2425
self._headers = func_req.headers
26+
url: ParseResult = urlparse(func_req.url)
27+
self.asgi_url_scheme = url.scheme
2528
super().__init__(func_req, func_ctx)
2629

2730
def _get_encoded_http_headers(self) -> List[Tuple[bytes, bytes]]:
@@ -49,7 +52,7 @@ def to_asgi_http_scope(self):
4952
"asgi.spec_version": self.asgi_spec_version,
5053
"http_version": "1.1",
5154
"method": self.request_method,
52-
"scheme": "https",
55+
"scheme": self.asgi_url_scheme,
5356
"path": self.path_info,
5457
"raw_path": _raw_path,
5558
"query_string": _query_string,

azure/functions/_http_wsgi.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ def __init__(self,
2929
# Implement interfaces for PEP 3333 environ
3030
self.request_method = getattr(func_req, 'method', None)
3131
self.script_name = ''
32-
self.path_info = unquote_to_bytes(
33-
getattr(url, 'path', None)).decode('latin-1') # type: ignore
32+
self.path_info = (
33+
unquote_to_bytes(getattr(url, 'path', None)) # type: ignore
34+
.decode('latin-1' if type(self) is WsgiRequest else 'utf-8')
35+
)
36+
3437
self.query_string = getattr(url, 'query', None)
3538
self.content_type = self._lowercased_headers.get('content-type')
3639
self.content_length = str(len(func_req_body))

azure/functions/_servicebus.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ def __init__(self, *,
3333
if body is not None:
3434
self.__set_body(body)
3535

36+
@property
37+
def application_properties(self) -> Dict[str, Any]:
38+
"""Gets the application properties bag, which can be used for
39+
custom message metadata.
40+
41+
Returns:
42+
--------
43+
Dict[str, Any]:
44+
If user has set application properties for the message,
45+
returns a dictionary.
46+
If nothing is set, returns an empty dictionary.
47+
"""
48+
return {}
49+
3650
@property
3751
def content_type(self) -> Optional[str]:
3852
"""Optionally describes the payload of the message,
@@ -59,6 +73,30 @@ def correlation_id(self) -> Optional[str]:
5973
"""
6074
return self.__correlation_id
6175

76+
@property
77+
def dead_letter_error_description(self) -> Optional[str]:
78+
"""Optionally describes the dead letter error description for the message.
79+
80+
Returns:
81+
--------
82+
Optional[str]
83+
If dead letter error description is set, returns a string.
84+
Otherwise, returns None.
85+
"""
86+
return None
87+
88+
@property
89+
def dead_letter_reason(self) -> Optional[str]:
90+
"""Optionally describes the dead letter reason description for the message.
91+
92+
Returns:
93+
--------
94+
Optional[str]
95+
If dead letter reason description is set, returns a string.
96+
Otherwise, returns None.
97+
"""
98+
return None
99+
62100
@property
63101
def dead_letter_source(self) -> Optional[str]:
64102
"""Only set in messages that have been dead-lettered and subsequently
@@ -89,6 +127,21 @@ def delivery_count(self) -> Optional[int]:
89127
"""
90128
return None
91129

130+
@property
131+
def enqueued_sequence_number(self) -> Optional[int]:
132+
"""For messages that have been auto-forwarded, this property reflects
133+
the sequence number that had first been assigned to the message at its
134+
original point of submission. This property is read-only. Optionally
135+
describes the enqueued sequence number of the message.
136+
137+
Returns:
138+
--------
139+
Optional[int]
140+
If enqueued sequence number is set, returns an integer.
141+
Otherwise, returns None.
142+
"""
143+
return None
144+
92145
@property
93146
def enqueued_time_utc(self) -> Optional[datetime.datetime]:
94147
"""The UTC instant at which the message has been accepted and stored
@@ -138,6 +191,24 @@ def label(self) -> Optional[str]:
138191
"""
139192
return None
140193

194+
@property
195+
def locked_until(self) -> Optional[datetime.datetime]:
196+
"""For messages retrieved under a lock (peek-lock receive mode, not
197+
pre-settled) this property reflects the UTC instant until which the
198+
message is held locked in the queue/subscription. When the lock
199+
expires, the DeliveryCount is incremented and the message is again
200+
available for retrieval. This property is read-only.Optionally
201+
describes the date and time in UTC until which the message will be
202+
locked in the queue/subscription.
203+
204+
Returns:
205+
--------
206+
Optional[datetime.datetime]
207+
If locked until is set, returns a datetime.
208+
Otherwise, returns None.
209+
"""
210+
return None
211+
141212
@property
142213
def lock_token(self) -> Optional[str]:
143214
""" The lock token is a reference to the lock that is being held by
@@ -267,6 +338,37 @@ def session_id(self) -> Optional[str]:
267338
"""
268339
return None
269340

341+
@property
342+
def state(self) -> Optional[int]:
343+
"""The state of the message can be Active, Deferred, or Scheduled.
344+
Deferred messages have Deferred state, scheduled messages have
345+
Scheduled state, all other messages have Active state. States are
346+
represented by corresponding integer values. Active = 0,
347+
Deferred = 1, Scheduled = 2.
348+
349+
Returns:
350+
--------
351+
Optional[int]
352+
If state is set, returns an integer.
353+
Otherwise, returns None.
354+
"""
355+
return None
356+
357+
@property
358+
def subject(self) -> Optional[str]:
359+
"""This property enables the application to indicate the purpose of the
360+
message to the receiver in a standardized fashion, similar to an email
361+
subject line. The mapped AMQP property is "subject". Optionally
362+
describes the application specific label.
363+
364+
Returns:
365+
--------
366+
Optional[str]
367+
If subject is set, returns a string.
368+
Otherwise, returns None.
369+
"""
370+
return None
371+
270372
@property
271373
def time_to_live(self) -> Optional[datetime.timedelta]:
272374
""" This value is the relative duration after which the message
@@ -300,6 +402,22 @@ def to(self) -> Optional[str]:
300402
"""
301403
return None
302404

405+
@property
406+
def transaction_partition_key(self) -> Optional[str]:
407+
"""If a message is sent via a transfer queue in the scope of a transaction,
408+
this value selects the transfer queue partition: This is functionally
409+
equivalent to PartitionKey and ensures that messages are kept together
410+
and in order as they are transferred. Optionally describes the
411+
partition key. Maximum length is 128 characters.
412+
413+
Returns:
414+
--------
415+
Optional[str]
416+
If transaction partition key is set, returns a string.
417+
Otherwise, returns None.
418+
"""
419+
return None
420+
303421
@property
304422
def user_properties(self) -> Dict[str, Any]:
305423
"""Contains user defined message properties.

0 commit comments

Comments
 (0)