Skip to content

Commit 1ca51f3

Browse files
committed
fix typos
1 parent e67387b commit 1ca51f3

12 files changed

+22
-30
lines changed

HOWTO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ and `ndiff = difftool --no-prompt --tool nested_diff` to section `[aliases]`.
5555

5656
Now `ndiff` subcommand available and may be used in the same manner as `diff`.
5757

58-
### How to run tests locally
58+
## How to run tests locally
5959

6060
```sh
6161
# prepare environment

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ $ nested_diff a.json b.json
4040
```
4141

4242
```sh
43-
$ nested_diff a.json b.json --ofmt json > patch.json
44-
$ nested_patch a.json patch.json
43+
nested_diff a.json b.json --ofmt json > patch.json
44+
nested_patch a.json patch.json
4545
```
4646

4747
## Library usage

nested_diff/cli.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class App:
3333
version = nested_diff.__version__
3434

3535
def __init__(self, args=None):
36-
"""Initialize appplication.
36+
"""Initialize application.
3737
3838
Args:
3939
args: Command line arguments; sys.argv used by default.
@@ -90,30 +90,26 @@ def get_optional_args_parser(self):
9090
version=f'%(prog)s {self.version}',
9191
help='print version and exit',
9292
)
93-
9493
parser.add_argument(
9594
'--ifmt',
9695
type=str,
9796
default=self.default_ifmt,
9897
choices=sorted(self.supported_ifmts),
9998
help='input files format; "%(default)s" is used by default',
10099
)
101-
102100
parser.add_argument(
103101
'--ifmt-opts',
104102
metavar='JSON',
105103
type=str,
106104
help='input files format options (JSON string)',
107105
)
108-
109106
parser.add_argument(
110107
'--ofmt',
111108
type=str,
112109
default=self.default_ofmt,
113110
choices=sorted(self.supported_ofmts),
114111
help='output files format; "%(default)s" is used by default',
115112
)
116-
117113
parser.add_argument(
118114
'--ofmt-opts',
119115
metavar='JSON',
@@ -156,7 +152,7 @@ def get_dumper(fmt, **kwargs):
156152

157153
@staticmethod
158154
def guess_fmt(fp, default, ignore_fps=(sys.stdin, sys.stdout, sys.stderr)):
159-
"""Guess format of a file object according it's extention."""
155+
"""Guess format of a file object according it's extension."""
160156
if fp in ignore_fps:
161157
return default
162158

@@ -169,7 +165,7 @@ def guess_fmt(fp, default, ignore_fps=(sys.stdin, sys.stdout, sys.stderr)):
169165

170166
@staticmethod
171167
def get_loader(fmt, **kwargs):
172-
"""Create data loader object accordint to passed format.
168+
"""Create data loader object according to passed format.
173169
174170
Args:
175171
fmt: Loader format.
@@ -220,11 +216,11 @@ def override_excepthook():
220216
221217
"""
222218

223-
def overrided(*args, **kwargs):
219+
def overridden(*args, **kwargs):
224220
sys.__excepthook__(*args, **kwargs) # do all the same
225221
raise SystemExit(127) # but change exit code
226222

227-
sys.excepthook = overrided
223+
sys.excepthook = overridden
228224

229225
def run(self):
230226
"""App object entry point.
@@ -431,7 +427,7 @@ def decode(self, data):
431427
for option in self.decoder.options(section):
432428
out[section][option] = self.decoder.get(section, option)
433429

434-
# cleanup (parser accumulates all readed confs)
430+
# cleanup (parser accumulates all confs)
435431
self.decoder.remove_section(section)
436432

437433
return out

nested_diff/diff_tool.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def get_optional_args_parser(self):
115115
help="don't diff arguments, just format and show them; nested "
116116
'diffs expected for input',
117117
)
118-
119118
parser.add_argument(
120119
'--text-ctx',
121120
default=3,
@@ -124,22 +123,19 @@ def get_optional_args_parser(self):
124123
help='amount of context lines for text (multiline strings) diffs; '
125124
'negative value will disable such diffs, default is "%(default)s"',
126125
)
127-
128126
parser.add_argument(
129127
'--out',
130128
default=sys.stdout,
131129
metavar='FILE',
132130
type=argparse.FileType('w'),
133131
help='output file; STDOUT is used if omitted',
134132
)
135-
136133
parser.add_argument(
137134
'-q',
138135
'--quiet',
139136
action='store_true',
140137
help="don't show diff, exit code is the only difference indicator",
141138
)
142-
143139
parser.add_argument(
144140
'--values',
145141
choices=('repr', 'none', 'json', 'yaml'),

tests/cli/shared.text.a.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"text": "Common line,\nanother common line.\nAnd one more common line.\nStill a common line, but last, next will be different.\nFirst string for a.\nSecond striing for a.\nThird string, belongs to file a.\nAnd fourth. Again to a.\nWow! Common strings began! =)\nAnother common line.\nDifferent line. AAaaaaa!!\nAaaaa!!\nA!\n"
2+
"text": "Common line,\nanother common line.\nAnd one more common line.\nStill a common line, but last, next will be different.\nFirst string for a.\nSecond string for a.\nThird string, belongs to file a.\nAnd fourth. Again to a.\nWow! Common strings began! =)\nAnother common line.\nDifferent line. AAaaaaa!!\nAaaaa!!\nA!\n"
33
}

