Skip to content

Commit

Permalink
fix(core): deprecated id_ parameter leftover
Browse files Browse the repository at this point in the history
  • Loading branch information
kkiani committed Sep 12, 2024
1 parent 3b4df37 commit b4385e9
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 30 deletions.
4 changes: 0 additions & 4 deletions src/damavand/base/controllers/base_controller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
from typing import Optional
from functools import cache
from pulumi import Resource as PulumiResource
import pulumi
Expand Down Expand Up @@ -40,14 +39,11 @@ class ApplicationController(object):
def __init__(
self,
name: str,
id: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> None:
self.name = name
self.tags = tags
# FIXME: the id should be removed.
self._id = id
self.extra_args = kwargs
self._pulumi_object = None

Expand Down
5 changes: 2 additions & 3 deletions src/damavand/base/controllers/object_storage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterable, Optional
from typing import Iterable

from damavand.base.controllers import ApplicationController

Expand All @@ -7,11 +7,10 @@ class ObjectStorageController(ApplicationController):
def __init__(
self,
name,
id_: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> None:
super().__init__(name, id_, tags, **kwargs)
super().__init__(name, tags, **kwargs)

def read(self, path: str) -> bytes:
"""Read an object from the storage."""
Expand Down
6 changes: 1 addition & 5 deletions src/damavand/base/controllers/spark.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import logging
from typing import Optional
from pyspark.conf import SparkConf
from pyspark.sql import SparkSession

Expand All @@ -27,8 +26,6 @@ class SparkController(ApplicationController):
the name of the controller.
applications : list[Sparkle]
the list of Spark applications.
id_ : Optional[str]
the ID of the controller.
tags : dict[str, str]
the tags of the controller.
kwargs : dict
Expand All @@ -51,11 +48,10 @@ class SparkController(ApplicationController):
def __init__(
self,
name,
id_: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> None:
ApplicationController.__init__(self, name, id_, tags, **kwargs)
ApplicationController.__init__(self, name, tags, **kwargs)
self.applications: list[Sparkle]

@property
Expand Down
4 changes: 0 additions & 4 deletions src/damavand/base/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def new(
ctr = self._new_aws_controller(
name=name,
region=self.provider.explicit_region,
id=id,
tags=self.tags,
**kwargs,
)
Expand All @@ -53,7 +52,6 @@ def new(
case AzurermProvider():
ctr = self._new_azure_controller(
name=name,
id=id,
tags=self.tags,
**kwargs,
)
Expand All @@ -66,7 +64,6 @@ def _new_aws_controller(
self,
name: str,
region: str,
id: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> ControllerType:
Expand All @@ -75,7 +72,6 @@ def _new_aws_controller(
def _new_azure_controller(
self,
name: str,
id: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> ControllerType:
Expand Down
5 changes: 2 additions & 3 deletions src/damavand/cloud/aws/controllers/object_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io
import logging
from botocore.exceptions import ClientError
from typing import Iterable, Optional
from typing import Iterable
from pulumi_aws import s3
from pulumi import Resource as PulumiResource

Expand All @@ -24,11 +24,10 @@ def __init__(
self,
name,
region: str,
id_: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> None:
super().__init__(name, id_, tags, **kwargs)
super().__init__(name, tags, **kwargs)
self.__s3_client = boto3.client("s3", region_name=region)

@buildtime
Expand Down
4 changes: 1 addition & 3 deletions src/damavand/cloud/aws/controllers/spark.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
from typing import Optional
from functools import cache

import boto3
Expand All @@ -19,11 +18,10 @@ def __init__(
self,
name,
region: str,
id_: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> None:
super().__init__(name, id_, tags, **kwargs)
super().__init__(name, tags, **kwargs)
self._glue_client = boto3.client("glue", region_name=region)

@buildtime
Expand Down
4 changes: 1 addition & 3 deletions src/damavand/cloud/azure/controllers/spark.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
from typing import Optional
from functools import cache

import pulumi
Expand All @@ -20,11 +19,10 @@ def __init__(
self,
name,
region: str,
id_: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> None:
super().__init__(name, id_, tags, **kwargs)
super().__init__(name, tags, **kwargs)
self.applications: list[Sparkle]

@buildtime
Expand Down
6 changes: 1 addition & 5 deletions src/damavand/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Optional

from damavand.base.controllers.spark import SparkController
from damavand.base.factory import ApplicationControllerFactory
Expand All @@ -11,24 +10,21 @@ def _new_aws_controller(
self,
name: str,
region: str,
id: Optional[str] = None,
tags: dict[str, str] = {},
**kwargs,
) -> SparkController:
return AwsSparkController(
name=name,
region=region,
id=id,
tags=tags,
**kwargs,
)

def _new_azure_controller(
self, name: str, id: Optional[str] = None, tags: dict[str, str] = {}, **kwargs
self, name: str, tags: dict[str, str] = {}, **kwargs
) -> SparkController:
return AzureSparkController(
name=name,
id=id,
tags=tags,
**kwargs,
)

0 comments on commit b4385e9

Please sign in to comment.