Skip to content

Commit

Permalink
New Version 1.7.2 (#167)
Browse files Browse the repository at this point in the history
- Replaced the dot operator from numpy and pandas with the Python @ operator.
- Made OpenTimeSeries Pydantic validator methods private.
- Adjustments to adhere to mypy unreachable code warnings.
- Removed table in security.md to limit maintenance.
- Removed setup_class from readme.md as it was deleted in version 1.7.1.
- Cosmetic improvements on raise exception statements.
- Limited scipy version to <1.14.1 due to statsmodels bug
- Miscellaneous dependency updates
  • Loading branch information
karrmagadgeteer2 authored Aug 24, 2024
1 parent d3e5144 commit 9e2768a
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 250 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:

repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.5.7
rev: v0.6.2
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Version [1.7.2] - 2024-08-24

- Replaced the dot operator from numpy and pandas with the Python @ operator.
- Made OpenTimeSeries Pydantic validator methods private.
- Adjustments to adhere to mypy unreachable code warnings.
- Removed table in security.md to limit maintenance.
- Removed setup_class from readme.md as it was deleted in version 1.7.1.
- Cosmetic improvements on raise exception statements.
- Miscellaneous dependency updates

## Version [1.7.1] - 2024-08-10

- Changed so that resample_to_business_period_ends method on OpenFrame now retains original stubs on all constituent OpenTimeSeries.
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ make lint

| Method | Applies to | Description |
|:-------------------------|:-----------------|:-----------------------------------------------------------------------------------------------------------------------------------------------|
| `setup_class` | `OpenTimeSeries` | Class method that defines the `domestic` home currency and the `countries` home countries attributes. |
| `pandas_df` | `OpenTimeSeries` | Method to create the `tsdf` pandas.DataFrame from the `dates` and `values`. |
| `set_new_label` | `OpenTimeSeries` | Method to change the pandas.DataFrame column MultiIndex. |
| `running_adjustment` | `OpenTimeSeries` | Adjusts the series performance with a `float` factor. |
Expand Down
24 changes: 2 additions & 22 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,8 @@

## Supported Versions

I typically only maintain the latest version. However, please reach out if support
is needed for an earlier version. Without an x next to a version below you can
assume that it works as intended.

| Version | Supported |
|---------|--------------------|
| 1.7.1 | :white_check_mark: |
| 1.7.0 | :white_check_mark: |
| 1.6.0 | :white_check_mark: |
| 1.5.7 | :white_check_mark: |
| 1.5.6 | :white_check_mark: |
| 1.5.5 | :white_check_mark: |
| 1.5.4 | :white_check_mark: |
| 1.5.3 | :white_check_mark: |
| 1.5.2 | :white_check_mark: |
| 1.5.1 | :white_check_mark: |
| 1.5.0 | :white_check_mark: |
| 1.4.12 | :white_check_mark: |
| 1.4.11 | :white_check_mark: |
| 1.4.10 | :white_check_mark: |
| 1.4.9 | :white_check_mark: |
| < 1.4.9 | :x: |
Typically only the latest version is supported. However, please reach out if you have any
questions about an earlier version.

## Reporting a Vulnerability

Expand Down
16 changes: 4 additions & 12 deletions openseries/_common_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,7 @@ def calc_range(
"Argument months_offset implies start"
"date before first date in series."
)
raise ValueError(
msg,
)
raise ValueError(msg)
later = self.last_idx
else:
if from_dt is not None:
Expand Down Expand Up @@ -785,9 +783,7 @@ def plot_bars(
if labels:
if len(labels) != self.tsdf.shape[1]:
msg = "Must provide same number of labels as items in frame."
raise ValueError(
msg,
)
raise ValueError(msg)
else:
labels = list(self.tsdf.columns.get_level_values(0))

Expand Down Expand Up @@ -902,9 +898,7 @@ def plot_series( # noqa: C901
if labels:
if len(labels) != self.tsdf.shape[1]:
msg = "Must provide same number of labels as items in frame."
raise ValueError(
msg,
)
raise ValueError(msg)
else:
labels = list(self.tsdf.columns.get_level_values(0))

Expand Down Expand Up @@ -1932,9 +1926,7 @@ def value_ret_func(
"Simple return cannot be calculated due to "
f"an initial value being zero. ({self.tsdf.head(3)})"
)
raise ValueError(
msg,
)
raise ValueError(msg)

result = self.tsdf.loc[later] / self.tsdf.loc[earlier] - 1

Expand Down
14 changes: 4 additions & 10 deletions openseries/datefixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ def holiday_calendar(
"Argument countries must be a string country code or "
"a list of string country codes according to ISO 3166-1 alpha-2."
)
raise ValueError(
msg,
)
raise ValueError(msg)

return busdaycalendar(holidays=hols)

Expand All @@ -115,6 +113,7 @@ def date_fix(
Parsed date
"""
msg = f"Unknown date format {fixerdate!s} of type {type(fixerdate)!s} encountered"
if isinstance(fixerdate, (Timestamp, dt.datetime)):
return fixerdate.date()
if isinstance(fixerdate, dt.date):
Expand All @@ -125,10 +124,7 @@ def date_fix(
)
if isinstance(fixerdate, str):
return dt.datetime.strptime(fixerdate, "%Y-%m-%d").astimezone().date()
msg = f"Unknown date format {fixerdate!s} of type {type(fixerdate)!s} encountered"
raise TypeError(
msg,
)
raise TypeError(msg)


def date_offset_foll(
Expand Down Expand Up @@ -372,9 +368,7 @@ def generate_calendar_date_range(
"Provide one of start or end date, but not both. "
"Date range is inferred from number of trading days."
)
raise ValueError(
msg,
)
raise ValueError(msg)


# noinspection PyUnusedLocal
Expand Down
Loading

0 comments on commit 9e2768a

Please sign in to comment.