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

Remove comments #136

Merged
merged 3 commits into from Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
@@ -1,3 +1,3 @@
[flake8]
select = F
select = E3, E4, F
per-file-ignores = __init__.py:F401
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/agile_innovative/blinkstick/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/compulab/fit_statusb/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
8 changes: 0 additions & 8 deletions chroma_feedback/consumer/elgato/streamdeck/device.py
Expand Up @@ -34,8 +34,6 @@ def process_devices(devices : Any, producer_report : List[ProducerReport]) -> Li
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process devices

for device in devices:
if set_device(device, producer_report):
result.append(
Expand All @@ -51,21 +49,15 @@ def process_devices(devices : Any, producer_report : List[ProducerReport]) -> Li
def set_device(device : Any, producer_report : List[ProducerReport]) -> bool:
device.open()

# process report

for index, report in enumerate(producer_report):
if index < device.key_count():
device.set_key_image(index, create_image(device, report))
if 'url' in report and report['url']:
device.set_key_callback(lambda __, key, state : state is True and webbrowser.open(producer_report[key]['url']))

# smooth reset

for index in range(len(producer_report), device.key_count()):
device.set_key_image(index, None)

# close on destroy

atexit.register(lambda : device.close())
return device.is_open() is True

Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/embrava/blynclight/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/embrava/blynclight_mini/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/embrava/blynclight_plus/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/kuando/busylight_alpha/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/kuando/busylight_omega/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/lifx/lifx/core.py
Expand Up @@ -32,8 +32,6 @@ def run(producer_report : List[ProducerReport]) -> List[Consumer]:
sys.exit()
return process_groups(groups, producer_report)

# fallback as needed

lights = filter_lights(get_lights(), ARGS.lifx_light_ip)

if not lights:
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/lifx/lifx/group.py
Expand Up @@ -29,8 +29,6 @@ def process_groups(groups : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process groups

for group in groups:
set_group(group, color.get_by_status(status))
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/lifx/lifx/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
set_light(light, color.get_by_status(status))
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/luxafor/flag/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/luxafor/mute/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/luxafor/orb/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/magic/hue/light.py
Expand Up @@ -20,8 +20,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
set_light(light, color.get_by_status(status))
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/muteme/muteme/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/muteme/muteme_mini/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/mutesync/mutesync/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/nanoleaf/nanoleaf/light.py
Expand Up @@ -20,8 +20,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/philips/hue/core.py
Expand Up @@ -40,8 +40,6 @@ def run(producer_report : List[ProducerReport]) -> List[Consumer]:
sys.exit()
return process_groups(groups, producer_report)

# fallback as needed

lights = filter_lights(get_lights(ARGS.philips_hue_bridge_ip), ARGS.philips_hue_light_id)

if not lights:
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/philips/hue/group.py
Expand Up @@ -28,8 +28,6 @@ def process_groups(groups : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process groups

for index in groups:
set_group(groups[index]['name'], color.get_by_status(status))
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/philips/hue/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
set_light(light.name, color.get_by_status(status))
result.append(
Expand Down
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/razer/chroma/device.py
Expand Up @@ -28,8 +28,6 @@ def process_devices(devices : Any, producer_report : List[ProducerReport]) -> Li
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process devices

for device in devices:
if set_device(device, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/signify/wiz/light.py
Expand Up @@ -20,8 +20,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
set_light(light, color.get_by_status(status))
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/thingm/blink1/light.py
Expand Up @@ -28,8 +28,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/consumer/xiaomi/yeelight/light.py
Expand Up @@ -20,8 +20,6 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
result : List[Consumer] = []
status : Status = reporter.resolve_report_status(producer_report)

# process lights

for light in lights:
if set_light(light, color.get_by_status(status)):
result.append(
Expand Down
29 changes: 0 additions & 29 deletions chroma_feedback/core.py
Expand Up @@ -22,23 +22,13 @@ def cli() -> None:

def init(program : ArgumentParser) -> None:
args = helper.get_first(program.parse_known_args())

# init logger

logger.init(args.log_level)

# validate version

if sys.version_info < (3, 8):
logger.error(wording.get('version_not_supported').format(sys.version_info.major, sys.version_info.minor) + wording.get('exclamation_mark'))
sys.exit()

# report header

reporter.print_header()

# handle loop

application = loop.get_application()
timer = loop.get_timer()
timer.setInterval(100)
Expand All @@ -57,8 +47,6 @@ def background_run(program : ArgumentParser) -> None:
args = helper.get_first(program.parse_known_args())
timer = loop.get_timer()

# handle interval

if INTERVAL == args.background_interval * 1000:
run(program)
INTERVAL = 0
Expand All @@ -68,41 +56,24 @@ def background_run(program : ArgumentParser) -> None:

def run(program : ArgumentParser) -> None:
args = helper.get_first(program.parse_known_args())

# process producer

producer_result = producer.process(program)

# handle exit

if not producer_result:
logger.error(wording.get('result_not_found') + wording.get('exclamation_mark'))
sys.exit()

# report producer

producer_report = reporter.create_producer_report(producer_result)

if producer_report:
reporter.print_report(producer_report)

# handle dry run

if args.dry_run is False:

# process consumer

consumer_result = consumer.process(program, producer_report)

# report consumer

consumer_report = reporter.create_consumer_report(consumer_result)

if consumer_report:
reporter.print_report(consumer_report)

# handle systray

if args.background_run is True and loop.is_created() is True:
if systray.is_created() is True:
systray.update(producer_report)
Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/install.py
Expand Up @@ -11,13 +11,11 @@ def write_rule() -> None:
file.write('SUBSYSTEM=="usb", MODE="0666"')
file.close()


@staticmethod
def load_rule() -> None:
os.system('udevadm control --reload')
os.system('udevadm trigger')


def run(self) -> None:
install.run(self)

Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/producer/appveyor/appveyor/core.py
Expand Up @@ -38,8 +38,6 @@ def fetch(host : str, slug : str, token : str) -> List[Producer]:
elif host and token:
response = request.get(host + '/api/projects', headers = request.create_bearer_auth_headers(token))

# process response

if response and response.status_code == 200:
data = request.parse_json(response)

Expand Down
2 changes: 0 additions & 2 deletions chroma_feedback/producer/atlassian/bamboo/core.py
Expand Up @@ -34,8 +34,6 @@ def fetch(host : str, slug : str, token : str) -> List[Producer]:
slug = normalize_slug(slug)
response = request.get(host + '/rest/api/latest/result/' + slug, headers = request.create_bearer_auth_headers(token))

# process response

if response and response.status_code == 200:
data = request.parse_json(response)

Expand Down
4 changes: 0 additions & 4 deletions chroma_feedback/producer/atlassian/bitbucket/core.py
Expand Up @@ -36,8 +36,6 @@ def fetch(host : str, slug : str, token : str) -> List[Producer]:
if host and slug and token:
response = request.get(host + '/2.0/repositories/' + slug + '/pipelines/', headers = request.create_bearer_auth_headers(token))

# process response

if response and response.status_code == 200:
data = request.parse_json(response)

Expand All @@ -62,8 +60,6 @@ def fetch_auth(host : str, username : str, password : str) -> Any:
'grant_type': 'client_credentials'
}, headers = request.create_basic_auth_headers(username, password))

# process response

if response and response.status_code == 200:
data = request.parse_json(response)

Expand Down