Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flake8 warning W504, disable W503 #158

Open
wants to merge 4 commits into
base: v0.2.0-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Sphinx==1.2.3
check-manifest==0.21
coverage==3.7.1
flake8==2.2.3
flake8==3.7.8
sphinx-rtd-theme==0.1.6
tox==1.9.0
pytest==2.6.4
Expand Down
2 changes: 1 addition & 1 deletion ramlfications/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def validate(raml, config_file=None):
with :py:class:`.loader.RAMLLoader` then validates with \
:py:func:`.validate.validate_raml`.

:param str raml: Either string path to the RAML file, a file object, \or
:param str raml: Either string path to the RAML file, a file object, or \
a string representation of RAML.
:param str config_file: String path to desired config file, if any.
:return: No return value if successful
Expand Down
20 changes: 10 additions & 10 deletions ramlfications/models/resource_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ResourceTypeNode(BaseNode):
method. Else, resource must implement the method.
:param str usage: Usage of resource type, or ``None``
:param bool optional: Inherited if resource defines method.
:param list is\_: List of assigned trait names, or ``None``
:param list is\_: List of assigned trait names, or ``None`` # noqa: W605
:param list traits: List of assigned :py:class:`TraitNode` objects, \
or ``None``
:param str secured_by: List of ``str`` s or ``dict`` s of assigned \
Expand All @@ -35,15 +35,15 @@ class ResourceTypeNode(BaseNode):
defaults to ``name``

"""
name = attr.ib()
name = attr.ib()
# TODO: abstract validator in BaseNode
# raw = attr.ib(repr=False, validator=defined_resource_type)
type = attr.ib(repr=False, validator=assigned_res_type)
method = attr.ib(repr=False)
usage = attr.ib(repr=False)
optional = attr.ib(repr=False)
is_ = attr.ib(repr=False, validator=assigned_traits)
traits = attr.ib(repr=False)
secured_by = attr.ib(repr=False)
type = attr.ib(repr=False, validator=assigned_res_type)
method = attr.ib(repr=False)
usage = attr.ib(repr=False)
optional = attr.ib(repr=False)
is_ = attr.ib(repr=False, validator=assigned_traits)
traits = attr.ib(repr=False)
secured_by = attr.ib(repr=False)
security_schemes = attr.ib(repr=False)
display_name = attr.ib(repr=False)
display_name = attr.ib(repr=False)
26 changes: 13 additions & 13 deletions ramlfications/models/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class ResourceNode(BaseNode):
:param str path: relative path of resource
:param str absolute_uri: Absolute URI of resource: \
:py:class:`RootNodeAPI08`'s ``base_uri`` + ``path``
:param list is\_: A list of ``str`` s or ``dict`` s of resource-assigned \
traits, or ``None``
:param list is\_: A list of ``str`` s or ``dict`` s of \ # noqa: W605
resource-assigned traits, or ``None``
:param list traits: A list of assigned :py:class:`TraitNode` objects, \
or ``None``
:param str type: The name of the assigned resource type, or ``None``
Expand All @@ -36,15 +36,15 @@ class ResourceNode(BaseNode):
:param list security_schemes: A list of assigned \
:py:class:`parameters.SecurityScheme` objects, or ``None``.
"""
name = attr.ib(repr=False)
parent = attr.ib(repr=False)
method = attr.ib()
display_name = attr.ib(repr=False)
path = attr.ib()
absolute_uri = attr.ib(repr=False)
is_ = attr.ib(repr=False, validator=assigned_traits)
traits = attr.ib(repr=False)
type = attr.ib(repr=False, validator=assigned_res_type)
resource_type = attr.ib(repr=False)
secured_by = attr.ib(repr=False)
name = attr.ib(repr=False)
parent = attr.ib(repr=False)
method = attr.ib()
display_name = attr.ib(repr=False)
path = attr.ib()
absolute_uri = attr.ib(repr=False)
is_ = attr.ib(repr=False, validator=assigned_traits)
traits = attr.ib(repr=False)
type = attr.ib(repr=False, validator=assigned_res_type)
resource_type = attr.ib(repr=False)
secured_by = attr.ib(repr=False)
security_schemes = attr.ib(repr=False)
4 changes: 2 additions & 2 deletions ramlfications/parser/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def __init__(self, data, config):
self.resolve_from = []

