Skip to content

Commit

Permalink
Fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
sk-keeper committed Jan 2, 2025
1 parent 3a7245f commit c069424
Show file tree
Hide file tree
Showing 30 changed files with 92 additions and 102 deletions.
3 changes: 0 additions & 3 deletions keepercommander/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@
# Contact: ops@keepersecurity.com
#

import keepercommander.keeper_dag as keeper_dag
import keepercommander.discovery_common as discovery_common

__version__ = '17.0.2'
2 changes: 1 addition & 1 deletion keepercommander/commands/discover/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ...proto import APIRequest_pb2
from ...crypto import encrypt_aes_v2, decrypt_aes_v2
from ...display import bcolors
from discovery_common.constants import PAM_USER, PAM_MACHINE, PAM_DATABASE, PAM_DIRECTORY
from keepercommander.discovery_common.constants import PAM_USER, PAM_MACHINE, PAM_DATABASE, PAM_DIRECTORY
import json
import base64

Expand Down
8 changes: 4 additions & 4 deletions keepercommander/commands/discover/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from . import PAMGatewayActionDiscoverCommandBase
from ...display import bcolors
from ... import vault
from discovery_common.infrastructure import Infrastructure
from discovery_common.record_link import RecordLink
from discovery_common.types import UserAcl, DiscoveryObject
from keeper_dag import EdgeType
from keepercommander.discovery_common.infrastructure import Infrastructure
from keepercommander.discovery_common.record_link import RecordLink
from keepercommander.discovery_common.types import UserAcl, DiscoveryObject
from keepercommander.keeper_dag import EdgeType
from importlib.metadata import version
from typing import Optional, TYPE_CHECKING

Expand Down
2 changes: 1 addition & 1 deletion keepercommander/commands/discover/job_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..pam.router_helper import router_send_action_to_gateway, router_get_connected_gateways
from ... import vault_extensions
from ...display import bcolors
from discovery_common.jobs import Jobs
from keepercommander.discovery_common.jobs import Jobs


class PAMGatewayActionDiscoverJobRemoveCommand(PAMGatewayActionDiscoverCommandBase):
Expand Down
4 changes: 2 additions & 2 deletions keepercommander/commands/discover/job_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from ... import vault
from ...proto import pam_pb2
from ...display import bcolors
from discovery_common.jobs import Jobs
from discovery_common.types import CredentialBase
from keepercommander.discovery_common.jobs import Jobs
from keepercommander.discovery_common.types import CredentialBase
from typing import List, TYPE_CHECKING

if TYPE_CHECKING:
Expand Down
12 changes: 6 additions & 6 deletions keepercommander/commands/discover/job_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from ... import vault_extensions
from ...display import bcolors
from ..pam.router_helper import router_get_connected_gateways
from discovery_common.jobs import Jobs
from discovery_common.infrastructure import Infrastructure
from discovery_common.constants import DIS_INFRA_GRAPH_ID
from discovery_common.types import DiscoveryDelta, DiscoveryObject
from keeper_dag.dag import DAG
from keepercommander.discovery_common.jobs import Jobs
from keepercommander.discovery_common.infrastructure import Infrastructure
from keepercommander.discovery_common.constants import DIS_INFRA_GRAPH_ID
from keepercommander.discovery_common.types import DiscoveryDelta, DiscoveryObject
from keepercommander.keeper_dag.dag import DAG
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from discovery_common.jobs import JobItem
from keepercommander.discovery_common.jobs import JobItem


def _h(text):
Expand Down
6 changes: 3 additions & 3 deletions keepercommander/commands/discover/result_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from ... import vault_extensions
from ...display import bcolors
from ..pam.router_helper import router_get_connected_gateways
from discovery_common.jobs import Jobs
from discovery_common.infrastructure import Infrastructure
from keepercommander.discovery_common.jobs import Jobs
from keepercommander.discovery_common.infrastructure import Infrastructure
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from discovery_common.jobs import JobItem
from keepercommander.discovery_common.jobs import JobItem


