Skip to content

Commit

Permalink
EXAMPLE considerations
Browse files Browse the repository at this point in the history
  • Loading branch information
attack68 committed Dec 9, 2024
1 parent 9556706 commit fe9e242
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion python/rateslib/default.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import os
import sys
from datetime import datetime
from enum import Enum
from typing import Any
Expand Down
14 changes: 8 additions & 6 deletions python/rateslib/scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from rateslib import defaults
from rateslib.calendars import (
CalInput,
CalTypes,
_adjust_date,
_get_modifier,
_get_roll,
Expand All @@ -22,8 +24,6 @@
_is_som,
add_tenor,
get_calendar,
CalInput,
CalTypes
)
from rateslib.default import NoInput, _drb

Expand Down Expand Up @@ -320,7 +320,6 @@ def __init__(

self._attribute_schedules()


def _dual_sided_stub_parsing(self, front_stub, back_stub, roll):
"""This is called when the provided `stub` argument implies dual sided stubs."""
if front_stub is NoInput.blank and back_stub is NoInput.blank:
Expand Down Expand Up @@ -1463,12 +1462,14 @@ def _raise_date_value_error(effective, termination, front_stub, back_stub, roll,
f"`roll`: {roll},\n"
)


def _validate_frequency(frequency: str) -> str:
frequency = frequency.upper()
if frequency not in ["M", "B", "Q", "T", "S", "A", "Z"]:
raise ValueError("`frequency` must be in {M, B, Q, T, S, A, Z}.")
return frequency


def _validate_effective(
effective: datetime | str,
eval_mode: str,
Expand Down Expand Up @@ -1506,6 +1507,7 @@ def _validate_effective(
else:
return effective


def _validate_termination(
termination: datetime | str,
effective: datetime,
Expand Down Expand Up @@ -1549,10 +1551,9 @@ def _validate_termination(
raise ValueError("Schedule `termination` must be after `effective`.")
return termination_


def _validate_stub(
stub: str | NoInput,
front_stub: datetime | NoInput,
back_stub: datetime | NoInput
stub: str | NoInput, front_stub: datetime | NoInput, back_stub: datetime | NoInput
) -> str:
"""
Sets a default type stub depending upon the `front_stub` and `back_stub` values.
Expand All @@ -1571,6 +1572,7 @@ def _validate_stub(
stub_ = stub.upper()
return stub_


# Licence: Creative Commons - Attribution-NonCommercial-NoDerivatives 4.0 International
# Commercial use of this code, and/or copying and redistribution is prohibited.
# Contact rateslib at gmail.com if this code is observed outside its intended sphere.

0 comments on commit fe9e242

Please sign in to comment.