Skip to content

Examples#

Index > CodeGuruSecurity > Examples

Auto-generated documentation for CodeGuruSecurity type annotations stubs module mypy-boto3-codeguru-security.

Client#

Implicit type annotations#

Can be used with boto3-stubs[codeguru-security] package installed.

Write your CodeGuruSecurity code as usual, type checking and code completion should work out of the box.

# CodeGuruSecurityClient usage example

from boto3.session import Session


session = Session()

client = session.client("codeguru-security")  # (1)
result = client.batch_get_findings()  # (2)
  1. client: CodeGuruSecurityClient
  2. result: BatchGetFindingsResponseTypeDef
# GetFindingsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("codeguru-security")  # (1)

paginator = client.get_paginator("get_findings")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: CodeGuruSecurityClient
  2. paginator: GetFindingsPaginator
  3. item: GetFindingsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[codeguru-security] or a standalone mypy_boto3_codeguru_security package, you have to explicitly specify client: CodeGuruSecurityClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# CodeGuruSecurityClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_codeguru_security.client import CodeGuruSecurityClient
from mypy_boto3_codeguru_security.type_defs import BatchGetFindingsResponseTypeDef
from mypy_boto3_codeguru_security.type_defs import BatchGetFindingsRequestRequestTypeDef


session = Session()

client: CodeGuruSecurityClient = session.client("codeguru-security")

kwargs: BatchGetFindingsRequestRequestTypeDef = {...}
result: BatchGetFindingsResponseTypeDef = client.batch_get_findings(**kwargs)
# GetFindingsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_codeguru_security.client import CodeGuruSecurityClient
from mypy_boto3_codeguru_security.paginator import GetFindingsPaginator
from mypy_boto3_codeguru_security.type_defs import GetFindingsResponseTypeDef


session = Session()
client: CodeGuruSecurityClient = session.client("codeguru-security")

paginator: GetFindingsPaginator = client.get_paginator("get_findings")
for item in paginator.paginate(...):
    item: GetFindingsResponseTypeDef
    print(item)