Skip to content

Commit

Permalink
TYP: add schedule (#541)
Browse files Browse the repository at this point in the history
Co-authored-by: JHM Darbyshire (win11) <[email protected]>
  • Loading branch information
attack68 and attack68 authored Dec 10, 2024
1 parent 33f5827 commit 609e17e
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 206 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ ignore = [
files = [
"python/rateslib/calendars/**/*.py",
"python/rateslib/fx/**/*.py",
"python/rateslib/dual/**/*.py"
"python/rateslib/dual/**/*.py",
"python/rateslib/scheduling.py"
]
strict = true

Expand Down
6 changes: 3 additions & 3 deletions python/rateslib/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self):
"T": 4,
"S": 6,
"A": 12,
"Z": 1e8,
"Z": 120000, # corresponds to 10,000 years
}
self.eom = False
self.eom_fx = True
Expand Down Expand Up @@ -380,9 +380,9 @@ def plot3d(x, y, z, labels=None):
return fig, ax, None


def _drb(default: Any, possible_blank: Any | NoInput) -> Any:
def _drb(default: Any, possible_ni: Any | NoInput) -> Any:
"""(D)efault (r)eplaces (b)lank"""
return default if possible_blank is NoInput.blank else possible_blank
return default if isinstance(possible_ni, NoInput) else possible_ni


def _make_py_json(json: str, class_name: str) -> str:
Expand Down
5 changes: 3 additions & 2 deletions python/rateslib/dual/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import math
from functools import partial
from statistics import NormalDist
from typing import TypeAlias

import numpy as np

Expand All @@ -12,8 +13,8 @@
Dual.__doc__ = "Dual number data type to perform first derivative automatic differentiation."
Dual2.__doc__ = "Dual number data type to perform second derivative automatic differentiation."

DualTypes = float | Dual | Dual2 | Variable
Number = float | Dual | Dual2
DualTypes: TypeAlias = "float | Dual | Dual2 | Variable"
Number: TypeAlias = "float | Dual | Dual2"

# Licence: Creative Commons - Attribution-NonCommercial-NoDerivatives 4.0 International
# Commercial use of this code, and/or copying and redistribution is prohibited.
Expand Down
Loading

0 comments on commit 609e17e

Please sign in to comment.