id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
142,682
from typing import ( Any, Dict, List, Optional, Tuple, ) from databuilder.models.atlas_entity import AtlasEntity from databuilder.models.atlas_relationship import AtlasRelationship from databuilder.utils.atlas import AtlasSerializedEntityFields, AtlasSerializedRelationshipFields def get_entity_attrs(attrs_mapping:...
null
142,683
from typing import ( Any, Dict, List, Optional, Tuple, ) from databuilder.models.atlas_entity import AtlasEntity from databuilder.models.atlas_relationship import AtlasRelationship from databuilder.utils.atlas import AtlasSerializedEntityFields, AtlasSerializedRelationshipFields The provided code snippet includes ...
relationship in form 'relation_attribute#relation_entity_type#qualified_name_of_related_object
142,684
from typing import ( Any, Dict, List, Optional, Tuple, ) from databuilder.models.atlas_entity import AtlasEntity from databuilder.models.atlas_relationship import AtlasRelationship from databuilder.utils.atlas import AtlasSerializedEntityFields, AtlasSerializedRelationshipFields def get_entity_relationships(relati...
null
142,685
from typing import ( Any, Dict, Optional, ) from amundsen_rds.models import RDSModel def serialize_record(record: Optional[RDSModel]) -> Dict[str, Any]: if record is None: return {} record_dict = {key: value for key, value in vars(record).items() if key in record.__table__.columns.keys()} ret...
null
142,686
from typing import ( Any, Dict, Optional, ) from databuilder.models.graph_node import GraphNode from databuilder.models.graph_relationship import GraphRelationship from databuilder.models.graph_serializable import ( NODE_KEY, NODE_LABEL, RELATION_END_KEY, RELATION_END_LABEL, RELATION_REVERSE_TYPE, RELATION_STAR...
null
142,687
from typing import ( Any, Dict, Optional, ) from databuilder.models.graph_node import GraphNode from databuilder.models.graph_relationship import GraphRelationship from databuilder.models.graph_serializable import ( NODE_KEY, NODE_LABEL, RELATION_END_KEY, RELATION_END_LABEL, RELATION_REVERSE_TYPE, RELATION_STAR...
null
142,688
from datetime import datetime from typing import ( Any, Dict, List, Optional, ) from databuilder.models.graph_node import GraphNode from databuilder.models.graph_relationship import GraphRelationship NEPTUNE_HEADER_ID = "~id" NEPTUNE_HEADER_LABEL = "~label" NEPTUNE_RELATIONSHIP_HEADER_FROM = "~from" NEPTUNE_RELATIO...
null
142,689
from datetime import datetime from typing import ( Any, Dict, List, Optional, ) from databuilder.models.graph_node import GraphNode from databuilder.models.graph_relationship import GraphRelationship NEPTUNE_HEADER_ID = "~id" NEPTUNE_HEADER_LABEL = "~label" METADATA_KEY_PROPERTY_NAME_BULK_LOADER_FORMAT = '{name}:St...
null
142,690
import csv import importlib from collections import defaultdict from typing import Any, List from pyhocon import ConfigTree from databuilder.extractor.base_extractor import Extractor from databuilder.models.badge import Badge, BadgeMetadata from databuilder.models.table_lineage import ColumnLineage, TableLineage from d...
Splits a string of badges into a list, removing all empty badges.
142,691
import importlib from typing import Any from pyhocon import ConfigFactory, ConfigTree from sqlalchemy import create_engine, text from databuilder import Scoped from databuilder.extractor.base_extractor import Extractor class SQLAlchemyExtractor(Extractor): # Config keys CONN_STRING = 'conn_string' EXTRACT_S...
A factory to create SQLAlchemyExtractors that are wrapped by another, specialized extractor. This function pulls the config from the wrapping extractor's config, and returns a newly configured SQLAlchemyExtractor. :param conf: A config tree from which the sqlalchemy config still needs to be taken. :param conf: The SQL ...
142,692
import logging import time from datetime import datetime from functools import wraps from multiprocessing.pool import ThreadPool from typing import ( Any, Iterator, List, Union, ) from pyhocon import ConfigFactory, ConfigTree from pytz import UTC from databuilder import Scoped from databuilder.extractor.base_extrac...
A Decorator that handles error from FileSystem for HiveTableLastUpdatedExtractor use case If it's client side error, it logs in INFO level, and other errors is logged as error level with stacktrace. The decorator is intentionally not re-raising exception so that it can isolate the error. :param f: :return:
142,693
import importlib import logging from typing import ( Any, Callable, Dict, Iterator, List, Optional, ) from amundsen_rds.models.badge import Badge from amundsen_rds.models.cluster import Cluster from amundsen_rds.models.column import ColumnDescription, TableColumn from amundsen_rds.models.dashboard import ( Dash...
Query table metadata. :param session: :param published_tag: :param limit: :return:
142,694
import importlib import logging from typing import ( Any, Callable, Dict, Iterator, List, Optional, ) from amundsen_rds.models.badge import Badge from amundsen_rds.models.cluster import Cluster from amundsen_rds.models.column import ColumnDescription, TableColumn from amundsen_rds.models.dashboard import ( Dash...
Query dashboard metadata. :param session: :param published_tag: :param limit: :return:
142,695
import importlib import logging from typing import ( Any, Callable, Dict, Iterator, List, Optional, ) from amundsen_rds.models.badge import Badge from amundsen_rds.models.cluster import Cluster from amundsen_rds.models.column import ColumnDescription, TableColumn from amundsen_rds.models.dashboard import ( Dash...
Query user metadata. :param session: :param published_tag: :param limit: :return:
142,696
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery The provided code snippet includes necessary dependencies for implementing the `sort_widgets` function. Write a Python function `def sort_widgets(widgets: Iterable[Dict[str, Any]]) -> List[Dict[str...
Sort raw widget data (as returned from the API) according to the position of the widgets in the dashboard (top to bottom, left to right) Redash does not return widgets in order of their position, so we do this to ensure that we look at widgets in a sensible order.
142,697
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery class RedashTextWidget: """ A textbox in a Redash dashboad. It pretty much just contains a single text property (Markdown). """ def __init__(self, data: Dict[str, Any]) -> None: ...
From the raw set of widget data returned from the API, filter down to text widgets and return them as a list of `RedashTextWidget`
142,698
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery class RedashVisualizationWidget: """ A visualization widget in a Redash dashboard. These are mapped 1:1 with queries, and can be of various types, e.g.: CHART, TABLE, PIVOT, etc. ...
From the raw set of widget data returned from the API, filter down to visualization widgets and return them as a list of `RedashVisualizationWidget`
142,699
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery def get_auth_headers(api_key: str) -> Dict[str, str]: return {'Authorization': f'Key {api_key}'}
null
142,700
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery class RedashVisualizationWidget: """ A visualization widget in a Redash dashboard. These are mapped 1:1 with queries, and can be of various types, e.g.: CHART, TABLE, PIVOT, etc. ...
Redash doesn't have dashboard descriptions, so we'll make our own. If there exist any text widgets, concatenate them, and use this text as the description for this dashboard. If not, put together a list of query names. If all else fails, this looks like an empty dashboard.
142,701
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery The provided code snippet includes necessary dependencies for implementing the `sort_widgets` function. Write a Python function `def sort_widgets(widgets: Iterable[Dict[str, Any]]) -> List[Dict[str...
Sort raw widget data (as returned from the API) according to the position of the widgets in the dashboard (top to bottom, left to right) Redash does not return widgets in order of their position, so we do this to ensure that we look at widgets in a sensible order.
142,702
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery class DatabricksSQLTextWidget: """ A textbox in a Databricks SQL dashboard. It pretty much just contains a single text property (Markdown). """ def __init__(self, data: Dict[str,...
From the raw set of widget data returned from the API, filter down to text widgets and return them as a list of `RedashTextWidget`
142,703
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery class DatabricksSQLVisualizationWidget: """ A visualization widget in a Databricks SQL dashboard. These are mapped 1:1 with queries, and can be of various types, e.g.: CHART, TABLE, ...
From the raw set of widget data returned from the API, filter down to visualization widgets and return them as a list of `RedashVisualizationWidget`
142,704
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery def get_auth_headers(api_key: str) -> Dict[str, str]: return {"Authorization": f"Bearer {api_key}"}
null
142,705
from typing import ( Any, Dict, Iterable, List, Tuple, ) from databuilder.rest_api.rest_api_query import RestApiQuery class DatabricksSQLVisualizationWidget: """ A visualization widget in a Databricks SQL dashboard. These are mapped 1:1 with queries, and can be of various types, e.g.: CHART, TABLE, ...
Redash doesn't have dashboard descriptions, so we'll make our own. If there exist any text widgets, concatenate them, and use this text as the description for this dashboard. If not, put together a list of query names. If all else fails, this looks like an empty dashboard.
142,706
import importlib from typing import ( Any, Dict, List, Optional, ) from gremlin_python.process.graph_traversal import GraphTraversalSource, __ from gremlin_python.process.traversal import ( Order, T, TextP, ) from pyhocon import ConfigTree from databuilder import Scoped from databuilder.clients.neptune_client i...
null
142,707
import importlib from typing import ( Any, Dict, List, Optional, ) from gremlin_python.process.graph_traversal import GraphTraversalSource, __ from gremlin_python.process.traversal import ( Order, T, TextP, ) from pyhocon import ConfigTree from databuilder import Scoped from databuilder.clients.neptune_client i...
null
142,708
import importlib from typing import ( Any, Dict, List, Optional, ) from gremlin_python.process.graph_traversal import GraphTraversalSource, __ from gremlin_python.process.traversal import ( Order, T, TextP, ) from pyhocon import ConfigTree from databuilder import Scoped from databuilder.clients.neptune_client i...
null
142,709
import logging from typing import Any, Optional from pyhocon import ConfigTree from databuilder.loader.base_loader import Loader LOGGER = logging.getLogger(__name__) The provided code snippet includes necessary dependencies for implementing the `log_call_back` function. Write a Python function `def log_call_back(recor...
A Sample callback function. Implement any function follows this function's signature to fit your needs. :param record: :return:
142,710
import logging from typing import List from pyhocon import ConfigFactory, ConfigTree from retrying import retry from databuilder import Scoped from databuilder.filesystem.metadata import FileMetadata def is_client_side_error(e: Exception) -> bool: """ An method that determines if the error is client side error ...
An method that determines if the error is retriable error within FileSystem context :param e: :return:
142,711
import pkg_resources def get_schema(schema: str) -> str: return pkg_resources.resource_string(__name__, schema).decode('utf-8')
null
142,712
import copy from typing import ( TYPE_CHECKING, Any, Dict, Iterable, Iterator, List, Optional, Set, Union, ) from amundsen_common.utils.atlas import ( AtlasCommonParams, AtlasCommonTypes, AtlasTableTypes, ) from amundsen_rds.models import RDSModel from amundsen_rds.models.cluster import Cluster as RDSCluster fr...
null
142,713
import logging from os import listdir from os.path import isfile, join from typing import ( Iterator, List, Set, ) import pandas from jinja2 import Template from neo4j import Neo4jDriver, Transaction from neo4j.exceptions import Neo4jError from pyhocon import ConfigTree from databuilder.models.graph_serializable im...
Generator to evenly split the input list into chunks
142,714
import logging from os import listdir from os.path import isfile, join from typing import ( Iterator, List, Set, ) import pandas from jinja2 import Template from neo4j import Neo4jDriver, Transaction from neo4j.exceptions import Neo4jError from pyhocon import ConfigTree from databuilder.models.graph_serializable im...
Go over the node file and try creating unique indices. For any label seen first time for this publisher it will try to create unique index. Neo4j ignores a second creation in 3.x, but raises an error in 4.x.
142,715
import logging from os import listdir from os.path import isfile, join from typing import ( Iterator, List, Set, ) import pandas from jinja2 import Template from neo4j import Neo4jDriver, Transaction from neo4j.exceptions import Neo4jError from pyhocon import ConfigTree from databuilder.models.graph_serializable im...
Create a dict of all the params for a given record
142,716
import logging from os import listdir from os.path import isfile, join from typing import ( Iterator, List, Set, ) import pandas from jinja2 import Template from neo4j import Neo4jDriver, Transaction from neo4j.exceptions import Neo4jError from pyhocon import ConfigTree from databuilder.models.graph_serializable im...
Returns the set of keys to be used in the props body of the merge statements :param record_keys: :param exclude_keys: set of excluded columns that do not need to be in properties (e.g: KEY, LABEL ...) :param additional_publisher_metadata_fields:
142,717
import logging from os import listdir from os.path import isfile, join from typing import ( Iterator, List, Set, ) import pandas from jinja2 import Template from neo4j import Neo4jDriver, Transaction from neo4j.exceptions import Neo4jError from pyhocon import ConfigTree from databuilder.models.graph_serializable im...
List files from directory :param conf: :param path_key: :return: List of file paths
142,718
from typing import Union from pyparsing import ( Forward, Group, Keyword, OneOrMore, Optional, Word, alphanums, delimitedList, nestedExpr, nums, originalTextFor, ) from databuilder.models.table_metadata import ColumnMetadata from databuilder.models.type_metadata import ( ArrayTypeMetadata, MapTypeMetadata, Scal...
null
142,719
from typing import Union from pyparsing import ( Forward, Group, Keyword, OneOrMore, Optional, Word, alphanums, delimitedList, nestedExpr, nums, originalTextFor, ) from databuilder.models.table_metadata import ColumnMetadata from databuilder.models.type_metadata import ( ArrayTypeMetadata, MapTypeMetadata, Scal...
null
142,720
from enum import Enum, auto class ResourceType(Enum): Table = auto() Dashboard = auto() User = auto() Column = auto() Type_Metadata = auto() Feature = auto() def to_resource_type(*, label: str) -> ResourceType: return ResourceType[label.title()]
null
142,721
import logging import sys from typing import Callable, List, Any from pkg_resources import iter_entry_points from amundsen_common.log.action_log_model import ActionLogParams LOGGER = logging.getLogger(__name__) class ActionLogParams(object): """ Holds parameters for Action log """ def __init__( ...
An action logger callback that just logs the ActionLogParams that it receives. :param **kwargs keyword arguments :return: None
142,722
import logging import sys from typing import Callable, List, Any from pkg_resources import iter_entry_points from amundsen_common.log.action_log_model import ActionLogParams def register_pre_exec_callback(action_log_callback: Callable[..., Any]) -> None: """ Registers more action_logger function callback for pr...
Retrieve declared action log callbacks from entry point where there are two groups that can be registered: 1. "action_log.post_exec.plugin": callback for pre-execution 2. "action_log.pre_exec.plugin": callback for post-execution :return: None
142,723
import functools import json import logging import socket from datetime import datetime, timezone, timedelta from typing import Any, Dict, Callable from flask import current_app as flask_app from amundsen_common.log import action_log_callback from amundsen_common.log.action_log_model import ActionLogParams LOGGER = log...
Decorates function to execute function at the same time triggering action logger callbacks. It will call action logger callbacks twice, one for pre-execution and the other one for post-execution. Action logger will be called with ActionLogParams :param f: function instance :return: wrapped function
142,724
from typing import List, Optional import attr from amundsen_common.models.user import User from amundsen_common.models.badge import Badge from amundsen_common.models.tag import Tag from marshmallow3_annotations.ext.attrs import AttrsSchema def default_if_none(arg: Optional[bool]) -> bool: return arg or False
null
142,749
import logging from enum import Enum from typing import ( Any, Dict, List, ) from amundsen_common.models.search import SearchResponse from elasticsearch_dsl.response import Response from elasticsearch_dsl.response.hit import Hit from elasticsearch_dsl.utils import AttrDict, AttrList class Resource(Enum): TABLE ...
null
142,758
import logging import json from http import HTTPStatus from typing import Any, Dict, Optional from flask import Response, jsonify, make_response, request from flask import current_app as app from flask.blueprints import Blueprint from amundsen_common.entity.resource_type import ResourceType, to_label from amundsen_comm...
null
142,760
import logging import json from http import HTTPStatus from typing import Any, Dict, Optional from flask import Response, jsonify, make_response, request from flask import current_app as app from flask.blueprints import Blueprint from amundsen_common.entity.resource_type import ResourceType, to_label from amundsen_comm...
null
142,761
import logging import json from http import HTTPStatus from typing import Any, Dict, Optional from flask import Response, jsonify, make_response, request from flask import current_app as app from flask.blueprints import Blueprint from amundsen_common.entity.resource_type import ResourceType, to_label from amundsen_comm...
null
142,766
import logging import json from http import HTTPStatus from typing import Any, Dict, Optional from flask import Response, jsonify, make_response, request from flask import current_app as app from flask.blueprints import Blueprint from amundsen_common.entity.resource_type import ResourceType, to_label from amundsen_comm...
null
142,777
import logging import json from http import HTTPStatus from typing import Any, Dict, Optional from flask import Response, jsonify, make_response, request from flask import current_app as app from flask.blueprints import Blueprint from amundsen_common.entity.resource_type import ResourceType, to_label from amundsen_comm...
null
142,780
import logging import json from http import HTTPStatus from typing import Any, Dict, Optional from flask import Response, jsonify, make_response, request from flask import current_app as app from flask.blueprints import Blueprint from amundsen_common.entity.resource_type import ResourceType, to_label from amundsen_comm...
null
142,781
import logging import json from http import HTTPStatus from typing import Any, Dict, Optional from flask import Response, jsonify, make_response, request from flask import current_app as app from flask.blueprints import Blueprint from amundsen_common.entity.resource_type import ResourceType, to_label from amundsen_comm...
null
142,788
import logging from http import HTTPStatus from flask import Response, jsonify, make_response from flask import current_app as app from flask.blueprints import Blueprint from amundsen_application.api.metadata.v0 import USER_ENDPOINT from amundsen_application.api.utils.request_utils import request_metadata from amundsen...
null
142,799
import logging from typing import Dict, List from http import HTTPStatus from flask import current_app as app from amundsen_application.api.utils.request_utils import request_search from amundsen_common.models.search import Filter, SearchRequest from amundsen_application.models.user import dump_user, load_user LOGGER ...
null
142,800
import logging from typing import Dict, List from http import HTTPStatus from flask import current_app as app from amundsen_application.api.utils.request_utils import request_search from amundsen_common.models.search import Filter, SearchRequest from amundsen_application.models.user import dump_user, load_user class ...
null
142,801
from typing import Dict import requests from flask import current_app as app def get_query_param(args: Dict, param: str, error_msg: str = None) -> str: value = args.get(param) if value is None: msg = 'A {0} parameter must be provided'.format(param) if error_msg is None else error_msg raise Exce...
null
142,802
from typing import Dict import requests from flask import current_app as app def request_wrapper(method: str, url: str, client, headers, timeout_sec: int, data=None, json=None): # type: ignore """ Wraps a request to use Envoy client and headers, if available :param method: DELETE | GET | POST | PUT :pa...
Helper function to make a request to metadata service. Sets the client and header information based on the configuration :param headers: Optional headers for the request, e.g. specifying Content-Type :param method: DELETE | GET | POST | PUT :param url: The request URL :param timeout_sec: Number of seconds before timeou...
142,803
from typing import Dict import requests from flask import current_app as app def request_wrapper(method: str, url: str, client, headers, timeout_sec: int, data=None, json=None): # type: ignore """ Wraps a request to use Envoy client and headers, if available :param method: DELETE | GET | POST | PUT :pa...
Helper function to make a request to search service. Sets the client and header information based on the configuration :param headers: Optional headers for the request, e.g. specifying Content-Type :param method: DELETE | GET | POST | PUT :param url: The request URL :param timeout_sec: Number of seconds before timeout ...
142,804
import logging from http import HTTPStatus from enum import Enum from flask import current_app as app from flask import jsonify, make_response, Response from typing import Dict, List from amundsen_application.api.exceptions import MailClientNotImplemented from amundsen_application.log.action_log import action_logging d...
Sends a notification via email to a given list of recipients :param notification_type: type of notification :param options: data necessary to render email template content :param recipients: list of recipients who should receive notification :param sender: email of notification sender :return: Response
142,806
import logging from dataclasses import dataclass from marshmallow import EXCLUDE from typing import Any, Dict, List, Optional from amundsen_common.models.dashboard import DashboardSummary, DashboardSummarySchema from amundsen_common.models.feature import Feature, FeatureSchema from amundsen_common.models.popular_table ...
Forms the full version of a table Dict, with additional and sanitized fields :param table_dict: Table Dict from metadata service :return: Table Dict with sanitized fields
142,807
import logging from dataclasses import dataclass from marshmallow import EXCLUDE from typing import Any, Dict, List, Optional from amundsen_common.models.dashboard import DashboardSummary, DashboardSummarySchema from amundsen_common.models.feature import Feature, FeatureSchema from amundsen_common.models.popular_table ...
Forms a short version of dashboard metadata, with selected fields and an added 'key' and 'type' :param dashboard_dict: Dict of partial dashboard metadata :return: partial dashboard Dict
142,808
import logging from dataclasses import dataclass from marshmallow import EXCLUDE from typing import Any, Dict, List, Optional from amundsen_common.models.dashboard import DashboardSummary, DashboardSummarySchema from amundsen_common.models.feature import Feature, FeatureSchema from amundsen_common.models.popular_table ...
Cleanup some fields in the dashboard response :param dashboard_dict: Dashboard response from metadata service. :return: Dashboard dictionary with sanitized fields, particularly the tables and owners.
142,809
import logging from dataclasses import dataclass from marshmallow import EXCLUDE from typing import Any, Dict, List, Optional from amundsen_common.models.dashboard import DashboardSummary, DashboardSummarySchema from amundsen_common.models.feature import Feature, FeatureSchema from amundsen_common.models.popular_table ...
Decorate lineage entries with database, schema, cluster, and table :param table_dict: :return: table entry with additional fields
142,810
import logging from dataclasses import dataclass from marshmallow import EXCLUDE from typing import Any, Dict, List, Optional from amundsen_common.models.dashboard import DashboardSummary, DashboardSummarySchema from amundsen_common.models.feature import Feature, FeatureSchema from amundsen_common.models.popular_table ...
Forms the full version of a table Dict, with additional and sanitized fields :param table_dict: Table Dict from metadata service :return: Table Dict with sanitized fields
142,815
import logging import sys from typing import Callable, List from pkg_resources import iter_entry_points from amundsen_application.log.action_log_model import ActionLogParams LOGGER = logging.getLogger(__name__) __pre_exec_callbacks = [] class ActionLogParams(object): """ Holds parameters for Action log ""...
Calls callbacks before execution. Note that any exception from callback will be logged but won't be propagated. :param kwargs: :return: None
142,816
import logging import sys from typing import Callable, List from pkg_resources import iter_entry_points from amundsen_application.log.action_log_model import ActionLogParams LOGGER = logging.getLogger(__name__) __post_exec_callbacks = [] class ActionLogParams(object): """ Holds parameters for Action log "...
Calls callbacks after execution. As it's being called after execution, it can capture most of fields in amundsen_application.log.action_log_model.ActionLogParams. Note that any exception from callback will be logged but won't be propagated. :param kwargs: :return: None
142,819
import functools import getpass import json import logging import socket from datetime import datetime, timezone, timedelta from typing import Any, Dict, Callable from flask import current_app as flask_app from amundsen_application.log import action_log_callback from amundsen_application.log.action_log_model import Act...
Decorates function to execute function at the same time triggering action logger callbacks. It will call action logger callbacks twice, one for pre-execution and the other one for post-execution. Action logger will be called with ActionLogParams :param f: function instance :return: wrapped function
142,820
from typing import Dict, Optional from amundsen_common.models.user import UserSchema, User from flask import current_app as app from marshmallow import ValidationError def _str_no_value(s: Optional[str]) -> bool: class User: # type: ignore # TODO: Add frequent_used, bookmarked, & owned resources class UserSchem...
null
142,821
from typing import Dict, Optional from amundsen_common.models.user import UserSchema, User from flask import current_app as app from marshmallow import ValidationError class User: # ToDo (Verdan): Make user_id a required field. # In case if there is only email, id could be email. # All the transactions a...
null
142,824
import uuid from datetime import datetime, timedelta from airflow import DAG from airflow import macros from airflow.operators.python_operator import PythonOperator from elasticsearch import Elasticsearch from pyhocon import ConfigFactory from databuilder.extractor.athena_metadata_extractor import AthenaMetadataExtr...
null
142,853
import logging import os import sys import uuid from elasticsearch.client import Elasticsearch from pyhocon import ConfigFactory from databuilder.extractor.neo4j_extractor import Neo4jExtractor from databuilder.extractor.neo4j_search_data_extractor import Neo4jSearchDataExtractor from databuilder.extractor.snowflake_me...
null
142,861
import logging import sys import textwrap import uuid from elasticsearch import Elasticsearch from pyhocon import ConfigFactory from sqlalchemy.ext.declarative import declarative_base from databuilder.extractor.mysql_metadata_extractor import MysqlMetadataExtractor from databuilder.extractor.neo4j_extractor import Neo4...
null
142,863
import logging import sys import textwrap import uuid from elasticsearch import Elasticsearch from pyhocon import ConfigFactory from sqlalchemy.ext.declarative import declarative_base from databuilder.extractor.neo4j_extractor import Neo4jExtractor from databuilder.extractor.neo4j_search_data_extractor import Neo4jSear...
null
142,870
import logging import sys import textwrap import uuid from elasticsearch import Elasticsearch from pyhocon import ConfigFactory from sqlalchemy.ext.declarative import declarative_base from databuilder.extractor.neo4j_extractor import Neo4jExtractor from databuilder.extractor.neo4j_search_data_extractor import Neo4jSear...
null
142,883
import logging import sys import uuid from elasticsearch import Elasticsearch from pyhocon import ConfigFactory from sqlalchemy.ext.declarative import declarative_base from databuilder.extractor.mssql_metadata_extractor import MSSQLMetadataExtractor from databuilder.extractor.neo4j_extractor import Neo4jExtractor from ...
null
142,905
from datetime import datetime from typing import ( Any, Dict, List, Optional, ) from databuilder.models.graph_node import GraphNode from databuilder.models.graph_relationship import GraphRelationship NEPTUNE_HEADER_ID = "~id" NEPTUNE_HEADER_LABEL = "~label" METADATA_KEY_PROPERTY_NAME_BULK_LOADER_FORMAT = '{name}:St...
null
142,937
from enum import Enum, auto class ResourceType(Enum): Table = auto() Dashboard = auto() User = auto() Column = auto() Type_Metadata = auto() Feature = auto() def to_label(*, resource_type: ResourceType) -> str: return resource_type.name.lower()
null
142,938
import logging import sys from typing import Callable, List, Any from pkg_resources import iter_entry_points from amundsen_common.log.action_log_model import ActionLogParams LOGGER = logging.getLogger(__name__) __pre_exec_callbacks: List[Callable[..., Any]] = [] class ActionLogParams(object): """ Holds paramet...
Calls callbacks before execution. Note that any exception from callback will be logged but won't be propagated. :param kwargs: :return: None
142,939
import logging import sys from typing import Callable, List, Any from pkg_resources import iter_entry_points from amundsen_common.log.action_log_model import ActionLogParams LOGGER = logging.getLogger(__name__) __post_exec_callbacks: List[Callable[..., Any]] = [] class ActionLogParams(object): """ Holds parame...
Calls callbacks after execution. As it's being called after execution, it can capture most of fields in amundsen_application.log.action_log_model.ActionLogParams. Note that any exception from callback will be logged but won't be propagated. :param kwargs: :return: None
142,944
import argparse import asyncio import base64 import json import multiprocessing import os import re import sys import traceback import zipfile from collections.abc import Awaitable, Callable from functools import lru_cache from io import BytesIO, TextIOWrapper from pathlib import Path from tempfile import NamedTemporar...
stdout/stderrのエンコーディングをUTF-8に切り替える関数
142,945
import argparse import asyncio import base64 import json import multiprocessing import os import re import sys import traceback import zipfile from collections.abc import Awaitable, Callable from functools import lru_cache from io import BytesIO, TextIOWrapper from pathlib import Path from tempfile import NamedTemporar...
null
142,946
import argparse import json from collections import OrderedDict from pathlib import Path def merge_json_string(src: str, dst: str) -> str: """ バージョンが同じ場合は要素を結合する >>> src = '[{"version": "0.0.1", "a": ["a1"], "b": ["b1", "b2"]}]' >>> dst = '[{"version": "0.0.1", "a": ["a2"], "b": ["b1", "b3"]}]' >>> ...
null
142,947
import json from pathlib import Path from voicevox_engine.dev.core.mock import MockCoreWrapper from voicevox_engine.dev.tts_engine.mock import MockTTSEngine from voicevox_engine.preset.PresetManager import PresetManager from voicevox_engine.setting.SettingLoader import USER_SETTING_PATH, SettingHandler from voicevox_en...
OpenAPI schema から API ドキュメント HTML を生成する
142,948
import json import os import subprocess import urllib.request from dataclasses import asdict, dataclass from pathlib import Path from typing import List, Optional class License: name: str version: Optional[str] license: Optional[str] text: str def generate_licenses() -> List[License]: licenses: Lis...
null
142,949
import argparse import json import time from io import BytesIO from pathlib import Path from subprocess import Popen from urllib.parse import urlencode from urllib.request import Request, urlopen import soundfile base_url = "http://127.0.0.1:50021/" def test_release_build(dist_dir: Path, skip_run_process: bool) -> Non...
null
142,950
import argparse import statistics from pathlib import Path from typing import List import numpy as np def get_candidates( naist_jdic_path: Path, pos: str, pos_detail_1: str, pos_detail_2: str, pos_detail_3: str, ) -> List[int]: costs = [] with naist_jdic_path.open(encoding="utf-8") as f: ...
null
142,951
import os import platform from ctypes import _Pointer from ctypes import CDLL, POINTER, c_bool, c_char_p, c_float, c_int, c_long from ctypes.util import find_library from dataclasses import dataclass from enum import Enum, auto from pathlib import Path from typing import Literal import numpy as np from numpy.typing im...
`core_dir` 直下に存在し実行中マシンでサポートされるコアDLLのロード Parameters ---------- core_dir : Path 直下にコア(共有ライブラリ)が存在するディレクトリ use_gpu Returns ------- core : CDLL コアDLL
142,952
import os import platform from ctypes import _Pointer from ctypes import CDLL, POINTER, c_bool, c_char_p, c_float, c_int, c_long from ctypes.util import find_library from dataclasses import dataclass from enum import Enum, auto from pathlib import Path from typing import Literal import numpy as np from numpy.typing im...
コアDLLの各関数を(その関数があれば)型付けする。APIの有無の情報を辞書として返す Parameters ---------- core_cdll : CDLL コアDLL Returns ------- api_exists : dict[str, bool] key: API名, value: APIの有無
142,953
import os import warnings The provided code snippet includes necessary dependencies for implementing the `decide_boolean_from_env` function. Write a Python function `def decide_boolean_from_env(env_name: str) -> bool` to solve the following problem: 環境変数からbool値を返す。 * 環境変数が"1"ならTrueを返す * 環境変数が"0"か空白か存在しないならFalseを返す * そ...
環境変数からbool値を返す。 * 環境変数が"1"ならTrueを返す * 環境変数が"0"か空白か存在しないならFalseを返す * それ以外はwarningを出してFalseを返す
142,954
import threading from collections.abc import Callable from typing import Any, TypeVar F = TypeVar("F", bound=Callable[..., Any]) def mutex_wrapper(lock: threading.Lock) -> Callable[[F], F]: def wrap(f): def func(*args, **kw): lock.acquire() try: return f(*args, **kw)...
null
142,955
import copy import math import numpy as np from fastapi import HTTPException from numpy.typing import NDArray from soxr import resample from ..core.core_adapter import CoreAdapter from ..core.core_wrapper import CoreWrapper from ..metas.Metas import StyleId from ..model import AccentPhrase, AudioQuery, FrameAudioQuery,...
アクセント句から指定インデックスのみが 1 の配列 (onehot) を生成する。 長さ `len(moras)` な配列の指定インデックスを 1 とし、pause_mora を含む場合は末尾に 0 が付加される。
142,956
import copy import math import numpy as np from fastapi import HTTPException from numpy.typing import NDArray from soxr import resample from ..core.core_adapter import CoreAdapter from ..core.core_wrapper import CoreWrapper from ..metas.Metas import StyleId from ..model import AccentPhrase, AudioQuery, FrameAudioQuery,...
必要に応じて各アクセント句の末尾へ疑問形モーラ(同一母音・継続長 0.15秒・音高↑)を付与する
142,957
import copy import math import numpy as np from fastapi import HTTPException from numpy.typing import NDArray from soxr import resample from ..core.core_adapter import CoreAdapter from ..core.core_wrapper import CoreWrapper from ..metas.Metas import StyleId from ..model import AccentPhrase, AudioQuery, FrameAudioQuery,...
音声合成用のクエリからフレームごとの音素 (shape=(フレーム長, 音素数)) と音高 (shape=(フレーム長,)) を得る
142,958
import copy import math import numpy as np from fastapi import HTTPException from numpy.typing import NDArray from soxr import resample from ..core.core_adapter import CoreAdapter from ..core.core_wrapper import CoreWrapper from ..metas.Metas import StyleId from ..model import AccentPhrase, AudioQuery, FrameAudioQuery,...
生音声波形に音声合成用のクエリを適用して出力音声波形を生成する
142,959
import copy import math import numpy as np from fastapi import HTTPException from numpy.typing import NDArray from soxr import resample from ..core.core_adapter import CoreAdapter from ..core.core_wrapper import CoreWrapper from ..metas.Metas import StyleId from ..model import AccentPhrase, AudioQuery, FrameAudioQuery,...
ひらがなをカタカナに変換する
142,960
import copy import math import numpy as np from fastapi import HTTPException from numpy.typing import NDArray from soxr import resample from ..core.core_adapter import CoreAdapter from ..core.core_wrapper import CoreWrapper from ..metas.Metas import StyleId from ..model import AccentPhrase, AudioQuery, FrameAudioQuery,...
子音長と音符長から音素長を計算する ただし、母音はノートの頭にくるようにするため、 予測された子音長は前のノートの長さを超えないように調整される
142,961
import copy import math import numpy as np from fastapi import HTTPException from numpy.typing import NDArray from soxr import resample from ..core.core_adapter import CoreAdapter from ..core.core_wrapper import CoreWrapper from ..metas.Metas import StyleId from ..model import AccentPhrase, AudioQuery, FrameAudioQuery,...
歌声合成用のクエリからフレームごとの音素・音高・音量を得る
142,962
import re from dataclasses import dataclass from itertools import chain from typing import Callable, Literal, Self import pyopenjtalk from ..model import AccentPhrase, Mora from .mora_mapping import mora_phonemes_to_mora_kana class Label: """OpenJTalkラベル""" contexts: dict[str, str] # ラベルの属性 def from_featur...
日本語文からアクセント句系列を生成する
142,963
import asyncio import queue import sys from multiprocessing import Pipe, Process from pathlib import Path from tempfile import NamedTemporaryFile import soundfile from fastapi import HTTPException, Request from .core.core_initializer import initialize_cores from .metas.Metas import StyleId from .model import AudioQuery...
音声合成を行うサブプロセスで行うための関数 pickle化の関係でグローバルに書いている 引数 use_gpu, voicelib_dirs, voicevox_dir, runtime_dirs, cpu_num_threads, enable_mock は、 core_initializer を参照 Parameters ---------- sub_proc_con: ConnectionType メインプロセスと通信するためのPipe
142,964
import asyncio import webbrowser from multiprocess import Process import signal import sys from typing import Dict, List from robyn.logger import logger from robyn.events import Events from robyn.robyn import FunctionInfo, Headers, Server, SocketHeld from robyn.router import GlobalMiddleware, RouteMiddleware, Route fro...
null
142,965
import logging import os from pathlib import Path logger = logging.getLogger(__name__) def parser(config_path=None, project_root=""): """Find robyn.env file in root of the project and parse it""" if config_path is None: config_path = Path(project_root) / "robyn.env" if config_path.exists(): ...
Main function