Skip to content

Commit

Permalink
docs(typos): fix typos using enchant+pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed May 25, 2016
1 parent b25c3ea commit 9719509
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 32 deletions.
72 changes: 72 additions & 0 deletions .spell
@@ -0,0 +1,72 @@
accessor
anyxml
API
arg
args
ast
attr
bool
builtin
chainable
cli
config
conftest
ctx
dasherize
dasherizes
dict
dicts
dir
docstring
DSL
env
eval
func
html
https
ietf
init
IO
kwargs
meth
namespace
noqa
ok
org
plugin
plugins
pre
py
pyang
pyangext
pytest
pythonhosted
RPC
RPCs
seealso
setuptools
singularize
stateful
stateless
stderr
stdout
str
substmts
sys
todo
tuple
tuples
typedef
typedefs
unicode
unprefixed
URL
urn
username
usernames
usr
utf
utils
wiki
wikipedia
wtf
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -17,12 +17,14 @@ addons:
packages:
- git
- python-pip
- python-enchant
install:
- source tests/travis_install.sh
- pip install -r requirements.txt
- pip install -r test-requirements.txt
# force pyang version with patches
- pip install -I git+https://github.com/abravalheri/pyang.git@deploy
- pip install pyenchant
script:
- python setup.py test
after_success:
Expand Down
6 changes: 3 additions & 3 deletions pyangext/__init__.py
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""Critical missing features for ``pyang`` plugin users and authors
``pyangext`` is an abbreviation for **pyang** + sensible **ext**ensions
``pyangext`` is an abbreviation for **pyang** + sensible **extensions**
Plugin Auto-Registering
=======================
No need for coping and pasting ``.py`` files inside
``pyang`` instalation dir or manually setting ``PYANG_PLUGINPATH``
``pyang`` installation dir or manually setting ``PYANG_PLUGINPATH``
environment variable. By using the ``pyangext`` command line tool all the
plugins registered using ``setuptools`` entry-points are auto-detected.
See :mod:`pyangext.__main__`.
.. seealso:: module :mod:`pyangext.paths`.
YANG module expansion
Expand Down
6 changes: 3 additions & 3 deletions pyangext/cli.py
Expand Up @@ -19,7 +19,7 @@
.. note:: Including non pyang-plugin python files alongside pyang-plugins
python files (in the same directory) will result in a pyang CLI crash.
It is recomended that the function registered as entry-point follows
It is recommended that the function registered as entry-point follows
the proprietary pyang plugin convention, or in other words:
- it should be named ``pyang_plugin_init``
- it should call ``pyang.plugin.register_plugin`` with an instance of
Expand Down Expand Up @@ -47,7 +47,7 @@
discovered plugin path.
This may be used by shell script to configure
``PYANG_PLUGINPATH`` evironment variable.
``PYANG_PLUGINPATH`` environment variable.
Example:
eval $(pyangext --export-path)
Expand Down Expand Up @@ -108,7 +108,7 @@ def export_path(ctx, _, value):
Prints an export shell statement with the auto discovered plugin path.
This may be used by shell script to configure ``PYANG_PLUGINPATH``
evironment variable.
environment variable.
Example: eval $(pyangext --export-path)
"""
Expand Down
2 changes: 1 addition & 1 deletion pyangext/paths.py
Expand Up @@ -44,7 +44,7 @@ def discover():


def expanded():
"""Combines the autodiscovered plugin paths with env ``PYANG_PLUGINPATH``.
"""Combines the auto-discovered plugin paths with env ``PYANG_PLUGINPATH``.
This function appends paths discovered using ``discover`` function
to the list provided by ``PYANG_PLUGINPATH`` environment variable.
Expand Down
21 changes: 11 additions & 10 deletions pyangext/utils.py
Expand Up @@ -35,7 +35,7 @@
'keep_comments': True,
'no_path_recurse': False,
'trim_yin': False,
'yang_canonical': True,
'yang_canonical': False,
'yang_remove_unused_imports': False,
# -- errors
'ignore_error_tags': [],
Expand Down Expand Up @@ -120,8 +120,8 @@ def compare_prefixed(arg1, arg2,
Returns:
bool
"""
cmp1 = qualify_str(arg1, prefix_sep=PREFIX_SEPARATOR)
cmp2 = qualify_str(arg2, prefix_sep=PREFIX_SEPARATOR)
cmp1 = qualify_str(arg1, prefix_sep=prefix_sep)
cmp2 = qualify_str(arg2, prefix_sep=prefix_sep)

if ignore_prefix:
return cmp1[-1:] == cmp2[-1:]
Expand Down Expand Up @@ -163,20 +163,21 @@ def select(statements, keyword=None, arg=None, ignore_prefix=False):
def find(parent, keyword=None, arg=None, ignore_prefix=False):
"""Select all sub-statements by keyword, or argument or both.
See :func:`select`
.. seealso:: function :func:`select`
"""
return select(parent.substmts, keyword, arg, ignore_prefix)


