Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace import all syntax with explicit import #2003

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,28 @@ class DualInputPortsPythonUDFOpDescV2 extends OperatorDescriptor {
defaultValue =
"# Choose from the following templates:\n" +
"# \n" +
"# from pytexera import *\n" +
"# import pytexera as pt\n" +
"# from overrides import overrides\n" +
"# from typing import Iterator, Optional\n" +
"# \n" +
"# class ProcessTupleOperator(UDFOperatorV2):\n" +
"# \n" +
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I am adding a new line to fix the warning of single blank line between imports and class definitions.

"# class ProcessTupleOperator(pt.UDFOperatorV2):\n" +
"# \n" +
"# @overrides\n" +
"# def process_tuple(self, tuple_: Tuple, port: int) -> Iterator[Optional[TupleLike]]:\n" +
"# def process_tuple(self, tuple_: pt.Tuple, port: int) -> Iterator[Optional[pt.TupleLike]]:\n" +
"# yield tuple_\n" +
"# \n" +
"# class ProcessBatchOperator(UDFBatchOperator):\n" +
"# class ProcessBatchOperator(pt.UDFBatchOperator):\n" +
"# BATCH_SIZE = 10 # must be a positive integer\n" +
"# \n" +
"# @overrides\n" +
"# def process_batch(self, batch: Batch, port: int) -> Iterator[Optional[BatchLike]]:\n" +
"# def process_batch(self, batch: pt.Batch, port: int) -> Iterator[Optional[pt.BatchLike]]:\n" +
"# yield batch\n" +
"# \n" +
"# class ProcessTableOperator(UDFTableOperator):\n" +
"# class ProcessTableOperator(pt.UDFTableOperator):\n" +
"# \n" +
"# @overrides\n" +
"# def process_table(self, table: Table, port: int) -> Iterator[Optional[TableLike]]:\n" +
"# def process_table(self, table: pt.Table, port: int) -> Iterator[Optional[pt.TableLike]]:\n" +
"# yield table\n"
)
@JsonSchemaTitle("Python script")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,28 @@ class PythonUDFOpDescV2 extends OperatorDescriptor with PortDescriptor {
defaultValue =
"# Choose from the following templates:\n" +
"# \n" +
"# from pytexera import *\n" +
"# import pytexera as pt\n" +
"# from overrides import overrides\n" +
"# from typing import Iterator, Optional\n" +
"# \n" +
"# class ProcessTupleOperator(UDFOperatorV2):\n" +
"# \n" +
"# class ProcessTupleOperator(pt.UDFOperatorV2):\n" +
"# \n" +
"# @overrides\n" +
"# def process_tuple(self, tuple_: Tuple, port: int) -> Iterator[Optional[TupleLike]]:\n" +
"# def process_tuple(self, tuple_: pt.Tuple, port: int) -> Iterator[Optional[pt.TupleLike]]:\n" +
"# yield tuple_\n" +
"# \n" +
"# class ProcessBatchOperator(UDFBatchOperator):\n" +
"# class ProcessBatchOperator(pt.UDFBatchOperator):\n" +
"# BATCH_SIZE = 10 # must be a positive integer\n" +
"# \n" +
"# @overrides\n" +
"# def process_batch(self, batch: Batch, port: int) -> Iterator[Optional[BatchLike]]:\n" +
"# def process_batch(self, batch: pt.Batch, port: int) -> Iterator[Optional[pt.BatchLike]]:\n" +
"# yield batch\n" +
"# \n" +
"# class ProcessTableOperator(UDFTableOperator):\n" +
"# class ProcessTableOperator(pt.UDFTableOperator):\n" +
"# \n" +
"# @overrides\n" +
"# def process_table(self, table: Table, port: int) -> Iterator[Optional[TableLike]]:\n" +
"# def process_table(self, table: pt.Table, port: int) -> Iterator[Optional[pt.TableLike]]:\n" +
"# yield table\n"
)
@JsonSchemaTitle("Python script")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
import edu.uci.ics.amber.engine.architecture.deploysemantics.layer.OpExecConfig;
import edu.uci.ics.amber.engine.architecture.deploysemantics.layer.OpExecFunc;
import edu.uci.ics.texera.workflow.common.metadata.InputPort;
import edu.uci.ics.texera.workflow.common.metadata.OperatorGroupConstants;
import edu.uci.ics.texera.workflow.common.metadata.OperatorInfo;
import edu.uci.ics.texera.workflow.common.metadata.OutputPort;
Expand All @@ -25,15 +24,16 @@
public class PythonUDFSourceOpDescV2 extends SourceOperatorDescriptor {

@JsonProperty(required = true, defaultValue =
"# Choose from the following templates:\n" +
"# \n" +
"# from pytexera import *\n" +
"# \n" +
"# class GenerateOperator(UDFSourceOperator):\n" +
"# \n" +
"# @overrides\n" +
"# def produce(self) -> Iterator[Union[TupleLike, TableLike, None]]:\n" +
"# yield\n")
"import pytexera as pt\n" +
"from overrides import overrides\n" +
"from typing import Iterator, Union\n" +
"\n" +
"\n" +
"class GenerateOperator(pt.UDFSourceOperator):\n" +
"\n" +
" @overrides\n" +
" def produce(self) -> Iterator[Union[pt.TupleLike, pt.TableLike, None]]:\n" +
" yield\n")
@JsonSchemaTitle("Python script")
@JsonPropertyDescription("Input your code here")
public String code;
Expand Down
Loading