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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19,778 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/searchhunterhow.py | 19,20 | 10,69 | do_search | SearchHunterHow | 20,63 | 20,63 | class SearchHunterHow:
def __init__(self, word) -> None:
self.word = word
self.total_hostnames: set = set()
self.key = Core.hunterhow_key()
if self.key is None:
raise MissingKey('hunterhow')
self.proxy = False
async def do_search(self) -> None:
FILL_FUNC_BODY... | class SearchHunterHow:
def __init__(self, word) -> None:
self.word = word
self.total_hostnames: set = set()
self.key = Core.hunterhow_key()
if self.key is None:
raise MissingKey('hunterhow')
self.proxy = False
async def do_search(self) -> None:
FILL_FUNC_BODY... | # https://hunter.how/search-api
query = f'domain.suffix="{self.word}"'
# second_query = f'domain="{self.word}"'
encoded_query = base64.urlsafe_b64encode(query.encode('utf-8')).decode('ascii')
page = 1
page_size = 100 # can be either: 10,20,50,100)
# The interval ... | # https://hunter.how/search-api
query = f'domain.suffix="{self.word}"'
# second_query = f'domain="{self.word}"'
encoded_query = base64.urlsafe_b64encode(query.encode('utf-8')).decode('ascii')
page = 1
page_size = 100 # can be either: 10,20,50,100)
# The interval ... | 165 | 166 | 707 | 873 | import base64
from datetime import datetime
from dateutil.relativedelta import relativedelta
from theHarvester.discovery.constants import MissingKey
from theHarvester.lib.core import AsyncFetcher, Core
class SearchHunterHow:
def __init__(self, word) -> None:
self.word = word
self.total_hostnames... | import base64
from datetime import datetime
from dateutil.relativedelta import relativedelta
from theHarvester.discovery.constants import MissingKey
from theHarvester.lib.core import AsyncFetcher, Core
class SearchHunterHow:
def __init__(self, word) -> None:
self.word = word
self.total_hostnames... |
19,779 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/securitytrailssearch.py | 44,45 | 8,58 | process | SearchSecuritytrail | 45,53 | 45,53 | class SearchSecuritytrail:
def __init__(self, word) -> None:
self.word = word
self.key = Core.security_trails_key()
if self.key is None:
raise MissingKey('Securitytrail')
self.results = ''
self.totalresults = ''
self.api = 'https://api.securitytrails.com/v... | class SearchSecuritytrail:
def __init__(self, word) -> None:
self.word = word
self.key = Core.security_trails_key()
if self.key is None:
raise MissingKey('Securitytrail')
self.results = ''
self.totalresults = ''
self.api = 'https://api.securitytrails.com/v... | self.proxy = proxy
await self.authenticate()
await self.do_search()
parser = securitytrailsparser.Parser(word=self.word, text=self.totalresults)
self.info = await parser.parse_text()
# Create parser and set self.info to tuple returned from parsing text.
print('\tD... | self.proxy = proxy
await self.authenticate()
await self.do_search()
parser = securitytrailsparser.Parser(word=self.word, text=self.totalresults)
self.info = await parser.parse_text()
# Create parser and set self.info to tuple returned from parsing text.
print('\tD... | 30 | 564 | 101 | 665 | import asyncio
from theHarvester.discovery.constants import MissingKey
from theHarvester.lib.core import AsyncFetcher, Core
from theHarvester.parsers import securitytrailsparser
class SearchSecuritytrail:
def __init__(self, word) -> None:
self.word = word
self.key = Core.security_trails_key()
... | import asyncio
from theHarvester.discovery.constants import MissingKey
from theHarvester.lib.core import AsyncFetcher, Core
from theHarvester.parsers import securitytrailsparser
class SearchSecuritytrail:
def __init__(self, word) -> None:
self.word = word
self.key = Core.security_trails_key()
... |
19,780 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/shodansearch.py | 18,19 | 9,100 | search_ip | SearchShodan | 19,100 | 19,100 | class SearchShodan:
def __init__(self) -> None:
self.key = Core.shodan_key()
if self.key is None:
raise MissingKey('Shodan')
self.api = Shodan(self.key)
self.hostdatarow: list = []
self.tracker: OrderedDict = OrderedDict()
async def search_ip(self, ip) -> Ord... | class SearchShodan:
def __init__(self) -> None:
self.key = Core.shodan_key()
if self.key is None:
raise MissingKey('Shodan')
self.api = Shodan(self.key)
self.hostdatarow: list = []
self.tracker: OrderedDict = OrderedDict()
async def search_ip(self, ip) -> Ord... | try:
ipaddress = ip
results = self.api.host(ipaddress)
asn = ''
domains: list = list()
hostnames: list = list()
ip_str = ''
isp = ''
org = ''
ports: list = list()
title = ''
server... | try:
ipaddress = ip
results = self.api.host(ipaddress)
asn = ''
domains: list = list()
hostnames: list = list()
ip_str = ''
isp = ''
org = ''
ports: list = list()
title = ''
server... | 232 | 126 | 818 | 944 | from collections import OrderedDict
from shodan import Shodan, exception
from theHarvester.discovery.constants import MissingKey
from theHarvester.lib.core import Core
class SearchShodan:
def __init__(self) -> None:
self.key = Core.shodan_key()
if self.key is None:
raise MissingKey('... | from collections import OrderedDict
from shodan import Shodan, exception
from theHarvester.discovery.constants import MissingKey
from theHarvester.lib.core import Core
class SearchShodan:
def __init__(self) -> None:
self.key = Core.shodan_key()
if self.key is None:
raise MissingKey('... |
19,781 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/sitedossier.py | 16,17 | 9,97 | do_search | SearchSitedossier | 17,91 | 17,91 | class SearchSitedossier:
def __init__(self, word):
self.word = word
self.totalhosts = set()
self.server = 'www.sitedossier.com'
self.proxy = False
async def do_search(self):
FILL_FUNC_BODY async def get_hostnames(self):
return self.totalhosts
async def process(se... | class SearchSitedossier:
def __init__(self, word):
self.word = word
self.totalhosts = set()
self.server = 'www.sitedossier.com'
self.proxy = False
async def do_search(self):
FILL_FUNC_BODY async def get_hostnames(self):
return self.totalhosts
async def process(se... | # 2023 but this site doesn't support https...
# This site seems to yield a lot of results but is a bit annoying to scrape
# Hence the need for delays after each request to get the most results
# Feel free to tweak the delays as needed
url = f'http://{self.server}/parentdomain/{se... | # 2023 but this site doesn't support https...
# This site seems to yield a lot of results but is a bit annoying to scrape
# Hence the need for delays after each request to get the most results
# Feel free to tweak the delays as needed
url = f'http://{self.server}/parentdomain/{se... | 353 | 133 | 1,126 | 1,259 | import asyncio
from bs4 import BeautifulSoup
from theHarvester.discovery.constants import get_delay
from theHarvester.lib.core import AsyncFetcher, Core
class SearchSitedossier:
def __init__(self, word):
self.word = word
self.totalhosts = set()
self.server = 'www.sitedossier.com'
... | import asyncio
from bs4 import BeautifulSoup
from theHarvester.discovery.constants import get_delay
from theHarvester.lib.core import AsyncFetcher, Core
class SearchSitedossier:
def __init__(self, word):
self.word = word
self.totalhosts = set()
self.server = 'www.sitedossier.com'
... |
19,782 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/subdomaincenter.py | 11,12 | 4,27 | do_search | SubdomainCenter | 12,21 | 12,21 | class SubdomainCenter:
def __init__(self, word):
self.word = word
self.results = set()
self.server = 'https://api.subdomain.center/?domain='
self.proxy = False
async def do_search(self):
FILL_FUNC_BODY async def get_hostnames(self):
return self.results
async def ... | class SubdomainCenter:
def __init__(self, word):
self.word = word
self.results = set()
self.server = 'https://api.subdomain.center/?domain='
self.proxy = False
async def do_search(self):
FILL_FUNC_BODY async def get_hostnames(self):
return self.results
async def ... | headers = {'User-Agent': Core.get_user_agent()}
try:
current_url = f'{self.server}{self.word}'
resp = await AsyncFetcher.fetch_all([current_url], headers=headers, proxy=self.proxy, json=True)
self.results = resp[0]
self.results = {sub[4:] if sub[:4] == 'ww... | headers = {'User-Agent': Core.get_user_agent()}
try:
current_url = f'{self.server}{self.word}'
resp = await AsyncFetcher.fetch_all([current_url], headers=headers, proxy=self.proxy, json=True)
self.results = resp[0]
self.results = {sub[4:] if sub[:4] == 'ww... | 46 | 125 | 153 | 278 | from theHarvester.lib.core import AsyncFetcher, Core
class SubdomainCenter:
def __init__(self, word):
self.word = word
self.results = set()
self.server = 'https://api.subdomain.center/?domain='
self.proxy = False
async def do_search(self):
FILL_FUNC_BODY async def get_hostn... | from theHarvester.lib.core import AsyncFetcher, Core
class SubdomainCenter:
def __init__(self, word):
self.word = word
self.results = set()
self.server = 'https://api.subdomain.center/?domain='
self.proxy = False
async def do_search(self):
FILL_FUNC_BODY async def get_hostn... |
19,783 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/subdomainfinderc99.py | 51,53 | 11,62 | get_csrf_params | SearchSubdomainfinderc99 | 53,62 | 53,62 | class SearchSubdomainfinderc99:
def __init__(self, word) -> None:
self.word = word
self.total_results: set = set()
self.proxy = False
# TODO add api support
self.server = 'https://subdomainfinder.c99.nl/'
self.totalresults = ''
async def do_search(self) -> None:
... | class SearchSubdomainfinderc99:
def __init__(self, word) -> None:
self.word = word
self.total_results: set = set()
self.proxy = False
# TODO add api support
self.server = 'https://subdomainfinder.c99.nl/'
self.totalresults = ''
async def do_search(self) -> None:
... | csrf_params = {}
html = BeautifulSoup(data, 'html.parser').find('div', {'class': 'input-group'})
for c in html.find_all('input'):
try:
csrf_params[c.get('name')] = c.get('value')
except Exception:
continue
return csrf_params
| csrf_params = {}
html = BeautifulSoup(data, 'html.parser').find('div', {'class': 'input-group'})
for c in html.find_all('input'):
try:
csrf_params[c.get('name')] = c.get('value')
except Exception:
continue
return csrf_params
| 22 | 554 | 104 | 658 | import asyncio
import ujson
from bs4 import BeautifulSoup
from theHarvester.discovery.constants import get_delay
from theHarvester.lib.core import AsyncFetcher, Core
from theHarvester.parsers import myparser
class SearchSubdomainfinderc99:
def __init__(self, word) -> None:
self.word = word
self.... | import asyncio
import ujson
from bs4 import BeautifulSoup
from theHarvester.discovery.constants import get_delay
from theHarvester.lib.core import AsyncFetcher, Core
from theHarvester.parsers import myparser
class SearchSubdomainfinderc99:
def __init__(self, word) -> None:
self.word = word
self.... |
19,784 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/takeover.py | 76,77 | 10,99 | do_take | TakeOver | 77,93 | 77,93 | class TakeOver:
def __init__(self, hosts) -> None:
# NOTE THIS MODULE IS ACTIVE RECON
self.hosts = hosts
self.proxy = False
self.fingerprints: dict[str, str] = dict()
# https://stackoverflow.com/questions/33080869/python-how-to-create-a-dict-of-dict-of-list-with-defaultdict
... | class TakeOver:
def __init__(self, hosts) -> None:
# NOTE THIS MODULE IS ACTIVE RECON
self.hosts = hosts
self.proxy = False
self.fingerprints: dict[str, str] = dict()
# https://stackoverflow.com/questions/33080869/python-how-to-create-a-dict-of-dict-of-list-with-defaultdict
... | try:
if len(self.hosts) > 0:
# Returns a list of tuples in this format: (url, response)
# Filter out responses whose responses are empty strings (indicates errored)
https_hosts = [f'https://{host}' for host in self.hosts]
http_hosts = [... | try:
if len(self.hosts) > 0:
# Returns a list of tuples in this format: (url, response)
# Filter out responses whose responses are empty strings (indicates errored)
https_hosts = [f'https://{host}' for host in self.hosts]
http_hosts = [... | 77 | 1,218 | 233 | 1,451 | import re
from collections import defaultdict
from random import shuffle
import ujson
from theHarvester.lib.core import AsyncFetcher, Core
class TakeOver:
def __init__(self, hosts) -> None:
# NOTE THIS MODULE IS ACTIVE RECON
self.hosts = hosts
self.proxy = False
self.fingerprints... | import re
from collections import defaultdict
from random import shuffle
import ujson
from theHarvester.lib.core import AsyncFetcher, Core
class TakeOver:
def __init__(self, hosts) -> None:
# NOTE THIS MODULE IS ACTIVE RECON
self.hosts = hosts
self.proxy = False
self.fingerprints... |
19,785 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/threatminer.py | 11,12 | 4,31 | do_search | SearchThreatminer | 12,22 | 12,22 | class SearchThreatminer:
def __init__(self, word) -> None:
self.word = word
self.totalhosts: set = set()
self.totalips: set = set()
self.proxy = False
async def do_search(self) -> None:
FILL_FUNC_BODY async def get_hostnames(self) -> set:
return self.totalhosts
a... | class SearchThreatminer:
def __init__(self, word) -> None:
self.word = word
self.totalhosts: set = set()
self.totalips: set = set()
self.proxy = False
async def do_search(self) -> None:
FILL_FUNC_BODY async def get_hostnames(self) -> set:
return self.totalhosts
a... | url = f'https://api.threatminer.org/v2/domain.php?q={self.word}&rt=5'
response = await AsyncFetcher.fetch_all([url], json=True, proxy=self.proxy)
self.totalhosts = {host for host in response[0]['results']}
second_url = f'https://api.threatminer.org/v2/domain.php?q={self.word}&rt=2'
... | url = f'https://api.threatminer.org/v2/domain.php?q={self.word}&rt=5'
response = await AsyncFetcher.fetch_all([url], json=True, proxy=self.proxy)
self.totalhosts = {host for host in response[0]['results']}
second_url = f'https://api.threatminer.org/v2/domain.php?q={self.word}&rt=2'
... | 36 | 164 | 198 | 362 | from theHarvester.lib.core import AsyncFetcher
class SearchThreatminer:
def __init__(self, word) -> None:
self.word = word
self.totalhosts: set = set()
self.totalips: set = set()
self.proxy = False
async def do_search(self) -> None:
FILL_FUNC_BODY async def get_hostnames(se... | from theHarvester.lib.core import AsyncFetcher
class SearchThreatminer:
def __init__(self, word) -> None:
self.word = word
self.totalhosts: set = set()
self.totalips: set = set()
self.proxy = False
async def do_search(self) -> None:
FILL_FUNC_BODY async def get_hostnames(se... |
19,786 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/tombasearch.py | 23,24 | 7,99 | do_search | SearchTomba | 24,76 | 24,76 | class SearchTomba:
def __init__(self, word, limit, start) -> None:
self.word = word
self.limit = limit
self.limit = 10 if limit > 10 else limit
self.start = start
self.key = Core.tomba_key()
if self.key[0] is None or self.key[1] is None:
raise MissingKey('... | class SearchTomba:
def __init__(self, word, limit, start) -> None:
self.word = word
self.limit = limit
self.limit = 10 if limit > 10 else limit
self.start = start
self.key = Core.tomba_key()
if self.key[0] is None or self.key[1] is None:
raise MissingKey('... | # First determine if a user account is not a free account, this call is free
is_free = True
headers = {
'User-Agent': Core.get_user_agent(),
'X-Tomba-Key': self.key[0],
'X-Tomba-Secret': self.key[1],
}
acc_info_url = 'https://api.tomba.io/v1/me... | # First determine if a user account is not a free account, this call is free
is_free = True
headers = {
'User-Agent': Core.get_user_agent(),
'X-Tomba-Key': self.key[0],
'X-Tomba-Secret': self.key[1],
}
acc_info_url = 'https://api.tomba.io/v1/me... | 266 | 409 | 868 | 1,277 | import asyncio
from theHarvester.discovery.constants import MissingKey
from theHarvester.lib.core import AsyncFetcher, Core
class SearchTomba:
def __init__(self, word, limit, start) -> None:
self.word = word
self.limit = limit
self.limit = 10 if limit > 10 else limit
self.start = ... | import asyncio
from theHarvester.discovery.constants import MissingKey
from theHarvester.lib.core import AsyncFetcher, Core
class SearchTomba:
def __init__(self, word, limit, start) -> None:
self.word = word
self.limit = limit
self.limit = 10 if limit > 10 else limit
self.start = ... |
19,787 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/urlscan.py | 13,14 | 4,41 | do_search | SearchUrlscan | 14,26 | 14,26 | class SearchUrlscan:
def __init__(self, word) -> None:
self.word = word
self.totalhosts: set = set()
self.totalips: set = set()
self.interestingurls: set = set()
self.totalasns: set = set()
self.proxy = False
async def do_search(self) -> None:
FILL_FUNC_BODY a... | class SearchUrlscan:
def __init__(self, word) -> None:
self.word = word
self.totalhosts: set = set()
self.totalips: set = set()
self.interestingurls: set = set()
self.totalasns: set = set()
self.proxy = False
async def do_search(self) -> None:
FILL_FUNC_BODY a... | url = f'https://urlscan.io/api/v1/search/?q=domain:{self.word}'
response = await AsyncFetcher.fetch_all([url], json=True, proxy=self.proxy)
resp = response[0]
self.totalhosts = {f"{page['page']['domain']}" for page in resp['results']}
self.totalips = {f"{page['page']['ip']}" for ... | url = f'https://urlscan.io/api/v1/search/?q=domain:{self.word}'
response = await AsyncFetcher.fetch_all([url], json=True, proxy=self.proxy)
resp = response[0]
self.totalhosts = {f"{page['page']['domain']}" for page in resp['results']}
self.totalips = {f"{page['page']['ip']}" for ... | 58 | 238 | 240 | 478 | from theHarvester.lib.core import AsyncFetcher
class SearchUrlscan:
def __init__(self, word) -> None:
self.word = word
self.totalhosts: set = set()
self.totalips: set = set()
self.interestingurls: set = set()
self.totalasns: set = set()
self.proxy = False
async... | from theHarvester.lib.core import AsyncFetcher
class SearchUrlscan:
def __init__(self, word) -> None:
self.word = word
self.totalhosts: set = set()
self.totalips: set = set()
self.interestingurls: set = set()
self.totalasns: set = set()
self.proxy = False
async... |
19,788 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/discovery/yahoosearch.py | 25,26 | 5,42 | get_emails | SearchYahoo | 26,38 | 26,38 | class SearchYahoo:
def __init__(self, word, limit) -> None:
self.word = word
self.total_results = ''
self.server = 'search.yahoo.com'
self.limit = limit
self.proxy = False
async def do_search(self) -> None:
base_url = f'https://{self.server}/search?p=%40{self.wor... | class SearchYahoo:
def __init__(self, word, limit) -> None:
self.word = word
self.total_results = ''
self.server = 'search.yahoo.com'
self.limit = limit
self.proxy = False
async def do_search(self) -> None:
base_url = f'https://{self.server}/search?p=%40{self.wor... | rawres = myparser.Parser(self.total_results, self.word)
toparse_emails = await rawres.emails()
emails = set()
# strip out numbers and dashes for emails that look like xxx-xxx-xxxemail@host.tld
for email in toparse_emails:
email = str(email)
if '-' in email... | rawres = myparser.Parser(self.total_results, self.word)
toparse_emails = await rawres.emails()
emails = set()
# strip out numbers and dashes for emails that look like xxx-xxx-xxxemail@host.tld
for email in toparse_emails:
email = str(email)
if '-' in email... | 52 | 339 | 168 | 507 | from theHarvester.lib.core import AsyncFetcher, Core
from theHarvester.parsers import myparser
class SearchYahoo:
def __init__(self, word, limit) -> None:
self.word = word
self.total_results = ''
self.server = 'search.yahoo.com'
self.limit = limit
self.proxy = False
as... | from theHarvester.lib.core import AsyncFetcher, Core
from theHarvester.parsers import myparser
class SearchYahoo:
def __init__(self, word, limit) -> None:
self.word = word
self.total_results = ''
self.server = 'search.yahoo.com'
self.limit = limit
self.proxy = False
as... |
19,789 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/lib/api/api.py | 119,139 | 1,190 | query | 139,190 | 139,190 | import argparse
import os
from fastapi import FastAPI, Header, Query, Request
from fastapi.responses import HTMLResponse, RedirectResponse, Response, UJSONResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import get_remote_address
from sta... | import argparse
import os
from fastapi import FastAPI, Header, Query, Request
from fastapi.responses import HTMLResponse, RedirectResponse, Response, UJSONResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import get_remote_address
from sta... | # Query function that allows user to query theHarvester rest API
# Rate limit of 2 requests per minute
# basic user agent filtering
if user_agent and ('gobuster' in user_agent or 'sqlmap' in user_agent or 'rustbuster' in user_agent):
response = RedirectResponse(app.url_path_for('bot'))
r... | # Query function that allows user to query theHarvester rest API
# Rate limit of 2 requests per minute
# basic user agent filtering
if user_agent and ('gobuster' in user_agent or 'sqlmap' in user_agent or 'rustbuster' in user_agent):
response = RedirectResponse(app.url_path_for('bot'))
r... | 111 | 1,391 | 523 | 1,914 | import argparse
import os
from fastapi import FastAPI, Header, Query, Request
from fastapi.responses import HTMLResponse, RedirectResponse, Response, UJSONResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import get_remote_address
from sta... | import argparse
import os
from fastapi import FastAPI, Header, Query, Request
from fastapi.responses import HTMLResponse, RedirectResponse, Response, UJSONResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import get_remote_address
from sta... | |
19,790 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/lib/api/api_example.py | 21,22 | 1,117 | main | 26,115 | 22,115 | """
Example script to query theHarvester rest API, obtain results, and write out to stdout as well as an html
"""
import asyncio
import aiohttp
import netaddr
async def fetch_json(session, url):
async with session.get(url) as response:
return await response.json()
async def fetch(session, url):
as... | """
Example script to query theHarvester rest API, obtain results, and write out to stdout as well as an html
"""
import asyncio
import aiohttp
import netaddr
async def fetch_json(session, url):
async with session.get(url) as response:
return await response.json()
async def fetch(session, url):
as... | url = 'http://127.0.0.1:5000'
domain = 'netflix.com'
query_url = f'{url}/query?limit=300&source=bing,baidu,duckduckgo,dogpile&domain={domain}'
async with aiohttp.ClientSession() as session:
fetched_json = await fetch_json(session, query_url)
total_asns = fetched_json['asns']
inte... | """
Just a simple example of how to interact with the rest api
you can easily use requests instead of aiohttp or whatever you best see fit
"""
url = 'http://127.0.0.1:5000'
domain = 'netflix.com'
query_url = f'{url}/query?limit=300&source=bing,baidu,duckduckgo,dogpile&domain={domain}'
as... | 255 | 190 | 1,279 | 1,469 | """
Example script to query theHarvester rest API, obtain results, and write out to stdout as well as an html
"""
import asyncio
import aiohttp
import netaddr
async def fetch_json(session, url):
async with session.get(url) as response:
return await response.json()
async def fetch(session, url):
as... | """
Example script to query theHarvester rest API, obtain results, and write out to stdout as well as an html
"""
import asyncio
import aiohttp
import netaddr
async def fetch_json(session, url):
async with session.get(url) as response:
return await response.json()
async def fetch(session, url):
as... | |
19,793 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/lib/hostchecker.py | 36,38 | 17,85 | resolve_host | Checker | 38,52 | 38,52 | class Checker:
def __init__(self, hosts: list, nameserver: list) -> None:
self.hosts = hosts
self.realhosts: list = []
self.addresses: set = set()
self.nameserver = nameserver
# @staticmethod
# async def query(host, resolver) -> Tuple[str, Any]:
# try:
# ... | class Checker:
def __init__(self, hosts: list, nameserver: list) -> None:
self.hosts = hosts
self.realhosts: list = []
self.addresses: set = set()
self.nameserver = nameserver
# @staticmethod
# async def query(host, resolver) -> Tuple[str, Any]:
# try:
# ... | try:
# TODO add check for ipv6 addrs as well
result = await resolver.gethostbyname(host, socket.AF_INET)
addresses = result.addresses
if addresses == [] or addresses is None or result is None:
return f'{host}:'
else:
add... | try:
# TODO add check for ipv6 addrs as well
result = await resolver.gethostbyname(host, socket.AF_INET)
addresses = result.addresses
if addresses == [] or addresses is None or result is None:
return f'{host}:'
else:
add... | 49 | 672 | 194 | 866 | #!/usr/bin/env python
"""
Created by laramies on 2008-08-21.
Revised to use aiodns & asyncio on 2019-09-23
"""
# Support for Python3.9
from __future__ import annotations
import asyncio
import socket
from typing import Any
import aiodns
class Checker:
def __init__(self, hosts: list, nameserver: list) -> None:
... | #!/usr/bin/env python
"""
Created by laramies on 2008-08-21.
Revised to use aiodns & asyncio on 2019-09-23
"""
# Support for Python3.9
from __future__ import annotations
import asyncio
import socket
from typing import Any
import aiodns
class Checker:
def __init__(self, hosts: list, nameserver: list) -> None:
... |
19,795 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/lib/version.py | 4,5 | 1,6 | version | 5,6 | 5,6 | VERSION = '4.6.0'
def version() -> str:
FILL_FUNC_BODY | VERSION = '4.6.0'
def version() -> str:
FILL_FUNC_BODY | return VERSION
| return VERSION
| 2 | 30 | 7 | 37 | VERSION = '4.6.0'
def version() -> str:
FILL_FUNC_BODY | VERSION = '4.6.0'
def version() -> str:
FILL_FUNC_BODY | |
19,796 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/parsers/intelxparser.py | 6,7 | 1,27 | parse_dictionaries | Parser | 12,27 | 7,27 | class Parser:
def __init__(self) -> None:
self.emails: set = set()
self.hosts: set = set()
async def parse_dictionaries(self, results: dict) -> tuple:
FILL_FUNC_BODY | class Parser:
def __init__(self) -> None:
self.emails: set = set()
self.hosts: set = set()
async def parse_dictionaries(self, results: dict) -> tuple:
"""
Parse method to parse json results
:param results: Dictionary containing a list of dictionaries known as selectors
... | if results is not None:
for dictionary in results['selectors']:
field = dictionary['selectorvalue']
if '@' in field:
self.emails.add(field)
else:
field = str(field)
if 'http' in field or 'http... | """
Parse method to parse json results
:param results: Dictionary containing a list of dictionaries known as selectors
:return: tuple of emails and hosts
"""
if results is not None:
for dictionary in results['selectors']:
field = dictionary['se... | 49 | 111 | 162 | 273 | class Parser:
def __init__(self) -> None:
self.emails: set = set()
self.hosts: set = set()
async def parse_dictionaries(self, results: dict) -> tuple:
FILL_FUNC_BODY | class Parser:
def __init__(self) -> None:
self.emails: set = set()
self.hosts: set = set()
async def parse_dictionaries(self, results: dict) -> tuple:
"""
Parse method to parse json results
:param results: Dictionary containing a list of dictionaries known as selectors
... |
19,797 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/parsers/myparser.py | 100,101 | 5,117 | set | Parser | 101,110 | 101,110 | class Parser:
def __init__(self, results, word) -> None:
self.results = results
self.word = word
self.temp: list = []
async def genericClean(self) -> None:
self.results = (
self.results.replace('<em>', '')
.replace('<b>', '')
.replace('</b>', ... | class Parser:
def __init__(self, results, word) -> None:
self.results = results
self.word = word
self.temp: list = []
async def genericClean(self) -> None:
self.results = (
self.results.replace('<em>', '')
.replace('<b>', '')
.replace('</b>', ... | reg_sets = re.compile(r'>[a-zA-Z\d]*</a></font>')
self.temp = reg_sets.findall(self.results)
sets = []
for iteration in self.temp:
delete = iteration.replace('>', '')
delete = delete.replace('</a</font', '')
sets.append(delete)
return sets
| reg_sets = re.compile(r'>[a-zA-Z\d]*</a></font>')
self.temp = reg_sets.findall(self.results)
sets = []
for iteration in self.temp:
delete = iteration.replace('>', '')
delete = delete.replace('</a</font', '')
sets.append(delete)
return sets
| 24 | 1,295 | 114 | 1,409 | import re
from collections.abc import Set
class Parser:
def __init__(self, results, word) -> None:
self.results = results
self.word = word
self.temp: list = []
async def genericClean(self) -> None:
self.results = (
self.results.replace('<em>', '')
.repl... | import re
from collections.abc import Set
class Parser:
def __init__(self, results, word) -> None:
self.results = results
self.word = word
self.temp: list = []
async def genericClean(self) -> None:
self.results = (
self.results.replace('<em>', '')
.repl... |
19,798 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/parsers/securitytrailsparser.py | 8,9 | 1,38 | parse_text | Parser | 9,38 | 9,38 | class Parser:
def __init__(self, word, text) -> None:
self.word = word
self.text = text
self.hostnames: set = set()
self.ips: set = set()
async def parse_text(self) -> tuple[set, set]:
FILL_FUNC_BODY | class Parser:
def __init__(self, word, text) -> None:
self.word = word
self.text = text
self.hostnames: set = set()
self.ips: set = set()
async def parse_text(self) -> tuple[set, set]:
FILL_FUNC_BODY | sub_domain_flag = 0
self.text = str(self.text).splitlines()
# Split lines to get a list of lines.
for index in range(0, len(self.text)):
line = self.text[index].strip()
if '"ip":' in line:
# Extract IP.
ip = ''
for c... | sub_domain_flag = 0
self.text = str(self.text).splitlines()
# Split lines to get a list of lines.
for index in range(0, len(self.text)):
line = self.text[index].strip()
if '"ip":' in line:
# Extract IP.
ip = ''
for c... | 104 | 85 | 322 | 407 | class Parser:
def __init__(self, word, text) -> None:
self.word = word
self.text = text
self.hostnames: set = set()
self.ips: set = set()
async def parse_text(self) -> tuple[set, set]:
FILL_FUNC_BODY | class Parser:
def __init__(self, word, text) -> None:
self.word = word
self.text = text
self.hostnames: set = set()
self.ips: set = set()
async def parse_text(self) -> tuple[set, set]:
FILL_FUNC_BODY |
19,799 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/restfulHarvest.py | 6,7 | 1,47 | main | 7,45 | 7,45 | import argparse
import uvicorn
def main():
FILL_FUNC_BODYif __name__ == '__main__':
main()
| import argparse
import uvicorn
def main():
FILL_FUNC_BODYif __name__ == '__main__':
main()
| parser = argparse.ArgumentParser()
parser.add_argument(
'-H',
'--host',
default='127.0.0.1',
help='IP address to listen on default is 127.0.0.1',
)
parser.add_argument(
'-p',
'--port',
default=5000,
help='Port to bind the web server to, def... | parser = argparse.ArgumentParser()
parser.add_argument(
'-H',
'--host',
default='127.0.0.1',
help='IP address to listen on default is 127.0.0.1',
)
parser.add_argument(
'-p',
'--port',
default=5000,
help='Port to bind the web server to, def... | 74 | 42 | 366 | 408 | import argparse
import uvicorn
def main():
FILL_FUNC_BODYif __name__ == '__main__':
main()
| import argparse
import uvicorn
def main():
FILL_FUNC_BODYif __name__ == '__main__':
main()
| |
19,800 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/screenshot/screenshot.py | 53,55 | 17,100 | visit | ScreenShotter | 55,76 | 55,76 | class ScreenShotter:
def __init__(self, output) -> None:
self.output = output
self.slash = '\\' if 'win' in sys.platform else '/'
self.slash = '' if (self.output[-1] == '\\' or self.output[-1] == '/') else self.slash
def verify_path(self) -> bool:
try:
if not os.path... | class ScreenShotter:
def __init__(self, output) -> None:
self.output = output
self.slash = '\\' if 'win' in sys.platform else '/'
self.slash = '' if (self.output[-1] == '\\' or self.output[-1] == '/') else self.slash
def verify_path(self) -> bool:
try:
if not os.path... | try:
timeout = aiohttp.ClientTimeout(total=35)
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/122.0.0.0 Safari/537.36'
}
url = f'http://{url}' if not url.startswith('http'... | try:
timeout = aiohttp.ClientTimeout(total=35)
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/122.0.0.0 Safari/537.36'
}
url = f'http://{url}' if not url.startswith('http'... | 80 | 768 | 319 | 1,087 | """
Screenshot module that utilizes playwright to asynchronously
take screenshots
"""
import os
import ssl
import sys
from collections.abc import Collection
from datetime import datetime
import aiohttp
import certifi
from playwright.async_api import async_playwright
class ScreenShotter:
def __init__(self, outpu... | """
Screenshot module that utilizes playwright to asynchronously
take screenshots
"""
import os
import ssl
import sys
from collections.abc import Collection
from datetime import datetime
import aiohttp
import certifi
from playwright.async_api import async_playwright
class ScreenShotter:
def __init__(self, outpu... |
19,801 | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester | /home/hieuvd/dung_repo/raw/stars_01/laramies_theHarvester/theHarvester/theHarvester/theHarvester.py | 7,8 | 1,26 | main | 8,26 | 8,26 | import asyncio
import sys
from theHarvester import __main__
def main():
FILL_FUNC_BODY | import asyncio
import sys
from theHarvester import __main__
def main():
FILL_FUNC_BODY | platform = sys.platform
if platform == 'win32':
# Required or things will break if trying to take screenshots
import multiprocessing
multiprocessing.freeze_support()
asyncio.DefaultEventLoopPolicy = asyncio.WindowsSelectorEventLoopPolicy
else:
import uvloop
... | platform = sys.platform
if platform == 'win32':
# Required or things will break if trying to take screenshots
import multiprocessing
multiprocessing.freeze_support()
asyncio.DefaultEventLoopPolicy = asyncio.WindowsSelectorEventLoopPolicy
else:
import uvloop
... | 54 | 34 | 181 | 215 | import asyncio
import sys
from theHarvester import __main__
def main():
FILL_FUNC_BODY | import asyncio
import sys
from theHarvester import __main__
def main():
FILL_FUNC_BODY | |
20,342 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/asr.py | 31,32 | 25,88 | generate_segment_batched | WhisperModel | 32,77 | 32,77 | class WhisperModel(faster_whisper.WhisperModel):
'''
FasterWhisperModel provides batched inference for faster-whisper.
Currently only works in non-timestamp mode and fixed prompt for all samples in batch.
'''
def generate_segment_batched(self, features: np.ndarray, tokenizer: faster_whisper.tokeniz... | class WhisperModel(faster_whisper.WhisperModel):
'''
FasterWhisperModel provides batched inference for faster-whisper.
Currently only works in non-timestamp mode and fixed prompt for all samples in batch.
'''
def generate_segment_batched(self, features: np.ndarray, tokenizer: faster_whisper.tokeniz... | batch_size = features.shape[0]
all_tokens = []
prompt_reset_since = 0
if options.initial_prompt is not None:
initial_prompt = " " + options.initial_prompt.strip()
initial_prompt_tokens = tokenizer.encode(initial_prompt)
all_tokens.extend(initial_prompt... | batch_size = features.shape[0]
all_tokens = []
prompt_reset_since = 0
if options.initial_prompt is not None:
initial_prompt = " " + options.initial_prompt.strip()
initial_prompt_tokens = tokenizer.encode(initial_prompt)
all_tokens.extend(initial_prompt... | 106 | 309 | 506 | 815 | import os
import warnings
from typing import List, Union, Optional, NamedTuple
import ctranslate2
import faster_whisper
import numpy as np
import torch
from transformers import Pipeline
from transformers.pipelines.pt_utils import PipelineIterator
from .audio import N_SAMPLES, SAMPLE_RATE, load_audio, log_mel_spectrog... | import os
import warnings
from typing import List, Union, Optional, NamedTuple
import ctranslate2
import faster_whisper
import numpy as np
import torch
from transformers import Pipeline
from transformers.pipelines.pt_utils import PipelineIterator
from .audio import N_SAMPLES, SAMPLE_RATE, load_audio, log_mel_spectrog... |
20,343 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/audio.py | 68,69 | 1,160 | pad_or_trim | 72,94 | 69,94 | import os
import subprocess
from functools import lru_cache
from typing import Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from .utils import exact_div
# hard-coded audio hyperparameters
SAMPLE_RATE = 16000
N_FFT = 400
HOP_LENGTH = 160
CHUNK_LENGTH = 30
N_SAMPLES = CHUNK_LENGTH * ... | import os
import subprocess
from functools import lru_cache
from typing import Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from .utils import exact_div
# hard-coded audio hyperparameters
SAMPLE_RATE = 16000
N_FFT = 400
HOP_LENGTH = 160
CHUNK_LENGTH = 30
N_SAMPLES = CHUNK_LENGTH * ... | if torch.is_tensor(array):
if array.shape[axis] > length:
array = array.index_select(
dim=axis, index=torch.arange(length, device=array.device)
)
if array.shape[axis] < length:
pad_widths = [(0, 0)] * array.ndim
pad_widths[axis] = (0, ... | """
Pad or trim the audio array to N_SAMPLES, as expected by the encoder.
"""
if torch.is_tensor(array):
if array.shape[axis] > length:
array = array.index_select(
dim=axis, index=torch.arange(length, device=array.device)
)
if array.shape[axis] < ... | 72 | 1,498 | 273 | 1,771 | import os
import subprocess
from functools import lru_cache
from typing import Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from .utils import exact_div
# hard-coded audio hyperparameters
SAMPLE_RATE = 16000
N_FFT = 400
HOP_LENGTH = 160
CHUNK_LENGTH = 30
N_SAMPLES = CHUNK_LENGTH * ... | import os
import subprocess
from functools import lru_cache
from typing import Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from .utils import exact_div
# hard-coded audio hyperparameters
SAMPLE_RATE = 16000
N_FFT = 400
HOP_LENGTH = 160
CHUNK_LENGTH = 30
N_SAMPLES = CHUNK_LENGTH * ... | |
20,346 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/utils.py | 208,209 | 192,212 | write_result | ResultWriter | 209,212 | 209,212 | class ResultWriter:
extension: str
def __init__(self, output_dir: str):
self.output_dir = output_dir
def __call__(self, result: dict, audio_path: str, options: dict):
audio_basename = os.path.basename(audio_path)
audio_basename = os.path.splitext(audio_basename)[0]
output_p... | class ResultWriter:
extension: str
def __init__(self, output_dir: str):
self.output_dir = output_dir
def __call__(self, result: dict, audio_path: str, options: dict):
audio_basename = os.path.basename(audio_path)
audio_basename = os.path.splitext(audio_basename)[0]
output_p... | raise NotImplementedError
| raise NotImplementedError
| 2 | 207 | 13 | 220 | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... |
20,347 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/utils.py | 224,225 | 220,334 | iterate_result | SubtitlesWriter | 225,326 | 225,326 | class SubtitlesWriter(ResultWriter):
always_include_hours: bool
decimal_marker: str
def iterate_result(self, result: dict, options: dict):
FILL_FUNC_BODY def format_timestamp(self, seconds: float):
return format_timestamp(
seconds=seconds,
always_include_hours=self.always... | class SubtitlesWriter(ResultWriter):
always_include_hours: bool
decimal_marker: str
def iterate_result(self, result: dict, options: dict):
FILL_FUNC_BODY def format_timestamp(self, seconds: float):
return format_timestamp(
seconds=seconds,
always_include_hours=self.always... | raw_max_line_width: Optional[int] = options["max_line_width"]
max_line_count: Optional[int] = options["max_line_count"]
highlight_words: bool = options["highlight_words"]
max_line_width = 1000 if raw_max_line_width is None else raw_max_line_width
preserve_segments = max_line_coun... | raw_max_line_width: Optional[int] = options["max_line_width"]
max_line_count: Optional[int] = options["max_line_count"]
highlight_words: bool = options["highlight_words"]
max_line_width = 1000 if raw_max_line_width is None else raw_max_line_width
preserve_segments = max_line_coun... | 383 | 118 | 1,278 | 1,396 | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... |
20,348 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/utils.py | 390,391 | 376,399 | write_result | WriteAudacity | 391,399 | 391,399 | class WriteAudacity(ResultWriter):
"""
Write a transcript to a text file that audacity can import as labels.
The extension used is "aud" to distinguish it from the txt file produced by WriteTXT.
Yet this is not an audacity project but only a label file!
Please note : Audacity uses seconds in ti... | class WriteAudacity(ResultWriter):
"""
Write a transcript to a text file that audacity can import as labels.
The extension used is "aud" to distinguish it from the txt file produced by WriteTXT.
Yet this is not an audacity project but only a label file!
Please note : Audacity uses seconds in ti... | ARROW = " "
for segment in result["segments"]:
print(segment["start"], file=file, end=ARROW)
print(segment["end"], file=file, end=ARROW)
print( ( ("[[" + segment["speaker"] + "]]") if "speaker" in segment else "") + segment["text"].strip().replace("\t", " "), file=fil... | ARROW = " "
for segment in result["segments"]:
print(segment["start"], file=file, end=ARROW)
print(segment["end"], file=file, end=ARROW)
print( ( ("[[" + segment["speaker"] + "]]") if "speaker" in segment else "") + segment["text"].strip().replace("\t", " "), file=fil... | 33 | 167 | 116 | 283 | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... |
20,349 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/utils.py | 402,403 | 399,406 | write_result | WriteJSON | 403,406 | 403,406 | class WriteJSON(ResultWriter):
extension: str = "json"
def write_result(self, result: dict, file: TextIO, options: dict):
FILL_FUNC_BODY | class WriteJSON(ResultWriter):
extension: str = "json"
def write_result(self, result: dict, file: TextIO, options: dict):
FILL_FUNC_BODY | json.dump(result, file, ensure_ascii=False)
| json.dump(result, file, ensure_ascii=False)
| 3 | 50 | 23 | 73 | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... |
20,350 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/utils.py | 350,351 | 345,357 | write_result | WriteSRT | 351,357 | 351,357 | class WriteSRT(SubtitlesWriter):
extension: str = "srt"
always_include_hours: bool = True
decimal_marker: str = ","
def write_result(self, result: dict, file: TextIO, options: dict):
FILL_FUNC_BODY | class WriteSRT(SubtitlesWriter):
extension: str = "srt"
always_include_hours: bool = True
decimal_marker: str = ","
def write_result(self, result: dict, file: TextIO, options: dict):
FILL_FUNC_BODY | for i, (start, end, text) in enumerate(
self.iterate_result(result, options), start=1
):
print(f"{i}\n{start} --> {end}\n{text}\n", file=file, flush=True)
| for i, (start, end, text) in enumerate(
self.iterate_result(result, options), start=1
):
print(f"{i}\n{start} --> {end}\n{text}\n", file=file, flush=True)
| 16 | 76 | 76 | 152 | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... |
20,351 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/utils.py | 369,370 | 357,376 | write_result | WriteTSV | 370,376 | 370,376 | class WriteTSV(ResultWriter):
"""
Write a transcript to a file in TSV (tab-separated values) format containing lines like:
<start time in integer milliseconds>\t<end time in integer milliseconds>\t<transcript text>
Using integer milliseconds as start and end times means there's no chance of interferenc... | class WriteTSV(ResultWriter):
"""
Write a transcript to a file in TSV (tab-separated values) format containing lines like:
<start time in integer milliseconds>\t<end time in integer milliseconds>\t<transcript text>
Using integer milliseconds as start and end times means there's no chance of interferenc... | print("start", "end", "text", sep="\t", file=file)
for segment in result["segments"]:
print(round(1000 * segment["start"]), file=file, end="\t")
print(round(1000 * segment["end"]), file=file, end="\t")
print(segment["text"].strip().replace("\t", " "), file=file, flush... | print("start", "end", "text", sep="\t", file=file)
for segment in result["segments"]:
print(round(1000 * segment["start"]), file=file, end="\t")
print(round(1000 * segment["end"]), file=file, end="\t")
print(segment["text"].strip().replace("\t", " "), file=file, flush... | 24 | 177 | 118 | 295 | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... |
20,352 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/utils.py | 215,216 | 212,220 | write_result | WriteTXT | 216,220 | 216,220 | class WriteTXT(ResultWriter):
extension: str = "txt"
def write_result(self, result: dict, file: TextIO, options: dict):
FILL_FUNC_BODY | class WriteTXT(ResultWriter):
extension: str = "txt"
def write_result(self, result: dict, file: TextIO, options: dict):
FILL_FUNC_BODY | for segment in result["segments"]:
print(segment["text"].strip(), file=file, flush=True)
| for segment in result["segments"]:
print(segment["text"].strip(), file=file, flush=True)
| 7 | 51 | 36 | 87 | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... |
20,353 | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX | /home/hieuvd/dung_repo/raw/stars_01/m-bain_whisperX/whisperX/whisperx/utils.py | 339,340 | 334,345 | write_result | WriteVTT | 340,345 | 340,345 | class WriteVTT(SubtitlesWriter):
extension: str = "vtt"
always_include_hours: bool = False
decimal_marker: str = "."
def write_result(self, result: dict, file: TextIO, options: dict):
FILL_FUNC_BODY | class WriteVTT(SubtitlesWriter):
extension: str = "vtt"
always_include_hours: bool = False
decimal_marker: str = "."
def write_result(self, result: dict, file: TextIO, options: dict):
FILL_FUNC_BODY | print("WEBVTT\n", file=file)
for start, end, text in self.iterate_result(result, options):
print(f"{start} --> {end}\n{text}\n", file=file, flush=True)
| print("WEBVTT\n", file=file)
for start, end, text in self.iterate_result(result, options):
print(f"{start} --> {end}\n{text}\n", file=file, flush=True)
| 14 | 76 | 70 | 146 | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... | import json
import os
import re
import sys
import zlib
from typing import Callable, Optional, TextIO
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko": "korean",
"fr": "french",
"ja": "japanese",
"pt": "portuguese",
"tr": "tur... |
20,354 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/ai/ai_client.py | 28,32 | 4,47 | find_block_params | AIClient | 46,47 | 32,47 | class AIClient():
async def inference_with_prompt(
self,
variable_values: Dict[str, str],
prompt_template: str,
is_json_response: bool = True
):
"""
Infers with Large Language Model with prompt and variables
Args:
variable_valu... | class AIClient():
async def inference_with_prompt(
self,
variable_values: Dict[str, str],
prompt_template: str,
is_json_response: bool = True
):
"""
Infers with Large Language Model with prompt and variables
Args:
variable_valu... | raise Exception('Subclasses must override this method.')
| """
Based on the block descriptionn, find the block type,
block language, pipeline type, and config for this block.
Args:
block_description: description of the block functions.
Returns:
return the response in JSON format with following keys:
bloc... | 6 | 366 | 14 | 380 | from typing import Dict
class AIClient():
async def inference_with_prompt(
self,
variable_values: Dict[str, str],
prompt_template: str,
is_json_response: bool = True
):
"""
Infers with Large Language Model with prompt and variables
Args:... | from typing import Dict
class AIClient():
async def inference_with_prompt(
self,
variable_values: Dict[str, str],
prompt_template: str,
is_json_response: bool = True
):
"""
Infers with Large Language Model with prompt and variables
Args:... |
20,355 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/logging.py | 15,16 | 1,25 | error | 16,21 | 16,21 | import os
from datetime import datetime
from mage_ai.server.logger import Logger
LOGGER = Logger().new_server_logger(__name__)
def debug(text):
if not os.getenv('DISABLE_API_TERMINAL_OUTPUT'):
now = datetime.utcnow().isoformat()
LOGGER.debug(f'[{now}][api.views] {text}')
def error(text):
FILL_... | import os
from datetime import datetime
from mage_ai.server.logger import Logger
LOGGER = Logger().new_server_logger(__name__)
def debug(text):
if not os.getenv('DISABLE_API_TERMINAL_OUTPUT'):
now = datetime.utcnow().isoformat()
LOGGER.debug(f'[{now}][api.views] {text}')
def error(text):
FILL_... | if not os.getenv('DISABLE_API_TERMINAL_OUTPUT'):
now = datetime.utcnow().isoformat()
LOGGER.error(f'[{now}][api.views] {text}')
| if not os.getenv('DISABLE_API_TERMINAL_OUTPUT'):
now = datetime.utcnow().isoformat()
LOGGER.error(f'[{now}][api.views] {text}')
| 8 | 184 | 64 | 248 | import os
from datetime import datetime
from mage_ai.server.logger import Logger
LOGGER = Logger().new_server_logger(__name__)
def debug(text):
if not os.getenv('DISABLE_API_TERMINAL_OUTPUT'):
now = datetime.utcnow().isoformat()
LOGGER.debug(f'[{now}][api.views] {text}')
def error(text):
FILL_... | import os
from datetime import datetime
from mage_ai.server.logger import Logger
LOGGER = Logger().new_server_logger(__name__)
def debug(text):
if not os.getenv('DISABLE_API_TERMINAL_OUTPUT'):
now = datetime.utcnow().isoformat()
LOGGER.debug(f'[{now}][api.views] {text}')
def error(text):
FILL_... | |
20,356 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/monitors/BaseMonitor.py | 16,17 | 9,66 | present | BaseMonitor | 17,66 | 17,66 | class BaseMonitor:
def __init__(self, resource, user, error, **kwargs):
self.error = error
self.options = kwargs
self.resource = resource
self.user = user
def present(self):
FILL_FUNC_BODY | class BaseMonitor:
def __init__(self, resource, user, error, **kwargs):
self.error = error
self.options = kwargs
self.resource = resource
self.user = user
def present(self):
FILL_FUNC_BODY | data = ApiError.RESOURCE_ERROR.copy()
if self.error.code:
data['code'] = self.error.code
if self.error.errors:
data['errors'] = self.error.errors
if self.error.message:
data['message'] = self.error.message
if self.error.type:
data['... | data = ApiError.RESOURCE_ERROR.copy()
if self.error.code:
data['code'] = self.error.code
if self.error.errors:
data['errors'] = self.error.errors
if self.error.message:
data['message'] = self.error.message
if self.error.type:
data['... | 69 | 70 | 363 | 433 | import asyncio
from mage_ai.api.errors import ApiError
from mage_ai.shared.hash import extract
from mage_ai.usage_statistics.constants import EventNameType
from mage_ai.usage_statistics.logger import UsageStatisticLogger
class BaseMonitor:
def __init__(self, resource, user, error, **kwargs):
self.error =... | import asyncio
from mage_ai.api.errors import ApiError
from mage_ai.shared.hash import extract
from mage_ai.usage_statistics.constants import EventNameType
from mage_ai.usage_statistics.logger import UsageStatisticLogger
class BaseMonitor:
def __init__(self, resource, user, error, **kwargs):
self.error =... |
20,357 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/parsers/PipelineScheduleParser.py | 28,34 | 1,122 | parse_write | 34,63 | 34,63 | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.api.policies.PipelineSchedulePolicy import (
READABLE_ATTRIB... | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.api.policies.PipelineSchedulePolicy import (
READABLE_ATTRIB... | if AuthorizeStatusType.FAILED == authorize_status:
parsed_value = extract(value or {}, WRITABLE_ATTRIBUTES_FOR_PIPELINE_INTERACTIONS)
else:
parsed_value = (value or {}).copy()
pipeline = parser.policy.parent_model()
if not pipeline:
pipeline = parser.policy.resource.pipeline
... | if AuthorizeStatusType.FAILED == authorize_status:
parsed_value = extract(value or {}, WRITABLE_ATTRIBUTES_FOR_PIPELINE_INTERACTIONS)
else:
parsed_value = (value or {}).copy()
pipeline = parser.policy.parent_model()
if not pipeline:
pipeline = parser.policy.resource.pipeline
... | 66 | 745 | 296 | 1,041 | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.api.policies.PipelineSchedulePolicy import (
READABLE_ATTRIB... | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.api.policies.PipelineSchedulePolicy import (
READABLE_ATTRIB... | |
20,358 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/parsers/ProjectParser.py | 14,15 | 1,30 | parse_read | 15,18 | 15,18 | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.shared.hash import extract
class ProjectParser(BaseParser):
... | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.shared.hash import extract
class ProjectParser(BaseParser):
... | return extract(value, ['features'])
| return extract(value, ['features'])
| 3 | 217 | 15 | 232 | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.shared.hash import extract
class ProjectParser(BaseParser):
... | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.shared.hash import extract
class ProjectParser(BaseParser):
... | |
20,359 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/parsers/RoleParser.py | 15,16 | 1,31 | parse_read | 16,19 | 16,19 | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.api.presenters.RolePresenter import RolePresenter
from mage_ai.s... | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.api.presenters.RolePresenter import RolePresenter
from mage_ai.s... | return extract(value, RolePresenter.default_attributes)
| return extract(value, RolePresenter.default_attributes)
| 3 | 240 | 21 | 261 | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.api.presenters.RolePresenter import RolePresenter
from mage_ai.s... | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
from mage_ai.api.presenters.RolePresenter import RolePresenter
from mage_ai.s... | |
20,360 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/parsers/UserParser.py | 13,14 | 1,29 | parse_read | 14,17 | 14,17 | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
class UserParser(BaseParser):
pass
async def parse_read(parser, value... | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
class UserParser(BaseParser):
pass
async def parse_read(parser, value... | return {}
| return {}
| 2 | 207 | 9 | 216 | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
class UserParser(BaseParser):
pass
async def parse_read(parser, value... | from typing import Dict
from mage_ai.api.constants import AuthorizeStatusType
from mage_ai.api.oauth_scope import OauthScopeType
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.parsers.BaseParser import BaseParser
class UserParser(BaseParser):
pass
async def parse_read(parser, value... | |
20,361 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/AutocompleteItemPolicy.py | 9,11 | 8,14 | entity | AutocompleteItemPolicy | 11,14 | 11,14 | class AutocompleteItemPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class AutocompleteItemPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | return Entity.ANY, None
| return Entity.ANY, None
| 3 | 33 | 15 | 48 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.AutocompleteItemPresenter import AutocompleteItemPresenter
from mage_ai.orchestration.constants import Entity
class AutocompleteItemPolicy(Base... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.AutocompleteItemPresenter import AutocompleteItemPresenter
from mage_ai.orchestration.constants import Entity
class AutocompleteItemPolicy(Base... |
20,362 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/BackfillPolicy.py | 9,11 | 8,18 | entity | BackfillPolicy | 11,18 | 11,18 | class BackfillPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class BackfillPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | parent_model = self.options.get('parent_model')
if parent_model:
return Entity.PIPELINE, parent_model.uuid
return super().entity
| parent_model = self.options.get('parent_model')
if parent_model:
return Entity.PIPELINE, parent_model.uuid
return super().entity
| 10 | 30 | 54 | 84 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.BackfillPresenter import BackfillPresenter
from mage_ai.orchestration.constants import Entity
class BackfillPolicy(BasePolicy):
@property
... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.BackfillPresenter import BackfillPresenter
from mage_ai.orchestration.constants import Entity
class BackfillPolicy(BasePolicy):
@property
... |
20,363 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/BlockPolicy.py | 10,12 | 9,25 | entity | BlockPolicy | 12,25 | 12,25 | class BlockPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class BlockPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | parent_model = self.options.get('parent_model')
if parent_model:
pipeline_uuid = None
if isinstance(parent_model, PipelineRun):
pipeline_uuid = parent_model.pipeline_uuid
else:
pipeline_uuid = parent_model.uuid
return Entit... | parent_model = self.options.get('parent_model')
if parent_model:
pipeline_uuid = None
if isinstance(parent_model, PipelineRun):
pipeline_uuid = parent_model.pipeline_uuid
else:
pipeline_uuid = parent_model.uuid
return Entit... | 23 | 29 | 109 | 138 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.BlockPresenter import BlockPresenter
from mage_ai.orchestration.constants import Entity
from mage_ai.orchestration.db.models.schedules import Pip... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.BlockPresenter import BlockPresenter
from mage_ai.orchestration.constants import Entity
from mage_ai.orchestration.db.models.schedules import Pip... |
20,364 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/BlockRunPolicy.py | 9,11 | 8,25 | entity | BlockRunPolicy | 11,25 | 11,25 | class BlockRunPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class BlockRunPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | query = self.options.get('query', {})
pipeline_uuid = query.get('pipeline_uuid', [None])
if pipeline_uuid:
pipeline_uuid = pipeline_uuid[0]
if pipeline_uuid:
return Entity.PIPELINE, pipeline_uuid
parent_model = self.options.get('parent_model')
if ... | query = self.options.get('query', {})
pipeline_uuid = query.get('pipeline_uuid', [None])
if pipeline_uuid:
pipeline_uuid = pipeline_uuid[0]
if pipeline_uuid:
return Entity.PIPELINE, pipeline_uuid
parent_model = self.options.get('parent_model')
if ... | 28 | 30 | 136 | 166 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.BlockRunPresenter import BlockRunPresenter
from mage_ai.orchestration.constants import Entity
class BlockRunPolicy(BasePolicy):
@property
... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.BlockRunPresenter import BlockRunPresenter
from mage_ai.orchestration.constants import Entity
class BlockRunPolicy(BasePolicy):
@property
... |
20,365 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/BlockTemplatePolicy.py | 9,11 | 8,14 | entity | BlockTemplatePolicy | 11,14 | 11,14 | class BlockTemplatePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class BlockTemplatePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | return Entity.ANY, None
| return Entity.ANY, None
| 3 | 30 | 15 | 45 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.BlockTemplatePresenter import BlockTemplatePresenter
from mage_ai.orchestration.constants import Entity
class BlockTemplatePolicy(BasePolicy):
... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.BlockTemplatePresenter import BlockTemplatePresenter
from mage_ai.orchestration.constants import Entity
class BlockTemplatePolicy(BasePolicy):
... |
20,366 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/ClusterPolicy.py | 9,11 | 8,14 | entity | ClusterPolicy | 11,14 | 11,14 | class ClusterPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class ClusterPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | return Entity.ANY, None
| return Entity.ANY, None
| 3 | 30 | 15 | 45 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.ClusterPresenter import ClusterPresenter
from mage_ai.orchestration.constants import Entity
class ClusterPolicy(BasePolicy):
@property
... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.ClusterPresenter import ClusterPresenter
from mage_ai.orchestration.constants import Entity
class ClusterPolicy(BasePolicy):
@property
... |
20,367 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/DataProviderPolicy.py | 9,11 | 8,14 | entity | DataProviderPolicy | 11,14 | 11,14 | class DataProviderPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class DataProviderPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | return Entity.ANY, None
| return Entity.ANY, None
| 3 | 30 | 15 | 45 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.DataProviderPresenter import DataProviderPresenter
from mage_ai.orchestration.constants import Entity
class DataProviderPolicy(BasePolicy):
... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.DataProviderPresenter import DataProviderPresenter
from mage_ai.orchestration.constants import Entity
class DataProviderPolicy(BasePolicy):
... |
20,368 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/EventRulePolicy.py | 9,11 | 8,14 | entity | EventRulePolicy | 11,14 | 11,14 | class EventRulePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class EventRulePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | return Entity.ANY, None
| return Entity.ANY, None
| 3 | 30 | 15 | 45 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.EventRulePresenter import EventRulePresenter
from mage_ai.orchestration.constants import Entity
class EventRulePolicy(BasePolicy):
@propert... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.EventRulePresenter import EventRulePresenter
from mage_ai.orchestration.constants import Entity
class EventRulePolicy(BasePolicy):
@propert... |
20,369 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/ExtensionOptionPolicy.py | 9,11 | 8,14 | entity | ExtensionOptionPolicy | 11,14 | 11,14 | class ExtensionOptionPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class ExtensionOptionPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | return Entity.ANY, None
| return Entity.ANY, None
| 3 | 30 | 15 | 45 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.ExtensionOptionPresenter import ExtensionOptionPresenter
from mage_ai.orchestration.constants import Entity
class ExtensionOptionPolicy(BasePol... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.ExtensionOptionPresenter import ExtensionOptionPresenter
from mage_ai.orchestration.constants import Entity
class ExtensionOptionPolicy(BasePol... |
20,370 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/FileVersionPolicy.py | 9,11 | 8,14 | entity | FileVersionPolicy | 11,14 | 11,14 | class FileVersionPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class FileVersionPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | return Entity.ANY, None
| return Entity.ANY, None
| 3 | 30 | 15 | 45 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.FileVersionPresenter import FileVersionPresenter
from mage_ai.orchestration.constants import Entity
class FileVersionPolicy(BasePolicy):
@p... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.FileVersionPresenter import FileVersionPresenter
from mage_ai.orchestration.constants import Entity
class FileVersionPolicy(BasePolicy):
@p... |
20,371 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/KernelPolicy.py | 9,11 | 8,14 | entity | KernelPolicy | 11,14 | 11,14 | class KernelPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class KernelPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | return Entity.ANY, None
| return Entity.ANY, None
| 3 | 29 | 15 | 44 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.KernelPresenter import KernelPresenter
from mage_ai.orchestration.constants import Entity
class KernelPolicy(BasePolicy):
@property
def... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.KernelPresenter import KernelPresenter
from mage_ai.orchestration.constants import Entity
class KernelPolicy(BasePolicy):
@property
def... |
20,372 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/LlmPolicy.py | 10,12 | 9,20 | entity | LlmPolicy | 12,20 | 12,20 | class LlmPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class LlmPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | parent_model = self.options.get('parent_model')
if parent_model:
if issubclass(parent_model.__class__, Pipeline):
return Entity.PIPELINE, parent_model.uuid
return Entity.PROJECT, get_project_uuid()
| parent_model = self.options.get('parent_model')
if parent_model:
if issubclass(parent_model.__class__, Pipeline):
return Entity.PIPELINE, parent_model.uuid
return Entity.PROJECT, get_project_uuid()
| 14 | 30 | 80 | 110 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.data_preparation.models.pipeline import Pipeline
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constants import ... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.data_preparation.models.pipeline import Pipeline
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constants import ... |
20,373 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/LogPolicy.py | 12,14 | 11,24 | entity | LogPolicy | 14,24 | 14,24 | class LogPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class LogPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | parent_model = self.options.get('parent_model')
if parent_model:
if type(parent_model) is BlockRun:
return Entity.PIPELINE, parent_model.pipeline_run.pipeline_uuid
elif issubclass(parent_model.__class__, Pipeline):
return Entity.PIPELINE, parent_mo... | parent_model = self.options.get('parent_model')
if parent_model:
if type(parent_model) is BlockRun:
return Entity.PIPELINE, parent_model.pipeline_run.pipeline_uuid
elif issubclass(parent_model.__class__, Pipeline):
return Entity.PIPELINE, parent_mo... | 21 | 29 | 118 | 147 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.LogPresenter import LogPresenter
from mage_ai.data_preparation.models.pipeline import Pipeline
from mage_ai.data_preparation.repo_manager import ... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.LogPresenter import LogPresenter
from mage_ai.data_preparation.models.pipeline import Pipeline
from mage_ai.data_preparation.repo_manager import ... |
20,374 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/OauthPolicy.py | 14,16 | 13,60 | action_rule_with_permissions | OauthPolicy | 16,28 | 16,28 | class OauthPolicy(BasePolicy, UserPermissionMixIn):
@classmethod
def action_rule_with_permissions(self, operation: OperationType) -> Dict:
FILL_FUNC_BODY @classmethod
def attribute_rule_with_permissions(
self,
attribute_operation_type: AttributeOperationType,
resource_attribute: s... | class OauthPolicy(BasePolicy, UserPermissionMixIn):
@classmethod
def action_rule_with_permissions(self, operation: OperationType) -> Dict:
FILL_FUNC_BODY @classmethod
def attribute_rule_with_permissions(
self,
attribute_operation_type: AttributeOperationType,
resource_attribute: s... | return merge_dict(
super().action_rule_with_permissions(operation),
{
OauthScope.CLIENT_PUBLIC: [
dict(
condition=lambda _policy: operation
in [OperationType.DETAIL, OperationType.LIST],
... | return merge_dict(
super().action_rule_with_permissions(operation),
{
OauthScope.CLIENT_PUBLIC: [
dict(
condition=lambda _policy: operation
in [OperationType.DETAIL, OperationType.LIST],
... | 17 | 359 | 93 | 452 | from typing import Dict
from mage_ai.api.constants import AttributeOperationType, AttributeType
from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.... | from typing import Dict
from mage_ai.api.constants import AttributeOperationType, AttributeType
from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.... |
20,375 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/OutputPolicy.py | 11,13 | 10,21 | entity | OutputPolicy | 13,21 | 13,21 | class OutputPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class OutputPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | parent_model = self.options.get('parent_model')
if parent_model:
if type(parent_model) is BlockRun:
return Entity.PIPELINE, parent_model.pipeline_run.pipeline_uuid
return Entity.PROJECT, get_project_uuid()
| parent_model = self.options.get('parent_model')
if parent_model:
if type(parent_model) is BlockRun:
return Entity.PIPELINE, parent_model.pipeline_run.pipeline_uuid
return Entity.PROJECT, get_project_uuid()
| 15 | 29 | 84 | 113 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.OutputPresenter import OutputPresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constants im... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.OutputPresenter import OutputPresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constants im... |
20,376 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/PipelinePolicy.py | 10,12 | 9,18 | entity | PipelinePolicy | 12,18 | 12,18 | class PipelinePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class PipelinePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | if self.resource and self.resource.model:
return Entity.PIPELINE, self.resource.model.uuid
return Entity.PROJECT, get_project_uuid()
| if self.resource and self.resource.model:
return Entity.PIPELINE, self.resource.model.uuid
return Entity.PROJECT, get_project_uuid()
| 10 | 30 | 53 | 83 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelinePresenter import PipelinePresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constant... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelinePresenter import PipelinePresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constant... |
20,377 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/PipelineRunPolicy.py | 10,12 | 9,25 | entity | PipelineRunPolicy | 12,25 | 12,25 | class PipelineRunPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class PipelineRunPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | query = self.options.get('query', {})
pipeline_uuid = query.get('pipeline_uuid', [None])
if pipeline_uuid:
pipeline_uuid = pipeline_uuid[0]
if pipeline_uuid:
return Entity.PIPELINE, pipeline_uuid
if self.resource and self.resource.model:
retur... | query = self.options.get('query', {})
pipeline_uuid = query.get('pipeline_uuid', [None])
if pipeline_uuid:
pipeline_uuid = pipeline_uuid[0]
if pipeline_uuid:
return Entity.PIPELINE, pipeline_uuid
if self.resource and self.resource.model:
retur... | 28 | 31 | 135 | 166 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelineRunPresenter import PipelineRunPresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.co... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelineRunPresenter import PipelineRunPresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.co... |
20,378 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/PipelineSchedulePolicy.py | 44,45 | 1,203 | authorize_operation_create | 45,73 | 45,73 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelineSchedulePresenter import PipelineSchedulePresenter
from mage_ai.data_preparation.models.pipelines.interactions import PipelineInteraction... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelineSchedulePresenter import PipelineSchedulePresenter
from mage_ai.data_preparation.models.pipelines.interactions import PipelineInteraction... | if policy.has_at_least_editor_role():
return True
pipeline = policy.parent_model()
if not pipeline and policy.resource:
pipeline = policy.resource.pipeline
if not Project(
pipeline.repo_config if pipeline else None,
).is_feature_enabled(FeatureUUID.INTERACTIONS):
re... | if policy.has_at_least_editor_role():
return True
pipeline = policy.parent_model()
if not pipeline and policy.resource:
pipeline = policy.resource.pipeline
if not Project(
pipeline.repo_config if pipeline else None,
).is_feature_enabled(FeatureUUID.INTERACTIONS):
re... | 55 | 1,679 | 277 | 1,956 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelineSchedulePresenter import PipelineSchedulePresenter
from mage_ai.data_preparation.models.pipelines.interactions import PipelineInteraction... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelineSchedulePresenter import PipelineSchedulePresenter
from mage_ai.data_preparation.models.pipelines.interactions import PipelineInteraction... | |
20,379 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/PipelineSchedulePolicy.py | 33,35 | 32,44 | entity | PipelineSchedulePolicy | 35,44 | 35,44 | class PipelineSchedulePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class PipelineSchedulePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | if self.resource and self.resource.model:
if isinstance(self.resource.model, dict):
return Entity.PIPELINE, self.resource.model.get('pipeline_uuid')
else:
return Entity.PIPELINE, self.resource.model.pipeline_uuid
return Entity.PROJECT, get_project... | if self.resource and self.resource.model:
if isinstance(self.resource.model, dict):
return Entity.PIPELINE, self.resource.model.get('pipeline_uuid')
else:
return Entity.PIPELINE, self.resource.model.pipeline_uuid
return Entity.PROJECT, get_project... | 17 | 32 | 100 | 132 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelineSchedulePresenter import PipelineSchedulePresenter
from mage_ai.data_preparation.models.pipelines.interactions import PipelineInteraction... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.PipelineSchedulePresenter import PipelineSchedulePresenter
from mage_ai.data_preparation.models.pipelines.interactions import PipelineInteraction... |
20,380 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/SessionPolicy.py | 14,16 | 13,50 | action_rule_with_permissions | SessionPolicy | 16,24 | 16,24 | class SessionPolicy(BasePolicy, UserPermissionMixIn):
@classmethod
def action_rule_with_permissions(self, operation: OperationType) -> Dict:
FILL_FUNC_BODY @classmethod
def attribute_rule_with_permissions(
self,
attribute_operation_type: AttributeOperationType,
resource_attribute:... | class SessionPolicy(BasePolicy, UserPermissionMixIn):
@classmethod
def action_rule_with_permissions(self, operation: OperationType) -> Dict:
FILL_FUNC_BODY @classmethod
def attribute_rule_with_permissions(
self,
attribute_operation_type: AttributeOperationType,
resource_attribute:... | return merge_dict(super().action_rule_with_permissions(operation), {
OauthScope.CLIENT_PUBLIC: [
dict(
condition=lambda _policy: OperationType.CREATE == operation,
),
],
})
| return merge_dict(super().action_rule_with_permissions(operation), {
OauthScope.CLIENT_PUBLIC: [
dict(
condition=lambda _policy: OperationType.CREATE == operation,
),
],
})
| 14 | 275 | 72 | 347 | from typing import Dict
from mage_ai.api.constants import AttributeOperationType
from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.policies.mixins... | from typing import Dict
from mage_ai.api.constants import AttributeOperationType
from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.policies.mixins... |
20,381 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/StatusPolicy.py | 25,31 | 13,50 | attribute_rule_with_permissions | StatusPolicy | 31,50 | 31,50 | class StatusPolicy(BasePolicy, UserPermissionMixIn):
@classmethod
def action_rule_with_permissions(self, operation: OperationType) -> Dict:
return merge_dict(super().action_rule_with_permissions(operation), {
OauthScope.CLIENT_PRIVATE: [
dict(condition=lambda _policy: Operati... | class StatusPolicy(BasePolicy, UserPermissionMixIn):
@classmethod
def action_rule_with_permissions(self, operation: OperationType) -> Dict:
return merge_dict(super().action_rule_with_permissions(operation), {
OauthScope.CLIENT_PRIVATE: [
dict(condition=lambda _policy: Operati... | config = {}
if AttributeOperationType.READ == attribute_operation_type:
config = self.read_rules[self.__name__].get(resource_attribute)
else:
config = self.write_rules[self.__name__].get(resource_attribute)
return merge_dict(super().attribute_rule_with_permission... | config = {}
if AttributeOperationType.READ == attribute_operation_type:
config = self.read_rules[self.__name__].get(resource_attribute)
else:
config = self.write_rules[self.__name__].get(resource_attribute)
return merge_dict(super().attribute_rule_with_permission... | 31 | 195 | 212 | 407 | from typing import Dict
from mage_ai.api.constants import AttributeOperationType
from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.policies.mixins... | from typing import Dict
from mage_ai.api.constants import AttributeOperationType
from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.policies.mixins... |
20,382 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/UserPolicy.py | 8,9 | 7,12 | is_current_user | UserPolicy | 9,12 | 9,12 | class UserPolicy(BasePolicy):
def is_current_user(self) -> bool:
FILL_FUNC_BODY | class UserPolicy(BasePolicy):
def is_current_user(self) -> bool:
FILL_FUNC_BODY | return self.current_user.owner or self.current_user.id == self.resource.id
| return self.current_user.owner or self.current_user.id == self.resource.id
| 6 | 33 | 29 | 62 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.UserPresenter import UserPresenter
class UserPolicy(BasePolicy):
def is_current_user(self) -> bool:
FILL_FUNC_BODYUserPolicy.allow_actions(... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.UserPresenter import UserPresenter
class UserPolicy(BasePolicy):
def is_current_user(self) -> bool:
FILL_FUNC_BODYUserPolicy.allow_actions(... |
20,383 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/VariablePolicy.py | 10,12 | 9,19 | entity | VariablePolicy | 12,19 | 12,19 | class VariablePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class VariablePolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | parent_model = self.options.get('parent_model')
if parent_model:
return Entity.PIPELINE, parent_model.uuid
return Entity.PROJECT, get_project_uuid()
| parent_model = self.options.get('parent_model')
if parent_model:
return Entity.PIPELINE, parent_model.uuid
return Entity.PROJECT, get_project_uuid()
| 11 | 30 | 62 | 92 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.VariablePresenter import VariablePresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constant... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.VariablePresenter import VariablePresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constant... |
20,384 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/WidgetPolicy.py | 10,12 | 9,19 | entity | WidgetPolicy | 12,19 | 12,19 | class WidgetPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | class WidgetPolicy(BasePolicy):
@property
def entity(self):
FILL_FUNC_BODY | parent_model = self.options.get('parent_model')
if parent_model:
return Entity.PIPELINE, parent_model.uuid
return Entity.PROJECT, get_project_uuid()
| parent_model = self.options.get('parent_model')
if parent_model:
return Entity.PIPELINE, parent_model.uuid
return Entity.PROJECT, get_project_uuid()
| 11 | 30 | 62 | 92 | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.WidgetPresenter import WidgetPresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constants im... | from mage_ai.api.oauth_scope import OauthScope
from mage_ai.api.operations import constants
from mage_ai.api.policies.BasePolicy import BasePolicy
from mage_ai.api.presenters.WidgetPresenter import WidgetPresenter
from mage_ai.data_preparation.repo_manager import get_project_uuid
from mage_ai.orchestration.constants im... |
20,386 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/policies/mixins/user_permissions.py | 257,259 | 256,312 | action_rule_with_permissions | UserPermissionMixIn | 259,267 | 259,267 | class UserPermissionMixIn:
@classmethod
def action_rule_with_permissions(self, operation: OperationType) -> Dict:
FILL_FUNC_BODY @classmethod
def attribute_rule_with_permissions(
self,
attribute_operation_type: AttributeOperationType,
resource_attribute: str,
) -> Dict:
... | class UserPermissionMixIn:
@classmethod
def action_rule_with_permissions(self, operation: OperationType) -> Dict:
FILL_FUNC_BODY @classmethod
def attribute_rule_with_permissions(
self,
attribute_operation_type: AttributeOperationType,
resource_attribute: str,
) -> Dict:
... | return {
OauthScope.CLIENT_PRIVATE: [
dict(
condition=self.build_validate_condition(operation),
),
]
}
| return {
OauthScope.CLIENT_PRIVATE: [
dict(
condition=self.build_validate_condition(operation),
),
]
}
| 9 | 380 | 54 | 434 | import asyncio
from typing import Any, Callable, Dict, Tuple
from mage_ai.api.constants import (
ATTRIBUTE_OPERATION_TYPE_DISABLE_TO_ACCESS_MAPPING,
ATTRIBUTE_OPERATION_TYPE_TO_ACCESS_MAPPING,
OPERATION_TYPE_DISABLE_TO_ACCESS_MAPPING,
OPERATION_TYPE_TO_ACCESS_MAPPING,
AttributeOperationType,
)
from... | import asyncio
from typing import Any, Callable, Dict, Tuple
from mage_ai.api.constants import (
ATTRIBUTE_OPERATION_TYPE_DISABLE_TO_ACCESS_MAPPING,
ATTRIBUTE_OPERATION_TYPE_TO_ACCESS_MAPPING,
OPERATION_TYPE_DISABLE_TO_ACCESS_MAPPING,
OPERATION_TYPE_TO_ACCESS_MAPPING,
AttributeOperationType,
)
from... |
20,387 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/BackfillPresenter.py | 28,29 | 6,59 | present | BackfillPresenter | 29,59 | 29,59 | class BackfillPresenter(BasePresenter):
default_attributes = [
'block_uuid',
'completed_at',
'created_at',
'end_datetime',
'failed_at',
'id',
'interval_type',
'interval_units',
'metrics',
'name',
'pipeline_schedule_id',
... | class BackfillPresenter(BasePresenter):
default_attributes = [
'block_uuid',
'completed_at',
'created_at',
'end_datetime',
'failed_at',
'id',
'interval_type',
'interval_units',
'metrics',
'name',
'pipeline_schedule_id',
... | query = kwargs.get('query', {})
meta = kwargs.get('meta', {})
limit = int((meta or {}).get(META_KEY_LIMIT, 40))
offset = int((meta or {}).get(META_KEY_OFFSET, 0))
data = self.model.to_dict()
include_preview_runs = query.get('include_preview_runs', [False])
incl... | query = kwargs.get('query', {})
meta = kwargs.get('meta', {})
limit = int((meta or {}).get(META_KEY_LIMIT, 40))
offset = int((meta or {}).get(META_KEY_OFFSET, 0))
data = self.model.to_dict()
include_preview_runs = query.get('include_preview_runs', [False])
incl... | 93 | 166 | 425 | 591 | from mage_ai.api.operations.constants import META_KEY_LIMIT, META_KEY_OFFSET
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.orchestration.backfills.service import preview_run_dates
class BackfillPresenter(BasePresenter):
default_attributes = [
'block_uuid',
'completed_... | from mage_ai.api.operations.constants import META_KEY_LIMIT, META_KEY_OFFSET
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.orchestration.backfills.service import preview_run_dates
class BackfillPresenter(BasePresenter):
default_attributes = [
'block_uuid',
'completed_... |
20,388 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/BlockRunPresenter.py | 19,20 | 4,24 | present | BlockRunPresenter | 20,24 | 20,24 | class BlockRunPresenter(BasePresenter):
default_attributes = [
'block_uuid',
'completed_at',
'created_at',
'id',
'metrics',
'pipeline_run_id',
'pipeline_schedule_id',
'pipeline_schedule_name',
'started_at',
'status',
'updated_at... | class BlockRunPresenter(BasePresenter):
default_attributes = [
'block_uuid',
'completed_at',
'created_at',
'id',
'metrics',
'pipeline_run_id',
'pipeline_schedule_id',
'pipeline_schedule_name',
'started_at',
'status',
'updated_at... | if isinstance(self.model, dict):
return self.model
else:
return self.model.to_dict()
| if isinstance(self.model, dict):
return self.model
else:
return self.model.to_dict()
| 8 | 127 | 37 | 164 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class BlockRunPresenter(BasePresenter):
default_attributes = [
'block_uuid',
'completed_at',
'created_at',
'id',
'metrics',
'pipeline_run_id',
'pipeline_schedule_id',
'pipeline_schedule_n... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class BlockRunPresenter(BasePresenter):
default_attributes = [
'block_uuid',
'completed_at',
'created_at',
'id',
'metrics',
'pipeline_run_id',
'pipeline_schedule_id',
'pipeline_schedule_n... |
20,389 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/CacheItemPresenter.py | 13,14 | 6,15 | prepare_present | CacheItemPresenter | 14,15 | 14,15 | class CacheItemPresenter(BasePresenter):
default_attributes = [
'item',
'item_type',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | class CacheItemPresenter(BasePresenter):
default_attributes = [
'item',
'item_type',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | return self.resource.model.to_dict()
| return self.resource.model.to_dict()
| 2 | 67 | 14 | 81 | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class CacheItemPresenter(BasePresenter):
default_attributes = [
'item',
'item_type',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class CacheItemPresenter(BasePresenter):
default_attributes = [
'item',
'item_type',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY |
20,390 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/ClientPagePresenter.py | 17,18 | 5,24 | prepare_present | ClientPagePresenter | 18,24 | 18,24 | class ClientPagePresenter(BasePresenter):
default_attributes = [
'category',
'disabled',
'enabled',
'operation',
'parent',
'resource',
'uuid',
'version',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | class ClientPagePresenter(BasePresenter):
default_attributes = [
'category',
'disabled',
'enabled',
'operation',
'parent',
'resource',
'uuid',
'version',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | return await self.model.to_dict(
current_user=self.current_user,
**(self.resource.result_set().context.data.get('resources') or {}),
)
| return await self.model.to_dict(
current_user=self.current_user,
**(self.resource.result_set().context.data.get('resources') or {}),
)
| 8 | 85 | 58 | 143 | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
class ClientPagePresenter(BasePresenter):
default_attributes = [
'category',
'disabled',
'enabled',
'operation',
'parent',
'resource',
'uuid',
... | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
class ClientPagePresenter(BasePresenter):
default_attributes = [
'category',
'disabled',
'enabled',
'operation',
'parent',
'resource',
'uuid',
... |
20,391 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/CommandCenterItemPresenter.py | 12,13 | 6,20 | prepare_present | CommandCenterItemPresenter | 13,20 | 13,20 | class CommandCenterItemPresenter(BasePresenter):
default_attributes = [
'items',
'settings',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | class CommandCenterItemPresenter(BasePresenter):
default_attributes = [
'items',
'settings',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | items = self.resource.model.get('items') or []
settings = self.resource.model.get('settings')
return dict(
items=[i.to_dict() for i in items],
settings=settings.to_dict() if settings else None,
)
| items = self.resource.model.get('items') or []
settings = self.resource.model.get('settings')
return dict(
items=[i.to_dict() for i in items],
settings=settings.to_dict() if settings else None,
)
| 21 | 61 | 77 | 138 | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class CommandCenterItemPresenter(BasePresenter):
default_attributes = [
'items',
'settings',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class CommandCenterItemPresenter(BasePresenter):
default_attributes = [
'items',
'settings',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY |
20,392 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/ComputeClusterPresenter.py | 12,13 | 7,20 | prepare_present | ComputeClusterPresenter | 13,20 | 13,20 | class ComputeClusterPresenter(BasePresenter):
default_attributes = [
'cluster',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | class ComputeClusterPresenter(BasePresenter):
default_attributes = [
'cluster',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | data = self.resource.model
if 'cluster' in data:
cluster = data.get('cluster')
if isinstance(cluster, BaseDataClass):
data['cluster'] = cluster.to_dict()
return data
| data = self.resource.model
if 'cluster' in data:
cluster = data.get('cluster')
if isinstance(cluster, BaseDataClass):
data['cluster'] = cluster.to_dict()
return data
| 18 | 56 | 65 | 121 | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.shared.models import BaseDataClass
class ComputeClusterPresenter(BasePresenter):
default_attributes = [
'cluster',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.shared.models import BaseDataClass
class ComputeClusterPresenter(BasePresenter):
default_attributes = [
'cluster',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY |
20,393 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/ComputeConnectionPresenter.py | 25,26 | 6,27 | prepare_present | ComputeConnectionPresenter | 26,27 | 26,27 | class ComputeConnectionPresenter(BasePresenter):
default_attributes = [
'actions',
'attributes',
'connection',
'description',
'error',
'group',
'name',
'required',
'state',
'status',
'status_calculated',
'steps',
... | class ComputeConnectionPresenter(BasePresenter):
default_attributes = [
'actions',
'attributes',
'connection',
'description',
'error',
'group',
'name',
'required',
'state',
'status',
'status_calculated',
'steps',
... | return self.resource.model.to_dict()
| return self.resource.model.to_dict()
| 2 | 129 | 14 | 143 | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class ComputeConnectionPresenter(BasePresenter):
default_attributes = [
'actions',
'attributes',
'connection',
'description',
'error',
'group',
'name',
'required'... | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class ComputeConnectionPresenter(BasePresenter):
default_attributes = [
'actions',
'attributes',
'connection',
'description',
'error',
'group',
'name',
'required'... |
20,394 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/ComputeServicePresenter.py | 14,15 | 6,16 | prepare_present | ComputeServicePresenter | 15,16 | 15,16 | class ComputeServicePresenter(BasePresenter):
default_attributes = [
'connection_credentials',
'clusters',
'setup_steps',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | class ComputeServicePresenter(BasePresenter):
default_attributes = [
'connection_credentials',
'clusters',
'setup_steps',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | return self.resource.model.to_dict()
| return self.resource.model.to_dict()
| 2 | 78 | 14 | 92 | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class ComputeServicePresenter(BasePresenter):
default_attributes = [
'connection_credentials',
'clusters',
'setup_steps',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FI... | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class ComputeServicePresenter(BasePresenter):
default_attributes = [
'connection_credentials',
'clusters',
'setup_steps',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FI... |
20,395 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/ConfigurationOptionPresenter.py | 16,17 | 6,18 | prepare_present | ConfigurationOptionPresenter | 17,18 | 17,18 | class ConfigurationOptionPresenter(BasePresenter):
default_attributes = [
'configuration_type',
'metadata',
'option',
'option_type',
'resource_type',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | class ConfigurationOptionPresenter(BasePresenter):
default_attributes = [
'configuration_type',
'metadata',
'option',
'option_type',
'resource_type',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | return self.resource.model.to_dict()
| return self.resource.model.to_dict()
| 2 | 86 | 14 | 100 | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class ConfigurationOptionPresenter(BasePresenter):
default_attributes = [
'configuration_type',
'metadata',
'option',
'option_type',
'resource_type',
'uuid',
]
async def... | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
class ConfigurationOptionPresenter(BasePresenter):
default_attributes = [
'configuration_type',
'metadata',
'option',
'option_type',
'resource_type',
'uuid',
]
async def... |
20,396 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/CustomDesignPresenter.py | 15,16 | 7,19 | prepare_present | CustomDesignPresenter | 16,19 | 16,19 | class CustomDesignPresenter(BasePresenter):
default_attributes = [
'components',
'pages',
'project',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | class CustomDesignPresenter(BasePresenter):
default_attributes = [
'components',
'pages',
'project',
'uuid',
]
async def prepare_present(self, **kwargs) -> Dict:
FILL_FUNC_BODY | return merge_dict(self.resource.model.to_dict(), dict(
uuid=self.resource.model.uuid,
))
| return merge_dict(self.resource.model.to_dict(), dict(
uuid=self.resource.model.uuid,
))
| 5 | 70 | 39 | 109 | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.shared.hash import merge_dict
class CustomDesignPresenter(BasePresenter):
default_attributes = [
'components',
'pages',
'project',
'uuid',
]
async def prepare_present(self,... | from typing import Dict
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.shared.hash import merge_dict
class CustomDesignPresenter(BasePresenter):
default_attributes = [
'components',
'pages',
'project',
'uuid',
]
async def prepare_present(self,... |
20,397 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/CustomTemplatePresenter.py | 27,28 | 12,52 | present | CustomTemplatePresenter | 28,52 | 28,52 | class CustomTemplatePresenter(BasePresenter):
default_attributes = [
'block_type',
'color',
'configuration',
'description',
'language',
'name',
'pipeline',
'tags',
'template_uuid',
'user',
'uuid',
]
async def present(se... | class CustomTemplatePresenter(BasePresenter):
default_attributes = [
'block_type',
'color',
'configuration',
'description',
'language',
'name',
'pipeline',
'tags',
'template_uuid',
'user',
'uuid',
]
async def present(se... | data = self.resource.model.to_dict()
if isinstance(self.resource.model, CustomBlockTemplate):
if kwargs.get('format') in [constants.DETAIL, constants.UPDATE]:
data['content'] = self.resource.model.load_template_content()
elif isinstance(self.resource.model, CustomPip... | data = self.resource.model.to_dict()
if isinstance(self.resource.model, CustomBlockTemplate):
if kwargs.get('format') in [constants.DETAIL, constants.UPDATE]:
data['content'] = self.resource.model.load_template_content()
elif isinstance(self.resource.model, CustomPip... | 40 | 103 | 275 | 378 | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.data_preparation.models.constants import DATAFRAME_SAMPLE_COUNT_PREVIEW
from mage_ai.data_preparation.models.custom_templates.custom_block_template import (
CustomBlockTemplate,
)
from mage_ai.da... | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.data_preparation.models.constants import DATAFRAME_SAMPLE_COUNT_PREVIEW
from mage_ai.data_preparation.models.custom_templates.custom_block_template import (
CustomBlockTemplate,
)
from mage_ai.da... |
20,398 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/DownloadPresenter.py | 10,11 | 4,15 | present | DownloadPresenter | 11,15 | 11,15 | class DownloadPresenter(BasePresenter):
default_attributes = [
'token',
'uri',
]
def present(self, **kwargs):
FILL_FUNC_BODY | class DownloadPresenter(BasePresenter):
default_attributes = [
'token',
'uri',
]
def present(self, **kwargs):
FILL_FUNC_BODY | if type(self.model) is dict:
return self.model
return self.model.to_dict()
| if type(self.model) is dict:
return self.model
return self.model.to_dict()
| 8 | 51 | 34 | 85 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class DownloadPresenter(BasePresenter):
default_attributes = [
'token',
'uri',
]
def present(self, **kwargs):
FILL_FUNC_BODY | from mage_ai.api.presenters.BasePresenter import BasePresenter
class DownloadPresenter(BasePresenter):
default_attributes = [
'token',
'uri',
]
def present(self, **kwargs):
FILL_FUNC_BODY |
20,399 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/FileContentPresenter.py | 13,14 | 4,15 | prepare_present | FileContentPresenter | 14,15 | 14,15 | class FileContentPresenter(BasePresenter):
default_attributes = [
'content',
'modified_timestamp',
'name',
'path',
'size',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | class FileContentPresenter(BasePresenter):
default_attributes = [
'content',
'modified_timestamp',
'name',
'path',
'size',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | return await self.model.to_dict_async(include_content=True)
| return await self.model.to_dict_async(include_content=True)
| 3 | 73 | 21 | 94 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class FileContentPresenter(BasePresenter):
default_attributes = [
'content',
'modified_timestamp',
'name',
'path',
'size',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | from mage_ai.api.presenters.BasePresenter import BasePresenter
class FileContentPresenter(BasePresenter):
default_attributes = [
'content',
'modified_timestamp',
'name',
'path',
'size',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY |
20,400 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/FilePresenter.py | 15,16 | 4,20 | prepare_present | FilePresenter | 16,20 | 16,20 | class FilePresenter(BasePresenter):
default_attributes = [
'children',
'disabled',
'modified_timestamp',
'name',
'path',
'pipeline_count',
'size',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | class FilePresenter(BasePresenter):
default_attributes = [
'children',
'disabled',
'modified_timestamp',
'name',
'path',
'pipeline_count',
'size',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | if isinstance(self.model, dict):
return self.model
return self.model.to_dict()
| if isinstance(self.model, dict):
return self.model
return self.model.to_dict()
| 7 | 85 | 34 | 119 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class FilePresenter(BasePresenter):
default_attributes = [
'children',
'disabled',
'modified_timestamp',
'name',
'path',
'pipeline_count',
'size',
]
async def prepare_present(self, **kwa... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class FilePresenter(BasePresenter):
default_attributes = [
'children',
'disabled',
'modified_timestamp',
'name',
'path',
'pipeline_count',
'size',
]
async def prepare_present(self, **kwa... |
20,401 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/FileVersionPresenter.py | 12,13 | 4,14 | present | FileVersionPresenter | 13,14 | 13,14 | class FileVersionPresenter(BasePresenter):
default_attributes = [
'modified_timestamp',
'name',
'path',
'size',
]
def present(self, **kwargs):
FILL_FUNC_BODY | class FileVersionPresenter(BasePresenter):
default_attributes = [
'modified_timestamp',
'name',
'path',
'size',
]
def present(self, **kwargs):
FILL_FUNC_BODY | return self.model.to_dict()
| return self.model.to_dict()
| 2 | 65 | 12 | 77 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class FileVersionPresenter(BasePresenter):
default_attributes = [
'modified_timestamp',
'name',
'path',
'size',
]
def present(self, **kwargs):
FILL_FUNC_BODY | from mage_ai.api.presenters.BasePresenter import BasePresenter
class FileVersionPresenter(BasePresenter):
default_attributes = [
'modified_timestamp',
'name',
'path',
'size',
]
def present(self, **kwargs):
FILL_FUNC_BODY |
20,402 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/FolderPresenter.py | 11,12 | 5,13 | name | FolderPresenter | 12,13 | 12,13 | class FolderPresenter(BasePresenter):
default_attributes = [
'name',
'path',
]
def name(self, **kwargs) -> str:
FILL_FUNC_BODY | class FolderPresenter(BasePresenter):
default_attributes = [
'name',
'path',
]
def name(self, **kwargs) -> str:
FILL_FUNC_BODY | return os.path.basename(self.resource.path)
| return os.path.basename(self.resource.path)
| 2 | 56 | 17 | 73 | from mage_ai.api.presenters.BasePresenter import BasePresenter
import os
class FolderPresenter(BasePresenter):
default_attributes = [
'name',
'path',
]
def name(self, **kwargs) -> str:
FILL_FUNC_BODY | from mage_ai.api.presenters.BasePresenter import BasePresenter
import os
class FolderPresenter(BasePresenter):
default_attributes = [
'name',
'path',
]
def name(self, **kwargs) -> str:
FILL_FUNC_BODY |
20,403 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/GitBranchPresenter.py | 24,25 | 5,33 | present | GitBranchPresenter | 25,33 | 25,33 | class GitBranchPresenter(BasePresenter):
default_attributes = [
'action_payload',
'action_type',
'error',
'files',
'files_absolute_path',
'is_git_integration_enabled',
'message',
'modified_files',
'name',
'progress',
'remote',
... | class GitBranchPresenter(BasePresenter):
default_attributes = [
'action_payload',
'action_type',
'error',
'files',
'files_absolute_path',
'is_git_integration_enabled',
'message',
'modified_files',
'name',
'progress',
'remote',
... | if 'with_logs' == kwargs['format']:
return merge_dict(self.model, dict(logs=self.resource.logs(commits=12)))
elif 'with_remotes' == kwargs['format']:
return merge_dict(self.model, dict(remotes=self.resource.remotes(limit=100)))
return self.model
| if 'with_logs' == kwargs['format']:
return merge_dict(self.model, dict(logs=self.resource.logs(commits=12)))
elif 'with_remotes' == kwargs['format']:
return merge_dict(self.model, dict(remotes=self.resource.remotes(limit=100)))
return self.model
| 16 | 147 | 109 | 256 | from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.shared.hash import merge_dict
class GitBranchPresenter(BasePresenter):
default_attributes = [
'action_payload',
'action_type',
'error',
'files',
'files_absolute_path',
'is_git_integration_en... | from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.shared.hash import merge_dict
class GitBranchPresenter(BasePresenter):
default_attributes = [
'action_payload',
'action_type',
'error',
'files',
'files_absolute_path',
'is_git_integration_en... |
20,404 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/GlobalDataProductPresenter.py | 14,15 | 4,16 | present | GlobalDataProductPresenter | 15,16 | 15,16 | class GlobalDataProductPresenter(BasePresenter):
default_attributes = [
'object_type',
'object_uuid',
'outdated_after',
'outdated_starting_at',
'settings',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | class GlobalDataProductPresenter(BasePresenter):
default_attributes = [
'object_type',
'object_uuid',
'outdated_after',
'outdated_starting_at',
'settings',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | return self.model.to_dict(include_uuid=True)
| return self.model.to_dict(include_uuid=True)
| 2 | 86 | 18 | 104 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class GlobalDataProductPresenter(BasePresenter):
default_attributes = [
'object_type',
'object_uuid',
'outdated_after',
'outdated_starting_at',
'settings',
'uuid',
]
def present(self, **kwargs):... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class GlobalDataProductPresenter(BasePresenter):
default_attributes = [
'object_type',
'object_uuid',
'outdated_after',
'outdated_starting_at',
'settings',
'uuid',
]
def present(self, **kwargs):... |
20,405 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/GlobalHookPresenter.py | 50,51 | 9,59 | pipeline_details | GlobalHookPresenter | 51,59 | 51,59 | class GlobalHookPresenter(BasePresenter):
default_attributes = [
'conditions',
'metadata',
'operation_type',
'outputs',
'pipeline',
'predicate',
'resource_type',
'run_settings',
'stages',
'strategies',
'uuid',
]
async d... | class GlobalHookPresenter(BasePresenter):
default_attributes = [
'conditions',
'metadata',
'operation_type',
'outputs',
'pipeline',
'predicate',
'resource_type',
'run_settings',
'stages',
'strategies',
'uuid',
]
async d... | if self.resource.model.pipeline_settings and \
self.resource.model.pipeline_settings.get('uuid'):
pipeline = await self.resource.pipeline
pipeline_dict = await pipeline.to_dict_async()
return pipeline_dict
| if self.resource.model.pipeline_settings and \
self.resource.model.pipeline_settings.get('uuid'):
pipeline = await self.resource.pipeline
pipeline_dict = await pipeline.to_dict_async()
return pipeline_dict
| 15 | 362 | 76 | 438 | from typing import Dict
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.data_preparation.models.global_hooks.constants import RESOURCE_TYPES
from mage_ai.data_preparation.models.global_hooks.models import HookOperation
class Globa... | from typing import Dict
from mage_ai.api.operations.constants import OperationType
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.data_preparation.models.global_hooks.constants import RESOURCE_TYPES
from mage_ai.data_preparation.models.global_hooks.models import HookOperation
class Globa... |
20,406 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/IntegrationSourcePresenter.py | 22,23 | 10,96 | prepare_present | IntegrationSourcePresenter | 23,96 | 23,96 | class IntegrationSourcePresenter(BasePresenter):
default_attributes = [
'block',
'name',
'partition',
'pipeline_run',
'pipeline_schedule',
'streams',
'templates',
'uuid',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | class IntegrationSourcePresenter(BasePresenter):
default_attributes = [
'block',
'name',
'partition',
'pipeline_run',
'pipeline_schedule',
'streams',
'templates',
'uuid',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | display_format = kwargs['format']
if constants.UPDATE == display_format:
payload = (kwargs.get('payload') or {}).get('integration_source') or {}
catalog = None
data_integration_uuid = None
selected_streams = payload.get('streams')
block_uuid... | display_format = kwargs['format']
if constants.UPDATE == display_format:
payload = (kwargs.get('payload') or {}).get('integration_source') or {}
catalog = None
data_integration_uuid = None
selected_streams = payload.get('streams')
block_uuid... | 138 | 95 | 734 | 829 | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.data_preparation.models.block.data_integration.utils import (
discover,
get_selected_streams,
update_metadata_in_stream,
)
class IntegrationSourcePresenter(BasePresenter):
default_a... | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.data_preparation.models.block.data_integration.utils import (
discover,
get_selected_streams,
update_metadata_in_stream,
)
class IntegrationSourcePresenter(BasePresenter):
default_a... |
20,407 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/IntegrationSourceStreamPresenter.py | 11,12 | 5,28 | present | IntegrationSourceStreamPresenter | 12,28 | 12,28 | class IntegrationSourceStreamPresenter(BasePresenter):
default_attributes = [
'streams',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | class IntegrationSourceStreamPresenter(BasePresenter):
default_attributes = [
'streams',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | try:
streams = self.resource.model.discover_streams() or {}
except Exception as ex:
error = ApiError.RESOURCE_ERROR.copy()
error.update(
message='Error discovering streams',
errors=dict(
error=str(ex),
... | try:
streams = self.resource.model.discover_streams() or {}
except Exception as ex:
error = ApiError.RESOURCE_ERROR.copy()
error.update(
message='Error discovering streams',
errors=dict(
error=str(ex),
... | 31 | 55 | 155 | 210 | from mage_ai.api.errors import ApiError
from mage_ai.api.presenters.BasePresenter import BasePresenter
class IntegrationSourceStreamPresenter(BasePresenter):
default_attributes = [
'streams',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | from mage_ai.api.errors import ApiError
from mage_ai.api.presenters.BasePresenter import BasePresenter
class IntegrationSourceStreamPresenter(BasePresenter):
default_attributes = [
'streams',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY |
20,408 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/InteractionPresenter.py | 14,15 | 4,19 | present | InteractionPresenter | 15,19 | 15,19 | class InteractionPresenter(BasePresenter):
default_attributes = [
'content',
'inputs',
'language',
'layout',
'uuid',
'variables',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | class InteractionPresenter(BasePresenter):
default_attributes = [
'content',
'inputs',
'language',
'layout',
'uuid',
'variables',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | if isinstance(self.model, dict):
return self.model
return await self.model.to_dict(include_content=True)
| if isinstance(self.model, dict):
return self.model
return await self.model.to_dict(include_content=True)
| 8 | 75 | 41 | 116 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class InteractionPresenter(BasePresenter):
default_attributes = [
'content',
'inputs',
'language',
'layout',
'uuid',
'variables',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | from mage_ai.api.presenters.BasePresenter import BasePresenter
class InteractionPresenter(BasePresenter):
default_attributes = [
'content',
'inputs',
'language',
'layout',
'uuid',
'variables',
]
async def present(self, **kwargs):
FILL_FUNC_BODY |
20,409 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/KernelPresenter.py | 14,15 | 6,41 | present | KernelPresenter | 15,41 | 15,41 | class KernelPresenter(BasePresenter):
default_attributes = [
'alive',
'id',
'name',
'usage',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | class KernelPresenter(BasePresenter):
default_attributes = [
'alive',
'id',
'name',
'usage',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | kernel = self.resource.model
kernel_response = dict(
alive=kernel.is_alive(),
id=kernel.kernel_id,
name=kernel.kernel_name,
)
if kernel.is_alive() and kernel.has_kernel:
try:
client = kernel.client()
session... | kernel = self.resource.model
kernel_response = dict(
alive=kernel.is_alive(),
id=kernel.kernel_id,
name=kernel.kernel_name,
)
if kernel.is_alive() and kernel.has_kernel:
try:
client = kernel.client()
session... | 59 | 63 | 250 | 313 | from inspect import isawaitable
from mage_ai.api.presenters.BasePresenter import BasePresenter
class KernelPresenter(BasePresenter):
default_attributes = [
'alive',
'id',
'name',
'usage',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | from inspect import isawaitable
from mage_ai.api.presenters.BasePresenter import BasePresenter
class KernelPresenter(BasePresenter):
default_attributes = [
'alive',
'id',
'name',
'usage',
]
async def present(self, **kwargs):
FILL_FUNC_BODY |
20,410 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/PageBlockLayoutPresenter.py | 11,12 | 4,13 | present | PageBlockLayoutPresenter | 12,13 | 12,13 | class PageBlockLayoutPresenter(BasePresenter):
default_attributes = [
'blocks',
'layout',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | class PageBlockLayoutPresenter(BasePresenter):
default_attributes = [
'blocks',
'layout',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | return self.resource.model.to_dict()
| return self.resource.model.to_dict()
| 2 | 58 | 14 | 72 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class PageBlockLayoutPresenter(BasePresenter):
default_attributes = [
'blocks',
'layout',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | from mage_ai.api.presenters.BasePresenter import BasePresenter
class PageBlockLayoutPresenter(BasePresenter):
default_attributes = [
'blocks',
'layout',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY |
20,411 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/PermissionPresenter.py | 24,25 | 12,33 | entity_names | PermissionPresenter | 25,27 | 25,27 | class PermissionPresenter(BasePresenter):
default_attributes = [
'access',
'created_at',
'entity',
'entity_id',
'entity_name',
'entity_type',
'id',
'updated_at',
]
def entity_names(self, **kwargs) -> List[str]:
FILL_FUNC_BODY def entity_typ... | class PermissionPresenter(BasePresenter):
default_attributes = [
'access',
'created_at',
'entity',
'entity_id',
'entity_name',
'entity_type',
'id',
'updated_at',
]
def entity_names(self, **kwargs) -> List[str]:
FILL_FUNC_BODY def entity_typ... | return sorted([n for n in EntityName])
| return sorted([n for n in EntityName])
| 6 | 150 | 16 | 166 | from typing import List
from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.authentication.permissions.constants import (
BlockEntityType,
EntityName,
PipelineEntityType,
)
class PermissionPresenter(BasePresenter):
default_attribute... | from typing import List
from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.authentication.permissions.constants import (
BlockEntityType,
EntityName,
PipelineEntityType,
)
class PermissionPresenter(BasePresenter):
default_attribute... |
20,412 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/PipelineInteractionPresenter.py | 11,12 | 4,16 | present | PipelineInteractionPresenter | 12,16 | 12,16 | class PipelineInteractionPresenter(BasePresenter):
default_attributes = [
'blocks',
'layout',
'permissions',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | class PipelineInteractionPresenter(BasePresenter):
default_attributes = [
'blocks',
'layout',
'permissions',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | if isinstance(self.model, dict):
return self.model
return await self.model.to_dict()
| if isinstance(self.model, dict):
return self.model
return await self.model.to_dict()
| 8 | 61 | 35 | 96 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class PipelineInteractionPresenter(BasePresenter):
default_attributes = [
'blocks',
'layout',
'permissions',
]
async def present(self, **kwargs):
FILL_FUNC_BODY | from mage_ai.api.presenters.BasePresenter import BasePresenter
class PipelineInteractionPresenter(BasePresenter):
default_attributes = [
'blocks',
'layout',
'permissions',
]
async def present(self, **kwargs):
FILL_FUNC_BODY |
20,413 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/PipelinePresenter.py | 38,39 | 11,104 | present | PipelinePresenter | 39,104 | 39,104 | class PipelinePresenter(BasePresenter):
default_attributes = [
'blocks',
'cache_block_output_in_memory',
'concurrency_config',
'created_at',
'data_integration',
'description',
'executor_config',
'executor_count',
'executor_type',
'name'... | class PipelinePresenter(BasePresenter):
default_attributes = [
'blocks',
'cache_block_output_in_memory',
'concurrency_config',
'created_at',
'data_integration',
'description',
'executor_config',
'executor_count',
'executor_type',
'name'... | query = kwargs.get('query', {})
display_format = kwargs['format']
include_extensions = query.get('includes_extensions', [True])
if include_extensions:
include_extensions = include_extensions[0]
include_schedules = query.get('include_schedules', [False])
if i... | query = kwargs.get('query', {})
display_format = kwargs['format']
include_extensions = query.get('includes_extensions', [True])
if include_extensions:
include_extensions = include_extensions[0]
include_schedules = query.get('include_schedules', [False])
if i... | 128 | 213 | 778 | 991 | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.data_preparation.models.constants import (
DATAFRAME_SAMPLE_COUNT_PREVIEW,
PipelineType,
)
from mage_ai.data_preparation.models.project import Project
from mage_ai.data_preparation.models.pro... | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.data_preparation.models.constants import (
DATAFRAME_SAMPLE_COUNT_PREVIEW,
PipelineType,
)
from mage_ai.data_preparation.models.project import Project
from mage_ai.data_preparation.models.pro... |
20,414 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/PipelineRunPresenter.py | 24,25 | 5,86 | prepare_present | PipelineRunPresenter | 25,86 | 25,86 | class PipelineRunPresenter(BasePresenter):
default_attributes = [
'backfill_id',
'completed_at',
'created_at',
'event_variables',
'execution_date',
'executor_type',
'id',
'metrics',
'passed_sla',
'pipeline_schedule_id',
'pipelin... | class PipelineRunPresenter(BasePresenter):
default_attributes = [
'backfill_id',
'completed_at',
'created_at',
'event_variables',
'execution_date',
'executor_type',
'id',
'metrics',
'passed_sla',
'pipeline_schedule_id',
'pipelin... | display_format = kwargs.get('format')
data_to_display = self.model
if constants.LIST == display_format:
query = kwargs.get('query', {})
additional_attributes = [
'block_runs',
'block_runs_count',
'completed_block_runs_coun... | display_format = kwargs.get('format')
data_to_display = self.model
if constants.LIST == display_format:
query = kwargs.get('query', {})
additional_attributes = [
'block_runs',
'block_runs_count',
'completed_block_runs_coun... | 117 | 156 | 670 | 826 | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
class PipelineRunPresenter(BasePresenter):
default_attributes = [
'backfill_id',
'completed_at',
'created_at',
'event_variables',
'execution_date',
'executor_... | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
class PipelineRunPresenter(BasePresenter):
default_attributes = [
'backfill_id',
'completed_at',
'created_at',
'event_variables',
'execution_date',
'executor_... |
20,415 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/PipelineSchedulePresenter.py | 26,27 | 5,53 | prepare_present | PipelineSchedulePresenter | 27,53 | 27,53 | class PipelineSchedulePresenter(BasePresenter):
default_attributes = [
'created_at',
'description',
'global_data_product_uuid',
'id',
'last_enabled_at',
'name',
'pipeline_uuid',
'repo_path',
'schedule_interval',
'schedule_type',
... | class PipelineSchedulePresenter(BasePresenter):
default_attributes = [
'created_at',
'description',
'global_data_product_uuid',
'id',
'last_enabled_at',
'name',
'pipeline_uuid',
'repo_path',
'schedule_interval',
'schedule_type',
... | display_format = kwargs['format']
if display_format in [constants.DETAIL, constants.UPDATE]:
data = self.model.to_dict(include_attributes=[
'event_matchers',
])
data['tags'] = sorted([tag.name for tag in self.get_tag_associations])
data['n... | display_format = kwargs['format']
if display_format in [constants.DETAIL, constants.UPDATE]:
data = self.model.to_dict(include_attributes=[
'event_matchers',
])
data['tags'] = sorted([tag.name for tag in self.get_tag_associations])
data['n... | 64 | 161 | 325 | 486 | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
class PipelineSchedulePresenter(BasePresenter):
default_attributes = [
'created_at',
'description',
'global_data_product_uuid',
'id',
'last_enabled_at',
'name... | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
class PipelineSchedulePresenter(BasePresenter):
default_attributes = [
'created_at',
'description',
'global_data_product_uuid',
'id',
'last_enabled_at',
'name... |
20,416 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/PipelineTriggerPresenter.py | 18,19 | 4,20 | prepare_present | PipelineTriggerPresenter | 19,20 | 19,20 | class PipelineTriggerPresenter(BasePresenter):
default_attributes = [
'envs',
'name',
'pipeline_uuid',
'schedule_interval',
'schedule_type',
'settings',
'sla',
'start_time',
'status',
'variables',
]
async def prepare_present(se... | class PipelineTriggerPresenter(BasePresenter):
default_attributes = [
'envs',
'name',
'pipeline_uuid',
'schedule_interval',
'schedule_type',
'settings',
'sla',
'start_time',
'status',
'variables',
]
async def prepare_present(se... | return self.resource.model.to_dict()
| return self.resource.model.to_dict()
| 2 | 111 | 14 | 125 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class PipelineTriggerPresenter(BasePresenter):
default_attributes = [
'envs',
'name',
'pipeline_uuid',
'schedule_interval',
'schedule_type',
'settings',
'sla',
'start_time',
'stat... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class PipelineTriggerPresenter(BasePresenter):
default_attributes = [
'envs',
'name',
'pipeline_uuid',
'schedule_interval',
'schedule_type',
'settings',
'sla',
'start_time',
'stat... |
20,417 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/SearchResultPresenter.py | 20,21 | 13,74 | present | SearchResultPresenter | 21,74 | 21,74 | class SearchResultPresenter(BasePresenter):
default_attributes = [
'results',
'type',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | class SearchResultPresenter(BasePresenter):
default_attributes = [
'results',
'type',
'uuid',
]
def present(self, **kwargs):
FILL_FUNC_BODY | display_format = kwargs['format']
if constants.CREATE != display_format:
return self.model
results = self.model.get('results', [])
search_type = self.model.get('type')
results_transformed = []
if SEARCH_TYPE_BLOCK_ACTION_OBJECTS == search_type:
... | display_format = kwargs['format']
if constants.CREATE != display_format:
return self.model
results = self.model.get('results', [])
search_type = self.model.get('type')
results_transformed = []
if SEARCH_TYPE_BLOCK_ACTION_OBJECTS == search_type:
... | 144 | 57 | 651 | 708 | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.cache.block_action_object.constants import (
OBJECT_TYPE_BLOCK_FILE,
OBJECT_TYPE_CUSTOM_BLOCK_TEMPLATE,
OBJECT_TYPE_MAGE_TEMPLATE,
)
from mage_ai.services.search.constants import SEARCH_T... | from mage_ai.api.operations import constants
from mage_ai.api.presenters.BasePresenter import BasePresenter
from mage_ai.cache.block_action_object.constants import (
OBJECT_TYPE_BLOCK_FILE,
OBJECT_TYPE_CUSTOM_BLOCK_TEMPLATE,
OBJECT_TYPE_MAGE_TEMPLATE,
)
from mage_ai.services.search.constants import SEARCH_T... |
20,418 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/SparkApplicationPresenter.py | 14,15 | 4,16 | prepare_present | SparkApplicationPresenter | 15,16 | 15,16 | class SparkApplicationPresenter(BasePresenter):
default_attributes = [
'attempts',
'attempts_count',
'calculated_id',
'id',
'name',
'spark_ui_url',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | class SparkApplicationPresenter(BasePresenter):
default_attributes = [
'attempts',
'attempts_count',
'calculated_id',
'id',
'name',
'spark_ui_url',
]
async def prepare_present(self, **kwargs):
FILL_FUNC_BODY | return self.model.to_dict()
| return self.model.to_dict()
| 2 | 90 | 12 | 102 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkApplicationPresenter(BasePresenter):
default_attributes = [
'attempts',
'attempts_count',
'calculated_id',
'id',
'name',
'spark_ui_url',
]
async def prepare_present(self, **kwargs):
F... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkApplicationPresenter(BasePresenter):
default_attributes = [
'attempts',
'attempts_count',
'calculated_id',
'id',
'name',
'spark_ui_url',
]
async def prepare_present(self, **kwargs):
F... |
20,419 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/SparkEnvironmentPresenter.py | 15,16 | 4,17 | prepare_present | SparkEnvironmentPresenter | 16,17 | 16,17 | class SparkEnvironmentPresenter(BasePresenter):
default_attributes = [
'classpath_entries',
'hadoop_properties',
'metrics_properties',
'resource_profiles',
'runtime',
'spark_properties',
'system_properties',
]
async def prepare_present(self, **kwargs)... | class SparkEnvironmentPresenter(BasePresenter):
default_attributes = [
'classpath_entries',
'hadoop_properties',
'metrics_properties',
'resource_profiles',
'runtime',
'spark_properties',
'system_properties',
]
async def prepare_present(self, **kwargs)... | return self.model.to_dict()
| return self.model.to_dict()
| 2 | 98 | 12 | 110 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkEnvironmentPresenter(BasePresenter):
default_attributes = [
'classpath_entries',
'hadoop_properties',
'metrics_properties',
'resource_profiles',
'runtime',
'spark_properties',
'system_... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkEnvironmentPresenter(BasePresenter):
default_attributes = [
'classpath_entries',
'hadoop_properties',
'metrics_properties',
'resource_profiles',
'runtime',
'spark_properties',
'system_... |
20,420 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/SparkExecutorPresenter.py | 37,38 | 4,39 | prepare_present | SparkExecutorPresenter | 38,39 | 38,39 | class SparkExecutorPresenter(BasePresenter):
default_attributes = [
'active_tasks',
'add_time',
'attributes',
'blacklisted_in_stages',
'completed_tasks',
'disk_used',
'excluded_in_stages',
'executor_logs',
'failed_tasks',
'host_port',
... | class SparkExecutorPresenter(BasePresenter):
default_attributes = [
'active_tasks',
'add_time',
'attributes',
'blacklisted_in_stages',
'completed_tasks',
'disk_used',
'excluded_in_stages',
'executor_logs',
'failed_tasks',
'host_port',
... | return self.model.to_dict()
| return self.model.to_dict()
| 2 | 280 | 12 | 292 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkExecutorPresenter(BasePresenter):
default_attributes = [
'active_tasks',
'add_time',
'attributes',
'blacklisted_in_stages',
'completed_tasks',
'disk_used',
'excluded_in_stages',
... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkExecutorPresenter(BasePresenter):
default_attributes = [
'active_tasks',
'add_time',
'attributes',
'blacklisted_in_stages',
'completed_tasks',
'disk_used',
'excluded_in_stages',
... |
20,421 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/SparkJobPresenter.py | 28,29 | 4,30 | prepare_present | SparkJobPresenter | 29,30 | 29,30 | class SparkJobPresenter(BasePresenter):
default_attributes = [
'application',
'completion_time',
'job_id',
'job_tags',
'killed_tasks_summary',
'name',
'num_active_stages',
'num_active_tasks',
'num_completed_indices',
'num_completed_stag... | class SparkJobPresenter(BasePresenter):
default_attributes = [
'application',
'completion_time',
'job_id',
'job_tags',
'killed_tasks_summary',
'name',
'num_active_stages',
'num_active_tasks',
'num_completed_indices',
'num_completed_stag... | return self.model.to_dict()
| return self.model.to_dict()
| 2 | 223 | 12 | 235 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkJobPresenter(BasePresenter):
default_attributes = [
'application',
'completion_time',
'job_id',
'job_tags',
'killed_tasks_summary',
'name',
'num_active_stages',
'num_active_tas... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkJobPresenter(BasePresenter):
default_attributes = [
'application',
'completion_time',
'job_id',
'job_tags',
'killed_tasks_summary',
'name',
'num_active_stages',
'num_active_tas... |
20,422 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/SparkSqlPresenter.py | 20,21 | 4,24 | prepare_present | SparkSqlPresenter | 21,24 | 21,24 | class SparkSqlPresenter(BasePresenter):
default_attributes = [
'application',
'description',
'duration',
'edges',
'failed_job_ids',
'id',
'nodes',
'plan_description',
'running_job_ids',
'status',
'submission_time',
'succ... | class SparkSqlPresenter(BasePresenter):
default_attributes = [
'application',
'description',
'duration',
'edges',
'failed_job_ids',
'id',
'nodes',
'plan_description',
'running_job_ids',
'status',
'submission_time',
'succ... | return self.model.to_dict()
| return self.model.to_dict()
| 2 | 124 | 16 | 140 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkSqlPresenter(BasePresenter):
default_attributes = [
'application',
'description',
'duration',
'edges',
'failed_job_ids',
'id',
'nodes',
'plan_description',
'running_job... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkSqlPresenter(BasePresenter):
default_attributes = [
'application',
'description',
'duration',
'edges',
'failed_job_ids',
'id',
'nodes',
'plan_description',
'running_job... |
20,423 | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai | /home/hieuvd/dung_repo/raw/stars_01/mage-ai_mage-ai/mage-ai/mage_ai/api/presenters/SparkStageAttemptPresenter.py | 68,69 | 4,70 | prepare_present | SparkStageAttemptPresenter | 69,70 | 69,70 | class SparkStageAttemptPresenter(BasePresenter):
default_attributes = [
'accumulator_updates',
'application',
'attempt_id',
'completion_time',
'details',
'disk_bytes_spilled',
'executor_cpu_time',
'executor_deserialize_cpu_time',
'executor_dese... | class SparkStageAttemptPresenter(BasePresenter):
default_attributes = [
'accumulator_updates',
'application',
'attempt_id',
'completion_time',
'details',
'disk_bytes_spilled',
'executor_cpu_time',
'executor_deserialize_cpu_time',
'executor_dese... | return self.model.to_dict()
| return self.model.to_dict()
| 2 | 693 | 12 | 705 | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkStageAttemptPresenter(BasePresenter):
default_attributes = [
'accumulator_updates',
'application',
'attempt_id',
'completion_time',
'details',
'disk_bytes_spilled',
'executor_cpu_time'... | from mage_ai.api.presenters.BasePresenter import BasePresenter
class SparkStageAttemptPresenter(BasePresenter):
default_attributes = [
'accumulator_updates',
'application',
'attempt_id',
'completion_time',
'details',
'disk_bytes_spilled',
'executor_cpu_time'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.