Skip to content

Commit

Permalink
Merge pull request #30 from kianmeng/fix-typos
Browse files Browse the repository at this point in the history
Fixed typos
  • Loading branch information
dhondta committed Jul 27, 2023
2 parents f9affa3 + ae1c95a commit 0bbb868
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion docs/pages/enhancements.md
Expand Up @@ -2,7 +2,7 @@

## `code`

Formerly a set of [helper functions](helpers.md), the followings have been attached to the `code` module, which is now preimported.
Formerly a set of [helper functions](helpers.md), the following have been attached to the `code` module, which is now preimported.

Code can be monkey-patched at runtime using multiple functions, depending on what should be patched and how. Note that some of the functions rely on the [`patchy`](https://github.com/adamchainz/patchy) module.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/helpers.md
Expand Up @@ -483,7 +483,7 @@ And for network-related types:

-----

## Data type tranformation functions
## Data type transformation functions

Tinyscript also provides a series of intuitive data transformation functions, formatted as follows:

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/index.md
Expand Up @@ -66,7 +66,7 @@ pip3 install --user tinyscript

## Rationale

This library is born from the need of efficiently building tools without caring for redefining various things or rewritting/setting the same functionalities like logging or parsing of input arguments.
This library is born from the need of efficiently building tools without caring for redefining various things or rewriting/setting the same functionalities like logging or parsing of input arguments.

In the meantime, I personnally used this library many times to create tools for my daily job or during cybersecurity or programming competitions and it proved very useful when dealing with rapid development.

2 changes: 1 addition & 1 deletion docs/pages/internals.md
Expand Up @@ -100,7 +100,7 @@ if __name__ == '__main__':

## Advanced option clash resolution

When a developper writes a script/tool relying on Tyniscript, every argument or option defined will preceed the default arguments, e.g. `-h` or `--help`. Tinyscript will then add these after the developper-defined ones, then using `argparse`'s conflict resolution first trying with full option strings (e.g. `-v` and `--verbose`), then with the long option string only (`--verbose`). If a name collision occurs, some of the pre-defined arguments use prefixes or suffixes to resolve it so that they can still be parsed. The following lists give the mappings between pre-defined default option names and their resolved names if a collision occurs.
When a developer writes a script/tool relying on Tyniscript, every argument or option defined will precede the default arguments, e.g. `-h` or `--help`. Tinyscript will then add these after the developer-defined ones, then using `argparse`'s conflict resolution first trying with full option strings (e.g. `-v` and `--verbose`), then with the long option string only (`--verbose`). If a name collision occurs, some of the pre-defined arguments use prefixes or suffixes to resolve it so that they can still be parsed. The following lists give the mappings between pre-defined default option names and their resolved names if a collision occurs.


List of "*extra*" arguments and options:
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/shaping.md
Expand Up @@ -93,7 +93,7 @@ DOCFORMAT_THEME = "Star"

!!! warning "Various formats support"

The support for HTML, RestructuredText and Textile is based on document conversion with ['pypandoc'](https://pypi.org/project/pypandoc/) to get Markdown before using [`mdv`](https://github.com/axiros/terminal_markdown_viewer). In some cases with complex formate text, Pandoc can cause issues with indentation or break the layout. It is then advised to only use Markdown directly to avoid any conversion.
The support for HTML, RestructuredText and Textile is based on document conversion with ['pypandoc'](https://pypi.org/project/pypandoc/) to get Markdown before using [`mdv`](https://github.com/axiros/terminal_markdown_viewer). In some cases with complex format text, Pandoc can cause issues with indentation or break the layout. It is then advised to only use Markdown directly to avoid any conversion.

!!! note "List of themes"

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/tsm.md
Expand Up @@ -119,7 +119,7 @@ $ tsm install stegopit --force
00:12:34 [INFO] Script 'stegopit' updated
```
The source to intall the script from can be forced by specifying the `--source` option.
The source to install the script from can be forced by specifying the `--source` option.
```sh
$ tsm install custom-script --source https://example.com/sources.list
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/usage.md
Expand Up @@ -125,7 +125,7 @@ After customizing the metadata, the `initialize` function can be filled with the
```add_interact=[boolean]``` | Add an interaction option.
```add_progress=[boolean]``` | Add an option to show a progress bar.
```add_step=[boolean]``` | Add a stepping mode option, for setting breakpoints into the code by using the `step` function or the `Step` context manager.
```add_time=[boolean]``` | Add an execution timing option, for benchmarking the exeuction by using the `get\_time` and `get\_time\_since\_last` functions or the `Timer` context manager.
```add_time=[boolean]``` | Add an execution timing option, for benchmarking the execution by using the `get\_time` and `get\_time\_since\_last` functions or the `Timer` context manager.
```add_version=[boolean]``` | Add the version option.
```add_wizard=[boolean]``` | Add a wizard option for asking the user to input each value.
```report_func=[function]``` | Add report options (output format, title, stylesheet and filename) by setting a function (taking no argument) that will generate the report at the end of the execution of the script/tool.
Expand Down
24 changes: 12 additions & 12 deletions docs/pages/utility.md
Expand Up @@ -6,7 +6,7 @@ This is achieved by passing a keyword argument `sudo=[boolean]` to `initialize(.

```python hl_lines="3"
...
initalize(...
initialize(...
sudo=True,
...)
...
Expand All @@ -26,7 +26,7 @@ This is achieved by passing a keyword argument `add_demo=[boolean]` to `initiali
...
__examples__ = ["test", "-sv", "-d --test"]
...
initalize(...
initialize(...
add_demo=True,
...)
...
Expand All @@ -44,7 +44,7 @@ This is enabled by passing a keyword argument `add_step=[boolean]` to `initializ

```python hl_lines="3"
...
initalize(...
initialize(...
add_step=True,
...)
...
Expand Down Expand Up @@ -89,7 +89,7 @@ def my_function(...):
# this will measure time for this block of instructions
# it will also stop block's execution after 10 seconds
...
initalize(...
initialize(...
add_time=True,
...)
...
Expand Down Expand Up @@ -121,7 +121,7 @@ This can be done by passing a keyword argument `add_progress=[boolean]` to `init

```python hl_lines="3 6"
...
initalize(...
initialize(...
add_progress=True,
...)
...
Expand Down Expand Up @@ -166,7 +166,7 @@ This is achieved by passing a keyword argument `add_interact=[boolean]` to `init

```python hl_lines="3"
...
initalize(...
initialize(...
add_interact=True,
...)
...
Expand All @@ -182,11 +182,11 @@ This adds multiple options:

## Starting a wizard

This is achieved by passing a keyword argument `add_wizard=[boolean]` to `initialize(...)`. It will interactively ask for prividing arguments to the script/tool.
This is achieved by passing a keyword argument `add_wizard=[boolean]` to `initialize(...)`. It will interactively ask for providing arguments to the script/tool.

```python hl_lines="3"
...
initalize(...
initialize(...
add_wizard=True,
...)
...
Expand All @@ -202,7 +202,7 @@ This is achieved by passing a keyword argument `add_config=[boolean]` to `initia

```python hl_lines="3"
...
initalize(...
initialize(...
add_config=True,
...)
...
Expand All @@ -225,7 +225,7 @@ This is achieved by passing a keyword argument `add_version=[boolean]` to `initi

```python hl_lines="3"
...
initalize(...
initialize(...
add_version=True,
...)
...
Expand All @@ -241,7 +241,7 @@ This is achieved by passing a keyword argument `noargs_action="[action]"` to `in

```python hl_lines="3"
...
initalize(...
initialize(...
noargs_action="...",
...)
...
Expand Down Expand Up @@ -285,7 +285,7 @@ def make_report():
)
...
...
initalize(...
initialize(...
report_func=make_report,
...)
...
Expand Down
4 changes: 2 additions & 2 deletions src/tinyscript/features/timing.py
Expand Up @@ -49,7 +49,7 @@ def _take_time(start=None, descr=None):
if start is not None and descr is not None:
manager.times.append((descr, float(start), float(t)))
return t - (start or 0)
# Time context manager, for easilly benchmarking a block of code
# Time context manager, for easily benchmarking a block of code
class Timer(object):
def __init__(self, description=None, message=TO_MSG, timeout=None, fail_on_timeout=False, precision=True):
self.fail = fail_on_timeout
Expand Down Expand Up @@ -92,7 +92,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback):
if self.timeout is not None:
if not self.fail and exc_type is TimeoutError:
return True # this allows to let the execution continue
# implicitely returns None ; this lets the exception be raised
# implicitly returns None ; this lets the exception be raised

def _handler(self, signum, frame):
raise TimeoutError(self.message)
Expand Down
2 changes: 1 addition & 1 deletion src/tinyscript/helpers/data/transform/common.py
Expand Up @@ -44,7 +44,7 @@ def __validation(**kwargs) -> None:
raise ValueError(f"Bad bits group order '{v}'")
elif k == "s":
if not is_str(v):
raise ValueError(f"Bad input string of 8-bits characaters '{v}'")
raise ValueError(f"Bad input string of 8-bits characters '{v}'")
elif k == "u":
if not isinstance(v, bool):
raise ValueError(f"Bad value for input boolean {v}")
Expand Down
2 changes: 1 addition & 1 deletion src/tinyscript/helpers/dictionaries.py
Expand Up @@ -185,7 +185,7 @@ def __init__(self, items=None, max_age=0, sort_by_time=True, **kwargs):
self[k] = v

def __check_expiration(self, key):
""" Chck for key times and remove expired keys. """
""" Check for key times and remove expired keys. """
t = self.__times.get(key)
if self.max_age > 0 and t is not None and time() - t > self.max_age:
del self[key]
Expand Down
2 changes: 1 addition & 1 deletion src/tinyscript/helpers/docstring.py
Expand Up @@ -61,7 +61,7 @@ def setkv(key, value):
metadata["description"] = value
else:
metadata["comments"].append(value)
# when comments field is explicitely set
# when comments field is explicitly set
elif key == "comments":
metadata["comments"].append(value)
# convert each option to a tuple
Expand Down
6 changes: 3 additions & 3 deletions src/tinyscript/helpers/path.py
Expand Up @@ -45,7 +45,7 @@ def __new__(cls, *parts, **kwargs):
if expand:
p = super(Path, cls).__new__(cls, str(p.expanduser().absolute()), **kwargs)
if create and touch:
raise ValueError("Conflicting options ; 'create' creates a folder hwile 'touch' creates a file")
raise ValueError("Conflicting options ; 'create' creates a folder while 'touch' creates a file")
elif (create or touch) and not p.exists():
if create:
p.mkdir(parents=True) # exist_ok does not work in Python 2
Expand Down Expand Up @@ -137,7 +137,7 @@ def __add_text(self, data, mode='w', encoding=None, errors=None):
return f.write(u(data))

def append_bytes(self, data):
""" Allows to append bytes to the file, as only write_bytes is available in pathlib2, overwritting the former
""" Allows to append bytes to the file, as only write_bytes is available in pathlib2, overwriting the former
bytes at each write. """
with self.open(mode='ab') as f:
return f.write(memoryview(data))
Expand All @@ -152,7 +152,7 @@ def append_lines(self, *lines):
self.append_line(line)

def append_text(self, text, encoding=None, errors=None):
""" Allows to append text to the file, as only write_text is available in pathlib2, overwritting the former text
""" Allows to append text to the file, as only write_text is available in pathlib2, overwriting the former text
at each write. """
return self.__add_text(text, 'a', encoding, errors)

Expand Down
2 changes: 1 addition & 1 deletion src/tinyscript/preimports/hash.py
Expand Up @@ -45,7 +45,7 @@ class LookupTable(dict):
:param algorithm: the hash algorithm to be used
:param ratio: ratio of value to be hashed in the lookup table (by default, every value is considered but, i.e.
with a big wordlist, a ratio of 2/3/4/5/... can be used in order to limit the memory load)
:param dict_filter: function aimed to filter the words from the dictionary (e.g. only alpha-numeric)
:param dict_filter: function aimed to filter the words from the dictionary (e.g. only alphanumeric)
:param prefix: prefix to be prepended to passwords (e.g. a salt)
:param suffix: suffix to be appended to passwords (e.g. a salt)
"""
Expand Down
2 changes: 1 addition & 1 deletion src/tinyscript/preimports/regex.py
Expand Up @@ -120,7 +120,7 @@ def group_gen(v):
empty_yield = True
# tricky case: (|[0-5])? and ([0-5])? give the same outputs, however re.size will give respectively
# 8 and 7 ; why ? because the output value "" is filtered in re.strings
# so, we need to handle this special case by substracting 1 when we have:
# so, we need to handle this special case by subtracting 1 when we have:
# - a subpattern (...)
# - with a branch ...|...
# e.g. [(SUBPATTERN, (1, 0, 0, [(BRANCH, (None, [[], [(IN, [(RANGE, (48, 53))])]]))]))]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_helpers_expressions.py
Expand Up @@ -21,7 +21,7 @@ def test_ast_nodes_evaluation(self):
self.assertIsNotNone(eval_ast_nodes(*EXPRESSIONS))

def test_expression_evaluations(self):
# simple expresions (including list comprehensions and generators)
# simple expressions (including list comprehensions and generators)
for e in EXPRESSIONS:
self.assertIsNotNone(eval2(e))
# missing names
Expand Down

0 comments on commit 0bbb868

Please sign in to comment.