adding new doctype
This commit is contained in:
16
poetry.lock
generated
16
poetry.lock
generated
@@ -73,6 +73,17 @@ optional = false
|
||||
python-versions = "*"
|
||||
version = "0.8.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "make your debug printing more friendly"
|
||||
name = "beeprint"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "2.4.10"
|
||||
|
||||
[package.dependencies]
|
||||
urwid = "*"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Python package for providing Mozilla's CA Bundle."
|
||||
@@ -1066,7 +1077,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["jaraco.itertools", "func-timeout"]
|
||||
|
||||
[metadata]
|
||||
content-hash = "44fd20a54848c7d35be309d10766f8c4a4f3fdee8d661a1ad5088085ca5aca5e"
|
||||
content-hash = "f2c161c810940af2e52283d3b1f2af77d6673bebe20a2af79cc44a14debb4bf1"
|
||||
python-versions = "^3.7"
|
||||
|
||||
[metadata.files]
|
||||
@@ -1098,6 +1109,9 @@ beautifultable = [
|
||||
{file = "beautifultable-0.8.0-py2.py3-none-any.whl", hash = "sha256:28e2e93d44a4e84511c4869da4b907345435a06728925e295790f24e1d57300c"},
|
||||
{file = "beautifultable-0.8.0.tar.gz", hash = "sha256:d44d9551bbed7bfa88675324f84efb9aa857384d44e9fb21eb530f0a0badb815"},
|
||||
]
|
||||
beeprint = [
|
||||
{file = "beeprint-2.4.10.tar.gz", hash = "sha256:b3cbe170718e696bfa05e074789212ba6aef5f096a5fd12717f14d4f1615a440"},
|
||||
]
|
||||
certifi = [
|
||||
{file = "certifi-2019.11.28-py2.py3-none-any.whl", hash = "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3"},
|
||||
{file = "certifi-2019.11.28.tar.gz", hash = "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"},
|
||||
|
||||
@@ -31,6 +31,7 @@ mkdocs = "^1.1"
|
||||
mkdocs-material = "^4.6.3"
|
||||
pymdown-extensions = "^6.3"
|
||||
mkdocstrings = "^0.8.0"
|
||||
beeprint = "^2.4.10"
|
||||
|
||||
[tool.poetry.plugins."console_scripts"]
|
||||
"musicbrainzapi" = "musicbrainzapi.cli.cli:cli"
|
||||
|
||||
@@ -1,53 +1,49 @@
|
||||
from __future__ import annotations
|
||||
from collections import Counter
|
||||
|
||||
import html
|
||||
import json
|
||||
import math
|
||||
import string
|
||||
from typing import Union, Dict
|
||||
from collections import Counter
|
||||
from typing import Dict, Union
|
||||
|
||||
import addict
|
||||
import click
|
||||
import musicbrainzngs
|
||||
import numpy as np
|
||||
import requests
|
||||
from beeprint import pp
|
||||
|
||||
from musicbrainzapi.api.lyrics.concrete_builder import LyricsConcreteBuilder
|
||||
from musicbrainzapi.api.lyrics import Lyrics
|
||||
from musicbrainzapi.api import authenticate
|
||||
from musicbrainzapi.api.lyrics import Lyrics
|
||||
from musicbrainzapi.api.lyrics.concrete_builder import LyricsConcreteBuilder
|
||||
|
||||
|
||||
class LyricsBuilder(LyricsConcreteBuilder):
|
||||
"""docstring for LyricsBuilder
|
||||
"""
|
||||
This interface will build a Lyrics object.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
album_statistics : addict.Dict
|
||||
Dictionary containing album statistics
|
||||
all_albums : list
|
||||
List of all albums + track titles
|
||||
all_albums_lyrics : list
|
||||
List of all albums + track lyrics
|
||||
all_albums_lyrics_count : list
|
||||
List of all albums + track lyrics counted by each word
|
||||
all_albums_lyrics_sum : list
|
||||
List of all albums + track lyrics counted and summed up.
|
||||
all_albums_lyrics_url : list
|
||||
List of all albums + link to lyrics api for each track.
|
||||
musicbrainz_artists : addict.Dict
|
||||
Dictionary of response from Musicbrainzapi
|
||||
release_group_ids : addict.Dict
|
||||
Dictionary of Musicbrainz release-group ids
|
||||
total_track_count : int
|
||||
Total number of tracks across all albums
|
||||
year_statistics : addict.Dict
|
||||
Dictionary containing album statistics
|
||||
!!! info "Attributes"
|
||||
- musicbrainz_artists (addict.Dict): A dict response from the Musicbrainz api for all artists.
|
||||
- release_group_ids (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
- all_albums (list): : A dict response from the Musicbrainz api for all artists.
|
||||
- total_track_count (list): : A dict response from the Musicbrainz api for all artists.
|
||||
- all_albums_lyrics_url (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
- all_albums_lyrics (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
- all_albums_lyrics_count (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
- all_albums_lyrics_sum (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
- album_statistics (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
- album_statistics (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
- year_statistics (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
- year_statistics (addict.Dict): : A dict response from the Musicbrainz api for all artists.
|
||||
|
||||
Example:
|
||||
A test example.
|
||||
"""
|
||||
|
||||
@property
|
||||
def product(self) -> Lyrics:
|
||||
product = self._product
|
||||
return product
|
||||
return self._product
|
||||
|
||||
@property
|
||||
def artist(self) -> str:
|
||||
@@ -167,7 +163,7 @@ class LyricsBuilder(LyricsConcreteBuilder):
|
||||
Dict[str, int]
|
||||
Dictionary of statistic and value.
|
||||
"""
|
||||
if len(nums) == 0:
|
||||
if not nums:
|
||||
return
|
||||
avg = math.ceil(np.mean(nums))
|
||||
median = math.ceil(np.median(nums))
|
||||
@@ -179,7 +175,7 @@ class LyricsBuilder(LyricsConcreteBuilder):
|
||||
p_75 = math.ceil(np.percentile(nums, 75))
|
||||
p_90 = math.ceil(np.percentile(nums, 90))
|
||||
count = len(nums)
|
||||
_d = addict.Dict(
|
||||
return addict.Dict(
|
||||
('avg', avg),
|
||||
('median', median),
|
||||
('std', std),
|
||||
@@ -191,10 +187,10 @@ class LyricsBuilder(LyricsConcreteBuilder):
|
||||
('p_90', p_90),
|
||||
('count', count),
|
||||
)
|
||||
return _d
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Create a builder instance to build a Lyrics object."""
|
||||
"""Create a `LyricsBuilder`.
|
||||
"""
|
||||
self.reset()
|
||||
|
||||
def reset(self) -> None:
|
||||
@@ -518,3 +514,6 @@ class LyricsBuilder(LyricsConcreteBuilder):
|
||||
self.year_statistics = addict.Dict(
|
||||
**self.year_statistics, **addict.Dict((year, _d))
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
pp(LyricsBuilder)
|
||||
|
||||
Reference in New Issue
Block a user