def walk(parent, select=lambda x: x, apply=lambda x: x, key='substmts'):
# pylint: disable=redefined-builtin,redefined-outer-name
"""Recursivelly find nodes and/or apply a function to them.
Arguments:
parent (pyang.staments.Statement): root of the subtree were
parent (pyang.statements.Statement): root of the subtree were
the search will take place.
select: optional callable that receives a node and returns a bool
(True if the node matches the criteria)
apply: optinal callable that are going to be applied to the node
apply: optional callable that are going to be applied to the node
if it matches the criteria
key (str): property where the children nodes are stored,
default is ``substmts``
Expand Down Expand Up @@ -206,9 +207,9 @@ def dump(node, file_obj=None, prev_indent='', indent_string=' ', ctx=None):
a string
Keyword Arguments:
prev_indent (str): string to be added to the produced identation
indent_string (str): string to be used as identation
ctx (pyang.Context): contex object used to generate string
prev_indent (str): string to be added to the produced indentation
indent_string (str): string to be used as indentation
ctx (pyang.Context): context object used to generate string
representation. If no context is passed, a dummy object
is used with default configuration
Expand All @@ -223,7 +224,7 @@ def dump(node, file_obj=None, prev_indent='', indent_string=' ', ctx=None):
ctx or create_context(), node, _file_obj, 1, None,
prev_indent, indent_string)

# oneliners <3: if no file_obj get buffer content and close it!
# one-liners <3: if no file_obj get buffer content and close it!
return file_obj or (_file_obj.getvalue(), _file_obj.close())[0]


Expand Down
8 changes: 4 additions & 4 deletions pylintrc
Expand Up @@ -127,7 +127,7 @@ expected-line-ending-format=LF
bad-functions=map,filter

# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,ex,_,x,y,X,Y
good-names=i,j,k,x,y,X,Y,fp,ex,_

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
Expand Down Expand Up @@ -231,13 +231,13 @@ notes=FIXME,XXX,TODO

# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
spelling-dict=
spelling-dict=en_US

# List of comma separated words that should not be checked.
spelling-ignore-words=
spelling-ignore-words=API,DSL,RPC,URL,RFC

# A path to a file that contains private dictionary; one word per line.
spelling-private-dict-file=
spelling-private-dict-file=.spell

# Tells whether to store unknown words to indicated private dictionary in
# --spelling-private-dict-file option instead of raising a message.
Expand Down
10 changes: 5 additions & 5 deletions tests/test_cli.py
Expand Up @@ -27,16 +27,16 @@ class CliExecutionAbort(RuntimeError):

@pytest.fixture
def run_command(tmpdir_factory, monkeypatch):
"""Fixture to run CLI command with arguments traping stdout and stderr"""
"""Fixture to run CLI command with arguments trapping stdout and stderr"""

def _run(command, *args):
"""Run CLI command with arguments traping stdout and stderr
"""Run CLI command with arguments trapping stdout and stderr
Arguments:
args (list): command line options and arguments
Returns:
tuple: (captured stdout, captured stdin)
tuple: (captured stdout, captured stderr)
"""
# prepare command options and arguments
monkeypatch.setattr(sys, 'argv', ['pyangext'] + list(args))
Expand All @@ -45,7 +45,7 @@ def _run(command, *args):
stdout_file = str(io_dir.join("stdout.txt").realpath())
stderr_file = str(io_dir.join("stderr.txt").realpath())

# Trap IO
# Trap input/output
with open(stdout_file, 'w') as trap_stdout, \
open(stderr_file, 'w') as trap_stderr:

Expand All @@ -62,7 +62,7 @@ def _run(command, *args):
except CliExecutionAbort:
pass

# Untrap IO
# Untrap input/output
sys.stdout, sys.stderr = old_stdout, old_stderr

# Untrap sys.exit
Expand Down
6 changes: 3 additions & 3 deletions tests/test_find.py
Expand Up @@ -31,9 +31,9 @@ def container():

def test_find(container):
"""
should find direct substatements by keyword + arg
should find direct substatements by keyword
should find direct substatements by arg
should find direct sub-statements by keyword + arg
should find direct sub-statements by keyword
should find direct sub-statements by arg
should return StatementWrapper
should not ignore prefix if no ``ignore_prefix`` were passed
should ignore prefix in keyword if ``ignore_prefix`` were passed
Expand Down
4 changes: 2 additions & 2 deletions tests/test_parse.py
Expand Up @@ -74,7 +74,7 @@ def test_not_warn_invalid_string_if_none_option(ctx, warning_type, text):
('EXPECTED_ARGUMENT', 'module a { keyword }'),
('INCOMPLETE_STATEMENT', 'module a { leaf a { leaf type }'),
('EOF_ERROR', '/* unterminated comment'),
# this do not need to be exaustive,
# this do not need to be exhaustive,
# just ensure exceptions are raised
])

Expand Down Expand Up @@ -116,7 +116,7 @@ def test_not_raise_invalid_string_if_ignore_tag(ctx, error_type, text):
'description "BEST DESCRIPTION EVER!!";',
'// this is a single line comment\nleaf name { type string; }',
'/* this is a\nmulti-line\ncomment */leaf name { type string; }',
# this do not need to be exaustive,
# this do not need to be exhaustive,
# just parser produce Statement
])
def test_parse_valid_string(text):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_paths.py
Expand Up @@ -26,7 +26,7 @@ def test_discover(dummy_plugin_dir, register_dummy_plugin):
def test_expanded(dummy_plugin_dir, register_dummy_plugin):
"""
expanded should contain PYANG_PLUGINPATH
expanded should keep order with PYANG_PLUGINPATH in the begining
expanded should keep order with PYANG_PLUGINPATH in the beginning
expanded should not contain duplicated values
"""
register_dummy_plugin()
Expand Down

0 comments on commit 9719509

Please sign in to comment.