Skip to content

Doc typo #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documentation/docs/getting-started-with-tirith.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: getting-started-with-tirith
title: Getting started with Tirith
sidebar_label: Getting Started
description: This documentation overviews you about the introduction of the tirith software.
description: This documentation provides an introduction to the Tirith software.
keywords:
- tirith
- stack-guardian
Expand Down Expand Up @@ -40,7 +40,7 @@ Tirith is a robust policy framework designed to automate and enforce security, g

## Key Benefits of Tirith

- **Centralized Policy Management :** Tirith offers a unified platform for centralized policy management, reducing duplication and streamlining governance across multiple infrastructures and environments. This ensures consistent application of policies, regardless of the platform being used.
- **Centralized Policy Management:** Tirith offers a unified platform for centralized policy management, reducing duplication and streamlining governance across multiple infrastructures and environments. This ensures consistent application of policies, regardless of the platform being used.

- **Simplified Policy Creation :** Tirith’s [intuitive, no-code interface](https://tirith-policy-builder.vercel.app/) and declarative language simplify policy authoring, enabling users to define and manage policies effortlessly. This removes the need for deep technical expertise, allowing teams to quickly align with evolving regulatory requirements.

Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/install-tirith-on-linux.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
id: install-tirith-on-linux
title: Install Tirith on linux
title: Install Tirith on Linux
sidebar_label: Linux
description: This documentation overviews you about the introduction of the tirith software.
description: This documentation provides an introduction to the Tirith software.
keywords:
- tirith
- stack-guardian
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/install-tirith-on-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: install-tirith-on-windows
title: Install Tirith on Windows
sidebar_label: Windows
description: This documentation overviews you about the introduction of the tirith software.
description: This documentation overviews you about the introduction of the Tirith software.
keywords:
- tirith
- stack-guardian
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/tirith-policy-conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: tirith-policy-conditions
title: Policy Conditions
sidebar_label: Policy Conditions
description: This documentation overviews you about the introduction of the tirith software.
description: This documentation overviews you about the introduction of the Tirith software.
keywords:
- tirith
- stack-guardian
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/tirith-policy-error-tolerance.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: tirith-policy-error-tolerance
title: Error Tolerance
sidebar_label: Error Tolerance
description: This documentation overviews you about the introduction of the tirith software.
description: This documentation overviews you about the introduction of the Tirith software.
keywords:
- tirith
- stack-guardian
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/tirith-policy-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: tirith-policy-examples
title: Example Policies
sidebar_label: Example Policies
description: This documentation overviews you about the introduction of the tirith software.
description: This documentation overviews you about the introduction of the Tirith software.
keywords:
- tirith
- stack-guardian
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/tirith-policy-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: tirith-policy-structure
title: Policy Structure
sidebar_label: Policy Structure
description: This documentation overviews you about the introduction of the tirith software.
description: This documentation overviews you about the introduction of the Tirith software.
keywords:
- tirith
- stack-guardian
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/tirith-policy-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: tirith-policy-variables
title: Policy Variables
sidebar_label: Policy Variables
description: This documentation overviews you about the introduction of the tirith software.
description: This documentation overviews you about the introduction of the Tirith software.
keywords:
- tirith
- stack-guardian
Expand Down
6 changes: 3 additions & 3 deletions src/tirith/providers/infracost/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
logger = logging.getLogger(__name__)


def __get_all_costs(operation_type, input_data):
def __get_all_costs(operation_type: str, input_data: dict) -> float:
logger.debug(f"costType : {operation_type}")
pointer = {
"total_monthly_cost": ["totalMonthlyCost", "monthlyCost"],
Expand Down Expand Up @@ -38,7 +38,7 @@ def __get_all_costs(operation_type, input_data):
raise KeyError("projects not found in input_data")


def __get_resources_costs(resource_type, operation_type, input_data):
def __get_resources_costs(resource_type: str, operation_type: str, input_data: dict) -> float:
logger.debug(f"costType : {operation_type}")
pointer = {"total_monthly_cost": "totalMonthlyCost", "total_hourly_cost": "totalHourlyCost"}
pointer = {
Expand Down Expand Up @@ -77,7 +77,7 @@ def __get_resources_costs(resource_type, operation_type, input_data):
raise KeyError("projects not found in input_data")


def provide(provider_args, input_data):
def provide(provider_args: dict, input_data: dict) -> List[Dict[str, Any]]:
logger.debug("infracost provider")
logger.debug(f"infracost provider inputs : {provider_args}")
try:
Expand Down
13 changes: 7 additions & 6 deletions src/tirith/providers/json/handler.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pydash

from typing import Callable, Dict, List
from typing import Callable, Dict, List, Any
from ..common import create_result_dict, ProviderError, get_path_value_from_dict


class PydashPathNotFound:
pass


def _get_path_value_from_dict(splitted_paths, input_dict):
final_data = []
def _get_path_value_from_dict(splitted_paths: List[str], input_dict: Dict[str, Any]) -> List[Any]:
final_data: List[Any] = []
for i, expression in enumerate(splitted_paths):
intermediate_val = pydash.get(input_dict, expression, default=PydashPathNotFound)
if isinstance(intermediate_val, list) and i < len(splitted_paths) - 1:
Expand All @@ -28,7 +28,7 @@ def _get_path_value_from_dict(splitted_paths, input_dict):
return final_data


def get_value(provider_args: Dict, input_data: Dict) -> List[dict]:
def get_value(provider_args: Dict[str, Any], input_data: Dict[str, Any]) -> List[Dict[str, Any]]:
# Must be validated first whether the provider args are valid for this op type
key_path: str = provider_args["key_path"]

Expand All @@ -48,10 +48,11 @@ def get_value(provider_args: Dict, input_data: Dict) -> List[dict]:
return outputs


SUPPORTED_OPS: Dict[str, Callable] = {"get_value": get_value}
SUPPORTED_OPS: Dict[str, Callable[[Dict[str, Any], Dict[str, Any]], List[Dict[str, Any]]]]


Comment on lines +51 to 53
Copy link
Preview

Copilot AI Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated SUPPORTED_OPS declaration is missing an assignment operator to bind the dictionary literal. Please add '= {"get_value": get_value}' or the appropriate dictionary value to complete the statement.

Suggested change
SUPPORTED_OPS: Dict[str, Callable[[Dict[str, Any], Dict[str, Any]], List[Dict[str, Any]]]]
SUPPORTED_OPS: Dict[str, Callable[[Dict[str, Any], Dict[str, Any]], List[Dict[str, Any]]]] = {
"get_value": get_value
}

Copilot uses AI. Check for mistakes.

def provide(provider_args: Dict, input_data: Dict) -> List[Dict]:
def provide(provider_args: Dict[str, Any], input_data: Dict[str, Any]) -> List[Dict[str, Any]]:

operation_type = provider_args["operation_type"]

op_handler = SUPPORTED_OPS.get(operation_type)
Expand Down
7 changes: 4 additions & 3 deletions src/tirith/providers/sg_workflow/handler.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import logging
from typing import Any, Dict, List, Union


logger = logging.getLogger(__name__)


def __getValue(key, data):
def __getValue(key: str, data: Dict[str, any]) -> Union[str, List[str]]:
Copy link
Preview

Copilot AI Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation for 'data' uses 'any' instead of the correctly imported 'Any'. Please replace 'any' with 'Any' for consistency and correctness.

Suggested change
def __getValue(key: str, data: Dict[str, any]) -> Union[str, List[str]]:
def __getValue(key: str, data: Dict[str, Any]) -> Union[str, List[str]]:

Copilot uses AI. Check for mistakes.

logger.debug(f"Searching {key} in input data")
result = ""
result: Union[str, List[str]] = ""
if key == "integrationId":
temp = []
if "DeploymentPlatformConfig" in data:
Expand Down Expand Up @@ -70,7 +71,7 @@ def __getValue(key, data):
return result


def provide(provider_args, input_data):
def provide(provider_args: Dict[str, Any], input_data: Dict[str, Any]) -> List[Dict[str, Any]]:
logger.debug("sg_workflow provider")
logger.debug(f"sg_workflow provider inputs : {provider_args}")
try:
Expand Down
Loading