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

Add codespell: workflow, config and fix typos it finds #1226

Merged
merged 10 commits into from
Nov 17, 2023

Conversation

yarikoptic
Copy link
Contributor

Description

codespell is great to pick up known typos. Unfortunately there were some custom variables used which I had to ignore to not introduce too many changes, but you might like to fix up code to stay aware from the names which are close to the typos.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would break back-compatibility)
  • Changes in documentation or new examples for demos and/or use cases.

Branching

  • All PRs should be made against the dev branch. The master branch is not often merged back to dev.

I realized that too late -- please let me know if I should redo but first want to check if you are interested in such a "change" in general

@kushalkolar
Copy link
Collaborator

🚀

@EricThomson
Copy link
Contributor

This looks very helpful -- maybe should be created from dev not main though. Nice to meet you at the booth will be great to collaborate on dandi and nwb! 💯

@pgunn
Copy link
Member

pgunn commented Nov 13, 2023

Hello,
If we do something like this it will probably be something devs run manually rather than as a GitHub action. It seems to do a good job at finding typos and that's something I like, although it makes a few mistakes too.

For now if you don't mind cutting the tool component and config out and making this a pure typo-fixing diff, and redoing it against dev, that would be a welcome fix and we can haggle our the mistakes it made (and areas where the typo isn't the main problem). Up to you whether you want to close this PR and open a new one, or force push a new diff to your branch and retarget then.

I appreciate the attention to the topic.

@yarikoptic
Copy link
Contributor Author

devs run manually

to run manually you would need a config. Can I keep it? I can remove github workflow if you insist.

NB I personally dislike "manual" things, it "never works" and just piles up problems. Hence we use LOTS of automations and I recommend to adopt some of them. Have a look at our pre-commit configuration for one of the components.

I will now redo/rebase on dev. (if you expect contributions against dev to be primary target, you might like to make dev to be the default branch here, not main. We did similarly change default one to maint for datalad since that is what bugfixes should go against).

@yarikoptic yarikoptic changed the base branch from main to dev November 13, 2023 21:33
@yarikoptic
Copy link
Contributor Author

ok, rebased on dev, redid fixups, removed action (IMHO your loss)

Copy link
Member

@pgunn pgunn left a comment

Choose a reason for hiding this comment

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

Generally looks good; happy to see a lot of typos removed from the codebase. The tool got a few things wrong; left some notes.

It's fine to leave the config stuff in pyproject.

@@ -94,7 +94,7 @@ Check console output at $BUILD_URL to view full results.
Building $BRANCH_NAME for $CAUSE
$JOB_DESCRIPTION

Chages:
Changes:
Copy link
Member

Choose a reason for hiding this comment

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

Interesting we never caught this before

