Skip to content

Commit

Permalink
Merge pull request #86 from thegridelectric/dev
Browse files Browse the repository at this point in the history
Added ensure_arg()
  • Loading branch information
anschweitzer committed Dec 16, 2022
2 parents 38fe8d2 + b818797 commit 7f3ae2d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
interval: monthly
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
interval: monthly
- package-ecosystem: pip
directory: "/docs"
schedule:
interval: daily
interval: monthly
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
interval: monthly
versioning-strategy: lockfile-only
allow:
- dependency-type: "all"
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- { python: "3.10", os: "ubuntu-latest", session: "pre-commit" }
# - { python: "3.10", os: "ubuntu-latest", session: "safety" }
# - { python: "3.10", os: "ubuntu-latest", session: "mypy" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.10", os: "windows-latest", session: "tests" }
- { python: "3.10", os: "macos-latest", session: "tests" }
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


package = "gwproto"
python_versions = ["3.10"]
python_versions = ["3.10", "3.11"]
nox.needs_version = ">= 2021.6.6"
nox.options.sessions = (
"pre-commit",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gridworks-protocol"
version = "0.2.1"
version = "0.2.2"
description = "Gridworks Protocol"
authors = ["Jessica Millar <jmillar@gridworks-consulting.com>"]
license = "MIT"
Expand Down
7 changes: 7 additions & 0 deletions src/gwproto/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class Header(BaseModel):
GRIDWORKS_ENVELOPE_TYPE = "gw"


def ensure_arg(arg_name: str, default_value: Any, kwargs_dict: dict) -> None:
if arg_name not in kwargs_dict:
payload = kwargs_dict.get("Payload", None)
if payload is None or not hasattr(payload, arg_name):
kwargs_dict[arg_name] = default_value


class Message(GenericModel, Generic[PayloadT]):
Header: Header
Payload: PayloadT
Expand Down

0 comments on commit 7f3ae2d

Please sign in to comment.