From 8dde5f7432ae34e7ddf42cfc7f04731dc54b848b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 23:49:21 +0700 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate (#66) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.1 → v0.2.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.1...v0.2.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fab6c11..c63e2e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: # ruff adalah salah satu linter dan formatter kode - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.1 + rev: v0.2.2 hooks: - id: ruff - id: ruff-format From 00b30f1c80171c122ec0d2c60a4c26ea72e101dc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:16:44 +0000 Subject: [PATCH 2/5] [pre-commit.ci] pre-commit autoupdate (#69) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.2...v0.3.2) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c63e2e2..9cb2ac5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,13 +22,13 @@ repos: # ruff adalah salah satu linter dan formatter kode - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.2 + rev: v0.3.2 hooks: - id: ruff - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.9.0 hooks: - id: mypy args: From 11f05d1ec3223ce8cd8a66aacb7fc31543fb38d2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 12:41:55 +0000 Subject: [PATCH 3/5] [pre-commit.ci] pre-commit autoupdate (#77) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/MarcoGorelli/auto-walrus: v0.2.2 → 0.3.4](https://github.com/MarcoGorelli/auto-walrus/compare/v0.2.2...0.3.4) - [github.com/astral-sh/ruff-pre-commit: v0.3.2 → v0.4.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.2...v0.4.3) - [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.9.0...v1.10.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9cb2ac5..141c2c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ # konfigurasi pre commit repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-executables-have-shebangs - id: check-toml @@ -16,19 +16,19 @@ repos: # contoh # total = sum(angka := num for num in nums ) - repo: https://github.com/MarcoGorelli/auto-walrus - rev: v0.2.2 + rev: 0.3.4 hooks: - id: auto-walrus # ruff adalah salah satu linter dan formatter kode - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.2 + rev: v0.4.3 hooks: - id: ruff - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.0 hooks: - id: mypy args: From b3b5b02c82a2ca3ef22f0b5a7eb62e0d63d6b544 Mon Sep 17 00:00:00 2001 From: arfy slowy Date: Wed, 31 Jul 2024 07:59:41 +0700 Subject: [PATCH 4/5] chore(docs): menambahkan komentar kode (#90) Signed-off-by: slowy07 --- OpenSeries/bilangan_istimewa.py | 2 ++ OpenSeries/matematika.py | 2 ++ OpenSeries/statistika.py | 5 +++++ OpenSeries/util/constant.py | 7 +------ setup.py | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/OpenSeries/bilangan_istimewa.py b/OpenSeries/bilangan_istimewa.py index 4261202..779a047 100644 --- a/OpenSeries/bilangan_istimewa.py +++ b/OpenSeries/bilangan_istimewa.py @@ -108,8 +108,10 @@ def angka_segitiga(angka: int) -> Union[int, error.ErrorTipeData, error.Error]: error.Error: jika angka negatif error.ErrorTipeData: jika tipe data salah """ + # jika tipe data dari angka tidak integer if not isinstance(angka, int): return error.ErrorTipeData(["int"]) + # jika value dari angka diisi nilai negatif if angka < 0: return error.Error("angka tidak boleh negatif") return angka * (angka + 1) // 2 diff --git a/OpenSeries/matematika.py b/OpenSeries/matematika.py index a0fcd07..8a22fe3 100644 --- a/OpenSeries/matematika.py +++ b/OpenSeries/matematika.py @@ -243,6 +243,7 @@ def permutasi(nilai: int, r: int) -> Union[int, float, error.ErrorTipeData]: faktorial_nilai = faktorial(nilai) faktorial_nilai_r = faktorial(nilai - r) + # mengecek tipe data dari nilai faktorial if isinstance(faktorial_nilai, int) and isinstance(faktorial_nilai_r, int): return faktorial_nilai / faktorial_nilai_r else: @@ -268,6 +269,7 @@ def kombinasi(nilai: int, r: int) -> Union[int, float, error.ErrorTipeData]: faktorial_r = faktorial(r) faktorial_nilai_r = faktorial(nilai - r) + # mengecek nilai dari faktorial nilai if ( isinstance(faktorial_nilai, int) and isinstance(faktorial_r, int) diff --git a/OpenSeries/statistika.py b/OpenSeries/statistika.py index c48fa6d..9948fe6 100644 --- a/OpenSeries/statistika.py +++ b/OpenSeries/statistika.py @@ -18,10 +18,13 @@ def entropy( error.ErrorTipeData: error jika tipe data salah error.Error: jika nilai label yang diberikan kosong """ + # jika tipe data dari label bukan list if not isinstance(label, (list)): return error.ErrorTipeData(["list"]) + # jika nilai di dalam list kosong if not label: return error.Error("label tidak boleh kosong") + # jika nilai di dalam list itu tidak int if not all(isinstance(cek_nilai, int) for cek_nilai in label): return error.ErrorTipeData(["int"]) _, count = np.unique(label, return_counts=True) @@ -46,8 +49,10 @@ def standar_deviasi( error.ErrorTipeData: error jika tipe data salah error.Error: jika vektor yang diberikan kosong """ + # cek parameter vektor jika tidak bertipe data np.ndarray if not isinstance(vektor, np.ndarray): return error.ErrorTipeData(["numpy array"]) + # cek jika nilai vektor adalah 0 if len(vektor) == 0: return error.Error("vektor tidak boleh kosong") diff --git a/OpenSeries/util/constant.py b/OpenSeries/util/constant.py index 85bbcd4..c04fc6e 100644 --- a/OpenSeries/util/constant.py +++ b/OpenSeries/util/constant.py @@ -8,14 +8,9 @@ # dan dikarakterisasi dalam berbagai cara BILANGAN_EULER: float = 2.718281828459045235360 -# konstanta plank, yang dilambangankan dengan h, yang merupakan konstanta fisika -# fundamental yang menghubungkan energi foton dengan frekuensinya, nilainya disini -# adalah 6.6261 × 10⁻³⁴ (joule per detik) -KONSTANTA_PLANCK = 6.6261 * pow(10, -34) - # variable ini juga mewakili dari konstanta planck, tetapi dinyatan dalam satuan # elektron volt per detik (eV/s) nilainya adalah 4.1357 × 10⁻¹⁵ eV s⁻¹ -KONSTANTA_PLANCK = 4.1357 * pow(10, -15) +KONSTANTA_PLANCK: float = 4.1357 * pow(10, -15) # default error dari warna menggunakan kode ANSI escape # merah diff --git a/setup.py b/setup.py index 0ae3bae..1b6099a 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ if platform.system == "windows": core_require.append("pywin32") + install_require = [x.strip() for x in core_require if "git+" not in x] # setup nama project From f4ac7fea3e468bdff1019d832c615a54044b3b76 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 16:44:28 +0000 Subject: [PATCH 5/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.6.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.3...v0.6.1) - [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.11.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.11.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 141c2c9..2d37a38 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,13 +22,13 @@ repos: # ruff adalah salah satu linter dan formatter kode - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.3 + rev: v0.6.1 hooks: - id: ruff - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.11.1 hooks: - id: mypy args: