Skip to content

Commit

Permalink
Small tweaks from using Process.run (#11110)
Browse files Browse the repository at this point in the history
* Once more unto the lint dear friends.

* Default the arguments for process run.
Allow delimiter to be used to convert Text to Table.

(cherry picked from commit b2545b8)
  • Loading branch information
jdunkerley committed Sep 17, 2024
1 parent 5c4fe1b commit 3270d45
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from Standard.Base import all
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
import Standard.Base.Errors.Common.Missing_Argument
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
from Standard.Base.Enso_Cloud.Enso_Secret import as_hideable_value
from Standard.Base.Metadata import Display, make_single_choice, Widget
from Standard.Base.Metadata.Choice import Option
Expand Down
2 changes: 1 addition & 1 deletion distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3.enso
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import Standard.Base.System.Input_Stream.Input_Stream
from Standard.Base.Network.HTTP.Response import filename_from_content_disposition

import project.AWS_Credential.AWS_Credential
import project.S3.S3_File.S3_File
import project.Errors.AWS_SDK_Error
import project.Errors.More_Records_Available
import project.Errors.S3_Bucket_Not_Found
import project.Errors.S3_Error
import project.Errors.S3_Key_Not_Found
import project.Internal.Request_Body
import project.S3.S3_File.S3_File

polyglot java import java.io.IOException
polyglot java import org.enso.aws.BucketLocator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import project.System.Process.Exit_Code.Exit_Code
import project.System.Process.Process_Builder.Process_Builder
import project.System.Process.Process_Builder.Process_Result
from project.Data.Boolean import Boolean, False, True
from project.Metadata.Widget import Text_Input, Vector_Editor

## ALIAS run a command
GROUP Input
Expand All @@ -25,8 +26,9 @@ from project.Data.Boolean import Boolean, False, True
example_run = case Platform.os of
Platform.OS.Windows -> Process.run "PowerShell" ["-Command", "exit 42"]
_ -> Process.run "bash" ["-c", "exit 42"]
@arguments (Vector_Editor item_editor=Text_Input item_default='""')
run : Text -> Vector Text -> Text -> Process_Result
run command arguments=[] stdin="" =
run command:Text arguments=[] stdin:Text="" =
new_builder command arguments stdin . create

## PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ from Standard.Base import all
since feature flags are user-facing, and can be used to identify features
that are not yet implemented.
type Dialect_Flags
## PRIVATE
Value (rounding : Rounding_Flags)

## PRIVATE
type Rounding_Flags
## PRIVATE
Value (supports_negative_decimal_places : Boolean) (supports_float_decimal_places : Boolean) (use_builtin_bankers : Boolean)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ from Standard.Table.Aggregate_Column.Aggregate_Column import all
from Standard.Table.Errors import Inexact_Type_Coercion
from Standard.Table.Internal.Storage import get_storage_for_column

from Standard.Database.Dialect_Flags import all

import project.Connection.Connection.Connection
import project.DB_Column.DB_Column
import project.DB_Table.DB_Table
Expand Down Expand Up @@ -38,7 +40,6 @@ import project.SQL.SQL_Fragment
import project.SQL_Statement.SQL_Statement
import project.SQL_Type.SQL_Type
from project.Dialect import Temp_Table_Style
from Standard.Database.Dialect_Flags import all
from project.Errors import SQL_Error, Unsupported_Database_Operation
from project.Internal.IR.Operation_Metadata import Date_Period_Metadata
from project.Internal.JDBC_Connection import JDBC_Connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import Standard.Table.Internal.Problem_Builder.Problem_Builder
from Standard.Table import Aggregate_Column, Value_Type
from Standard.Table.Aggregate_Column.Aggregate_Column import all

from Standard.Database.Dialect_Flags import all

import project.Connection.Connection.Connection
import project.DB_Column.DB_Column
import project.DB_Table.DB_Table
Expand Down Expand Up @@ -35,7 +37,6 @@ import project.SQL.SQL_Builder
import project.SQL_Statement.SQL_Statement
import project.SQL_Type.SQL_Type
from project.Dialect import Temp_Table_Style
from Standard.Database.Dialect_Flags import all
from project.Errors import SQL_Error, Unsupported_Database_Operation
from project.Internal.JDBC_Connection import JDBC_Connection

Expand Down
12 changes: 7 additions & 5 deletions distribution/lib/Standard/Table/0.0.0-dev/src/Table.enso
Original file line number Diff line number Diff line change
Expand Up @@ -3784,11 +3784,13 @@ Table.from (that:Column) = that.to_table
- that: The text to convert.
- format: The format of the text.
- on_problems: What to do if there are problems reading the text.
Table.from (that : Text) (format = Delimited_Format.Delimited '\t') (on_problems:Problem_Behavior=..Report_Warning) =
resolved_format = File_Format.resolve format
case resolved_format of
_ : Delimited_Format -> Delimited_Reader.read_text that resolved_format on_problems
_ -> Unimplemented.throw "Table.from is currently only implemented for Delimited_Format."
Table.from (that : Text) (format = Delimited_Format.Delimited '\t') (on_problems:Problem_Behavior=..Report_Warning) = case format of
_ : Text -> Table.from that (Delimited_Format.Delimited format) on_problems
_ ->
resolved_format = File_Format.resolve format
case resolved_format of
_ : Delimited_Format -> Delimited_Reader.read_text that resolved_format on_problems
_ -> Unimplemented.throw "Table.from is currently only implemented for Delimited_Format."

## PRIVATE
Converts a Table into a Text value.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from Standard.Base import all
import Standard.Base.Errors.Common.Not_Invokable
from Standard.Base.Meta import Instrumentor
from Standard.Database import all

from Standard.Table import all

from Standard.Database import all

## PRIVATE
Basic preprocessor for widgets metadata visualization.

Expand Down

0 comments on commit 3270d45

Please sign in to comment.