Skip to content

Commit

Permalink
code quality: isort, flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed Jul 20, 2020
1 parent a1a2483 commit 20ce9a6
Show file tree
Hide file tree
Showing 86 changed files with 141 additions and 165 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __pycache__/

# Environments
.env
.envrc
.venv
env/
venv/
Expand Down
1 change: 0 additions & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ multi_line_output = 3
line_length = 120
balanced_wrapping = true
order_by_type = false
not_skip = __init__.py
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ python:
install:
- pip install -r requirements.txt

script: python setup.py test
script:
flake8 office365 generator examples
isort office365 generator examples
python setup.py test

stages:
# Tests are configured in upstream
Expand Down
3 changes: 1 addition & 2 deletions examples/directory/delete_deletedObjects.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from settings import settings

from office365.graph.graph_client import GraphClient
from settings import settings


def get_token_for_user(auth_ctx):
Expand Down
4 changes: 2 additions & 2 deletions examples/directory/import_users.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from faker import Faker
from settings import settings
from tests import random_seed

from office365.graph.directory.userProfile import UserProfile
from office365.graph.graph_client import GraphClient
from settings import settings
from tests import random_seed


def acquire_token(auth_ctx):
Expand Down
3 changes: 1 addition & 2 deletions examples/onedrive/export_files.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os
import tempfile

from settings import settings

from office365.graph.graph_client import GraphClient
from settings import settings


def get_token(auth_ctx):
Expand Down
3 changes: 1 addition & 2 deletions examples/onedrive/import_files.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os
from os.path import isfile, join

from settings import settings

from office365.graph.graph_client import GraphClient
from settings import settings


def get_token(auth_ctx):
Expand Down
3 changes: 1 addition & 2 deletions examples/onedrive/print_folders_and_files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from settings import settings

from office365.graph.graph_client import GraphClient
from settings import settings


def get_token_for_user(auth_ctx):
Expand Down
3 changes: 1 addition & 2 deletions examples/outlook/send_message.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from settings import settings

from office365.graph.graph_client import GraphClient
from settings import settings


def get_token(auth_ctx):
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/connect_with_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings

credentials = ClientCredential(settings['client_credentials']['client_id'],
settings['client_credentials']['client_secret'])
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/connect_with_proxy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings


def set_proxy(request):
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/connect_with_user_creds.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from settings import settings

from office365.runtime.auth.userCredential import UserCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings

