Skip to content

Commit

Permalink
Tidy up the default imports for Standard.Table (#3660)
Browse files Browse the repository at this point in the history
- Removed various unnecessary `Standard.Base` imports still left behind.
- Added `Regex` to default `Standard.Base`.
- Removed aliasing from the examples as no longer needed (case coercion no long occurs).
- Remove `import Standard.Table` from within the Table library (directly importing types).
- Reviewed what was in `Standard.Database` - a few tweaks and removals.
- Removed various un-needed aliasing following Hubert's import work.
  • Loading branch information
jdunkerley authored Aug 22, 2022
1 parent 58fb383 commit 684adcb
Show file tree
Hide file tree
Showing 70 changed files with 165 additions and 240 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from Standard.Base import all
import Standard.Base.Data.Ordering.Natural_Order
from Standard.Base.Data.Text.Text_Ordering import Text_Ordering

polyglot java import org.enso.base.ObjectComparator

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from Standard.Base import all

import Standard.Base.Data.Text.Regex
import Standard.Base.Data.Text.Regex.Mode
import Standard.Base.Data.Ordering.Vector_Lexicographic_Order

polyglot java import org.enso.base.Text_Utils
polyglot java import com.ibm.icu.text.BreakIterator

Expand Down
2 changes: 2 additions & 0 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text.enso
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from Standard.Base import Any, Boolean
import Standard.Base.Meta

polyglot java import org.enso.base.Text_Utils

## Enso's text type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ from Standard.Base import all

import Standard.Base.Data.Text.Regex
import Standard.Base.Data.Text.Regex.Mode

import Standard.Base.Data.Text.Matching_Mode
import Standard.Base.Data.Text.Case
import Standard.Base.Data.Text.Location
import Standard.Base.Data.Text.Line_Ending_Style
import Standard.Base.Data.Text.Span as Span_Module

import Standard.Base.Data.Text.Text_Sub_Range
from Standard.Base.Data.Text.Text_Sub_Range import First

from Standard.Base.Error.Problem_Behavior import Report_Warning
import Standard.Base.Data.Locale
import Standard.Base.Meta

export Standard.Base.Data.Text.Matching_Mode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from Standard.Base import all
from Standard.Base import Text

## An enumeration of different line ending styles.
type Line_Ending_Style
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from Standard.Base import all

import Standard.Base.Data.Locale
import Standard.Base.Data.Text.Regex
from Standard.Base.Error.Problem_Behavior import Problem_Behavior, Report_Warning
from Standard.Base.Error.Problem_Behavior import Report_Warning
from Standard.Base.Error.Common import Wrapped_Dataflow_Error

## UNSTABLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@

from Standard.Base import all

import Standard.Base.Data.Map
import Standard.Base.Data.Text.Span
import Standard.Base.Data.Text.Regex
import Standard.Base.Data.Text.Regex.Engine
import Standard.Base.Data.Text.Regex.Engine.Default as Default_Engine
import Standard.Base.Data.Text.Regex.Mode
import Standard.Base.Data.Text.Regex.Option
import Standard.Base.Data.Map

## Compile the provided `expression` into a regex pattern that can be used for
matching.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import Standard.Base.Data.Text.Regex
import Standard.Base.Data.Text.Regex.Engine
import Standard.Base.Data.Text.Regex.Option as Global_Option
import Standard.Base.Data.Text.Regex.Mode
import Standard.Base.Data.Text.Matching_Mode
import Standard.Base.Polyglot.Java

polyglot java import java.lang.IllegalArgumentException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from Standard.Base import all

from Standard.Base.Data.Text.Extensions import Index_Out_Of_Bounds_Error
from Standard.Base.Error.Common import Index_Out_Of_Bounds_Error

polyglot java import org.enso.base.Text_Utils
polyglot java import com.ibm.icu.text.BreakIterator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from Standard.Base import all
from Standard.Base.Data.Text.Extensions import Index_Out_Of_Bounds_Error
from Standard.Base.Data.Text.Span as Span_Module import Span
from Standard.Base.Error.Common import Index_Out_Of_Bounds_Error
from Standard.Base.Data.Text.Span import Span, range_to_char_indices
from Standard.Base.Data.Index_Sub_Range import First, Last, While, By_Index, Sample, Every
import Standard.Base.Random

Expand Down Expand Up @@ -158,7 +158,7 @@ resolve_index_or_range text descriptor = Panic.recover [Index_Out_Of_Bounds_Erro
true_range = normalize_range descriptor len
if descriptor.is_empty then Range 0 0 else
case true_range.step == 1 of
True -> Span_Module.range_to_char_indices text true_range
True -> range_to_char_indices text true_range
False ->
ranges = Vector.new_builder
if true_range.step <= 0 then panic_on_non_positive_step
Expand Down
2 changes: 0 additions & 2 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time.enso
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from Standard.Base import all

import Standard.Base.Data.Locale
import Standard.Base.Data.Time.Duration
import Standard.Base.Data.Time.Time_Of_Day
import Standard.Base.Data.Time.Zone
import Standard.Base.Data.Ordering

polyglot java import java.time.format.DateTimeFormatter
polyglot java import java.time.ZonedDateTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from Standard.Base import all

import Standard.Base.Data.Locale
import Standard.Base.Data.Time
import Standard.Base.Data.Time.Duration
import Standard.Base.Data.Time.Zone
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from Standard.Base import all
import Standard.Base.Data.Json
import Standard.Base.Runtime

polyglot java import java.lang.IllegalArgumentException
Expand Down
7 changes: 4 additions & 3 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Main.enso
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import project.Data.Text
import project.Data.Text.Encoding
import project.Data.Text.Extensions
import project.Data.Text.Matching
import project.Data.Text.Matching_Mode
import project.Data.Text.Text_Ordering
import project.Data.Text.Span
import project.Data.Time.Date
Expand All @@ -42,6 +41,7 @@ import project.Runtime.State
import project.System.Environment
import project.System.File
import project.System.File.Existing_File_Behavior
import project.Data.Text.Regex
import project.Data.Text.Regex.Mode as Regex_Mode
import project.Warning

Expand All @@ -51,13 +51,14 @@ export project.Data.Locale
export project.Data.Map
export project.Data.Maybe
export project.Data.Ordering

export project.Data.Ordering.Natural_Order
export project.Data.Ordering.Sort_Direction
export project.Data.Regression
export project.Data.Statistics
export project.Data.Statistics.Rank_Method
export project.Data.Text.Regex
export project.Data.Text.Regex.Mode as Regex_Mode
export project.Data.Text.Matching_Mode
export project.Data.Time.Date
export project.Data.Vector
export project.Error.Problem_Behavior
Expand Down Expand Up @@ -87,7 +88,7 @@ from project.Data.Range export all
Relevant issues:
https://www.pivotaltracker.com/story/show/181403340
https://www.pivotaltracker.com/story/show/181309938
from project.Data.Text.Extensions export Text, Line_Ending_Style, Case, Location
from project.Data.Text.Extensions export Text, Line_Ending_Style, Case, Location, Matching_Mode
from project.Data.Text.Matching export Case_Insensitive, Text_Matcher, Regex_Matcher, No_Matches_Found
from project.Data.Text export all hiding Encoding, Span, Text_Ordering
from project.Data.Text.Encoding export Encoding, Encoding_Error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from Standard.Base import all

import Standard.Base.Data.Json
import Standard.Base.Data.Time.Duration
import Standard.Base.Data.Time
import Standard.Base.Network.Http.Form
Expand All @@ -12,7 +11,6 @@ import Standard.Base.Network.Http.Response
import Standard.Base.Network.Http.Version
import Standard.Base.Network.Proxy
import Standard.Base.Network.URI
import Standard.Base.System.File

polyglot java import java.net.http.HttpClient
polyglot java import java.net.http.HttpRequest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from Standard.Base import all

import Standard.Base.Data.Vector

## Create Form data from Parts.

Arguments:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Standard.Base.Network.Http.Header
import Standard.Base.Network.Http.Method
import Standard.Base.Network.Http.Request.Body as Request_Body
import Standard.Base.Network.URI
import Standard.Base.System.File

## Create new HTTP request.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from Standard.Base import all

import Standard.Base.Data.Vector
import Standard.Base.Network.Http.Header
import Standard.Base.Network.Http.Response.Body as Response_Body
import Standard.Base.Network.Http.Status_Code
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from Standard.Base import all

import Standard.Base.Data.Json
import Standard.Base.System.File

type Body

## Response body
Expand Down
3 changes: 0 additions & 3 deletions distribution/lib/Standard/Base/0.0.0-dev/src/System/File.enso
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from Standard.Base import all

import Standard.Base.System.File.Option
import Standard.Base.System.File.Existing_File_Behavior
import Standard.Base.System.File.File_Permissions
import Standard.Base.Error.Problem_Behavior
import Standard.Base.Data.Text.Matching_Mode
import Standard.Base.Data.Text.Text_Sub_Range
from Standard.Base.Error.Problem_Behavior import Report_Warning
import Standard.Base.Runtime.Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import Standard.Base.System

import Standard.Base.System.Process.Exit_Code

from Standard.Base.Data.Vector import Vector

## ALIAS Run a Command
UNSTABLE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import Standard.Base.Error.Common as Errors
import Standard.Table.Data.Aggregate_Column
import Standard.Database.Data.Sql
import Standard.Database.Data.Internal.IR
import Standard.Database.Data.Dialect.Postgres as Postgres_Module
import Standard.Database.Data.Dialect.Redshift as Redshift_Module
import Standard.Database.Data.Dialect.SQLite as SQLite_Module
import Standard.Database.Data.Dialect.Postgres
import Standard.Database.Data.Dialect.Redshift
import Standard.Database.Data.Dialect.SQLite

## PRIVATE

Expand Down Expand Up @@ -52,18 +52,18 @@ type Dialect

The dialect of SQLite databases.
sqlite : Dialect
sqlite = SQLite_Module.sqlite
sqlite = SQLite.sqlite

## PRIVATE

The dialect of PostgreSQL databases.
postgres : Dialect
postgres = Postgres_Module.postgres
postgres = Postgres.postgres

## PRIVATE

The dialect of Redshift databases.
redshift : Dialect
redshift = Redshift_Module.redshift
redshift = Redshift.redshift


Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from Standard.Base import all hiding First, Last
from Standard.Base.Data.Text.Text_Ordering import Text_Ordering

from Standard.Table.Data.Aggregate_Column import all
import Standard.Database.Data.Internal.IR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
from Standard.Base import all
from Standard.Base.Error.Problem_Behavior import Report_Warning

import Standard.Database.Data.Internal.Helpers
import Standard.Database.Data.Internal.Aggregate_Helper
import Standard.Database.Data.Internal.IR
import Standard.Database.Data.Sql

import Standard.Table.Data.Column as Materialized_Column
import Standard.Table.Data.Table as Materialized_Table
import Standard.Table.IO.File_Format

import Standard.Table.Internal.Java_Exports
import Standard.Table.Internal.Table_Helpers
import Standard.Table.Internal.Problem_Builder
import Standard.Table.IO.File_Format
import Standard.Base.System.File.Existing_File_Behavior

import Standard.Table.Data.Aggregate_Column
import Standard.Table.Internal.Aggregate_Column_Helper
from Standard.Database.Data.Column import Column, Aggregate_Column_Builder
from Standard.Database.Data.Internal.IR import Internal_Column
from Standard.Table.Errors import No_Such_Column_Error
from Standard.Table.Data.Column_Selector import Column_Selector, By_Index
from Standard.Base.Data.Text.Text_Ordering import Text_Ordering
from Standard.Table.Data.Data_Formatter import Data_Formatter
from Standard.Base.Error.Problem_Behavior import Problem_Behavior, Report_Warning
from Standard.Database.Error import Unsupported_Database_Operation_Error
import Standard.Table.Data.Column_Name_Mapping
import Standard.Table.Data.Position
Expand Down
19 changes: 10 additions & 9 deletions distribution/lib/Standard/Database/0.0.0-dev/src/Main.enso
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ import Standard.Database.Connection.Redshift

export Standard.Database.Data.Table
export Standard.Database.Data.Column
export Standard.Database.Connection.Connection

from Standard.Database.Connection.Credentials export all
from Standard.Database.Connection.Client_Certificate export all
from Standard.Database.Connection.SSL_Mode export all
from Standard.Database.Connection.Connection_Options export all
export Standard.Database.Connection.SSL_Mode
from Standard.Database.Connection.Connection export Sql_Error, Sql_Timeout_Error

from Standard.Database.Connection.Database export all
from Standard.Database.Connection.Postgres export all
from Standard.Database.Connection.SQLite export all
from Standard.Database.Connection.Redshift export all
from Standard.Database.Connection.Credentials export Credentials
from Standard.Database.Connection.Client_Certificate export Client_Certificate
from Standard.Database.Connection.Connection_Options export Connection_Options

from Standard.Database.Connection.Database export connect
from Standard.Database.Connection.Postgres export Postgres
from Standard.Database.Connection.SQLite export SQLite, In_Memory
from Standard.Database.Connection.Redshift export Redshift, AWS_Profile, AWS_Key
Loading

0 comments on commit 684adcb

Please sign in to comment.