Skip to content

Commit ac7828b

Browse files
authored
release/1.2.3 (#6)
* Gmail API wrapper (#4) * Update workspace settings * Bump and update project dependencies * Add Gmail API wrapper with GmailMailbox and GmailEmail classes * Remove unnecessary "Object" from class names * Fix bugs in worksheet generation and conditional formatting * Update tests * Improve kwargs on search messages command to be snake case * Add to_json method to GmailEmail object * Update credentials specifications in gitignore * Improve multipart message handling * Bump version after improving multipart message handling * Fix linting errors * Update linting workflow, errors and tests * Fix more linting errors * Improve gmail wrapper (#5) * Handle multipart messages and case sensitivity of headers * Bump dependencies
1 parent 19bb60a commit ac7828b

17 files changed

+1719
-590
lines changed

.github/workflows/codeqa.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,5 @@ jobs:
2323
key: ${{ runner.os }}-linting
2424
restore-keys: ${{ runner.os }}-linting
2525

26-
- run: pip install bandit black codespell flake8 pycodestyle pydocstyle
27-
- run: bandit -r googau || true
28-
- run: black --check googau
29-
- run: codespell googau
30-
- run: flake8 googau --count --max-line-length=120 --show-source --statistics
31-
- run: pycodestyle googau --ignore=E501
32-
- run: pydocstyle googau
26+
- run: pip install ruff
27+
- run: ruff check googau --config pyproject.toml

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Credentials files
2+
credentials.json
3+
client_secret*.json
4+
*token*.pickle
5+
16
# Byte-compiled / optimized / DLL files
27
__pycache__/
38
*.py[cod]

.vscode/settings.json

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,40 @@
77
"files.trimTrailingWhitespace": true,
88
"files.trimFinalNewlines": true,
99
"files.insertFinalNewline": true,
10+
"files.exclude": {
11+
"venv/": true,
12+
".mypy_cache/": true,
13+
"**/node_modules/": true,
14+
"**/__pycache__/": true,
15+
"**/.mypy_cache/": true,
16+
"**/.pytest_cache/": true,
17+
"**/.ruff_cache/": true,
18+
"**/.ipynb_checkpoints": true,
19+
"**/.DS_Store": true,
20+
"**/.scannerwork": true
21+
},
1022
"[python]": {
23+
"editor.defaultFormatter": "ms-python.black-formatter",
1124
"editor.tabSize": 4,
1225
"editor.insertSpaces": true,
13-
"editor.formatOnSave": true
26+
"editor.formatOnSave": true,
27+
"editor.formatOnPaste": false,
28+
"editor.codeActionsOnSave": {
29+
"source.organizeImports": "never",
30+
"source.fixAll": "explicit"
31+
},
32+
"editor.formatOnType": false,
1433
},
1534
"python.defaultInterpreterPath": "./venv/bin/python",
16-
"python.formatting.provider": "black",
17-
"python.linting.enabled": true,
18-
"python.linting.flake8Path": "flake8",
19-
"python.linting.flake8Enabled": true,
20-
"python.linting.flake8CategorySeverity.F": "Error",
21-
"python.linting.flake8CategorySeverity.E": "Error",
22-
"python.linting.flake8Args": [
23-
"--max-line-length=120"
24-
],
25-
"python.linting.mypyEnabled": true,
26-
"python.linting.mypyPath": "mypy",
27-
"python.linting.pylintEnabled": true,
28-
"python.linting.banditEnabled": true,
29-
"python.linting.banditArgs": [
30-
"-x",
31-
"./tests",
32-
"-r",
33-
],
34-
"python.linting.pylintArgs": [
35-
"--disable=C0301"
36-
],
37-
"python.linting.pycodestyleEnabled": true,
38-
"python.linting.pycodestyleArgs": [
39-
"--ignore E501"
40-
],
41-
"python.linting.pydocstylePath": "pydocstyle",
42-
"python.linting.pydocstyleEnabled": false,
43-
"python.linting.pydocstyleArgs": [
44-
"--convention=numpy"
45-
],
4635
"python.languageServer": "Pylance",
4736
"python.testing.pytestArgs": [
4837
"tests"
4938
],
5039
"python.testing.unittestEnabled": false,
5140
"python.testing.pytestEnabled": true,
5241
"python.terminal.activateEnvironment": true,
53-
"workbench.colorTheme": "Sublime Text 4 Theme",
42+
"workbench.colorTheme": "Default Dark Modern",
5443
"editor.bracketPairColorization.independentColorPoolPerBracketType": true,
55-
"workbench.activityBar.visible": true,
5644
"workbench.preferredDarkColorTheme": "GitHub Dark Dimmed",
5745
"workbench.preferredLightColorTheme": "GitHub Light Default",
5846
"workbench.preferredHighContrastLightColorTheme": "Default Light+",

googau/calendar.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Calendar utilities."""
2+
23
import datetime
34
from typing import Optional
45
from googau.sessions import CalendarSession
@@ -14,7 +15,7 @@ class TimeDeltas:
1415
YTD = datetime.timedelta(days=365)
1516

1617

17-
class CalendarObject:
18+
class Calendar(object):
1819
"""Gets a Calendar object for the current session and an ID."""
1920

2021
calendarId = None
@@ -35,6 +36,7 @@ def __init__(
3536
The calendar session or None, by default None
3637
calendarId : Union[str, None], optional
3738
The calendar id from G-Suite or None, by default None
39+
3840
"""
3941
self.calendarId = calendarId
4042
self.service = session
@@ -57,6 +59,7 @@ def get_events_td(
5759
-------
5860
list
5961
The list of events
62+
6063
"""
6164
if not date:
6265
_date = datetime.datetime.utcnow()

googau/documents.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Document utilities."""
2+
23
from typing import Optional
34
from .sessions import DocSession
45

56

6-
class DocObject:
7+
class Doc(object):
78
"""Gets a Document object for the current session and an ID."""
89

910
documentId: Optional[str] = None
@@ -19,6 +20,7 @@ def __init__(self, session=None, documentId=None):
1920
The Google Docs API session to use, by default None
2021
documentId : Optional[str], optional
2122
The document id from Google Docs, by default None
23+
2224
"""
2325
self.documentId = documentId
2426
self.session = session

googau/drive.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .constants.drive_constants import SHARED_DRIVE
77

88

9-
class SharedDriveObject(object):
9+
class SharedDrive(object):
1010
"""SharedDrive object for the current session and an ID."""
1111

1212
drive_id: Optional[str] = None
@@ -21,6 +21,7 @@ def __init__(self, session: DriveSession, drive_id: Optional[str] = None):
2121
A DriveSession instance
2222
drive_id : Optional[str], optional
2323
The shared drive id from G-Suite, by default None
24+
2425
"""
2526
self.drive_id = drive_id
2627
self.session = session
@@ -48,6 +49,7 @@ def create(self, request_id: str, name: str, **kwargs) -> dict:
4849
-------
4950
dict
5051
The response from the API call.
52+
5153
"""
5254
drive_template = copy.deepcopy(SHARED_DRIVE)
5355
drive_template["name"] = name
@@ -67,6 +69,7 @@ def hide(self) -> dict:
6769
-------
6870
dict
6971
The response from the API call.
72+
7073
"""
7174
if self.drive_id is None:
7275
return {"error": "No Drive ID provided."}
@@ -80,6 +83,7 @@ def unhide(self) -> dict:
8083
-------
8184
dict
8285
The response from the API call.
86+
8387
"""
8488
if self.drive_id is None:
8589
return {"error": "No Drive ID provided."}

0 commit comments

Comments
 (0)