Skip to content

Commit

Permalink
Logical.py and its ancestor accept certain params and lint refactor
Browse files Browse the repository at this point in the history
lint refactor.

Logical.py and its ancestor accept very certain params, the change will make this clear.
  • Loading branch information
chjuncn committed Jan 23, 2025
1 parent 841c5e0 commit ae9da64
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/palimpzest/query/generators/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from abc import ABC, abstractmethod
from collections import Counter
from string import Formatter
from typing import Any, Generic, Tuple, TypeVar
from typing import Any, Generic, TypeVar

from colorama import Fore, Style
from openai import OpenAI
Expand Down Expand Up @@ -40,7 +40,7 @@
from palimpzest.utils.sandbox import API

# DEFINITIONS
GenerationOutput = Tuple[dict, str | None, GenerationStats]
GenerationOutput = tuple[dict, str | None, GenerationStats]
ContextType = TypeVar("ContextType")
InputType = TypeVar("InputType")

Expand Down
8 changes: 4 additions & 4 deletions src/palimpzest/query/operators/code_synthesis_convert.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Any, Dict, Tuple
from typing import Any

from palimpzest.constants import Cardinality, GPT_4o_MODEL_CARD, Model
from palimpzest.core.data.dataclasses import GenerationStats, OperatorCostEstimates
Expand All @@ -15,9 +15,9 @@
FieldName = str
CodeName = str
Code = str
DataRecordDict = Dict[str, Any]
Exemplar = Tuple[DataRecordDict, DataRecordDict]
CodeEnsemble = Dict[CodeName, Code]
DataRecordDict = dict[str, Any]
Exemplar = tuple[DataRecordDict, DataRecordDict]
CodeEnsemble = dict[CodeName, Code]


class CodeSynthesisConvert(LLMConvert):
Expand Down
10 changes: 2 additions & 8 deletions src/palimpzest/query/operators/logical.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,8 @@ def get_logical_op_params(self) -> dict:
class BaseScan(LogicalOperator):
"""A BaseScan is a logical operator that represents a scan of a particular data source."""

def __init__(self, dataset_id: str, *args, **kwargs):
if kwargs.get("input_schema") is not None:
raise Exception(
f"BaseScan must be initialized with `input_schema=None` but was initialized with "
f"`input_schema={kwargs.get('input_schema')}`"
)

super().__init__(*args, **kwargs)
def __init__(self, dataset_id: str, output_schema: Schema):
super().__init__(output_schema=output_schema)
self.dataset_id = dataset_id

def __str__(self):
Expand Down

0 comments on commit ae9da64

Please sign in to comment.