From 24a7d99b34f8a7355ab1c7392ace1a45f055b40e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:01:30 +0100 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#56) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1) * [pre-commit.ci] auto fixes from hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- src/graph_onedrive/__main__.py | 1 + src/graph_onedrive/_cli.py | 1 + src/graph_onedrive/_config.py | 1 + src/graph_onedrive/_decorators.py | 1 + src/graph_onedrive/_main.py | 1 + src/graph_onedrive/_manager.py | 1 + src/graph_onedrive/_onedrive.py | 1 + tests/_config_test.py | 7 +++---- tests/_decorators_test.py | 1 + tests/_manager_test.py | 1 + tests/_onedrive_test.py | 33 +++++++++++-------------------- tests/conftest.py | 7 ++++--- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 989eadc..ffe3c8f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - id: pyupgrade args: ["--py38-plus"] - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black - repo: https://github.com/asottile/blacken-docs diff --git a/src/graph_onedrive/__main__.py b/src/graph_onedrive/__main__.py index 3c3c0f6..e15035f 100644 --- a/src/graph_onedrive/__main__.py +++ b/src/graph_onedrive/__main__.py @@ -1,5 +1,6 @@ """Entrypoint module redirects to command line interface, in case of use of `python -m graphonedrive`. """ + from graph_onedrive._cli import main if __name__ == "__main__": diff --git a/src/graph_onedrive/_cli.py b/src/graph_onedrive/_cli.py index 5b35508..319a0f0 100755 --- a/src/graph_onedrive/_cli.py +++ b/src/graph_onedrive/_cli.py @@ -1,6 +1,7 @@ """Command line interface tools for the Python package Graph-OneDrive. Run terminal command 'graph-onedrive --help' or 'python -m graph-onedrive --help' for details. """ + from __future__ import annotations import argparse diff --git a/src/graph_onedrive/_config.py b/src/graph_onedrive/_config.py index c38eb5e..873793f 100644 --- a/src/graph_onedrive/_config.py +++ b/src/graph_onedrive/_config.py @@ -1,5 +1,6 @@ """Configuration file related functions. """ + from __future__ import annotations import json diff --git a/src/graph_onedrive/_decorators.py b/src/graph_onedrive/_decorators.py index e1e8114..b1f1036 100755 --- a/src/graph_onedrive/_decorators.py +++ b/src/graph_onedrive/_decorators.py @@ -1,5 +1,6 @@ """Decorators to wrap Graph-OneDrive package methods and functions. """ + import logging from datetime import datetime from functools import wraps diff --git a/src/graph_onedrive/_main.py b/src/graph_onedrive/_main.py index fea2f39..4831fdd 100644 --- a/src/graph_onedrive/_main.py +++ b/src/graph_onedrive/_main.py @@ -1,4 +1,5 @@ """OneDrive Class and Context Manager. """ + from graph_onedrive._manager import OneDriveManager from graph_onedrive._onedrive import OneDrive diff --git a/src/graph_onedrive/_manager.py b/src/graph_onedrive/_manager.py index 4fe7f58..6d414b2 100644 --- a/src/graph_onedrive/_manager.py +++ b/src/graph_onedrive/_manager.py @@ -1,5 +1,6 @@ """OneDrive context manager. """ + from __future__ import annotations import logging diff --git a/src/graph_onedrive/_onedrive.py b/src/graph_onedrive/_onedrive.py index 59d03f6..5c05f46 100755 --- a/src/graph_onedrive/_onedrive.py +++ b/src/graph_onedrive/_onedrive.py @@ -1,5 +1,6 @@ """Contains the OneDrive object class to interact through the Graph API using the Python package Graph-OneDrive. """ + from __future__ import annotations import asyncio diff --git a/tests/_config_test.py b/tests/_config_test.py index 15d8aa0..a145a12 100644 --- a/tests/_config_test.py +++ b/tests/_config_test.py @@ -1,4 +1,5 @@ """Tests the config functions using pytest.""" + import json import sys from pathlib import Path @@ -87,8 +88,7 @@ def test_load_config_raw(self, tmp_path): data = load_config(config_path) assert data == config - def test_load_config_failure(self): - ... + def test_load_config_failure(self): ... class TestDump: @@ -140,8 +140,7 @@ def test_dump_config(self, tmp_path, config_path): initial_file[config_key]["refresh_token"] = "new" assert read_data == initial_file - def test_dump_config_failure(self): - ... + def test_dump_config_failure(self): ... class TestFileTypeCheck: diff --git a/tests/_decorators_test.py b/tests/_decorators_test.py index bb31bd4..a42d1a1 100644 --- a/tests/_decorators_test.py +++ b/tests/_decorators_test.py @@ -1,4 +1,5 @@ """Tests the OneDrive decorators pytest.""" + from datetime import datetime from datetime import timedelta diff --git a/tests/_manager_test.py b/tests/_manager_test.py index 79b1f2f..4d06f0e 100644 --- a/tests/_manager_test.py +++ b/tests/_manager_test.py @@ -1,4 +1,5 @@ """Tests the OneDrive context manager using pytest.""" + import json from pathlib import Path diff --git a/tests/_onedrive_test.py b/tests/_onedrive_test.py index 64be01a..269d618 100644 --- a/tests/_onedrive_test.py +++ b/tests/_onedrive_test.py @@ -1,4 +1,5 @@ """Tests the OneDrive class using pytest.""" + import json import logging import os @@ -601,8 +602,7 @@ def test_list_directory_folder(self, onedrive): assert items[0].get("id") == "01BYE5RZZWSN2ASHUEBJH2XJJ25WSEBUJ3" @pytest.mark.skip(reason="not implemented") - def test_list_directory_failure(self, onedrive): - ... + def test_list_directory_failure(self, onedrive): ... def test_list_directory_failure_type(self, onedrive): with pytest.raises(TypeError) as excinfo: @@ -627,8 +627,7 @@ def test_search(self, onedrive, query, top, exp_len): assert len(items) == exp_len @pytest.mark.skip(reason="not implemented") - def test_search_failure(self, onedrive): - ... + def test_search_failure(self, onedrive): ... @pytest.mark.parametrize( "query, top, exp_msg", @@ -713,8 +712,7 @@ def test_detail_item_verbose(self, onedrive, capsys, item_id, exp_stout): assert stdout == exp_stout @pytest.mark.skip(reason="not implemented") - def test_detail_item_failure(self): - ... + def test_detail_item_failure(self): ... # detail_item_path def test_detail_item_path(self, onedrive): @@ -735,8 +733,7 @@ def test_item_type(self, onedrive, item_id, exp_type): assert item_type == exp_type @pytest.mark.skip(reason="not implemented") - def test_item_type_failure(self): - ... + def test_item_type_failure(self): ... # is_folder @pytest.mark.parametrize( @@ -751,8 +748,7 @@ def test_is_folder(self, onedrive, item_id, exp_bool): assert is_folder == exp_bool @pytest.mark.skip(reason="not implemented") - def test_is_folder_failure(self): - ... + def test_is_folder_failure(self): ... # is_file @pytest.mark.parametrize( @@ -767,8 +763,7 @@ def test_is_file(self, onedrive, item_id, exp_bool): assert is_file == exp_bool @pytest.mark.skip(reason="not implemented") - def test_is_file_failure(self): - ... + def test_is_file_failure(self): ... class TestSharingLink: @@ -932,7 +927,7 @@ class TestMakeFolder: ("tesy 1", "01BYE5RZ4CPC5XBOTZCFD2CT7SZFNICEYC", True, "ACEA49D1-144"), ("tesy 1", "01BYE5RZ4CPC5XBOTZCFD2CT7SZFNICEYC", False, "ACEA49D1-144"), ("tesy 1", None, True, "ACEA49D1-144"), - ("tesy 1", None, False, "ACEA49D1-144") + ("tesy 1", None, False, "ACEA49D1-144"), # To-do: allow for other folder names by using a side effect in the mock route ], ) @@ -943,8 +938,7 @@ def test_make_folder( assert item_id == exp_str @pytest.mark.skip(reason="not implemented") - def test_make_folder_failure(self): - ... + def test_make_folder_failure(self): ... class TestMove: @@ -1098,8 +1092,7 @@ def test_rename_item(self, onedrive): assert returned_name == new_name @pytest.mark.skip(reason="not implemented") - def test_rename_item_failure(self): - ... + def test_rename_item_failure(self): ... class TestDelete: @@ -1149,12 +1142,10 @@ class TestDownload: # download_file @pytest.mark.skip(reason="not implemented") - def test_download_file(self): - ... + def test_download_file(self): ... @pytest.mark.skip(reason="not implemented") - def test_download_file_failure(self): - ... + def test_download_file_failure(self): ... """# _download_async @pytest.mark.skip(reason="not implemented") diff --git a/tests/conftest.py b/tests/conftest.py index b62e185..e3c018d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """Sets-up and tears-down configuration used for testing.""" + import json import os import re @@ -244,9 +245,9 @@ def side_effect_search(request): if next: alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" # = string.ascii_letters + string.digits skip_token = "s!" + "".join(secrets.choice(alphabet) for _ in range(10)) - response_json[ - "@odata.nextLink" - ] = f"https://graph.microsoft.com/v1.0/me/drive/root/search(q='{query}')?$top={top}&$skiptoken={skip_token}" + response_json["@odata.nextLink"] = ( + f"https://graph.microsoft.com/v1.0/me/drive/root/search(q='{query}')?$top={top}&$skiptoken={skip_token}" + ) return httpx.Response(200, json=response_json)