Skip to content

Commit 7a05f84

Browse files
committed
Added changelog to documentation
- Added type hints to many instance variables
1 parent 7b43a31 commit 7a05f84

File tree

14 files changed

+168
-109
lines changed

14 files changed

+168
-109
lines changed

CHANGELOG.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

CHANGELOG.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
=========
2+
Changelog
3+
=========
4+
5+
.. _v1.1.0:
6+
7+
1.1.0 (2019-01-08)
8+
==================
9+
10+
- Parsing Highscores from Tibia.com and TibiaData.
11+
- Some strings from TibiaData had unpredictable trailing whitespaces,
12+
all leading and trailing whitespaces are removed.
13+
- Added type hints to many variables and methods.
14+
15+
.. _v1.0.0:
16+
17+
1.0.0 (2018-12-23)
18+
==================
19+
20+
- Added support for TibiaData JSON parsing. To have interoperability
21+
between Tibia.com and TibiaData.
22+
- Added support for parsing Houses, House lists, World and World list
23+
- Added support for many missing attributes in Character and Guilds.
24+
- All objects are now serializable to JSON strings.
25+
26+
.. _v0.1.0:
27+
28+
0.1.0 (2018-08-17)
29+
==================
30+
31+
Initial release:
32+
33+
- Parses content from tibia.com
34+
35+
- Character pages
36+
- Guild pages
37+
- Guild list pages
38+
39+
- Parses content into JSON format strings.
40+
- Parses content into Python objects.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
include requirements.txt
22
include README.md
3-
include CHANGELOG.md
3+
include CHANGELOG.rst
44
include LICENSE

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../CHANGELOG.rst

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def setup(app):
100100
'github_repo': 'tibia.py',
101101
'github_type': 'star',
102102
'fixed_sidebar': True,
103-
'travis_button': True
103+
'travis_button': True,
104+
'donate_url': 'https://beerpay.io/Galarzaa90/tibia.py'
104105
}
105106

106107
# Add any paths that contain custom static files (such as style sheets) here,

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Indices and tables
3232

3333
intro
3434
api
35+
changelog
3536

3637
* :ref:`genindex`
3738
* :ref:`search`

setup.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ def get_version(package):
1414
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
1515

1616

