Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ shipit *args:

# Format code with Fantomas
format:
dotnet fantomas {{src_path}} -r
dotnet fantomas {{test_path}} -r
dotnet fantomas {{src_path}}
dotnet fantomas {{test_path}}

# Check code formatting without making changes
format-check:
dotnet fantomas {{src_path}} -r --check
dotnet fantomas {{test_path}} -r --check
dotnet fantomas {{src_path}} --check
dotnet fantomas {{test_path}} --check

# Install .NET tools (Fable, Fantomas) and Python dependencies
setup:
Expand Down
1 change: 1 addition & 0 deletions src/Fable.Python.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<Compile Include="stdlib/Os.fs" />
<Compile Include="stdlib/Heapq.fs" />
<Compile Include="stdlib/Itertools.fs" />
<Compile Include="stdlib/Datetime.fs" />
<Compile Include="stdlib/Functools.fs" />
<Compile Include="stdlib/Queue.fs" />
<Compile Include="stdlib/String.fs" />
Expand Down
2 changes: 1 addition & 1 deletion src/fable/Testing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let throwsError (expected: string) (f: unit -> 'a) : unit =
let throwsErrorContaining (expected: string) (f: unit -> 'a) : unit =
match run f with
| Error _ when String.IsNullOrEmpty expected -> ()
| Error (actual: string) when actual.Contains expected -> ()
| Error(actual: string) when actual.Contains expected -> ()
| Error actual -> equal (sprintf "Error containing '%s'" expected) actual
| Ok _ -> equal (sprintf "Error containing '%s'" expected) "No error was thrown"

Expand Down
3 changes: 2 additions & 1 deletion src/stdlib/Builtins.fs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ let __name__: string = nativeOnly
let print obj = builtins.print obj

/// Return the value of the named attribute of object with a default.
let getattr obj name defaultValue = builtins.getattr (obj, name, defaultValue)
let getattr obj name defaultValue =
builtins.getattr (obj, name, defaultValue)

/// Sets the named attribute on the given object to the specified value.
let setattr obj name value = builtins.setattr (obj, name, value)
Expand Down
324 changes: 324 additions & 0 deletions src/stdlib/Datetime.fs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/stdlib/Math.fs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ type IExports =
/// Return True if the values a and b are close to each other
/// See https://docs.python.org/3/library/math.html#math.isclose
abstract isclose: a: float * b: float -> bool

/// Return True if the values a and b are close to each other with custom tolerances
/// See https://docs.python.org/3/library/math.html#math.isclose
[<NamedParams(fromIndex = 2)>]
abstract isclose: a: float * b: float * ?rel_tol: float * ?abs_tol: float -> bool

/// Return the least common multiple of the integers
/// See https://docs.python.org/3/library/math.html#math.lcm
abstract lcm: [<ParamArray>] ints: int[] -> int
Expand Down
3 changes: 3 additions & 0 deletions src/stdlib/Queue.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ type Queue<'T>() =
/// operation goes into an uninterruptible wait on an underlying lock. This means that no exceptions can occur, and
/// in particular a SIGINT will not trigger a KeyboardInterrupt.
member x.get(?block: bool, ?timeout: float) : 'T = nativeOnly

/// Equivalent to get(False).
/// See https://docs.python.org/3/library/queue.html#queue.Queue.get_nowait
[<Emit("$0.get_nowait()")>]
member x.get_nowait() : 'T = nativeOnly

/// Blocks until all items in the queue have been gotten and processed.
///
/// The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a
Expand Down Expand Up @@ -74,6 +76,7 @@ type SimpleQueue<'T>() =
member x.put(item: 'T, ?block: bool, ?timeout: float) : unit = nativeOnly
/// Remove and return an item from the queue.
member x.get(?block: bool, ?timeout: float) : 'T = nativeOnly

/// Equivalent to get(False).
[<Emit("$0.get_nowait()")>]
member x.get_nowait() : 'T = nativeOnly
Expand Down
1 change: 1 addition & 0 deletions test/Fable.Python.Test.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<Compile Include="TestSys.fs" />
<Compile Include="TestTime.fs" />
<Compile Include="TestString.fs" />
<Compile Include="TestDatetime.fs" />
<Compile Include="TestPydantic.fs" />
<Compile Include="TestFastAPI.fs" />
<Compile Include="TestTypes.fs" />
Expand Down
Loading
Loading