From 04a4336f7690360a94c4c938cb04c61d757fcf07 Mon Sep 17 00:00:00 2001 From: ccianelli22 <70442081+ccianelli22@users.noreply.github.com> Date: Thu, 12 Oct 2023 11:57:17 -0400 Subject: [PATCH] Update documentation for installing in isolated env (#724) * Update documentation for installing in isolated env * update params * update docs * domaintools fix for tldextract tldextract 5.0 has changed result type from namedtuple to dataclass * Typo in previous fix * Typo 2 in previous fix * Typo 3 * Mypy suppression for fix type check * New mypy suppression In observationlist.py ln 96 - likely new mypy version --------- Co-authored-by: Christopher Cianelli Co-authored-by: Ian Hellen --- docs/source/getting_started/Installing.rst | 2 +- msticpy/analysis/observationlist.py | 2 +- msticpy/context/domain_utils.py | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/source/getting_started/Installing.rst b/docs/source/getting_started/Installing.rst index 60b192df2..3b875f6bf 100644 --- a/docs/source/getting_started/Installing.rst +++ b/docs/source/getting_started/Installing.rst @@ -334,7 +334,7 @@ Example: .. code-block:: powershell - python \path\to\python\file --python-version "3.8.5" --module-name "msticpy[sentinel]" --module-version "2.7.0" --directory \path\to\destination + python [path]\download_python_package.py --python-version "3.8.5" --package-name "msticpy[sentinel]" --package-version "2.7.0" --directory \path\to\destination 3. Copy the directory folder to the isolated environment. diff --git a/msticpy/analysis/observationlist.py b/msticpy/analysis/observationlist.py index 93536c4bf..d7104d4ee 100644 --- a/msticpy/analysis/observationlist.py +++ b/msticpy/analysis/observationlist.py @@ -93,7 +93,7 @@ def all_fields(cls) -> Set[str]: Set of all field names. """ - return {field.name for field in attr.fields(cls)} + return {field.name for field in attr.fields(cls)} # type: ignore[misc] def display(self): """Display the observation.""" diff --git a/msticpy/context/domain_utils.py b/msticpy/context/domain_utils.py index 29fb7d378..e07174f55 100644 --- a/msticpy/context/domain_utils.py +++ b/msticpy/context/domain_utils.py @@ -13,6 +13,7 @@ import json import ssl import time +from dataclasses import asdict from datetime import datetime from enum import Enum from typing import Any, Dict, Optional, Tuple @@ -261,7 +262,10 @@ def dns_components(domain: str) -> dict: Returns subdomain and TLD components from a domain. """ - return tldextract.extract(domain.lower())._asdict() + result = tldextract.extract(domain.lower()) + if isinstance(result, tuple): + return result._asdict() # type: ignore + return asdict(result) def url_components(url: str) -> Dict[str, str]: