Api reference¶
Note
- The data containers are divided in two sections:
- Containers: They contain data and have some functionalities and processing properties.
- Containers-bare: They do not have any special functionality other than being datacontainers.
Containers¶
Main classes, data containers with functionalities. |
JsonDict¶
User¶
-
class
wakapy.User(fp: str)¶ Represents a user containing all the data from source file
Parameters: fp ( str) – The file path to the Wakatime json filebool- True if user has premium features.
-
fetch_data(to_fetch: str, sliced: bool) → dict¶ Parameters: Returns: dictcontaining the data.Note
The fetched data is the total_time of each
Daycontainer.(s).This is an example of it:
# 'lan' - language data = {'python': 253, 'bash': 623}
-
get_slice(date1=None, date2=None) → wakapy.user.Slice¶ Dates: Default NoneType, can be eitherstrwith the following format: YYYY-MM-DD or adatetime.dateobjectReturns: Slice
-
pie_chart(to_fetch: str, num: int = 10, sliced=False) → wakapy.plot.PieChart¶ Creates a pie chart with the given parameters.
Parameters: Returns:
Day¶
-
class
wakapy.day.Day(_dict: dict)¶ Represents a day. It contains all the data regarding a specific day. Every date is unique.
Parameters: _dict ( dict) – A dictionary containing all the data within a one day range.-
container_dict¶ dictshortcut reference to the class containers.- os: operative_systems
- lan: languages
- ent: entities
- edit: editors
- cat: categories
- proj: projects
-
operative_systems¶ List[
Os] List containing every Os object, representing every s that was used this date.
-
languages¶ List[
Language] List containing every Language object, representing every programming language that was used this date.
-
entities¶ List[
Dependency] List containing every Dependency object, representing every dependency that was used this date.
-
editors¶ List[
Editor] List containing every Editor object, representing every editor that was used this date.
-
categories¶ List[
Category] List containing every Category object, representing every category that was used this date.
-
Slice¶
-
class
wakapy.user.Slice(days, date_1=None, date_2=None)¶ Given two valid dates it’ll slice and save them. It always includes the given dates.
Parameters: - days (List[
Day]) – The list of Day objects to slice by dates. - dates (Union[
str,datetime.date]) – date_1 has to be lower than date_2 and both have to follow the YYYY-MM-DD format.
Note
str given dates will be converted to
datetime.date, so both dates can be given in any of those 2 formats independently. The slicing will be done automatically upon creating the class with two valid dates. This class can be iterated, yieldsDayfromdays()So this twos are equivalent:
myslice = Slice(dates_list, date1, date2) for day in myslice: print(day.date) for day in myslice.days: print(day.date)
-
date_1 see dates.
-
date_2 see dates.
- days (List[
Containers-bare¶
The following classes are the static data containers
Parent¶
Project¶
-
class
wakapy.containers.Project(_dict)¶ Represents a Project. It contains every container-bare plus three more.
This class adds overall more accuracy in the timings within a
DayParameters: _dict ( dict) – Dictionary that contains all the data.-
operative_systems¶ List[
Os] list containing every Os object, representing every s that was used this date.
-
languages¶ List[
Language] list containing every Language object, representing every programming language that was used this date.
-
entities¶ List[
Dependency] list containing every Dependency object, representing every dependency that was used this date.
-
editors¶ List[
Editor] list containing every Editor object, representing every editor that was used this date.
-
categories¶ List[
Category] list containing every Category object, representing every category that was used this date.
-
dependencies¶ List[
Dependency] list containing every Dependency object, representing every dependency that was used this date.
-
Child Containers¶
The following classes are all child’s of Parent
-
class
wakapy.containers.Os(_dict)¶ Class representing a wakatime Operative System data within a one day range.
-
class
wakapy.containers.Language(_dict)¶ Class representing a wakatime Programming language data within a one day range.
-
class
wakapy.containers.Entity(_dict)¶ Class representing a wakatime Entity data within a one day range. A entity can be a module, dependency.. it may vary from plugin to plugin. It’s only present in
Project
-
class
wakapy.containers.Dependency(_dict)¶ Class representing a wakatime Entity data within a one day range. A entity can be a module, dependency.. it may vary from plugin to plugin.
-
class
wakapy.containers.Category(_dict)¶ Class representing a wakatime Category data within a one day range, usually ‘Coding’
-
class
wakapy.containers.Editor(_dict)¶ Class representing a wakatime Editor data within a one day range, it does not distinguish between editors and IDEs
Extra¶
PieChart¶
-
class
wakapy.plot.PieChart(_dict, num: int, dates=None)¶ Matplotlib pie chart that comes with the library for the people that just want a quick insight of their data.
Parameters: - _dict (
dict) – The dictionary containing all the data that will be showed in the piechart. - num (
int) – Number of max elements that will be shown in the chart - dates (
datetime.date) – The dates if the data comes from a slice. Just for tagging purposes.
Note
You are suppose to access this by
pie_chart()-
save(fp: str) → None¶ Saves the figure in the given path.
matplotlib.pyplot.save(fp)Parameters: fp – str
-
show() → None¶ Shows the figure.
matplotlib.pyplot.show
- _dict (