@@ -1095,7 +1095,7 @@ def extract_binary_masks_blob(A,

Args:
A: scipy.sparse matrix
contains the components as outputed from the CNMF algorithm
contains the components as outputted from the CNMF algorithm
Copy link
Member

Choose a reason for hiding this comment

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

We'll have to circle back to this later; the phrasing is weird.

@@ -1642,7 +1642,7 @@ def register_translation(src_image, target_image, upsample_factor=1,
"and \"fourier\" values for the ``space`` argument."

References:
.. [1] Manuel Guizar-Sicairos, Samuel T. Thurman, and James R. Fienup,
.. [1] Manual Guizar-Sicairos, Samuel T. Thurman, and James R. Fienup,
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, will force push rewrite, thanks for catching

@@ -1154,9 +1154,9 @@ def fast_graph_Laplacian(mmap_file, dims, max_radius=10, kernel='heat',
else:
res = dview.map(fast_graph_Laplacian_pixel, pars, chunksize=128)
indptr = np.cumsum(np.array([0] + [len(r[0]) for r in res]))
indeces = [item for sublist in res for item in sublist[0]]
indices = [item for sublist in res for item in sublist[0]]
Copy link
Member

Choose a reason for hiding this comment

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

I feel a little weird that it's correcting code rather than just comments, although this is a change I'd make myself so let's leave it in

@@ -280,7 +280,7 @@ def denoise_spikes(trace, sampleRate, windowLength, superfactor, threshs=(.4, .6

tlimit = len(trace)

thre = threshold_sets[th]
Copy link
Member

Choose a reason for hiding this comment

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

Let's revert this set of changes though; not its job to weigh in on something that's not a misspelling

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW, thre is a frequent typo of three, there, their, the hence was detected. I will make it skip all "thre" but then you would miss the typos.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dropping 6642c7f

@@ -89,7 +89,7 @@
"source": [
"max_shifts = (6, 6) # maximum allowed rigid shift in pixels (view the movie to get a sense of motion)\n",
"strides = (48, 48) # create a new patch every x pixels for pw-rigid correction\n",
"overlaps = (24, 24) # overlap between pathes (size of patch strides+overlaps)\n",
"overlaps = (24, 24) # overlap between paths (size of patch strides+overlaps)\n",
Copy link
Member

Choose a reason for hiding this comment

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

patches

@@ -131,7 +131,7 @@
"\n",
"# motion correction parameters\n",
"strides = (48, 48) # start a new patch for pw-rigid motion correction every x pixels\n",
"overlaps = (24, 24) # overlap between pathes (size of patch strides+overlaps)\n",
"overlaps = (24, 24) # overlap between paths (size of patch strides+overlaps)\n",
Copy link
Member

Choose a reason for hiding this comment

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

patches

@@ -120,7 +120,7 @@
"gSig_filt = (3, 3) # size of high pass spatial filtering, used in 1p data\n",
"max_shifts = (5, 5) # maximum allowed rigid shift\n",
"strides = (48, 48) # start a new patch for pw-rigid motion correction every x pixels\n",
"overlaps = (24, 24) # overlap between pathes (size of patch strides+overlaps)\n",
"overlaps = (24, 24) # overlap between paths (size of patch strides+overlaps)\n",
Copy link
Member

Choose a reason for hiding this comment

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

patches

@@ -104,7 +104,7 @@
" # change this one if algorithm does not work\n",
"max_shifts = (5, 5) # maximum allowed rigid shift\n",
"strides = (48, 48) # start a new patch for pw-rigid motion correction every x pixels\n",
"overlaps = (24, 24) # overlap between pathes (size of patch strides+overlaps)\n",
"overlaps = (24, 24) # overlap between paths (size of patch strides+overlaps)\n",
Copy link
Member

Choose a reason for hiding this comment

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

patches

@@ -37,4 +37,4 @@ Second, some behavior is egregious enough that people should not see it in the c

## Process

People who feel that they have been ignored when trying to close a topic or otherwise uncomfortable interactions, or people who feel they have been targeted by egregious behavior that should not be permitted, should contact any of the project organizers. If the claim is not against any of the project organizers, available organizers should confer in the spirit of fairness and due process, investigate as they see fit (including discussing things with the accused), and apply any remedies that they choose. If an organizer is accused, other organizers should confer and apply the same process. Organizers should recuse if they think they cannot be fair.
People who feel that they have been ignored when trying to close a topic or otherwise uncomfortable interactions, or people who feel they have been targeted by egregious behavior that should not be permitted, should contact any of the project organizers. If the claim is not against any of the project organizers, available organizers should confer in the spirit of fairness and due process, investigate as they see fit (including discussing things with the accused), and apply any remedies that they choose. If an organizer is accused, other organizers should confer and apply the same process. Organizers should recurse if they think they cannot be fair.
Copy link
Member

Choose a reason for hiding this comment

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

recuse was actually the word meant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks! ignoring it too

@EricThomson
Copy link
Contributor

Note I will probably get to this next week I'm recovering from workshop-sfn 😄 but it does look like it found a lot of useful things.

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w -i 3 -C 2",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^

note: commit was rebased and adjusted manually for a conflict
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "git-sedi 'between pathes' 'between patches'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
@pgunn
Copy link
Member

pgunn commented Nov 17, 2023

Thanks; this looks good now! Much appreciated!

@pgunn pgunn merged commit 21db43a into flatironinstitute:dev Nov 17, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants