Skip to content

Commit 0c3e8f1

Browse files
authored
Update ICONs as per Cass's work (#9023)
Apply the Date and Time based ICON updates.
1 parent 6739426 commit 0c3e8f1

File tree

17 files changed

+109
-29
lines changed

17 files changed

+109
-29
lines changed

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Base_64.enso

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ polyglot java import java.util.Base64
77

88
## A helper utility for handling base64 encoding.
99
type Base_64
10-
## Converts a string to bytes using the specified encoding, and encodes that
10+
## ICON convert
11+
Converts a string to bytes using the specified encoding, and encodes that
1112
to base64.
1213
encode_text (text : Text) (encoding : Encoding = Encoding.utf_8) -> Text =
1314
Base64.getEncoder.encodeToString (text.bytes encoding)
1415

15-
## Decodes a base64 encoded string, using the provided encoding.
16+
## ICON convert
17+
Decodes a base64 encoded string, using the provided encoding.
1618
decode_text (encoded_text : Text) (encoding : Encoding = Encoding.utf_8) -> Text ! Encoding_Error =
1719
Text.from_bytes (Base64.getDecoder.decode encoded_text) encoding

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Enso_Cloud/Enso_File.enso

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ type Enso_File
233233
list_assets self . filter f-> f.asset_type != Enso_Asset_Type.Secret
234234

235235
## UNSTABLE
236+
GROUP Output
236237
Creates a subdirectory in a specified directory.
237238
create_directory : Text -> Enso_File
238239
create_directory self (name : Text) = if self.is_directory.not then Error.throw (Illegal_Argument.Error "Only directories can contain subdirectories.") else
@@ -244,6 +245,7 @@ type Enso_File
244245
response.if_not_error <| response.decode_as_json.into Enso_File
245246

246247
## UNSTABLE
248+
GROUP Output
247249
Deletes the file or directory.
248250
delete : Nothing
249251
delete self = if self.id == "" then Error.throw (Illegal_Argument.Error "The root directory cannot be deleted.") else
@@ -254,6 +256,7 @@ type Enso_File
254256
response.if_not_error <| Nothing
255257

256258
## UNSTABLE
259+
GROUP Operators
257260
Resolves a file or directory within this directory.
258261
/ : Text -> Enso_File ! Not_Found
259262
/ self (name : Text) -> Enso_File ! Not_Found =

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Java_Json.enso

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ polyglot java import com.fasterxml.jackson.databind.ObjectMapper
3232
type Java_Json
3333
## ALIAS from text
3434
GROUP Conversions
35+
ICON convert
3536

3637
Parse a Text value into a `Jackson_Object` or an Enso primitive value
3738
(like `Text`, `Number`, `Boolean`, `Nothing`), or a `Vector` of values.
@@ -83,11 +84,13 @@ type Jackson_Object
8384
Value object_node ~field_array
8485

8586
## GROUP Logical
87+
ICON preparation
8688
Returns True iff the objects contains the given `key`.
8789
contains_key : Text -> Boolean
8890
contains_key self key:Text = self.object_node.has key
8991

90-
## Get a value for a key of the object, or a default value if that key is not present.
92+
## ICON select_row
93+
Get a value for a key of the object, or a default value if that key is not present.
9194

9295
Arguments:
9396
- key: The key to get.
@@ -100,6 +103,7 @@ type Jackson_Object
100103
read_json_node child
101104

102105
## GROUP Selections
106+
ICON select_row
103107
Get a value for a key of the object.
104108
If the key is not found, throws a `No_Such_Key` error.
105109

@@ -110,6 +114,7 @@ type Jackson_Object
110114
at self key:Text = self.get key (Error.throw (No_Such_Key.Error self key))
111115

112116
## GROUP Metadata
117+
ICON metadata
113118
Get the keys of the object.
114119
field_names : Vector
115120
field_names self = self.field_array
@@ -136,6 +141,7 @@ type Jackson_Object
136141
function key value
137142

138143
## GROUP Conversions
144+
ICON convert
139145
Convert the object to a Vector of Pairs.
140146
to_vector : Vector
141147
to_vector self =
@@ -144,16 +150,19 @@ type Jackson_Object
144150
Vector.from_polyglot_array proxy
145151

146152
## GROUP Metadata
153+
ICON metadata
147154
Gets the number of keys in the object.
148155
length : Number
149156
length self = self.object_node.size
150157

151158
## GROUP Logical
159+
ICON metadata
152160
Returns True iff the Map is empty, i.e., does not have any entries.
153161
is_empty : Boolean
154162
is_empty self = self.length == 0
155163

