1 Commits

Author SHA1 Message Date
tsunyoku cf4275c363 fix: remove 2019 usage 2023-01-22 18:22:17 +00:00
9 changed files with 46 additions and 290 deletions
+32 -32
View File
@@ -8,28 +8,29 @@ on:
jobs: jobs:
macos: macos:
runs-on: macos-13 runs-on: macos-latest
strategy:
matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps: steps:
- name: Checkout project - name: Checkout project
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Python setup - name: Python setup
uses: actions/setup-python@v5.1.1 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python_version }} python-version: 3.9
architecture: x64 architecture: x64
- name: Rust setup - name: Rust setup
uses: dtolnay/rust-toolchain@stable uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build wheels - x86_64 - name: Build wheels - x86_64
uses: PyO3/maturin-action@v1 uses: messense/maturin-action@v1
with: with:
target: x86_64 target: x86_64
args: --release --out dist --sdist args: --release --out dist
- name: Install built wheel - x86_64 - name: Install built wheel - x86_64
run: | run: |
@@ -37,9 +38,9 @@ jobs:
python -c "import akatsuki_pp_py" python -c "import akatsuki_pp_py"
- name: Build wheels - universal2 - name: Build wheels - universal2
uses: PyO3/maturin-action@v1 uses: messense/maturin-action@v1
with: with:
args: --release --universal2 --out dist args: --release --universal2 --out dist --no-sdist
- name: Install built wheel - universal2 - name: Install built wheel - universal2
run: | run: |
@@ -56,26 +57,29 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
strategy: strategy:
matrix: matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
target: [x64, x86] target: [x64, x86]
steps: steps:
- name: Checkout project - name: Checkout project
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Python setup - name: Python setup
uses: actions/setup-python@v5.1.1 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python_version }} python-version: 3.9
architecture: ${{ matrix.target }} architecture: ${{ matrix.target }}
- name: Rust setup - name: Rust setup
uses: dtolnay/rust-toolchain@stable uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build wheels - name: Build wheels
uses: PyO3/maturin-action@v1 uses: messense/maturin-action@v1
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
args: --release --out dist args: --release --out dist --no-sdist
- name: Install built wheel - name: Install built wheel
run: | run: |
@@ -89,27 +93,26 @@ jobs:
path: dist path: dist
linux: linux:
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11'] target: [x86_64, i686]
target: [x86_64, i686, aarch64]
steps: steps:
- name: Checkout project - name: Checkout project
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Python setup - name: Python setup
uses: actions/setup-python@v5.1.1 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python_version }} python-version: 3.9
architecture: x64 architecture: x64
- name: Build wheels - name: Build wheels
uses: PyO3/maturin-action@v1 uses: messense/maturin-action@v1
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
manylinux: auto manylinux: auto
args: --release --out dist -i ${{ matrix.python_version }} args: --release --out dist --no-sdist
- name: Install built wheel - name: Install built wheel
if: matrix.target == 'x86_64' if: matrix.target == 'x86_64'
@@ -126,9 +129,6 @@ jobs:
release: release:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
needs: [ macos, windows, linux ] needs: [ macos, windows, linux ]
steps: steps:
- name: Get artifacts - name: Get artifacts
@@ -137,9 +137,9 @@ jobs:
name: wheels name: wheels
- name: Python setup - name: Python setup
uses: actions/setup-python@v5.1.1 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python_version }} python-version: 3.9
- name: Publish to PyPi - name: Publish to PyPi
env: env:
-6
View File
@@ -1,6 +0,0 @@
* @tsunyoku @cmyui
# Infrastructure
/.github/* @cmyui
/tf/* @cmyui
/chart/* @cmyui
Generated
+4 -4
View File
@@ -1,15 +1,15 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 4 version = 3
[[package]] [[package]]
name = "akatsuki-pp" name = "akatsuki-pp"
version = "1.0.1" version = "0.9.3"
source = "git+https://git.ez-pp.farm/EZPPFarm/akatsuki-pp-rs?rev=da105ffb14e45fb2896e87c623471a0843838689#da105ffb14e45fb2896e87c623471a0843838689" source = "git+https://github.com/osuAkatsuki/akatsuki-pp-rs#4140dc70840044d9d4313731ce04c5793098ed62"
[[package]] [[package]]
name = "akatsuki-pp-py" name = "akatsuki-pp-py"
version = "1.0.5" version = "0.9.3"
dependencies = [ dependencies = [
"akatsuki-pp", "akatsuki-pp",
"pyo3", "pyo3",
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "akatsuki-pp-py" name = "akatsuki-pp-py"
version = "1.0.5" version = "0.9.3"
description = "osu! difficulty and pp calculation for all modes" description = "osu! difficulty and pp calculation for all modes"
authors = ["Max Ohn <ohn.m@hotmail.de>", "tsunyoku <tsunyoku@gmail.com>"] authors = ["Max Ohn <ohn.m@hotmail.de>", "tsunyoku <tsunyoku@gmail.com>"]
license = "MIT" license = "MIT"
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
[dependencies] [dependencies]
pyo3 = { version = "0.17", features = ["extension-module", "macros"] } pyo3 = { version = "0.17", features = ["extension-module", "macros"] }
akatsuki-pp = { git = "https://git.ez-pp.farm/EZPPFarm/akatsuki-pp-rs", rev = "da105ffb14e45fb2896e87c623471a0843838689" } akatsuki-pp = { git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "61cb1564b4fdbffb21748b35f58805327dc4aac4" }
[profile.release] [profile.release]
lto = "fat" lto = "fat"
+1 -167
View File
@@ -1,6 +1,3 @@
from typing import Optional
from typing import List
class Beatmap: class Beatmap:
""" """
A class containing a parsed beatmap. A class containing a parsed beatmap.
@@ -28,8 +25,7 @@ class Beatmap:
Throws an exception if the map could not be parsed or an invalid kwarg was given Throws an exception if the map could not be parsed or an invalid kwarg was given
""" """
def __init__(self, **kwargs) -> None: def __init__(self, **kwargs) -> None: ...
...
def set_ar(self, ar: float) -> None: def set_ar(self, ar: float) -> None:
""" """
@@ -234,45 +230,6 @@ class BeatmapAttributes:
Amount of spinners Amount of spinners
""" """
@property
def ar(self) -> float: ...
@property
def cs(self) -> float: ...
@property
def hp(self) -> float: ...
@property
def od(self) -> float: ...
@property
def ar_hit_window(self) -> float: ...
@property
def od_hit_window(self) -> float: ...
@property
def clock_rate(self) -> float: ...
@property
def bpm(self) -> float: ...
@property
def mode(self) -> int: ...
@property
def version(self) -> int: ...
@property
def n_circles(self) -> int: ...
@property
def n_sliders(self) -> int: ...
@property
def n_spinners(self) -> int: ...
class DifficultyAttributes: class DifficultyAttributes:
""" """
@@ -326,69 +283,6 @@ class DifficultyAttributes:
Amount of tiny droplets (C) Amount of tiny droplets (C)
""" """
@property
def mode(self) -> int: ...
@property
def stars(self) -> float: ...
@property
def max_combo(self) -> int: ...
@property
def aim(self) -> Optional[float]: ...
@property
def speed(self) -> Optional[float]: ...
@property
def flashlight(self) -> Optional[float]: ...
@property
def slider_factor(self) -> Optional[float]: ...
@property
def speed_note_count(self) -> Optional[float]: ...
@property
def ar(self) -> Optional[float]: ...
@property
def od(self) -> Optional[float]: ...
@property
def n_circles(self) -> Optional[int]: ...
@property
def n_sliders(self) -> Optional[int]: ...
@property
def n_spinners(self) -> Optional[int]: ...
@property
def stamina(self) -> Optional[float]: ...
@property
def color(self) -> Optional[float]: ...
@property
def rhythm(self) -> Optional[float]: ...
@property
def peak(self) -> Optional[float]: ...
@property
def hit_window(self) -> Optional[float]: ...
@property
def n_fruits(self) -> Optional[int]: ...
@property
def n_droplets(self) -> Optional[int]: ...
@property
def n_tiny_droplets(self) -> Optional[int]: ...
class PerformanceAttributes: class PerformanceAttributes:
""" """
@@ -418,33 +312,6 @@ class PerformanceAttributes:
Difficulty based portion of the performance points (T, M) Difficulty based portion of the performance points (T, M)
""" """
@property
def mode(self) -> int: ...
@property
def pp(self) -> float: ...
@property
def difficulty(self) -> DifficultyAttributes: ...
@property
def pp_acc(self) -> Optional[float]: ...
@property
def pp_aim(self) -> Optional[float]: ...
@property
def pp_speed(self) -> Optional[float]: ...
@property
def pp_flashlight(self) -> Optional[float]: ...
@property
def effective_miss_count(self) -> Optional[float]: ...
@property
def pp_difficulty(self) -> Optional[float]: ...
class Strains: class Strains:
""" """
@@ -477,36 +344,3 @@ class Strains:
`'strains': Optional[List[float]]` `'strains': Optional[List[float]]`
Strain values (M) Strain values (M)
""" """
@property
def mode(self) -> int: ...
@property
def section_len(self) -> float: ...
@property
def aim(self) -> Optional[List[float]]: ...
@property
def aim_no_sliders(self) -> Optional[List[float]]: ...
@property
def speed(self) -> Optional[List[float]]: ...
@property
def flashlight(self) -> Optional[List[float]]: ...
@property
def color(self) -> Optional[List[float]]: ...
@property
def stamina(self) -> Optional[List[float]]: ...
@property
def rhythm(self) -> Optional[List[float]]: ...
@property
def movement(self) -> Optional[List[float]]: ...
@property
def strains(self) -> Optional[List[float]]: ...
+3 -6
View File
@@ -1,10 +1,10 @@
[build-system] [build-system]
requires = ["maturin>=0.14,<0.15"] requires = ["maturin>=0.12,<0.13", "setuptools", "setuptools-rust", "wheel"]
build-backend = "maturin" build-backend = "maturin"
[project] [project]
name = "akatsuki-pp-py" name = "akatsuki-pp-py"
version = "1.0.5" version = "0.9.3"
requires-python = ">=3.7" requires-python = ">=3.7"
description = "osu! difficulty and pp calculation for all modes" description = "osu! difficulty and pp calculation for all modes"
classifiers = [ classifiers = [
@@ -17,10 +17,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: PyPy",
] ]
packages = [{ include = "akatsuki_pp_py" }] packages = [{ include = "akatsuki_pp_py" }]
authors = [ authors = [{ name = "Max Ohn", email = "ohn.m@hotmail.de" }, { name = "tsunyoku", email = "tsunyoku@gmail.com" }]
{ name = "Max Ohn", email = "ohn.m@hotmail.de" },
{ name = "tsunyoku", email = "tsunyoku@gmail.com" },
]
readme = "README.md" readme = "README.md"
license = { file = "LICENSE" } license = { file = "LICENSE" }
repository = "https://github.com/osuAkatsuki/akatsuki-pp-py" repository = "https://github.com/osuAkatsuki/akatsuki-pp-py"
+1 -67
View File
@@ -1,8 +1,4 @@
use akatsuki_pp::{ use akatsuki_pp::{AnyPP, AnyStars, DifficultyAttributes, GameMode};
osu::{OsuDifficultyAttributes, OsuPerformanceAttributes},
osu_2019::OsuPP,
AnyPP, AnyStars, DifficultyAttributes, GameMode, Mods, PerformanceAttributes,
};
use pyo3::{ use pyo3::{
exceptions::{PyTypeError, PyValueError}, exceptions::{PyTypeError, PyValueError},
pyclass, pymethods, pyclass, pymethods,
@@ -231,69 +227,7 @@ impl PyCalculator {
Ok(calc.calculate().into()) Ok(calc.calculate().into())
} }
fn performance_2019(&self, map: &PyBeatmap) -> PyResult<PyPerformanceAttributes> {
let mut calc = OsuPP::new(&map.inner);
set_calc! { calc, self:
mods,
combo,
n300,
n100,
n50,
passed_objects,
};
if let Some(n_misses) = self.n_misses {
calc = calc.misses(n_misses);
}
if let Some(acc) = self.acc {
calc = calc.accuracy(acc as f32);
}
let attrs = calc.calculate();
let new_attrs = OsuPerformanceAttributes {
difficulty: OsuDifficultyAttributes {
aim: attrs.difficulty.aim_strain,
speed: attrs.difficulty.speed_strain,
flashlight: 0.0,
slider_factor: 0.0,
speed_note_count: 0.0,
ar: attrs.difficulty.ar,
od: attrs.difficulty.od,
hp: attrs.difficulty.hp,
n_circles: attrs.difficulty.n_circles,
n_sliders: attrs.difficulty.n_sliders,
n_spinners: attrs.difficulty.n_spinners,
stars: attrs.difficulty.stars,
max_combo: attrs.difficulty.max_combo,
aim_difficult_strain_count: 0.0,
speed_difficult_strain_count: 0.0,
},
pp: attrs.pp,
pp_acc: attrs.pp_acc,
pp_aim: attrs.pp_aim,
pp_flashlight: attrs.pp_flashlight,
pp_speed: attrs.pp_speed,
effective_miss_count: attrs.effective_miss_count,
};
Ok(PerformanceAttributes::Osu(new_attrs).into())
}
fn performance(&self, map: &PyBeatmap) -> PyResult<PyPerformanceAttributes> { fn performance(&self, map: &PyBeatmap) -> PyResult<PyPerformanceAttributes> {
// criteria:
// - is relax
// - is osu!standard
// or mode is not specified and map is osu!standard, as that will be the inferred mode
if (self.mods.is_some() && self.mods.unwrap().rx())
&& ((self.mode.is_none() && map.inner.mode == GameMode::Osu)
|| self.mode == Some(GameMode::Osu))
{
return self.performance_2019(map);
}
let mut calc = AnyPP::new(&map.inner); let mut calc = AnyPP::new(&map.inner);
set_calc! { calc, self: set_calc! { calc, self:
-2
View File
@@ -234,6 +234,4 @@ getters! {
n_tiny_droplets as usize: (Catch), n_tiny_droplets as usize: (Catch),
ar as f64: (Osu, Catch), ar as f64: (Osu, Catch),
hit_window as f64: (Taiko, Mania), hit_window as f64: (Taiko, Mania),
aim_difficult_strain_count as f64: (Osu),
speed_difficult_strain_count as f64: (Osu),
} }
-1
View File
@@ -1,4 +1,3 @@
#![allow(unexpected_cfgs)]
#![deny(clippy::all, nonstandard_style, rust_2018_idioms, unused, warnings)] #![deny(clippy::all, nonstandard_style, rust_2018_idioms, unused, warnings)]
use self::{ use self::{