class PAMGatewayActionDiscoverResultGetCommand(PAMGatewayActionDiscoverCommandBase):
Expand Down
10 changes: 5 additions & 5 deletions keepercommander/commands/discover/result_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from ... import api, subfolder, utils, crypto, vault, vault_extensions
from ...display import bcolors
from ...proto import router_pb2, record_pb2
from discovery_common.jobs import Jobs
from discovery_common.process import Process, QuitException, NoDiscoveryDataException
from discovery_common.types import (DiscoveryObject, UserAcl, PromptActionEnum, PromptResult,
from keepercommander.discovery_common.jobs import Jobs
from keepercommander.discovery_common.process import Process, QuitException, NoDiscoveryDataException
from keepercommander.discovery_common.types import (DiscoveryObject, UserAcl, PromptActionEnum, PromptResult,
BulkRecordAdd, BulkRecordConvert, BulkProcessResults, BulkRecordSuccess,
BulkRecordFail, DirectoryInfo, NormalizedRecord, RecordField)
from pydantic import BaseModel
Expand All @@ -21,8 +21,8 @@
if TYPE_CHECKING:
from ...params import KeeperParams
from ...vault import TypedRecord, KeeperRecord
from keeper_dag.vertex import DAGVertex
from discovery_common.record_link import RecordLink
from keepercommander.keeper_dag.vertex import DAGVertex
from keepercommander.discovery_common.record_link import RecordLink


def _h(value: str) -> str:
Expand Down
4 changes: 2 additions & 2 deletions keepercommander/commands/discover/rule_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from ..pam.router_helper import router_send_action_to_gateway, router_get_connected_gateways
from ...display import bcolors
from ...proto import pam_pb2
from discovery_common.rule import Rules
from discovery_common.types import ActionRuleItem
from keepercommander.discovery_common.rule import Rules
from keepercommander.discovery_common.types import ActionRuleItem
from typing import TYPE_CHECKING

if TYPE_CHECKING:
Expand Down
6 changes: 3 additions & 3 deletions keepercommander/commands/discover/rule_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from . import PAMGatewayActionDiscoverCommandBase, GatewayContext
from ...display import bcolors
from ..pam.router_helper import router_get_connected_gateways
from discovery_common.rule import Rules
from discovery_common.types import RuleTypeEnum
from keepercommander.discovery_common.rule import Rules
from keepercommander.discovery_common.types import RuleTypeEnum
from typing import List, TYPE_CHECKING

if TYPE_CHECKING:
from discovery_common.types import RuleItem
from keepercommander.discovery_common.types import RuleItem


class PAMGatewayActionDiscoverRuleListCommand(PAMGatewayActionDiscoverCommandBase):
Expand Down
4 changes: 2 additions & 2 deletions keepercommander/commands/discover/rule_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from . import PAMGatewayActionDiscoverCommandBase, GatewayContext
from ..pam.router_helper import router_get_connected_gateways
from ...display import bcolors
from discovery_common.rule import Rules
from discovery_common.types import RuleTypeEnum
from keepercommander.discovery_common.rule import Rules
from keepercommander.discovery_common.types import RuleTypeEnum


class PAMGatewayActionDiscoverRuleRemoveCommand(PAMGatewayActionDiscoverCommandBase):
Expand Down
2 changes: 1 addition & 1 deletion keepercommander/commands/discover/rule_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .rule_add import PAMGatewayActionDiscoverRuleAddCommand
from ..pam.router_helper import router_get_connected_gateways
from ...display import bcolors
from discovery_common.rule import Rules, RuleTypeEnum
from keepercommander.discovery_common.rule import Rules, RuleTypeEnum


class PAMGatewayActionDiscoverRuleUpdateCommand(PAMGatewayActionDiscoverCommandBase):
Expand Down
6 changes: 3 additions & 3 deletions keepercommander/commands/pam_debug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

if TYPE_CHECKING:
from ...params import KeeperParams
from keeper_dag.connection import ConnectionBase
from keepercommander.keeper_dag.connection import ConnectionBase


def get_connection(params: KeeperParams) -> ConnectionBase:
if value_to_boolean(os.environ.get("USE_LOCAL_DAG", False)) is False:
from keeper_dag.connection.commander import Connection as CommanderConnection
from keepercommander.keeper_dag.connection.commander import Connection as CommanderConnection
return CommanderConnection(params=params)
else:
from keeper_dag.connection.local import Connection as LocalConnection
from keepercommander.keeper_dag.connection.local import Connection as LocalConnection
return LocalConnection()
4 changes: 2 additions & 2 deletions keepercommander/commands/pam_debug/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from ..discover import PAMGatewayActionDiscoverCommandBase, GatewayContext, PAM_USER
from ...display import bcolors
from ... import vault
from discovery_common.record_link import RecordLink
from discovery_common.types import UserAcl
from keepercommander.discovery_common.record_link import RecordLink
from keepercommander.discovery_common.types import UserAcl
from typing import Optional, TYPE_CHECKING

if TYPE_CHECKING:
Expand Down
13 changes: 3 additions & 10 deletions keepercommander/commands/pam_debug/alter.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
from __future__ import annotations

import argparse
import os
from typing import TYPE_CHECKING

from ..discover import PAMGatewayActionDiscoverCommandBase
from ...display import bcolors
from ... import vault
from discovery_common.infrastructure import Infrastructure
from discovery_common.record_link import RecordLink
from discovery_common.types import UserAcl, DiscoveryObject
from keeper_dag import EdgeType
from importlib.metadata import version
from typing import Optional, TYPE_CHECKING

if TYPE_CHECKING:
from ...vault import TypedRecord
from ...params import KeeperParams


Expand Down
8 changes: 4 additions & 4 deletions keepercommander/commands/pam_debug/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from ..discover import PAMGatewayActionDiscoverCommandBase, GatewayContext
from .graph import PAMDebugGraphCommand
from ...display import bcolors
from discovery_common.infrastructure import Infrastructure
from discovery_common.record_link import RecordLink
from discovery_common.user_service import UserService
from discovery_common.constants import PAM_USER, PAM_MACHINE, PAM_DATABASE, PAM_DIRECTORY
from keepercommander.discovery_common.infrastructure import Infrastructure
from keepercommander.discovery_common.record_link import RecordLink
from keepercommander.discovery_common.user_service import UserService
from keepercommander.discovery_common.constants import PAM_USER, PAM_MACHINE, PAM_DATABASE, PAM_DIRECTORY
from typing import TYPE_CHECKING

if TYPE_CHECKING:
Expand Down
24 changes: 12 additions & 12 deletions keepercommander/commands/pam_debug/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
from ..discover import PAMGatewayActionDiscoverCommandBase, GatewayContext
from ...display import bcolors
from ... import vault
from discovery_common.infrastructure import Infrastructure
from discovery_common.record_link import RecordLink
from discovery_common.user_service import UserService
from discovery_common.jobs import Jobs
from discovery_common.constants import (PAM_USER, PAM_DIRECTORY, PAM_MACHINE, PAM_DATABASE, VERTICES_SORT_MAP,
from keepercommander.discovery_common.infrastructure import Infrastructure
from keepercommander.discovery_common.record_link import RecordLink
from keepercommander.discovery_common.user_service import UserService
from keepercommander.discovery_common.jobs import Jobs
from keepercommander.discovery_common.constants import (PAM_USER, PAM_DIRECTORY, PAM_MACHINE, PAM_DATABASE, VERTICES_SORT_MAP,
DIS_INFRA_GRAPH_ID, RECORD_LINK_GRAPH_ID, USER_SERVICE_GRAPH_ID,
DIS_JOBS_GRAPH_ID)
from discovery_common.types import (DiscoveryObject, DiscoveryUser, DiscoveryDirectory, DiscoveryMachine,
from keepercommander.discovery_common.types import (DiscoveryObject, DiscoveryUser, DiscoveryDirectory, DiscoveryMachine,
DiscoveryDatabase, JobContent)
from discovery_common.dag_sort import sort_infra_vertices
from keeper_dag import DAG
from keeper_dag.connection.commander import Connection as CommanderConnection
from keeper_dag.connection.local import Connection as LocalConnection
from keeper_dag.vertex import DAGVertex
from keeper_dag.edge import DAGEdge
from keepercommander.discovery_common.dag_sort import sort_infra_vertices
from keepercommander.keeper_dag import DAG
from keepercommander.keeper_dag.connection.commander import Connection as CommanderConnection
from keepercommander.keeper_dag.connection.local import Connection as LocalConnection
from keepercommander.keeper_dag.vertex import DAGVertex
from keepercommander.keeper_dag.edge import DAGEdge
from typing import Optional, Union, TYPE_CHECKING

Connection = Union[CommanderConnection, LocalConnection]
Expand Down
12 changes: 6 additions & 6 deletions keepercommander/commands/pam_debug/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from ..discover import PAMGatewayActionDiscoverCommandBase, GatewayContext
from ...display import bcolors
from ... import vault
from discovery_common.infrastructure import Infrastructure
from discovery_common.record_link import RecordLink
from discovery_common.user_service import UserService
from discovery_common.types import UserAcl, DiscoveryObject
from discovery_common.constants import PAM_USER, PAM_MACHINE, PAM_DATABASE, PAM_DIRECTORY
from keeper_dag import EdgeType
from keepercommander.discovery_common.infrastructure import Infrastructure
from keepercommander.discovery_common.record_link import RecordLink
from keepercommander.discovery_common.user_service import UserService
from keepercommander.discovery_common.types import UserAcl, DiscoveryObject
from keepercommander.discovery_common.constants import PAM_USER, PAM_MACHINE, PAM_DATABASE, PAM_DIRECTORY
from keepercommander.keeper_dag import EdgeType
import time
import re
from typing import Optional, TYPE_CHECKING
Expand Down
2 changes: 1 addition & 1 deletion keepercommander/commands/pam_debug/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ..discover import PAMGatewayActionDiscoverCommandBase, GatewayContext
from ...display import bcolors
from ...vault import TypedRecord
from discovery_common.verify import Verify
from keepercommander.discovery_common.verify import Verify
import sys
from typing import TYPE_CHECKING

Expand Down
8 changes: 4 additions & 4 deletions keepercommander/commands/tunnel/port_forward/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

from aiortc import RTCPeerConnection, RTCSessionDescription, RTCConfiguration, RTCIceServer
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from keeper_dag import DAG, EdgeType
from keeper_dag.connection.commander import Connection
from keeper_dag.types import RefType
from keeper_dag.vertex import DAGVertex
from keepercommander.keeper_dag import DAG, EdgeType
from keepercommander.keeper_dag.connection.commander import Connection
from keepercommander.keeper_dag.types import RefType
from keepercommander.keeper_dag.vertex import DAGVertex
from keeper_secrets_manager_core.utils import bytes_to_base64, base64_to_bytes, bytes_to_string, string_to_bytes

from keepercommander import crypto, utils, rest_api
Expand Down
2 changes: 1 addition & 1 deletion keepercommander/discovery_common/dag_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Logger = Union[logging.RootLogger, logging.Logger]
if TYPE_CHECKING:
from keeper_dag.vertex import DAGVertex
from keepercommander.keeper_dag.vertex import DAGVertex


def sort_infra_name(vertices: List[DAGVertex]) -> List[DAGVertex]:
Expand Down
8 changes: 4 additions & 4 deletions keepercommander/discovery_common/infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
import logging
from .constants import DIS_INFRA_GRAPH_ID
from .utils import get_connection
from keeper_dag import DAG, EdgeType
from keeper_dag.exceptions import DAGVertexException
from keeper_dag.crypto import urlsafe_str_to_bytes
from keepercommander.keeper_dag import DAG, EdgeType
from keepercommander.keeper_dag.exceptions import DAGVertexException
from keepercommander.keeper_dag.crypto import urlsafe_str_to_bytes
import os
import importlib
from typing import Any, Optional, TYPE_CHECKING

if TYPE_CHECKING:
from keeper_dag.vertex import DAGVertex
from keepercommander.keeper_dag.vertex import DAGVertex


class Infrastructure:
Expand Down
2 changes: 1 addition & 1 deletion keepercommander/discovery_common/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .constants import DIS_JOBS_GRAPH_ID
from .utils import get_connection
from .types import JobContent, JobItem, Settings
from keeper_dag import DAG, EdgeType
from keepercommander.keeper_dag import DAG, EdgeType
import logging
import os
import base64
Expand Down
6 changes: 3 additions & 3 deletions keepercommander/discovery_common/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
DirectoryInfo, NormalizedRecord)
from .utils import value_to_boolean, split_user_and_domain
from .dag_sort import sort_infra_vertices
from keeper_dag import EdgeType
from keeper_dag.crypto import bytes_to_urlsafe_str
from keepercommander.keeper_dag import EdgeType
from keepercommander.keeper_dag.crypto import bytes_to_urlsafe_str
import hashlib
import time
import os
from typing import Any, Callable, List, Optional, Union, TYPE_CHECKING


if TYPE_CHECKING:
from keeper_dag.vertex import DAGVertex
from keepercommander.keeper_dag.vertex import DAGVertex
DirectoryResult = Union[DirectoryInfo, List]
DirectoryUserResult = Union[NormalizedRecord, DAGVertex]

Expand Down
4 changes: 2 additions & 2 deletions keepercommander/discovery_common/record_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from .constants import RECORD_LINK_GRAPH_ID
from .utils import get_connection
from .types import UserAcl, DiscoveryObject
from keeper_dag import DAG, EdgeType
from keepercommander.keeper_dag import DAG, EdgeType
import importlib
from typing import Any, Optional, List, TYPE_CHECKING

if TYPE_CHECKING:
from keeper_dag.vertex import DAGVertex
from keepercommander.keeper_dag.vertex import DAGVertex


class RecordLink:
Expand Down
4 changes: 2 additions & 2 deletions keepercommander/discovery_common/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from .types import (RuleTypeEnum, RuleItem, ActionRuleSet, ActionRuleItem, ScheduleRuleSet, ComplexityRuleSet,
Statement, RuleActionEnum)
from .utils import value_to_boolean, get_connection
from keeper_dag import DAG, EdgeType
from keeper_dag.exceptions import DAGException
from keepercommander.keeper_dag import DAG, EdgeType
from keepercommander.keeper_dag.exceptions import DAGException
from time import time
import base64
import os
Expand Down
2 changes: 1 addition & 1 deletion keepercommander/discovery_common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any, Union, Optional, List, TYPE_CHECKING

if TYPE_CHECKING:
from keeper_dag.vertex import DAGVertex
from keepercommander.keeper_dag.vertex import DAGVertex

# IMPORTANT!!!!!!!!!!!
#
Expand Down
Loading

0 comments on commit c069424

Please sign in to comment.