Skip to content

Commit

Permalink
Fix typos (#228)
Browse files Browse the repository at this point in the history
Found via `typos --hidden --format brief` and `codespell -H -L cant`
  • Loading branch information
kianmeng committed Jun 23, 2024
1 parent 4b66184 commit 7b0fa64
Show file tree
Hide file tree
Showing 27 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion docs/env_vars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Internal Environment variables
The following environment variables are used by Poe the Poet internally, and can be accessed from within configuration and tasks.

- ``POE_ROOT``: path to the parent directory of the main tasks file (e.g. pyproject.toml).
- ``POE_PWD``: the current working directory of the poe process (unless overriden programmatically).
- ``POE_PWD``: the current working directory of the poe process (unless overridden programmatically).
- ``POE_CONF_DIR``: the path to the parent directory of the config file that defines the running task or the :ref:`cwd option<Setting a working directory for included tasks>` set when including that config.
- ``POE_ACTIVE``: identifies the active PoeExecutor, so that Poe the Poet can tell when it is running recursively.

Expand Down
6 changes: 3 additions & 3 deletions docs/guides/args_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Named arguments support the following configuration options:
default = "${AWS_REGION}"
env.AWS_REGION.default = "eu-central-1"
As in the above example, this can be combined with setting an :doc:`env value<../tasks/options>` on the task with the ``default`` specifier to get the following precendence of values for the arg:
As in the above example, this can be combined with setting an :doc:`env value<../tasks/options>` on the task with the ``default`` specifier to get the following precedence of values for the arg:

1. the value passed on the command line
2. the value of the variable set on the environment
Expand All @@ -151,11 +151,11 @@ Named arguments support the following configuration options:

If set to a number, then the argument will accept *exactly* that number of values.

For positional aguments, only the last positional argument may have the ``multiple`` option set.
For positional arguments, only the last positional argument may have the ``multiple`` option set.

This option is not compatible with arguments with type ``boolean`` since these are interpreted as flags. However multiple ones or zeros can be passed to an argument of type "integer" for similar effect.

The values provided to an argument with the ``multiple`` option set are available on the environment as a string of whitespace separated values. For script tasks, the values will be provided to your python function as a list of values. In a cmd task the values can be passed as separate arugments to the task via templating as in the following example.
The values provided to an argument with the ``multiple`` option set are available on the environment as a string of whitespace separated values. For script tasks, the values will be provided to your python function as a list of values. In a cmd task the values can be passed as separate arguments to the task via templating as in the following example.

.. code-block:: toml
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/running_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This task can the be run via the poe cli as ``poe test``.
Run a task with the poe CLI
---------------------------

The prefered way to run poe is via the standalone CLI.
The preferred way to run poe is via the standalone CLI.

.. code-block:: sh
Expand Down
4 changes: 2 additions & 2 deletions docs/poetry_plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ And the poe documentation can be viewed via:
poetry poe
It is also possible to modify this behavoir, to either have a different command prefix
It is also possible to modify this behavior, to either have a different command prefix
or none at all by setting the :toml:`poetry_command` global option in your
pyproject.toml like so:

Expand All @@ -44,7 +44,7 @@ invoked simply as:
Whatever :toml:`tool.poe.poetry_command` is set to must not already exist as a
poetry command!

Additionally if setting it to the emtpy string then care must be taken to avoid
Additionally if setting it to the empty string then care must be taken to avoid
defining any poe tasks that conflict with any other built in or plugin provided
poetry command.

Expand Down
2 changes: 1 addition & 1 deletion docs/tasks/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A task defined as a string will by default be interpreted as a single command to
[tool.poe.tasks]
test = "pytest"
A task defined as an array will by default be interepreted as a :doc:`sequence <task_types/sequence>` of :doc:`references<task_types/ref>` to other tasks.
A task defined as an array will by default be interpreted as a :doc:`sequence <task_types/sequence>` of :doc:`references<task_types/ref>` to other tasks.

.. code-block:: toml
Expand Down
2 changes: 1 addition & 1 deletion docs/tasks/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,5 @@ However in certain situations it can be desirable to define a task that is inste
Note the following limitations with this feature:

1. a task configured in this way may not be referenced by another task
2. this does not work on windows becuase of `this issue <https://bugs.python.org/issue19066>`_. On windows a subprocess is always created.
2. this does not work on windows because of `this issue <https://bugs.python.org/issue19066>`_. On windows a subprocess is always created.

2 changes: 1 addition & 1 deletion docs/tasks/task_types/expr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
`this collection <https://github.com/nat-n/poethepoet/blob/main/poethepoet/helpers/python.py#L13>`_
- reference the |sys_module_link| module without having to specify it as an import
- directly access whatever arguments were passed to the task from `sys.argv`
- referene values of named args as python variables
- reference values of named args as python variables
- include environment variables as string values that are injected into the expression
using the usual templating syntax ``${...}``

Expand Down
2 changes: 1 addition & 1 deletion docs/tasks/task_types/script.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ As in the second example, is it possible to hard code literal arguments to the t

If extra arguments are passed to task on the command line (and no CLI args are declared), then they will be available within the called python function via :python:`sys.argv`. If :doc:`args <../options>` are configured for the task then they will be available as python variables.

If the target python function is an async function then it will be exectued with :python:`asyncio.run`.
If the target python function is an async function then it will be executed with :python:`asyncio.run`.


Available task options
Expand Down
2 changes: 1 addition & 1 deletion docs/tasks/task_types/shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ It is also possible to specify python code as the shell task code as in the foll
The following interpreter values may be used:

posix
This is the default behavoir, equivalent to ``["sh", "bash", "zsh"]``, meaning that poe will try to find sh, and fallback to bash, then zsh.
This is the default behavior, equivalent to ``["sh", "bash", "zsh"]``, meaning that poe will try to find sh, and fallback to bash, then zsh.
sh
Use the basic posix shell. This is often an alias for either bash or dash depending on the operating system.
bash
Expand Down
4 changes: 2 additions & 2 deletions poethepoet/env/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

class SpyDict(dict):
"""
A kind of dict in which the behavior __getitem__ can be overriden.
A kind of dict in which the behavior __getitem__ can be overridden.
"""

def __init__(self, content=tuple(), *, getitem_spy=None):
Expand Down Expand Up @@ -59,7 +59,7 @@ def apply_envvars_to_template(
Template in ${environmental} $variables from env as if we were in a shell
Supports escaping of the $ if preceded by an odd number of backslashes, in which
case the backslash immediately precending the $ is removed. This is an
case the backslash immediately preceding the $ is removed. This is an
intentionally very limited implementation of escaping semantics for the sake of
usability.
"""
Expand Down
2 changes: 1 addition & 1 deletion poethepoet/executor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

class MetaPoeExecutor(type):
"""
This metaclass makes all decendents of PoeExecutor (task types) register themselves
This metaclass makes all descendents of PoeExecutor (task types) register themselves
on declaration and validates that they include the expected class attributes.
"""

Expand Down
2 changes: 1 addition & 1 deletion poethepoet/helpers/command/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def parse_poe_cmd(source: str, config: Optional["ParseConfig"] = None):
# Poe cmd task content differs from POSIX command lines in that new lines are
# ignored (except in comments) and glob patterns are constrained to what the
# python standard library glob module can support
config = ParseConfig(substitute_nodes={Glob: PythonGlob}, line_seperators=";")
config = ParseConfig(substitute_nodes={Glob: PythonGlob}, line_separators=";")

return Script(ParseCursor.from_string(source), config)

Expand Down
18 changes: 9 additions & 9 deletions poethepoet/helpers/command/ast.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# ruff: noqa: N806
r"""
This module implements a heirarchical parser and AST along the lines of the
This module implements a hierarchical parser and AST along the lines of the
following grammar which is a subset of bash syntax.
script : line*
line : word* comment?
word : segment*
segment : UNQUOTED_CONTENT | single_quoted_sement | double_quoted_sement
segment : UNQUOTED_CONTENT | single_quoted_segment | double_quoted_segment
unquoted_sement : UNQUOTED_CONTENT | param_expansion | glob
single_quoted_sement : "'" SINGLE_QUOTED_CONTENT "'"
double_quoted_sement : "\"" (DOUBLE_QUOTED_CONTENT | param_expansion) "\""
unquoted_segment : UNQUOTED_CONTENT | param_expansion | glob
single_quoted_segment : "'" SINGLE_QUOTED_CONTENT "'"
double_quoted_segment : "\"" (DOUBLE_QUOTED_CONTENT | param_expansion) "\""
comment : /#[^\n\r\f\v]*/
glob : "?" | "*" | "[" /(\!?\]([^\s\]\\]|\\.)*|([^\s\]\\]|\\.)+)*/ "]"
Expand Down Expand Up @@ -393,7 +393,7 @@ def _parse(self, chars: ParseCursor):