156164
## GROUP Logical
165+
ICON metadata
157166
Returns True iff the Map is not empty, i.e., has at least one entry.
158167
not_empty : Boolean
159168
not_empty self = self.is_empty.not
@@ -187,7 +196,8 @@ make_field_name_selector : Jackson_Object -> Display -> Widget
187196
make_field_name_selector js_object display=Display.Always =
188197
Single_Choice display=display values=(js_object.field_names.map n->(Option n n.pretty))
189198

190-
## Extension for Text to allow use.
199+
## ICON convert
200+
Extension for Text to allow use.
191201
Text.parse_fast_json : Nothing | Boolean | Number | Text | Vector | Jackson_Object
192202
Text.parse_fast_json self = Java_Json.parse self
193203

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ type JS_Object
141141
contains_key : Text -> Boolean
142142
contains_key self key:Text = has_property self.js_object key
143143

144-
## Get a value for a key of the object, or a default value if that key is not present.
144+
## ICON select_row
145+
Get a value for a key of the object, or a default value if that key is not present.
145146

146147
Arguments:
147148
- key: The key to get.
@@ -154,6 +155,7 @@ type JS_Object
154155
make_enso value
155156

156157
## GROUP Selections
158+
ICON select_row
157159
Get a value for a key of the object.
158160
If the key is not found, throws a `No_Such_Key` error.
159161

@@ -164,6 +166,7 @@ type JS_Object
164166
at self key:Text = self.get key (Error.throw (No_Such_Key.Error self key))
165167

166168
## GROUP Metadata
169+
ICON metadata
167170
Get the keys of the object.
168171
field_names : Vector
169172
field_names self =
@@ -191,22 +194,26 @@ type JS_Object
191194
function key value
192195

193196
## GROUP Metadata
197+
ICON metadata
194198
Gets the number of keys in the object.
195199
length : Number
196200
length self =
197201
get_property_names self.js_object . length
198202

199203
## GROUP Logical
204+
ICON metadata
200205
Returns True iff the Map is empty, i.e., does not have any entries.
201206
is_empty : Boolean
202207
is_empty self = self.length == 0
203208

204209
## GROUP Logical
210+
ICON metadata
205211
Returns True iff the Map is not empty, i.e., has at least one entry.
206212
not_empty : Boolean
207213
not_empty self = self.is_empty.not
208214

209215
## GROUP Conversions
216+
ICON convert
210217
Convert the object to a Vector of Key and Values.
211218
to_vector : Vector
212219
to_vector self =

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Numbers.enso

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ type Number
294294
log self base = self.ln / base.ln
295295

296296
## GROUP Conversions
297+
ICON convert
297298
Converts a numeric value to a string, using the Java DecimalFormat
298299
formatter.
299300

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date.enso

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ type Date
524524

525525
## ALIAS date range
526526
GROUP Input
527+
ICON date_and_time
527528
Creates an increasing range of dates from `self` to `end`.
528529

529530
Arguments:
@@ -550,6 +551,7 @@ type Date
550551

551552
## ALIAS date range
552553
GROUP Input
554+
ICON date_and_time
553555
Creates a decreasing range of dates from `self` to `end`.
554556

555557
Arguments:
@@ -749,7 +751,7 @@ type Date
749751
JS_Object.from_pairs [type_pair, cons_pair, ["day", self.day], ["month", self.month], ["year", self.year]]
750752

751753
## GROUP Conversions
752-
ICON text
754+
ICON convert
753755
Format this date using the provided format specifier.
754756

755757
Arguments:

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Time.enso

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ type Date_Time
285285
parse text:Text format:Date_Time_Formatter=Date_Time_Formatter.default_enso_zoned_date_time =
286286
format.parse_date_time text
287287

288-
## Creates a new `Date_Time` from a Unix epoch timestamp in seconds (and optional nanoseconds).
288+
## ICON convert
289+
Creates a new `Date_Time` from a Unix epoch timestamp in seconds (and optional nanoseconds).
289290

290291
Arguments:
291292
- seconds: The number of seconds since the Unix epoch.
@@ -301,7 +302,8 @@ type Date_Time
301302
from_unix_epoch_seconds seconds:Integer nanoseconds:Integer=0 =
302303
unix_epoch_start + Duration.new seconds=seconds nanoseconds=nanoseconds
303304

304-
## Creates a new `Date_Time` from a Unix epoch timestamp in milliseconds.
305+
## ICON convert
306+
Creates a new `Date_Time` from a Unix epoch timestamp in milliseconds.
305307

306308
Arguments:
307309
- milliseconds: The number of milliseconds since the Unix epoch.
@@ -835,7 +837,7 @@ type Date_Time
835837
JS_Object.from_pairs [type_pair, cons_pair, ["year", self.year], ["month", self.month], ["day", self.day], ["hour", self.hour], ["minute", self.minute], ["second", self.second], ["nanosecond", self.nanosecond include_milliseconds=True], ["zone", self.zone]]
836838

