Skip to content

Commit b5b33ef

Browse files
authored
Merge pull request #1 from NarrativeScience/pre-commit-path
Fix path and copy over changes
2 parents 3e6aa81 + 2a563fc commit b5b33ef

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ repos:
5050

5151
- id: flake8
5252
name: Lint Python (flake8)
53-
entry: flake8 --config py2sfn-task-tools/.flake8
53+
entry: flake8 --config .flake8
5454
language: python
5555
types: [file, python]
5656
additional_dependencies:

src/py2sfn_task_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Tools for tasks embedded in an AWS Step Functions state machine."""
22

3-
__version__ = "0.1.0"
3+
__version__ = "0.2.1"

src/py2sfn_task_tools/state_data_client.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
from .exceptions import NoItemFound
1212

13-
dynamodb = boto3.client("dynamodb")
14-
s3 = boto3.client("s3")
13+
dynamodb = boto3.client(
14+
"dynamodb", endpoint_url=os.environ.get("DYNAMODB_ENDPOINT_URL")
15+
)
16+
s3 = boto3.client("s3", endpoint_url=os.environ.get("S3_ENDPOINT_URL"))
1517

1618
#: If an item's data is larger than this threshold it will be stored in S3 instead of
1719
#: DynamoDB. The item limit is 400KB but we'll leave room for other attributes.
@@ -42,6 +44,7 @@ class StateDataClient:
4244
tasks to use to store data remotely instead of passing it directly to downstream
4345
states in the state machine input data object. This is handy when the state data is
4446
larger than 32K characters (the AWS limit).
47+
4548
"""
4649

4750
def __init__(
@@ -74,7 +77,9 @@ def __init__(
7477
self.default_table_name = default_table_name
7578
self.namespace = namespace
7679
self.ttl_days = ttl_days
77-
self.s3_bucket = boto3.resource("s3").Bucket(s3_bucket)
80+
self.s3_bucket = boto3.resource(
81+
"s3", endpoint_url=os.environ.get("S3_ENDPOINT_URL")
82+
).Bucket(s3_bucket)
7883

7984
def table(self, table_name: str) -> "dynamodb.Table":
8085
"""Helper method to create a DynamoDB table object.
@@ -86,7 +91,9 @@ def table(self, table_name: str) -> "dynamodb.Table":
8691
DynamoDB table object
8792
8893
"""
89-
return boto3.resource("dynamodb").Table(table_name)
94+
return boto3.resource(
95+
"dynamodb", endpoint_url=os.environ.get("DYNAMODB_ENDPOINT_URL")
96+
).Table(table_name)
9097

9198
def _load_item_data(self, item: Dict) -> Any:
9299
"""Load item data for a given item metadata dict.

0 commit comments

Comments
 (0)