def create_node(self):
raise NotImplemented()
raise NotImplementedError()

def create_node_dict(self):
raise NotImplemented()
raise NotImplementedError()

def create_param_objects(self, param):
"""
Expand Down
2 changes: 1 addition & 1 deletion ramlfications/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _parse_xml_data(xml_data):
if not registries:
msg = "No registries found to parse."
raise MediaTypeError(msg)
if len(registries) is not 9:
if len(registries) != 9:
msg = ("Expected 9 registries but parsed "
"{0}".format(len(registries)))
raise MediaTypeError(msg)
Expand Down
264 changes: 132 additions & 132 deletions tests/data/fixtures/tree_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,148 +25,148 @@
# call `colored()` around the pipe separately.

tree_light = (
colored("==================================", "white") + "\n" +
colored("Spotify Web API Demo - Simple Tree", "yellow") + "\n" +
colored("==================================", "white") + "\n" +
colored("Base URI: https://api.spotify.com/v1", "yellow") + "\n" +
colored("|", "green", attrs=["bold"]) +
colored("- /tracks", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" - /tracks/{id}", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored("- /users/{user_id}/playlists", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" - /users/{user_id}/playlists/{playlist_id}", "green",
attrs=["bold"]) + "\n"
colored("==================================", "white") + "\n"
+ colored("Spotify Web API Demo - Simple Tree", "yellow") + "\n"
+ colored("==================================", "white") + "\n"
+ colored("Base URI: https://api.spotify.com/v1", "yellow") + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored("- /tracks", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" - /tracks/{id}", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored("- /users/{user_id}/playlists", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" - /users/{user_id}/playlists/{playlist_id}", "green",
attrs=["bold"]) + "\n"
)

tree_dark = (
colored("==================================", "grey") + "\n" +
colored("Spotify Web API Demo - Simple Tree", "grey",
attrs=["bold"]) + "\n" +
colored("==================================", "grey") + "\n" +
colored("Base URI: https://api.spotify.com/v1",
"grey", attrs=["bold"]) + "\n" +
colored("|", "grey", attrs=["bold"]) +
colored("- /tracks", "grey", attrs=["bold"]) + "\n" +
colored("|", "grey", attrs=["bold"]) +
colored(" - /tracks/{id}", "grey", attrs=["bold"]) + "\n" +
colored("|", "grey", attrs=["bold"]) +
colored("- /users/{user_id}/playlists", "grey", attrs=["bold"]) + "\n" +
colored("|", "grey", attrs=["bold"]) +
colored(" - /users/{user_id}/playlists/{playlist_id}", "grey",
attrs=["bold"]) + "\n"
colored("==================================", "grey") + "\n"
+ colored("Spotify Web API Demo - Simple Tree", "grey",
attrs=["bold"]) + "\n" +
+ colored("==================================", "grey") + "\n"
+ colored("Base URI: https://api.spotify.com/v1",
"grey", attrs=["bold"]) + "\n"
+ colored("|", "grey", attrs=["bold"])
+ colored("- /tracks", "grey", attrs=["bold"]) + "\n"
+ colored("|", "grey", attrs=["bold"])
+ colored(" - /tracks/{id}", "grey", attrs=["bold"]) + "\n"
+ colored("|", "grey", attrs=["bold"])
+ colored("- /users/{user_id}/playlists", "grey", attrs=["bold"]) + "\n"
+ colored("|", "grey", attrs=["bold"])
+ colored(" - /users/{user_id}/playlists/{playlist_id}", "grey",
attrs=["bold"]) + "\n"
)

tree_light_v = (
colored("==================================", "white") + "\n" +
colored("Spotify Web API Demo - Simple Tree", "yellow") + "\n" +
colored("==================================", "white") + "\n" +
colored("Base URI: https://api.spotify.com/v1", "yellow") + "\n" +
colored("|", "green", attrs=["bold"]) +
colored("- /tracks", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" - /tracks/{id}", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored("- /users/{user_id}/playlists", "green",
attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" - /users/{user_id}/playlists/{playlist_id}", "green",
attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ PUT", "blue", attrs=["bold"]) + "\n"
colored("==================================", "white") + "\n"
+ colored("Spotify Web API Demo - Simple Tree", "yellow") + "\n"
+ colored("==================================", "white") + "\n"
+ colored("Base URI: https://api.spotify.com/v1", "yellow") + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored("- /tracks", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" - /tracks/{id}", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored("- /users/{user_id}/playlists", "green",
attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" - /users/{user_id}/playlists/{playlist_id}", "green",
attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ PUT", "blue", attrs=["bold"]) + "\n"
)

tree_light_vv = (
colored("==================================", "white") + "\n" +
colored("Spotify Web API Demo - Simple Tree", "yellow") + "\n" +
colored("==================================", "white") + "\n" +
colored("Base URI: https://api.spotify.com/v1", "yellow") + "\n" +
colored("|", "green", attrs=["bold"]) +
colored("- /tracks", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" Query Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ ids", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" - /tracks/{id}", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" URI Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ id", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored("- /users/{user_id}/playlists", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" URI Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ user_id", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" - /users/{user_id}/playlists/{playlist_id}", "green",
attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ PUT", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" URI Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ user_id", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" Form Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ name", "cyan", attrs=["bold"]) + "\n"
colored("==================================", "white") + "\n"
+ colored("Spotify Web API Demo - Simple Tree", "yellow") + "\n"
+ colored("==================================", "white") + "\n"
+ colored("Base URI: https://api.spotify.com/v1", "yellow") + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored("- /tracks", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" Query Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ ids", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" - /tracks/{id}", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" URI Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ id", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored("- /users/{user_id}/playlists", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" URI Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ user_id", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" - /users/{user_id}/playlists/{playlist_id}", "green",
attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ PUT", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" URI Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ user_id", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" Form Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ name", "cyan", attrs=["bold"]) + "\n"
)

tree_light_vvv = (
colored("==================================", "white") + "\n" +
colored("Spotify Web API Demo - Simple Tree", "yellow") + "\n" +
colored("==================================", "white") + "\n" +
colored("Base URI: https://api.spotify.com/v1", "yellow") + "\n" +
colored("|", "green", attrs=["bold"]) +
colored("- /tracks", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" Query Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ ids: Spotify Track IDs", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" - /tracks/{id}", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" URI Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ id: Spotify Track ID", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored("- /users/{user_id}/playlists", "green", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" URI Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ user_id: User ID", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" - /users/{user_id}/playlists/{playlist_id}", "green",
attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ PUT", "blue", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" URI Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ user_id: User ID", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" Form Params", "cyan", attrs=["bold"]) + "\n" +
colored("|", "green", attrs=["bold"]) +
colored(" ⌙ name: Playlist Name", "cyan", attrs=["bold"]) + "\n"
colored("==================================", "white") + "\n"
+ colored("Spotify Web API Demo - Simple Tree", "yellow") + "\n"
+ colored("==================================", "white") + "\n"
+ colored("Base URI: https://api.spotify.com/v1", "yellow") + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored("- /tracks", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" Query Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ ids: Spotify Track IDs", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" - /tracks/{id}", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" URI Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ id: Spotify Track ID", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored("- /users/{user_id}/playlists", "green", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ GET", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" URI Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ user_id: User ID", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" - /users/{user_id}/playlists/{playlist_id}", "green",
attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ PUT", "blue", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" URI Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ user_id: User ID", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" Form Params", "cyan", attrs=["bold"]) + "\n"
+ colored("|", "green", attrs=["bold"])
+ colored(" ⌙ name: Playlist Name", "cyan", attrs=["bold"]) + "\n"
)
Loading