From 66003edbee0886665013472489c5588b54b4bba8 Mon Sep 17 00:00:00 2001 From: Alcheri <121733018+Alcheri@users.noreply.github.com> Date: Sat, 11 Jan 2025 15:53:42 +0000 Subject: [PATCH] :art: Format Python code with psf/black --- ISO/__init__.py | 5 ++-- ISO/config.py | 9 ++++-- ISO/test.py | 2 +- MyPing/__init__.py | 9 +++--- MyPing/config.py | 17 +++++++---- MyPing/local/colour.py | 64 ++++++++++++++++++++++++++-------------- MyPing/plugin.py | 2 -- MyPing/test.py | 9 +++--- OnJoin/__init__.py | 6 ++-- OnJoin/config.py | 14 +++++---- OnJoin/test.py | 2 +- Weatherstack/__init__.py | 8 +++-- Weatherstack/config.py | 32 ++++++++++++-------- Weatherstack/setup.py | 8 ++--- 14 files changed, 115 insertions(+), 72 deletions(-) diff --git a/ISO/__init__.py b/ISO/__init__.py index 06df7c3..58c90f9 100644 --- a/ISO/__init__.py +++ b/ISO/__init__.py @@ -40,18 +40,19 @@ __version__ = "0.1" # XXX Replace this with an appropriate author or supybot.Author instance. -__author__ = 'Barry Suridge ' +__author__ = "Barry Suridge " # This is a dictionary mapping supybot.Author instances to lists of # contributions. __contributors__ = {} # This is a url where the most recent plugin package can be downloaded. -__url__ = '' +__url__ = "" from . import config from . import plugin from importlib import reload + # In case we're being reloaded. reload(config) reload(plugin) diff --git a/ISO/config.py b/ISO/config.py index 7293c01..51b2459 100644 --- a/ISO/config.py +++ b/ISO/config.py @@ -29,9 +29,11 @@ ### from supybot import conf, registry + try: from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('ISO') + + _ = PluginInternationalization("ISO") except: # Placeholder that allows to run the plugin on a bot # without the i18n module @@ -44,10 +46,11 @@ def configure(advanced): # user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn - conf.registerPlugin('ISO', True) + + conf.registerPlugin("ISO", True) -ISO = conf.registerPlugin('ISO') +ISO = conf.registerPlugin("ISO") # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(ISO, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) diff --git a/ISO/test.py b/ISO/test.py index 84568f0..d65849c 100644 --- a/ISO/test.py +++ b/ISO/test.py @@ -32,7 +32,7 @@ class ISOTestCase(PluginTestCase): - plugins = ('ISO',) + plugins = ("ISO",) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/MyPing/__init__.py b/MyPing/__init__.py index dfd862d..c92fe99 100644 --- a/MyPing/__init__.py +++ b/MyPing/__init__.py @@ -10,6 +10,7 @@ """ import sys + # Python 3.3 an above ONLY!! if sys.version_info <= (3, 6): raise RuntimeError("This plugin requires Python 3.6 or above.") @@ -19,22 +20,22 @@ # Use this for the version of this plugin. You may wish to put a CVS keyword # in here if you're keeping the plugin in CVS or some similar system. -__version__ = '1.0.2' +__version__ = "1.0.2" # XXX Replace this with an appropriate author or supybot.Author instance. -__author__ = supybot.Author('Barry Suridge', 'Alcheri', - 'barry.suridge@outlook.com') +__author__ = supybot.Author("Barry Suridge", "Alcheri", "barry.suridge@outlook.com") # This is a dictionary mapping supybot.Author instances to lists of # contributions. __contributors__ = {} # This is a url where the most recent plugin package can be downloaded. -__url__ = 'https://github.com/Alcheri/Plugins.git' +__url__ = "https://github.com/Alcheri/Plugins.git" from . import config from . import plugin from importlib import reload + # In case we're being reloaded. reload(config) reload(plugin) diff --git a/MyPing/config.py b/MyPing/config.py index bb3f2b1..77eec87 100644 --- a/MyPing/config.py +++ b/MyPing/config.py @@ -29,13 +29,16 @@ import supybot.conf as conf import supybot.registry as registry + try: from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('MyPing') + + _ = PluginInternationalization("MyPing") except ImportError: # Placeholder that allows to run the plugin on a bot # without the i18n module - _ = lambda x:x + _ = lambda x: x + def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -43,14 +46,16 @@ def configure(advanced): # user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn - conf.registerPlugin('MyPing', True) + + conf.registerPlugin("MyPing", True) -MyPing = conf.registerPlugin('MyPing') +MyPing = conf.registerPlugin("MyPing") # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(MyPing, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) -conf.registerChannelValue(MyPing, 'enable', - registry.Boolean(False, """Should plugin work in this channel?""")) +conf.registerChannelValue( + MyPing, "enable", registry.Boolean(False, """Should plugin work in this channel?""") +) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/MyPing/local/colour.py b/MyPing/local/colour.py index 3558718..1b680a3 100644 --- a/MyPing/local/colour.py +++ b/MyPing/local/colour.py @@ -1,6 +1,6 @@ - ############## - # FORMATTING # - ############## +############## +# FORMATTING # +############## ## mIRC colour codes # @@ -24,81 +24,101 @@ import supybot.ircutils as utils + def white(s): """Returns a white string.""" - return utils.mircColor(s, 'white') + return utils.mircColor(s, "white") + def black(s): """Returns a black string.""" - return utils.mircColor(s, 'black') + return utils.mircColor(s, "black") + def blue(s): """Returns a blue string.""" - return utils.mircColor(s, 'blue') + return utils.mircColor(s, "blue") + def green(s): """Returns a green string.""" - return utils.mircColor(s, 'green') + return utils.mircColor(s, "green") + def red(s): """Returns a red string.""" - return utils.mircColor(s, 'red') + return utils.mircColor(s, "red") + def brown(s): """Returns a brown string.""" - return utils.mircColor(s, 'brown') + return utils.mircColor(s, "brown") + def purple(s): """Returns a purple string.""" - return utils.mircColor(s, 'purple') + return utils.mircColor(s, "purple") + def orange(s): """Returns a orange string.""" - return utils.mircColor(s, 'orange') + return utils.mircColor(s, "orange") + def yellow(s): """Returns a yellow string.""" - return utils.mircColor(s, 'yellow') + return utils.mircColor(s, "yellow") + def light_green(s): """Returns a light green string.""" - return utils.mircColor(s, 'light green') + return utils.mircColor(s, "light green") + def teal(s): """Returns a teal string.""" - return utils.mircColor(s, 'teal') + return utils.mircColor(s, "teal") + def light_blue(s): """Returns a teal string.""" - return utils.mircColor(s, 'blue') + return utils.mircColor(s, "blue") + def dark_blue(s): """Returns a dark blue string.""" - return utils.mircColor(s, 'dark blue') + return utils.mircColor(s, "dark blue") + def pink(s): """Returns a pink string.""" - return utils.mircColor(s, 'pink') + return utils.mircColor(s, "pink") + def dark_grey(s): """Returns a dark grey string.""" - return utils.mircColor(s, 'dark grey') + return utils.mircColor(s, "dark grey") + def dark_gray(s): """Returns a dark grey string.""" - return utils.mircColor(s, 'dark gray') + return utils.mircColor(s, "dark gray") + def light_grey(s): """Returns a light gray string.""" - return utils.mircColor(s, 'light grey') + return utils.mircColor(s, "light grey") + def light_gray(s): """Returns a light gray string.""" - return utils.mircColor(s, 'light gray') + return utils.mircColor(s, "light gray") + # Non-mIRC def bold(s): """Returns the string s, bolded.""" - return f'\x02{s}\x02' + return f"\x02{s}\x02" + # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/MyPing/plugin.py b/MyPing/plugin.py index 24708b2..cbf0fb5 100644 --- a/MyPing/plugin.py +++ b/MyPing/plugin.py @@ -81,9 +81,7 @@ def _elapsed_loss(loss): class MyPing(callbacks.Plugin): - def __init__(self, irc): - self.__parent = super(MyPing, self) self.__parent.__init__(irc) diff --git a/MyPing/test.py b/MyPing/test.py index 46dcc2d..f8e485b 100644 --- a/MyPing/test.py +++ b/MyPing/test.py @@ -10,10 +10,11 @@ class MyPingTestCase(PluginTestCase): - plugins = ('MyPing',) + plugins = ("MyPing",) def testSimple(self): - self.assertNotError('myping ping google.com') - self.assertNotError('myping ping 2a03:2880:f119:8083:face:b00c:0:25de') - + self.assertNotError("myping ping google.com") + self.assertNotError("myping ping 2a03:2880:f119:8083:face:b00c:0:25de") + + # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/OnJoin/__init__.py b/OnJoin/__init__.py index 5ab3493..3fd26cc 100644 --- a/OnJoin/__init__.py +++ b/OnJoin/__init__.py @@ -21,19 +21,19 @@ __version__ = "0.02" # XXX Replace this with an appropriate author or supybot.Author instance. -__author__ = supybot.Author('Barry Suridge', 'Alcheri', - 'barry.suridge@outlook.com') +__author__ = supybot.Author("Barry Suridge", "Alcheri", "barry.suridge@outlook.com") # This is a dictionary mapping supybot.Author instances to lists of # contributions. __contributors__ = {} # This is a url where the most recent plugin package can be downloaded. -__url__ = 'https://github.com/Alcheri/Plugins.git' +__url__ = "https://github.com/Alcheri/Plugins.git" from . import config from . import plugin from importlib import reload + # In case we're being reloaded. reload(config) reload(plugin) diff --git a/OnJoin/config.py b/OnJoin/config.py index 2abab96..61561f4 100644 --- a/OnJoin/config.py +++ b/OnJoin/config.py @@ -7,9 +7,11 @@ import supybot.conf as conf import supybot.registry as registry + try: from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('OnJoin') + + _ = PluginInternationalization("OnJoin") except: # Placeholder that allows to run the plugin on a bot # without the i18n module @@ -22,13 +24,15 @@ def configure(advanced): # user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn - conf.registerPlugin('OnJoin', True) + + conf.registerPlugin("OnJoin", True) -OnJoin = conf.registerPlugin('OnJoin') +OnJoin = conf.registerPlugin("OnJoin") # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(OnJoin, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) -conf.registerChannelValue(OnJoin, 'enable', - registry.Boolean(False, """Should plugin work in this channel?""")) +conf.registerChannelValue( + OnJoin, "enable", registry.Boolean(False, """Should plugin work in this channel?""") +) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/OnJoin/test.py b/OnJoin/test.py index cdd894e..a398bcf 100644 --- a/OnJoin/test.py +++ b/OnJoin/test.py @@ -9,7 +9,7 @@ class OnJoinTestCase(PluginTestCase): - plugins = ('OnJoin',) + plugins = ("OnJoin",) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Weatherstack/__init__.py b/Weatherstack/__init__.py index 2527816..3755fac 100644 --- a/Weatherstack/__init__.py +++ b/Weatherstack/__init__.py @@ -33,6 +33,7 @@ """ import sys + if sys.version_info <= (3, 6): raise RuntimeError("This plugin requires Python 3.6 or above.") import supybot @@ -42,22 +43,23 @@ __version__ = "15092021" # XXX Replace this with an appropriate author or supybot.Author instance. -__author__ = supybot.Author('Barry Suridge', 'Alcheri', - 'barry.suridge@outlook.com') +__author__ = supybot.Author("Barry Suridge", "Alcheri", "barry.suridge@outlook.com") # This is a dictionary mapping supybot.Author instances to lists of # contributions. __contributors__ = {} # This is a url where the most recent plugin package can be downloaded. -__url__ = 'https://github.com/Alcheri/My-Limnoria-Plugins' +__url__ = "https://github.com/Alcheri/My-Limnoria-Plugins" import sys + if sys.version_info <= (3, 9): raise RuntimeError("This plugin requires Python 3.9 or above.") from . import config from . import plugin from importlib import reload + # In case we're being reloaded. reload(config) reload(plugin) diff --git a/Weatherstack/config.py b/Weatherstack/config.py index 60e3cc1..90ace3c 100644 --- a/Weatherstack/config.py +++ b/Weatherstack/config.py @@ -29,45 +29,53 @@ ### from supybot import conf, registry + try: from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('Weather') + + _ = PluginInternationalization("Weather") except: # Placeholder that allows to run the plugin on a bot # without the i18n module _ = lambda x: x + def configure(advanced): # This will be called by supybot to configure this module. advanced is # a bool that specifies whether the user identified themself as an advanced # user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn - conf.registerPlugin('Weatherstack', True) + + conf.registerPlugin("Weatherstack", True) -Weatherstack = conf.registerPlugin('Weatherstack') +Weatherstack = conf.registerPlugin("Weatherstack") # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(DALnet, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) -conf.registerGroup(Weatherstack, 'apikeys') +conf.registerGroup(Weatherstack, "apikeys") conf.registerGlobalValue( - Weatherstack, 'weatherstackAPI', registry.String( - '', _("""Sets the API key for Weatherstack."""), private=True) + Weatherstack, + "weatherstackAPI", + registry.String("", _("""Sets the API key for Weatherstack."""), private=True), ) conf.registerGlobalValue( - Weatherstack, 'positionstackAPI', registry.String( - '', _("""Sets the API key for positionstack."""), private=True) + Weatherstack, + "positionstackAPI", + registry.String("", _("""Sets the API key for positionstack."""), private=True), ) conf.registerGlobalValue( - Weatherstack, 'openweatherAPI', registry.String( - '', _("""Sets the API key for OpenWeatherMap."""), private=True) + Weatherstack, + "openweatherAPI", + registry.String("", _("""Sets the API key for OpenWeatherMap."""), private=True), ) conf.registerChannelValue( - Weatherstack, 'enabled', registry.Boolean( - False, """Should plugin work in this channel?""") + Weatherstack, + "enabled", + registry.Boolean(False, """Should plugin work in this channel?"""), ) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Weatherstack/setup.py b/Weatherstack/setup.py index 081f5de..ed1527d 100644 --- a/Weatherstack/setup.py +++ b/Weatherstack/setup.py @@ -31,10 +31,10 @@ from supybot.setup import plugin_setup plugin_setup( - 'Weatherstack', + "Weatherstack", install_requires=[ - 'aiohttp', - 'asyncio', - 'pgeocode', + "aiohttp", + "asyncio", + "pgeocode", ], )