Skip to content

Commit

Permalink
add a function to set random seed (#17)
Browse files Browse the repository at this point in the history
* add a function to set random seed

* changelog
  • Loading branch information
AleksanderWWW authored Jul 4, 2024
1 parent 093d709 commit aae355e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

### Features
- Added exporting the graph to `scipy.csr_matrix` ([#16](https://github.com/AleksanderWWW/abcd-graph/pull/16))
- Added a function to set the random seed ([#17](https://github.com/AleksanderWWW/abcd-graph/pull/17))
7 changes: 7 additions & 0 deletions src/abcd_graph/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
# SOFTWARE.


import random
from functools import wraps
from typing import (
TYPE_CHECKING,
Callable,
)

import numpy
from typing_extensions import (
ParamSpec,
TypeVar,
Expand All @@ -37,6 +39,11 @@
R = TypeVar("R")


def seed(num: int) -> None:
random.seed(num)
numpy.random.seed(num)


def require(package_name: str) -> Callable[[Callable[P, R]], Callable[P, R]]:
def deco(func: Callable[P, R]) -> Callable[P, R]:
@wraps(func)
Expand Down

1 comment on commit aae355e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/abcd_graph
   abcd.py1193967%56–60, 85–87, 98–99, 104–105, 120, 128–134, 139–142, 147–155, 161–177, 181–182
   logger.py53983%39, 43, 47, 51, 55, 63, 66, 69, 72
   utils.py29776%36, 43–44, 51–54
   version.py330%20–24
src/abcd_graph/core
   build.py89397%132, 149, 161
   models.py155497%53, 93, 149, 169
   utils.py22864%31, 45–55
TOTAL5497387% 

Tests Skipped Failures Errors Time
42 0 💤 0 ❌ 0 🔥 22.508s ⏱️

Please sign in to comment.