async-lambda-unstable 0.3.9__tar.gz → 0.3.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/PKG-INFO +1 -1
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/__init__.py +2 -1
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/controller.py +15 -2
- async-lambda-unstable-0.3.11/async_lambda/models/case_insensitive_dict.py +82 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/api_event.py +5 -4
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/task.py +3 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda_unstable.egg-info/PKG-INFO +1 -1
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda_unstable.egg-info/SOURCES.txt +1 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/README.md +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/build_config.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/cli.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/client.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/config.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/defer.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/env.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/__init__.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/__init__.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/base_event.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/dynamodb_event.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/managed_sqs_event.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/scheduled_event.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/unmanaged_sqs_event.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/mock/mock_context.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/mock/mock_event.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/py.typed +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/util.py +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda_unstable.egg-info/dependency_links.txt +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda_unstable.egg-info/entry_points.txt +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda_unstable.egg-info/requires.txt +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda_unstable.egg-info/top_level.txt +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/pyproject.toml +0 -0
- {async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/setup.cfg +0 -0
|
@@ -5,10 +5,11 @@ from .defer import Defer as Defer
|
|
|
5
5
|
from .env import disable_force_sync_mode as disable_force_sync_mode
|
|
6
6
|
from .env import enable_force_sync_mode as enable_force_sync_mode
|
|
7
7
|
from .env import is_build_mode as is_build_mode
|
|
8
|
+
from .models.case_insensitive_dict import CaseInsensitiveDict as CaseInsensitiveDict
|
|
8
9
|
from .models.events.api_event import APIEvent as APIEvent
|
|
9
10
|
from .models.events.dynamodb_event import DynamoDBEvent as DynamoDBEvent
|
|
10
11
|
from .models.events.managed_sqs_event import ManagedSQSEvent as ManagedSQSEvent
|
|
11
12
|
from .models.events.scheduled_event import ScheduledEvent as ScheduledEvent
|
|
12
13
|
from .models.events.unmanaged_sqs_event import UnmanagedSQSEvent as UnmanagedSQSEvent
|
|
13
14
|
|
|
14
|
-
__version__ = "0.3.
|
|
15
|
+
__version__ = "0.3.11"
|
|
@@ -529,7 +529,15 @@ class AsyncLambdaController:
|
|
|
529
529
|
|
|
530
530
|
return _task
|
|
531
531
|
|
|
532
|
-
def dynamodb_task(
|
|
532
|
+
def dynamodb_task(
|
|
533
|
+
self,
|
|
534
|
+
task_id: str,
|
|
535
|
+
*,
|
|
536
|
+
stream_arn: str,
|
|
537
|
+
batch_size: int,
|
|
538
|
+
max_batching_window: int = 0,
|
|
539
|
+
**kwargs,
|
|
540
|
+
):
|
|
533
541
|
"""
|
|
534
542
|
Decorate a function to register it as a DynamoDB task.
|
|
535
543
|
These tasks will be triggered by the given DynamoDB stream.
|
|
@@ -550,7 +558,12 @@ class AsyncLambdaController:
|
|
|
550
558
|
executable=inner,
|
|
551
559
|
task_id=task_id,
|
|
552
560
|
trigger_type=TaskTriggerType.DYNAMODB_EVENT,
|
|
553
|
-
trigger_config={
|
|
561
|
+
trigger_config={
|
|
562
|
+
"stream_arn": stream_arn,
|
|
563
|
+
"batch_size": batch_size,
|
|
564
|
+
"max_batching_window": max_batching_window,
|
|
565
|
+
},
|
|
566
|
+
**kwargs,
|
|
554
567
|
)
|
|
555
568
|
)
|
|
556
569
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import collections.abc
|
|
2
|
+
from collections import OrderedDict
|
|
3
|
+
from typing import Tuple, TypeVar
|
|
4
|
+
|
|
5
|
+
T = TypeVar("T", bound=str)
|
|
6
|
+
V = TypeVar("V")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CaseInsensitiveDict(collections.abc.MutableMapping[T, V]):
|
|
10
|
+
"""
|
|
11
|
+
A case-insensitive ``dict``-like object.
|
|
12
|
+
|
|
13
|
+
Implements all methods and operations of
|
|
14
|
+
``MutableMapping`` as well as dict's ``copy``. Also
|
|
15
|
+
provides ``lower_items``.
|
|
16
|
+
|
|
17
|
+
All keys are expected to be strings. The structure remembers the
|
|
18
|
+
case of the last key to be set, and ``iter(instance)``,
|
|
19
|
+
``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()``
|
|
20
|
+
will contain case-sensitive keys. However, querying and contains
|
|
21
|
+
testing is case insensitive::
|
|
22
|
+
|
|
23
|
+
cid = CaseInsensitiveDict()
|
|
24
|
+
cid['Accept'] = 'application/json'
|
|
25
|
+
cid['aCCEPT'] == 'application/json' # True
|
|
26
|
+
list(cid) == ['Accept'] # True
|
|
27
|
+
|
|
28
|
+
For example, ``headers['content-encoding']`` will return the
|
|
29
|
+
value of a ``'Content-Encoding'`` response header, regardless
|
|
30
|
+
of how the header name was originally stored.
|
|
31
|
+
|
|
32
|
+
If the constructor, ``.update``, or equality comparison
|
|
33
|
+
operations are given keys that have equal ``.lower()``s, the
|
|
34
|
+
behavior is undefined.
|
|
35
|
+
|
|
36
|
+
This was vendored from requests
|
|
37
|
+
https://github.com/kennethreitz/requests/blob/v2.25.1/requests/structures.py
|
|
38
|
+
|
|
39
|
+
Generic typing added by me.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
def __init__(self, data=None, **kwargs):
|
|
43
|
+
self._store: OrderedDict[T, Tuple[T, V]] = OrderedDict()
|
|
44
|
+
if data is None:
|
|
45
|
+
data = {}
|
|
46
|
+
self.update(data, **kwargs)
|
|
47
|
+
|
|
48
|
+
def __setitem__(self, key, value):
|
|
49
|
+
# Use the lowercased key for lookups, but store the actual
|
|
50
|
+
# key alongside the value.
|
|
51
|
+
self._store[key.lower()] = (key, value)
|
|
52
|
+
|
|
53
|
+
def __getitem__(self, key):
|
|
54
|
+
return self._store[key.lower()][1]
|
|
55
|
+
|
|
56
|
+
def __delitem__(self, key):
|
|
57
|
+
del self._store[key.lower()]
|
|
58
|
+
|
|
59
|
+
def __iter__(self):
|
|
60
|
+
return (casedkey for casedkey, mappedvalue in self._store.values())
|
|
61
|
+
|
|
62
|
+
def __len__(self):
|
|
63
|
+
return len(self._store)
|
|
64
|
+
|
|
65
|
+
def lower_items(self):
|
|
66
|
+
"""Like iteritems(), but with all lowercase keys."""
|
|
67
|
+
return ((lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items())
|
|
68
|
+
|
|
69
|
+
def __eq__(self, other):
|
|
70
|
+
if isinstance(other, collections.abc.Mapping):
|
|
71
|
+
other = CaseInsensitiveDict(other)
|
|
72
|
+
else:
|
|
73
|
+
return NotImplemented
|
|
74
|
+
# Compare insensitively
|
|
75
|
+
return dict(self.lower_items()) == dict(other.lower_items())
|
|
76
|
+
|
|
77
|
+
# Copy is required
|
|
78
|
+
def copy(self):
|
|
79
|
+
return CaseInsensitiveDict(self._store.values())
|
|
80
|
+
|
|
81
|
+
def __repr__(self):
|
|
82
|
+
return str(dict(self.items()))
|
{async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/api_event.py
RENAMED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
from typing import Any, Dict, List, Optional
|
|
2
2
|
|
|
3
|
+
from ..case_insensitive_dict import CaseInsensitiveDict
|
|
3
4
|
from .base_event import BaseEvent
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class APIEvent(BaseEvent):
|
|
7
8
|
path: str
|
|
8
9
|
method: str
|
|
9
|
-
headers:
|
|
10
|
-
multi_value_headers:
|
|
10
|
+
headers: CaseInsensitiveDict[str, str]
|
|
11
|
+
multi_value_headers: CaseInsensitiveDict[str, List[str]]
|
|
11
12
|
querystring_params: Dict[str, str]
|
|
12
13
|
multi_value_querystring_params: Dict[str, List[str]]
|
|
13
14
|
path_parameters: Dict[str, str]
|
|
@@ -18,8 +19,8 @@ class APIEvent(BaseEvent):
|
|
|
18
19
|
def _hydrate_event(self):
|
|
19
20
|
self.path = self._event["path"]
|
|
20
21
|
self.method = self._event["httpMethod"]
|
|
21
|
-
self.headers = self._event["headers"]
|
|
22
|
-
self.multi_value_headers = self._event["multiValueHeaders"]
|
|
22
|
+
self.headers = CaseInsensitiveDict(self._event["headers"])
|
|
23
|
+
self.multi_value_headers = CaseInsensitiveDict(self._event["multiValueHeaders"])
|
|
23
24
|
self.querystring_params = self._event.get("queryStringParameters", dict())
|
|
24
25
|
self.multi_value_querystring_params = self._event.get(
|
|
25
26
|
"multiValueQueryStringParameters", dict()
|
|
@@ -273,6 +273,9 @@ class AsyncLambdaTask(Generic[EventType]):
|
|
|
273
273
|
"Stream": self.trigger_config["stream_arn"],
|
|
274
274
|
"StartingPosition": "TRIM_HORIZON",
|
|
275
275
|
"BatchSize": self.trigger_config["batch_size"],
|
|
276
|
+
"MaximumBatchingWindowInSeconds": self.trigger_config[
|
|
277
|
+
"max_batching_window"
|
|
278
|
+
],
|
|
276
279
|
"Enabled": True,
|
|
277
280
|
},
|
|
278
281
|
}
|
|
@@ -11,6 +11,7 @@ async_lambda/env.py
|
|
|
11
11
|
async_lambda/py.typed
|
|
12
12
|
async_lambda/util.py
|
|
13
13
|
async_lambda/models/__init__.py
|
|
14
|
+
async_lambda/models/case_insensitive_dict.py
|
|
14
15
|
async_lambda/models/task.py
|
|
15
16
|
async_lambda/models/events/__init__.py
|
|
16
17
|
async_lambda/models/events/api_event.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/__init__.py
RENAMED
|
File without changes
|
{async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/events/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{async-lambda-unstable-0.3.9 → async-lambda-unstable-0.3.11}/async_lambda/models/mock/mock_event.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|