From f721b3f97486348c0fa4117d83fb0ad856c76baf Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Tue, 12 Oct 2021 16:49:20 +0200 Subject: [PATCH] update for rebound 3.18.0 --- .travis.yml | 2 +- rebound/horizons.pyi | 8 ++++++-- rebound/simulation.pyi | 29 ++++++++++++++--------------- rebound/units.pyi | 4 ++-- setup.py | 4 ++-- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 74131be..a9e29ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: - git clone https://github.com/hannorein/rebound rebound-src - pip install mypy matplotlib - pip install git+https://github.com/Findus23/retype.git@skip-setters -script: +script: # stub-dir, output dir, src dir - retype -p rebound -t retyped/rebound rebound-src/rebound - cd retyped && mypy rebound || true diff --git a/rebound/horizons.pyi b/rebound/horizons.pyi index e30f693..c54b229 100644 --- a/rebound/horizons.pyi +++ b/rebound/horizons.pyi @@ -1,13 +1,17 @@ from datetime import datetime -from typing import Optional +from typing import Optional, Union from . import Particle +def api_request(particle: str, datestart: Union[str, datetime], dateend: Union[str, datetime], plane: str) -> str: + ... + + def getParticle(particle: Optional[str] = ..., m: Optional[float] = ..., x: Optional[float] = ..., y: Optional[float] = ..., z: Optional[float] = ..., vx: Optional[float] = ..., vy: Optional[float] = ..., vz: Optional[float] = ..., primary: Optional[float] = ..., a: Optional[float] = ..., anom: Optional[float] = ..., e: Optional[float] = ..., omega: Optional[float] = ..., inc: Optional[float] = ..., Omega: Optional[float] = ..., - MEAN: Optional[float] = ..., date: Optional[str|datetime] = ..., plane: str = ..., + MEAN: Optional[float] = ..., date: Optional[Union[str, datetime]] = ..., plane: str = ..., hash: int = ...) -> Particle: ... diff --git a/rebound/simulation.pyi b/rebound/simulation.pyi index 59a746f..8280edb 100644 --- a/rebound/simulation.pyi +++ b/rebound/simulation.pyi @@ -100,10 +100,10 @@ class reb_simulation_integrator_saba(Structure): keep_unsynchronized: IntBoolean @property - def type(self) -> str: ... + def type(self) -> Union[str, int]: ... @type.setter - def type(self, value: str) -> None: ... + def type(self, value: Union[str, int]) -> None: ... class reb_simulation_integrator_whfast(Structure): @@ -124,16 +124,16 @@ class reb_simulation_integrator_whfast(Structure): def __repr__(self) -> str: ... @property - def coordinates(self) -> str: ... + def coordinates(self) -> Union[int, str]: ... @coordinates.setter - def coordinates(self, value: str) -> None: ... + def coordinates(self, value: Union[int, str]) -> None: ... @property - def kernel(self) -> str: ... + def kernel(self) -> Union[int, str]: ... @kernel.setter - def kernel(self, value: str) -> None: ... + def kernel(self, value: Union[int, str]) -> None: ... class Orbit(Structure): @@ -290,7 +290,7 @@ class Simulation(Structure): def simulationarchive_snapshot(self, filename: str, deletefile: bool = ...) -> None: ... @property - def simulationarchive_filename(self) -> str: ... + def simulationarchive_filename(self) -> bytes: ... def process_messages(self) -> None: ... @@ -373,25 +373,25 @@ class Simulation(Structure): def N_real(self) -> int: ... @property - def integrator(self) -> str: ... + def integrator(self) -> Union[int, str]: ... @integrator.setter def integrator(self, value: Union[int, str]) -> None: ... @property - def boundary(self) -> str: ... + def boundary(self) -> Union[int, str]: ... @boundary.setter def boundary(self, value: Union[int, str]) -> None: ... @property - def gravity(self) -> str: ... + def gravity(self) -> Union[int, str]: ... @gravity.setter def gravity(self, value: Union[int, str]) -> None: ... @property - def collision(self) -> str: ... + def collision(self) -> Union[int, str]: ... @collision.setter def collision(self, value: Union[int, str]) -> None: ... @@ -411,7 +411,7 @@ class Simulation(Structure): def convert_particle_units(self, *args: Any) -> None: ... def add_variation(self, order: int = ..., first_order: Optional[Variation] = ..., - first_order_2: Optional[Variation] = ..., testparticle: int = ...)->Variation: ... + first_order_2: Optional[Variation] = ..., testparticle: int = ...) -> Variation: ... def init_megno(self, seed: Optional[int] = ...) -> None: ... @@ -434,9 +434,8 @@ class Simulation(Structure): def add_particles_ascii(self, s: str) -> None: ... - def calculate_orbits(self, primary: Optional[Particle] = ..., jacobi_masses: bool = ..., - heliocentric: Optional[bool] = ..., barycentric: Optional[bool] = ... - ) -> Orbit: ... + def calculate_orbits(self, primary: Optional[Particle] = ..., jacobi_masses: bool = ... + ) -> List[Orbit]: ... def calculate_com(self, first: int = ..., last: Optional[int] = ...) -> Particle: ... diff --git a/rebound/units.pyi b/rebound/units.pyi index 45c670f..97b1d00 100644 --- a/rebound/units.pyi +++ b/rebound/units.pyi @@ -1,10 +1,10 @@ from ctypes import c_uint32 -from typing import Dict, Sequence +from typing import Dict, Sequence, Optional from . import Particle -def hash_to_unit(hash: c_uint32) -> str: ... +def hash_to_unit(hash: c_uint32) -> Optional[str]: ... G_SI: float diff --git a/setup.py b/setup.py index 7a7ebc0..c1eda7a 100644 --- a/setup.py +++ b/setup.py @@ -18,11 +18,11 @@ setup( maintainer_email="rebound-stubs@lw1.at", description="type stubs for Rebound", license="GPL", - version="3.16.0", + version="3.18.0", packages=["rebound-stubs"], # PEP 561 requires these install_requires=[ - "rebound>=3.16.0", + "rebound>=3.18.0", ], package_data=find_stubs("rebound-stubs"), zip_safe=False,