Skip to content

Commit

Permalink
v0.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dariobauer committed Nov 30, 2021
1 parent 0cec32b commit 57d79ba
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Released

### Version 0.1.1
### Version 0.2.0

Released 2021-11-30

Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ Save the following in a .py file in the same folder.
```python
from graph_onedrive import OneDriveManager

# Set config file details
config_file = "config.json"
config_key = "onedrive"

# Use a context manager to manage the session
with OneDriveManager(config_file, config_key) as my_drive:
with OneDriveManager(config_path="config.json", config_key="onedrive") as my_drive:

# Print the OneDrive usage
my_drive.get_usage(verbose=True)
Expand All @@ -61,7 +57,7 @@ with OneDriveManager(config_file, config_key) as my_drive:
new_file_id = my_drive.upload_file("my-photo.jpg", verbose=True)
```

*OneDriveManager is new in version 0.1.1. Refer docs for other instance constructors.*
*OneDriveManager is new in version 0.2.0. Refer docs for other instance constructors.*

## License and Terms of Use

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/example_context-manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ def main() -> None:
# Set config path
config_file_name = "config.json"
directory_of_this_file = path.dirname(path.abspath(__file__))
file_path = path.join(directory_of_this_file, config_file_name)
config_path = path.join(directory_of_this_file, config_file_name)

# Set config dictionary key
config_key = "onedrive"

# Use the context manager to manage a session instance
with OneDriveManager(file_path, config_key) as my_drive:
with OneDriveManager(config_path, config_key) as my_drive:
# Complete tasks using the instance. For this example we will just display the usage
my_drive.get_usage(verbose=True)

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/example_upload_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def main() -> None:
dest_folder_name = "My Photos"

# Use the context manager to manage a session instance
with OneDriveManager(file_path="config.json", config_key="onedrive") as my_drive:
with OneDriveManager(config_path="config.json", config_key="onedrive") as my_drive:

# Get the details of all the items in the root directory
items = my_drive.list_directory()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ deps = -r{toxinidir}/requirements-dev.txt
commands =
coverage erase
coverage run -m pytest {posargs:tests}
coverage report --fail-under 50
coverage report --fail-under 55
[testenv:style-and-typing]
skip_install = true
Expand Down
2 changes: 1 addition & 1 deletion src/graph_onedrive/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.1.1"
__version__ = "0.2.0"

import logging

Expand Down
8 changes: 4 additions & 4 deletions src/graph_onedrive/_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

@contextmanager
def OneDriveManager(
file_path: str | Path, config_key: str = "onedrive"
config_path: str | Path, config_key: str = "onedrive"
) -> Generator[OneDrive, None, None]:
"""Context manager for the OneDrive class, only use this if you want to save and read from a file.
Positional arguments:
file_path (str|Path) -- path to configuration json file
config_path (str|Path) -- path to configuration json file
Keyword arguments:
config_key (str) -- key of the json item storing the configuration (default = "onedrive")
Returns:
onedrive_instance (OneDrive) -- OneDrive object instance
"""
logging.info("OneDriveManager creating instance")
onedrive_instance = OneDrive.from_json(file_path, config_key)
onedrive_instance = OneDrive.from_json(config_path, config_key)
yield onedrive_instance
logging.info("OneDriveManager saving instance configuration to file")
onedrive_instance.to_json(file_path, config_key)
onedrive_instance.to_json(config_path, config_key)

0 comments on commit 57d79ba

Please sign in to comment.