Skip to content

Commit 301717f

Browse files
committed
Merge branch 'development'
2 parents 8586284 + bd6be2c commit 301717f

38 files changed

+901
-547
lines changed

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
ignore = E402,F401,F403
3+
exclude =
4+
.git,
5+
__pycache__,
6+
ciscosparkapi/_version.py,
7+
docs/source/conf.py,
8+
build,
9+
dist,

Makefile

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@ SHELL=/bin/bash
22

33
# Build recipes
44
.PHONY : build
5-
build : tests docs buildpackage ;
5+
build : tests docs buildpackage
6+
$(MAKE) clean
67

78
.PHONY : buildpackage
89
buildpackage : setup.py
910
python setup.py sdist
1011

1112
.PHONY : docs
1213
docs : docs/Makefile
13-
cd docs/
14-
make html
14+
cd docs/ && $(MAKE) html
15+
16+
17+
# Local project directory and environment management recipes
18+
.PHONY : init
19+
init : requirements.txt
20+
pip install -r requirements.txt
21+
22+
.PHONY : update
23+
update : clean-venv init versioneer.py
24+
rm versioneer.py
25+
versioneer install
1526

1627

1728
# Local testing recipes
@@ -33,13 +44,15 @@ lint :
3344
flake8 ciscosparkapi
3445

3546

47+
# Git recipes
48+
.PHONY : push
49+
push :
50+
git push origin --tags
51+
52+
3653
# Cleaning recipes
3754
.PHONY : clean
38-
clean : cleanbuild cleandocs cleanpytest cleantox cleandist ;
39-
40-
.PHONY : cleandist
41-
cleandist :
42-
rm -rf ./dist/*
55+
clean : cleanbuild cleandocs cleanpytest cleantox ;
4356

4457
.PHONY : cleanbuild
4558
cleanbuild :
@@ -56,3 +69,14 @@ cleantox : cleanpytest
5669
.PHONY : cleanpytest
5770
cleanpytest :
5871
rm -rf ./.cache/
72+
73+
.PHONY : clean-all
74+
clean-all : clean clean-dist ;
75+
76+
.PHONY : clean-dist
77+
cleandist :
78+
rm -rf ./dist/*
79+
80+
.PHONY : clean-venv
81+
clean-venv :
82+
pip freeze | grep -v "^-e" | xargs pip uninstall -y

ciscosparkapi/__init__.py

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,35 @@
22
"""Python API wrapper for the Cisco Spark APIs."""
33

44

5-
from __future__ import absolute_import
6-
from builtins import object
7-
from six import string_types
5+
# Use future for Python v2 and v3 compatibility
6+
from __future__ import (
7+
absolute_import,
8+
division,
9+
print_function,
10+
unicode_literals,
11+
)
12+
from builtins import *
13+
14+
from past.builtins import basestring
815

916
import os
1017

11-
from .exceptions import ciscosparkapiException, SparkApiError
12-
from .restsession import RestSession
13-
from .api.people import Person, PeopleAPI
14-
from .api.rooms import Room, RoomsAPI
15-
from .api.memberships import Membership, MembershipsAPI
16-
from .api.messages import Message, MessagesAPI
17-
from .api.teams import Team, TeamsAPI
18-
from .api.teammemberships import TeamMembership, TeamMembershipsAPI
19-
from .api.webhooks import Webhook, WebhooksAPI
20-
from .api.organizations import Organization, OrganizationsAPI
21-
from .api.licenses import License, LicensesAPI
22-
from .api.roles import Role, RolesAPI
23-
from .api.accesstokens import AccessToken, AccessTokensAPI
18+
from ciscosparkapi.exceptions import ciscosparkapiException, SparkApiError
19+
from ciscosparkapi.restsession import RestSession
20+
from ciscosparkapi.api.people import Person, PeopleAPI
21+
from ciscosparkapi.api.rooms import Room, RoomsAPI
22+
from ciscosparkapi.api.memberships import Membership, MembershipsAPI
23+
from ciscosparkapi.api.messages import Message, MessagesAPI
24+
from ciscosparkapi.api.teams import Team, TeamsAPI
25+
from ciscosparkapi.api.teammemberships import (
26+
TeamMembership,
27+
TeamMembershipsAPI
28+
)
29+
from ciscosparkapi.api.webhooks import Webhook, WebhooksAPI
30+
from ciscosparkapi.api.organizations import Organization, OrganizationsAPI
31+
from ciscosparkapi.api.licenses import License, LicensesAPI
32+
from ciscosparkapi.api.roles import Role, RolesAPI
33+
from ciscosparkapi.api.accesstokens import AccessToken, AccessTokensAPI
2434

2535

2636
__author__ = "Chris Lunsford"
@@ -91,10 +101,10 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
91101
via one of these two methods.
92102
93103
Args:
94-
access_token(string_types): The access token to be used for API
104+
access_token(str): The access token to be used for API
95105
calls to the Cisco Spark service. Defaults to checking for a
96106
SPARK_ACCESS_TOKEN environment variable.
97-
base_url(string_types): The base URL to be prefixed to the
107+
base_url(str): The base URL to be prefixed to the
98108
individual API endpoint suffixes.
99109
Defaults to ciscosparkapi.DEFAULT_BASE_URL.
100110
timeout(int): Timeout (in seconds) for RESTful HTTP requests.
@@ -111,8 +121,8 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
111121
112122
"""
113123
# Process args
114-
assert access_token is None or isinstance(access_token, string_types)
115-
assert isinstance(base_url, string_types)
124+
assert access_token is None or isinstance(access_token, basestring)
125+
assert isinstance(base_url, str)
116126
assert isinstance(timeout, int)
117127
spark_access_token = os.environ.get(ACCESS_TOKEN_ENVIRONMENT_VARIABLE)
118128
access_token = access_token if access_token else spark_access_token

0 commit comments

Comments
 (0)