forked from LorenFrankLab/spyglass
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
141 changed files
with
29,689 additions
and
21,719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Description | ||
|
||
Please include a summary of the changes and the related issue. Please also | ||
include relevant motivation and context. Please list issues fixed or closed by | ||
This PR. | ||
|
||
- Fixes #000: How this PR fixes the issue | ||
- `path/file.py`: Description of the change | ||
- `path/file.py`: Description of the change | ||
- Fixes #000: How this PR fixes the issue | ||
- `path/file.py`: Description of the change | ||
- `path/file.py`: Description of the change | ||
|
||
# Checklist: | ||
|
||
- [ ] This PR should be accompanied by a release: (yes/no/unsure) | ||
- [ ] (If release) I have updated the `CITATION.cff` | ||
- [ ] I have updated the `CHANGELOG.md` | ||
- [ ] I have added/edited docs/notebooks to reflect the changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
default_stages: [commit, push] | ||
exclude: (^.github/|^docs/site/|^images/) | ||
|
||
repos: | ||
- repo: https://github.com/executablebooks/mdformat | ||
# Do this before other tools "fixing" the line endings | ||
rev: 0.7.16 | ||
hooks: | ||
- id: mdformat | ||
name: Format Markdown | ||
entry: mdformat # Executable to run, with fixed options | ||
language: python | ||
types: [markdown] | ||
args: [--wrap, "80", --number] | ||
additional_dependencies: | ||
- mdformat-toc | ||
- mdformat-beautysh | ||
- mdformat-config | ||
- mdformat-black | ||
- mdformat-web | ||
- mdformat-gfm | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-json | ||
- id: check-toml | ||
- id: check-yaml | ||
args: [--unsafe] | ||
- id: requirements-txt-fixer | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
args: ["--fix=lf"] | ||
description: Forces to replace line ending by the UNIX 'lf' character. | ||
- id: trailing-whitespace | ||
- id: debug-statements | ||
- id: check-added-large-files # prevent giant files from being committed | ||
- id: check-builtin-literals | ||
- id: check-merge-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-docstring-first | ||
- id: check-case-conflict | ||
- id: fix-byte-order-marker | ||
|
||
- repo: https://github.com/adrienverge/yamllint.git | ||
rev: v1.29.0 | ||
hooks: | ||
- id: yamllint | ||
args: | ||
- --no-warnings | ||
- -d | ||
- "{extends: relaxed, rules: {line-length: {max: 90}}}" | ||
|
||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.0.254 | ||
hooks: | ||
- id: ruff | ||
|
||
- repo: https://github.com/PyCQA/autoflake | ||
rev: v2.0.1 | ||
hooks: | ||
- id: autoflake | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.2 | ||
hooks: | ||
- id: codespell | ||
args: [--toml, pyproject.toml] | ||
additional_dependencies: | ||
- tomli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,12 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
import tempfile | ||
|
||
# shared_modules = [ | ||
# "common\_%", | ||
# "spikesorting\_%", | ||
# "decoding\_%", | ||
# "position\_%", | ||
# "lfp\_%", | ||
# ] | ||
|
||
|
||
def add_collab_user(user_name): | ||
# create a tempoary file for the command | ||
file = tempfile.NamedTemporaryFile(mode="w") | ||
|
||
file.write( | ||
f"GRANT ALL PRIVILEGES ON `{user_name}\_%`.* TO `{user_name}`@'%' IDENTIFIED BY 'temppass';\n" | ||
) | ||
# for module in shared_modules: | ||
# file.write(f"GRANT ALL PRIVILEGES ON `{module}`.* TO `{user_name}`@'%';\n") | ||
file.write(f"GRANT SELECT ON `%`.* TO `{user_name}`@'%';\n") | ||
file.flush() | ||
|
||
# run those commands in sql | ||
os.system(f"mysql -p -h lmf-db.cin.ucsf.edu < {file.name}") | ||
from warnings import warn | ||
|
||
from spyglass.utils.database_settings import DatabaseSettings | ||
|
||
if __name__ == "__main__": | ||
add_collab_user(sys.argv[1]) | ||
warn( | ||
"This script is deprecated. " | ||
+ "Use spyglass.utils.database_settings.DatabaseSettings instead." | ||
) | ||
DatabaseSettings(user_name=sys.argv[1]).add_collab_user() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,12 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
import tempfile | ||
|
||
shared_modules = [ | ||
"common\_%", | ||
"spikesorting\_%", | ||
"decoding\_%", | ||
"position\_%", | ||
"lfp\_%", | ||
] | ||
|
||
|
||
def add_user(user_name): | ||
# create a tempoary file for the command | ||
file = tempfile.NamedTemporaryFile(mode="w") | ||
|
||
file.write( | ||
f"GRANT SELECT ON `%`.* TO `{user_name}`@'%' IDENTIFIED BY 'Data_$haring';\n" | ||
) | ||
file.flush() | ||
|
||
# run that commands in sql | ||
os.system(f"mysql -p -h lmf-db.cin.ucsf.edu < {file.name}") | ||
from warnings import warn | ||
|
||
from spyglass.utils.database_settings import DatabaseSettings | ||
|
||
if __name__ == "__main__": | ||
add_user(sys.argv[1]) | ||
warn( | ||
"This script is deprecated. " | ||
+ "Use spyglass.utils.database_settings.DatabaseSettings instead." | ||
) | ||
DatabaseSettings(user_name=sys.argv[1]).add_dj_guest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,12 @@ | ||
#!/usr/bin/env python | ||
import grp | ||
import os | ||
import sys | ||
import tempfile | ||
|
||
target_group = "kachery-users" | ||
|
||
|
||
def add_module(module_name): | ||
print(f"Granting everyone permissions to module {module_name}") | ||
|
||
# create a tempoary file for the command | ||
file = tempfile.NamedTemporaryFile(mode="w") | ||
|
||
# find the kachery-users group | ||
groups = grp.getgrall() | ||
for group in groups: | ||
if group.gr_name == target_group: | ||
break | ||
|
||
# get a list of usernames | ||
for user in group.gr_mem: | ||
file.write( | ||
f"GRANT ALL PRIVILEGES ON `{module_name}\_%`.* TO `{user}`@'%';\n" | ||
) | ||
file.flush() | ||
|
||
# run those commands in sql | ||
os.system(f"mysql -p -h lmf-db.cin.ucsf.edu < {file.name}") | ||
from warnings import warn | ||
|
||
from spyglass.utils.database_settings import DatabaseSettings | ||
|
||
if __name__ == "__main__": | ||
add_module(sys.argv[1]) | ||
warn( | ||
"This script is deprecated. " | ||
+ "Use spyglass.utils.database_settings.DatabaseSettings instead." | ||
) | ||
DatabaseSettings().add_module(sys.argv[1]) |
Oops, something went wrong.