Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
obj["color"] = color
output.append(obj)
composites = {"output": self.py3.composite_create(output)}
rainbow = self.py3.safe_format(self.format, composites)
return {"cached_until": self._cycle_time, "full_text": rainbow}
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
msg = "This GPU contains {} supported properties."
for line in gpu_data.splitlines():
gpu = dict(zip(new_properties, line.split(", ")))
gpu = {k: v for k, v in gpu.items() if "[Not Supported]" not in v}
gpu["= " + msg.format(len(gpu))] = ""
gpu["=" * (len(msg) + 2)] = ""
new_gpus.append(gpu)
print(dumps(new_gpus, sort_keys=True, indent=4))
exit()
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
if "DPMS is Enabled" in self.py3.command_output("xset -q"):
self.py3.command_run("xset -dpms s off")
else:
self.py3.command_run("xset +dpms s on")
if event["button"] == self.button_off:
self.py3.command_run("xset dpms force off")
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
return response
def on_click(self, event):
button = event["button"]
if button == self.button_show_notification:
self.py3.notify_user(self.output)
self.py3.prevent_refresh()
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
def on_click(self, event):
button = event["button"]
if button == self.button_next:
self._set_active(1)
if button == self.button_prev:
self._set_active(-1)
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
return {
"cached_until": self.py3.time_in(self.cache_timeout),
"color": color,
"full_text": self.py3.safe_format(
self.format, {"icon": icon, "process": self.process}
),
}
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
self.format, {"bill_amount": bill_amount}
)
response["color"] = self.py3.COLOR_GOOD
else:
response["full_text"] = "Global error - WTF exception"
return response
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
if x in self.load_data:
self.py3.threshold_get_color(self.load_data[x], x)
return {
"cached_until": self.py3.time_in(self.cache_timeout),
"full_text": self.py3.safe_format(self.format, self.load_data),
}
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
conn.on("binding", update_title)
conn.main() # run the event loop
def window_title_async(self):
return {"cached_until": self.py3.CACHE_FOREVER, "full_text": self.title}
if __name__ == "__main__":
"""
Run module in test mode.
"""
config = {"always_show": True}
from py3status.module_test import module_test
module_test(Py3status, config=config)
Switch the displayed module or pass the event on to the active module
"""
if event["button"] == self.button_toggle:
# we only toggle if button was used
if event.get("index") == "button" and self.py3.is_my_event(event):
self.urgent = False
self.open = not self.open
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)