Commit Graph

2227 Commits

Author SHA1 Message Date
Don Cross
513d1f0f17 Python: reordered things to reduce forward type declarations. 2023-02-21 13:17:43 -05:00
Don Cross
cd8f9e9f4c Improved Python table for Jupiter moon models.
Updated the code generator so the Python version of
the Jupiter moon tables has better type checking
and is easier to understand.
2023-02-21 12:17:35 -05:00
Don Cross
23b45dd075 Improved Pluto state table in Python code.
The generated code for the Pluto state table in Python
now uses a class `_pstate` for better type checking.
It also makes the code easier to understand.
Moved class _TerseVector higher in the source file to
reduce the need for quoted forward type declarations.
2023-02-21 10:56:05 -05:00
Don Cross
a530069e99 Improved Python VSOP table generation.
The VSOP table generator for Python now is now
better type-checked using classes and tuples.
This also makes the code easier to understand.
2023-02-21 10:12:45 -05:00
Don Cross
f849c11258 Require type hints for all Python functions.
I added the mypy option `--disallow-untyped-defs` to fail
any function lacking complete type hints.
Then I fixed all the resulting errors.

I ended up changing the Python code generator to create
some tuple types instead of list, because it is possible
to write stricter type checks that way. This was in
the Pluto and Jupiter Moon tables.
I still should come back and do the same thing for the VSOP tables.

The type checking revealed a couple of places where I wasn't
checking for a search failure. I fixed those too.
2023-02-20 20:04:10 -05:00
Don Cross
afe1498917 Merge branch 'python_type_hints' 2023-02-20 11:47:59 -05:00
Don Cross
981cafd427 Node.js demo that shows how to calculate drift of the vernal point. 2023-02-20 11:38:09 -05:00
Don Cross
fa3b90678e Work around inconsistent type signatures in Python.
My custom Markdown generator for Python documentation `pydown`
was generating inconsistent function type signatures depending
on the version of Python executing it. This happened for functions
like `Search` that return either Time or None.

On older Pythons we see "Optional[astronomy.Time]".
On newer Pythons we see "Union[astronomy.Time, NoneType]".
This caused unit test failures on GitHub Actions when I check in changes.

I prefer to see Optional[x] over Union[x, NoneType], so I hacked
pydown to replace this using a regex substitution.
2023-02-20 10:32:55 -05:00
Don Cross
fc408501c5 Fix for dotnet command no longer allowing --output on solution files.
The `dotnet` command no longer allows using `--output` to specify the
output directory for building a solution file:
https://github.com/dotnet/sdk/issues/15607

This broke my GitHub Actions tests for C#.

