id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
26,920
import time from typing import Dict The provided code snippet includes necessary dependencies for implementing the `retry` function. Write a Python function `def retry( retries: int = 2, delay: int = 5, max_delay: int = 60, exponential_backoff: bool = True, logger=None, logging_tags: Dict = Non...
Create the decorator to retry a method Args: retries (int, optional): Number of retry attempts. delay (int, optional): Delay between retries. If using exponential backoff retry, delay will be multiplied by 2 for each additional retry. max_delay (int, optional): Maximum delay time. exponential_backoff (bool, optional): ...
26,921
import inspect import logging from enum import Enum import simplejson from mage_ai.data_preparation.models.constants import BlockType from mage_ai.shared.environments import is_deus_ex_machina from mage_ai.shared.parsers import encode_complex def targets(): return [ # 'get_outputs', # 'get_callers'...
null
26,922
from urllib.parse import urlparse from mage_ai.shared.constants import GCS_PREFIX, S3_PREFIX S3_PREFIX = 's3://' def s3_url_path(path): if path.startswith(S3_PREFIX): s3_url = urlparse(path, allow_fragments=False) return s3_url.path.lstrip('/') return path
null
26,923
from urllib.parse import urlparse from mage_ai.shared.constants import GCS_PREFIX, S3_PREFIX GCS_PREFIX = 'gs://' def gcs_url_path(path): if path.startswith(GCS_PREFIX): gcs_url = urlparse(path, allow_fragments=False) return gcs_url.path.lstrip('/') return path
null
26,924
import os import sys from mage_ai.shared.constants import ENV_DEV, ENV_PROD, ENV_STAGING, ENV_TEST def is_deus_ex_machina(): return int(os.getenv('DEUS_EX_MACHINA', 0) or 0) == 1
null
26,925
import os import sys from mage_ai.shared.constants import ENV_DEV, ENV_PROD, ENV_STAGING, ENV_TEST def is_dev(): return os.getenv('ENV', None) == 'dev' or os.getenv('ENV', None) == 'development'
null
26,926
import datetime import pytz from mage_ai.shared.array import find_index def str_to_timedelta(period_str: str): unit = period_str[-1] if unit not in ['d', 'h', 'w']: raise Exception( 'Please provide a valid period unit ("d", "h", or "w")') if unit == 'd': return datetime.timedelt...
null
26,927
import datetime import pytz from mage_ai.shared.array import find_index def find_index(condition, arr): for idx, item in enumerate(arr): if condition(item): return idx return -1 def week_of_month(day: datetime.datetime) -> int: first_day = day.replace(day=1) # e.g. 4 for Friday ...
null
26,928
import os from pathlib import Path from typing import Tuple from mage_ai.settings.platform import get_repo_paths_for_file_path from mage_ai.settings.repo import get_repo_path from mage_ai.settings.utils import base_repo_dirname, base_repo_name, base_repo_path from mage_ai.shared.files import find_directory def get_rep...
null
26,929
import os from pathlib import Path from typing import Tuple from mage_ai.settings.platform import get_repo_paths_for_file_path from mage_ai.settings.repo import get_repo_path from mage_ai.settings.utils import base_repo_dirname, base_repo_name, base_repo_path from mage_ai.shared.files import find_directory def get_rep...
null
26,930
import os from pathlib import Path from typing import Tuple from mage_ai.settings.platform import get_repo_paths_for_file_path from mage_ai.settings.repo import get_repo_path from mage_ai.settings.utils import base_repo_dirname, base_repo_name, base_repo_path from mage_ai.shared.files import find_directory def convert...
null
26,931
import os from pathlib import Path from typing import Tuple from mage_ai.settings.platform import get_repo_paths_for_file_path from mage_ai.settings.repo import get_repo_path from mage_ai.settings.utils import base_repo_dirname, base_repo_name, base_repo_path from mage_ai.shared.files import find_directory def convert...
null
26,932
import os from pathlib import Path from typing import Tuple from mage_ai.settings.platform import get_repo_paths_for_file_path from mage_ai.settings.repo import get_repo_path from mage_ai.settings.utils import base_repo_dirname, base_repo_name, base_repo_path from mage_ai.shared.files import find_directory def get_rep...
null
26,933
import json import math import re from functools import reduce from typing import Any, Dict, List from mage_ai.shared.strings import camel_to_snake_case def camel_to_snake_case(name): def camel_case_keys_to_snake_case(d): if not isinstance(d, dict): return d snake_dict = {} for key, value in d.ite...
null
26,934
import json import math import re from functools import reduce from typing import Any, Dict, List from mage_ai.shared.strings import camel_to_snake_case The provided code snippet includes necessary dependencies for implementing the `safe_dig` function. Write a Python function `def safe_dig(obj_arg, arr_or_string)` to ...
Safely retrieves nested values from a dictionary or list using a dot-separated path. Args: obj_arg: The object (dictionary or list) to navigate. arr_or_string (str or list): A dot-separated path string or a list of keys/indexes. Returns: The value retrieved from the nested structure, or None if any intermediate key/ind...
26,935
import json import math import re from functools import reduce from typing import Any, Dict, List from mage_ai.shared.strings import camel_to_snake_case def flatten(input_data): final_data = {} for k1, v1 in input_data.items(): if type(v1) is dict: for k2, v2 in v1.items(): ...
null
26,936
import json import math import re from functools import reduce from typing import Any, Dict, List from mage_ai.shared.strings import camel_to_snake_case def ignore_keys_with_blank_values(d: Dict, include_values: List[Any] = None) -> Dict: d2 = d.copy() for key, value in d.items(): if not value and (not...
null
26,937
import json import math import re from functools import reduce from typing import Any, Dict, List from mage_ai.shared.strings import camel_to_snake_case def extract_arrays(input_data): arr = [] for _, v in input_data.items(): if type(v) is list: arr.append(v) return arr
null
26,938
import json import math import re from functools import reduce from typing import Any, Dict, List from mage_ai.shared.strings import camel_to_snake_case def replace_dict_nan_value(d): def _replace_nan_value(v): if isinstance(v, float) and math.isnan(v): return None return v return ...
null
26,939
import json import math import re from functools import reduce from typing import Any, Dict, List from mage_ai.shared.strings import camel_to_snake_case def get_safe_value(data: Dict, key: str, default_value): return data.get(key, default_value) if data else default_value
null
26,940
import json import math import re from functools import reduce from typing import Any, Dict, List from mage_ai.shared.strings import camel_to_snake_case def dig(obj_arg, arr_or_string): def set_value(obj: Dict, keys: List[str], value) -> Dict: if len(keys) >= 2: for idx in range(len(keys)): key...
null
26,941
import glob import os from pathlib import Path from typing import Callable, List, Tuple import aiofiles from mage_ai.shared.environments import is_debug def read_last_line(filename: str) -> str: with open(filename, 'rb') as f: try: # catch OSError in case of a one line file f.seek(-2, os.SEEK_...
null
26,942
import glob import os from pathlib import Path from typing import Callable, List, Tuple import aiofiles from mage_ai.shared.environments import is_debug def get_absolute_paths_from_all_files( starting_full_path_directory: str, comparator: Callable = None, include_hidden_files: bool = False, parse_value...
null
26,943
import glob import os from pathlib import Path from typing import Callable, List, Tuple import aiofiles from mage_ai.shared.environments import is_debug def find_file_from_another_file_path(file_path: str, comparator) -> str: if not file_path or not comparator: return if not os.path.isdir(file_path): ...
null
26,944
import glob import os from pathlib import Path from typing import Callable, List, Tuple import aiofiles from mage_ai.shared.environments import is_debug def is_debug(): return int(os.getenv('DEBUG', 0) or 0) == 1 async def read_async(file_path: str) -> str: dirname = os.path.dirname(file_path) if not os.p...
null
26,945
import random def batch(iterable, n=1): length = len(iterable) for ndx in range(0, length, n): yield iterable[ndx:min(ndx + n, length)]
null
26,946
import random def difference(li1, li2): li1_lookup = set(li1) li2_lookup = set(li2) return [i for i in li1 + li2 if i not in li1_lookup or i not in li2_lookup]
null
26,947
import random def flatten(arr): return [item for sublist in arr for item in sublist]
null
26,948
import random def sample(arr): return arr[random.randrange(0, len(arr))]
null
26,949
import random def unique_by(arr1, key): mapping = {} arr2 = [] for item in arr1: k = key(item) if k in mapping: continue arr2.append(item) mapping[k] = True return arr2
null
26,950
from concurrent.futures import ThreadPoolExecutor from joblib import Parallel, delayed from threading import Thread def execute_parallel(list_of_funcs_and_args, verbose=0): parallel = Parallel(n_jobs=-1, prefer='threads', verbose=verbose) return parallel(delayed(func)(*args) for func, args in list_of_funcs_and...
null
26,951
from concurrent.futures import ThreadPoolExecutor from joblib import Parallel, delayed from threading import Thread def start_thread(target, **kwargs): thread = Thread( target=target, kwargs=kwargs, ) thread.start() return thread
null
26,952
from concurrent.futures import ThreadPoolExecutor from joblib import Parallel, delayed from threading import Thread MAX_WORKERS = 16 def parallelize(func, arr): with ThreadPoolExecutor(max_workers=MAX_WORKERS) as pool: return pool.map(func, arr)
null
26,953
from concurrent.futures import ThreadPoolExecutor from joblib import Parallel, delayed from threading import Thread MAX_WORKERS = 16 def parallelize_multiple_args(func, arr_args): with ThreadPoolExecutor(max_workers=MAX_WORKERS) as pool: return pool.map(func, *zip(*arr_args))
null
26,954
from concurrent.futures import ThreadPoolExecutor from joblib import Parallel, delayed from threading import Thread MAX_WORKERS = 16 def run_parallel_threads(list_of_funcs_and_args_or_kwargs): with ThreadPoolExecutor(max_workers=MAX_WORKERS) as pool: for func, args in list_of_funcs_and_args_or_kwargs: ...
null
26,955
from concurrent.futures import ThreadPoolExecutor from joblib import Parallel, delayed from threading import Thread MAX_WORKERS = 16 def run_parallel(func, arr_args_1, arr_args_2): with ThreadPoolExecutor(max_workers=MAX_WORKERS) as pool: return pool.map(func, *arr_args_1, *arr_args_2)
null
26,956
from datetime import datetime from enum import Enum from json import JSONDecoder import numpy as np import pandas as pd from mage_ai.orchestration.db.models.base import BaseModel MAX_ITEMS_IN_SAMPLE_OUTPUT = 20 def sample_output(obj): if isinstance(obj, list): sampled = len(obj) > MAX_ITEMS_IN_SAMPLE_OUTPU...
null
26,957
import re from typing import List import inflection def classify(name): return ''.join([n.capitalize() for n in name.split('_')])
null
26,958
import re from typing import List import inflection def format_enum(v): return v.value if type(v) is not str else v
null
26,959
import re from typing import List import inflection def remove_extension_from_filename(filename: str) -> str: parts = filename.split('/') fn = parts[-1].split('.')[0] return '/'.join(parts[:-1] + [fn])
null
26,960
import re from typing import List import inflection def singularize(word: str) -> str: return inflection.singularize(word)
null
26,961
import re from typing import List import inflection def size_of_string(string: str) -> float: return len(str(string).encode('utf-8'))
null
26,962
from typing import Dict, Optional from mage_ai.shared.array import find def find(condition, arr, map=None): try: return next(map(x) if map else x for x in arr if condition(x)) except StopIteration: return None The provided code snippet includes necessary dependencies for implementing the `get_...
Args: headers (Dict): Headers from the request Returns: Optional[str]: The bearer token from the headers if it exists
26,963
from collections import OrderedDict import logging import numpy as np import pandas as pd import scipy import six.moves The provided code snippet includes necessary dependencies for implementing the `as_scalar` function. Write a Python function `def as_scalar(x, str_encoding='utf-8')` to solve the following problem: C...
Converts from a non-python scalar type to a Python scalar :param x: The scalar object to convert :param str_encoding: The encoding to use for converting fixed-width numpy strings (np.string_)
26,964
from collections import OrderedDict import logging import numpy as np import pandas as pd import scipy import six.moves def sparse_to_dense(x): """ Converts a sparse matrix into its dense representation. Passes through non-sparse matrices :param x: The input :return: A dense numpy array """ if i...
Vertically stacks features together (by column) If there is a single feature, we return just that one This requires homogeneous shapes. :param x: The feature dict :param method: Either column_stack or stack. Refer to numpy docs for more info. :param axis: If using stack, the axis to stack on :param dtype: The dtype to ...
26,965
from collections import OrderedDict import logging import numpy as np import pandas as pd import scipy import six.moves The provided code snippet includes necessary dependencies for implementing the `fd_to_df` function. Write a Python function `def fd_to_df(x)` to solve the following problem: :param x: FeatureDict :re...
:param x: FeatureDict :return: A Pandas DataFrame representation of the FeatureDict
26,966
from collections import OrderedDict import logging import numpy as np import pandas as pd import scipy import six.moves def df_to_fd(x, copy=False, nan_str='null', dtype=None): """ Converts a pandas DataFrame to an ordered dictionary of numpy arrays :param x: The input DataFrame :param copy: Generates a...
Convenience function that auto-detects the type and performs the conversion :param x: Input data :param dtype: If None, we attempt to pass-through without copies. Doesn't apply to feature dicts Note: when passing non-numpy types do not set dtype. :return: A FeatureDict
26,967
from collections import OrderedDict import logging import numpy as np import pandas as pd import scipy import six.moves The provided code snippet includes necessary dependencies for implementing the `to_list` function. Write a Python function `def to_list(feature)` to solve the following problem: Converts a feature of...
Converts a feature of a vector type (pandas series or numpy ndarray) to a list native python types :param feature: The input feature as a list, numpy ndarray, or pandas Series :return: the corresponding data in native python type
26,968
import os import shutil import traceback from typing import Callable, Union import aiofiles async def safe_write_async(filepath: str, content: str, write_func: Callable = None): temp_file_path = filepath + '.temp' if os.path.isfile(filepath): shutil.copy2(filepath, temp_file_path) prev_existed ...
null
26,969
import os import shutil import traceback from typing import Callable, Union import aiofiles async def read_last_line_async(file_path: str) -> str: if not file_path: return # https://stackoverflow.com/questions/46258499/how-to-read-the-last-line-of-a-file-in-python async with aiofiles.open(file_pat...
null
26,970
import json import os from logging import Logger from typing import Any, Callable, Dict import psutil from mage_ai.data_preparation.logging.logger import DictLogger def __log(log_message: str, logger: Logger = None, logging_tags: Dict = None): if logger: if isinstance(logger, DictLogger): logger...
null
26,971
import json import os from logging import Logger from typing import Any, Callable, Dict import psutil from mage_ai.data_preparation.logging.logger import DictLogger def __log(log_message: str, logger: Logger = None, logging_tags: Dict = None): if logger: if isinstance(logger, DictLogger): logger...
null
26,972
from datetime import datetime from typing import Callable, Dict, List, Union from mage_ai.shared.hash import extract, merge_dict def build_block_dict(block: Union[Dict]) -> Dict: file_path = None if isinstance(block, dict): block_language = block.get('language') block_name = block.get('name') ...
null
26,973
from datetime import datetime from typing import Callable, Dict, List, Union from mage_ai.shared.hash import extract, merge_dict PIPELINE_KEYS = [ 'created_at', 'description', 'name', 'tags', 'type', 'uuid', ] BLOCK_KEYS = [ 'downstream_blocks', 'language', 'name', 'type', 'u...
null
26,974
from datetime import datetime from typing import Callable, Dict, List, Union from mage_ai.shared.hash import extract, merge_dict def group_models_by_keys( model_dicts: List[Dict], keys: List[str], get_uuid_key: Callable, ) -> Dict: mapping = {key: {} for key in keys} for model_dict in model_dicts:...
null
26,975
import asyncio import os from typing import Dict, List import aiofiles import yaml from jinja2 import Template from mage_ai.cache.dbt.constants import PROFILES_FILENAME, PROJECT_FILENAMES from mage_ai.data_preparation.shared.utils import get_template_vars from mage_ai.settings.utils import base_repo_path from mage_ai.s...
null
26,976
import asyncio import os from typing import Dict, List import aiofiles import yaml from jinja2 import Template from mage_ai.cache.dbt.constants import PROFILES_FILENAME, PROJECT_FILENAMES from mage_ai.data_preparation.shared.utils import get_template_vars from mage_ai.settings.utils import base_repo_path from mage_ai.s...
null
26,977
import asyncio import os from typing import Dict, List import aiofiles import yaml from jinja2 import Template from mage_ai.cache.dbt.constants import PROFILES_FILENAME, PROJECT_FILENAMES from mage_ai.data_preparation.shared.utils import get_template_vars from mage_ai.settings.utils import base_repo_path from mage_ai.s...
null
26,978
import asyncio import os from typing import Dict, List import aiofiles import yaml from jinja2 import Template from mage_ai.cache.dbt.constants import PROFILES_FILENAME, PROJECT_FILENAMES from mage_ai.data_preparation.shared.utils import get_template_vars from mage_ai.settings.utils import base_repo_path from mage_ai.s...
null
26,979
from enum import Enum from mage_ai.data_preparation.models.constants import ( BLOCK_TYPE_DIRECTORY_NAME, PIPELINES_FOLDER, BlockType, ) from mage_ai.shared.hash import merge_dict PROFILES_FILENAME = 'profiles.yml' PROJECT_FILENAMES = [PROJECT_FILENAME, 'dbt_project.yaml'] class FileType(str, Enum): MODE...
null
26,980
import json from typing import Dict, List, Tuple import simplejson import yaml from jinja2 import Template from mage_ai.data_integrations.utils.parsers import NoDatesSafeLoader from mage_ai.data_preparation.shared.utils import get_template_vars from mage_ai.shared.dates import n_days_ago from mage_ai.shared.hash import...
null
26,981
import json from typing import Dict, List, Tuple import simplejson import yaml from jinja2 import Template from mage_ai.data_integrations.utils.parsers import NoDatesSafeLoader from mage_ai.data_preparation.shared.utils import get_template_vars from mage_ai.shared.dates import n_days_ago from mage_ai.shared.hash import...
null
26,982
import json from typing import Dict, List, Tuple import simplejson import yaml from jinja2 import Template from mage_ai.data_integrations.utils.parsers import NoDatesSafeLoader from mage_ai.data_preparation.shared.utils import get_template_vars from mage_ai.shared.dates import n_days_ago from mage_ai.shared.hash import...
null
26,983
import json import math import os import shutil from typing import Dict, List, Union from mage_ai.data_integrations.sources.constants import SQL_SOURCES from mage_ai.data_integrations.utils.config import build_config, get_batch_fetch_limit from mage_ai.data_preparation.logging.logger import DictLogger from mage_ai.data...
null
26,984
import json import math import os import shutil from typing import Dict, List, Union from mage_ai.data_integrations.sources.constants import SQL_SOURCES from mage_ai.data_integrations.utils.config import build_config, get_batch_fetch_limit from mage_ai.data_preparation.logging.logger import DictLogger from mage_ai.data...
null
26,985
import json import math import os import shutil from typing import Dict, List, Union from mage_ai.data_integrations.sources.constants import SQL_SOURCES from mage_ai.data_integrations.utils.config import build_config, get_batch_fetch_limit from mage_ai.data_preparation.logging.logger import DictLogger from mage_ai.data...
null
26,986
import json import math import os import shutil from typing import Dict, List, Union from mage_ai.data_integrations.sources.constants import SQL_SOURCES from mage_ai.data_integrations.utils.config import build_config, get_batch_fetch_limit from mage_ai.data_preparation.logging.logger import DictLogger from mage_ai.data...
null
26,987
from functools import reduce from mage_ai.shared.utils import files_in_path import aiofiles import importlib import os import pathlib import re root_path = '/'.join(str(pathlib.Path(__file__).parent.resolve()).split('/')[:-2]) def add_file(acc, path): files = files_in_path(path) def __should_include(file_name):...
null
26,988
import re from typing import Any, List, Union import numpy as np import pandas as pd from pandas.core.indexes.frozen import FrozenList from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.transformer_actions.constants import CURRENCY_SYMBOLS from mage_ai.shared.cust...
null
26,989
import re from typing import Any, List, Union import numpy as np import pandas as pd from pandas.core.indexes.frozen import FrozenList from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.transformer_actions.constants import CURRENCY_SYMBOLS from mage_ai.shared.cust...
null
26,990
import re from typing import Any, List, Union import numpy as np import pandas as pd from pandas.core.indexes.frozen import FrozenList from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.transformer_actions.constants import CURRENCY_SYMBOLS from mage_ai.shared.cust...
null
26,991
import re from typing import Any, List, Union import numpy as np import pandas as pd from pandas.core.indexes.frozen import FrozenList from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.transformer_actions.constants import CURRENCY_SYMBOLS from mage_ai.shared.cust...
null
26,992
from mage_ai.data_cleaner.analysis.calculator import AnalysisCalculator from mage_ai.data_cleaner.column_types import column_type_detector from mage_ai.data_cleaner.pipelines.base import DEFAULT_RULES, BasePipeline from mage_ai.data_cleaner.shared.utils import clean_dataframe from mage_ai.data_cleaner.statistics.calcul...
null
26,993
from mage_ai.data_cleaner.analysis.calculator import AnalysisCalculator from mage_ai.data_cleaner.column_types import column_type_detector from mage_ai.data_cleaner.pipelines.base import DEFAULT_RULES, BasePipeline from mage_ai.data_cleaner.shared.utils import clean_dataframe from mage_ai.data_cleaner.statistics.calcul...
null
26,994
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.shared.utils import clean_dataframe from mage_ai.shared.constants import SAMPLE_SIZE from mage_ai.shared.custom_types import Fr...
null
26,995
from mage_ai.data_cleaner.analysis.constants import ( CHART_TYPE_BAR_HORIZONTAL, CHART_TYPE_LINE_CHART, CHART_TYPE_HISTOGRAM, DATA_KEY_SCATTER_PLOT, DATA_KEY_SCATTER_PLOT_LABELS, DATA_KEY_TIME_SERIES, LABEL_TYPE_RANGE, ) from mage_ai.data_cleaner.column_types.constants import ColumnType from...
null
26,996
from mage_ai.data_cleaner.analysis.constants import ( CHART_TYPE_BAR_HORIZONTAL, CHART_TYPE_LINE_CHART, CHART_TYPE_HISTOGRAM, DATA_KEY_SCATTER_PLOT, DATA_KEY_SCATTER_PLOT_LABELS, DATA_KEY_TIME_SERIES, LABEL_TYPE_RANGE, ) from mage_ai.data_cleaner.column_types.constants import ColumnType from...
null
26,997
from mage_ai.data_cleaner.analysis.constants import ( CHART_TYPE_BAR_HORIZONTAL, CHART_TYPE_LINE_CHART, CHART_TYPE_HISTOGRAM, DATA_KEY_SCATTER_PLOT, DATA_KEY_SCATTER_PLOT_LABELS, DATA_KEY_TIME_SERIES, LABEL_TYPE_RANGE, ) from mage_ai.data_cleaner.column_types.constants import ColumnType from...
null
26,998
from mage_ai.data_cleaner.analysis.constants import ( CHART_TYPE_BAR_HORIZONTAL, CHART_TYPE_LINE_CHART, CHART_TYPE_HISTOGRAM, DATA_KEY_SCATTER_PLOT, DATA_KEY_SCATTER_PLOT_LABELS, DATA_KEY_TIME_SERIES, LABEL_TYPE_RANGE, ) from mage_ai.data_cleaner.column_types.constants import ColumnType from...
Build sample data for scatter plot. Sample data consits of two parts: 1. Numeric features 2. Low cardinality categorical features
26,999
from mage_ai.data_cleaner.analysis import charts from mage_ai.data_cleaner.analysis.constants import ( DATA_KEY_CHARTS, DATA_KEY_CORRELATION, DATA_KEY_TIME_SERIES, ) from mage_ai.data_cleaner.column_types.constants import ColumnType from mage_ai.data_cleaner.shared.utils import clean_dataframe, is_numeric_d...
null
27,000
from pandas import DataFrame from typing import Dict, Tuple import re def default_resolution(df: DataFrame, action: Dict) -> Tuple[bool, str]: return True, None
null
27,001
from pandas import DataFrame from typing import Dict, Tuple import re def resolve_filter_action(df: DataFrame, action: Dict) -> Tuple[bool, str]: for name in df.columns: if re.search(r'\s', name): return ( False, 'Column name contains whitespace or newline ' ...
null
27,002
from keyword import iskeyword from mage_ai.data_cleaner.column_types.column_type_detector import REGEX_NUMBER, infer_column_types from mage_ai.data_cleaner.column_types.constants import ColumnType from mage_ai.data_cleaner.transformer_actions.constants import ( ActionType, Axis, NameConventionPatterns, ) fr...
null
27,003
from keyword import iskeyword from mage_ai.data_cleaner.column_types.column_type_detector import REGEX_NUMBER, infer_column_types from mage_ai.data_cleaner.column_types.constants import ColumnType from mage_ai.data_cleaner.transformer_actions.constants import ( ActionType, Axis, NameConventionPatterns, ) fr...
null
27,004
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,005
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,006
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,007
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,008
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,009
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,010
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,011
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,012
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,013
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,014
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,015
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,016
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,017
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,018
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,019
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null