Align headers in doc comments... (#10025)

- Always use `Arguments:` for parameters or fields.
- Always use `> Example` for examples.
- Align sections behind `!` or `?` headers.
- Whitespace fixes.
This commit is contained in:
James Dunkerley 2024-05-21 20:44:58 +01:00 committed by GitHub
parent 1633965173
commit 2677e556e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 245 additions and 243 deletions

View File

@ -453,7 +453,7 @@ type Any
GROUP Operators
Applies the function on the right hand side to the argument on the left.
Arguments
Arguments:
- function: The function to apply to `self`.
? `|>` or `.`?

View File

@ -88,7 +88,6 @@ type Array
By default, elements are sorted in ascending order.
This is a stable sort, meaning that items that compare the same will not
have their order changed by the sorting process.

View File

@ -1117,7 +1117,7 @@ type Integer
Bitwise and computes the logical conjunction of the corresponding pairs
of bits in the operands.
? Example
> Example
Computing the bitwise conjunction of 2_01101101 and 2_11110000.
2_01101101.bit_and 2_11110000

View File

@ -14,99 +14,99 @@ from project.Data.Boolean import Boolean, False, True
## Provides custom ordering, equality check and hash code for types that need it.
The Enso runtime system offers default implementation of _equality_
as well as capability to _compute hash code_ (e.g. for use in `Map`) automatically.
The default implementation is sufficient for most of the programming activities.
Especially when defining new type and its constructors, they get sensible
implementation of both functions.
The Enso runtime system offers default implementation of _equality_
as well as capability to _compute hash code_ (e.g. for use in `Map`) automatically.
The default implementation is sufficient for most of the programming activities.
Especially when defining new type and its constructors, they get sensible
implementation of both functions.
Should there be a need to redefine the default implementation, here is a way:
Define conversion function `Comparable.from` for your `type` and return pointer to
another `type` that satisfies the following definition:
Should there be a need to redefine the default implementation, here is a way:
Define conversion function `Comparable.from` for your `type` and return pointer to
another `type` that satisfies the following definition:
```
type Comparator T
compare : T -> T -> (Ordering|Nothing)
hash : T -> Integer
```
```
type Comparator T
compare : T -> T -> (Ordering|Nothing)
hash : T -> Integer
```
Every type must provide exactly one comparator, i.e., the method of form
`Comparable.from (_:My_Type)` must return the same comparator type for every
value. Note that there is an implicit `Default_Comparator` assigned for every
type by default.
Every type must provide exactly one comparator, i.e., the method of form
`Comparable.from (_:My_Type)` must return the same comparator type for every
value. Note that there is an implicit `Default_Comparator` assigned for every
type by default.
A comparator has to implement `compare` and `hash` methods. `compare x y` method
returns `Ordering.Less` if x is ordered before y, `Ordering.Equal` if x is equal
to y, `Ordering.Greater` if x is ordered after y, and `Nothing` if x and y are
not equal, and their relative ordering cannot be determined.
A comparator has to implement `compare` and `hash` methods. `compare x y` method
returns `Ordering.Less` if x is ordered before y, `Ordering.Equal` if x is equal
to y, `Ordering.Greater` if x is ordered after y, and `Nothing` if x and y are
not equal, and their relative ordering cannot be determined.
The signature of the `compare` method is designed so that it enables comparators
to provide a _partial ordering_ for a specific type.
The signature of the `compare` method is designed so that it enables comparators
to provide a _partial ordering_ for a specific type.
A hash code must be provided for all the objects, therefore, the type signature
of `hash` method does not allow `Nothing` as a return value.
A hash code must be provided for all the objects, therefore, the type signature
of `hash` method does not allow `Nothing` as a return value.
The runtime expects the following semantics for all the comparators:
- Hash consistency:
- If x == y then hash(x) == hash(y)
- If hash(x) != hash(y) then x != y
- Consistency: if x == y then x == y for all the subsequent invocations.
- Symmetry: if x == y then y == x
- Reflexivity: x == x
- Transitivity: if x < y and y < z then x < z
- Antisymmetry: if x > y then y < x
The runtime expects the following semantics for all the comparators:
- Hash consistency:
- If x == y then hash(x) == hash(y)
- If hash(x) != hash(y) then x != y
- Consistency: if x == y then x == y for all the subsequent invocations.
- Symmetry: if x == y then y == x
- Reflexivity: x == x
- Transitivity: if x < y and y < z then x < z
- Antisymmetry: if x > y then y < x
Users are responsible for the compliance to the aforementioned semantics.
Should the semantics be violated, an unexpected behavior may be encountered, e.g.,
`Array.sort` may return unexpected results or fail with `Incomparable_Values`.
Users are responsible for the compliance to the aforementioned semantics.
Should the semantics be violated, an unexpected behavior may be encountered, e.g.,
`Array.sort` may return unexpected results or fail with `Incomparable_Values`.
> Example
Comparator for an unordered Pair `UPair`. In this example, we can see an
implementation of the `hash` method that delegates to hash methods of
fields.
> Example
Comparator for an unordered Pair `UPair`. In this example, we can see an
implementation of the `hash` method that delegates to hash methods of
fields.
```
type UPair
Value x y
```
type UPair
Value x y
type UPair_Comparator
compare pair1 pair2 =
if pair1.x == pair2.x && pair1.y == pair2.y then Ordering.Equal else
if pair1.x == pair2.y && pair1.y == pair2.x then Ordering.Equal else
Nothing
type UPair_Comparator
compare pair1 pair2 =
if pair1.x == pair2.x && pair1.y == pair2.y then Ordering.Equal else
if pair1.x == pair2.y && pair1.y == pair2.x then Ordering.Equal else
Nothing
hash upair =
x_comp = Comparable.from upair.x
y_comp = Comparable.from upair.y
(x_comp.hash upair.x) + (y_comp.hash upair.y)
hash upair =
x_comp = Comparable.from upair.x
y_comp = Comparable.from upair.y
(x_comp.hash upair.x) + (y_comp.hash upair.y)
Comparable.from (_ : UPair) = UPair_Comparator
```
Comparable.from (_ : UPair) = UPair_Comparator
```
> Example
Representation of _rational numbers_ as a pair of integers needs a
special equality. Here is a way to define it:
> Example
Representation of _rational numbers_ as a pair of integers needs a
special equality. Here is a way to define it:
```
type Rational
Fraction (numerator:Integer) (denominator:Integer)
```
type Rational
Fraction (numerator:Integer) (denominator:Integer)
Comparable.from (_:Rational) = Rational_Ordering
Comparable.from (_:Rational) = Rational_Ordering
type Rational_Ordering
compare self r1 r2 =
v1 = r1.numerator * r2.denominator
v2 = r2.numerator * r1.denominator
if v1 < v2 then Ordering.Less else
if v1 > v2 then Ordering.Greater else
Ordering.Equal
hash self r1 = 42 # or something better
```
type Rational_Ordering
compare self r1 r2 =
v1 = r1.numerator * r2.denominator
v2 = r2.numerator * r1.denominator
if v1 < v2 then Ordering.Less else
if v1 > v2 then Ordering.Greater else
Ordering.Equal
hash self r1 = 42 # or something better
```
By defining the `Rational_Ordering` and making it available via
`Comparable.from (_:Rational)` method, all parts of the Enso system will use
the custom comparator whenever equality or hash code is needed.
By defining the `Rational_Ordering` and making it available via
`Comparable.from (_:Rational)` method, all parts of the Enso system will use
the custom comparator whenever equality or hash code is needed.
@Builtin_Type
type Comparable
## PRIVATE

View File

@ -325,7 +325,7 @@ Text.match self pattern=".*" case_sensitivity=Case_Sensitivity.Sensitive =
ICON text
Compile the text into a regex pattern that can be used for matching.
Arguments
Arguments:
- case_insensitive: Enables or disables case-insensitive matching. Case
insensitive matching behaves as if it normalises the case of all input
text before matching on it.
@ -1021,7 +1021,7 @@ Text.repeat self count=1 =
Returns:
The part of the input as specified by the range parameter.
> Examples
> Example
Various different ways to take part of "Hello World!"
"Hello World!".take First == "H"
@ -1070,7 +1070,7 @@ Text.take self range=(Index_Sub_Range.First 1) =
Returns:
The part of the input as specified by the range parameter.
> Examples
> Example
Various different ways to take part of "Hello World!"
"Hello World!".drop First == "ello World!"
@ -1885,7 +1885,7 @@ Text.parse_time_zone self = Time_Zone.parse self
Returns:
Part of the selected Text starting at start and stopping after length.
> Examples
> Example
Various different ways to take part of "Hello World!"
"Hello World!".substring 3 2 == "lo"

View File

@ -39,7 +39,7 @@ type Regex
Compile the provided `expression` into a `Regex` that can be used for
matching.
Arguments
Arguments:
- expression: The text representing the regular expression that you want to
compile. Must be non-empty.
- case_insensitive: Enables or disables case-insensitive matching. Case
@ -360,7 +360,7 @@ type Regex
Return a lazy iterator over matches against a string.
Arguments
Arguments:
- text: the string to match against.
iterator : Text -> Match_Iterator
iterator self input = Match_Iterator.new self input
@ -496,7 +496,7 @@ type Regex_Syntax_Error
If an empty regex is used, throws an Illegal_Argument error.
Arguments
Arguments:
- expression: The text representing the regular expression that you want to
compile. Must be non-empty.
regex : Text -> Regex ! Regex_Syntax_Error | Illegal_Argument

View File

@ -36,7 +36,7 @@ type Replacer
## PRIVATE
Creates a new Replacer.
Arguments
Arguments:
- replacement_string: a string, possibly containing group references,
that will be used to provide a replacement in a regex match.
new : Text -> Regex -> Replacer ! No_Such_Group

View File

@ -38,7 +38,7 @@ polyglot java import org.enso.base.Time_Utils
## PRIVATE
Constructs a new Date from a year, month, and day.
Arguments
Arguments:
- year: The year to represent.
- month: The month-of-year to represent, from 1 (January) to 12 (December).
- day: The day-of-month to represent, from 1 to 31. It must be valid for the
@ -75,7 +75,7 @@ type Date
ICON date_and_time
Constructs a new Date from a year, month, and day.
Arguments
Arguments:
- year: The year to represent.
- month: The month-of-year to represent, from 1 (January) to 12 (December).
- day: The day-of-month to represent, from 1 to 31. It must be valid for the

View File

@ -87,16 +87,16 @@ type Date_Time
## ICON date_and_time
Obtains the start of the epoch for Enso.
? Start of the epoch
For Enso, start of the epoch is equal to the start of the Gregorian calendar,
which is on 15th October 1582.
? Start of the epoch
For Enso, start of the epoch is equal to the start of the Gregorian calendar,
which is on 15th October 1582.
Invoking some Gregorian calendar related functionalities, like `is_leap_year`,
is computed for all the date times, including those before an epoch start,
with today's rules. Trying to get some Gregorian calendar related properties
for a historical date times that is defined before the epoch is likely an error,
as the Gregorian calendar had not yet been introduced. Therefore, for such
historical date times, a warning is attached to the result.
Invoking some Gregorian calendar related functionalities, like `is_leap_year`,
is computed for all the date times, including those before an epoch start,
with today's rules. Trying to get some Gregorian calendar related properties
for a historical date times that is defined before the epoch is likely an error,
as the Gregorian calendar had not yet been introduced. Therefore, for such
historical date times, a warning is attached to the result.
enso_epoch_start : Date_Time
enso_epoch_start = @Builtin_Method "Date_Time.epoch_start"

View File

@ -41,7 +41,8 @@ type Date_Time_Formatter
Pattern characters are interpreted case insensitively, with the exception
of `M/m' and 'H/h'.
Date pattern characters:
? Date pattern characters
- y: Year. The number of pattern letters determines the minimum number of
digits.
- y: The year using any number of digits.
@ -69,7 +70,8 @@ type Date_Time_Formatter
If only year and quarter are provided in the pattern, when parsing a
date, the result will be the first day of that quarter.
Time pattern characters:
? Time pattern characters
- H: 24h hour of day (0-23).
- h: 12h hour of day (0-12). The `a` pattern is needed to disambiguate
between AM and PM.
@ -80,7 +82,8 @@ type Date_Time_Formatter
digits will be accepted.
- a: AM/PM marker.
Time zone pattern characters:
? Time zone pattern characters
- T: If repeated 3 or less times - Time zone ID (e.g. Europe/Warsaw, Z,
-08:30), otherwise - Time zone name (e.g. Central European Time, CET).
- Z: Zone offset.

View File

@ -34,18 +34,18 @@ from project.Runtime import assert
polyglot java import java.lang.IndexOutOfBoundsException
## The basic, immutable, vector type.
A vector allows to store an arbitrary number of elements, in linear memory.
It is the recommended data structure for most applications.
## The basic, immutable, vector type.
A vector allows to store an arbitrary number of elements, in linear memory.
It is the recommended data structure for most applications.
> Example
A vector containing the elements `1`, `2`, and `3`, in this order is:
[1, 2, 3]
> Example
A vector containing the elements `1`, `2`, and `3`, in this order is:
[1, 2, 3]
> Example
A vector containing 50 elements, each being the number `42`, can be
created by:
Vector.fill length=50 item=42
> Example
A vector containing 50 elements, each being the number `42`, can be
created by:
Vector.fill length=50 item=42
@Builtin_Type
type Vector a
@ -1121,7 +1121,6 @@ type Vector a
By default, elements are sorted in ascending order.
This is a stable sort, meaning that items that compare the same will not
have their order changed by the sorting process.

View File

@ -103,12 +103,12 @@ type Data_Link
source.underlying.delete . if_not_error target.underlying
## PRIVATE
Reads the raw configuration data of a data-link, as plain text.
Reads the raw configuration data of a data-link, as plain text.
This is should mostly be used for testing, `read_config` is preferred for normal use.
This is should mostly be used for testing, `read_config` is preferred for normal use.
Arguments:
- file: The file to read the configuration from.
Arguments:
- file: The file to read the configuration from.
read_raw_config (file : File_Like) -> Text =
if Data_Link.is_data_link file . not then
Panic.throw (Illegal_Argument.Error " Data_Link should only be used for reading config of Data Links, but "+file.to_display_text+" is not a Data Link.")

View File

@ -20,7 +20,7 @@ type Enso_User
## PRIVATE
Represents a user within Enso Cloud.
Fields:
Arguments:
- name: The user's name.
- email: The user's email address.
- id: The user's unique ID.

View File

@ -16,7 +16,7 @@ from project.Internal.Time.Format.Parser import all
type Analyzer
## PRIVATE
Fields:
Arguments:
- nodes: The raw list of nodes as returned from the parser.
- flattened: The list of nodes after flattening the optional sections and
removing literals - so it just contains raw patterns.

View File

@ -27,7 +27,7 @@ type File_Action
type Choice
## Describes an entry in a Single_Choice or Multiple_Choice widget.
Fields:
Arguments:
- label: The text to display for the entry.
- value: The code to insert for the entry. By default, the `label` is used.
- parameters: A list of parameters for the arguments for the `value`.
@ -38,7 +38,7 @@ type Choice
type Widget
## Describes a single value widget (dropdown).
Fields:
Arguments:
- values: A list of choices to display.
- label: The placeholder text value.
By default, the parameter name is used.
@ -49,7 +49,7 @@ type Widget
## Describes a list editor widget producing a Vector.
Items can be dragged around to change the order, or dragged out to be deleted from the Vector.
Fields:
Arguments:
- item_editor: The widget to use for editing the items.
- item_default: The default value for new items inserted when the user clicks the `+` button.
- label: The placeholder text value.

View File

@ -200,18 +200,18 @@ type Request
## ICON edit
Set the body for the request.
Arguments:
- new_body: The body to insert into the request.
Arguments:
- new_body: The body to insert into the request.
> Example
Unsetting the body in a post request.
> Example
Unsetting the body in a post request.
import Standard.Base.Network.HTTP.Request.Request
import Standard.Base.Network.HTTP.Request_Body.Request_Body
import Standard.Base.Network.URI.URI
import Standard.Base.Network.HTTP.Request.Request
import Standard.Base.Network.HTTP.Request_Body.Request_Body
import Standard.Base.Network.URI.URI
example_with_body =
Request.post (URI.parse "http://example.com") Request_Body.Empty |> _.with_body Request_Body.Empty
example_with_body =
Request.post (URI.parse "http://example.com") Request_Body.Empty |> _.with_body Request_Body.Empty
with_body : Request_Body -> Request
with_body self new_body = Request.Value self.method self.uri self.headers new_body

View File

@ -182,7 +182,7 @@ type Response
- file: The file to write the body to.
- on_existing_file: Specifies how to proceed if the file already exists.
> Examples
> Example
Write the contents of the request body to a scratch file on disk. The
file will be created if it does not exist, and will be overwritten if
it does.

View File

@ -193,7 +193,7 @@ type Response_Body
- file: The file to write the body to.
- on_existing_file: Specifies how to proceed if the file already exists.
> Examples
> Example
Write the contents of the request body to a scratch file on disk. The
file will be created if it does not exist, and will be overwritten if
it does.

View File

@ -47,13 +47,13 @@ type Polyglot
ADVANCED
Performs a by-name lookup for a member in a polyglot object.
Arguments:
- object: The polyglot object on which to perform the member lookup.
- member_name: The textual name of the member to lookup.
Arguments:
- object: The polyglot object on which to perform the member lookup.
- member_name: The textual name of the member to lookup.
> Example
Look up the field a on an object o.
Polyglot.get_member o "a"
> Example
Look up the field a on an object o.
Polyglot.get_member o "a"
get_member : Any -> Text -> Any
get_member object member_name = @Builtin_Method "Polyglot.get_member"
@ -61,12 +61,12 @@ type Polyglot
ADVANCED
Returns a polyglot array of all of the members of the provided object.
Arguments:
- object: The object from which to get a list of member names.
Arguments:
- object: The object from which to get a list of member names.
> Example
Get a list of the fields for an object o.
Polyglot.get_members o
> Example
Get a list of the fields for an object o.
Polyglot.get_members o
get_members : Any -> Array
get_members object = @Builtin_Method "Polyglot.get_members"
@ -74,14 +74,14 @@ type Polyglot
ADVANCED
Instantiates a polyglot object using the provided constructor.
Arguments:
- constructor: The constructor with which to instantiate the object.
- arguments: A vector of the arguments to pass to the polyglot
constructor.
Arguments:
- constructor: The constructor with which to instantiate the object.
- arguments: A vector of the arguments to pass to the polyglot
constructor.
> Example
Instantiate a new Java Integer with the value 1.
Polyglot.new Integer [1]
> Example
Instantiate a new Java Integer with the value 1.
Polyglot.new Integer [1]
new : Any -> Vector -> Any
new constructor arguments = @Builtin_Method "Polyglot.new"
@ -89,10 +89,10 @@ type Polyglot
ADVANCED
Invokes a method on a polyglot object by name.
Arguments:
- target: The polyglot object on which to call the method.
- name: The name of the method.
- arguments: The arguments to pass to the method given by name.
Arguments:
- target: The polyglot object on which to call the method.
- name: The name of the method.
- arguments: The arguments to pass to the method given by name.
invoke : Any -> Text -> Vector -> Any
invoke target name arguments = @Builtin_Method "Polyglot.invoke"

View File

@ -53,8 +53,8 @@ type Ref
Arguments:
- fun: the function to transform the value in the ref
> Example
Increment the integer stored in a ref, and receive the old value.
> Example
Increment the integer stored in a ref, and receive the old value.
(Ref.new 10) . modify (_+1)
# => 10

View File

@ -24,7 +24,7 @@ type File_By_Line
## ICON data_input
Creates a new File_By_Line object.
Arguments
Arguments:
- file: The file to read.
- encoding: The encoding to use when reading the file (defaults to UTF 8).
- offset: The position within the file to read from (defaults to first byte).
@ -40,7 +40,7 @@ type File_By_Line
## PRIVATE
Creates a new File_By_Line object.
Arguments
Arguments:
- file: The file to read.
- encoding: The encoding to use when reading the file (defaults to UTF 8).
- limit_lines: The number of lines to read (defaults to all lines).
@ -53,7 +53,7 @@ type File_By_Line
ICON parse3
Reads a specific line from the file.
Arguments
Arguments:
- line: The line to read (0 indexed).
get : Integer -> Text
get self line:Integer = if self.limit_lines.is_nothing.not && line>self.limit_lines then Error.throw (Index_Out_Of_Bounds.Error line self.limit_lines) else
@ -93,7 +93,7 @@ type File_By_Line
## ICON parse3
Performs an action on each line.
Arguments
Arguments:
- function: The action to perform on each line.
each : (Text -> Any) -> Nothing
each self function =
@ -116,7 +116,7 @@ type File_By_Line
## ICON dataframe_map_column
Transforms each line in the file and returns the result as a vector.
Arguments
Arguments:
- action: The action to perform on each line.
map : (Text -> Any) -> Vector Any
map self action =
@ -127,7 +127,7 @@ type File_By_Line
## ICON dataframe_map_column
Transforms each line in the file and returns the result as a vector.
Arguments
Arguments:
- action: The action to perform on each line.
map_with_index : (Integer -> Text -> Any) -> Vector Any
map_with_index self action =
@ -139,7 +139,7 @@ type File_By_Line
ICON select_row
Skips the specified number of lines.
Arguments
Arguments:
- lines: The number of lines to skip.
skip : Integer -> File_By_Line
skip self lines:Integer =
@ -159,7 +159,7 @@ type File_By_Line
ICON parse3
Limits a file to a specific number of lines.
Arguments
Arguments:
- lines: The number of lines to limit the file to.
limit : Integer -> File_By_Line
limit self lines:Integer =
@ -169,7 +169,7 @@ type File_By_Line
ICON preparation
Filters the file by a predicate.
Arguments
Arguments:
- predicate: The predicate to filter by.
filter : Text | (Text -> Boolean) -> File_By_Line
filter self predicate =

View File

@ -30,7 +30,7 @@ type Process_Builder
Arguments:
- arguments: The arguments to pass to the process.
> Examples
> Example
Set the arguments to the process using a builder.
import Standard.Base.System.Process
@ -48,7 +48,7 @@ type Process_Builder
Arguments:
- stdin: The standard input contents to pass to the process.
> Examples
> Example
Set the standard input to a process using a builder.
import Standard.Base.System.Process

View File

@ -9,7 +9,7 @@ type Column_Constraint
## ADVANCED
Specifies a default value for the column.
Argument:
Arguments:
- `sql_expression`: The SQL expression to use as the default value. Note that this is a raw SQL expression, so if you want to set a default to a string, you must include the quotes. The quoting style may depend on the database. Never pass unsanitized data to this parameter.
! SQL Injection

View File

@ -12,7 +12,7 @@ type Client_Certificate
## PRIVATE
Creates the JDBC properties for the client certificate.
JDBC Properties:
? JDBC Properties
- sslcert: points to the client certificate file.
- sslkey: points to the client key file.
- sslpass: password for the client key file.

View File

@ -879,7 +879,7 @@ type DB_Table
Specifically, applying further filters will still apply to the whole
result set and the limit will be taken after applying these filters.
> For example:
> Example
In the call below, assuming that the table of `t1` contains rows for
numbers 1, 2, ..., 10, will return rows starting from 6 and not an empty
result as one could expect if the limit was applied before the filters.
@ -2387,11 +2387,11 @@ type DB_Table
ICON split_text
Expand a column of objects to a new set of columns.
Arguments:
- column: The column to expand.
- fields: The set fields to expand. If `Nothing` then all fields are added.
- prefix: Prefix to add to the column names. If `Nothing` then the column
name is used.
Arguments:
- column: The column to expand.
- fields: The set fields to expand. If `Nothing` then all fields are added.
- prefix: Prefix to add to the column names. If `Nothing` then the column
name is used.
@column Widget_Helpers.make_column_name_selector
expand_column : Text | Integer -> Vector | Nothing -> Text | DB_Table -> DB_Table ! Type_Error
expand_column self column fields=Nothing prefix=Nothing =
@ -2886,28 +2886,28 @@ type DB_Table
ICON dataframe_map_column
Applies the specified cleansings to the text in each row of the specified columns
Arguments:
- remove: A vector of the text cleanings to remove from the text. The text cleansings are
applied in the order they are provided. The same text cleansing can be used multiple
times. The text cleansings are:
- ..Leading_Whitespace: Removes all whitspace from the start of the string.
- ..Trailing_Whitespace: Removes all whitspace from the end of the string.
- ..Duplicate_Whitespace: Removes all duplicate whitspace from the string replacing it with the first whitespace character of the duplicated block.
- ..All_Whitespace: Removes all whitspace from the string.
- ..Leading_Numbers: Removes all numbers from the start of the string.
- ..Trailing_Numbers: Removes all numbers from the end of the string.
- ..Non_ASCII: Removes all non-ascii characters from the string.
- ..Tabs: Removes all tab characters from the string.
- ..Letters: Removes all letters from the string.
- ..Numbers: Removes all numbers characters from the string.
- ..Punctuation: Removes all characters in the set ,.!?():;'" from the string.
- ..Symbols: Removes anything that isn't letters, numbers or whitespace from the string.
- from: The column(s) to cleanse.
Arguments:
- remove: A vector of the text cleanings to remove from the text. The text cleansings are
applied in the order they are provided. The same text cleansing can be used multiple
times. The text cleansings are:
- ..Leading_Whitespace: Removes all whitspace from the start of the string.
- ..Trailing_Whitespace: Removes all whitspace from the end of the string.
- ..Duplicate_Whitespace: Removes all duplicate whitspace from the string replacing it with the first whitespace character of the duplicated block.
- ..All_Whitespace: Removes all whitspace from the string.
- ..Leading_Numbers: Removes all numbers from the start of the string.
- ..Trailing_Numbers: Removes all numbers from the end of the string.
- ..Non_ASCII: Removes all non-ascii characters from the string.
- ..Tabs: Removes all tab characters from the string.
- ..Letters: Removes all letters from the string.
- ..Numbers: Removes all numbers characters from the string.
- ..Punctuation: Removes all characters in the set ,.!?():;'" from the string.
- ..Symbols: Removes anything that isn't letters, numbers or whitespace from the string.
- from: The column(s) to cleanse.
> Example
Remove leading and trailing spaces from cells.
> Example
Remove leading and trailing spaces from cells.
table.text_cleanse [..Leading_Whitespace, ..Trailing_Whitespace]
table.text_cleanse [..Leading_Whitespace, ..Trailing_Whitespace]
@remove make_data_cleanse_vector_selector
@from (Widget_Helpers.make_column_name_multi_selector add_regex=True)
text_cleanse : Vector Text_Cleanse -> Vector (Integer | Text | Regex) -> DB_Table

View File

@ -53,7 +53,7 @@ type Context
their columns come and set filters and other settings for processing the
query.
Arguments:
Arguments:
- from_spec: the sources for the query, see `From_Spec` for more
details.
- where_filters: a list of expressions for filtering - only the rows
@ -138,7 +138,7 @@ type Context
## PRIVATE
Returns a copy of the context with changed `distinct_on` expressions.
Returns a copy of the context with changed `distinct_on` expressions.
set_distinct_on : (Nothing | Vector SQL_Expression) -> Context
set_distinct_on self new_distinct_on =
Context.Value self.from_spec self.where_filters self.orders self.groups self.limit new_distinct_on

View File

@ -311,22 +311,22 @@ type Matrix
combined with the appropriate value (the element with the same row and
column) of this matrix.
> Example
Divide each channel of the matrix by 2.
> Example
Divide each channel of the matrix by 2.
import Standard.Examples
example_div = Examples.matrix / 2
> Example
Divide first channel of the matrix by 2, and second channel by 4.
> Example
Divide first channel of the matrix by 2, and second channel by 4.
import Standard.Examples
example_div = Examples.matrix / [2, 4, 1, 1]
> Example
Divide two matrices.
> Example
Divide two matrices.
import Standard.Examples

View File

@ -147,12 +147,12 @@ type Excel_Format
- If `Excel_Section.Cell_Range`, the `table` will be written to the
specified range.
Arguments:
- file: The file to write to.
- table: The table to write.
- on_existing_file: What to do if the file already exists.
- match_columns: How to match columns between the table and the file.
- on_problems: What to do if there are problems reading the file.
Arguments:
- file: The file to write to.
- table: The table to write.
- on_existing_file: What to do if the file already exists.
- match_columns: How to match columns between the table and the file.
- on_problems: What to do if there are problems reading the file.
write_table : File -> Table -> Existing_File_Behavior -> Match_Columns -> Problem_Behavior -> File
write_table self file table on_existing_file match_columns on_problems =
format = should_treat_as_xls_format self.xls_format file

View File

@ -67,7 +67,8 @@ JS_Object.to_table self fields=Nothing =
- fields: a Vector of Text representing the names of fields to look up.
If `Nothing` then all fields found are added.
> Example Converts a set of objects into a table using the provided headers.
> Example
Converts a set of objects into a table using the provided headers.
from Standard.Table import Table
import Standard.Examples
@ -111,13 +112,13 @@ Text.parse_to_table self (pattern : Text | Regex) case_sensitivity=Case_Sensitiv
ADVANCED
Implements the `Table.write` for this `JSON_File`.
Arguments:
- file: The file to write to.
- table: The table to write.
- on_existing_file: What to do if the file already exists.
- match_columns: How to match columns between the table and the file.
Not used for JSON.
- on_problems: What to do if there are problems reading the file.
Arguments:
- file: The file to write to.
- table: The table to write.
- on_existing_file: What to do if the file already exists.
- match_columns: How to match columns between the table and the file.
Not used for JSON.
- on_problems: What to do if there are problems reading the file.
JSON_Format.write_table : Writable_File -> Table -> Existing_File_Behavior -> Match_Columns -> Problem_Behavior -> File
JSON_Format.write_table self file:Writable_File table on_existing_file match_columns on_problems =
_ = match_columns

View File

@ -1383,11 +1383,11 @@ type Table
ICON split_text
Expand a column of objects to a new set of columns.
Arguments:
- column: The column to expand.
- fields: The set fields to expand. If `Nothing` then all fields are added.
- prefix: Prefix to add to the column names. If `Nothing` then the column
name is used.
Arguments:
- column: The column to expand.
- fields: The set fields to expand. If `Nothing` then all fields are added.
- prefix: Prefix to add to the column names. If `Nothing` then the column
name is used.
@column Widget_Helpers.make_column_name_selector
expand_column : Text | Integer -> (Vector Text) | Nothing -> Prefix_Name -> Table ! Type_Error | No_Such_Column | Index_Out_Of_Bounds
expand_column self (column : Text | Integer) (fields : (Vector Text) | Nothing = Nothing) (prefix : Prefix_Name = Prefix_Name.Column_Name) =
@ -1809,7 +1809,7 @@ type Table
## ICON convert
Returns the vector of columns contained in this table.
> Examples
> Example
Get a vector containing the columns in the table.
import Standard.Examples
@ -2874,28 +2874,28 @@ type Table
ICON dataframe_map_column
Applies the specified cleansings to the text in each row of the specified columns.
Arguments:
- remove: A vector of the text cleanings to remove from the text. The text cleansings are
applied in the order they are provided. The same text cleansing can be used multiple
times. The text cleansings are:
- ..Leading_Whitespace: Removes all whitspace from the start of the string.
- ..Trailing_Whitespace: Removes all whitspace from the end of the string.
- ..Duplicate_Whitespace: Removes all duplicate whitspace from the string replacing it with the first whitespace character of the duplicated block.
- ..All_Whitespace: Removes all whitspace from the string.
- ..Leading_Numbers: Removes all numbers from the start of the string.
- ..Trailing_Numbers: Removes all numbers from the end of the string.
- ..Non_ASCII: Removes all non-ascii characters from the string.
- ..Tabs: Removes all tab characters from the string.
- ..Letters: Removes all letters from the string.
- ..Numbers: Removes all numbers characters from the string.
- ..Punctuation: Removes all characters in the set ,.!?():;'" from the string.
- ..Symbols: Removes anything that isn't letters, numbers or whitespace from the string.
- from: The column(s) to cleanse.
Arguments:
- remove: A vector of the text cleanings to remove from the text. The text cleansings are
applied in the order they are provided. The same text cleansing can be used multiple
times. The text cleansings are:
- ..Leading_Whitespace: Removes all whitspace from the start of the string.
- ..Trailing_Whitespace: Removes all whitspace from the end of the string.
- ..Duplicate_Whitespace: Removes all duplicate whitspace from the string replacing it with the first whitespace character of the duplicated block.
- ..All_Whitespace: Removes all whitspace from the string.
- ..Leading_Numbers: Removes all numbers from the start of the string.
- ..Trailing_Numbers: Removes all numbers from the end of the string.
- ..Non_ASCII: Removes all non-ascii characters from the string.
- ..Tabs: Removes all tab characters from the string.
- ..Letters: Removes all letters from the string.
- ..Numbers: Removes all numbers characters from the string.
- ..Punctuation: Removes all characters in the set ,.!?():;'" from the string.
- ..Symbols: Removes anything that isn't letters, numbers or whitespace from the string.
- from: The column(s) to cleanse.
> Example
Remove leading and trailing spaces from cells.
> Example
Remove leading and trailing spaces from cells.
table.text_cleanse [..Leading_Whitespace, ..Trailing_Whitespace]
table.text_cleanse [..Leading_Whitespace, ..Trailing_Whitespace]
@remove make_data_cleanse_vector_selector
@from (Widget_Helpers.make_column_name_multi_selector use_regex=True)
text_cleanse : Vector Text_Cleanse -> Vector (Integer | Text | Regex) -> Table

View File

@ -415,7 +415,7 @@ Error.should_be_false self = Test.fail_match_on_unexpected_error self 1
Arguments:
- typ: The type to assert that `self` is a value of.
> Examples
> Example
Assert that 1 is of type Boolean.
from Standard.Test import Test

View File

@ -38,7 +38,7 @@ type Faker
- template: Vector of vectors that represent the possible characters for each
letter, as UTF-16 code units.
> Examples:
> Example
Creates a fake UK National Insurance number:
l = "ABCEGHJKLMNOPRSTWXYZ".char_vector