tests/cli/shared.text.b.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"text": "Common line,\nanother common line.\nAnd one more common line.\nStill a common line, but last, next will be different.\nFirst string for b.\nSecond striing for b.\nThird string, belongs to file b.\nAnd fourth. Again to b.\nWow! Common strings began! =)\nAnother common line.\nDifferent line. BBbbbbb!!\nBbbbb!!\nB!\n"
2+
"text": "Common line,\nanother common line.\nAnd one more common line.\nStill a common line, but last, next will be different.\nFirst string for b.\nSecond string for b.\nThird string, belongs to file b.\nAnd fourth. Again to b.\nWow! Common strings began! =)\nAnother common line.\nDifferent line. BBbbbbb!!\nBbbbb!!\nB!\n"
33
}

tests/cli/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_exit_code_wrong_args():
5656
assert e.value.code == 2
5757

5858

59-
def test_excepthook_overrided():
59+
def test_excepthook_overridden():
6060
orig_id = id(sys.excepthook)
6161
cli.App(args=())
6262

tests/cli/test_diff_tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,15 @@ def test_yaml_ofmt(capsys, expected, rpath):
379379
def test_python_yaml_impl(capsys, expected, rpath):
380380
orig_import = builtins.__import__
381381

382-
def overrided_import(name, globals, locals, fromlist, level): # noqa A002
382+
def overridden_import(name, globals, locals, fromlist, level): # noqa A002
383383
if name == 'yaml' and fromlist is not None:
384384
for sym in ('CSafeDumper', 'CSafeLoader'):
385385
if sym in fromlist:
386386
raise ImportError(f'Mocked import error for yaml.{sym}')
387387

388388
return orig_import(name, globals, locals, fromlist, level) # noqa A002
389389

390-
with mock.patch('builtins.__import__', overrided_import):
390+
with mock.patch('builtins.__import__', overridden_import):
391391
exit_code = nested_diff.diff_tool.App(
392392
args=(
393393
rpath('shared.lists.a.yaml'),

tests/cli/test_diff_tool.test_text_context_0.exp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# <str>
33
@@ -5,4 +5,4 @@
44
- First string for a.
5-
- Second striing for a.
5+
- Second string for a.
66
- Third string, belongs to file a.
77
- And fourth. Again to a.
88
+ First string for b.
9-
+ Second striing for b.
9+
+ Second string for b.
1010
+ Third string, belongs to file b.
1111
+ And fourth. Again to b.
1212
@@ -11,3 +11,3 @@

tests/cli/test_diff_tool.test_text_default.exp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
And one more common line.
66
Still a common line, but last, next will be different.
77
- First string for a.
8-
- Second striing for a.
8+
- Second string for a.
99
- Third string, belongs to file a.
1010
- And fourth. Again to a.
1111
+ First string for b.
12-
+ Second striing for b.
12+
+ Second string for b.
1313
+ Third string, belongs to file b.
1414
+ And fourth. Again to b.
1515
Wow! Common strings began! =)

0 commit comments

Comments
 (0)