Skip to content

Commit

Permalink
general cleanup with flake8 and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
wuub committed Oct 18, 2016
1 parent 1843a9f commit 73a5619
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 23 deletions.
12 changes: 12 additions & 0 deletions Makefile
@@ -0,0 +1,12 @@
test:
flake8
isort --recursive --check-only --diff
tox

isort:
isort --recursive --apply

clean:
rm -rf .virtualenv dist build *.egg-info

.PHONY: clean isort test
3 changes: 2 additions & 1 deletion README.rst
Expand Up @@ -71,11 +71,12 @@ Contributors
* `@rthill <https://github.com/rthill>`_
* `@jtai <https://github.com/jtai>`_
* `@ahocquet <https://github.com/ahocquet>`_
* `@Raynes <https:/github.com/Raynes>`_
* `@Raynes <https://github.com/Raynes>`_
* `@sdague <https://github.com/sdague>`_
* `@postlund <https://github.com/postlund>`_

Users
=====

* `Home Assistant <https://github.com/home-assistant/home-assistant/>`_

This comment has been minimized.

Copy link
@isolationism

isolationism Jan 25, 2021

Contributor

Begging your pardon for the comment on a 4-year old comment. I know Home Assistant has changed rather a lot in 4 years, but as I am setting my own instance of late, I wondered at this remark: Is there an integration available anywhere?

This comment has been minimized.

Copy link
@isolationism

isolationism Jan 25, 2021

Contributor

I should have waited a few more minutes before posting. Sorry for the trouble, and for other wayward idiots:

https://www.home-assistant.io/integrations/yamaha

* `rxvc <https://github.com/Raynes/rxvc>`_
2 changes: 1 addition & 1 deletion rxv/exceptions.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
from __future__ import absolute_import, division, print_function


class RXVException(Exception):
Expand Down
15 changes: 8 additions & 7 deletions rxv/rxv.py
@@ -1,17 +1,18 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
from __future__ import absolute_import, division, print_function

import re
import copy
import re
import time
import requests
import warnings
import xml.etree.ElementTree as ET
from math import floor
from collections import namedtuple
from math import floor

import requests

from .exceptions import ResponseException, MenuUnavailable, PlaybackUnavailable
from .exceptions import MenuUnavailable, PlaybackUnavailable, ResponseException

try:
from urllib.parse import urlparse
Expand Down Expand Up @@ -41,7 +42,8 @@
ListGet = '<{src_name}><List_Info>GetParam</List_Info></{src_name}>'
ListControlJumpLine = '<{src_name}><List_Control><Jump_Line>{lineno}</Jump_Line>' \
'</List_Control></{src_name}>'
ListControlCursor = '<{src_name}><List_Control><Cursor>{action}</Cursor></List_Control></{src_name}>'
ListControlCursor = '<{src_name}><List_Control><Cursor>{action}</Cursor>'\
'</List_Control></{src_name}>'
VolumeLevel = '<Volume><Lvl>{value}</Lvl></Volume>'
VolumeLevelValue = '<Val>{val}</Val><Exp>{exp}</Exp><Unit>{unit}</Unit>'
VolumeMute = '<Volume><Mute>{state}</Mute></Volume>'
Expand Down Expand Up @@ -212,7 +214,6 @@ def zone_controllers(self):
controllers.append(zone_ctrl)
return controllers


def _src_name(self, cur_input):
if cur_input not in self.inputs():
return None
Expand Down
30 changes: 19 additions & 11 deletions rxv/ssdp.py
@@ -1,12 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
from __future__ import absolute_import, division, print_function

import re
import socket
import requests
from collections import namedtuple
import xml.etree.ElementTree as ET
from collections import namedtuple

import requests

try:
from urllib.parse import urljoin
Expand All @@ -16,18 +17,25 @@

SSDP_ADDR = '239.255.255.250'
SSDP_PORT = 1900
SSDP_MSEARCH_QUERY = \
'M-SEARCH * HTTP/1.1\r\n' \
'MX: 1\r\n' \
'HOST: 239.255.255.250:1900\r\n' \
'MAN: "ssdp:discover"\r\n' \
'ST: upnp:rootdevice\r\n\r\n'
SSDP_MSEARCH_QUERY = (
'M-SEARCH * HTTP/1.1\r\n'
'MX: 1\r\n'
'HOST: 239.255.255.250:1900\r\n'
'MAN: "ssdp:discover"\r\n'
'ST: upnp:rootdevice\r\n\r\n'
)

URL_BASE_QUERY = '*/{urn:schemas-yamaha-com:device-1-0}X_URLBase'
CONTROL_URL_QUERY = '***/{urn:schemas-yamaha-com:device-1-0}X_controlURL'
UNITDESC_URL_QUERY = '***/{urn:schemas-yamaha-com:device-1-0}X_unitDescURL'
MODEL_NAME_QUERY = "{urn:schemas-upnp-org:device-1-0}device/{urn:schemas-upnp-org:device-1-0}modelName"
FRIENDLY_NAME_QUERY = "{urn:schemas-upnp-org:device-1-0}device/{urn:schemas-upnp-org:device-1-0}friendlyName"
MODEL_NAME_QUERY = (
"{urn:schemas-upnp-org:device-1-0}device"
"/{urn:schemas-upnp-org:device-1-0}modelName"
)
FRIENDLY_NAME_QUERY = (
"{urn:schemas-upnp-org:device-1-0}device"
"/{urn:schemas-upnp-org:device-1-0}friendlyName"
)

RxvDetails = namedtuple("RxvDetails", "ctrl_url unit_desc_url, model_name friendly_name")

Expand Down
7 changes: 7 additions & 0 deletions setup.cfg
@@ -1,2 +1,9 @@
[wheel]
universal = 1

[flake8]
exclude = .cache,.git,.tox,.eggs,build,docs/*,*.egg-info
max-line-length = 100

[isort]
skip = .tox,.eggs
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -3,7 +3,8 @@
from __future__ import absolute_import, division, print_function

import sys
from setuptools import setup, find_packages

from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand


Expand Down
5 changes: 3 additions & 2 deletions tests/test_integration.py
@@ -1,10 +1,11 @@
#!/usr/bin/env python
import rxv
import time

import rxv

rx = None


def setup_module(module):
receivers = rxv.find()
if not receivers:
Expand All @@ -20,7 +21,7 @@ def teardown_module(module):


def test_on_off():
assert rx.on == False, "reciver should be turned off"
assert rx.on is False, "reciver should be turned off"
rx.on = True
time.sleep(1.0)
assert rx.on
Expand Down

0 comments on commit 73a5619

Please sign in to comment.