837839
## GROUP Conversions
838-
ICON text
840+
ICON convert
839841
Format this time as text using the specified format specifier.
840842

841843
Arguments:

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Day_Of_Week.enso

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type Day_Of_Week
3030
Saturday
3131

3232
## GROUP Conversions
33+
ICON convert
3334
Convert the Day_Of_Week to an Integer.
3435

3536
Arguments:

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Duration.enso

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ ensure_duration object ~action =
6565
## Represents the amount of time between two points in time.
6666
@Builtin_Type
6767
type Duration
68-
## Create an interval representing the duration between two points in time.
68+
## ICON date_and_time
69+
Create an interval representing the duration between two points in time.
6970

7071
Arguments:
7172
- start_inclusive: The start datetime of the duration, included.
@@ -85,6 +86,7 @@ type Duration
8586
between_builtin start_inclusive end_exclusive timezone_aware
8687

8788
## GROUP DateTime
89+
ICON date_and_time
8890
Create a duration from time units.
8991

9092
Arguments:
@@ -104,7 +106,8 @@ type Duration
104106
new hours=0 minutes=0 seconds=0 milliseconds=0 nanoseconds=0 =
105107
new_builtin hours minutes seconds milliseconds nanoseconds
106108

107-
## Create a zero (empty) duration.
109+
## ICON date_and_time
110+
Create a zero (empty) duration.
108111
> Example
109112
Folding a vector of durations.
110113

@@ -116,6 +119,7 @@ type Duration
116119
zero = Duration.new
117120

118121
## ADVANCED
122+
ICON date_and_time
119123

120124
Time the evaluation of a function, return a Pair of Duration and Result
121125

@@ -177,6 +181,7 @@ type Duration
177181
Error.throw (Time_Error.Error err.payload.getMessage)
178182

179183
## GROUP Metadata
184+
ICON metadata
180185
Get the portion of the duration expressed in nanoseconds.
181186

182187
> Example
@@ -189,6 +194,7 @@ type Duration
189194
nanoseconds self = @Builtin_Method "Duration.nanoseconds"
190195

191196
## GROUP Metadata
197+
ICON metadata
192198
Get the portion of the duration expressed in milliseconds.
193199

194200
> Example
@@ -201,6 +207,7 @@ type Duration
201207
milliseconds self = @Builtin_Method "Duration.milliseconds"
202208

203209
## GROUP Metadata
210+
ICON metadata
204211
Get the portion of the duration expressed in seconds.
205212

206213
> Example
@@ -213,6 +220,7 @@ type Duration
213220
seconds self = @Builtin_Method "Duration.seconds"
214221

215222
## GROUP Metadata
223+
ICON metadata
216224
Get the portion of the duration expressed in minutes.
217225

218226
> Example
@@ -225,6 +233,7 @@ type Duration
225233
minutes self = @Builtin_Method "Duration.minutes"
226234

227235
## GROUP Metadata
236+
ICON metadata
228237
Get the portion of the duration expressed in hours.
229238

230239
> Example
@@ -237,23 +246,27 @@ type Duration
237246
hours self = @Builtin_Method "Duration.hours"
238247

239248
## GROUP DateTime
249+
ICON convert
240250
Convert the duration to total milliseconds.
241251
total_milliseconds : Integer ! Illegal_State
242252
total_milliseconds self =
243253
Panic.catch ArithmeticException (self.total_milliseconds_builtin) _->
244254
Error.throw (Illegal_State.Error "The duration is too large to convert it to milliseconds")
245255

246256
## GROUP DateTime
257+
ICON convert
247258
Convert the duration to total seconds.
248259
total_seconds : Float ! Illegal_State
249260
total_seconds self = self.total_milliseconds / 1000.0
250261

251262
## GROUP DateTime
263+
ICON convert
252264
Convert the duration to total minutes.
253265
total_minutes : Float ! Illegal_State
254266
total_minutes self = self.total_seconds / 60.0
255267

256268
## GROUP DateTime
269+
ICON convert
257270
Convert the duration to total minutes.
258271
total_hours : Float ! Illegal_State
259272
total_hours self = self.total_minutes / 60.0

distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Period.enso

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ ensure_period object ~action error_msg="Cannot use Duration as a parameter" =
3939
daylight saving time. This means that a Period of 1 day does not necessarily
4040
have to be 24 hours of Duration.
4141
type Period
42-
## Create a Period representing the time interval between two dates.
42+
## ICON date_and_time
43+
Create a Period representing the time interval between two dates.
4344

4445
Arguments:
4546
- start_date_inclusive: The start date of the period, included.

0 commit comments

Comments
 (0)