Linter and small widget change (#10136)

Linter issues to allow doc site generation.
Small change in order for aggregate column.
This commit is contained in:
James Dunkerley 2024-05-31 13:30:38 +01:00 committed by GitHub
parent 28655e13d7
commit ffdfc7195e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 92 additions and 70 deletions

View File

@ -374,7 +374,7 @@ type Array
- on_problems: Specifies how to handle any problems that arise in
`function`.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on
`on_problems`:
@ -413,7 +413,7 @@ type Array
- on_problems: Specifies how to handle any problems that arise in
`function`.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on
`on_problems`:
@ -660,7 +660,7 @@ type Array
The function is called with both the element index as well as the
element itself.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on
`on_problems`:
@ -883,7 +883,7 @@ type Array
The result of this function is a `Vector` of length being the shorter of
`self` and `that`, containing results of calling `function`.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on
`on_problems`:

View File

@ -9,9 +9,9 @@ import project.Data.Text.Encoding.Encoding
import project.Data.Text.Location.Location
import project.Data.Text.Matching_Mode.Matching_Mode
import project.Data.Text.Regex.Match.Match
import project.Data.Text.Regex.Named_Pattern.Named_Pattern
import project.Data.Text.Regex.Regex
import project.Data.Text.Regex.Regex_Syntax_Error
import project.Data.Text.Regex.Named_Pattern.Named_Pattern
import project.Data.Text.Span.Span
import project.Data.Text.Span.Utf_16_Span
import project.Data.Text.Text

View File

@ -2,56 +2,56 @@ from Standard.Base import all
## PRIVATE
type Named_Pattern
## Matches one or more whitespace characters at the beginning of a string.
Leading_Whitespace
## Matches one or more whitespace characters at the beginning of a string.
Leading_Whitespace
## Matches one or more whitespace characters at the end of a string.
Trailing_Whitespace
## Matches one or more whitespace characters at the end of a string.
Trailing_Whitespace
## Matches one or more whitespace characters that are preceded by another whitespace character.
Duplicate_Whitespace
## Matches one or more whitespace characters that are preceded by another whitespace character.
Duplicate_Whitespace
## Matches one or more whitespace characters anywhere in a string.
All_Whitespace
## Matches one or more whitespace characters anywhere in a string.
All_Whitespace
## Matches one or more digits at the beginning of a string.
Leading_Numbers
## Matches one or more digits at the beginning of a string.
Leading_Numbers
## Matches one or more digits at the end of a string.
Trailing_Numbers
## Matches one or more digits at the end of a string.
Trailing_Numbers
## Matches any character that is not in the ASCII range (0x00-0x7F).
Non_ASCII
## Matches any character that is not in the ASCII range (0x00-0x7F).
Non_ASCII
## Matches a tab character.
Tabs
## Matches a tab character.
Tabs
## Matches any single alphabetic character (both lowercase and uppercase).
Letters
## Matches any single alphabetic character (both lowercase and uppercase).
Letters
## Matches any single digit.
Numbers
## Matches any single digit.
Numbers
## Matches any single punctuation character from the set: comma, period, exclamation mark, question mark, colon, semicolon, single quote, double quote, parenthesis.
Punctuation
## Matches any single punctuation character from the set: comma, period, exclamation mark, question mark, colon, semicolon, single quote, double quote, parenthesis.
Punctuation
## Matches any single character that is not an alphabetic character, digit, or whitespace.
Symbols
## Matches any single character that is not an alphabetic character, digit, or whitespace.
Symbols
## PRIVATE
regex_pattern self = case self of
Named_Pattern.Leading_Whitespace -> "^\s+"
Named_Pattern.Trailing_Whitespace -> "\s+$"
Named_Pattern.Duplicate_Whitespace -> "(?<=\s)\s+"
Named_Pattern.All_Whitespace -> "\s+"
Named_Pattern.Leading_Numbers -> "^\d+"
Named_Pattern.Trailing_Numbers -> "\d+$"
Named_Pattern.Non_ASCII -> "[^\x00-\x7F]"
Named_Pattern.Tabs -> "\t"
Named_Pattern.Letters -> "[a-zA-Z]"
Named_Pattern.Numbers -> "\d"
Named_Pattern.Punctuation -> '[,.!?():;\'\"]'
Named_Pattern.Symbols -> "[^a-zA-Z\d\s]"
## PRIVATE
regex_pattern self = case self of
Named_Pattern.Leading_Whitespace -> "^\s+"
Named_Pattern.Trailing_Whitespace -> "\s+$"
Named_Pattern.Duplicate_Whitespace -> "(?<=\s)\s+"
Named_Pattern.All_Whitespace -> "\s+"
Named_Pattern.Leading_Numbers -> "^\d+"
Named_Pattern.Trailing_Numbers -> "\d+$"
Named_Pattern.Non_ASCII -> "[^\x00-\x7F]"
Named_Pattern.Tabs -> "\t"
Named_Pattern.Letters -> "[a-zA-Z]"
Named_Pattern.Numbers -> "\d"
Named_Pattern.Punctuation -> '[,.!?():;\'\"]'
Named_Pattern.Symbols -> "[^a-zA-Z\d\s]"
## PRIVATE
Regex.from (that:Named_Pattern) = Regex.compile that.regex_pattern

View File

@ -3,12 +3,12 @@ from Standard.Base import all
## PRIVATE
Defines a Text_Cleanse operation
type Text_Cleanse
## PRIVATE
Value named_pattern:Named_Pattern
## Apply the cleanse operation to the text.
apply self input:Cleansable_Text -> Any =
input.replace self.named_pattern.regex_pattern ""
## PRIVATE
Value named_pattern:Named_Pattern
## Apply the cleanse operation to the text.
apply self input:Cleansable_Text -> Any =
input.replace self.named_pattern.regex_pattern ""
## PRIVATE
Defines the interface for cleansable object.

View File

@ -671,7 +671,7 @@ type Vector a
- on_problems: Specifies how to handle any problems that arise in
`function`.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on
`on_problems`:
@ -710,7 +710,7 @@ type Vector a
- on_problems: Specifies how to handle any problems that arise in
`function`.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on
`on_problems`:
@ -764,7 +764,7 @@ type Vector a
The function is called with both the element index as well as the
element itself.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on
`on_problems`:
@ -1006,7 +1006,7 @@ type Vector a
The result of this function is a `Vector` of length being the shorter of
`self` and `that`, containing results of calling `function`.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on
`on_problems`:

View File

@ -71,7 +71,7 @@ slice vector start end = @Builtin_Method "Array_Like_Helpers.slice"
After that, the warnings are dropped, but a count of the additional
warnings is attached in an `Additional_Warnings` warning.
? Problem Handling
! Error Conditions
The result of Errors thrown when executing the function depend on `on_problems`:
- Report_Error: The first error is thrown, and is wrapped in

View File

@ -278,7 +278,7 @@ type DB_Column
Returns a column with results of comparing this column's elements against
`other`.
! Warnings
! Error Conditions
- If this operation results in comparing floating-point values for
equality which is not recommended, a `Floating_Point_Equality`
@ -335,7 +335,7 @@ type DB_Column
Returns a column with results of comparing this column's elements against
`other`.
! Warnings
! Error Conditions
- If this operation results in comparing floating-point values for
equality which is not recommended, a `Floating_Point_Equality`
@ -536,7 +536,7 @@ type DB_Column
Returns a column containing the result of dividing each element of `self`
by `other`.
! Warnings
! Error Conditions
- If division by zero occurs, an `Arithmetic_Error` warning is attached
to the result.
@ -581,7 +581,7 @@ type DB_Column
Returns a column with results of modulus this column's elements against
`other`.
! Warnings
! Error Conditions
- If division by zero occurs, an `Arithmetic_Error` warning is attached
to the result.

View File

@ -135,7 +135,7 @@ type DB_Table
Arguments:
- selector: The name or index of the column to get.
@selector Widget_Helpers.make_column_name_selector
at : Text | Integer -> DB_Column ! No_Such_Column | Index_Out_Of_Bounds
at : Integer | Text -> DB_Column ! No_Such_Column | Index_Out_Of_Bounds
at self (selector:(Integer | Text)=0) = case selector of
_ : Integer -> self.make_column (self.internal_columns.at selector)
_ -> self.get selector (Error.throw (No_Such_Column.Error selector))
@ -147,7 +147,7 @@ type DB_Table
- selector: The name or index of the column being looked up.
- if_missing: The value to use if the selector isn't present.
@selector Widget_Helpers.make_column_name_selector
get : Text | Integer -> Any -> DB_Column | Any
get : Integer | Text -> Any -> DB_Column | Any
get self (selector:(Integer | Text)=0) ~if_missing=Nothing =
internal_column = case selector of
_ : Integer -> self.internal_columns.get selector if_missing=Nothing
@ -1759,7 +1759,7 @@ type DB_Table
Finally, if no common type is found using the rules above, everything
is converted to text.
? Problem Conditions
! Error Conditions
- If no common type is found and the text conversion fallback is used,
the `No_Common_Type` problem is reported.

View File

@ -190,7 +190,7 @@ type Column
Returns a column with results of comparing this column's elements against
`other`.
! Warnings
! Error Conditions
- If this operation results in comparing floating-point values for
equality which is not recommended, a `Floating_Point_Equality`
@ -258,7 +258,7 @@ type Column
Returns a column with results of comparing this column's elements against
`other`.
! Warnings
! Error Conditions
- If this operation results in comparing floating-point values for
equality which is not recommended, a `Floating_Point_Equality`
@ -577,7 +577,7 @@ type Column
Returns a column containing the result of dividing each element of `self`
by `other`.
! Warnings
! Error Conditions
- If division by zero occurs, an `Arithmetic_Error` warning is attached
to the result.
@ -623,7 +623,7 @@ type Column
Returns a column with results of modulus this column's elements against
`other`.
! Warnings
! Error Conditions
- If division by zero occurs, an `Arithmetic_Error` warning is attached
to the result.
@ -2341,6 +2341,28 @@ type Column
Arguments:
- range: The selection of rows from the table to return.
Returns:
A new Column containing the selected rows.
! Error Conditions
- If the range is out of bounds, an `Index_Out_Of_Bounds` error is raised.
> Example
Select the first row from the "Name" Column.
table = Table.new [["Name", ["Alice", "Bob", "Charlie"]]]
column = table.get "Name"
## The take returns "Alice"
first_row = column.take (First 1)
> Example
Select the last row from the "Name" Column.
table = Table.new [["Name", ["Alice", "Bob", "Charlie"]]]
column = table.get "Name"
## The take returns "Charlie"
last_row = column.take (Last 1)
@range Index_Sub_Range.default_widget
take : (Index_Sub_Range | Range | Integer) -> Column
take self range=(First 1) =

View File

@ -57,7 +57,7 @@ make_aggregate_column_selector table display=Display.Always =
maximum = Option "Maximum" fqn+".Maximum" [column_widget]
minimum = Option "Minimum" fqn+".Minimum" [column_widget]
Single_Choice display=display values=[count, count_distinct, first, last, count_not_nothing, count_nothing, count_not_empty, count_empty, concatenate, shortest, longest, sum, average, median, percentile, mode, standard_deviation, maximum, minimum]
Single_Choice display=display values=[count, sum, average, count_distinct, first, last, count_not_nothing, count_nothing, count_not_empty, count_empty, concatenate, shortest, longest, median, percentile, mode, standard_deviation, maximum, minimum]
## PRIVATE
Make an Aggregate_Column list editor

View File

@ -244,7 +244,7 @@ type Table
example_at = Examples.inventory_table.at -1
@selector Widget_Helpers.make_column_name_selector
at : Text | Integer -> Column ! No_Such_Column | Index_Out_Of_Bounds
at : Integer | Text -> Column ! No_Such_Column | Index_Out_Of_Bounds
at self (selector:(Integer | Text)=0) = case selector of
_ : Integer ->
java_columns = Vector.from_polyglot_array self.java_table.getColumns
@ -272,7 +272,7 @@ type Table
example_at = Examples.inventory_table.get -1
@selector Widget_Helpers.make_column_name_selector
get : Text | Integer -> Any -> Column | Any
get : Integer | Text -> Any -> Column | Any
get self (selector:(Integer | Text)=0) ~if_missing=Nothing =
java_column = case selector of
_ : Integer -> Vector.from_polyglot_array self.java_table.getColumns . get selector
@ -2286,7 +2286,7 @@ type Table
Finally, if no common type is found using the rules above, everything
is converted to text.
? Problem Conditions
! Error Conditions
- If no common type is found and the text conversion fallback is used,
the `No_Common_Type` problem is reported.
@ -2984,7 +2984,7 @@ type Table
Finally, if no common type is found using the rules above, everything
is converted to text.
? Problem Conditions
! Error Conditions
- If no common type is found and the text conversion fallback is used,
the `No_Common_Type` problem is reported.