ctx = ClientContext.connect_with_credentials(settings["url"],
UserCredential(settings['user_credentials']['username'],
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/export/exportList.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
import os
import tempfile

from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings

"Demonstrates how to export a List data"

Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/export_search_crawl_log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.search.administration.documentCrawlLog import DocumentCrawlLog
from settings import settings

ctx = ClientContext.connect_with_credentials(settings['url'],
ClientCredential(settings['client_credentials']['client_id'],
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/files/download_file.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import os
import tempfile

from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings

ctx = ClientContext.connect_with_credentials(settings.get('url') + "/sites/team",
ClientCredential(settings.get('client_credentials').get('client_id'),
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/files/download_file_from_url.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import os
import tempfile

from settings import settings

from office365.runtime.auth.userCredential import UserCredential
from office365.sharepoint.files.file import File
from settings import settings

abs_file_url = "{site_url}sites/team/Shared Documents/sample.docx".format(site_url=settings.get('url'))
user_credentials = UserCredential(settings.get('user_credentials').get('username'),
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/files/upload_file.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os

from settings import settings

from office365.runtime.auth.userCredential import UserCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings

ctx = ClientContext.connect_with_credentials(settings['url'],
UserCredential(settings['user_credentials']['username'],
Expand Down
2 changes: 1 addition & 1 deletion examples/sharepoint/files/upload_large_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from settings import settings
from office365.runtime.auth.userCredential import UserCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings


def print_upload_progress(offset):
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/folders/download_folder.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import os
import tempfile

from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings

ctx = ClientContext(settings['url']).with_credentials(
ClientCredential(settings['client_credentials']['client_id'],
Expand Down
2 changes: 1 addition & 1 deletion examples/sharepoint/lists_and_items/data_generator.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from faker import Faker
from settings import settings

from office365.runtime.auth.userCredential import UserCredential
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.lists.list_creation_information import ListCreationInformation
from office365.sharepoint.lists.list_template_type import ListTemplateType
from settings import settings


def ensure_list(web, list_properties):
Expand Down
5 changes: 2 additions & 3 deletions examples/sharepoint/lists_and_items/read_attachments.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import os
import tempfile

from office365.sharepoint.listitems.caml import CamlQuery
from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.listitems.caml import CamlQuery
from settings import settings

download_path = tempfile.mkdtemp()

Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/lists_and_items/read_large_list.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings


def print_progress(items_read):
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/load_web_fluent_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from settings import settings

from office365.runtime.auth.clientCredential import ClientCredential
from office365.sharepoint.client_context import ClientContext
from settings import settings

credentials = ClientCredential(settings['client_credentials']['client_id'],
settings['client_credentials']['client_secret'])
Expand Down
3 changes: 1 addition & 2 deletions examples/sharepoint/read_resource_no_model.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import json

from settings import settings

from office365.runtime.auth.userCredential import UserCredential
from office365.runtime.http.request_options import RequestOptions
from office365.sharepoint.client_context import ClientContext
from settings import settings

if __name__ == '__main__':
"""Demonstrates how to construct and submit requests without model involved"""
Expand Down
1 change: 0 additions & 1 deletion examples/sharepoint/search/search_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from office365.sharepoint.search.searchService import SearchService
from settings import settings


ctx = ClientContext.connect_with_credentials(settings['url'],
UserCredential(settings['user_credentials']['username'],
settings['user_credentials']['password']))
Expand Down
1 change: 0 additions & 1 deletion generator/generate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from generator.typeBuilder import TypeBuilder

from office365.runtime.odata.odata_v3_reader import ODataV3Reader
from office365.runtime.odata.odata_v4_reader import ODataV4Reader

Expand Down
2 changes: 1 addition & 1 deletion office365/graph/base_item.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from office365.graph.entity import Entity
from office365.graph.directory.identitySet import IdentitySet
from office365.graph.entity import Entity
from office365.graph.onedrive.itemReference import ItemReference
from office365.runtime.client_query import DeleteEntityQuery

Expand Down
2 changes: 1 addition & 1 deletion office365/graph/directory/directoryObjectCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from office365.runtime.client_object_collection import ClientObjectCollection
from office365.runtime.client_result import ClientResult
from office365.runtime.http.http_method import HttpMethod
from office365.runtime.resource_path import ResourcePath
from office365.runtime.queries.serviceOperationQuery import ServiceOperationQuery
from office365.runtime.resource_path import ResourcePath


class DirectoryObjectCollection(ClientObjectCollection):
Expand Down
4 changes: 2 additions & 2 deletions office365/graph/directory/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from office365.graph.directory.directoryObjectCollection import DirectoryObjectCollection
from office365.graph.onedrive.driveCollection import DriveCollection
from office365.graph.onedrive.siteCollection import SiteCollection
from office365.graph.teams.team import Team
from office365.runtime.http.http_method import HttpMethod
from office365.runtime.resource_path import ResourcePath
from office365.runtime.queries.serviceOperationQuery import ServiceOperationQuery
from office365.graph.teams.team import Team
from office365.runtime.resource_path import ResourcePath


class Group(DirectoryObject):
Expand Down
2 changes: 1 addition & 1 deletion office365/graph/directory/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from office365.outlookservices.contact_collection import ContactCollection
from office365.outlookservices.event_collection import EventCollection
from office365.outlookservices.messageCollection import MessageCollection
from office365.runtime.resource_path import ResourcePath
from office365.runtime.queries.serviceOperationQuery import ServiceOperationQuery
from office365.runtime.resource_path import ResourcePath


class User(DirectoryObject):
Expand Down
14 changes: 7 additions & 7 deletions office365/graph/graph_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
from office365.graph.directory.directoryObjectCollection import DirectoryObjectCollection
from office365.graph.directory.groupCollection import GroupCollection
from office365.graph.directory.groupSettingTemplateCollection import GroupSettingTemplateCollection
from office365.graph.directory.user import User
from office365.graph.directory.userCollection import UserCollection
from office365.graph.one_drive_actions import DownloadContentQuery, UploadContentQuery, ReplaceMethodQuery, SearchQuery
from office365.graph.one_drive_actions import DownloadContentQuery, ReplaceMethodQuery, SearchQuery, UploadContentQuery
from office365.graph.onedrive.driveCollection import DriveCollection
from office365.graph.onedrive.sharedDriveItemCollection import SharedDriveItemCollection
from office365.graph.onedrive.siteCollection import SiteCollection
from office365.graph.teams.teamCollection import TeamCollection
from office365.outlookservices.contact_collection import ContactCollection
from office365.runtime.client_query import UpdateEntityQuery, DeleteEntityQuery
from office365.runtime.client_query import DeleteEntityQuery, UpdateEntityQuery
from office365.runtime.client_runtime_context import ClientRuntimeContext
from office365.runtime.http.http_method import HttpMethod
from office365.runtime.http.request_options import RequestOptions
from office365.runtime.odata.odata_request import ODataRequest
from office365.runtime.odata.v4_json_format import V4JsonFormat
from office365.runtime.resource_path import ResourcePath
from office365.runtime.http.http_method import HttpMethod
from office365.runtime.http.request_options import RequestOptions
from office365.graph.directory.user import User
from office365.graph.onedrive.driveCollection import DriveCollection
from office365.graph.teams.teamCollection import TeamCollection


class GraphClient(ClientRuntimeContext):
Expand Down
2 changes: 1 addition & 1 deletion office365/graph/one_drive_actions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from office365.graph.onedrive.driveItem import DriveItem
from office365.runtime.client_result import ClientResult
from office365.graph.resource_path_url import ResourcePathUrl
from office365.runtime.client_result import ClientResult
from office365.runtime.queries.serviceOperationQuery import ServiceOperationQuery


Expand Down
2 changes: 1 addition & 1 deletion office365/graph/onedrive/driveCollection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from office365.graph.onedrive.drive import Drive
from office365.runtime.client_object_collection import ClientObjectCollection
from office365.runtime.resource_path import ResourcePath
from office365.graph.onedrive.drive import Drive


class DriveCollection(ClientObjectCollection):
Expand Down
8 changes: 4 additions & 4 deletions office365/graph/onedrive/driveItem.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from office365.graph.base_item import BaseItem
from office365.graph.directory.permission_collection import PermissionCollection
from office365.graph.onedrive.folder import Folder
from office365.graph.onedrive.conflictBehavior import ConflictBehavior
from office365.graph.onedrive.file import File
from office365.graph.onedrive.fileSystemInfo import FileSystemInfo
from office365.graph.onedrive.folder import Folder
from office365.graph.onedrive.listItem import ListItem
from office365.graph.onedrive.uploadSession import UploadSession
from office365.runtime.client_query import CreateEntityQuery
from office365.runtime.client_result import ClientResult
from office365.runtime.resource_path import ResourcePath
from office365.graph.base_item import BaseItem
from office365.graph.onedrive.listItem import ListItem
from office365.runtime.queries.serviceOperationQuery import ServiceOperationQuery
from office365.runtime.resource_path import ResourcePath


class DriveItem(BaseItem):
Expand Down
4 changes: 2 additions & 2 deletions office365/graph/onedrive/driveItemCollection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from office365.runtime.client_object_collection import ClientObjectCollection
from office365.runtime.resource_path import ResourcePath
from office365.graph.onedrive.driveItem import DriveItem
from office365.graph.resource_path_url import ResourcePathUrl
from office365.runtime.client_object_collection import ClientObjectCollection
from office365.runtime.resource_path import ResourcePath


class DriveItemCollection(ClientObjectCollection):
Expand Down
4 changes: 2 additions & 2 deletions office365/graph/onedrive/list.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from office365.graph.base_item import BaseItem
from office365.graph.onedrive.listItemCollection import ListItemCollection
from office365.runtime.resource_path import ResourcePath
from office365.graph.onedrive.columnDefinitionCollection import ColumnDefinitionCollection
from office365.graph.onedrive.contentTypeCollection import ContentTypeCollection
from office365.graph.onedrive.listItemCollection import ListItemCollection
from office365.runtime.resource_path import ResourcePath


class List(BaseItem):
Expand Down
2 changes: 1 addition & 1 deletion office365/graph/onedrive/sharedDriveItemCollection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from office365.runtime.client_object_collection import ClientObjectCollection
from office365.graph.onedrive.sharedDriveItem import SharedDriveItem
from office365.runtime.client_object_collection import ClientObjectCollection


class SharedDriveItemCollection(ClientObjectCollection):
Expand Down
Loading

0 comments on commit 20ce9a6

Please sign in to comment.