self._children = []
for char in chars:
if char in self.config.line_seperators:
if char in self.config.line_separators:
break

elif char.isspace():
Expand All @@ -414,8 +414,8 @@ def _parse(self, chars: ParseCursor):

class Script(SyntaxNode[Line]):
def __init__(self, chars: ParseCursor, config: ParseConfig = ParseConfig()):
if not config.line_seperators:
config.line_seperators = LINE_SEP_CHARS
if not config.line_separators:
config.line_separators = LINE_SEP_CHARS
super().__init__(chars, config)

@property
Expand All @@ -434,7 +434,7 @@ def _parse(self, chars: ParseCursor):

self._children = []
while next_char := chars.peek():
if next_char in self.config.line_seperators:
if next_char in self.config.line_separators:
chars.take()
continue

Expand Down
8 changes: 4 additions & 4 deletions poethepoet/helpers/command/ast_core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This module core a framework for defining heirarchical parser and ASTs.
This module core a framework for defining hierarchical parser and ASTs.
See sibling ast module for an example usage.
"""

Expand Down Expand Up @@ -89,15 +89,15 @@ def __bool__(self):

class ParseConfig:
substitute_nodes: Dict[Type["AstNode"], Type["AstNode"]]
line_seperators: str
line_separators: str

def __init__(
self,
substitute_nodes: Optional[Dict[Type["AstNode"], Type["AstNode"]]] = None,
line_seperators="",
line_separators="",
):
self.substitute_nodes = substitute_nodes or {}
self.line_seperators = line_seperators
self.line_separators = line_separators

def resolve_node_cls(self, klass: Type["AstNode"]) -> Type["AstNode"]:
return self.substitute_nodes.get(klass, klass)
Expand Down
2 changes: 1 addition & 1 deletion poethepoet/helpers/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def _apply_substitutions(content: str, subs: List[Substitution]):
return "".join(segments)


# This pattern matches the sequence of chars from the begining of the string that are
# This pattern matches the sequence of chars from the beginning of the string that are
# *probably* a valid identifier
IDENTIFIER_PATTERN = r"[^\s\!-\/\:-\@\[-\^\{-\~`]+"

Expand Down
4 changes: 2 additions & 2 deletions poethepoet/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ def _parse_value(
# Try format expected_type nicely in the error message
if not isinstance(expected_type, tuple):
expected_type = (expected_type,)
formated_type = " | ".join(
formatted_type = " | ".join(
type_.__name__ for type_ in expected_type if type_ is not type(None)
)
raise ConfigValidationError(
f"Option {key!r} should have a value of type: {formated_type}",
f"Option {key!r} should have a value of type: {formatted_type}",
index=index,
)

Expand Down
14 changes: 7 additions & 7 deletions poethepoet/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ def command_event_handler(
def _monkey_patch_cleo(self, prefix: str, task_names: List[str]):
"""
Cleo is quite opinionated about CLI structure and loose about how options are
used, and so doesn't currently support invidual commands having their own way of
interpreting arguments, and forces them to inherit certain options from the
used, and so doesn't currently support individual commands having their own way
of interpreting arguments, and forces them to inherit certain options from the
application. This is a problem for poe which requires that global options are
provided before the task name, and everything after the task name is interpreted
ONLY in terms of the task.
This hack monkey-patches internals of Cleo that are invoked directly after
plugin's are loaded by poetry, and exploits a feature whereby argument and
option parsing are effectively disabled following any occurance of a "--" on the
command line, but parsing of the command name still works! Thus the solution is
to detect when it is a command from this plugin that is about to be executed and
insert the "--" token at the start of the tokens list of the ArgvInput instance
that the application is about to read the CLI options from.
option parsing are effectively disabled following any occurrence of a "--" on
the command line, but parsing of the command name still works! Thus the solution
is to detect when it is a command from this plugin that is about to be executed
and insert the "--" token at the start of the tokens list of the ArgvInput
instance that the application is about to read the CLI options from.
Hopefully this doesn't get broken by a future update to poetry or cleo :S
"""
Expand Down
6 changes: 3 additions & 3 deletions poethepoet/task/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ArgSpec(PoeOptions):
@classmethod
def normalize(cls, args_def: ArgsDef, strict: bool = True):
"""
Becuase arguments can be declared with different structures
Because arguments can be declared with different structures
(i.e. dict or list), this function normalizes the input into a list of
dictionaries with necessary keys.
Expand All @@ -72,7 +72,7 @@ def normalize(cls, args_def: ArgsDef, strict: bool = True):
)
elif strict:
raise ConfigValidationError(
f"Argument {item!r} has invlaid type, a string or dict is "
f"Argument {item!r} has invalid type, a string or dict is "
"expected"
)