17+
version = get_version("tibiapy")
18+
if version.endswith(('a', 'b', 'rc')):
19+
# append version identifier based on commit count
20+
try:
21+
import subprocess
22+
p = subprocess.Popen(['git', 'rev-list', '--count', 'HEAD'],
23+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
24+
out, err = p.communicate()
25+
if out:
26+
version += out.decode('utf-8').strip()
27+
p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
28+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
29+
out, err = p.communicate()
30+
if out:
31+
version += '+g' + out.decode('utf-8').strip()
32+
except Exception:
33+
pass
34+
1735
with open('requirements.txt') as f:
1836
requirements = f.read().splitlines()
1937

@@ -33,7 +51,7 @@ def get_version(package):
3351

3452
setup(
3553
name='tibia.py',
36-
version=get_version("tibiapy"),
54+
version=version,
3755
author='Galarzaa90',
3856
author_email="allan.galarza@gmail.com",
3957
url='https://github.com/Galarzaa90/tibia.py',

tests/resources/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ exist.
5454
- [tibiadata_list.json](house/tibiadata_list.json) - A house list on TibiaData.
5555
- [tibiadata_list_not_found.json](house/tibiadata_list_not_found.json) - The TibiaData response for a house list that
5656
doesn't exist.
57+
58+
## Highscores resources
59+
- [tibiacom_full.txt](highscores/tibiacom_full.txt) - The content of a correct highscore's pagem
60+
- [tibiacom_empty.txt](highscores/tibiacom_empty.txt) - The content of the highscores page of a nonexistent world.
61+
- [tibiacom_experience.txt](highscores/tibiacom_experience.txt) - The content of an experience highscores page.
62+
- [tibiacom_loyalty.txt](highscores/tibiacom_loyalty.txt) - The content of a loyalty highscores page.
63+
- [tibiadata_full.json](highscores/tibiadata_full.json) - A highscores response from TibiaData.
64+
- [tibiadata_empty.json](highscores/tibiadata_empty.json) - A highscores response from TibiaData of a nonexistent world.
65+
- [tibiadata_experience.json](highscores/tibiadata_experience.json) - A response containing experience highscores from
66+
TibiaData.
67+
- [tibiadata_loyalty.json](highscores/tibiadata_loyalty.json) - A response containing loyalty highscores from TibiaData.
5768

5869
## World resources
5970
- [tibiacom_online.txt](world/tibiacom_online.txt) - An online world on Tibia.com.

tibiapy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
from tibiapy.house import *
88
from tibiapy.world import *
99

10-
__version__ = '1.0.0'
10+
__version__ = '1.1.0rc'

tibiapy/character.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class AccountInformation(abc.Serializable):
4848
__slots__ = ("created", "loyalty_title", "position")
4949

5050
def __init__(self, created, loyalty_title=None, position=None):
51-
self.created = created
52-
self.loyalty_title = loyalty_title
53-
self.position = position
51+
self.created = try_datetime(created)
52+
self.loyalty_title = loyalty_title # type: Optional[str]
53+
self.position = position # type: Optional[str]
5454

5555
def __repr__(self):
5656
return "<%s created=%r>" % (self.__class__.__name__, self.created)
@@ -69,8 +69,8 @@ class Achievement(abc.Serializable):
6969
__slots__ = ("name", "grade")
7070

7171
def __init__(self, name, grade):
72-
self.name = name
73-
self.grade = grade
72+
self.name = name # type: str
73+
self.grade = int(grade)
7474

7575
def __repr__(self):
7676
return "<%s name=%r grade=%d>" % (self.__class__.__name__, self.name, self.grade)
@@ -134,8 +134,8 @@ def __init__(self, name=None, world=None, vocation=None, level=0, sex=None, **kw
134134
self.former_names = kwargs.get("former_names", []) # type: List[str]
135135
self.sex = try_enum(Sex, sex)
136136
self.vocation = try_enum(Vocation, vocation)
137-
self.level = level # type: int
138-
self.achievement_points = kwargs.get("achievement_points", 0) # type: int
137+
self.level = int(level)
138+
self.achievement_points = int(kwargs.get("achievement_points", 0))
139139
self.world = world # type: str
140140
self.former_world = kwargs.get("former_world") # type: Optional[str]
141141
self.residence = kwargs.get("residence") # type: str
@@ -622,8 +622,8 @@ class GuildMembership(abc.BaseGuild):
622622
__slots__ = ("rank",)
623623

624624
def __init__(self, name, rank):
625-
self.name = name
626-
self.rank = rank
625+
self.name = name # type: str
626+
self.rank = rank # type: str
627627

628628
def __repr__(self):
629629
return "<{0.__class__.__name__} name={0.name!r} rank={0.rank!r}>".format(self)
@@ -651,9 +651,9 @@ class Killer(abc.Serializable):
651651
__slots__ = ("name", "player", "summon")
652652

653653
def __init__(self, name, player=False, summon=None):
654-
self.name = name
655-
self.player = player
656-
self.summon = summon
654+
self.name = name # type: str
655+
self.player = player # type: bool
656+
self.summon = summon # type: Optional[str]
657657

658658
def __repr__(self):
659659
attributes = ""
@@ -695,11 +695,11 @@ class OtherCharacter(abc.BaseCharacter):
695695
"""
696696
__slots__ = ("world", "online", "deleted")
697697

698-
def __init__(self, name, world=None, online=False, deleted=False):
699-
self.name = name
700-
self.world = world
701-
self.online = online
702-
self.deleted = deleted
698+
def __init__(self, name, world, online=False, deleted=False):
699+
self.name = name # type: str
700+
self.world = world # type: str
701+
self.online = online # type: bool
702+
self.deleted = deleted # type: bool
703703

704704

705705
class OnlineCharacter(abc.BaseCharacter):
@@ -719,7 +719,7 @@ class OnlineCharacter(abc.BaseCharacter):
719719
__slots__ = ("world", "vocation", "level")
720720

721721
def __init__(self, name, world, level, vocation):
722-
self.name = name
723-
self.world = world
722+
self.name = name # type: str
723+
self.world = world # type: str
724724
self.level = int(level)
725725
self.vocation = try_enum(Vocation, vocation)

0 commit comments

Comments
 (0)