Skip to content

Commit

Permalink
dropped support for python 3.5 and some refactoring (#13)
Browse files Browse the repository at this point in the history
* dropped support for python 3.5 and some refactoring

* Update Python in ReadMe

Co-authored-by: Zulqarnain <[email protected]>
  • Loading branch information
mraarif and Zulqarnain authored Jan 18, 2021
1 parent afcaec1 commit c1ec351
Show file tree
Hide file tree
Showing 46 changed files with 80 additions and 77 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: python
python:
- 3.5
- 3.8
install:
- pip install -r requirements/travis.txt
Expand All @@ -13,6 +12,6 @@ deploy:
distributions: sdist bdist_wheel
on:
tags: true
python: 3.5
python: 3.8
password:
secure: XftLPhN6LpfOxPTiTnlwFDi53qjZIkp0VeR+Ydy4MTUbJKla5/yfXfSFmBX0lHN3PYa1A2A4rIUhvMWd9j66ist+2nqPjcJJy1DwSX1nKgVLanOpV/fFTC8yt/BOxgiaT+vdOUdoi3LmbTpezc6dYZHPmts5maAtG/RLGZG9Bcoreu28WPCGv45t1t36s+HUxtbDrMCTEqgwrBKJiaHza3m1XtFOjF722ypyoOlPPutq565tlmacJ7A44jaCrv/6SVtPCOsBd48qXyULvpZJdWor2vGdKzPQOWi7cOLty6iNc9chHCP5CCCJvRIwiv3RMkOhtcxqT/ch5eVhzBpTb8uV3upbQslP88q8bGeMVDWNBnpwPvNYipMX4mEJHKCESzGp9doJtPF17e3fPw7L52sGtHbn8peLm0Itw65W8UH1w49LDmJSOqPeZmzlSg/tp/Tt4FvYWt8zxH2J5Q4UReM5SCROWfBq5Asn1rzHZCgHauLRrBd0SjeO9RgDHPsuDUZmvzMiJ/wPwQ21IpSXl7xBEx79mI3NOdYRGxOA+y8fQUdfPLtY0TV3xhv4dU6YCc2jrpmwNu07jbHO5w47RtZr0TBfIR6wjcVMSeQBtUkKpn0QPKN+JpAU6qrEeDNx92YUm6V0z7MXZmtcxr/dcxq4fsTK5hQqy2zOzkw8VYY=
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ For more information about the Tin Can API visit:

<http://tincanapi.com/>

Requires Python 2.7 or later.
Requires Python 3.8 or later.

## Installation
TinCanPython requires [Python 2.7](https://www.python.org/downloads/) or later. Python 3 is not supported.
TinCanPython requires [Python 3.8](https://www.python.org/downloads/) or later.

If you are installing from the Github repo, you will need to install `aniso8601` and `pytz` (use `sudo` as necessary):

Expand Down
17 changes: 8 additions & 9 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Tin Can Python documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 10 12:52:27 2014.
Expand Down Expand Up @@ -57,8 +56,8 @@ def setup(app):
master_doc = 'index'

# General information about the project.
project = u'Tin Can Python'
copyright = u'2014, Rustici Software'
project = 'Tin Can Python'
copyright = '2014, Rustici Software'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -209,8 +208,8 @@ def setup(app):
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'TinCanPython.tex', u'Tin Can Python Documentation',
u'Rustici Software', 'manual'),
('index', 'TinCanPython.tex', 'Tin Can Python Documentation',
'Rustici Software', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -239,8 +238,8 @@ def setup(app):
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'tincanpython', u'Tin Can Python Documentation',
[u'Rustici Software'], 1)
('index', 'tincanpython', 'Tin Can Python Documentation',
['Rustici Software'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -253,8 +252,8 @@ def setup(app):
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'TinCanPython', u'Tin Can Python Documentation',
u'Rustici Software', 'TinCanPython',
('index', 'TinCanPython', 'Tin Can Python Documentation',
'Rustici Software', 'TinCanPython',
'One line description of project.', 'Miscellaneous'),
]

Expand Down
6 changes: 4 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
#
# make upgrade
#
aniso8601==8.0.0 # via -r requirements/base.in
pytz==2020.1 # via -r requirements/base.in
aniso8601==8.1.0
# via -r requirements/base.in
pytz==2020.5
# via -r requirements/base.in
7 changes: 4 additions & 3 deletions requirements/pip_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#
# make upgrade
#
click==7.1.2 # via pip-tools
pip-tools==5.2.1 # via -r requirements/pip_tools.in
six==1.15.0 # via pip-tools
click==7.1.2
# via pip-tools
pip-tools==5.5.0
# via -r requirements/pip_tools.in

# The following packages are considered to be unsafe in a requirements file:
# pip
6 changes: 4 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
#
# make upgrade
#
aniso8601==8.0.0 # via -r requirements/base.txt
pytz==2020.1 # via -r requirements/base.txt
aniso8601==8.1.0
# via -r requirements/base.txt
pytz==2020.5
# via -r requirements/base.txt
6 changes: 4 additions & 2 deletions requirements/travis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
#
# make upgrade
#
aniso8601==8.0.0 # via -r requirements/test.txt
pytz==2020.1 # via -r requirements/test.txt
aniso8601==8.1.0
# via -r requirements/test.txt
pytz==2020.5
# via -r requirements/test.txt
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ def is_requirement(line):
'tincan/conversions',
'tincan/documents',
],
version='0.0.9',
version='1.0.0',
description='A Python 3 library for implementing Tin Can API.',
author='edX',
author_email='[email protected]',
classifiers=[
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.8',
],
maintainer_email='mailto:[email protected]',
Expand Down
2 changes: 1 addition & 1 deletion test/documents/activity_profile_document_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_init_arg_exception_dict(self):
ActivityProfileDocument(d)

def test_init_arg_exception_obj(self):
class Tester(object):
class Tester:
def __init__(self, id=None, bad_test="test"):
self.id = id
self.bad_test = bad_test
Expand Down
2 changes: 1 addition & 1 deletion test/documents/agent_profile_document_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_init_arg_exception_dict(self):
AgentProfileDocument(d)

def test_init_arg_exception_obj(self):
class Tester(object):
class Tester:
def __init__(self, id=None, bad_test="test"):
self.id = id
self.bad_test = bad_test
Expand Down
2 changes: 1 addition & 1 deletion test/documents/document_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_init_arg_exception_dict(self):
Document(d)

def test_init_arg_exception_obj(self):
class Tester(object):
class Tester:
def __init__(self, id=None, bad_test="test"):
self.id = id
self.bad_test = bad_test
Expand Down
2 changes: 1 addition & 1 deletion test/documents/state_document_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_init_arg_exception_dict(self):
StateDocument(d)

def test_init_arg_exception_obj(self):
class Tester(object):
class Tester:
def __init__(self, id=None, bad_test="test"):
self.id = id
self.bad_test = bad_test
Expand Down
6 changes: 3 additions & 3 deletions test/http_request_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_init_arg_exception_dict(self):
HTTPRequest(d)

def test_init_arg_exception_obj(self):
class Tester(object):
class Tester:
def __init__(self, resource="ok", bad_test="test"):
self.resource = resource
self.bad_test = bad_test
Expand Down Expand Up @@ -153,7 +153,7 @@ def test_setters_none(self):
self.assertEqual(req.query_params, {})

def test_headers_setter(self):
class Tester(object):
class Tester:
def __init__(self, param="ok", tester="test"):
self.param = param
self.tester = tester
Expand All @@ -169,7 +169,7 @@ def __init__(self, param="ok", tester="test"):
self.assertEqual(req.headers["tester"], "test")

def test_query_params_setter(self):
class Tester(object):
class Tester:
def __init__(self, param="ok", tester="test"):
self.param = param
self.tester = tester
Expand Down
9 changes: 4 additions & 5 deletions test/lrs_response_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding=utf-8
#
# Copyright 2014 Rustici Software
#
Expand Down Expand Up @@ -59,7 +58,7 @@ def test_init_arg_exception_dict(self):
LRSResponse(d)

def test_init_arg_exception_obj(self):
class Tester(object):
class Tester:
def __init__(self, success=True, bad_test="test"):
self.success = success
self.bad_test = bad_test
Expand Down Expand Up @@ -143,7 +142,7 @@ def test_unicode(self):

self.assertIsInstance(resp, LRSResponse)
self.assertIsInstance(resp.data, str)
self.assertEqual(resp.data, u"δοκιμή περιεχομένου")
self.assertEqual(resp.data, "δοκιμή περιεχομένου")

def test_setters_none(self):
resp = LRSResponse()
Expand All @@ -168,7 +167,7 @@ def test_setters_none(self):
self.assertIsNone(resp.response)

def test_request_setter(self):
class Tester(object):
class Tester:
def __init__(self, resource="ok", headers=None):
if headers is None:
headers = {"test": "ok"}
Expand All @@ -188,7 +187,7 @@ def __init__(self, resource="ok", headers=None):
self.assertEqual(resp.request.headers, {"test": "ok"})

def test_response_setter(self):
class Tester(object):
class Tester:
def __init__(self, msg="ok", version="test"):
self.msg = msg
self.version = version
Expand Down
2 changes: 1 addition & 1 deletion tincan/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, *args, **kwargs):
self._version = None
self._extensions = None

super(About, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def version(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, *args, **kwargs):
self._object_type = None
self._definition = None

super(Activity, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def id(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/activity_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, *args, **kwargs):
self._steps = None
self._extensions = None

super(ActivityDefinition, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def name(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, *args, **kwargs):
self._openid = None
self._account = None

super(Agent, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def object_type(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/agent_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, *args, **kwargs):
self._name = None
self._home_page = None

super(AgentAccount, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def name(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, *args, **kwargs):
self._description = None
self._fileurl = None

super(Attachment, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def usage_type(self):
Expand Down
6 changes: 3 additions & 3 deletions tincan/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"""


class Base(object):
class Base:
_props = []

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -56,7 +56,7 @@ def __setattr__(self, attr, value):
"""
if attr.startswith('_') and attr[1:] in self._props:
super(Base, self).__setattr__(attr, value)
super().__setattr__(attr, value)
elif attr not in self._props:
raise AttributeError(
"Property '%s' cannot be set on a 'tincan.%s' object. Allowed properties: %s" %
Expand All @@ -66,7 +66,7 @@ def __setattr__(self, attr, value):
', '.join(self._props)
))
else:
super(Base, self).__setattr__(attr, value)
super().__setattr__(attr, value)

def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
2 changes: 1 addition & 1 deletion tincan/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, *args, **kwargs):
self._statement = None
self._extensions = None

super(Context, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def registration(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/context_activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, *args, **kwargs):
self._grouping = None
self._other = None

super(ContextActivities, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def category(self):
Expand Down
6 changes: 3 additions & 3 deletions tincan/conversions/iso8601.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ def jsonify_timedelta(value):
# hours
bigger_exists = date or hours
if bigger_exists:
time += '{:02}H'.format(hours)
time += f'{hours:02}H'

# minutes
bigger_exists = bigger_exists or minutes
if bigger_exists:
time += '{:02}M'.format(minutes)
time += f'{minutes:02}M'

# seconds
if seconds.is_integer():
Expand All @@ -130,7 +130,7 @@ def jsonify_timedelta(value):
# remove trailing zeros
seconds = seconds.rstrip('0')

time += '{}S'.format(seconds)
time += f'{seconds}S'

return 'P' + date + time

Expand Down
2 changes: 1 addition & 1 deletion tincan/documents/activity_profile_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ActivityProfileDocument(Document):

def __init__(self, *args, **kwargs):
self._activity = None
super(ActivityProfileDocument, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def activity(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/documents/agent_profile_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AgentProfileDocument(Document):

def __init__(self, *args, **kwargs):
self._agent = None
super(AgentProfileDocument, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def agent(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/documents/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, *args, **kwargs):
self._etag = None
self._timestamp = None

super(Document, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def id(self):
Expand Down
2 changes: 1 addition & 1 deletion tincan/documents/state_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, *args, **kwargs):
self._activity = None
self._registration = None

super(StateDocument, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@property
def agent(self):
Expand Down
Loading

0 comments on commit c1ec351

Please sign in to comment.