style: change in black and isort autoformat config

This commit is contained in:
Dineshkarthik 2022-07-18 20:08:21 +02:00
parent c36b3af158
commit ef12b4f5e2
No known key found for this signature in database
GPG key ID: E256EF0EECD6F201
5 changed files with 8 additions and 24 deletions

View file

@ -47,9 +47,7 @@ def update_config(config: dict):
logger.info("Updated last read message_id to config file") logger.info("Updated last read message_id to config file")
def _can_download( def _can_download(_type: str, file_formats: dict, file_format: Optional[str]) -> bool:
_type: str, file_formats: dict, file_format: Optional[str]
) -> bool:
""" """
Check if the given file format can be downloaded. Check if the given file format can be downloaded.

View file

@ -134,9 +134,7 @@ async def mock_process_message(*args, **kwargs):
async def async_process_messages(client, messages, media_types, file_formats): async def async_process_messages(client, messages, media_types, file_formats):
result = await process_messages( result = await process_messages(client, messages, media_types, file_formats)
client, messages, media_types, file_formats
)
return result return result
@ -289,9 +287,7 @@ class MediaDownloaderTestCase(unittest.TestCase):
) )
self.assertEqual( self.assertEqual(
( (
platform_generic_path( platform_generic_path("/root/project/document/sample_document.pdf"),
"/root/project/document/sample_document.pdf"
),
"pdf", "pdf",
), ),
result, result,
@ -495,9 +491,7 @@ class MediaDownloaderTestCase(unittest.TestCase):
} }
update_config(conf) update_config(conf)
mock_open.assert_called_with("config.yaml", "w") mock_open.assert_called_with("config.yaml", "w")
mock_yaml.dump.assert_called_with( mock_yaml.dump.assert_called_with(conf, mock.ANY, default_flow_style=False)
conf, mock.ANY, default_flow_style=False
)
@mock.patch("media_downloader.update_config") @mock.patch("media_downloader.update_config")
@mock.patch("media_downloader.pyrogram.Client", new=MockClient) @mock.patch("media_downloader.pyrogram.Client", new=MockClient)

View file

@ -15,12 +15,8 @@ class FileManagementTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
self.this_dir = os.path.dirname(os.path.abspath(__file__)) self.this_dir = os.path.dirname(os.path.abspath(__file__))
self.test_file = os.path.join(self.this_dir, "file-test.txt") self.test_file = os.path.join(self.this_dir, "file-test.txt")
self.test_file_copy_1 = os.path.join( self.test_file_copy_1 = os.path.join(self.this_dir, "file-test-copy1.txt")
self.this_dir, "file-test-copy1.txt" self.test_file_copy_2 = os.path.join(self.this_dir, "file-test-copy2.txt")
)
self.test_file_copy_2 = os.path.join(
self.this_dir, "file-test-copy2.txt"
)
f = open(self.test_file, "w+") f = open(self.test_file, "w+")
f.write("dummy file") f.write("dummy file")
f.close() f.close()

View file

@ -2,6 +2,4 @@
__version__ = "1.5.1" __version__ = "1.5.1"
__license__ = "MIT License" __license__ = "MIT License"
__copyright__ = ( __copyright__ = "Copyright (C) 2019 Dineshkarthik <https://github.com/Dineshkarthik>"
"Copyright (C) 2019 Dineshkarthik <https://github.com/Dineshkarthik>"
)

View file

@ -6,9 +6,7 @@ from rich.console import Console
from . import __copyright__, __license__, __version__ from . import __copyright__, __license__, __version__
APP_VERSION = f"Telegram Media Downloader {__version__}" APP_VERSION = f"Telegram Media Downloader {__version__}"
DEVICE_MODEL = ( DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}"
f"{platform.python_implementation()} {platform.python_version()}"
)
SYSTEM_VERSION = f"{platform.system()} {platform.release()}" SYSTEM_VERSION = f"{platform.system()} {platform.release()}"
LANG_CODE = "en" LANG_CODE = "en"