Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python up to 3.12, drop 2.x. #88

Merged
merged 9 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7,3.7,3.8,3.9]
python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"]

steps:
- uses: actions/checkout@v2
Expand Down
12 changes: 5 additions & 7 deletions pycronofy/client.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import datetime
import collections
import collections.abc

import hashlib
import base64
import hmac

import pytz
from future.standard_library import hooks

from pycronofy import settings
from pycronofy.auth import Auth
Expand All @@ -18,8 +17,7 @@
from pycronofy.request_handler import RequestHandler
from pycronofy.validation import validate

with hooks():
from urllib.parse import urlencode
from urllib.parse import urlencode


class Client(object):
Expand Down Expand Up @@ -808,7 +806,7 @@ def translate_available_periods(self, periods):
params[tp] = format_event_time(params[tp])

def map_availability_sequence(self, sequence):
if isinstance(sequence, collections.Iterable):
if isinstance(sequence, collections.abc.Iterable):
return list(map(lambda item: self.map_sequence_item(item), sequence))
else:
return sequence
Expand Down Expand Up @@ -856,7 +854,7 @@ def map_availability_participants(self, participants):
if type(participants) is dict:
# Allow one group to be specified without being nested
return [self.map_availability_participants_group(participants)]
elif isinstance(participants, collections.Iterable):
elif isinstance(participants, collections.abc.Iterable):
return list(map(lambda group: self.map_availability_participants_group(group), participants))
else:
return participants
Expand All @@ -870,7 +868,7 @@ def map_availability_participants_group(self, participants):
participants['required'] = 'all'

return participants
elif isinstance(participants, collections.Iterable):
elif isinstance(participants, collections.abc.Iterable):
return list(map(lambda group: self.map_availability_participants(group), participants))
else:
participants
Expand Down
2 changes: 1 addition & 1 deletion pycronofy/tests/test_availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def request_callback(request):
}

result = client.availability(required_duration={'minutes': 30}, available_periods=periods, participants=example_participants, buffer=example_buffer)
assert(len(result)) == 1
assert len(result) == 1


@responses.activate
Expand Down
3 changes: 1 addition & 2 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
requests>=2.21.0
pytz>=2018.9
future

pytest
pytest-cov
responses
flake8
flake8
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
requests>=2.21.0
pytz>=2018.9
future

pytest==6.2.4
pytest-cov==2.12.1
responses==0.5.0
pytest>=6.2.4
pytest-cov>=2.12.1
responses>=0.5.0
flake8
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ def find_version(*file_paths):
install_requires=[
"requests>=2.20.0",
"pytz>=2013.7",
"future",
],
)
16 changes: 15 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
[tox:tox]
envlist = py{3.7,3.8,3.9,3.10,3.11,3.12}

[flake8]
exclude = .tox,./build
filename = *.py
ignore = E501
ignore = E501 E721

[testenv]
basepython =
py3.7: python3.7
py3.8: python3.8
py3.9: python3.9
py3.10: python3.10
py3.11: python3.11
py3.12: python3.12
commands = pytest
deps = -rrequirements.txt