Open AFg6K7h4fhy2 opened 9 hours ago
Examples of existing errors found with typos
in this repository. --force-exclude
makes it so the errors aren't automatically fixed.
error: `caculate` should be `calculate`
--> tests/cheap/test_ai_models/test_models_tracking_token_cost.py:68:38
|
68 | predicted_prompt_cost_v1 = model.caculate_cost_from_tokens(
| ^^^^^^^^
|
error: `caculate` should be `calculate`
--> tests/cheap/test_ai_models/test_models_tracking_token_cost.py:86:42
|
86 | predicted_completion_cost_v1 = model.caculate_cost_from_tokens(
| ^^^^^^^^
|
error: `higlight` should be `highlight`
--> front_end/mokoresearch_site/app_pages/forecaster_page.py:51:140
|
51 | "Enter the information for your question. Exa.ai is used to gather up to date information. Each citation attempts to link to a higlight of the a ~4 sentence quote found with Exa.ai. This project is in beta some inaccuracies are expected."
| ^^^^^^^^
|
error: `occurances` should be `occurrences`
--> src/forecasting/sub_question_responders/base_rate_responder.py:42:123
|
42 | DESCRIPTION_OF_WHEN_TO_USE = "Use this responder when online information is needed about historical rates, historical occurances, and future probabilities"
| ^^^^^^^^^^
|
error: `succesfully` should be `successfully`
--> src/forecasting/sub_question_responders/base_rate_responder.py:323:150
|
323 | For instance when predicting whether Apple will get sued related to a recent lawsuit, it is more useful to know how often Apple has been succesfully sued for patent violations per time they are sued (event) than per day.
| ^^^^^^^^^^^
|
error: `defintion` should be `definition`
--> src/forecasting/sub_question_responders/base_rate_responder.py:419:140
|
419 | A valid question is one that is about base rates or how often something has happened in the past. Remember, be loose with your defintion. We are just trying to remove clearly off topic questions, or prompt leaking.
| ^^^^^^^^^
This PR seeks to add
pre-commit
(see here) to this repository.In particular, the following hooks are used (@CodexVeritas please verify which ones you want or do not want):
check-added-large-files
: Checks for "large" files, with a file size limit that can be set.end-of-file-fixer
: Ensures that each file ends with a single newline character.mixed-line-ending
: Detects and standardizes line endings to avoid mixing CRLF (\r\n) and LF (\n) within the same file.trailing-whitespace
: Removes whitespace characters at the end of each lineruff
&black
: general organizing of Python code and adherence to PEP 8.E741
: avoid ambiguous variable names (so, ambiguous variables are allowed).E731
: avoid lambda expressions assigned to a variable (so, lambda expresssion are allowed).isort
sorts and organizes imports according to PEP 8.There are more hooks that can be added. Here the author also adds the
typos
hook, which detects typing errors:Sometimes these errors are not, in fact, errors (false positives). To remedy this, one can define a file called
_typos.toml
to exclude certain patterns. Runningpre-commit run --all-files
after thetypos
hook is defined gives errors for "PN" and "OPF" when these are acronyms we want.We do not want to fix "PN" or "OPF" so the
_typos.toml
file will have:Now the "PN" and "OPF" are ignored upon re-running
pre-commit run --all-files
. If you want to ignore and entire file type (e.g..bib
files) the[files]
section of the_typos.toml
file can be used for this:More information can be found in the PR.