Skip to content

Commit

Permalink
Codespell - edit typos (#1189)
Browse files Browse the repository at this point in the history
* correct spelling in CHANGELOG.rst

* edit typos

* add tool.codespell section to pyproject.toml

* add ignore_lines and ignore_words

* add ignore_words

* add codespell to pre-commit

* add more file extensions to skip

* fix typo

* add more words to ignore
  • Loading branch information
tinatn29 authored Nov 9, 2024
1 parent ff1c095 commit f6d3cfb
Show file tree
Hide file tree
Showing 24 changed files with 74 additions and 35 deletions.
2 changes: 2 additions & 0 deletions .codespell/ignore_lines.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Please include filenames and explanations for each ignored line.
;; See https://docs.openverse.org/meta/codespell.html for docs.
26 changes: 26 additions & 0 deletions .codespell/ignore_words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
;; Please include explanations for each ignored word (lowercase).
;; See https://docs.openverse.org/meta/codespell.html for docs.

;; abbreviation for "materials" often used in a journal title
mater

;; alternative use of socioeconomic
socio-economic

;; Frobenius norm used in np.linalg.norm
fro

;; variable names
stati
convertor
dploy
pres

;; package name
rever

;; people.rst manually allows 'programer' as a variation of 'programmer'
programer

;; suffix for dates
nd
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ repos:
name: Prevent Commit to Main Branch
args: ["--branch", "main"]
stages: [pre-commit]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ v0.3.1

**Changed:**

* ``open`` uses explict 'utf-8' bindings (for windows users)
* ``open`` uses explicit 'utf-8' bindings (for windows users)
* Allow education to be ongoing
* Allow begin and end years for service
* Make employment optional
Expand Down Expand Up @@ -434,7 +434,7 @@ v0.2.0

* Error in ``BaseBuilder`` which caused it to look in the wrong spot for
templates
* Fixed bug in grad builder when the total wieght is zero.
* Fixed bug in grad builder when the total weight is zero.
* Actually use ``ChainedDB`` when working with the DBs

* Error in ``ChainedDB`` which caused bad keys to return with ``None``
Expand Down Expand Up @@ -465,7 +465,7 @@ v0.1.10

**Changed:**

* ``CVBuilder`` and ``ResumeBuilder`` builders now inheret from ``LatexBuilderBase``
* ``CVBuilder`` and ``ResumeBuilder`` builders now inherit from ``LatexBuilderBase``


**Fixed:**
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ trying to commit again.

Improvements and fixes are always appreciated.

Before contribuing, please read our `Code of Conduct <https://github.com/regro/regolith/blob/main/CODE_OF_CONDUCT.rst>`_.
Before contributing, please read our `Code of Conduct <https://github.com/regro/regolith/blob/main/CODE_OF_CONDUCT.rst>`_.

Contact
-------
Expand Down
8 changes: 4 additions & 4 deletions doc/source/collections/beamplan.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ YAML Example
exp_plan:
- load samples on the holder
- scan the holder to locate the samples
- take room temperature measurement of sample and the subtrate
- take room temperature measurement of sample and the substrate
- ramp down temperature to 100K
- ramp up, measure PDF at temperature 100K ~ 300K, 10K stepsize, 1 min exposure
holder: film holder (1 cm * 1 cm * 1 mm)
Expand All @@ -70,7 +70,7 @@ YAML Example
project_lead: kseth
samples:
- WO3 film
- glass subtrate
- glass substrate
scanplan:
- Scanplan(bt, Tramp, 30, 80, 500, 10)
ship_plan:
Expand All @@ -97,7 +97,7 @@ JSON/Mongo Example
"exp_plan": [
"load samples on the holder",
"scan the holder to locate the samples",
"take room temperature measurement of sample and the subtrate",
"take room temperature measurement of sample and the substrate",
"ramp down temperature to 100K",
"ramp up, measure PDF at temperature 100K ~ 300K, 10K stepsize, 1 min exposure"
],
Expand All @@ -112,7 +112,7 @@ JSON/Mongo Example
"project_lead": "kseth",
"samples": [
"WO3 film",
"glass subtrate"
"glass substrate"
],
"scanplan": [
"Scanplan(bt, Tramp, 30, 80, 500, 10)"
Expand Down
2 changes: 1 addition & 1 deletion doc/source/commands/classlist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ classlist
op filename course_id
positional arguments:
op operatation to perform, such as "add" or "replace".
op operation to perform, such as "add" or "replace".
filename file to read class information from.
course_id course identifier whose registry should be updated
Expand Down
2 changes: 1 addition & 1 deletion doc/source/commands/ingest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ ingest
options:
-h, --help show this help message and exit
--coll COLL collection name, if this is not given it is infered from the
--coll COLL collection name, if this is not given it is inferred from the
file type or file name.
2 changes: 1 addition & 1 deletion doc/source/database_maintenance/mongo_maintenance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Setting Up a Server
**LOCAL**

| Your local server is automatically running as a service on localhost if you have downloaded the community version of
mongodb correctly. **Congradulations!**
mongodb correctly. **Congratulations!**
| Accessing your local mongodb server **for administrative purposes** can be done simply by typing "mongo" into your
terminal, which opens the mongodb shell. By default, you will have three databases present (admin, config, local).
Expand Down
4 changes: 2 additions & 2 deletions doc/source/rc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ The MongoDB client to use. This is almost always set by regolith internally.

``db``
=========
The database to use. This should coorespond to the name field of one of the ``databases`` entries.
The database to use. This should correspond to the name field of one of the ``databases`` entries.

``coll``
=========
Expand All @@ -128,7 +128,7 @@ Boolean for whether to select only public databases.

``filename``
==============
Sting that is a path to a file to operate on.
String that is a path to a file to operate on.

``debug``
================
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ exclude = '''
| tests/data
)/
'''

[tool.codespell]
exclude-file = ".codespell/ignore_lines.txt"
ignore-words = ".codespell/ignore_words.txt"
skip = "*.cif, *.dat, *.js, *.txt, *.map, *.tex, *.bib, *.json, *.html"
2 changes: 1 addition & 1 deletion src/regolith/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Broker:
>>> # Load the db
>>> db = Broker.from_rc()
>>> # Get a docment from the broker
>>> # Get a document from the broker
>>> ergs =db['group']['ergs']
>>> # Store a file
>>> db.add_file(ergs, 'myfile', '/path/to/file/hello.txt')
Expand Down
4 changes: 2 additions & 2 deletions src/regolith/builders/coabuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
For the specified person it returns the name and institution of all
graduate student and post-doc advisors,
all graduate student advisees, all post-doc advisees in the past 60 monts
all graduate student advisees, all post-doc advisees in the past 60 months
and all coauthors in the past 48 months.
"""

Expand Down Expand Up @@ -253,7 +253,7 @@ def query_people_and_institutions(rc, names):


def get_inst_name(person, rc):
"""Get the name of instituion of the person's latest employment."""
"""Get the name of institution of the person's latest employment."""
if "employment" in person:
org = get_recent_org(person)
person_inst_abbr = org
Expand Down
4 changes: 2 additions & 2 deletions src/regolith/client_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ def keys(self):
return keys

def collection_names(self, dbname, include_system_collections=True):
"""Returns the collaction names for a database."""
"""Returns the collection names for a database."""
for client in self.clients:
if dbname in client.keys():
return client.collection_names(dbname)

def all_documents(self, collname, copy=True):
"""Returns an iteratable over all documents in a collection."""
"""Returns an iterable over all documents in a collection."""
if copy:
return deepcopy(self.chained_db.get(collname, {})).values()
return self.chained_db.get(collname, {}).values()
Expand Down
4 changes: 2 additions & 2 deletions src/regolith/emailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def attach_pdf(filename):


def make_message(rc, to, subject="", body="", attachments=()):
"""Creates an email following the approriate format. The body kwarg
may be a string of restructured text. Attachements is a list of filenames
"""Creates an email following the appropriate format. The body kwarg
may be a string of restructured text. Attachments is a list of filenames
to attach.
"""
msg = MIMEMultipart("alternative")
Expand Down
4 changes: 2 additions & 2 deletions src/regolith/fsclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ def __getitem__(self, key):
return self.dbs[key]

def collection_names(self, dbname, include_system_collections=True):
"""Returns the collaction names for a database."""
"""Returns the collection names for a database."""
return set(self.dbs[dbname].keys())

def all_documents(self, collname, copy=True):
"""Returns an iteratable over all documents in a collection."""
"""Returns an iterable over all documents in a collection."""
if copy:
return deepcopy(self.chained_db.get(collname, {})).values()
return self.chained_db.get(collname, {}).values()
Expand Down
2 changes: 1 addition & 1 deletion src/regolith/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"u_todo": (u_todo.TodoUpdaterHelper, u_todo.subparser),
}

# Lister helpers need to load collections across all the databses to show everything
# Lister helpers need to load collections across all the databases to show everything
LISTER_HELPERS = {
"l_abstract": (l_abstract.AbstractListerHelper, l_abstract.subparser),
"l_contacts": (l_contacts.ContactsListerHelper, l_contacts.subparser),
Expand Down
8 changes: 4 additions & 4 deletions src/regolith/helpers/a_projectumhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def insert_checklists(self, pdoc, now):
presubmission_checklist = [
(
"Create slide figures",
"Create Inkscape graphics (Inkscape is preferrable over ppt) for the slides "
"Create Inkscape graphics (Inkscape is preferable over ppt) for the slides "
"and place in a ``figures`` directory in the slides directory. "
"These may then be used either in beamer or ppt. "
"Iterate with PI to convergence. (to get started with Inkscape download and install it, "
Expand Down Expand Up @@ -581,7 +581,7 @@ def insert_checklists(self, pdoc, now):
"Read the paper",
"Finally, after you have done all these 'mechanical' checks, "
"read through the paper and try and find any typos or other problems. "
"Resist the temptation to do any rewriting here...you are looking for mispellings "
"Resist the temptation to do any rewriting here...you are looking for misspellings "
"and missing or extra words and so on.",
),
(
Expand Down Expand Up @@ -693,7 +693,7 @@ def insert_checklists(self, pdoc, now):
"Update arXiv if necessary",
"If the paper was listed on a preprint server like arXiv, submit a note to arXiv that the paper "
"has appeared and give the full reference. If the journal copyright allows "
"you can post the published version here, but normally that is not alllowed! "
"you can post the published version here, but normally that is not allowed! "
"Still, it is important that people who find the paper on arXiv "
"get directed to the correct reference.",
),
Expand Down Expand Up @@ -831,7 +831,7 @@ def insert_checklists(self, pdoc, now):
# 'closes. The goal of this is that it will be '
# 'printed as a progress report for a grant '
# 'so write it as if it will be read by an external '
# 'person. It doesnt have to describe the whole prum '
# 'person. It doesn't have to describe the whole prum '
# 'but clearly show the progress that has been made. '
# 'It can be multiple paragraphs or a short statement'
# 'depending on the situation',
Expand Down
2 changes: 1 addition & 1 deletion src/regolith/helpers/attestationshelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def db_updater(self):
print(rc.begin_date)
raise RuntimeError(
"Begin date needed for effort reporting. Please rerun specifying "
"--begin-date YYYY-MM-DD (and preferrably --end-date YYYY-MM-DD) "
"--begin-date YYYY-MM-DD (and preferably --end-date YYYY-MM-DD) "
"or remove --effort-reporting if you "
"want an attestation report for a grant"
)
Expand Down
2 changes: 1 addition & 1 deletion src/regolith/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def create_parser():
"--coll",
dest="coll",
default=None,
help="collection name, if this is not given it is infered from the " "file type or file name.",
help="collection name, if this is not given it is inferred from the " "file type or file name.",
)

# store subparser
Expand Down
2 changes: 1 addition & 1 deletion src/regolith/runcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def load_rcfile(fname):
if ext == ".json":
rc = load_json_rcfile(fname)
else:
raise RuntimeError("could not detemine run control file type from extension.")
raise RuntimeError("could not determine run control file type from extension.")
return rc


Expand Down
2 changes: 1 addition & 1 deletion src/regolith/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def load_exemplars():
for s in SCHEMAS:
SCHEMAS[s]["files"] = {
"description": "Files associated with the document",
# TODO: fix this since this is currently comming out a CommentedMap (+1: Yevgeny)
# TODO: fix this since this is currently coming out a CommentedMap (+1: Yevgeny)
# "type": "list",
# "schema": {"type": "string"},
"required": False,
Expand Down
4 changes: 2 additions & 2 deletions src/regolith/tests/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_builder(bm, db_src, make_db, make_mongodb, monkeypatch):
for testfile in test_files:
if testfile.name not in output_filenames:
print(
f"Expected test file {testfile} not generated by the builder." f"Files genereated: {output_files}"
f"Expected test file {testfile} not generated by the builder." f"Files generated: {output_files}"
)
assert False
# for all other test output 'expected' files check they are the same as the program output
Expand Down Expand Up @@ -280,7 +280,7 @@ def mockreturn(*args, **kwargs):
for testfile in test_files:
if testfile.name not in output_filenames:
print(
f"Expected test file {testfile} not generated by the builder." f"Files genereated: {output_files}"
f"Expected test file {testfile} not generated by the builder." f"Files generated: {output_files}"
)
assert False
# for all other test output 'expected' files check they are the same as the program output
Expand Down
4 changes: 2 additions & 2 deletions src/regolith/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def get_person_contact(name, people_coll, contacts_coll):

def merge_collections_intersect(a, b, target_id):
"""
merge two collections such thta just the intersection is returned
merge two collections such that just the intersection is returned
for shared keys that are in both collections, the value in b will be kept
Expand Down Expand Up @@ -2211,7 +2211,7 @@ def get_target_token(target_token_id, tokens):


def create_repo(destination_id, token_info_id, rc):
"""Creates a repo at the target distination
"""Creates a repo at the target destination
tries to fail gracefully if repo information and token is not defined
Expand Down

0 comments on commit f6d3cfb

Please sign in to comment.