index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
27,096 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/tuho.py | 27,28 | 1,39 | get_real_url | 28,36 | 28,36 | # 星光直播:https://www.tuho.tv/28545037
import requests
import re
class TuHo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
res = s.get(f'https://www.tuho.tv/{self.rid}').text
flv = re.search(r'videoPlayFlv":"(https[\s\S]+?flv)... | # 星光直播:https://www.tuho.tv/28545037
import requests
import re
class TuHo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
res = s.get(f'https://www.tuho.tv/{self.rid}').text
flv = re.search(r'videoPlayFlv":"(https[\s\S]+?flv)... | try:
th = TuHo(rid)
return th.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
th = TuHo(rid)
return th.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 292 | 56 | 348 | # 星光直播:https://www.tuho.tv/28545037
import requests
import re
class TuHo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
res = s.get(f'https://www.tuho.tv/{self.rid}').text
flv = re.search(r'videoPlayFlv":"(https[\s\S]+?flv)... | # 星光直播:https://www.tuho.tv/28545037
import requests
import re
class TuHo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
res = s.get(f'https://www.tuho.tv/{self.rid}').text
flv = re.search(r'videoPlayFlv":"(https[\s\S]+?flv)... | |
27,097 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/tuho.py | 12,13 | 7,27 | get_real_url | TuHo | 13,27 | 13,27 | class TuHo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | class TuHo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | with requests.Session() as s:
res = s.get(f'https://www.tuho.tv/{self.rid}').text
flv = re.search(r'videoPlayFlv":"(https[\s\S]+?flv)', res)
if flv:
status = re.search(r'isPlaying\s:\s(\w+),', res).group(1)
if status == 'true':
real_url = flv.g... | with requests.Session() as s:
res = s.get(f'https://www.tuho.tv/{self.rid}').text
flv = re.search(r'videoPlayFlv":"(https[\s\S]+?flv)', res)
if flv:
status = re.search(r'isPlaying\s:\s(\w+),', res).group(1)
if status == 'true':
real_url = flv.g... | 33 | 46 | 176 | 222 | # 星光直播:https://www.tuho.tv/28545037
import requests
import re
class TuHo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
th = TuHo(rid)
return th.get_real_url()
except Exception as e:
print('Exception:', e)
... | # 星光直播:https://www.tuho.tv/28545037
import requests
import re
class TuHo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
th = TuHo(rid)
return th.get_real_url()
except Exception as e:
print('Exception:', e)
... |
27,098 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/twitch.py | 82,83 | 1,94 | get_real_url | 83,91 | 83,91 | # -*- coding: utf-8 -*-
# @Time: 2021/5/2 16:20
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import json
import re
from urllib.parse import urlencode
# twitch 直播需要科学上网
import requests
class Twitch:
def __init__(self, rid):
# rid = channel_name
self.rid = rid
with reque... | # -*- coding: utf-8 -*-
# @Time: 2021/5/2 16:20
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import json
import re
from urllib.parse import urlencode
# twitch 直播需要科学上网
import requests
class Twitch:
def __init__(self, rid):
# rid = channel_name
self.rid = rid
with reque... | try:
tw = Twitch(rid)
return tw.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
tw = Twitch(rid)
return tw.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 980 | 55 | 1,035 | # -*- coding: utf-8 -*-
# @Time: 2021/5/2 16:20
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import json
import re
from urllib.parse import urlencode
# twitch 直播需要科学上网
import requests
class Twitch:
def __init__(self, rid):
# rid = channel_name
self.rid = rid
with reque... | # -*- coding: utf-8 -*-
# @Time: 2021/5/2 16:20
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import json
import re
from urllib.parse import urlencode
# twitch 直播需要科学上网
import requests
class Twitch:
def __init__(self, rid):
# rid = channel_name
self.rid = rid
with reque... | |
27,099 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/twitch.py | 23,24 | 15,82 | get_client_id | Twitch | 24,31 | 24,31 | class Twitch:
def __init__(self, rid):
# rid = channel_name
self.rid = rid
with requests.Session() as self.s:
pass
def get_client_id(self):
FILL_FUNC_BODY def get_sig_token(self):
data = {
"operationName": "PlaybackAccessToken_Template",
"... | class Twitch:
def __init__(self, rid):
# rid = channel_name
self.rid = rid
with requests.Session() as self.s:
pass
def get_client_id(self):
FILL_FUNC_BODY def get_sig_token(self):
data = {
"operationName": "PlaybackAccessToken_Template",
"... | try:
res = self.s.get(f'https://www.twitch.tv/{self.rid}').text
client_id = re.search(r'clientId="(.*?)"', res).group(1)
return client_id
except requests.exceptions.ConnectionError:
raise Exception('ConnectionError')
| try:
res = self.s.get(f'https://www.twitch.tv/{self.rid}').text
client_id = re.search(r'clientId="(.*?)"', res).group(1)
return client_id
except requests.exceptions.ConnectionError:
raise Exception('ConnectionError')
| 14 | 751 | 90 | 841 | # -*- coding: utf-8 -*-
# @Time: 2021/5/2 16:20
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import json
import re
from urllib.parse import urlencode
# twitch 直播需要科学上网
import requests
class Twitch:
def __init__(self, rid):
# rid = channel_name
self.rid = rid
with reque... | # -*- coding: utf-8 -*-
# @Time: 2021/5/2 16:20
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import json
import re
from urllib.parse import urlencode
# twitch 直播需要科学上网
import requests
class Twitch:
def __init__(self, rid):
# rid = channel_name
self.rid = rid
with reque... |
27,100 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/v6cn.py | 26,27 | 1,38 | get_real_url | 27,35 | 27,35 | # 获取六间房直播的真实流媒体地址。
import requests
import re
class V6CN:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
try:
response = requests.get(f'https://v.6.cn/{self.rid}').text
result = re.findall(r'"flvtitle":"v(\d*?)-(\d*?)"', response)[0]
uid =... | # 获取六间房直播的真实流媒体地址。
import requests
import re
class V6CN:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
try:
response = requests.get(f'https://v.6.cn/{self.rid}').text
result = re.findall(r'"flvtitle":"v(\d*?)-(\d*?)"', response)[0]
uid =... | try:
v6cn = V6CN(rid)
return v6cn.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
v6cn = V6CN(rid)
return v6cn.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 339 | 60 | 399 | # 获取六间房直播的真实流媒体地址。
import requests
import re
class V6CN:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
try:
response = requests.get(f'https://v.6.cn/{self.rid}').text
result = re.findall(r'"flvtitle":"v(\d*?)-(\d*?)"', response)[0]
uid =... | # 获取六间房直播的真实流媒体地址。
import requests
import re
class V6CN:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
try:
response = requests.get(f'https://v.6.cn/{self.rid}').text
result = re.findall(r'"flvtitle":"v(\d*?)-(\d*?)"', response)[0]
uid =... | |
27,101 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/v6cn.py | 12,13 | 7,26 | get_real_url | V6CN | 13,26 | 13,26 | class V6CN:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | class V6CN:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | try:
response = requests.get(f'https://v.6.cn/{self.rid}').text
result = re.findall(r'"flvtitle":"v(\d*?)-(\d*?)"', response)[0]
uid = result[0]
flvtitle = 'v{}-{}'.format(*result)
response = requests.get(f'https://rio.6rooms.com/live/?s={uid}').text
... | try:
response = requests.get(f'https://v.6.cn/{self.rid}').text
result = re.findall(r'"flvtitle":"v(\d*?)-(\d*?)"', response)[0]
uid = result[0]
flvtitle = 'v{}-{}'.format(*result)
response = requests.get(f'https://rio.6rooms.com/live/?s={uid}').text
... | 33 | 46 | 231 | 277 | # 获取六间房直播的真实流媒体地址。
import requests
import re
class V6CN:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
v6cn = V6CN(rid)
return v6cn.get_real_url()
except Exception as e:
print('Exception:', e)
return... | # 获取六间房直播的真实流媒体地址。
import requests
import re
class V6CN:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
v6cn = V6CN(rid)
return v6cn.get_real_url()
except Exception as e:
print('Exception:', e)
return... |
27,102 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/wali.py | 23,24 | 1,35 | get_real_url | 24,32 | 24,32 | # 小米直播:https://live.wali.com/fe
import requests
class WaLi:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
zuid = self.rid.split('_')[0]
with requests.Session() as s:
res = s.get(f'https://s.zb.mi.com/get_liveinfo?lid={self.rid}&zuid={zuid}').json()
... | # 小米直播:https://live.wali.com/fe
import requests
class WaLi:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
zuid = self.rid.split('_')[0]
with requests.Session() as s:
res = s.get(f'https://s.zb.mi.com/get_liveinfo?lid={self.rid}&zuid={zuid}').json()
... | try:
wali = WaLi(rid)
return wali.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
wali = WaLi(rid)
return wali.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 252 | 57 | 309 | # 小米直播:https://live.wali.com/fe
import requests
class WaLi:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
zuid = self.rid.split('_')[0]
with requests.Session() as s:
res = s.get(f'https://s.zb.mi.com/get_liveinfo?lid={self.rid}&zuid={zuid}').json()
... | # 小米直播:https://live.wali.com/fe
import requests
class WaLi:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
zuid = self.rid.split('_')[0]
with requests.Session() as s:
res = s.get(f'https://s.zb.mi.com/get_liveinfo?lid={self.rid}&zuid={zuid}').json()
... | |
27,103 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/wali.py | 11,12 | 6,23 | get_real_url | WaLi | 12,23 | 12,23 | class WaLi:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | class WaLi:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | zuid = self.rid.split('_')[0]
with requests.Session() as s:
res = s.get(f'https://s.zb.mi.com/get_liveinfo?lid={self.rid}&zuid={zuid}').json()
status = res['data']['status']
if status == 1:
flv = res['data']['video']['flv']
return flv.replace('http', '... | zuid = self.rid.split('_')[0]
with requests.Session() as s:
res = s.get(f'https://s.zb.mi.com/get_liveinfo?lid={self.rid}&zuid={zuid}').json()
status = res['data']['status']
if status == 1:
flv = res['data']['video']['flv']
return flv.replace('http', '... | 26 | 45 | 145 | 190 | # 小米直播:https://live.wali.com/fe
import requests
class WaLi:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
wali = WaLi(rid)
return wali.get_real_url()
except Exception as e:
print('Exception:', e)
ret... | # 小米直播:https://live.wali.com/fe
import requests
class WaLi:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
wali = WaLi(rid)
return wali.get_real_url()
except Exception as e:
print('Exception:', e)
ret... |
27,104 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/woxiu.py | 31,32 | 1,43 | get_real_url | 32,40 | 32,40 | # 我秀直播:https://www.woxiu.com/
import requests
class WoXiu:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
headers = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
'like Gecko) Ve... | # 我秀直播:https://www.woxiu.com/
import requests
class WoXiu:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
headers = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
'like Gecko) Ve... | try:
wx = WoXiu(rid)
return wx.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
wx = WoXiu(rid)
return wx.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 350 | 57 | 407 | # 我秀直播:https://www.woxiu.com/
import requests
class WoXiu:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
headers = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
'like Gecko) Ve... | # 我秀直播:https://www.woxiu.com/
import requests
class WoXiu:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
headers = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
'like Gecko) Ve... | |
27,105 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/woxiu.py | 11,12 | 6,31 | get_real_url | WoXiu | 12,31 | 12,31 | class WoXiu:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | class WoXiu:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | headers = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
'like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 '
}
url = f'https://m.woxiu.com/index.php?action=M/Live&do=LiveInfo&room_id={self.rid}'
... | headers = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
'like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 '
}
url = f'https://m.woxiu.com/index.php?action=M/Live&do=LiveInfo&room_id={self.rid}'
... | 56 | 47 | 247 | 294 | # 我秀直播:https://www.woxiu.com/
import requests
class WoXiu:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
wx = WoXiu(rid)
return wx.get_real_url()
except Exception as e:
print('Exception:', e)
return ... | # 我秀直播:https://www.woxiu.com/
import requests
class WoXiu:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
wx = WoXiu(rid)
return wx.get_real_url()
except Exception as e:
print('Exception:', e)
return ... |
27,106 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/xunlei.py | 45,46 | 1,57 | get_real_url | 46,54 | 46,54 | # 迅雷直播:https://live.xunlei.com/global/index.html?id=0
import requests
import hashlib
import time
from urllib.parse import urlencode
class XunLei:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
url = 'https://biz-live-ssl.xunlei.com//caller'
headers = {
'... | # 迅雷直播:https://live.xunlei.com/global/index.html?id=0
import requests
import hashlib
import time
from urllib.parse import urlencode
class XunLei:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
url = 'https://biz-live-ssl.xunlei.com//caller'
headers = {
'... | try:
xl = XunLei(rid)
return xl.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
xl = XunLei(rid)
return xl.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 489 | 59 | 548 | # 迅雷直播:https://live.xunlei.com/global/index.html?id=0
import requests
import hashlib
import time
from urllib.parse import urlencode
class XunLei:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
url = 'https://biz-live-ssl.xunlei.com//caller'
headers = {
'... | # 迅雷直播:https://live.xunlei.com/global/index.html?id=0
import requests
import hashlib
import time
from urllib.parse import urlencode
class XunLei:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
url = 'https://biz-live-ssl.xunlei.com//caller'
headers = {
'... | |
27,107 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/xunlei.py | 14,15 | 9,45 | get_real_url | XunLei | 15,45 | 15,45 | class XunLei:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | class XunLei:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | url = 'https://biz-live-ssl.xunlei.com//caller'
headers = {
'cookie': 'appid=1002'
}
_t = int(time.time() * 1000)
u = '1002'
f = '&*%$7987321GKwq'
params = {
'_t': _t,
'a': 'play',
'c': 'room',
'hid': 'h5... | url = 'https://biz-live-ssl.xunlei.com//caller'
headers = {
'cookie': 'appid=1002'
}
_t = int(time.time() * 1000)
u = '1002'
f = '&*%$7987321GKwq'
params = {
'_t': _t,
'a': 'play',
'c': 'room',
'hid': 'h5... | 74 | 47 | 370 | 417 | # 迅雷直播:https://live.xunlei.com/global/index.html?id=0
import requests
import hashlib
import time
from urllib.parse import urlencode
class XunLei:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
xl = XunLei(rid)
return xl.... | # 迅雷直播:https://live.xunlei.com/global/index.html?id=0
import requests
import hashlib
import time
from urllib.parse import urlencode
class XunLei:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
xl = XunLei(rid)
return xl.... |
27,108 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/yangshipin.py | 22,23 | 1,118 | aes_encrypt | 26,36 | 23,36 | # -*- coding: utf-8 -*-
# @Time: 2021/5/3 12:28
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
# CCTV-1: https://m.yangshipin.cn/video?type=1&vid=2000210103&pid=600001859
# 需要替换 headers 中登陆的 cookie
# 目前网页版链接有效时间很短,且每个IP每天的请求数量有限制
# APP版本的链接放时间更长,但需要反编译获取ckey生成方式,以后再更新。
import binascii
import ctypes
im... | # -*- coding: utf-8 -*-
# @Time: 2021/5/3 12:28
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
# CCTV-1: https://m.yangshipin.cn/video?type=1&vid=2000210103&pid=600001859
# 需要替换 headers 中登陆的 cookie
# 目前网页版链接有效时间很短,且每个IP每天的请求数量有限制
# APP版本的链接放时间更长,但需要反编译获取ckey生成方式,以后再更新。
import binascii
import ctypes
im... | key = binascii.a2b_hex('4E2918885FD98109869D14E0231A0BF4')
iv = binascii.a2b_hex('16B17E519DDD0CE5B79D7A63A4DD801C')
pad = 16 - len(text) % 16
text = text + pad * chr(pad)
text = text.encode()
cipher = AES.new(key, AES.MODE_CBC, iv)
encrypt_bytes = cipher.encrypt(text)
return binascii.b2... | """
AES加密
"""
key = binascii.a2b_hex('4E2918885FD98109869D14E0231A0BF4')
iv = binascii.a2b_hex('16B17E519DDD0CE5B79D7A63A4DD801C')
pad = 16 - len(text) % 16
text = text + pad * chr(pad)
text = text.encode()
cipher = AES.new(key, AES.MODE_CBC, iv)
encrypt_bytes = cipher.encrypt(te... | 33 | 1,188 | 197 | 1,385 | # -*- coding: utf-8 -*-
# @Time: 2021/5/3 12:28
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
# CCTV-1: https://m.yangshipin.cn/video?type=1&vid=2000210103&pid=600001859
# 需要替换 headers 中登陆的 cookie
# 目前网页版链接有效时间很短,且每个IP每天的请求数量有限制
# APP版本的链接放时间更长,但需要反编译获取ckey生成方式,以后再更新。
import binascii
import ctypes
im... | # -*- coding: utf-8 -*-
# @Time: 2021/5/3 12:28
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
# CCTV-1: https://m.yangshipin.cn/video?type=1&vid=2000210103&pid=600001859
# 需要替换 headers 中登陆的 cookie
# 目前网页版链接有效时间很短,且每个IP每天的请求数量有限制
# APP版本的链接放时间更长,但需要反编译获取ckey生成方式,以后再更新。
import binascii
import ctypes
im... | |
27,109 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/yangshipin.py | 91,92 | 36,106 | get_real_url | YangShiPin | 92,106 | 92,106 | class YangShiPin:
def __init__(self, rid):
var = parse_qs(rid)
vid, = var['vid']
pid, = var['pid']
platform = 4330701
guid = 'ko7djb70_vbjvrg5gcm'
txvlive_version = '3.0.37'
tt = int(time.time())
jc = 'mg3c3b04ba'
wu = f'|{vid}|{tt}|{jc}|{txv... | class YangShiPin:
def __init__(self, rid):
var = parse_qs(rid)
vid, = var['vid']
pid, = var['pid']
platform = 4330701
guid = 'ko7djb70_vbjvrg5gcm'
txvlive_version = '3.0.37'
tt = int(time.time())
jc = 'mg3c3b04ba'
wu = f'|{vid}|{tt}|{jc}|{txv... | headers = {
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
'like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
'referer': 'https://m.yangshipin.cn/',
'cookie': ''
}
res = re... | headers = {
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, '
'like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
'referer': 'https://m.yangshipin.cn/',
'cookie': ''
}
res = re... | 43 | 643 | 197 | 840 | # -*- coding: utf-8 -*-
# @Time: 2021/5/3 12:28
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
# CCTV-1: https://m.yangshipin.cn/video?type=1&vid=2000210103&pid=600001859
# 需要替换 headers 中登陆的 cookie
# 目前网页版链接有效时间很短,且每个IP每天的请求数量有限制
# APP版本的链接放时间更长,但需要反编译获取ckey生成方式,以后再更新。
import binascii
import ctypes
im... | # -*- coding: utf-8 -*-
# @Time: 2021/5/3 12:28
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
# CCTV-1: https://m.yangshipin.cn/video?type=1&vid=2000210103&pid=600001859
# 需要替换 headers 中登陆的 cookie
# 目前网页版链接有效时间很短,且每个IP每天的请求数量有限制
# APP版本的链接放时间更长,但需要反编译获取ckey生成方式,以后再更新。
import binascii
import ctypes
im... |
27,110 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/yizhibo.py | 30,31 | 1,42 | get_real_url | 31,39 | 31,39 | # 获取一直播的真实流媒体地址。
import requests
import re
class YiZhiBo:
def __init__(self, rid):
"""
一直播需要传入直播间的完整地址
Args:
rid:完整地址
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
try:
res = self.s.get(self.rid).text
... | # 获取一直播的真实流媒体地址。
import requests
import re
class YiZhiBo:
def __init__(self, rid):
"""
一直播需要传入直播间的完整地址
Args:
rid:完整地址
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
try:
res = self.s.get(self.rid).text
... | try:
yzb = YiZhiBo(rid)
return yzb.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
yzb = YiZhiBo(rid)
return yzb.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 264 | 62 | 326 | # 获取一直播的真实流媒体地址。
import requests
import re
class YiZhiBo:
def __init__(self, rid):
"""
一直播需要传入直播间的完整地址
Args:
rid:完整地址
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
try:
res = self.s.get(self.rid).text
... | # 获取一直播的真实流媒体地址。
import requests
import re
class YiZhiBo:
def __init__(self, rid):
"""
一直播需要传入直播间的完整地址
Args:
rid:完整地址
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
try:
res = self.s.get(self.rid).text
... | |
27,111 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/yizhibo.py | 18,19 | 7,30 | get_real_url | YiZhiBo | 19,30 | 19,30 | class YiZhiBo:
def __init__(self, rid):
"""
一直播需要传入直播间的完整地址
Args:
rid:完整地址
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
FILL_FUNC_BODY | class YiZhiBo:
def __init__(self, rid):
"""
一直播需要传入直播间的完整地址
Args:
rid:完整地址
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
FILL_FUNC_BODY | try:
res = self.s.get(self.rid).text
play_url, status_code = re.findall(r'play_url:"(.*?)"[\s\S]*status:(\d+),', res)[0]
if status_code == '10':
return play_url
else:
raise Exception('未开播')
except Exception:
rais... | try:
res = self.s.get(self.rid).text
play_url, status_code = re.findall(r'play_url:"(.*?)"[\s\S]*status:(\d+),', res)[0]
if status_code == '10':
return play_url
else:
raise Exception('未开播')
except Exception:
rais... | 22 | 87 | 117 | 204 | # 获取一直播的真实流媒体地址。
import requests
import re
class YiZhiBo:
def __init__(self, rid):
"""
一直播需要传入直播间的完整地址
Args:
rid:完整地址
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
yzb ... | # 获取一直播的真实流媒体地址。
import requests
import re
class YiZhiBo:
def __init__(self, rid):
"""
一直播需要传入直播间的完整地址
Args:
rid:完整地址
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
yzb ... |
27,112 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/youku.py | 46,47 | 1,58 | get_real_url | 47,55 | 47,55 | # 获取@优酷轮播台@的真实流媒体地址。
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,
# 而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
# liveId 是如下形式直播间链接:
# “https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
import requests
import time
import hashlib... | # 获取@优酷轮播台@的真实流媒体地址。
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,
# 而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
# liveId 是如下形式直播间链接:
# “https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
import requests
import time
import hashlib... | try:
yk = YouKu(rid)
return yk.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
yk = YouKu(rid)
return yk.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 743 | 58 | 801 | # 获取@优酷轮播台@的真实流媒体地址。
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,
# 而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
# liveId 是如下形式直播间链接:
# “https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
import requests
import time
import hashlib... | # 获取@优酷轮播台@的真实流媒体地址。
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,
# 而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
# liveId 是如下形式直播间链接:
# “https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
import requests
import time
import hashlib... | |
27,113 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/youku.py | 24,25 | 13,46 | get_real_url | YouKu | 25,46 | 25,46 | class YouKu:
def __init__(self, rid):
"""
获取优酷轮播台的流媒体地址
Args:
rid: 直播间url中id=8019610,其中id即为房间号
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
FILL_FUNC_BODY | class YouKu:
def __init__(self, rid):
"""
获取优酷轮播台的流媒体地址
Args:
rid: 直播间url中id=8019610,其中id即为房间号
"""
self.rid = rid
self.s = requests.Session()
def get_real_url(self):
FILL_FUNC_BODY | try:
tt = str(int(time.time() * 1000))
data = json.dumps({'liveId': self.rid, 'app': 'Pc'}, separators=(',', ':'))
url = 'https://acs.youku.com/h5/mtop.youku.live.com.livefullinfo/1.0/?appKey=24679788'
cookies = self.s.get(url).cookies
token = cookies.... | try:
tt = str(int(time.time() * 1000))
data = json.dumps({'liveId': self.rid, 'app': 'Pc'}, separators=(',', ':'))
url = 'https://acs.youku.com/h5/mtop.youku.live.com.livefullinfo/1.0/?appKey=24679788'
cookies = self.s.get(url).cookies
token = cookies.... | 55 | 105 | 380 | 485 | # 获取@优酷轮播台@的真实流媒体地址。
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,
# 而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
# liveId 是如下形式直播间链接:
# “https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
import requests
import time
import hashlib... | # 获取@优酷轮播台@的真实流媒体地址。
# 优酷轮播台是优酷直播live.youku.com下的一个子栏目,轮播一些经典电影电视剧,个人感觉要比其他直播平台影视区的画质要好,
# 而且没有平台水印和主播自己贴的乱七八糟的字幕遮挡。
# liveId 是如下形式直播间链接:
# “https://vku.youku.com/live/ilproom?spm=a2hcb.20025885.m_16249_c_59932.d_11&id=8019610&scm=20140670.rcmd.16249.live_8019610”中的8019610字段。
import requests
import time
import hashlib... |
27,114 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/yuanbobo.py | 26,27 | 1,38 | get_real_url | 27,35 | 27,35 | # 热猫直播:https://zhibo.yuanbobo.com/
import requests
import re
class YuanBoBo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
res = s.get(f'https://zhibo.yuanbobo.com/{self.rid}').text
stream_id = re.search(r"stream_id:\s+'(\d+... | # 热猫直播:https://zhibo.yuanbobo.com/
import requests
import re
class YuanBoBo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
res = s.get(f'https://zhibo.yuanbobo.com/{self.rid}').text
stream_id = re.search(r"stream_id:\s+'(\d+... | try:
th = YuanBoBo(rid)
return th.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
th = YuanBoBo(rid)
return th.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 305 | 57 | 362 | # 热猫直播:https://zhibo.yuanbobo.com/
import requests
import re
class YuanBoBo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
res = s.get(f'https://zhibo.yuanbobo.com/{self.rid}').text
stream_id = re.search(r"stream_id:\s+'(\d+... | # 热猫直播:https://zhibo.yuanbobo.com/
import requests
import re
class YuanBoBo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
res = s.get(f'https://zhibo.yuanbobo.com/{self.rid}').text
stream_id = re.search(r"stream_id:\s+'(\d+... | |
27,115 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/yuanbobo.py | 11,12 | 6,26 | get_real_url | YuanBoBo | 12,26 | 12,26 | class YuanBoBo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | class YuanBoBo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | with requests.Session() as s:
res = s.get(f'https://zhibo.yuanbobo.com/{self.rid}').text
stream_id = re.search(r"stream_id:\s+'(\d+)'", res)
if stream_id:
status = re.search(r"status:\s+'(\d)'", res).group(1)
if status == '1':
real_url = f'http... | with requests.Session() as s:
res = s.get(f'https://zhibo.yuanbobo.com/{self.rid}').text
stream_id = re.search(r"stream_id:\s+'(\d+)'", res)
if stream_id:
status = re.search(r"status:\s+'(\d)'", res).group(1)
if status == '1':
real_url = f'http... | 32 | 47 | 192 | 239 | # 热猫直播:https://zhibo.yuanbobo.com/
import requests
import re
class YuanBoBo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
th = YuanBoBo(rid)
return th.get_real_url()
except Exception as e:
print('Exception:'... | # 热猫直播:https://zhibo.yuanbobo.com/
import requests
import re
class YuanBoBo:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
th = YuanBoBo(rid)
return th.get_real_url()
except Exception as e:
print('Exception:'... |
27,116 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/yy.py | 39,40 | 1,51 | get_real_url | 40,48 | 40,48 | # 获取YY直播的真实流媒体地址。https://www.yy.com/1349606469
# 默认获取最高画质
import requests
import re
import json
class YY:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
headers = {
'referer': f'https://wap.yy.com/mobileweb/{self.rid}',
'user-agent': 'Mozilla/5.0 (Wi... | # 获取YY直播的真实流媒体地址。https://www.yy.com/1349606469
# 默认获取最高画质
import requests
import re
import json
class YY:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
headers = {
'referer': f'https://wap.yy.com/mobileweb/{self.rid}',
'user-agent': 'Mozilla/5.0 (Wi... | try:
yy = YY(rid)
return yy.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
yy = YY(rid)
return yy.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 528 | 57 | 585 | # 获取YY直播的真实流媒体地址。https://www.yy.com/1349606469
# 默认获取最高画质
import requests
import re
import json
class YY:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
headers = {
'referer': f'https://wap.yy.com/mobileweb/{self.rid}',
'user-agent': 'Mozilla/5.0 (Wi... | # 获取YY直播的真实流媒体地址。https://www.yy.com/1349606469
# 默认获取最高画质
import requests
import re
import json
class YY:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
headers = {
'referer': f'https://wap.yy.com/mobileweb/{self.rid}',
'user-agent': 'Mozilla/5.0 (Wi... | |
27,117 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/yy.py | 14,15 | 9,39 | get_real_url | YY | 15,39 | 15,39 | class YY:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | class YY:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODY | headers = {
'referer': f'https://wap.yy.com/mobileweb/{self.rid}',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/95.0.4638.69 Safari/537.36 '
}
room_url = f'https://interface.yy.com/hls/... | headers = {
'referer': f'https://wap.yy.com/mobileweb/{self.rid}',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/95.0.4638.69 Safari/537.36 '
}
room_url = f'https://interface.yy.com/hls/... | 70 | 45 | 407 | 452 | # 获取YY直播的真实流媒体地址。https://www.yy.com/1349606469
# 默认获取最高画质
import requests
import re
import json
class YY:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
yy = YY(rid)
return yy.get_real_url()
except Exception as e:
... | # 获取YY直播的真实流媒体地址。https://www.yy.com/1349606469
# 默认获取最高画质
import requests
import re
import json
class YY:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
FILL_FUNC_BODYdef get_real_url(rid):
try:
yy = YY(rid)
return yy.get_real_url()
except Exception as e:
... |
27,118 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/zhanqi.py | 63,64 | 1,76 | get_real_url | 64,72 | 64,72 | # 获取战旗直播(战旗TV)的真实流媒体地址。https://www.zhanqi.tv/lives
# 默认最高画质
import json
import re
import requests
class ZhanQi:
def __init__(self, rid):
"""
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
所以先判断一次后从网页源代码里获取数字直播间号
Args:
rid:直播间链接,从网页源码里获取真实数字rid
"""
se... | # 获取战旗直播(战旗TV)的真实流媒体地址。https://www.zhanqi.tv/lives
# 默认最高画质
import json
import re
import requests
class ZhanQi:
def __init__(self, rid):
"""
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
所以先判断一次后从网页源代码里获取数字直播间号
Args:
rid:直播间链接,从网页源码里获取真实数字rid
"""
se... | try:
zq = ZhanQi(rid)
return zq.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
zq = ZhanQi(rid)
return zq.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 845 | 59 | 904 | # 获取战旗直播(战旗TV)的真实流媒体地址。https://www.zhanqi.tv/lives
# 默认最高画质
import json
import re
import requests
class ZhanQi:
def __init__(self, rid):
"""
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
所以先判断一次后从网页源代码里获取数字直播间号
Args:
rid:直播间链接,从网页源码里获取真实数字rid
"""
se... | # 获取战旗直播(战旗TV)的真实流媒体地址。https://www.zhanqi.tv/lives
# 默认最高画质
import json
import re
import requests
class ZhanQi:
def __init__(self, rid):
"""
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
所以先判断一次后从网页源代码里获取数字直播间号
Args:
rid:直播间链接,从网页源码里获取真实数字rid
"""
se... | |
27,119 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/zhanqi.py | 23,24 | 10,63 | get_real_url | ZhanQi | 24,63 | 24,63 | class ZhanQi:
def __init__(self, rid):
"""
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
所以先判断一次后从网页源代码里获取数字直播间号
Args:
rid:直播间链接,从网页源码里获取真实数字rid
"""
self.s = requests.Session()
res = self.s.get(rid).text
self.rid = re.search(r'"code":"(\... | class ZhanQi:
def __init__(self, rid):
"""
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
所以先判断一次后从网页源代码里获取数字直播间号
Args:
rid:直播间链接,从网页源码里获取真实数字rid
"""
self.s = requests.Session()
res = self.s.get(rid).text
self.rid = re.search(r'"code":"(\... | res = self.s.get(f'https://m.zhanqi.tv/api/static/v2.1/room/domain/{self.rid}.json')
try:
res = res.json()
videoid = res['data']['videoId']
status = res['data']['status']
except (KeyError, json.decoder.JSONDecodeError):
raise Exception('Incorrect r... | res = self.s.get(f'https://m.zhanqi.tv/api/static/v2.1/room/domain/{self.rid}.json')
try:
res = res.json()
videoid = res['data']['videoId']
status = res['data']['status']
except (KeyError, json.decoder.JSONDecodeError):
raise Exception('Incorrect r... | 87 | 175 | 557 | 732 | # 获取战旗直播(战旗TV)的真实流媒体地址。https://www.zhanqi.tv/lives
# 默认最高画质
import json
import re
import requests
class ZhanQi:
def __init__(self, rid):
"""
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
所以先判断一次后从网页源代码里获取数字直播间号
Args:
rid:直播间链接,从网页源码里获取真实数字rid
"""
se... | # 获取战旗直播(战旗TV)的真实流媒体地址。https://www.zhanqi.tv/lives
# 默认最高画质
import json
import re
import requests
class ZhanQi:
def __init__(self, rid):
"""
战旗直播间有两种:一种是普通直播间号为数字或字幕;另一种是官方的主题直播间,链接带topic。
所以先判断一次后从网页源代码里获取数字直播间号
Args:
rid:直播间链接,从网页源码里获取真实数字rid
"""
se... |
27,120 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/zhibotv.py | 52,53 | 1,64 | get_real_url | 53,61 | 53,61 | # -*- coding: utf-8 -*-
# @Time: 2021/5/13 20:27
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import requests
class ZhiBotv:
def __init__(self, rid):
"""
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
Args:
rid:房间号
"""
self.rid = rid
self.... | # -*- coding: utf-8 -*-
# @Time: 2021/5/13 20:27
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import requests
class ZhiBotv:
def __init__(self, rid):
"""
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
Args:
rid:房间号
"""
self.rid = rid
self.... | try:
zbtv = ZhiBotv(rid)
return zbtv.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| try:
zbtv = ZhiBotv(rid)
return zbtv.get_real_url()
except Exception as e:
print('Exception:', e)
return False
| 14 | 579 | 61 | 640 | # -*- coding: utf-8 -*-
# @Time: 2021/5/13 20:27
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import requests
class ZhiBotv:
def __init__(self, rid):
"""
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
Args:
rid:房间号
"""
self.rid = rid
self.... | # -*- coding: utf-8 -*-
# @Time: 2021/5/13 20:27
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import requests
class ZhiBotv:
def __init__(self, rid):
"""
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
Args:
rid:房间号
"""
self.rid = rid
self.... | |
27,121 | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url | /home/hieuvd/dung_repo/raw/stars_01/wbt5_real-url/real-url/zhibotv.py | 34,35 | 10,52 | get_real_url | ZhiBotv | 40,52 | 35,52 | class ZhiBotv:
def __init__(self, rid):
"""
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
Args:
rid:房间号
"""
self.rid = rid
self.params = {
'token': '',
'roomId': self.rid,
'angleId': '',
'lineId': '',
... | class ZhiBotv:
def __init__(self, rid):
"""
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
Args:
rid:房间号
"""
self.rid = rid
self.params = {
'token': '',
'roomId': self.rid,
'angleId': '',
'lineId': '',
... | with requests.Session() as s:
res = s.get(self.BASE_URL, params=self.params, headers=self.HEADERS).json()
if 'hlsHUrl' in res['data']:
url = res['data'].get('hlsHUrl')
if url:
return url
else:
raise E... | """
no streaming 没开播;
non-existent rid 房间号不存在;
:return: url
"""
with requests.Session() as s:
res = s.get(self.BASE_URL, params=self.params, headers=self.HEADERS).json()
if 'hlsHUrl' in res['data']:
url = res['data'].get('hlsHUrl')
... | 28 | 353 | 119 | 472 | # -*- coding: utf-8 -*-
# @Time: 2021/5/13 20:27
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import requests
class ZhiBotv:
def __init__(self, rid):
"""
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
Args:
rid:房间号
"""
self.rid = rid
self.... | # -*- coding: utf-8 -*-
# @Time: 2021/5/13 20:27
# @Project: real-url
# @Author: wbt5
# @Blog: https://wbt5.com
import requests
class ZhiBotv:
def __init__(self, rid):
"""
中国体育&新传宽频,直播间地址如:https://v.zhibo.tv/10007
Args:
rid:房间号
"""
self.rid = rid
self.... |
27,122 | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr/amzqr/mylibs/ECC.py | 20,21 | 1,45 | divide | 21,33 | 21,33 | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import GP_list, ecc_num_per_block, lindex, po2, log
#ecc: Error Correction Codewords
def encode(ver, ecl, data_codewords):
en = ecc_num_per_block[ver-1][lindex[ecl]]
ecc = []
for dc in data_codewords:
ecc.append(get_ecc(dc, en))
return ecc
d... | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import GP_list, ecc_num_per_block, lindex, po2, log
#ecc: Error Correction Codewords
def encode(ver, ecl, data_codewords):
en = ecc_num_per_block[ver-1][lindex[ecl]]
ecc = []
for dc in data_codewords:
ecc.append(get_ecc(dc, en))
return ecc
d... | if MP[0]:
GP = list(GP)
for i in range(len(GP)):
GP[i] += log[MP[0]]
if GP[i] > 255:
GP[i] %= 255
GP[i] = po2[GP[i]]
return XOR(GP, *MP)
else:
return XOR([0]*len(GP), *MP)
| if MP[0]:
GP = list(GP)
for i in range(len(GP)):
GP[i] += log[MP[0]]
if GP[i] > 255:
GP[i] %= 255
GP[i] = po2[GP[i]]
return XOR(GP, *MP)
else:
return XOR([0]*len(GP), *MP)
| 29 | 322 | 124 | 446 | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import GP_list, ecc_num_per_block, lindex, po2, log
#ecc: Error Correction Codewords
def encode(ver, ecl, data_codewords):
en = ecc_num_per_block[ver-1][lindex[ecl]]
ecc = []
for dc in data_codewords:
ecc.append(get_ecc(dc, en))
return ecc
d... | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import GP_list, ecc_num_per_block, lindex, po2, log
#ecc: Error Correction Codewords
def encode(ver, ecl, data_codewords):
en = ecc_num_per_block[ver-1][lindex[ecl]]
ecc = []
for dc in data_codewords:
ecc.append(get_ecc(dc, en))
return ecc
d... | |
27,123 | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr/amzqr/mylibs/data.py | 91,92 | 1,119 | byte_encoding | 92,99 | 92,99 | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import char_cap, required_bytes, mindex, lindex, num_list, alphanum_list, grouping_list, mode_indicator
# ecl: Error Correction Level(L,M,Q,H)
def encode(ver, ecl, str):
mode_encoding = {
'numeric': numeric_encoding,
'alphanumeric':... | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import char_cap, required_bytes, mindex, lindex, num_list, alphanum_list, grouping_list, mode_indicator
# ecl: Error Correction Level(L,M,Q,H)
def encode(ver, ecl, str):
mode_encoding = {
'numeric': numeric_encoding,
'alphanumeric':... | code = ''
for i in str:
c = bin(ord(i.encode('iso-8859-1')))[2:]
c = '0'*(8-len(c)) + c
code += c
return code
| code = ''
for i in str:
c = bin(ord(i.encode('iso-8859-1')))[2:]
c = '0'*(8-len(c)) + c
code += c
return code
| 20 | 1,289 | 71 | 1,360 | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import char_cap, required_bytes, mindex, lindex, num_list, alphanum_list, grouping_list, mode_indicator
# ecl: Error Correction Level(L,M,Q,H)
def encode(ver, ecl, str):
mode_encoding = {
'numeric': numeric_encoding,
'alphanumeric':... | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import char_cap, required_bytes, mindex, lindex, num_list, alphanum_list, grouping_list, mode_indicator
# ecl: Error Correction Level(L,M,Q,H)
def encode(ver, ecl, str):
mode_encoding = {
'numeric': numeric_encoding,
'alphanumeric':... | |
27,125 | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr/amzqr/mylibs/structure.py | 5,6 | 1,28 | structure_final_bits | 6,13 | 6,13 | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import required_remainder_bits, lindex, grouping_list
def structure_final_bits(ver, ecl, data_codewords, ecc):
FILL_FUNC_BODYdef interleave_dc(ver, ecl, data_codewords):
id = []
for t in zip(*data_codewords):
id += list(t)
g = grouping_list[ver-1]... | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import required_remainder_bits, lindex, grouping_list
def structure_final_bits(ver, ecl, data_codewords, ecc):
FILL_FUNC_BODYdef interleave_dc(ver, ecl, data_codewords):
id = []
for t in zip(*data_codewords):
id += list(t)
g = grouping_list[ver-1]... | final_message = interleave_dc(ver, ecl, data_codewords) + interleave_ecc(ecc)
# convert to binary & Add Remainder Bits if Necessary
final_bits = ''.join(['0'*(8-len(i))+i for i in [bin(i)[2:] for i in final_message]]) + '0' * required_remainder_bits[ver-1]
return final_bits
| final_message = interleave_dc(ver, ecl, data_codewords) + interleave_ecc(ecc)
# convert to binary & Add Remainder Bits if Necessary
final_bits = ''.join(['0'*(8-len(i))+i for i in [bin(i)[2:] for i in final_message]]) + '0' * required_remainder_bits[ver-1]
return final_bits
| 34 | 220 | 122 | 342 | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import required_remainder_bits, lindex, grouping_list
def structure_final_bits(ver, ecl, data_codewords, ecc):
FILL_FUNC_BODYdef interleave_dc(ver, ecl, data_codewords):
id = []
for t in zip(*data_codewords):
id += list(t)
g = grouping_list[ver-1]... | # -*- coding: utf-8 -*-
from amzqr.mylibs.constant import required_remainder_bits, lindex, grouping_list
def structure_final_bits(ver, ecl, data_codewords, ecc):
FILL_FUNC_BODYdef interleave_dc(ver, ecl, data_codewords):
id = []
for t in zip(*data_codewords):
id += list(t)
g = grouping_list[ver-1]... | |
27,126 | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr/amzqr/mylibs/theqrmodule.py | 8,9 | 1,23 | get_qrcode | 9,23 | 9,23 | # -*- coding: utf-8 -*-
from amzqr.mylibs import data, ECC, structure, matrix, draw
# ver: Version from 1 to 40
# ecl: Error Correction Level (L,M,Q,H)
# get a qrcode picture of 3*3 pixels per module
def get_qrcode(ver, ecl, str, save_place):
FILL_FUNC_BODY | # -*- coding: utf-8 -*-
from amzqr.mylibs import data, ECC, structure, matrix, draw
# ver: Version from 1 to 40
# ecl: Error Correction Level (L,M,Q,H)
# get a qrcode picture of 3*3 pixels per module
def get_qrcode(ver, ecl, str, save_place):
FILL_FUNC_BODY | # Data Coding
ver, data_codewords = data.encode(ver, ecl, str)
# Error Correction Coding
ecc = ECC.encode(ver, ecl, data_codewords)
# Structure final bits
final_bits = structure.structure_final_bits(ver, ecl, data_codewords, ecc)
# Get the QR Matrix
qrmatrix = matrix.get_qrmat... | # Data Coding
ver, data_codewords = data.encode(ver, ecl, str)
# Error Correction Coding
ecc = ECC.encode(ver, ecl, data_codewords)
# Structure final bits
final_bits = structure.structure_final_bits(ver, ecl, data_codewords, ecc)
# Get the QR Matrix
qrmatrix = matrix.get_qrmat... | 58 | 110 | 180 | 290 | # -*- coding: utf-8 -*-
from amzqr.mylibs import data, ECC, structure, matrix, draw
# ver: Version from 1 to 40
# ecl: Error Correction Level (L,M,Q,H)
# get a qrcode picture of 3*3 pixels per module
def get_qrcode(ver, ecl, str, save_place):
FILL_FUNC_BODY | # -*- coding: utf-8 -*-
from amzqr.mylibs import data, ECC, structure, matrix, draw
# ver: Version from 1 to 40
# ecl: Error Correction Level (L,M,Q,H)
# get a qrcode picture of 3*3 pixels per module
def get_qrcode(ver, ecl, str, save_place):
FILL_FUNC_BODY | |
27,127 | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr | /home/hieuvd/dung_repo/raw/stars_01/x-hw_amazing-qr/amazing-qr/amzqr/terminal.py | 7,8 | 1,39 | main | 8,39 | 8,39 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from amzqr.amzqr import run
import os
def main():
FILL_FUNC_BODY | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from amzqr.amzqr import run
import os
def main():
FILL_FUNC_BODY | import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument('Words', help = 'The words to produce you QR-code picture, like a URL or a sentence. Please read the README file for the supported characters.')
argparser.add_argument('-v', '--version', type = int, choices = range(1,41), defau... | import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument('Words', help = 'The words to produce you QR-code picture, like a URL or a sentence. Please read the README file for the supported characters.')
argparser.add_argument('-v', '--version', type = int, choices = range(1,41), defau... | 299 | 54 | 751 | 805 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from amzqr.amzqr import run
import os
def main():
FILL_FUNC_BODY | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from amzqr.amzqr import run
import os
def main():
FILL_FUNC_BODY | |
27,341 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/config.py | 477,479 | 405,492 | shorthands | Config | 479,492 | 479,492 | class Config:
arg_groups: Dict[str, Any] = {
"sensitive": {
"samples": None,
"duplicates": None,
"vars": {"cat": {"redact": True}, "text": {"redact": True}},
},
"dark_mode": {
"html": {
"style": {
"theme": Th... | class Config:
arg_groups: Dict[str, Any] = {
"sensitive": {
"samples": None,
"duplicates": None,
"vars": {"cat": {"redact": True}, "text": {"redact": True}},
},
"dark_mode": {
"html": {
"style": {
"theme": Th... | shorthand_args = {}
if not split:
shorthand_args = kwargs
for key, value in list(kwargs.items()):
if value is None and key in Config._shorthands:
shorthand_args[key] = Config._shorthands[key]
if split:
del kwargs[key]
... | shorthand_args = {}
if not split:
shorthand_args = kwargs
for key, value in list(kwargs.items()):
if value is None and key in Config._shorthands:
shorthand_args[key] = Config._shorthands[key]
if split:
del kwargs[key]
... | 38 | 669 | 133 | 802 | """Configuration for the package."""
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import yaml
from pydantic.v1 import BaseModel, BaseSettings, Field, PrivateAttr
def _merge_dictionaries(dict1: dict, dict2: dict) -> dict:
"""
Recursive merge diction... | """Configuration for the package."""
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import yaml
from pydantic.v1 import BaseModel, BaseSettings, Field, PrivateAttr
def _merge_dictionaries(dict1: dict, dict2: dict) -> dict:
"""
Recursive merge diction... |
27,342 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/config.py | 357,359 | 288,372 | from_file | Settings | 366,372 | 359,372 | class Settings(BaseSettings):
# Default prefix to avoid collisions with environment variables
class Config:
env_prefix = "profile_"
# Title of the document
title: str = "Pandas Profiling Report"
dataset: Dataset = Dataset()
variables: Variables = Variables()
infer_dtypes: bool = Tr... | class Settings(BaseSettings):
# Default prefix to avoid collisions with environment variables
class Config:
env_prefix = "profile_"
# Title of the document
title: str = "Pandas Profiling Report"
dataset: Dataset = Dataset()
variables: Variables = Variables()
infer_dtypes: bool = Tr... | with open(config_file) as f:
data = yaml.safe_load(f)
return Settings.parse_obj(data)
| """Create a Settings object from a yaml file.
Args:
config_file: yaml file path
Returns:
Settings
"""
with open(config_file) as f:
data = yaml.safe_load(f)
return Settings.parse_obj(data)
| 9 | 720 | 45 | 765 | """Configuration for the package."""
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import yaml
from pydantic.v1 import BaseModel, BaseSettings, Field, PrivateAttr
def _merge_dictionaries(dict1: dict, dict2: dict) -> dict:
"""
Recursive merge diction... | """Configuration for the package."""
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import yaml
from pydantic.v1 import BaseModel, BaseSettings, Field, PrivateAttr
def _merge_dictionaries(dict1: dict, dict2: dict) -> dict:
"""
Recursive merge diction... |
27,343 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/config.py | 187,189 | 185,205 | primary_color | Style | 189,193 | 189,193 | class Style(BaseModel):
# Primary color used for plotting and text where applicable.
@property
def primary_color(self) -> str:
FILL_FUNC_BODY primary_colors: List[str] = ["#377eb8", "#e41a1c", "#4daf4a"]
# Base64-encoded logo image
logo: str = ""
# HTML Theme (optional, default: None)
t... | class Style(BaseModel):
# Primary color used for plotting and text where applicable.
@property
def primary_color(self) -> str:
FILL_FUNC_BODY primary_colors: List[str] = ["#377eb8", "#e41a1c", "#4daf4a"]
# Base64-encoded logo image
logo: str = ""
# HTML Theme (optional, default: None)
t... | # This attribute may be deprecated in the future, please use primary_colors[0]
return self.primary_colors[0]
# Primary color used for comparisons (default: blue, red, green)
| # This attribute may be deprecated in the future, please use primary_colors[0]
return self.primary_colors[0]
# Primary color used for comparisons (default: blue, red, green)
| 24 | 158 | 57 | 215 | """Configuration for the package."""
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import yaml
from pydantic.v1 import BaseModel, BaseSettings, Field, PrivateAttr
def _merge_dictionaries(dict1: dict, dict2: dict) -> dict:
"""
Recursive merge diction... | """Configuration for the package."""
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import yaml
from pydantic.v1 import BaseModel, BaseSettings, Field, PrivateAttr
def _merge_dictionaries(dict1: dict, dict2: dict) -> dict:
"""
Recursive merge diction... |
27,344 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/controller/console.py | 10,11 | 1,126 | parse_args | 20,99 | 11,99 | """This file add the console interface to the package."""
import argparse
from pathlib import Path
from typing import Any, List, Optional
from ydata_profiling.__init__ import ProfileReport, __version__
from ydata_profiling.utils.dataframe import read_pandas
def parse_args(args: Optional[List[Any]] = None) -> argpars... | """This file add the console interface to the package."""
import argparse
from pathlib import Path
from typing import Any, List, Optional
from ydata_profiling.__init__ import ProfileReport, __version__
from ydata_profiling.utils.dataframe import read_pandas
def parse_args(args: Optional[List[Any]] = None) -> argpars... | parser = argparse.ArgumentParser(
description="Profile the variables in a CSV file and generate a HTML report."
)
# Version
parser.add_argument(
"--version", action="version", version=f"%(prog)s {__version__}"
)
# Console specific
parser.add_argument(
"-s",
... | """Parse the command line arguments for the `ydata_profiling` binary.
Args:
args: List of input arguments. (Default value=None).
Returns:
Namespace with parsed arguments.
"""
parser = argparse.ArgumentParser(
description="Profile the variables in a CSV file and generate a HTML... | 167 | 400 | 688 | 1,088 | """This file add the console interface to the package."""
import argparse
from pathlib import Path
from typing import Any, List, Optional
from ydata_profiling.__init__ import ProfileReport, __version__
from ydata_profiling.utils.dataframe import read_pandas
def parse_args(args: Optional[List[Any]] = None) -> argpars... | """This file add the console interface to the package."""
import argparse
from pathlib import Path
from typing import Any, List, Optional
from ydata_profiling.__init__ import ProfileReport, __version__
from ydata_profiling.utils.dataframe import read_pandas
def parse_args(args: Optional[List[Any]] = None) -> argpars... | |
27,345 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/controller/pandas_decorator.py | 7,8 | 1,22 | profile_report | 17,21 | 8,21 | """This file add the decorator on the DataFrame object."""
from pandas import DataFrame
from ydata_profiling.profile_report import ProfileReport
def profile_report(df: DataFrame, **kwargs) -> ProfileReport:
FILL_FUNC_BODYDataFrame.profile_report = profile_report
| """This file add the decorator on the DataFrame object."""
from pandas import DataFrame
from ydata_profiling.profile_report import ProfileReport
def profile_report(df: DataFrame, **kwargs) -> ProfileReport:
"""Profile a DataFrame.
Args:
df: The DataFrame to profile.
**kwargs: Optional argume... | p = ProfileReport(df, **kwargs)
return p
| """Profile a DataFrame.
Args:
df: The DataFrame to profile.
**kwargs: Optional arguments for the ProfileReport object.
Returns:
A ProfileReport of the DataFrame.
"""
p = ProfileReport(df, **kwargs)
return p
| 6 | 134 | 22 | 156 | """This file add the decorator on the DataFrame object."""
from pandas import DataFrame
from ydata_profiling.profile_report import ProfileReport
def profile_report(df: DataFrame, **kwargs) -> ProfileReport:
FILL_FUNC_BODYDataFrame.profile_report = profile_report
| """This file add the decorator on the DataFrame object."""
from pandas import DataFrame
from ydata_profiling.profile_report import ProfileReport
def profile_report(df: DataFrame, **kwargs) -> ProfileReport:
"""Profile a DataFrame.
Args:
df: The DataFrame to profile.
**kwargs: Optional argume... | |
27,347 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 119,120 | 90,143 | fmt | Alert | 120,129 | 120,129 | class Alert:
"""An alert object (type, values, column)."""
_anchor_id: Optional[str] = None
def __init__(
self,
alert_type: AlertType,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
fields: Optional[Set] = None,
is_empty: bool = False,
... | class Alert:
"""An alert object (type, values, column)."""
_anchor_id: Optional[str] = None
def __init__(
self,
alert_type: AlertType,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
fields: Optional[Set] = None,
is_empty: bool = False,
... | # TODO: render in template
name = self.alert_type.name.replace("_", " ")
if name == "HIGH CORRELATION" and self.values is not None:
num = len(self.values["fields"])
title = ", ".join(self.values["fields"])
corr = self.values["corr"]
name = f'<abbr ... | # TODO: render in template
name = self.alert_type.name.replace("_", " ")
if name == "HIGH CORRELATION" and self.values is not None:
num = len(self.values["fields"])
title = ", ".join(self.values["fields"])
corr = self.values["corr"]
name = f'<abbr ... | 47 | 377 | 147 | 524 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,348 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 177,178 | 162,181 | _get_description | ConstantAlert | 178,181 | 178,181 | class ConstantAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.CONSTANT,
values=values,
column_name=column_name,
... | class ConstantAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.CONSTANT,
values=values,
column_name=column_name,
... | return f"[{self.column_name}] has a constant value"
| return f"[{self.column_name}] has a constant value"
| 6 | 143 | 23 | 166 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,349 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 158,159 | 143,162 | _get_description | ConstantLengthAlert | 159,162 | 159,162 | class ConstantLengthAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.CONSTANT_LENGTH,
values=values,
column_name=column... | class ConstantLengthAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.CONSTANT_LENGTH,
values=values,
column_name=column... | return f"[{self.column_name}] has a constant length"
| return f"[{self.column_name}] has a constant length"
| 6 | 157 | 23 | 180 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,350 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 196,197 | 181,203 | _get_description | DuplicatesAlert | 197,203 | 197,203 | class DuplicatesAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.DUPLICATES,
values=values,
column_name=column_name,
... | class DuplicatesAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.DUPLICATES,
values=values,
column_name=column_name,
... | if self.values is not None:
return f"Dataset has {self.values['n_duplicates']} ({fmt_percent(self.values['p_duplicates'])}) duplicate rows"
else:
return "Dataset has duplicated values"
| if self.values is not None:
return f"Dataset has {self.values['n_duplicates']} ({fmt_percent(self.values['p_duplicates'])}) duplicate rows"
else:
return "Dataset has duplicated values"
| 18 | 148 | 74 | 222 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,351 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 218,219 | 203,222 | _get_description | EmptyAlert | 219,222 | 219,222 | class EmptyAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.EMPTY,
values=values,
column_name=column_name,
... | class EmptyAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.EMPTY,
values=values,
column_name=column_name,
... | return "Dataset is empty"
| return "Dataset is empty"
| 4 | 141 | 14 | 155 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,352 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 237,238 | 222,244 | _get_description | HighCardinalityAlert | 238,244 | 238,244 | class HighCardinalityAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.HIGH_CARDINALITY,
values=values,
column_name=colu... | class HighCardinalityAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.HIGH_CARDINALITY,
values=values,
column_name=colu... | if self.values is not None:
return f"[{self.column_name}] has {self.values['n_distinct']:} ({fmt_percent(self.values['p_distinct'])}) distinct values"
else:
return f"[{self.column_name}] has a high cardinality"
| if self.values is not None:
return f"[{self.column_name}] has {self.values['n_distinct']:} ({fmt_percent(self.values['p_distinct'])}) distinct values"
else:
return f"[{self.column_name}] has a high cardinality"
| 19 | 151 | 86 | 237 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,353 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 258,259 | 244,270 | _get_description | HighCorrelationAlert | 259,270 | 259,270 | class HighCorrelationAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.HIGH_CORRELATION,
values=values,
column_name=colu... | class HighCorrelationAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.HIGH_CORRELATION,
values=values,
column_name=colu... | if self.values is not None:
description = f"[{self.column_name}] is highly {self.values['corr']} correlated with [{self.values['fields'][0]}]"
if len(self.values["fields"]) > 1:
description += f" and {len(self.values['fields']) - 1} other fields"
else:
... | if self.values is not None:
description = f"[{self.column_name}] is highly {self.values['corr']} correlated with [{self.values['fields'][0]}]"
if len(self.values["fields"]) > 1:
description += f" and {len(self.values['fields']) - 1} other fields"
else:
... | 43 | 140 | 139 | 279 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,354 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 285,286 | 270,293 | _get_description | ImbalanceAlert | 286,293 | 286,293 | class ImbalanceAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.IMBALANCE,
values=values,
column_name=column_name,
... | class ImbalanceAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.IMBALANCE,
values=values,
column_name=column_name,
... | description = f"[{self.column_name}] is highly imbalanced"
if self.values is not None:
return description + f" ({self.values['imbalance']})"
else:
return description
| description = f"[{self.column_name}] is highly imbalanced"
if self.values is not None:
return description + f" ({self.values['imbalance']})"
else:
return description
| 19 | 145 | 65 | 210 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,355 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 308,309 | 293,315 | _get_description | InfiniteAlert | 309,315 | 309,315 | class InfiniteAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.INFINITE,
values=values,
column_name=column_name,
... | class InfiniteAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.INFINITE,
values=values,
column_name=column_name,
... | if self.values is not None:
return f"[{self.column_name}] has {self.values['n_infinite']} ({fmt_percent(self.values['p_infinite'])}) infinite values"
else:
return f"[{self.column_name}] has infinite values"
| if self.values is not None:
return f"[{self.column_name}] has {self.values['n_infinite']} ({fmt_percent(self.values['p_infinite'])}) infinite values"
else:
return f"[{self.column_name}] has infinite values"
| 18 | 151 | 84 | 235 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,356 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 330,331 | 315,337 | _get_description | MissingAlert | 331,337 | 331,337 | class MissingAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.MISSING,
values=values,
column_name=column_name,
... | class MissingAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.MISSING,
values=values,
column_name=column_name,
... | if self.values is not None:
return f"[{self.column_name}] {self.values['n_missing']} ({fmt_percent(self.values['p_missing'])}) missing values"
else:
return f"[{self.column_name}] has missing values"
| if self.values is not None:
return f"[{self.column_name}] {self.values['n_missing']} ({fmt_percent(self.values['p_missing'])}) missing values"
else:
return f"[{self.column_name}] has missing values"
| 17 | 150 | 83 | 233 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,357 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 351,352 | 337,355 | _get_description | NonStationaryAlert | 352,355 | 352,355 | class NonStationaryAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.NON_STATIONARY,
values=values,
column_name=column_n... | class NonStationaryAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.NON_STATIONARY,
values=values,
column_name=column_n... | return f"[{self.column_name}] is non stationary"
| return f"[{self.column_name}] is non stationary"
| 5 | 138 | 22 | 160 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,358 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 505,506 | 491,509 | _get_description | RejectedAlert | 506,509 | 506,509 | class RejectedAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.REJECTED,
values=values,
column_name=column_name,
... | class RejectedAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.REJECTED,
values=values,
column_name=column_name,
... | return f"[{self.column_name}] was rejected"
| return f"[{self.column_name}] was rejected"
| 4 | 134 | 21 | 155 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,359 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 369,370 | 355,373 | _get_description | SeasonalAlert | 370,373 | 370,373 | class SeasonalAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.SEASONAL,
values=values,
column_name=column_name,
... | class SeasonalAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.SEASONAL,
values=values,
column_name=column_name,
... | return f"[{self.column_name}] is seasonal"
| return f"[{self.column_name}] is seasonal"
| 4 | 135 | 22 | 157 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,360 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 388,389 | 373,396 | _get_description | SkewedAlert | 389,396 | 389,396 | class SkewedAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.SKEWED,
values=values,
column_name=column_name,
... | class SkewedAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.SKEWED,
values=values,
column_name=column_name,
... | description = f"[{self.column_name}] is highly skewed"
if self.values is not None:
return description + f"(\u03b31 = {self.values['skewness']})"
else:
return description
| description = f"[{self.column_name}] is highly skewed"
if self.values is not None:
return description + f"(\u03b31 = {self.values['skewness']})"
else:
return description
| 20 | 146 | 73 | 219 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,361 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 410,411 | 396,414 | _get_description | TypeDateAlert | 411,414 | 411,414 | class TypeDateAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.TYPE_DATE,
values=values,
column_name=column_name,
... | class TypeDateAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.TYPE_DATE,
values=values,
column_name=column_name,
... | return f"[{self.column_name}] only contains datetime values, but is categorical. Consider applying `pd.to_datetime()`"
| return f"[{self.column_name}] only contains datetime values, but is categorical. Consider applying `pd.to_datetime()`"
| 12 | 134 | 39 | 173 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,362 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 428,429 | 414,432 | _get_description | UniformAlert | 429,432 | 429,432 | class UniformAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.UNIFORM,
values=values,
column_name=column_name,
... | class UniformAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.UNIFORM,
values=values,
column_name=column_name,
... | return f"[{self.column_name}] is uniformly distributed"
| return f"[{self.column_name}] is uniformly distributed"
| 5 | 134 | 22 | 156 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,363 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 447,448 | 432,451 | _get_description | UniqueAlert | 448,451 | 448,451 | class UniqueAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.UNIQUE,
values=values,
column_name=column_name,
... | class UniqueAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.UNIQUE,
values=values,
column_name=column_name,
... | return f"[{self.column_name}] has unique values"
| return f"[{self.column_name}] has unique values"
| 5 | 160 | 22 | 182 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,364 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 465,466 | 451,469 | _get_description | UnsupportedAlert | 466,469 | 466,469 | class UnsupportedAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.UNSUPPORTED,
values=values,
column_name=column_name,
... | class UnsupportedAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.UNSUPPORTED,
values=values,
column_name=column_name,
... | return f"[{self.column_name}] is an unsupported type, check if it needs cleaning or further analysis"
| return f"[{self.column_name}] is an unsupported type, check if it needs cleaning or further analysis"
| 14 | 135 | 33 | 168 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,365 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/alerts.py | 484,485 | 469,491 | _get_description | ZerosAlert | 485,491 | 485,491 | class ZerosAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.ZEROS,
values=values,
column_name=column_name,
... | class ZerosAlert(Alert):
def __init__(
self,
values: Optional[Dict] = None,
column_name: Optional[str] = None,
is_empty: bool = False,
):
super().__init__(
alert_type=AlertType.ZEROS,
values=values,
column_name=column_name,
... | if self.values is not None:
return f"[{self.column_name}] has {self.values['n_zeros']} ({fmt_percent(self.values['p_zeros'])}) zeros"
else:
return f"[{self.column_name}] has predominantly zeros"
| if self.values is not None:
return f"[{self.column_name}] has {self.values['n_zeros']} ({fmt_percent(self.values['p_zeros'])}) zeros"
else:
return f"[{self.column_name}] has predominantly zeros"
| 17 | 150 | 86 | 236 | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... | """Logic for alerting the user on possibly problematic patterns in the data (e.g. high number of zeros , constant
values, high correlations)."""
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Set
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from... |
27,366 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/correlations.py | 65,66 | 1,144 | warn_correlation | 66,76 | 66,76 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | warnings.warn(
f"""There was an attempt to calculate the {correlation_name} correlation, but this failed.
To hide this warning, disable the calculation
(using `df.profile_report(correlations={{\"{correlation_name}\": {{\"calculate\": False}}}})`
If this is problematic for your use case, please report this a... | warnings.warn(
f"""There was an attempt to calculate the {correlation_name} correlation, but this failed.
To hide this warning, disable the calculation
(using `df.profile_report(correlations={{\"{correlation_name}\": {{\"calculate\": False}}}})`
If this is problematic for your use case, please report this a... | 45 | 1,079 | 136 | 1,215 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | |
27,367 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/correlations.py | 24,27 | 23,30 | compute | Auto | 27,30 | 27,30 | class Auto(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | class Auto(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 53 | 14 | 67 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... |
27,368 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/correlations.py | 18,20 | 17,23 | compute | Correlation | 20,23 | 20,23 | class Correlation:
@staticmethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | class Correlation:
@staticmethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 45 | 14 | 59 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... |
27,369 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/correlations.py | 52,55 | 51,58 | compute | Cramers | 55,58 | 55,58 | class Cramers(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | class Cramers(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 55 | 14 | 69 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... |
27,370 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/correlations.py | 45,48 | 44,51 | compute | Kendall | 48,51 | 48,51 | class Kendall(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | class Kendall(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 55 | 14 | 69 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... |
27,371 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/correlations.py | 38,41 | 37,44 | compute | Pearson | 41,44 | 41,44 | class Pearson(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | class Pearson(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 54 | 14 | 68 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... |
27,372 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/correlations.py | 59,62 | 58,65 | compute | PhiK | 62,65 | 62,65 | class PhiK(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | class PhiK(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 55 | 14 | 69 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... |
27,373 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/correlations.py | 31,34 | 30,37 | compute | Spearman | 34,37 | 34,37 | class Spearman(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | class Spearman(Correlation):
@staticmethod
@multimethod
def compute(config: Settings, df: Sized, summary: dict) -> Optional[Sized]:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 55 | 14 | 69 | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... | """Correlations between variables."""
import warnings
from typing import Dict, List, Optional, Sized
import numpy as np
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
try:
from pandas.core.base import DataError
except ImportError:
from pandas.errors import... |
27,374 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/dataframe.py | 8,10 | 1,16 | check_dataframe | 10,13 | 10,13 | from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def check_dataframe(df: Any) -> None:
FILL_FUNC_BODY@multimethod
def preprocess(config: Settings, df: Any) -> Any:
return df
| from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def check_dataframe(df: Any) -> None:
FILL_FUNC_BODY@multimethod
def preprocess(config: Settings, df: Any) -> Any:
return df
| raise NotImplementedError()
| raise NotImplementedError()
| 2 | 86 | 14 | 100 | from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def check_dataframe(df: Any) -> None:
FILL_FUNC_BODY@multimethod
def preprocess(config: Settings, df: Any) -> Any:
return df
| from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def check_dataframe(df: Any) -> None:
FILL_FUNC_BODY@multimethod
def preprocess(config: Settings, df: Any) -> Any:
return df
| |
27,375 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/description.py | 28,30 | 8,43 | duration | BaseAnalysis | 30,43 | 30,43 | @dataclass
class BaseAnalysis:
"""Description of base analysis module of report.
Overall info about report.
Attributes
title (str): Title of report.
date_start (Union[datetime, List[datetime]]): Start of generating description.
date_end (Union[datetime, List[datetime]]): End of gene... | @dataclass
class BaseAnalysis:
"""Description of base analysis module of report.
Overall info about report.
Attributes
title (str): Title of report.
date_start (Union[datetime, List[datetime]]): Start of generating description.
date_end (Union[datetime, List[datetime]]): End of gene... | if isinstance(self.date_start, datetime) and isinstance(
self.date_end, datetime
):
return self.date_end - self.date_start
if isinstance(self.date_start, list) and isinstance(self.date_end, list):
return [
self.date_end[i] - self.date_start[i]
... | if isinstance(self.date_start, datetime) and isinstance(
self.date_end, datetime
):
return self.date_end - self.date_start
if isinstance(self.date_start, list) and isinstance(self.date_end, list):
return [
self.date_end[i] - self.date_start[i]
... | 31 | 217 | 137 | 354 | from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Union
from pandas import Timedelta
@dataclass
class BaseAnalysis:
"""Description of base analysis module of report.
Overall info about report.
Attributes
title (str): Title of... | from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Union
from pandas import Timedelta
@dataclass
class BaseAnalysis:
"""Description of base analysis module of report.
Overall info about report.
Attributes
title (str): Title of... |
27,376 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/duplicates.py | 10,14 | 1,15 | get_duplicates | 14,15 | 14,15 | from typing import Any, Dict, Optional, Sequence, Tuple, TypeVar
from multimethod import multimethod
from ydata_profiling.config import Settings
T = TypeVar("T")
@multimethod
def get_duplicates(
config: Settings, df: T, supported_columns: Sequence
) -> Tuple[Dict[str, Any], Optional[T]]:
FILL_FUNC_BODY | from typing import Any, Dict, Optional, Sequence, Tuple, TypeVar
from multimethod import multimethod
from ydata_profiling.config import Settings
T = TypeVar("T")
@multimethod
def get_duplicates(
config: Settings, df: T, supported_columns: Sequence
) -> Tuple[Dict[str, Any], Optional[T]]:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 111 | 10 | 121 | from typing import Any, Dict, Optional, Sequence, Tuple, TypeVar
from multimethod import multimethod
from ydata_profiling.config import Settings
T = TypeVar("T")
@multimethod
def get_duplicates(
config: Settings, df: T, supported_columns: Sequence
) -> Tuple[Dict[str, Any], Optional[T]]:
FILL_FUNC_BODY | from typing import Any, Dict, Optional, Sequence, Tuple, TypeVar
from multimethod import multimethod
from ydata_profiling.config import Settings
T = TypeVar("T")
@multimethod
def get_duplicates(
config: Settings, df: T, supported_columns: Sequence
) -> Tuple[Dict[str, Any], Optional[T]]:
FILL_FUNC_BODY | |
27,377 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/handler.py | 65,66 | 1,84 | get_render_map | 66,84 | 66,84 | from functools import reduce
from typing import Any, Callable, Dict, List, Sequence
import networkx as nx
from visions import VisionsTypeset
def compose(functions: Sequence[Callable]) -> Callable:
"""
Compose a sequence of functions
:param functions: sequence of functions
:return: combined functions,... | from functools import reduce
from typing import Any, Callable, Dict, List, Sequence
import networkx as nx
from visions import VisionsTypeset
def compose(functions: Sequence[Callable]) -> Callable:
"""
Compose a sequence of functions
:param functions: sequence of functions
:return: combined functions,... | import ydata_profiling.report.structure.variables as render_algorithms
render_map = {
"Boolean": render_algorithms.render_boolean,
"Numeric": render_algorithms.render_real,
"Complex": render_algorithms.render_complex,
"Text": render_algorithms.render_text,
"DateTime": re... | import ydata_profiling.report.structure.variables as render_algorithms
render_map = {
"Boolean": render_algorithms.render_boolean,
"Numeric": render_algorithms.render_real,
"Complex": render_algorithms.render_complex,
"Text": render_algorithms.render_text,
"DateTime": re... | 34 | 507 | 234 | 741 | from functools import reduce
from typing import Any, Callable, Dict, List, Sequence
import networkx as nx
from visions import VisionsTypeset
def compose(functions: Sequence[Callable]) -> Callable:
"""
Compose a sequence of functions
:param functions: sequence of functions
:return: combined functions,... | from functools import reduce
from typing import Any, Callable, Dict, List, Sequence
import networkx as nx
from visions import VisionsTypeset
def compose(functions: Sequence[Callable]) -> Callable:
"""
Compose a sequence of functions
:param functions: sequence of functions
:return: combined functions,... | |
27,378 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/handler.py | 46,47 | 28,65 | _complete_dag | Handler | 47,54 | 47,54 | class Handler:
"""A generic handler
Allows any custom mapping between data types and functions
"""
def __init__(
self,
mapping: Dict[str, List[Callable]],
typeset: VisionsTypeset,
*args,
**kwargs
):
self.mapping = mapping
self.typeset = types... | class Handler:
"""A generic handler
Allows any custom mapping between data types and functions
"""
def __init__(
self,
mapping: Dict[str, List[Callable]],
typeset: VisionsTypeset,
*args,
**kwargs
):
self.mapping = mapping
self.typeset = types... | for from_type, to_type in nx.topological_sort(
nx.line_graph(self.typeset.base_graph)
):
self.mapping[str(to_type)] = (
self.mapping[str(from_type)] + self.mapping[str(to_type)]
)
| for from_type, to_type in nx.topological_sort(
nx.line_graph(self.typeset.base_graph)
):
self.mapping[str(to_type)] = (
self.mapping[str(from_type)] + self.mapping[str(to_type)]
)
| 14 | 198 | 89 | 287 | from functools import reduce
from typing import Any, Callable, Dict, List, Sequence
import networkx as nx
from visions import VisionsTypeset
def compose(functions: Sequence[Callable]) -> Callable:
"""
Compose a sequence of functions
:param functions: sequence of functions
:return: combined functions,... | from functools import reduce
from typing import Any, Callable, Dict, List, Sequence
import networkx as nx
from visions import VisionsTypeset
def compose(functions: Sequence[Callable]) -> Callable:
"""
Compose a sequence of functions
:param functions: sequence of functions
:return: combined functions,... |
27,379 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/missing.py | 25,26 | 1,123 | get_missing_active | 35,75 | 26,75 | import warnings
from typing import Any, Callable, Dict, Optional
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def missing_bar(config: Settings, df: Any) -> str:
raise NotImplementedError()
@multimethod
def missing_matrix(config: Settings, df:... | import warnings
from typing import Any, Callable, Dict, Optional
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def missing_bar(config: Settings, df: Any) -> str:
raise NotImplementedError()
@multimethod
def missing_matrix(config: Settings, df:... | missing_map = {
"bar": {
"min_missing": 0,
"name": "Count",
"caption": "A simple visualization of nullity by column.",
"function": missing_bar,
},
"matrix": {
"min_missing": 0,
"name": "Matrix",
"caption": "N... | """
Args:
config: report Settings object
table_stats: The overall statistics for the DataFrame.
Returns:
"""
missing_map = {
"bar": {
"min_missing": 0,
"name": "Count",
"caption": "A simple visualization of nullity by column.",
... | 113 | 675 | 384 | 1,059 | import warnings
from typing import Any, Callable, Dict, Optional
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def missing_bar(config: Settings, df: Any) -> str:
raise NotImplementedError()
@multimethod
def missing_matrix(config: Settings, df:... | import warnings
from typing import Any, Callable, Dict, Optional
import pandas as pd
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def missing_bar(config: Settings, df: Any) -> str:
raise NotImplementedError()
@multimethod
def missing_matrix(config: Settings, df:... | |
27,380 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pairwise.py | 9,12 | 1,34 | get_scatter_tasks | 12,23 | 12,23 | from typing import Any, List, Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.visualisation.plot import scatter_pairwise
def get_scatter_tasks(
config: Settings, continuous_variables: list
) -> List[Tuple[Any, Any]]:
FILL_FUNC_BODYdef get_scatter_plot(
config: Sett... | from typing import Any, List, Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.visualisation.plot import scatter_pairwise
def get_scatter_tasks(
config: Settings, continuous_variables: list
) -> List[Tuple[Any, Any]]:
FILL_FUNC_BODYdef get_scatter_plot(
config: Sett... | if not config.interactions.continuous:
return []
targets = config.interactions.targets
if len(targets) == 0:
targets = continuous_variables
tasks = [(x, y) for y in continuous_variables for x in targets]
return tasks
| if not config.interactions.continuous:
return []
targets = config.interactions.targets
if len(targets) == 0:
targets = continuous_variables
tasks = [(x, y) for y in continuous_variables for x in targets]
return tasks
| 29 | 228 | 87 | 315 | from typing import Any, List, Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.visualisation.plot import scatter_pairwise
def get_scatter_tasks(
config: Settings, continuous_variables: list
) -> List[Tuple[Any, Any]]:
FILL_FUNC_BODYdef get_scatter_plot(
config: Sett... | from typing import Any, List, Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.visualisation.plot import scatter_pairwise
def get_scatter_tasks(
config: Settings, continuous_variables: list
) -> List[Tuple[Any, Any]]:
FILL_FUNC_BODYdef get_scatter_plot(
config: Sett... | |
27,381 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/dataframe_pandas.py | 16,18 | 1,37 | pandas_preprocess | 31,37 | 18,37 | import warnings
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.dataframe import check_dataframe, preprocess
from ydata_profiling.utils.dataframe import rename_index
@check_dataframe.register
def pandas_check_dataframe(df: pd.DataFrame) -> None:
if not isinstance(df, p... | import warnings
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.dataframe import check_dataframe, preprocess
from ydata_profiling.utils.dataframe import rename_index
@check_dataframe.register
def pandas_check_dataframe(df: pd.DataFrame) -> None:
if not isinstance(df, p... | # Rename reserved column names
df = rename_index(df)
# Ensure that columns are strings
df.columns = df.columns.astype("str")
return df
| """Preprocess the dataframe
- Appends the index to the dataframe when it contains information
- Rename the "index" column to "df_index", if exists
- Convert the DataFrame's columns to str
Args:
config: report Settings object
df: the pandas DataFrame
Returns:
The prepro... | 19 | 266 | 54 | 320 | import warnings
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.dataframe import check_dataframe, preprocess
from ydata_profiling.utils.dataframe import rename_index
@check_dataframe.register
def pandas_check_dataframe(df: pd.DataFrame) -> None:
if not isinstance(df, p... | import warnings
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.dataframe import check_dataframe, preprocess
from ydata_profiling.utils.dataframe import rename_index
@check_dataframe.register
def pandas_check_dataframe(df: pd.DataFrame) -> None:
if not isinstance(df, p... | |
27,382 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_boolean_pandas.py | 14,19 | 1,44 | pandas_describe_boolean_1d | 29,44 | 19,44 | from typing import Tuple
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.pandas.imbalance_pandas import column_imbalance_score
from ydata_profiling.model.summary_algorithms import (
describe_boolean_1d,
series_hashable,
)
@describe_boolean_1d.reg... | from typing import Tuple
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.pandas.imbalance_pandas import column_imbalance_score
from ydata_profiling.model.summary_algorithms import (
describe_boolean_1d,
series_hashable,
)
@describe_boolean_1d.reg... |
value_counts: pd.Series = summary["value_counts_without_nan"]
if not value_counts.empty:
summary.update({"top": value_counts.index[0], "freq": value_counts.iloc[0]})
summary["imbalance"] = column_imbalance_score(value_counts, len(value_counts))
else:
summary.update(
{
... | """Describe a boolean series.
Args:
config: report Settings object
series: The Series to describe.
summary: The dict containing the series description so far.
Returns:
A dict containing calculated series description values.
"""
value_counts: pd.Series = summary["va... | 30 | 232 | 165 | 397 | from typing import Tuple
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.pandas.imbalance_pandas import column_imbalance_score
from ydata_profiling.model.summary_algorithms import (
describe_boolean_1d,
series_hashable,
)
@describe_boolean_1d.reg... | from typing import Tuple
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.pandas.imbalance_pandas import column_imbalance_score
from ydata_profiling.model.summary_algorithms import (
describe_boolean_1d,
series_hashable,
)
@describe_boolean_1d.reg... | |
27,384 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_counts_pandas.py | 9,13 | 1,64 | pandas_describe_counts | 23,64 | 13,64 | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_counts
@describe_counts.register
def pandas_describe_counts(
config: Settings, series: pd.Series, summary: dict
) -> Tuple[Settings, pd.Series, dict]:
FILL_FUNC_... | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_counts
@describe_counts.register
def pandas_describe_counts(
config: Settings, series: pd.Series, summary: dict
) -> Tuple[Settings, pd.Series, dict]:
"""Cou... | try:
value_counts_with_nan = series.value_counts(dropna=False)
_ = set(value_counts_with_nan.index)
hashable = True
except: # noqa: E722
hashable = False
summary["hashable"] = hashable
if hashable:
value_counts_with_nan = value_counts_with_nan[value_counts_with... | """Counts the values in a series (with and without NaN, distinct).
Args:
config: report Settings object
series: Series for which we want to calculate the values.
summary: series' summary
Returns:
A dictionary with the count values (with and without NaN, distinct).
"""
... | 82 | 189 | 424 | 613 | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_counts
@describe_counts.register
def pandas_describe_counts(
config: Settings, series: pd.Series, summary: dict
) -> Tuple[Settings, pd.Series, dict]:
FILL_FUNC_... | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_counts
@describe_counts.register
def pandas_describe_counts(
config: Settings, series: pd.Series, summary: dict
) -> Tuple[Settings, pd.Series, dict]:
"""Cou... | |
27,385 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_date_pandas.py | 16,22 | 1,58 | pandas_describe_date_1d | 32,58 | 22,58 | from typing import Tuple
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import (
chi_square,
describe_date_1d,
histogram_compute,
series_handle_nulls,
series_hashable,
)
@describe_date_1d.register
@series_hashable
... | from typing import Tuple
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import (
chi_square,
describe_date_1d,
histogram_compute,
series_handle_nulls,
series_hashable,
)
@describe_date_1d.register
@series_hashable
... | if summary["value_counts_without_nan"].empty:
values = series.values
summary.update(
{
"min": pd.NaT,
"max": pd.NaT,
"range": 0,
}
)
else:
summary.update(
{
"min": pd.Timestamp.to_... | """Describe a date series.
Args:
config: report Settings object
series: The Series to describe.
summary: The dict containing the series description so far.
Returns:
A dict containing calculated series description values.
"""
if summary["value_counts_without_nan"].em... | 48 | 235 | 263 | 498 | from typing import Tuple
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import (
chi_square,
describe_date_1d,
histogram_compute,
series_handle_nulls,
series_hashable,
)
@describe_date_1d.register
@series_hashable
... | from typing import Tuple
import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import (
chi_square,
describe_date_1d,
histogram_compute,
series_handle_nulls,
series_hashable,
)
@describe_date_1d.register
@series_hashable
... | |
27,386 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_file_pandas.py | 11,12 | 1,57 | file_summary | 20,37 | 12,37 | import os
from datetime import datetime
from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_file_1d, histogram_compute
def file_summary(series: pd.Series) -> dict:
FILL_FUNC_BODY@describe_file_1d.register
def pandas_d... | import os
from datetime import datetime
from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_file_1d, histogram_compute
def file_summary(series: pd.Series) -> dict:
"""
Args:
series: series to summariz... |
# Transform
stats = series.map(lambda x: os.stat(x))
def convert_datetime(x: float) -> str:
return datetime.fromtimestamp(x).strftime("%Y-%m-%d %H:%M:%S")
# Transform some more
summary = {
"file_size": stats.map(lambda x: x.st_size),
"file_created_time": stats.map(lambda x... | """
Args:
series: series to summarize
Returns:
"""
# Transform
stats = series.map(lambda x: os.stat(x))
def convert_datetime(x: float) -> str:
return datetime.fromtimestamp(x).strftime("%Y-%m-%d %H:%M:%S")
# Transform some more
summary = {
"file_size": s... | 41 | 298 | 217 | 515 | import os
from datetime import datetime
from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_file_1d, histogram_compute
def file_summary(series: pd.Series) -> dict:
FILL_FUNC_BODY@describe_file_1d.register
def pandas_d... | import os
from datetime import datetime
from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_file_1d, histogram_compute
def file_summary(series: pd.Series) -> dict:
"""
Args:
series: series to summariz... | |
27,387 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_generic_pandas.py | 9,13 | 1,37 | pandas_describe_generic | 23,37 | 13,37 | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_generic
@describe_generic.register
def pandas_describe_generic(
config: Settings, series: pd.Series, summary: dict
) -> Tuple[Settings, pd.Series, dict]:
FILL_FU... | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_generic
@describe_generic.register
def pandas_describe_generic(
config: Settings, series: pd.Series, summary: dict
) -> Tuple[Settings, pd.Series, dict]:
"""... |
# number of observations in the Series
length = len(series)
summary.update(
{
"n": length,
"p_missing": summary["n_missing"] / length if length > 0 else 0,
"count": length - summary["n_missing"],
"memory_size": series.memory_usage(deep=config.memory_... | """Describe generic series.
Args:
config: report Settings object
series: The Series to describe.
summary: The dict containing the series description so far.
Returns:
A dict containing calculated series description values.
"""
# number of observations in the Series
... | 36 | 169 | 124 | 293 | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_generic
@describe_generic.register
def pandas_describe_generic(
config: Settings, series: pd.Series, summary: dict
) -> Tuple[Settings, pd.Series, dict]:
FILL_FU... | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_generic
@describe_generic.register
def pandas_describe_generic(
config: Settings, series: pd.Series, summary: dict
) -> Tuple[Settings, pd.Series, dict]:
"""... | |
27,388 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_path_pandas.py | 10,11 | 1,64 | path_summary | 19,40 | 11,40 | import os
from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_path_1d
def path_summary(series: pd.Series) -> dict:
FILL_FUNC_BODY@describe_path_1d.register
def pandas_describe_path_1d(
config: Settings, series: pd... | import os
from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_path_1d
def path_summary(series: pd.Series) -> dict:
"""
Args:
series: series to summarize
Returns:
"""
FILL_FUNC_BODY@describe_... |
# TODO: optimize using value counts
summary = {
"common_prefix": os.path.commonprefix(series.values.tolist())
or "No common prefix",
"stem_counts": series.map(lambda x: os.path.splitext(x)[0]).value_counts(),
"suffix_counts": series.map(lambda x: os.path.splitext(x)[1]).value_co... | """
Args:
series: series to summarize
Returns:
"""
# TODO: optimize using value counts
summary = {
"common_prefix": os.path.commonprefix(series.values.tolist())
or "No common prefix",
"stem_counts": series.map(lambda x: os.path.splitext(x)[0]).value_counts(),
... | 53 | 314 | 344 | 658 | import os
from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_path_1d
def path_summary(series: pd.Series) -> dict:
FILL_FUNC_BODY@describe_path_1d.register
def pandas_describe_path_1d(
config: Settings, series: pd... | import os
from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_path_1d
def path_summary(series: pd.Series) -> dict:
"""
Args:
series: series to summarize
Returns:
"""
FILL_FUNC_BODY@describe_... | |
27,389 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_supported_pandas.py | 9,14 | 1,42 | pandas_describe_supported | 24,42 | 14,42 | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_supported, series_hashable
@describe_supported.register
@series_hashable
def pandas_describe_supported(
config: Settings, series: pd.Series, series_description: ... | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_supported, series_hashable
@describe_supported.register
@series_hashable
def pandas_describe_supported(
config: Settings, series: pd.Series, series_description: ... |
# number of non-NaN observations in the Series
count = series_description["count"]
value_counts = series_description["value_counts_without_nan"]
distinct_count = len(value_counts)
unique_count = value_counts.where(value_counts == 1).count()
stats = {
"n_distinct": distinct_count,
... | """Describe a supported series.
Args:
config: report Settings object
series: The Series to describe.
series_description: The dict containing the series description so far.
Returns:
A dict containing calculated series description values.
"""
# number of non-NaN obse... | 63 | 185 | 207 | 392 | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_supported, series_hashable
@describe_supported.register
@series_hashable
def pandas_describe_supported(
config: Settings, series: pd.Series, series_description: ... | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_supported, series_hashable
@describe_supported.register
@series_hashable
def pandas_describe_supported(
config: Settings, series: pd.Series, series_description: ... | |
27,390 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_text_pandas.py | 19,27 | 1,65 | pandas_describe_text_1d | 37,65 | 27,65 | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.pandas.describe_categorical_pandas import (
length_summary_vc,
unicode_summary_vc,
word_summary_vc,
)
from ydata_profiling.model.summary_algorithms import (
describe_text_1d,
histogr... | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.pandas.describe_categorical_pandas import (
length_summary_vc,
unicode_summary_vc,
word_summary_vc,
)
from ydata_profiling.model.summary_algorithms import (
describe_text_1d,
histogr... |
series = series.astype(str)
# Only run if at least 1 non-missing value
value_counts = summary["value_counts_without_nan"]
value_counts.index = value_counts.index.astype(str)
summary.update({"first_rows": series.head(5)})
if config.vars.text.length:
summary.update(length_summary_vc(va... | """Describe string series.
Args:
config: report Settings object
series: The Series to describe.
summary: The dict containing the series description so far.
Returns:
A dict containing calculated series description values.
"""
series = series.astype(str)
# Only ... | 43 | 280 | 292 | 572 | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.pandas.describe_categorical_pandas import (
length_summary_vc,
unicode_summary_vc,
word_summary_vc,
)
from ydata_profiling.model.summary_algorithms import (
describe_text_1d,
histogr... | from typing import Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.pandas.describe_categorical_pandas import (
length_summary_vc,
unicode_summary_vc,
word_summary_vc,
)
from ydata_profiling.model.summary_algorithms import (
describe_text_1d,
histogr... | |
27,391 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/describe_url_pandas.py | 30,34 | 1,58 | pandas_describe_url_1d | 44,58 | 34,58 | from typing import Tuple
from urllib.parse import urlsplit
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_url_1d
def url_summary(series: pd.Series) -> dict:
"""
Args:
series: series to summarize
Returns:
"""
... | from typing import Tuple
from urllib.parse import urlsplit
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_url_1d
def url_summary(series: pd.Series) -> dict:
"""
Args:
series: series to summarize
Returns:
"""
... |
# Make sure we deal with strings (Issue #100)
if series.hasnans:
raise ValueError("May not contain NaNs")
if not hasattr(series, "str"):
raise ValueError("series should have .str accessor")
# Transform
series = series.apply(urlsplit)
# Update
summary.update(url_summary(ser... | """Describe a url series.
Args:
config: report Settings object
series: The Series to describe.
summary: The dict containing the series description so far.
Returns:
A dict containing calculated series description values.
"""
# Make sure we deal with strings (Issue #... | 38 | 370 | 125 | 495 | from typing import Tuple
from urllib.parse import urlsplit
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_url_1d
def url_summary(series: pd.Series) -> dict:
"""
Args:
series: series to summarize
Returns:
"""
... | from typing import Tuple
from urllib.parse import urlsplit
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.summary_algorithms import describe_url_1d
def url_summary(series: pd.Series) -> dict:
"""
Args:
series: series to summarize
Returns:
"""
... | |
27,392 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/discretize_pandas.py | 70,71 | 13,82 | _descritize_quantile | Discretizer | 71,75 | 71,75 | class Discretizer:
"""
A class which enables the discretization of a pandas dataframe.
Perform this action when you want to convert a continuous variable
into a categorical variable.
Attributes:
method (DiscretizationType): this attribute controls how the buckets
of your discretization are... | class Discretizer:
"""
A class which enables the discretization of a pandas dataframe.
Perform this action when you want to convert a continuous variable
into a categorical variable.
Attributes:
method (DiscretizationType): this attribute controls how the buckets
of your discretization are... | return pd.qcut(
column, q=self.n_bins, labels=False, retbins=False, duplicates="drop"
).values
| return pd.qcut(
column, q=self.n_bins, labels=False, retbins=False, duplicates="drop"
).values
| 8 | 695 | 47 | 742 | from enum import Enum
from typing import List
import numpy as np
import pandas as pd
class DiscretizationType(Enum):
UNIFORM = "uniform"
QUANTILE = "quantile"
class Discretizer:
"""
A class which enables the discretization of a pandas dataframe.
Perform this action when you want to convert a co... | from enum import Enum
from typing import List
import numpy as np
import pandas as pd
class DiscretizationType(Enum):
UNIFORM = "uniform"
QUANTILE = "quantile"
class Discretizer:
"""
A class which enables the discretization of a pandas dataframe.
Perform this action when you want to convert a co... |
27,393 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/duplicates_pandas.py | 9,13 | 1,56 | pandas_get_duplicates | 23,56 | 13,56 | from typing import Any, Dict, Optional, Sequence, Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.duplicates import get_duplicates
@get_duplicates.register(Settings, pd.DataFrame, Sequence)
def pandas_get_duplicates(
config: Settings, df: pd.DataFrame, supported_... | from typing import Any, Dict, Optional, Sequence, Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.duplicates import get_duplicates
@get_duplicates.register(Settings, pd.DataFrame, Sequence)
def pandas_get_duplicates(
config: Settings, df: pd.DataFrame, supported_... | n_head = config.duplicates.head
metrics: Dict[str, Any] = {}
if n_head > 0:
if supported_columns and len(df) > 0:
duplicates_key = config.duplicates.key
if duplicates_key in df.columns:
raise ValueError(
f"Duplicates key ({duplicates_key})... | """Obtain the most occurring duplicate rows in the DataFrame.
Args:
config: report Settings object
df: the Pandas DataFrame.
supported_columns: the columns to consider
Returns:
A subset of the DataFrame, ordered by occurrence.
"""
n_head = config.duplicates.head
... | 95 | 213 | 381 | 594 | from typing import Any, Dict, Optional, Sequence, Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.duplicates import get_duplicates
@get_duplicates.register(Settings, pd.DataFrame, Sequence)
def pandas_get_duplicates(
config: Settings, df: pd.DataFrame, supported_... | from typing import Any, Dict, Optional, Sequence, Tuple
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.duplicates import get_duplicates
@get_duplicates.register(Settings, pd.DataFrame, Sequence)
def pandas_get_duplicates(
config: Settings, df: pd.DataFrame, supported_... | |
27,394 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/imbalance_pandas.py | 8,11 | 1,36 | column_imbalance_score | 28,36 | 11,36 | from typing import Union
import pandas as pd
from numpy import log2
from scipy.stats import entropy
def column_imbalance_score(
value_counts: pd.Series, n_classes: int
) -> Union[float, int]:
FILL_FUNC_BODY | from typing import Union
import pandas as pd
from numpy import log2
from scipy.stats import entropy
def column_imbalance_score(
value_counts: pd.Series, n_classes: int
) -> Union[float, int]:
"""column_imbalance_score
The class balance score for categorical and boolean variables uses entropy to calculat... | # return 0 if there is only one class (when entropy =0) as it is balanced.
# note that this also prevents a zero division error with log2(n_classes)
if n_classes > 1:
# casting to numpy array to ensure correct dtype when a categorical integer
# variable is evaluated
value_counts = va... | """column_imbalance_score
The class balance score for categorical and boolean variables uses entropy to calculate a bounded score between 0 and 1.
A perfectly uniform distribution would return a score of 0, and a perfectly imbalanced distribution would return a score of 1.
When dealing with probabili... | 61 | 346 | 139 | 485 | from typing import Union
import pandas as pd
from numpy import log2
from scipy.stats import entropy
def column_imbalance_score(
value_counts: pd.Series, n_classes: int
) -> Union[float, int]:
FILL_FUNC_BODY | from typing import Union
import pandas as pd
from numpy import log2
from scipy.stats import entropy
def column_imbalance_score(
value_counts: pd.Series, n_classes: int
) -> Union[float, int]:
"""column_imbalance_score
The class balance score for categorical and boolean variables uses entropy to calculat... | |
27,395 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/missing_pandas.py | 34,36 | 1,47 | pandas_missing_heatmap | 36,47 | 36,47 | import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.missing import missing_bar, missing_heatmap, missing_matrix
from ydata_profiling.visualisation.missing import (
plot_missing_bar,
plot_missing_heatmap,
plot_missing_matrix,
)
@missing_bar.registe... | import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.missing import missing_bar, missing_heatmap, missing_matrix
from ydata_profiling.visualisation.missing import (
plot_missing_bar,
plot_missing_heatmap,
plot_missing_matrix,
)
@missing_bar.registe... | # Remove completely filled or completely empty variables.
columns = [i for i, n in enumerate(np.var(df.isnull(), axis="rows")) if n > 0]
df = df.iloc[:, columns]
# Create and mask the correlation matrix. Construct the base heatmap.
corr_mat = df.isnull().corr()
mask = np.zeros_like(corr_mat)
... | # Remove completely filled or completely empty variables.
columns = [i for i, n in enumerate(np.var(df.isnull(), axis="rows")) if n > 0]
df = df.iloc[:, columns]
# Create and mask the correlation matrix. Construct the base heatmap.
corr_mat = df.isnull().corr()
mask = np.zeros_like(corr_mat)
... | 52 | 337 | 173 | 510 | import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.missing import missing_bar, missing_heatmap, missing_matrix
from ydata_profiling.visualisation.missing import (
plot_missing_bar,
plot_missing_heatmap,
plot_missing_matrix,
)
@missing_bar.registe... | import numpy as np
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.missing import missing_bar, missing_heatmap, missing_matrix
from ydata_profiling.visualisation.missing import (
plot_missing_bar,
plot_missing_heatmap,
plot_missing_matrix,
)
@missing_bar.registe... | |
27,396 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/sample_pandas.py | 9,11 | 1,39 | pandas_get_sample | 20,39 | 11,39 | from typing import List
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.sample import Sample, get_sample
@get_sample.register(Settings, pd.DataFrame)
def pandas_get_sample(config: Settings, df: pd.DataFrame) -> List[Sample]:
FILL_FUNC_BODY | from typing import List
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.sample import Sample, get_sample
@get_sample.register(Settings, pd.DataFrame)
def pandas_get_sample(config: Settings, df: pd.DataFrame) -> List[Sample]:
"""Obtains a sample from head and tail of th... | samples: List[Sample] = []
if len(df) == 0:
return samples
n_head = config.samples.head
if n_head > 0:
samples.append(Sample(id="head", data=df.head(n=n_head), name="First rows"))
n_tail = config.samples.tail
if n_tail > 0:
samples.append(Sample(id="tail", data=df.tail(... | """Obtains a sample from head and tail of the DataFrame
Args:
config: Settings object
df: the pandas DataFrame
Returns:
a list of Sample objects
"""
samples: List[Sample] = []
if len(df) == 0:
return samples
n_head = config.samples.head
if n_head > 0:
... | 47 | 151 | 212 | 363 | from typing import List
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.sample import Sample, get_sample
@get_sample.register(Settings, pd.DataFrame)
def pandas_get_sample(config: Settings, df: pd.DataFrame) -> List[Sample]:
FILL_FUNC_BODY | from typing import List
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.sample import Sample, get_sample
@get_sample.register(Settings, pd.DataFrame)
def pandas_get_sample(config: Settings, df: pd.DataFrame) -> List[Sample]:
"""Obtains a sample from head and tail of th... | |
27,397 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/summary_pandas.py | 19,26 | 1,112 | pandas_describe_1d | 37,60 | 26,60 | """Compute statistical description of datasets."""
import multiprocessing
import multiprocessing.pool
from typing import Tuple
import numpy as np
import pandas as pd
from tqdm import tqdm
from visions import VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model.summarizer import BaseS... | """Compute statistical description of datasets."""
import multiprocessing
import multiprocessing.pool
from typing import Tuple
import numpy as np
import pandas as pd
from tqdm import tqdm
from visions import VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model.summarizer import BaseS... |
# Make sure pd.NA is not in the series
series = series.fillna(np.nan)
if (
isinstance(typeset, ProfilingTypeSet)
and typeset.type_schema
and series.name in typeset.type_schema
):
vtype = typeset.type_schema[series.name]
elif config.infer_dtypes:
# Infer vari... | """Describe a series (infer the variable type, then calculate type-specific values).
Args:
config: report Settings object
series: The Series to describe.
summarizer: Summarizer object
typeset: Typeset
Returns:
A Series containing calculated series description values... | 67 | 827 | 257 | 1,084 | """Compute statistical description of datasets."""
import multiprocessing
import multiprocessing.pool
from typing import Tuple
import numpy as np
import pandas as pd
from tqdm import tqdm
from visions import VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model.summarizer import BaseS... | """Compute statistical description of datasets."""
import multiprocessing
import multiprocessing.pool
from typing import Tuple
import numpy as np
import pandas as pd
from tqdm import tqdm
from visions import VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model.summarizer import BaseS... | |
27,398 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/table_pandas.py | 9,13 | 1,57 | pandas_get_table_stats | 23,57 | 13,57 | from collections import Counter
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.table import get_table_stats
@get_table_stats.register
def pandas_get_table_stats(
config: Settings, df: pd.DataFrame, variable_stats: dict
) -> dict:
FILL_FUNC_BODY | from collections import Counter
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.table import get_table_stats
@get_table_stats.register
def pandas_get_table_stats(
config: Settings, df: pd.DataFrame, variable_stats: dict
) -> dict:
"""General statistics for the Data... | n = len(df) if not df.empty else 0
memory_size = df.memory_usage(deep=config.memory_deep).sum()
record_size = float(memory_size) / n if n > 0 else 0
table_stats = {
"n": n,
"n_var": len(df.columns),
"memory_size": memory_size,
"record_size": record_size,
"n_cell... | """General statistics for the DataFrame.
Args:
config: report Settings object
df: The DataFrame to describe.
variable_stats: Previously calculated statistic on the DataFrame.
Returns:
A dictionary that contains the table statistics.
"""
n = len(df) if not df.empty e... | 98 | 169 | 433 | 602 | from collections import Counter
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.table import get_table_stats
@get_table_stats.register
def pandas_get_table_stats(
config: Settings, df: pd.DataFrame, variable_stats: dict
) -> dict:
FILL_FUNC_BODY | from collections import Counter
import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.model.table import get_table_stats
@get_table_stats.register
def pandas_get_table_stats(
config: Settings, df: pd.DataFrame, variable_stats: dict
) -> dict:
"""General statistics for the Data... | |
27,399 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/timeseries_index_pandas.py | 10,16 | 1,34 | pandas_get_time_index_description | 16,34 | 16,34 | """Compute statistical description of datasets."""
import numpy as np
import pandas as pd
from pandas.api.types import is_numeric_dtype
from ydata_profiling.config import Settings
from ydata_profiling.model.timeseries_index import get_time_index_description
@get_time_index_description.register
def pandas_get_time_in... | """Compute statistical description of datasets."""
import numpy as np
import pandas as pd
from pandas.api.types import is_numeric_dtype
from ydata_profiling.config import Settings
from ydata_profiling.model.timeseries_index import get_time_index_description
@get_time_index_description.register
def pandas_get_time_in... | if not (is_numeric_dtype(df.index) or isinstance(df.index, pd.DatetimeIndex)):
return {}
n_series = table_stats["types"].get("TimeSeries", 0)
length = table_stats["n"]
start = df.index.min()
end = df.index.max()
period = abs(np.diff(df.index)).mean()
if isinstance(df.index, pd.Datet... | if not (is_numeric_dtype(df.index) or isinstance(df.index, pd.DatetimeIndex)):
return {}
n_series = table_stats["types"].get("TimeSeries", 0)
length = table_stats["n"]
start = df.index.min()
end = df.index.max()
period = abs(np.diff(df.index)).mean()
if isinstance(df.index, pd.Datet... | 43 | 140 | 199 | 339 | """Compute statistical description of datasets."""
import numpy as np
import pandas as pd
from pandas.api.types import is_numeric_dtype
from ydata_profiling.config import Settings
from ydata_profiling.model.timeseries_index import get_time_index_description
@get_time_index_description.register
def pandas_get_time_in... | """Compute statistical description of datasets."""
import numpy as np
import pandas as pd
from pandas.api.types import is_numeric_dtype
from ydata_profiling.config import Settings
from ydata_profiling.model.timeseries_index import get_time_index_description
@get_time_index_description.register
def pandas_get_time_in... | |
27,400 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/pandas/utils_pandas.py | 4,5 | 1,28 | weighted_median | 10,28 | 5,28 | import numpy as np
def weighted_median(data: np.ndarray, weights: np.ndarray) -> int:
FILL_FUNC_BODY | import numpy as np
def weighted_median(data: np.ndarray, weights: np.ndarray) -> int:
"""
Args:
data (list or numpy.array): data
weights (list or numpy.array): weights
"""
FILL_FUNC_BODY | if not isinstance(data, np.ndarray):
data = np.array(data)
if not isinstance(weights, np.ndarray):
weights = np.array(weights)
s_data, s_weights = map(np.sort, [data, weights])
midpoint = 0.5 * np.sum(s_weights)
if s_weights[-1] > midpoint:
w_median = data[weights == np.max... | """
Args:
data (list or numpy.array): data
weights (list or numpy.array): weights
"""
if not isinstance(data, np.ndarray):
data = np.array(data)
if not isinstance(weights, np.ndarray):
weights = np.array(weights)
s_data, s_weights = map(np.sort, [data, weights])
... | 62 | 78 | 252 | 330 | import numpy as np
def weighted_median(data: np.ndarray, weights: np.ndarray) -> int:
FILL_FUNC_BODY | import numpy as np
def weighted_median(data: np.ndarray, weights: np.ndarray) -> int:
"""
Args:
data (list or numpy.array): data
weights (list or numpy.array): weights
"""
FILL_FUNC_BODY | |
27,401 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/sample.py | 23,24 | 1,38 | get_custom_sample | 24,38 | 24,38 | from typing import List, Optional, TypeVar
from multimethod import multimethod
from pydantic.v1 import BaseModel
from ydata_profiling.config import Settings
T = TypeVar("T") # type: ignore
class Sample(BaseModel):
id: str
data: T # type: ignore
name: str
caption: Optional[str] = None
@multimeth... | from typing import List, Optional, TypeVar
from multimethod import multimethod
from pydantic.v1 import BaseModel
from ydata_profiling.config import Settings
T = TypeVar("T") # type: ignore
class Sample(BaseModel):
id: str
data: T # type: ignore
name: str
caption: Optional[str] = None
@multimeth... | if "name" not in sample:
sample["name"] = None
if "caption" not in sample:
sample["caption"] = None
samples = [
Sample(
id="custom",
data=sample["data"],
name=sample["name"],
caption=sample["caption"],
)
]
return sample... | if "name" not in sample:
sample["name"] = None
if "caption" not in sample:
sample["caption"] = None
samples = [
Sample(
id="custom",
data=sample["data"],
name=sample["name"],
caption=sample["caption"],
)
]
return sample... | 28 | 164 | 102 | 266 | from typing import List, Optional, TypeVar
from multimethod import multimethod
from pydantic.v1 import BaseModel
from ydata_profiling.config import Settings
T = TypeVar("T") # type: ignore
class Sample(BaseModel):
id: str
data: T # type: ignore
name: str
caption: Optional[str] = None
@multimeth... | from typing import List, Optional, TypeVar
from multimethod import multimethod
from pydantic.v1 import BaseModel
from ydata_profiling.config import Settings
T = TypeVar("T") # type: ignore
class Sample(BaseModel):
id: str
data: T # type: ignore
name: str
caption: Optional[str] = None
@multimeth... | |
27,402 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/summarizer.py | 90,91 | 1,180 | format_summary | 99,122 | 91,122 | from dataclasses import asdict
from typing import Any, Callable, Dict, List, Type, Union
import numpy as np
import pandas as pd
from visions import VisionsBaseType, VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.model.handler import Ha... | from dataclasses import asdict
from typing import Any, Callable, Dict, List, Type, Union
import numpy as np
import pandas as pd
from visions import VisionsBaseType, VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.model.handler import Ha... |
def fmt(v: Any) -> Any:
if isinstance(v, dict):
return {k: fmt(va) for k, va in v.items()}
else:
if isinstance(v, pd.Series):
return fmt(v.to_dict())
elif (
isinstance(v, tuple)
and len(v) == 2
and a... | """Prepare summary for export to json file.
Args:
summary (Union[BaseDescription, dict]): summary to export
Returns:
dict: summary as dict
"""
def fmt(v: Any) -> Any:
if isinstance(v, dict):
return {k: fmt(va) for k, va in v.items()}
else:
i... | 63 | 1,360 | 228 | 1,588 | from dataclasses import asdict
from typing import Any, Callable, Dict, List, Type, Union
import numpy as np
import pandas as pd
from visions import VisionsBaseType, VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.model.handler import Ha... | from dataclasses import asdict
from typing import Any, Callable, Dict, List, Type, Union
import numpy as np
import pandas as pd
from visions import VisionsBaseType, VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.model.handler import Ha... | |
27,403 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/summarizer.py | 34,37 | 28,46 | summarize | BaseSummarizer | 42,46 | 37,46 | class BaseSummarizer(Handler):
"""A base summarizer
Can be used to define custom summarizations
"""
def summarize(
self, config: Settings, series: pd.Series, dtype: Type[VisionsBaseType]
) -> dict:
FILL_FUNC_BODY | class BaseSummarizer(Handler):
"""A base summarizer
Can be used to define custom summarizations
"""
def summarize(
self, config: Settings, series: pd.Series, dtype: Type[VisionsBaseType]
) -> dict:
"""
Returns:
object:
"""
FILL_FUNC_BODY | _, _, summary = self.handle(str(dtype), config, series, {"type": str(dtype)})
return summary
| """
Returns:
object:
"""
_, _, summary = self.handle(str(dtype), config, series, {"type": str(dtype)})
return summary
| 11 | 94 | 37 | 131 | from dataclasses import asdict
from typing import Any, Callable, Dict, List, Type, Union
import numpy as np
import pandas as pd
from visions import VisionsBaseType, VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.model.handler import Ha... | from dataclasses import asdict
from typing import Any, Callable, Dict, List, Type, Union
import numpy as np
import pandas as pd
from visions import VisionsBaseType, VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.model.handler import Ha... |
27,404 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/summary.py | 13,20 | 1,32 | describe_1d | 20,23 | 20,23 | """Compute statistical description of datasets."""
from typing import Any
from multimethod import multimethod
from tqdm import tqdm
from visions import VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model.summarizer import BaseSummarizer
@multimethod
def describe_1d(
config: Se... | """Compute statistical description of datasets."""
from typing import Any
from multimethod import multimethod
from tqdm import tqdm
from visions import VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model.summarizer import BaseSummarizer
@multimethod
def describe_1d(
config: Se... | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 208 | 14 | 222 | """Compute statistical description of datasets."""
from typing import Any
from multimethod import multimethod
from tqdm import tqdm
from visions import VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model.summarizer import BaseSummarizer
@multimethod
def describe_1d(
config: Se... | """Compute statistical description of datasets."""
from typing import Any
from multimethod import multimethod
from tqdm import tqdm
from visions import VisionsTypeset
from ydata_profiling.config import Settings
from ydata_profiling.model.summarizer import BaseSummarizer
@multimethod
def describe_1d(
config: Se... | |
27,405 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/table.py | 8,10 | 1,11 | get_table_stats | 10,11 | 10,11 | from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def get_table_stats(config: Settings, df: Any, variable_stats: dict) -> dict:
FILL_FUNC_BODY | from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def get_table_stats(config: Settings, df: Any, variable_stats: dict) -> dict:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 71 | 10 | 81 | from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def get_table_stats(config: Settings, df: Any, variable_stats: dict) -> dict:
FILL_FUNC_BODY | from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def get_table_stats(config: Settings, df: Any, variable_stats: dict) -> dict:
FILL_FUNC_BODY | |
27,406 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/timeseries_index.py | 10,16 | 1,17 | get_time_index_description | 16,17 | 16,17 | """Compute statistical description of datasets."""
from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def get_time_index_description(
config: Settings,
df: Any,
table_stats: dict,
) -> dict:
FILL_FUNC_BODY | """Compute statistical description of datasets."""
from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def get_time_index_description(
config: Settings,
df: Any,
table_stats: dict,
) -> dict:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 91 | 10 | 101 | """Compute statistical description of datasets."""
from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def get_time_index_description(
config: Settings,
df: Any,
table_stats: dict,
) -> dict:
FILL_FUNC_BODY | """Compute statistical description of datasets."""
from typing import Any
from multimethod import multimethod
from ydata_profiling.config import Settings
@multimethod
def get_time_index_description(
config: Settings,
df: Any,
table_stats: dict,
) -> dict:
FILL_FUNC_BODY | |
27,408 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 218,220 | 215,247 | get_relations | Boolean | 220,234 | 220,234 | class Boolean(visions.VisionsBaseType):
"""Type for boolean columns."""
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
FILL_FUNC_BODY @staticmethod
@multimethod
@series_not_empty
@series_handle_nulls
def contains_op(series: pd.Series, sta... | class Boolean(visions.VisionsBaseType):
"""Type for boolean columns."""
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
FILL_FUNC_BODY @staticmethod
@multimethod
@series_not_empty
@series_handle_nulls
def contains_op(series: pd.Series, sta... | # Numeric [0, 1] goes via Categorical with distinct_count_without_nan <= 2
mapping = config.vars.bool.mappings
return [
IdentityRelation(Unsupported),
InferenceRelation(
Text,
relationship=lambda x, y: partial(s... | # Numeric [0, 1] goes via Categorical with distinct_count_without_nan <= 2
mapping = config.vars.bool.mappings
return [
IdentityRelation(Unsupported),
InferenceRelation(
Text,
relationship=lambda x, y: partial(s... | 35 | 171 | 145 | 316 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,409 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 203,208 | 158,215 | contains_op | Categorical | 208,215 | 208,215 | class Categorical(visions.VisionsBaseType):
"""Type for categorical columns.
Categorical columns in pandas categorical format
and columns in string format with small count of unique values.
Can be transformed from:
- Unsupported
- Numeric
- String... | class Categorical(visions.VisionsBaseType):
"""Type for categorical columns.
Categorical columns in pandas categorical format
and columns in string format with small count of unique values.
Can be transformed from:
- Unsupported
- Numeric
- String... | is_valid_dtype = pdt.is_categorical_dtype(series) and not pdt.is_bool_dtype(
series
)
if is_valid_dtype:
return True
return False
| is_valid_dtype = pdt.is_categorical_dtype(series) and not pdt.is_bool_dtype(
series
)
if is_valid_dtype:
return True
return False
| 14 | 402 | 67 | 469 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,410 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 142,147 | 130,158 | contains_op | DateTime | 147,158 | 147,158 | class DateTime(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [
IdentityRelation(Unsupported),
InferenceRelation(
Text,
relationship=lambda x, y: partial(string_is_datet... | class DateTime(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [
IdentityRelation(Unsupported),
InferenceRelation(
Text,
relationship=lambda x, y: partial(string_is_datet... | is_datetime = pdt.is_datetime64_any_dtype(series)
if is_datetime:
return True
has_builtin_datetime = (
series.dropna()
.apply(type)
.isin([datetime.date, datetime.datetime])
.all()
)
... | is_datetime = pdt.is_datetime64_any_dtype(series)
if is_datetime:
return True
has_builtin_datetime = (
series.dropna()
.apply(type)
.isin([datetime.date, datetime.datetime])
.all()
)
... | 18 | 157 | 100 | 257 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,411 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 283,287 | 278,289 | contains_op | File | 287,289 | 287,289 | class File(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(Path)]
@staticmethod
@multimethod
@series_handle_nulls
def contains_op(series: pd.Series, state: dict) -> bool:
FILL_FUNC_BODY | class File(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(Path)]
@staticmethod
@multimethod
@series_handle_nulls
def contains_op(series: pd.Series, state: dict) -> bool:
FILL_FUNC_BODY | return all(os.path.exists(p) for p in series)
| return all(os.path.exists(p) for p in series)
| 6 | 97 | 21 | 118 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,412 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 294,298 | 289,300 | contains_op | Image | 298,300 | 298,300 | class Image(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(File)]
@staticmethod
@multimethod
@series_handle_nulls
def contains_op(series: pd.Series, state: dict) -> bool:
FILL_FUNC_BODY | class Image(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(File)]
@staticmethod
@multimethod
@series_handle_nulls
def contains_op(series: pd.Series, state: dict) -> bool:
FILL_FUNC_BODY | return all(imghdr.what(p) for p in series)
| return all(imghdr.what(p) for p in series)
| 6 | 97 | 21 | 118 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.