Linting and Widgets (#11551)

- Fix any issues identified by the doc writer.
- Alter all `default_widget` functions: all now take display and all use the type check signature.
- Review widgets on AWS APIs and make sure display is correct.
This commit is contained in:
James Dunkerley 2024-11-14 12:01:04 +00:00 committed by GitHub
parent 5b79f6729c
commit 7363377331
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
50 changed files with 110 additions and 117 deletions

View File

@ -38,8 +38,8 @@ type AWS
- region_service: The region and service to use for signing the request.
Defaults to the region and service parsed from the URI.
@uri (Text_Input display=..Always)
@format File_Format.default_widget
@headers Header.default_widget
@format File_Format.default_widget
@credentials AWS_Credential.default_widget
signed_fetch : URI -> HTTP_Method -> (Vector (Header | Pair Text Text)) -> File_Format -> AWS_Credential -> AWS_Region_Service -> Any
signed_fetch (uri:URI=(Missing_Argument.throw "uri")) (method:HTTP_Method=..Get) (headers:(Vector (Header | Pair Text Text))=[]) (format = Auto_Detect) credentials:AWS_Credential=..Default (region_service:AWS_Region_Service=(AWS.resolve_region_and_service uri)) = if_fetch_method method <|
@ -71,10 +71,10 @@ type AWS
- region_service: The region and service to use for signing the request.
Defaults to the region and service parsed from the URI.
@uri (Text_Input display=..Always)
@format File_Format.default_widget
@headers Header.default_widget
@format File_Format.default_widget
@credentials AWS_Credential.default_widget
signed_post : (URI | Text) -> Request_Body -> HTTP_Method -> Vector (Header | Pair Text Text) -> Response ! Request_Error | HTTP_Error
signed_post : URI -> Request_Body -> HTTP_Method -> Vector (Header | Pair Text Text) -> Any -> AWS_Credential -> AWS_Region_Service -> Response ! Request_Error | HTTP_Error
signed_post (uri:URI=(Missing_Argument.throw "uri")) (body:Request_Body=..Empty) (method:HTTP_Method=..Post) (headers:(Vector (Header | Pair Text Text))=[]) (response_format = Auto_Detect) credentials:AWS_Credential=..Default (region_service:AWS_Region_Service=(AWS.resolve_region_and_service uri)) = if_post_method method <|
request = Request.new method uri (Header.unify_vector headers) body
http = with_hash_and_client HTTP.new hash_method=AWS.hash_bytes make_client=(_make_client credentials region_service)

View File

@ -20,7 +20,7 @@ type AWS_Credential
Arguments:
- profile: AWS profile name (if empty uses default).
@profile (make_single_choice AWS_Credential.profile_names)
@profile (make_single_choice AWS_Credential.profile_names display=..Always)
Profile profile:Text='default'
## Access using IAM via an AWS access key ID and secret access key.
@ -28,8 +28,8 @@ type AWS_Credential
Arguments:
- access_key_id: AWS access key ID.
- secret_access_key: AWS secret access key.
@access_key_id make_text_secret_selector
@secret_access_key make_text_secret_selector
@access_key_id (make_text_secret_selector display=..Always)
@secret_access_key (make_text_secret_selector display=..Always)
Key (access_key_id : (Text|Enso_Secret) = (Missing_Argument.throw "access_key_id")) (secret_access_key : (Text|Enso_Secret) = (Missing_Argument.throw "secret_access_key"))
## PRIVATE
@ -40,7 +40,8 @@ type AWS_Credential
Default, Profile, Key.
- default_region: The default region to use for operations that may
require a region but it is not explicitly specified.
@default_region AWS_Region.default_widget
@base_credential (AWS_Credential.default_widget display=..Always)
@default_region (AWS_Region.default_widget display=..Always)
With_Configuration (base_credential : AWS_Credential) (default_region : AWS_Region)
## ICON cloud
@ -68,8 +69,8 @@ type AWS_Credential
## ICON metadata
Sets the default region for operations that need it but do not specify it
explicitly.
@region AWS_Region.default_widget
with_default_region self (region : AWS_Region) -> AWS_Credential = case self of
@region (AWS_Region.default_widget display=..Always)
with_default_region self (region : AWS_Region = (Missing_Argument.throw "region")) -> AWS_Credential = case self of
AWS_Credential.With_Configuration base_credential _ ->
AWS_Credential.With_Configuration base_credential region
_ -> AWS_Credential.With_Configuration self region

View File

@ -27,7 +27,7 @@ type AWS_Region
Java_Region.regions.map .id
## PRIVATE
default_widget (display : Display = Display.When_Modified) -> Widget =
default_widget (display : Display = ..When_Modified) -> Widget =
options = [Option "Default" ("..Default")] + AWS_Region.all_region_ids.map id->
code = "(..Region "+id.pretty+")"
Option id code

View File

@ -6,6 +6,7 @@ from Standard.Table import Aggregate_Column, Value_Type
import Standard.Database.Connection.Connection.Connection
import Standard.Database.DB_Column.DB_Column
import Standard.Database.Dialect
import Standard.Database.Dialect_Flag.Dialect_Flag
import Standard.Database.Feature.Feature
import Standard.Database.Internal.Base_Generator
import Standard.Database.Internal.Column_Fetcher as Column_Fetcher_Module
@ -24,7 +25,6 @@ import Standard.Database.Internal.Postgres.Postgres_Type_Mapping.Postgres_Type_M
import Standard.Database.Internal.SQL_Type_Mapping.SQL_Type_Mapping
import Standard.Database.Internal.SQL_Type_Reference.SQL_Type_Reference
import Standard.Database.Internal.Statement_Setter.Statement_Setter
import Standard.Database.Dialect_Flag.Dialect_Flag
import Standard.Database.SQL.SQL_Builder
import Standard.Database.SQL_Statement.SQL_Statement
import Standard.Database.SQL_Type.SQL_Type

View File

@ -128,7 +128,7 @@ get_object bucket key credentials:AWS_Credential=AWS_Credential.Default delimite
- If the object does not exist, an `S3_Key_Not_Found` error is thrown.
@credentials AWS_Credential.default_widget
head : Text -> Text -> AWS_Credential -> Dictionary Text Any ! S3_Error
head (bucket : Text = Missing_Argument.throw "bucket") key:Text="" credentials:AWS_Credential=AWS_Credential.Default =
head (bucket : Text = Missing_Argument.throw "bucket") key:Text="" credentials:AWS_Credential=..Default =
response = raw_head bucket key credentials
pairs = response.sdkFields.map f-> [f.memberName, f.getValueOrDefault response]
Dictionary.from_vector pairs

View File

@ -12,10 +12,12 @@ type Base_64
## ICON convert
Converts a string to bytes using the specified encoding, and encodes that
to base64.
@encoding Encoding.default_widget
encode_text (text : Text) (encoding : Encoding = Encoding.utf_8) -> Text =
Base64.getEncoder.encodeToString (text.bytes encoding)
## ICON convert
Decodes a base64 encoded string, using the provided encoding.
@encoding Encoding.default_widget
decode_text (encoded_text : Text) (encoding : Encoding = Encoding.utf_8) -> Text ! Encoding_Error =
Text.from_bytes (Base64.getDecoder.decode encoded_text) encoding

View File

@ -1153,8 +1153,8 @@ type Decimal
Decimal.parse "(123,456,789.654)" format="###,###.##;(###,###.##)"
# => -123456789.654
parse : Text -> Locale | Nothing -> Decimal ! Number_Parse_Error ! Illegal_Argument
parse text locale:Locale=Locale.default format:Text="" -> Decimal ! Number_Parse_Error ! Illegal_Argument =
parse : Text -> Locale -> Text -> Decimal ! Number_Parse_Error ! Illegal_Argument
parse text:Text locale:Locale=Locale.default format:Text="" -> Decimal ! Number_Parse_Error ! Illegal_Argument =
Illegal_Argument.handle_java_exception <|
# `getInstance` returns `DecimalFormat` or a subclass of `DecimalFormat`.
decimal_format = NumberFormat.getInstance locale.java_locale

View File

@ -256,8 +256,7 @@ type Filter_Condition
## PRIVATE
Creates a Single_Choice Widget for delimiters.
default_widget : Boolean -> Boolean -> Boolean -> Boolean -> Boolean -> Boolean -> Boolean -> Boolean -> Widget
default_widget include_comparable=True include_text=True include_boolean=True include_nullable=True include_numeric=True include_date=True include_time=True include_date_time=True =
default_widget include_comparable:Boolean=True include_text:Boolean=True include_boolean:Boolean=True include_nullable:Boolean=True include_numeric:Boolean=True include_date:Boolean=True include_time:Boolean=True include_date_time:Boolean=True display:Display=..When_Modified -> Widget =
options = Vector.build builder->
equatable_types = make_any_selector add_text=include_text add_boolean=include_boolean add_number=include_numeric add_date=include_date add_time=include_time add_date_time=include_date_time
builder.append (Option "Equals" "..Equal" [["to", equatable_types]])
@ -297,7 +296,7 @@ type Filter_Condition
value_editor = Widget.Vector_Editor item_editor=equatable_types display=Display.Always item_default='""'
builder.append (Option "Is In" "..Is_In" [["values", value_editor]])
make_single_choice options
make_single_choice options display=display
## Specifies the action of a Filter_Condition.
type Filter_Action

View File

@ -94,9 +94,8 @@ type Index_Sub_Range
[o1, o2, o4, o5, o6, o7, o3]
## PRIVATE
default_widget : (Integer|Nothing) -> Widget
default_widget count:(Integer|Nothing)=Nothing =
Single_Choice display=Display.Always (Index_Sub_Range.default_options count)
default_widget count:(Integer|Nothing)=Nothing display:Display=..Always -> Widget =
Single_Choice display=display (Index_Sub_Range.default_options count)
## PRIVATE
Resolves a vector of ranges or indices into a vector of ranges that fit

View File

@ -460,8 +460,8 @@ type Locale
## PRIVATE
Gets the default drop down option for Locale.
default_widget : Widget
default_widget = Widget.Single_Choice values=Locale.widget_options display=Display.When_Modified
default_widget display:Display=..When_Modified -> Widget =
Widget.Single_Choice values=Locale.widget_options display=display
## PRIVATE
predefined_locale_fields : Vector Text

View File

@ -793,8 +793,8 @@ type Float
Float.parse "(123,456,789.654)" format="###,###.##;(###,###.##)"
# => -123456789.654
parse : Text -> Locale | Nothing -> Float ! Number_Parse_Error ! Illegal_Argument
parse text (locale : Locale | Nothing = Nothing) (format : Text | Nothing = Nothing) -> Float ! Number_Parse_Error ! Illegal_Argument =
parse : Text -> Locale | Nothing -> Text | Nothing -> Float ! Number_Parse_Error ! Illegal_Argument
parse text:Text (locale : Locale | Nothing = Nothing) (format : Text | Nothing = Nothing) -> Float ! Number_Parse_Error ! Illegal_Argument =
case locale.is_nothing && format.is_nothing of
True ->
Panic.catch NumberFormatException (Double.parseDouble text) _->

View File

@ -1,6 +1,6 @@
import project.Any.Any
import project.Data.Text.Text
import project.Data.Read.Many_Files_List.Many_Files_List
import project.Data.Text.Text
import project.Data.Vector.Vector
import project.Error.Error
import project.Errors.Common.Type_Error
@ -49,10 +49,9 @@ type Return_As
_ -> Panic.throw (Type_Error.Error Return_As value "Expected `return` to be a Return_As type, but got {got}.")
## PRIVATE
default_widget : Widget
default_widget =
default_widget display:Display=..When_Modified -> Widget =
options = _get_known_return_classes.map .get_dropdown_options
Single_Choice display=Display.Always values=options
Single_Choice display=display values=options
## PRIVATE
type Return_As_Base

View File

@ -19,12 +19,11 @@ polyglot java import org.enso.base.Text_Utils
## Represents a character encoding.
type Encoding
## PRIVATE
Gets the default drop down option for this encoding.
default_widget : Widget
default_widget =
Gets the default drop down option for Encoding.
default_widget display:Display=..When_Modified -> Widget =
fqn = Meta.get_qualified_type_name Encoding
values = [Option "UTF-8" fqn+".utf_8", Option "ASCII" fqn+".ascii", Option "UTF-16LE" fqn+".utf_16_le", Option "UTF-16BE" fqn+".utf_16_be", Option "UTF-32LE" fqn+".utf_32_le", Option "UTF-32BE" fqn+".utf_32_be", Option "Windows-1250" fqn+".windows_1250", Option "Windows-1251" fqn+".windows_1251", Option "Windows-1252" fqn+".windows_1252", Option "Windows-1253" fqn+".windows_1253", Option "Windows-1254" fqn+".windows_1254", Option "Windows-1255" fqn+".windows_1255", Option "Windows-1256" fqn+".windows_1256", Option "Windows-1257" fqn+".windows_1257", Option "Windows-1258" fqn+".windows_1258"]
Single_Choice values=values display=Display.When_Modified
Single_Choice values=values display=display
## PRIVATE
ADVANCED

View File

@ -335,7 +335,7 @@ Text.find_all self pattern:Text|Regex=".*" case_sensitivity:Case_Sensitivity=..S
# Evaluates to true
"CONTACT@enso.org".match regex Case_Sensitivity.Insensitive
Text.match : Text|Regex -> Case_Sensitivity -> Boolean ! Regex_Syntax_Error | Illegal_Argument
Text.match self pattern:Text|Regex=".*" case_sensitivity:Case_Sensitivity=..Sensitive -> Boolean =
Text.match self pattern:Text|Regex=".*" case_sensitivity:Case_Sensitivity=..Sensitive -> Boolean ! Regex_Syntax_Error | Illegal_Argument =
case_insensitive = case_sensitivity.is_case_insensitive_in_memory
compiled_pattern = Regex.compile pattern case_insensitive=case_insensitive
compiled_pattern.matches self

View File

@ -65,10 +65,9 @@ type Text_Sub_Range
The widget for `Text_Sub_Range` also displays options for
`Index_Sub_Range` since the former is supposed to 'expand' the latter and
is always used together with it.
default_widget : Widget
default_widget =
default_widget display:Display=..When_Modified -> Widget =
options = Index_Sub_Range.default_options + Text_Sub_Range.default_options
Single_Choice display=Display.Always options
Single_Choice display=display options
type Codepoint_Ranges
## PRIVATE

View File

@ -845,10 +845,9 @@ type Date
## PRIVATE
Gets the default drop down option for Date.
default_widget : Boolean -> Widget
default_widget (include_today:Boolean=False) =
default_widget (include_today:Boolean=False) display:Display=..When_Modified -> Widget =
options = [Option "<Fixed Date>" "Date.new"] + (if include_today then [Option "<Today>" "Date.today"] else [])
Widget.Single_Choice values=options display=Display.When_Modified
Widget.Single_Choice values=options display=display
## PRIVATE
week_days_between start end =

View File

@ -518,10 +518,9 @@ type Time_Of_Day
## PRIVATE
Gets the default drop down option for Time_Of_Day.
default_widget : Boolean -> Widget
default_widget (include_now:Boolean=False) =
default_widget (include_now:Boolean=False) display:Display=..When_Modified -> Widget =
options = [Option "<Fixed Time>" "Time_Of_Day.new"] + (if include_now then [Option "<Now>" "Time_Of_Day.now"] else [])
Widget.Single_Choice values=options display=Display.When_Modified
Widget.Single_Choice values=options display=display
## PRIVATE
Time_Of_Day.from (that:JS_Object) =

View File

@ -203,10 +203,9 @@ type Time_Zone
## PRIVATE
Gets the default drop down option for Time_Zone.
default_widget : Widget
default_widget =
default_widget display:Display=..When_Modified -> Widget =
options = [Option "System" "Time_Zone.system", Option "Local" "Time_Zone.local", Option "UTC" "Time_Zone.utc", Option "Named" "(Time_Zone.parse 'UTC')", Option "custom" "(Time_Zone.new 1 0 0)"]
Widget.Single_Choice values=options display=Display.When_Modified
Widget.Single_Choice values=options display=display
## ICON time
Gets a list of all the time zone names that are predefined.

View File

@ -1558,6 +1558,7 @@ type Map_Error
Indicates that a method should not wrap thrown errors in `Map_Error`.
@Builtin_Type
type No_Wrap
## PRIVATE
Value
## PRIVATE

View File

@ -252,7 +252,7 @@ type Enso_File
Arguments:
- name: The name of the label to create.
- color: The color of the label to create.
create_label : Text -> Text -> Nothing
create_label : Text -> Color -> Nothing
create_label (name : Text) (color : Color) -> Nothing =
# TODO once cloud also checks for tag existance, if the Write context is enabled we could avoid this check as cloud will do it anyway - then we'll have only one request instead of 2 each time
# Cloud ticket: https://github.com/enso-org/cloud-v2/issues/1544

View File

@ -25,7 +25,7 @@ import project.Runtime.Context
from project.Data.Boolean import Boolean, False, True
from project.Data.Text.Extensions import all
from project.Enso_Cloud.Data_Link_Helpers import data_link_extension
from project.Enso_Cloud.Public_Utils import get_required_field, get_optional_field
from project.Enso_Cloud.Public_Utils import get_optional_field, get_required_field
## PRIVATE
Currently, most of the Cloud API relies on asset IDs and not paths.

View File

@ -14,8 +14,8 @@ from project.Data.Boolean import Boolean, False, True
polyglot java import java.lang.ArithmeticException
polyglot java import java.lang.ClassCastException
polyglot java import java.lang.OutOfMemoryError
polyglot java import org.enso.base.CompareException
polyglot java import org.enso.base.cache.ResponseTooLargeException
polyglot java import org.enso.base.CompareException
## An error indicating that no value was found.
type Not_Found

View File

@ -99,8 +99,7 @@ type Widget
JS_Object.from_pairs (type_pair + cons_pair + field_pairs)
## PRIVATE
make_single_choice : Vector -> Display -> Widget
make_single_choice values display:Display=..Always =
make_single_choice values:Vector display:Display=..Always -> Widget =
make_option value = case value of
_ : Vector -> Choice.Option value.first value.second
_ : Text -> Choice.Option value value.pretty

View File

@ -36,8 +36,8 @@ from project.Data.Boolean import Boolean, False, True
from project.Data.Json.Extensions import all
from project.Data.Text.Extensions import all
polyglot java import java.lang.IllegalArgumentException
polyglot java import java.io.IOException
polyglot java import java.lang.IllegalArgumentException
polyglot java import java.net.http.HttpClient
polyglot java import java.net.http.HttpClient.Builder as ClientBuilder
polyglot java import java.net.http.HttpClient.Redirect

View File

@ -12,7 +12,7 @@ type Cache_Policy
## Don't use the response cache.
No_Cache
# Default to using the cache for GET requests, unless explicitly disabled
## Default to using the cache for GET requests, unless explicitly disabled
should_use_cache self request:Request -> Boolean = case self of
Cache_Policy.Default -> if request.method == HTTP_Method.Get then True else False
Cache_Policy.Use_Cache -> True

View File

@ -145,10 +145,9 @@ type File_Format
format_types.flat_map .get_name_patterns . flat_map .patterns . distinct
## PRIVATE
default_widget : Widget
default_widget =
default_widget display:Display=..When_Modified -> Widget =
options = ([Auto_Detect]+format_types).flat_map .get_dropdown_options
Single_Choice display=Display.Always values=options
Single_Choice display=display values=options
## PRIVATE
Builds a widget intended to be used for `name_filter` of `File.list` and

View File

@ -15,10 +15,9 @@ from project.Metadata.Choice import Option
## PRIVATE
Creates a Single_Choice Widget for text or secret value.
make_text_secret_selector : Widget
make_text_secret_selector =
make_text_secret_selector display:Display=..When_Modified -> Widget =
fqn = Meta.get_qualified_type_name Enso_Secret
make_single_choice [['<Text Value>', '""'], ['<Secret Value>', fqn+".get"]]
make_single_choice [['<Text Value>', '""'], ['<Secret Value>', fqn+".get"]] display=display
## PRIVATE
Creates a Regex / Text Widget for search and replace.

View File

@ -1,4 +1,5 @@
from Standard.Base import all
import Standard.Base.Metadata.Display
import Standard.Base.Metadata.Widget
from Standard.Base.Metadata.Choice import Option
from Standard.Base.Metadata.Widget import Single_Choice, Text_Input, Vector_Editor
@ -20,13 +21,12 @@ type Connection_Options
## PRIVATE
Widget to design connection options.
default_widget : Widget
default_widget =
default_widget display:Display=..Always -> Widget =
fqn = Meta.get_qualified_type_name Pair . take (..Before_Last '.')
default = 'pair "key" "value"'
pair = Option "Pair" fqn+".pair" [["first", Text_Input], ["second", make_text_secret_selector]]
item_editor = Single_Choice display=..Always values=[pair]
Vector_Editor item_editor=item_editor display=..Always item_default=default
Vector_Editor item_editor=item_editor display=display item_default=default
## PRIVATE
Connection_Options.from (that:Vector) = Connection_Options.Value that

View File

@ -20,7 +20,7 @@ type Credentials
to_display_text self -> Text = self.to_text.to_display_text
## PRIVATE
default_widget (include_nothing : Boolean = True) -> Widget =
default_widget (include_nothing : Boolean = True) display:Display=..When_Modified -> Widget =
fqn = Meta.get_qualified_type_name Credentials
values = [Option "Username_And_Password" fqn+".Username_And_Password"] + if include_nothing then [Option "No credentials" "Nothing"] else []
Single_Choice values=values display=Display.When_Modified
Single_Choice values=values display=display

View File

@ -11,9 +11,9 @@ import project.Connection.Connection.Connection
import project.DB_Table.DB_Table
import project.Dialect
import project.Internal.Connection.Entity_Naming_Properties.Entity_Naming_Properties
import project.Internal.Data_Link_Setup.Data_Link_Setup
import project.Internal.IR.Query.Query
import project.Internal.JDBC_Connection
import project.Internal.Data_Link_Setup.Data_Link_Setup
import project.Internal.SQL_Type_Reference.SQL_Type_Reference
import project.SQL_Query.SQL_Query
import project.SQL_Statement.SQL_Statement
@ -137,7 +137,7 @@ type Postgres_Connection
tables self name_like=Nothing database=self.database schema=Nothing types=self.dialect.default_table_types all_fields=False =
self.connection.tables name_like database schema types all_fields
## ALIAS read, load, open, import
## ALIAS import, load, open, read
GROUP Standard.Base.Input
ICON data_input
Set up a query returning a Table object, which can be used to work with
@ -159,7 +159,7 @@ type Postgres_Connection
query : SQL_Query -> Text -> DB_Table ! Table_Not_Found
query self query:SQL_Query alias="" = self.connection.query query alias
## ALIAS query, load, open, import
## ALIAS import, load, open, query
GROUP Standard.Base.Input
ICON data_input
Execute the query and load the results into memory as a Table.

View File

@ -8,6 +8,7 @@ from Standard.Table import Aggregate_Column, Join_Kind, Value_Type
import project.Connection.Connection.Connection
import project.DB_Column.DB_Column
import project.DB_Table.DB_Table
import project.Dialect_Flag.Dialect_Flag
import project.Internal.Column_Fetcher.Column_Fetcher
import project.Internal.DB_Wrapped_Error.DB_Wrapped_Error
import project.Internal.Error_Mapper.Error_Mapper
@ -23,7 +24,6 @@ import project.Internal.SQL_Type_Mapping.SQL_Type_Mapping
import project.Internal.SQL_Type_Reference.SQL_Type_Reference
import project.Internal.SQLite.SQLite_Dialect
import project.Internal.Statement_Setter.Statement_Setter
import project.Dialect_Flag.Dialect_Flag
import project.SQL.SQL_Builder
import project.SQL_Statement.SQL_Statement
import project.SQL_Type.SQL_Type

View File

@ -4,7 +4,7 @@ import Standard.Base.Errors.File_Error.File_Error
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
import Standard.Base.Errors.Illegal_State.Illegal_State
import Standard.Base.Runtime.Context
from Standard.Base.Enso_Cloud.Data_Link_Helpers import data_link_extension, secure_value_to_json, save_password_for_data_link
from Standard.Base.Enso_Cloud.Data_Link_Helpers import data_link_extension, save_password_for_data_link, secure_value_to_json
import project.Connection.Credentials.Credentials
import project.SQL_Statement.SQL_Statement

View File

@ -14,6 +14,7 @@ import project.Connection.Connection.Connection
import project.DB_Column.DB_Column
import project.DB_Table.DB_Table
import project.Dialect
import project.Dialect_Flag.Dialect_Flag
import project.Internal.Base_Generator
import project.Internal.Common.Database_Distinct_Helper
import project.Internal.Common.Database_Join_Helper
@ -33,7 +34,6 @@ import project.Internal.Replace_Params.Replace_Params
import project.Internal.SQL_Type_Mapping.SQL_Type_Mapping
import project.Internal.SQL_Type_Reference.SQL_Type_Reference
import project.Internal.Statement_Setter.Statement_Setter
import project.Dialect_Flag.Dialect_Flag
import project.SQL.SQL_Builder
import project.SQL.SQL_Fragment
import project.SQL_Statement.SQL_Statement

View File

@ -11,6 +11,7 @@ import project.Connection.Connection.Connection
import project.DB_Column.DB_Column
import project.DB_Table.DB_Table
import project.Dialect
import project.Dialect_Flag.Dialect_Flag
import project.Internal.Aggregate_Helper
import project.Internal.Aggregate_Helper.Aggregate_With_Helper_Expressions
import project.Internal.Base_Generator
@ -31,7 +32,6 @@ import project.Internal.SQL_Type_Reference.SQL_Type_Reference
import project.Internal.SQLite.SQLite_Error_Mapper.SQLite_Error_Mapper
import project.Internal.SQLite.SQLite_Type_Mapping.SQLite_Type_Mapping
import project.Internal.Statement_Setter.Statement_Setter
import project.Dialect_Flag.Dialect_Flag
import project.SQL.SQL_Builder
import project.SQL_Statement.SQL_Statement
import project.SQL_Type.SQL_Type

View File

@ -18,7 +18,9 @@ type SQLite_Error_Mapper
## PRIVATE
SQLite does not mind SQLite NULL primary keys.
is_null_primary_key_violation : SQL_Error -> Boolean
is_null_primary_key_violation _ = False
is_null_primary_key_violation error =
_ = error
False
## PRIVATE
is_table_already_exists_error : SQL_Error -> Boolean

View File

@ -14,7 +14,7 @@ import project.Internal.In_Transaction.In_Transaction
import project.Internal.IR.Query.Query
import project.SQL_Query.SQL_Query
from project.Dialect import Temp_Table_Style
from project.Errors import SQL_Error, Table_Already_Exists, Different_Connections
from project.Errors import Different_Connections, SQL_Error, Table_Already_Exists
from project.Internal.JDBC_Connection import log_sql_if_enabled
from project.Internal.Upload.Helpers.Argument_Checks import resolve_primary_key
from project.Internal.Upload.Helpers.Constants import default_batch_size

View File

@ -5,18 +5,19 @@ from Standard.Base.Metadata import make_single_choice, Widget
from Standard.Base.Metadata.Choice import Option
from Standard.Base.Metadata.Widget import Single_Choice, Text_Input, Vector_Editor
from Standard.Table import Data_Formatter, Table
import Standard.Table.Rows_To_Read.Rows_To_Read
from Standard.Table import Data_Formatter, Table
from Standard.Table.Table import from_java_table
import project.Google_Credential.Google_Credential
import project.Google_Analytics_Account.Google_Analytics_Account
import project.Google_Analytics_Account.Google_Analytics_Account_Filter
import project.Google_Analytics_Field.Google_Analytics_Field
import project.Google_Analytics_Property.Google_Analytics_Property
import project.Google_Credential.Google_Credential
polyglot java import org.enso.google.GoogleAnalyticsReader
## Type providing API access to Google Analytics.
type Google_Analytics
## GROUP Standard.Base.Input
ICON data_input

View File

@ -1,5 +1,5 @@
from Standard.Base import all
from Standard.Base.Metadata import make_single_choice, Widget
from Standard.Base.Metadata import Display, make_single_choice, Widget
from Standard.Base.Metadata.Choice import Option
from Standard.Base.Metadata.Widget import Text_Input, Vector_Editor
@ -58,6 +58,7 @@ type Google_Analytics_Account
## Filter for Google Analytics accounts.
type Google_Analytics_Account_Filter
## Filter to all accounts.
All_Accounts
## Filter to a single account
@ -69,14 +70,13 @@ type Google_Analytics_Account_Filter
Accounts accounts:Vector
## PRIVATE
default_widget : Any -> Any -> Widget
default_widget self_arg cache =
default_widget self_arg cache display:Display=..Always -> Widget =
_ = self_arg
default = [Option "<All>" "..All_Accounts", Option "<Account>" "..Account", Option "<Multiple Accounts>" "..Accounts"]
Panic.catch Any handler=_->(make_single_choice default) <|
credentials = cache.if_not_nothing <| cache "credentials"
options = Google_Analytics.list_accounts credentials=(credentials.if_nothing Google_Credential.Default) limit=(..First 10) . map p->(Option (p.name + " (" + p.id + ")") "..Account "+p.id.pretty)
make_single_choice default+options display=..Always
make_single_choice default+options display=display
## PRIVATE
private as_java self -> Array | Nothing = case self of

View File

@ -1,6 +1,6 @@
from Standard.Base import all
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
from Standard.Base.Metadata import make_single_choice, Widget
from Standard.Base.Metadata import Display, make_single_choice, Widget
from Standard.Base.Metadata.Choice import Option
import project.Google_Analytics.Google_Analytics
@ -65,13 +65,12 @@ type Google_Analytics_Property
Google_Analytics.list_dimensions self credentials
## PRIVATE
default_widget : Any -> Any -> Widget
default_widget self_arg cache =
default_widget self_arg cache display:Display=..Always -> Widget =
_ = self_arg
Panic.catch Any handler=_->(Widget.Text_Input display=..Always) <|
Panic.catch Any handler=_->(Widget.Text_Input display=display) <|
credentials = cache.if_not_nothing <| cache "credentials"
options = Google_Analytics.list_properties account=..All_Accounts credentials=(credentials.if_nothing Google_Credential.Default) limit=(..First 10) . map p->(Option (p.name + " (" + p.id + ")") p.id.pretty)
make_single_choice options display=..Always
make_single_choice options display=display
## PRIVATE
Google_Analytics_Property.from (that:Text) =

View File

@ -1,6 +1,6 @@
from Standard.Base import all
import Standard.Base.Errors.Common.Missing_Argument
from Standard.Base.Metadata import make_single_choice, Choice, Widget
from Standard.Base.Metadata import Choice, Display, make_single_choice, Widget
from Standard.Base.Metadata.Choice import Option
polyglot java import com.google.api.gax.core.CredentialsProvider
@ -45,9 +45,8 @@ type Google_Credential
Google_Credential.Default -> Nothing
## PRIVATE
default_widget : Widget
default_widget =
make_single_choice [Option "File" "..From_File", Option "Default" "..Default"]
default_widget display:Display=..When_Modified -> Widget =
make_single_choice [Option "File" "..From_File", Option "Default" "..Default"] display=display
## PRIVATE
Google_Credential.from (that:File) = Google_Credential.From_File that

View File

@ -16,6 +16,7 @@ import Standard.Database.Connection.Connection.Connection
import Standard.Database.DB_Column.DB_Column
import Standard.Database.DB_Table.DB_Table
import Standard.Database.Dialect
import Standard.Database.Dialect_Flag.Dialect_Flag
import Standard.Database.Feature.Feature
import Standard.Database.Internal.Base_Generator
import Standard.Database.Internal.Common.Database_Distinct_Helper
@ -35,7 +36,6 @@ import Standard.Database.Internal.Replace_Params.Replace_Params
import Standard.Database.Internal.SQL_Type_Mapping.SQL_Type_Mapping
import Standard.Database.Internal.SQL_Type_Reference.SQL_Type_Reference
import Standard.Database.Internal.Statement_Setter.Statement_Setter
import Standard.Database.Dialect_Flag.Dialect_Flag
import Standard.Database.SQL.SQL_Builder
import Standard.Database.SQL.SQL_Fragment
import Standard.Database.SQL_Statement.SQL_Statement

View File

@ -17,6 +17,7 @@ import Standard.Database.Connection.Connection.Connection
import Standard.Database.DB_Column.DB_Column
import Standard.Database.DB_Table.DB_Table
import Standard.Database.Dialect
import Standard.Database.Dialect_Flag.Dialect_Flag
import Standard.Database.Feature.Feature
import Standard.Database.Internal.Aggregate_Helper
import Standard.Database.Internal.Aggregate_Helper.Aggregate_With_Helper_Expressions
@ -39,7 +40,6 @@ import Standard.Database.Internal.Replace_Params.Replace_Params
import Standard.Database.Internal.SQL_Type_Mapping.SQL_Type_Mapping
import Standard.Database.Internal.SQL_Type_Reference.SQL_Type_Reference
import Standard.Database.Internal.Statement_Setter.Statement_Setter
import Standard.Database.Dialect_Flag.Dialect_Flag
import Standard.Database.SQL.SQL_Builder
import Standard.Database.SQL.SQL_Fragment
import Standard.Database.SQL_Statement.SQL_Statement

View File

@ -1,5 +1,5 @@
from Standard.Base import all
from Standard.Base.Metadata import make_single_choice, Widget
from Standard.Base.Metadata import Display, make_single_choice, Widget
## PRIVATE
type Columns_To_Add
@ -10,8 +10,8 @@ type Columns_To_Add
First columns:Integer=1
## PRIVATE
default_widget -> Widget =
make_single_choice [["All_Columns", "..All_Columns"], ["First", "..First"]]
default_widget display:Display=..When_Modified -> Widget =
make_single_choice [["All_Columns", "..All_Columns"], ["First", "..First"]] display=display
## PRIVATE
Gets the number of columns to add (or Nothing if all columns).

View File

@ -1,5 +1,5 @@
from Standard.Base import Text, Vector
from Standard.Base.Metadata import make_single_choice, Widget
from Standard.Base.Metadata import Display, make_single_choice, Widget
## Specifies which columns to keep in a union operation.
type Columns_To_Keep
@ -30,6 +30,6 @@ type Columns_To_Keep
The default widget for `Columns_To_Keep`.
It does not display the internal `In_Any_Warn_On_Missing` variant, since
that variant is only meant to be used as the default value.
default_widget -> Widget =
make_single_choice <|
default_widget display:Display=..When_Modified -> Widget =
make_single_choice display=display <|
["In_Any", "In_All", "In_List"].map c-> [c, ".."+c]

View File

@ -1,5 +1,5 @@
from Standard.Base import all
from Standard.Base.Metadata import make_single_choice, Widget
from Standard.Base.Metadata import Display, make_single_choice, Widget
import project.Errors.Not_All_Rows_Downloaded
import project.Table.Table
@ -18,8 +18,8 @@ type Rows_To_Read
First_With_Warning rows:Integer=1000
## PRIVATE
default_widget -> Widget =
make_single_choice [["All_Rows", "..All_Rows"], ["First", "..First"]]
default_widget display:Display=..When_Modified -> Widget =
make_single_choice [["All_Rows", "..All_Rows"], ["First", "..First"]] display=display
## PRIVATE
Gets the number of rows to read (or Nothing if all rows).

View File

@ -66,8 +66,7 @@ type Simple_Expression
## PRIVATE
Create a widget for operation
default_widget : Table_Ref -> Display -> Widget
default_widget table:Table_Ref display=Display.Always =
default_widget table:Table_Ref display:Display=..Always -> Widget =
with_everything = Widget_Helpers.make_column_ref_by_name_selector table add_text=True add_number=True add_boolean=True add_date=True add_time=True add_date_time=True add_nothing=True
with_all_types = Widget_Helpers.make_column_ref_by_name_selector table add_text=True add_number=True add_boolean=True add_date=True add_time=True add_date_time=True
with_number_text = Widget_Helpers.make_column_ref_by_name_selector table add_text=True add_number=True

View File

@ -125,7 +125,7 @@ type Faker
Arguments
- bit_length: specifies the range of values to select from. The values
will be between -2^bit_length and 2^bit_length.
large_integer : Integer -> Integer -> Integer
large_integer : Integer -> Integer
large_integer self bit_length =
BigInteger.new bit_length 0 self.generator
@ -141,7 +141,7 @@ type Faker
Arguments
- bit_length: specifies the range of values to select from. The values
will be between -2^bit_length and 2^bit_length.
decimal : Integer -> Integer -> Integer
decimal : Integer -> Integer
decimal self bit_length =
(self.large_integer bit_length) + self.float

View File

@ -59,7 +59,7 @@ prepare_visualization y max_rows=1000 =
Column Limit
max_columns = 250
##PRIVATE
## PRIVATE
whitespace_count : Column -> Integer | Nothing
whitespace_count col =
find_whitespace col =

View File

@ -1,6 +1,6 @@
from Standard.Base import all
import Standard.Base.Metadata.Widget
import Standard.Base.Errors.Common.Not_Invokable
import Standard.Base.Metadata.Widget
from Standard.Base.Logging import all
from Standard.Base.Meta import Instrumentor