Skip to content

Commit

Permalink
Provider and lookup typing (#795)
Browse files Browse the repository at this point in the history
* Improve typing for export decorator

* wip: Add typing to base providers

* wip: Add typing to lookups

* wip: Add typing to context providers

* wip: Add typing to tiproviders

* Minor changes on tests

* wip: typing for context providers

* WIP: Apply typing to various objects from msticpy.context

* Inherit from httpx to define test objects

* Add requests as a dependency for riskiq

* WIP - Add typing to lookup

* WIP - Fix linting errors

* [WIP] Apply linting to ti providers

* Adding requests to dependencies

* [WIP] Apply linting to ti providers + fix bugs

* Remove kwargs

* Fix black linting

* Fix pylint errors

* Fix mypy errors

* Fix Flake8 error

* [WIP] Add typing to providers, entities and common classes

* [WIP] Add typing to context classes

* [WIP] Add typing to context classes, replace attrs by dataclass

* [WIP] Continue adding typing and fixing ruff errors

* Adding self/cls typing and replace print by logger.info

* Remove unused parameter

* Finish applying ruff standards to msticpy/context files

* Merge branch 'main' of https://github.com/microsoft/msticpy into provider-and-driver-typing

* [WIP] Fix typing and linting errors

* Apply black linting to files

* Add typing and removing some kwargs

* Update test mocks to align with new hierarchy

* Fix pylint issues

* Fix pytest issue

* Ignore errors that I don't know how to fix

* Fix singleton typing

* Make version requirements explicit

* Reùove unrequired pylint disable

* Remove unrequired TypeVar

* Fix linting errors

* Fix partially usage of Self typing

* Rolling back changes on print for usage functions

* Fix linting

* Adding Crypto exceptions for CodeQL
Also some minor spacing/formatting things

---------

Co-authored-by: Ian Hellen <[email protected]>
  • Loading branch information
FlorianBracq and ianhelle authored Sep 13, 2024
1 parent b5e052a commit 4734c66
Show file tree
Hide file tree
Showing 63 changed files with 3,971 additions and 2,159 deletions.
1 change: 0 additions & 1 deletion msticpy/aiagents/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ..common.exceptions import MsticpyUserConfigError
from ..common.pkg_config import get_config


ConfigItem = Dict[str, Union[str, Callable]]
ConfigList = List[ConfigItem]
Config = Dict[str, Union[str, float, ConfigList]]
Expand Down
1 change: 0 additions & 1 deletion msticpy/aiagents/rag_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""

import sys

from pathlib import Path
from typing import List, Optional

Expand Down
8 changes: 6 additions & 2 deletions msticpy/auth/azure_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
AzCredentials,
AzureCloudConfig,
AzureCredEnvNames,
ChainedTokenCredential,
az_connect_core,
)
from .cred_wrapper import CredentialWrapper
Expand Down Expand Up @@ -99,7 +100,10 @@ def az_connect(
az_cli_config.args.get("clientSecret") or ""
)
credentials = az_connect_core(
auth_methods=auth_methods, tenant_id=tenant_id, silent=silent, **kwargs
auth_methods=auth_methods,
tenant_id=tenant_id,
silent=silent,
**kwargs,
)
sub_client = SubscriptionClient(
credential=credentials.modern,
Expand Down Expand Up @@ -174,7 +178,7 @@ def fallback_devicecode_creds(
if not creds:
raise CloudError("Could not obtain credentials.")

return AzCredentials(legacy_creds, creds)
return AzCredentials(legacy_creds, ChainedTokenCredential(creds)) # type: ignore[arg-type]


def get_default_resource_name(resource_uri: str) -> str:
Expand Down
Loading

0 comments on commit 4734c66

Please sign in to comment.