Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Add pre-commit #87

Merged
merged 5 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: pip install mkdocs-material
- run: pip install "mkdocstrings[python]"
- run: pip install mkdocs-jupyter
- run: mkdocs gh-deploy --force
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.3
hooks:
- id: ruff # Run the linter
- id: ruff-format # Run the formatter
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.25
hooks:
- id: uv-lock # Keep uv.lock up to date with pyproject.toml
- repo: https://github.com/crate-ci/typos
rev: v1.29.4
hooks:
- id: typos
2 changes: 1 addition & 1 deletion docs/concepts/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Each time step, nodes interact randomly with the weights of edges in the adjacen

The model uses two parameters, $\alpha$ and $\beta$, to govern the reinforcement dynamics. The $\alpha$ parameter tunes the amount by which nodes' attitudes are reinforced by acting as an exponent on the adjacency matrix. The sign of this parameter determines whether interaction with opposing attitude nodes strengthens (positive) or weakens (negative) the nodes' attitudes.

The parameter $\beta$ governs the speed at which nodes change their attitudes. It is a constant which modulates the magnitude of attitude reinforcement. When $\beta$ is large, attitudes change rapidly, and as $\beta$ becomes smaller they change more slowly. The sign of this parameter governs whether the network tends to polarize or synchronize over time. If positive, as default, the reinforcemnt tends to polarize the network, if negative the reinforcement tends to synchronize the network.
The parameter $\beta$ governs the speed at which nodes change their attitudes. It is a constant which modulates the magnitude of attitude reinforcement. When $\beta$ is large, attitudes change rapidly, and as $\beta$ becomes smaller they change more slowly. The sign of this parameter governs whether the network tends to polarize or synchronize over time. If positive, as default, the reinforcement tends to polarize the network, if negative the reinforcement tends to synchronize the network.
6 changes: 3 additions & 3 deletions docs/javascripts/mathjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ window.MathJax = {
processHtmlClass: "arithmatex"
}
};
document$.subscribe(() => {

document$.subscribe(() => {
MathJax.startup.output.clearCache()
MathJax.typesetClear()
MathJax.texReset()
MathJax.typesetPromise()
})
})
2 changes: 1 addition & 1 deletion docs/user-guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ With the model object instantiated as `nemodel`, you can use its attached method
>>> nemodel.create_network(network_type="erdos_renyi", p=0.3)
```

Simulations also depend on the individual attitudes of the in the basis network and the connections between them, which you can initalize like so:
Simulations also depend on the individual attitudes of the in the basis network and the connections between them, which you can initialize like so:

```py
>>> nemodel.initialize_connections()
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies = [
"mkdocstrings[python]>=0.25.2",
"rich>=13.9.4",
"pandas>2.2.2",
"pre-commit>=4.1.0",
]

[build-system]
Expand Down
4 changes: 2 additions & 2 deletions src/netechos/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ def initialize_connections(
----------
neighbor_weight : float
The weight to assign to edges between nodes which have an
existing edge in the intial network.
existing edge in the initial network.
non_neighbor_weight : float
The weight to assign to edges between nodes which don't
have an existing edge in the intial network. If non-zero
have an existing edge in the initial network. If non-zero
the network will technically become a complete network.

Returns
Expand Down
Loading
Loading