From 73d48d56b162da4865d7796ee7e5b9e9651f3764 Mon Sep 17 00:00:00 2001 From: Dag Brattli Date: Sun, 22 Oct 2023 12:36:29 +0200 Subject: [PATCH 1/2] Test printing special characters --- tests/Python/TestString.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Python/TestString.fs b/tests/Python/TestString.fs index 78ec6f434f..0f44b1c4ef 100644 --- a/tests/Python/TestString.fs +++ b/tests/Python/TestString.fs @@ -861,3 +861,7 @@ let ``test Can create FormattableString`` () = // let s3: FormattableString = $"""I have no holes""" // s3.GetStrings() |> equal [|"I have no holes"|] #endif + +[] +let ``test printing strings with unicode characters`` () = + printfn "🚀 start running tests ..." From cf2dc1c48899acd63f31ba1c8b32bd508559fe20 Mon Sep 17 00:00:00 2001 From: Dag Brattli Date: Sat, 28 Oct 2023 07:44:32 +0200 Subject: [PATCH 2/2] Code cleanup --- .../fable_library/time_span.py | 1 + src/fable-library-py/fable_library/uri.py | 4 +- src/fable-library-py/fable_library/util.py | 915 ++++++++++++++---- tests/Python/TestString.fs | 2 +- 4 files changed, 722 insertions(+), 200 deletions(-) diff --git a/src/fable-library-py/fable_library/time_span.py b/src/fable-library-py/fable_library/time_span.py index b28d1cf08f..595e587a33 100644 --- a/src/fable-library-py/fable_library/time_span.py +++ b/src/fable-library-py/fable_library/time_span.py @@ -146,6 +146,7 @@ def to_string(ts: timedelta, format: str = "c", _provider: Any | None = None) -> __all__ = [ "create", "to_milliseconds", + "to_string", "from_ticks", "from_milliseconds", "from_hours", diff --git a/src/fable-library-py/fable_library/uri.py b/src/fable-library-py/fable_library/uri.py index 18fce95f3b..42d6e9b297 100644 --- a/src/fable-library-py/fable_library/uri.py +++ b/src/fable-library-py/fable_library/uri.py @@ -102,13 +102,13 @@ def __str__(self) -> str: @staticmethod def create( - uri: str | Uri, kind_or_uri: UriKind | (str | Uri) = UriKind.Absolute + uri: str | Uri, kind_or_uri: UriKind | str | Uri = UriKind.Absolute ) -> Uri: return Uri(uri, kind_or_uri) @staticmethod def try_create( - uri: str | Uri, kind_or_uri: UriKind | (str | Uri), out: FSharpRef[Uri] + uri: str | Uri, kind_or_uri: UriKind | str | Uri, out: FSharpRef[Uri] ) -> bool: try: out.contents = Uri.create(uri, kind_or_uri) diff --git a/src/fable-library-py/fable_library/util.py b/src/fable-library-py/fable_library/util.py index 73ad49f33c..2cfecb59cb 100644 --- a/src/fable-library-py/fable_library/util.py +++ b/src/fable-library-py/fable_library/util.py @@ -268,7 +268,7 @@ def compare_dicts(x: dict[str, Any], y: dict[str, Any]) -> int: return 0 -def compare_arrays(xs: list[Any], ys: list[Any]): +def compare_arrays(xs: list[Any] | None, ys: list[Any] | None): if xs is None: return 0 if ys is None else 1 @@ -351,7 +351,6 @@ def max(comparer: Callable[[_T, _T], int], x: _T, y: _T) -> _T: def clamp(comparer: Callable[[_T, _T], int], value: _T, min: _T, max: _T): - # return (comparer(value, min) < 0) ? min : (comparer(value, max) > 0) ? max : value; return ( min if (comparer(value, min) < 0) @@ -674,6 +673,7 @@ def curry2( else: return f2 + def uncurry3( f: Callable[[_T1], Callable[[_T2], Callable[[_T3], _TResult]]] ) -> Callable[[_T1, _T2, _T3], _TResult]: @@ -713,6 +713,7 @@ def curry4( else: return f2 + def uncurry5( f: Callable[ [_T1], @@ -775,6 +776,7 @@ def curry6( else: return f2 + def uncurry7( f: Callable[ [_T1], @@ -818,6 +820,7 @@ def curry7( else: return f2 + def uncurry8( f: Callable[ [_T1], @@ -870,6 +873,7 @@ def curry8( else: return f2 + def uncurry9( f: Callable[ [_T1], @@ -929,6 +933,7 @@ def curry9( else: return f2 + def uncurry10( f: Callable[ [_T1], @@ -1007,6 +1012,7 @@ def curry10( else: return f2 + def uncurry11( f: Callable[ [_T1], @@ -1026,11 +1032,8 @@ def uncurry11( [_T8], Callable[ [_T9], - Callable[ - [_T10], - Callable[[_T11], _TResult] - ] - ] + Callable[[_T10], Callable[[_T11], _TResult]], + ], ], ], ], @@ -1041,7 +1044,17 @@ def uncurry11( ] ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11], _TResult]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, ) -> Any: return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11) @@ -1066,7 +1079,10 @@ def curry11( Callable[ [_T7], Callable[ - [_T8], Callable[[_T9], Callable[[_T10], Callable[[_T11], _TResult]]] + [_T8], + Callable[ + [_T9], Callable[[_T10], Callable[[_T11], _TResult]] + ], ], ], ], @@ -1105,9 +1121,11 @@ def uncurry12( [_T9], Callable[ [_T10], - Callable[[_T11], Callable[[_T12], _TResult]] - ] - ] + Callable[ + [_T11], Callable[[_T12], _TResult] + ], + ], + ], ], ], ], @@ -1116,9 +1134,22 @@ def uncurry12( ], ], ] -) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12], _TResult]: +) -> Callable[ + [_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12], _TResult +]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, ) -> Any: return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12) @@ -1127,7 +1158,9 @@ def f2( def curry12( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12], _TResult] + f: Callable[ + [_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12], _TResult + ] ) -> Callable[ [_T1], Callable[ @@ -1148,12 +1181,9 @@ def curry12( [_T9], Callable[ [_T10], - Callable[ - [_T11], - Callable[[_T12], _TResult] - ] - ] - ] + Callable[[_T11], Callable[[_T12], _TResult]], + ], + ], ], ], ], @@ -1194,11 +1224,13 @@ def uncurry13( [_T10], Callable[ [_T11], - Callable[[_T12], Callable[[_T13], _TResult]] - ] - ] - ] - ] + Callable[ + [_T12], Callable[[_T13], _TResult] + ], + ], + ], + ], + ], ], ], ], @@ -1210,15 +1242,30 @@ def uncurry13( [_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13], _TResult ]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, a13: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, + a13: Any, ) -> Any: return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13) _curried[f2] = f return f2 + def curry13( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13], _TResult] + f: Callable[ + [_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13], _TResult + ] ) -> Callable[ [_T1], Callable[ @@ -1242,12 +1289,11 @@ def curry13( Callable[ [_T11], Callable[ - [_T12], - Callable[[_T13], _TResult] - ] - ] - ] - ] + [_T12], Callable[[_T13], _TResult] + ], + ], + ], + ], ], ], ], @@ -1290,12 +1336,15 @@ def uncurry14( [_T11], Callable[ [_T12], - Callable[[_T13], Callable[[_T14], _TResult]] - ] - ] - ] - ] - ] + Callable[ + [_T13], + Callable[[_T14], _TResult], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1304,9 +1353,39 @@ def uncurry14( ], ] ) -> Callable[ - [ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, ], _TResult, ]: + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + ], + _TResult, +]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, a13: Any, a14: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, + a13: Any, + a14: Any, ) -> Any: return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14) @@ -1315,7 +1394,10 @@ def f2( def curry14( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14], _TResult] + f: Callable[ + [_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14], + _TResult, + ] ) -> Callable[ [_T1], Callable[ @@ -1341,13 +1423,12 @@ def curry14( Callable[ [_T12], Callable[ - [_T13], - Callable[[_T14], _TResult] - ] - ] - ] - ] - ] + [_T13], Callable[[_T14], _TResult] + ], + ], + ], + ], + ], ], ], ], @@ -1364,6 +1445,7 @@ def curry14( else: return f2 + def uncurry15( f: Callable[ [_T1], @@ -1391,13 +1473,16 @@ def uncurry15( [_T12], Callable[ [_T13], - Callable[[_T14], Callable[[_T15], _TResult]] - ] - ] - ] - ] - ] - ] + Callable[ + [_T14], + Callable[[_T15], _TResult], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1406,10 +1491,25 @@ def uncurry15( ], ] ) -> Callable[ - [ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15] ,_TResult, + [_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15], + _TResult, ]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, a13: Any, a14: Any, a15: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, + a13: Any, + a14: Any, + a15: Any, ) -> Any: return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15) @@ -1418,7 +1518,26 @@ def f2( def curry15( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15], _TResult] + f: Callable[ + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + ], + _TResult, + ] ) -> Callable[ [_T1], Callable[ @@ -1447,13 +1566,13 @@ def curry15( [_T13], Callable[ [_T14], - Callable[[_T15], _TResult] - ] - ] - ] - ] - ] - ] + Callable[[_T15], _TResult], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1470,6 +1589,7 @@ def curry15( else: return f2 + def uncurry16( f: Callable[ [_T1], @@ -1499,14 +1619,19 @@ def uncurry16( [_T13], Callable[ [_T14], - Callable[[_T15], Callable[[_T16], _TResult]] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T15], + Callable[ + [_T16], _TResult + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1515,18 +1640,72 @@ def uncurry16( ], ] ) -> Callable[ - [ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16] ,_TResult, + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + ], + _TResult, ]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, a13: Any, a14: Any, a15: Any, a16: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, + a13: Any, + a14: Any, + a15: Any, + a16: Any, ) -> Any: return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16) _curried[f2] = f return f2 + def curry16( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16], _TResult] + f: Callable[ + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + ], + _TResult, + ] ) -> Callable[ [_T1], Callable[ @@ -1557,14 +1736,14 @@ def curry16( [_T14], Callable[ [_T15], - Callable[[_T16], _TResult] - ] - ] - ] - ] - ] - ] - ] + Callable[[_T16], _TResult], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1581,6 +1760,7 @@ def curry16( else: return f2 + def uncurry17( f: Callable[ [_T1], @@ -1610,14 +1790,22 @@ def uncurry17( [_T13], Callable[ [_T14], - Callable[[_T15], Callable[[_T16], Callable[[_T17], _TResult]]] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T15], + Callable[ + [_T16], + Callable[ + [_T17], _TResult + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1626,18 +1814,77 @@ def uncurry17( ], ] ) -> Callable[ - [ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16, _T17] ,_TResult, + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + _T17, + ], + _TResult, ]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, a13: Any, a14: Any, a15: Any, a16: Any, a17: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, + a13: Any, + a14: Any, + a15: Any, + a16: Any, + a17: Any, ) -> Any: - return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)(a17) + return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)( + a17 + ) _curried[f2] = f return f2 + def curry17( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16, _T17], _TResult] + f: Callable[ + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + _T17, + ], + _TResult, + ] ) -> Callable[ [_T1], Callable[ @@ -1670,15 +1917,17 @@ def curry17( [_T15], Callable[ [_T16], - Callable[[_T17], _TResult] - ] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T17], _TResult + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1695,6 +1944,7 @@ def curry17( else: return f2 + def uncurry18( f: Callable[ [_T1], @@ -1728,16 +1978,22 @@ def uncurry18( [_T15], Callable[ [_T16], - Callable[[_T17], Callable[[_T18], _TResult]] - ] - ] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T17], + Callable[ + [_T18], + _TResult, + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1746,19 +2002,80 @@ def uncurry18( ], ] ) -> Callable[ - [ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16, _T17, _T18] ,_TResult, + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + _T17, + _T18, + ], + _TResult, ]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, a13: Any, a14: Any, a15: Any, a16: Any, a17: Any, a18: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, + a13: Any, + a14: Any, + a15: Any, + a16: Any, + a17: Any, + a18: Any, ) -> Any: - return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)(a17)(a18) + return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)( + a17 + )(a18) _curried[f2] = f return f2 def curry18( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16, _T17, _T18], _TResult] + f: Callable[ + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + _T17, + _T18, + ], + _TResult, + ] ) -> Callable[ [_T1], Callable[ @@ -1793,16 +2110,18 @@ def curry18( [_T16], Callable[ [_T17], - Callable[[_T18], _TResult] - ] - ] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T18], _TResult + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1813,10 +2132,25 @@ def curry18( ]: f2 = _curried.get(f) if f2 is None: - return ( - lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: f( - a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 - ) + return lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: f( + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, ) else: return f2 @@ -1857,17 +2191,23 @@ def uncurry19( [_T16], Callable[ [_T17], - Callable[[_T18], Callable[[_T19], _TResult]] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T18], + Callable[ + [_T19], + _TResult, + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1876,18 +2216,83 @@ def uncurry19( ], ] ) -> Callable[ - [ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16, _T17, _T18, _T19] ,_TResult, + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + _T17, + _T18, + _T19, + ], + _TResult, ]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, a13: Any, a14: Any, a15: Any, a16: Any, a17: Any, a18: Any, a19: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, + a13: Any, + a14: Any, + a15: Any, + a16: Any, + a17: Any, + a18: Any, + a19: Any, ) -> Any: - return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)(a17)(a18)(a19) + return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)( + a17 + )(a18)(a19) _curried[f2] = f return f2 + def curry19( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16, _T17, _T18, _T19], _TResult] + f: Callable[ + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + _T17, + _T18, + _T19, + ], + _TResult, + ] ) -> Callable[ [_T1], Callable[ @@ -1924,17 +2329,20 @@ def curry19( [_T17], Callable[ [_T18], - Callable[[_T19], _TResult] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T19], + _TResult, + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -1945,14 +2353,31 @@ def curry19( ]: f2 = _curried.get(f) if f2 is None: - return ( - lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: lambda a19: f( - a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19 - ) + return lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: lambda a19: f( + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, ) else: return f2 + def uncurry20( f: Callable[ [_T1], @@ -1990,18 +2415,26 @@ def uncurry20( [_T17], Callable[ [_T18], - Callable[[_T19], Callable[[_T20], _TResult]] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T19], + Callable[ + [ + _T20 + ], + _TResult, + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -2010,18 +2443,86 @@ def uncurry20( ], ] ) -> Callable[ - [ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16, _T17, _T18, _T19, _T20] ,_TResult, + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + _T17, + _T18, + _T19, + _T20, + ], + _TResult, ]: def f2( - a1: Any, a2: Any, a3: Any, a4: Any, a5: Any, a6: Any, a7: Any, a8: Any, a9: Any, a10: Any, a11: Any, a12: Any, a13: Any, a14: Any, a15: Any, a16: Any, a17: Any, a18: Any, a19: Any, a20: Any, + a1: Any, + a2: Any, + a3: Any, + a4: Any, + a5: Any, + a6: Any, + a7: Any, + a8: Any, + a9: Any, + a10: Any, + a11: Any, + a12: Any, + a13: Any, + a14: Any, + a15: Any, + a16: Any, + a17: Any, + a18: Any, + a19: Any, + a20: Any, ) -> Any: - return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)(a17)(a18)(a19)(a20) + return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)( + a17 + )(a18)(a19)(a20) _curried[f2] = f return f2 + def curry20( - f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, _T16, _T17, _T18, _T19, _T20], _TResult] + f: Callable[ + [ + _T1, + _T2, + _T3, + _T4, + _T5, + _T6, + _T7, + _T8, + _T9, + _T10, + _T11, + _T12, + _T13, + _T14, + _T15, + _T16, + _T17, + _T18, + _T19, + _T20, + ], + _TResult, + ] ) -> Callable[ [_T1], Callable[ @@ -2060,18 +2561,21 @@ def curry20( [_T18], Callable[ [_T19], - Callable[[_T20], _TResult] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] + Callable[ + [_T20], + _TResult, + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], + ], ], ], ], @@ -2082,10 +2586,27 @@ def curry20( ]: f2 = _curried.get(f) if f2 is None: - return ( - lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: lambda a19: lambda a20: f( - a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20 - ) + return lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: lambda a19: lambda a20: f( + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + a20, ) else: return f2 diff --git a/tests/Python/TestString.fs b/tests/Python/TestString.fs index 0f44b1c4ef..d3e489b645 100644 --- a/tests/Python/TestString.fs +++ b/tests/Python/TestString.fs @@ -864,4 +864,4 @@ let ``test Can create FormattableString`` () = [] let ``test printing strings with unicode characters`` () = - printfn "🚀 start running tests ..." + printfn "🚀 printing unicode ..."