I used the following workaround, because in my case I
know merging multiple builds into one directory is safe:
https://github.com/dotnet/sdk/issues/30624#issuecomment-1432118204
2023-02-19 17:13:05 -05:00
Don Cross
da14856a19 Pydown fix: more reliable way to extract list of imported symbols. 2023-02-19 15:47:46 -05:00
Don Cross
1040a213dc Merge branch 'omar_python_type_hints' into python_type_hints 2023-02-19 14:28:48 -05:00
ris-tlp
66c3ebbc33 Fix PR reviews 2023-02-18 15:45:06 -05:00
ris-tlp
43be952eb2 Python: Type Hints Integration - 6 2023-02-18 03:58:01 -05:00
ris-tlp
e7f8f2b8e2 Python: Type Hints Integration - 5 2023-02-18 03:26:35 -05:00
ris-tlp
0d4c438c2b Python: Type Hints Integration - 4 2023-02-18 02:46:04 -05:00
ris-tlp
f442afd342 Relaxation of test for M1 MacOS Ventura 13.2.1 2023-02-18 02:03:42 -05:00
ris-tlp
d055cb9fe8 Python: Type Hints Integration - 3 2023-02-16 01:12:09 -05:00
ris-tlp
92d266fc3a Python: Type Hints Integration - 2 2023-02-15 02:07:43 -05:00
ris-tlp
7818a6ce38 Python: Fixing multiple imports within same line bug 2023-02-15 00:56:18 -05:00
ris-tlp
6bb781146b Python: Type Hints Integration - 1 2023-02-13 22:56:10 -05:00
ris-tlp
6c1523038d Testing if setting branch upstream was successful 2023-02-13 19:33:21 -05:00
Don Cross
f87b600955 Document mypy, pylint as required contributor tools. 2023-02-13 14:18:26 -05:00
Don Cross
d73d271a4f Fixed pydown to understand imported symbols.
In order to import typing.Union into the module namespace,
I had to fix pydown to recognize Union as a defined symbol.
2023-02-13 13:19:13 -05:00
Don Cross
740ef86d31 Run mypy to verify Python data types. 2023-02-13 12:30:16 -05:00
Don Cross
54181605a0 Merge branch 'pr_python_type_hints' into python_type_hints 2023-02-13 10:23:59 -05:00
ris-tlp
4ea28c6d88 Python: Few typehints for initial review 2023-02-13 02:11:37 -05:00
Don Cross
97c4d2f8f0 Version 2.1.14: added HourAngle function. v2.1.14 2023-02-12 21:34:10 -05:00
Don Cross
42650bd341 Java: added true solar time demo 2023-02-12 20:01:05 -05:00
Don Cross
1dcdb7780f Kotlin: true solar time demo 2023-02-12 19:30:35 -05:00
Don Cross
632d059972 Kotlin: implemented hourAngle function. 2023-02-12 18:13:36 -05:00
Don Cross
5d130f0b3c Missed a change to generated astronomy.ts. 2023-02-12 16:47:10 -05:00
Don Cross
42c352f918 PY: true solar time demo 2023-02-12 16:28:37 -05:00
Don Cross
9e98d0fb17 PY: Implemented HourAngle function. 2023-02-12 16:20:33 -05:00
Don Cross
41e05090aa JS: true solar time demo 2023-02-12 15:35:58 -05:00
Don Cross
f11e2e8c6d JS: Implemented HourAngle function. 2023-02-12 14:22:41 -05:00
Don Cross
93fb6226cd C#: Solar time demo using HourAngle(). 2023-02-12 13:32:38 -05:00
Don Cross
43c37c9038 C#: Implemented HourAngle function. 2023-02-12 13:05:29 -05:00
Don Cross
86fde0d5cd C demo: Calculate true solar time from the Sun's hour angle. 2023-02-12 12:03:43 -05:00
Don Cross
6a8a905aa5 C: Implemented Astronomy_HourAngle function.
We already had a function to search for the next time a body
reaches a certain hour angle. But we didn't have a function
to ask what the current hour angle of a body is.
This will resolve that problem, which will also answer
questions about true solar time: use the Sun as the body,
and add 12 to the hour angle, modulo 24.
2023-02-12 10:52:42 -05:00
Don Cross
73f9cb4b0d Another relaxation of test tolerances for the Apple M1 processor. 2023-02-09 10:00:56 -05:00
Don Cross
8bf48d0681 Slight relaxation of test tolerances.
Contributor @ris-tip ran into erroneous test failures
due to tiny floating point calculation differences.
I'm adjusting the thresholds slightly so his tests will pass.
2023-02-09 08:37:39 -05:00
Don Cross
ae467d67df ctest: Finished eliminating hardcoded function names. 2023-02-08 14:26:20 -05:00
Don Cross
67955c2575 ctest.c: More WIP eliminating hardcoded function names. 2023-02-08 11:57:17 -05:00
Don Cross
3777b7f5bb C tests: remove hardcoded function names (WIP). 2023-02-07 15:45:14 -05:00
Don Cross
341a4bbaec Fixed overly general exception in Python code.
Pylint discovered that I was raising Exception,
which was overly general. I didn't mean to do that;
it was supposed to be my custom exception type
astronomy.Error instead. So I fixed that case.

There were also some deprecated settings in the
pylint configuration file, so I fixed those too.
2023-02-07 14:27:06 -05:00
Don Cross
1624ca0890 A quick test to see if __func__ is supported.
It looks like the C unit tests can use __func__ to avoid
hardcoded function names everywhere. I know this is defined
in C++11 and C99, so it should be fine. If it passes unit
testing across all platforms I exercise in GitHub Actions,
I feel comfortable using it, since it will not affect
production code.
2023-02-07 12:27:22 -05:00
Don Cross
667dcf5c9c Fixed #285 - added missing time parameter to docs.
The documentation was missing a mention of
the `time` parameter in the following TypeScript
functions:

* `Rotation_ECT_EQD`
* `Rotation_EQD_ECT`

Likewise, the `time` parameter was not documented in
the corresponding Kotlin functions:

* `rotationEctEqd`
* `rotationEqdEct`

These mistakes have been corrected.
2023-01-28 12:33:12 -05:00
Don Cross
4256903060 Fixed #280 - corrected typo in documentation. 2023-01-23 17:50:13 -05:00
Don Cross
efa5ea7945 Windows build missed a copyright year.
The Windows build does not run the demo tests like
the Linux one does. This resulted in not copying
the updated astronomy.ts to the calendar demo, thus
missing the copyright year update for 2023.
2023-01-07 20:57:23 -05:00
Don Cross
62192357ba Updated copyrights for 2023.
Windows build process now updates copyright
years just like the Linux build process does.
Ran it to update the copyright years for 2023.
2023-01-07 17:13:07 -05:00