lint: Pre-fix places where Black will reformat incorrectly.
This commit is contained in:
parent
63fefd2a0f
commit
5a17c60987
|
@ -166,8 +166,7 @@ def dbx_write(client: Any, fn: str, content: str) -> str:
|
||||||
result = client.files_upload(content.encode(), fn)
|
result = client.files_upload(content.encode(), fn)
|
||||||
msg = "Written to file: " + URL.format(name=result.name, path=result.path_lower)
|
msg = "Written to file: " + URL.format(name=result.name, path=result.path_lower)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = "Incorrect file path or file already exists.\n"\
|
msg = "Incorrect file path or file already exists.\nUsage: `write <filename> CONTENT`"
|
||||||
"Usage: `write <filename> CONTENT`"
|
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
@ -178,8 +177,7 @@ def dbx_read(client: Any, fn: str) -> str:
|
||||||
result = client.files_download(fn)
|
result = client.files_download(fn)
|
||||||
msg = "**{}** :\n{}".format(result[0].name, result[1].text)
|
msg = "**{}** :\n{}".format(result[0].name, result[1].text)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = "Please provide a correct file path\n"\
|
msg = "Please provide a correct file path\nUsage: `read <filename>` to read content of a file"
|
||||||
"Usage: `read <filename>` to read content of a file"
|
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
@ -218,8 +216,7 @@ def dbx_share(client: Any, fn: str):
|
||||||
result = client.sharing_create_shared_link(fn)
|
result = client.sharing_create_shared_link(fn)
|
||||||
msg = result.url
|
msg = result.url
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = "Please provide a correct file name.\n"\
|
msg = "Please provide a correct file name.\nUsage: `share <filename>`"
|
||||||
"Usage: `share <filename>`"
|
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
|
@ -142,8 +142,7 @@ class TestDropboxBot(BotTestCase, DefaultTests):
|
||||||
self.verify_reply('write foo boo', bot_response)
|
self.verify_reply('write foo boo', bot_response)
|
||||||
|
|
||||||
def test_dbx_write_error(self):
|
def test_dbx_write_error(self):
|
||||||
bot_response = "Incorrect file path or file already exists.\n"\
|
bot_response = "Incorrect file path or file already exists.\nUsage: `write <filename> CONTENT`"
|
||||||
"Usage: `write <filename> CONTENT`"
|
|
||||||
with patch('dropbox.Dropbox.files_upload', side_effect=Exception()), \
|
with patch('dropbox.Dropbox.files_upload', side_effect=Exception()), \
|
||||||
self.mock_config_info(self.config_info):
|
self.mock_config_info(self.config_info):
|
||||||
self.verify_reply('write foo boo', bot_response)
|
self.verify_reply('write foo boo', bot_response)
|
||||||
|
@ -162,8 +161,7 @@ class TestDropboxBot(BotTestCase, DefaultTests):
|
||||||
self.verify_reply('read foo', bot_response)
|
self.verify_reply('read foo', bot_response)
|
||||||
|
|
||||||
def test_dbx_search(self):
|
def test_dbx_search(self):
|
||||||
bot_response = " - [foo](https://www.dropbox.com/home/foo)\n"\
|
bot_response = " - [foo](https://www.dropbox.com/home/foo)\n - [fooboo](https://www.dropbox.com/home/fooboo)"
|
||||||
" - [fooboo](https://www.dropbox.com/home/fooboo)"
|
|
||||||
with patch('dropbox.Dropbox.files_search', side_effect=search_files), \
|
with patch('dropbox.Dropbox.files_search', side_effect=search_files), \
|
||||||
self.mock_config_info(self.config_info):
|
self.mock_config_info(self.config_info):
|
||||||
self.verify_reply('search foo', bot_response)
|
self.verify_reply('search foo', bot_response)
|
||||||
|
@ -191,8 +189,7 @@ class TestDropboxBot(BotTestCase, DefaultTests):
|
||||||
self.verify_reply('share boo', bot_response)
|
self.verify_reply('share boo', bot_response)
|
||||||
|
|
||||||
def test_dbx_share_error(self):
|
def test_dbx_share_error(self):
|
||||||
bot_response = "Please provide a correct file name.\n"\
|
bot_response = "Please provide a correct file name.\nUsage: `share <filename>`"
|
||||||
"Usage: `share <filename>`"
|
|
||||||
with patch('dropbox.Dropbox.sharing_create_shared_link', side_effect=Exception()), \
|
with patch('dropbox.Dropbox.sharing_create_shared_link', side_effect=Exception()), \
|
||||||
self.mock_config_info(self.config_info):
|
self.mock_config_info(self.config_info):
|
||||||
self.verify_reply('share boo', bot_response)
|
self.verify_reply('share boo', bot_response)
|
||||||
|
|
|
@ -51,8 +51,7 @@ class GameHandlerBotHandler(GameAdapter):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
game_name = 'foo test game'
|
game_name = 'foo test game'
|
||||||
bot_name = 'game_handler_bot'
|
bot_name = 'game_handler_bot'
|
||||||
move_help_message = '* To make your move during a game, type\n' \
|
move_help_message = '* To make your move during a game, type\n```move <column-number>```'
|
||||||
'```move <column-number>```'
|
|
||||||
move_regex = r'move (\d)$'
|
move_regex = r'move (\d)$'
|
||||||
model = MockModel
|
model = MockModel
|
||||||
gameMessageHandler = GameHandlerBotMessageHandler
|
gameMessageHandler = GameHandlerBotMessageHandler
|
||||||
|
|
|
@ -124,8 +124,7 @@ class GameOfFifteenBotHandler(GameAdapter):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
game_name = 'Game of Fifteen'
|
game_name = 'Game of Fifteen'
|
||||||
bot_name = 'Game of Fifteen'
|
bot_name = 'Game of Fifteen'
|
||||||
move_help_message = '* To make your move during a game, type\n' \
|
move_help_message = '* To make your move during a game, type\n```move <tile1> <tile2> ...```'
|
||||||
'```move <tile1> <tile2> ...```'
|
|
||||||
move_regex = r'move [\d{1}\s]+$'
|
move_regex = r'move [\d{1}\s]+$'
|
||||||
model = GameOfFifteenModel
|
model = GameOfFifteenModel
|
||||||
gameMessageHandler = GameOfFifteenMessageHandler
|
gameMessageHandler = GameOfFifteenMessageHandler
|
||||||
|
|
|
@ -41,8 +41,7 @@ def unknown_command():
|
||||||
|
|
||||||
:return: A string containing info about available commands
|
:return: A string containing info about available commands
|
||||||
"""
|
"""
|
||||||
message = "Unknown command. Available commands: " \
|
message = "Unknown command. Available commands: put (v,h), take (v,h), move (v,h) -> (v,h)"
|
||||||
"put (v,h), take (v,h), move (v,h) -> (v,h)"
|
|
||||||
raise BadMoveException(message)
|
raise BadMoveException(message)
|
||||||
|
|
||||||
def beat(message, topic_name, merels_storage):
|
def beat(message, topic_name, merels_storage):
|
||||||
|
|
|
@ -42,7 +42,6 @@ class TestTwitpostBot(BotTestCase, DefaultTests):
|
||||||
@patch('tweepy.API.update_status', return_value=api_response)
|
@patch('tweepy.API.update_status', return_value=api_response)
|
||||||
def test_tweet(self, mockedarg):
|
def test_tweet(self, mockedarg):
|
||||||
test_message = 'tweet Maybe he\'ll finally find his keys. #peterfalk'
|
test_message = 'tweet Maybe he\'ll finally find his keys. #peterfalk'
|
||||||
bot_response = 'Tweet Posted\n'\
|
bot_response = 'Tweet Posted\nhttps://twitter.com/jasoncosta/status/243145735212777472'
|
||||||
'https://twitter.com/jasoncosta/status/243145735212777472'
|
|
||||||
with self.mock_config_info(self.mock_config):
|
with self.mock_config_info(self.mock_config):
|
||||||
self.verify_reply(test_message, bot_response)
|
self.verify_reply(test_message, bot_response)
|
||||||
|
|
|
@ -103,8 +103,7 @@ class YodaSpeakHandler:
|
||||||
logging.error(reply_message)
|
logging.error(reply_message)
|
||||||
|
|
||||||
except ApiKeyError:
|
except ApiKeyError:
|
||||||
reply_message = 'Invalid Api Key. Did you follow the instructions in the ' \
|
reply_message = 'Invalid Api Key. Did you follow the instructions in the `readme.md` file?'
|
||||||
'`readme.md` file?'
|
|
||||||
logging.error(reply_message)
|
logging.error(reply_message)
|
||||||
|
|
||||||
bot_handler.send_reply(message, reply_message)
|
bot_handler.send_reply(message, reply_message)
|
||||||
|
|
Loading…
Reference in a new issue