Expand Down Expand Up @@ -177,7 +177,7 @@ def _validate(self):

if self.multiple is not False and self.type == "boolean":
raise ConfigValidationError(
"Argument with type 'boolean' may not delcare option 'multiple'"
"Argument with type 'boolean' may not declare option 'multiple'"
)


Expand Down
2 changes: 1 addition & 1 deletion poethepoet/task/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

class MetaPoeTask(type):
"""
This metaclass makes all decendents of PoeTask (task types) register themselves on
This metaclass makes all descendents of PoeTask (task types) register themselves on
declaration and validates that they include the expected class attributes.
"""

Expand Down
2 changes: 1 addition & 1 deletion poethepoet/task/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def _locate_interpreter(self, interpreter: str) -> Optional[str]:
elif interpreter == "bash":
if self._is_windows:
# Specifically look for git bash on windows as the preferred option
# Don't trust bash from the path becuase it might be a useless decoy
# Don't trust bash from the path because it might be a useless decoy
result = (
which(f"{prog_files}\\Git\\bin\\bash.exe")
or which("/bin/bash")
Expand Down
2 changes: 1 addition & 1 deletion poethepoet/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def build_parser(self) -> "ArgumentParser":
help="Specify where to find the pyproject.toml",
)

# legacy --root parameter, keep for backwards compatability but help output is
# legacy --root parameter, keep for backwards compatibility but help output is
# suppressed
parser.add_argument(
"--root",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ poethepoet = "poethepoet.plugin:PoetryPlugin"
_clean_docs.script = "shutil:rmtree('docs/_build', ignore_errors=1)"

[tool.poe.tasks.format]
help = "Run all formating tools on the code base"
help = "Run all formatting tools on the code base"
sequence = ["format-ruff", "format-black"]

[tool.poe.tasks.format-ruff]
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/includes_project/greet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_greeting = "Hello"

[tool.poe.tasks]
echo.cmd = "poe_test_echo echo echo"
echo.help = "This is ignored becuase it's already defined!"
echo.help = "This is ignored because it's already defined!"

greet = "poe_test_echo $default_greeting"

Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/includes_project/laugh.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"echo": {
"shell": "poe_test_echo echo echo echo echo echo echo echo",
"help": "This is ignored becuase it's already defined!"
"help": "This is ignored because it's already defined!"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ignore_fail.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_return_non_zero(generate_pyproject, run_poe):
assert "Subtasks task_1, task_2 returned non-zero exit status" in result.capture


def test_invalid_ingore_value(generate_pyproject, run_poe):
def test_invalid_ignore_value(generate_pyproject, run_poe):
project_path = generate_pyproject(ignore_fail="invalid_value")
result = run_poe("all_tasks", cwd=project_path)
assert result.code == 1, "Expected non-zero result"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_docs_for_only_includes(run_poe_subproc, projects):
)
assert (
"CONFIGURED TASKS\n"
" echo This is ignored becuase it's already defined!\n" # or not
" echo This is ignored because it's already defined!\n" # or not
" greet \n"
" greet1 \n"
" greet2 Issue a greeting from the Iberian Peninsula\n"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_script_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ def test_wrong_args_passed(run_poe_subproc):
assert result.stderr == (f"{base_error} unrecognized arguments: --age 3 2 1\n")

result = run_poe_subproc(
"greet-full-args", "--potatoe", project="scripts", env=no_venv
"greet-full-args", "--potato", project="scripts", env=no_venv
)
assert result.capture == ""
assert result.stdout == ""
assert result.stderr == (f"{base_error} unrecognized arguments: --potatoe\n")
assert result.stderr == (f"{base_error} unrecognized arguments: --potato\n")


def test_required_args(run_poe_subproc):
Expand Down Expand Up @@ -244,15 +244,15 @@ def test_script_with_positional_args(run_poe_subproc):
assert result.stdout == "help! Santa\n"
assert result.stderr == ""

# Ommission of optional positional arg
# Omission of optional positional arg
result = run_poe_subproc(
"greet-positional", "Santa", project="scripts", env=no_venv
)
assert result.capture == "Poe => greet-positional Santa\n"
assert result.stdout == "yo Santa\n"
assert result.stderr == ""

# Ommission of required positional arg
# Omission of required positional arg
result = run_poe_subproc("greet-positional", project="scripts", env=no_venv)
assert result.capture == ""
assert result.stdout == ""
Expand Down

0 comments on commit 7b0fa64

Please sign in to comment.