{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":84795,"databundleVersionId":11281725,"isSourceIdPinned":false,"sourceType":"competition"},{"sourceId":10222992,"sourceType":"datasetVersion","datasetId":6319846},{"sourceId":10998331,"sourceType":"datasetVersion","datasetId":6846525},{"sourceId":10998679,"sourceType":"datasetVersion","datasetId":6846747},{"sourceId":221096520,"sourceType":"kernelVersion"},{"sourceId":265863,"sourceType":"modelInstanceVersion","isSourceIdPinned":false,"modelInstanceId":227466,"modelId":224053},{"sourceId":265872,"sourceType":"modelInstanceVersion","isSourceIdPinned":false,"modelInstanceId":227475,"modelId":224053},{"sourceId":276458,"sourceType":"modelInstanceVersion","isSourceIdPinned":false,"modelInstanceId":236741,"modelId":224053}],"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\n\n# https://www.kaggle.com/competitions/ai-mathematical-olympiad-progress-prize-2/discussion/560682#3113134\nos.environ[\"TRITON_PTXAS_PATH\"] = \"/usr/local/cuda/bin/ptxas\"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import io\nimport time\nimport shutil\nimport pandas as pd\nimport polars as pl\nimport re\nimport kaggle_evaluation.konwinski_prize_inference_server\nfrom typing import List, Tuple, Dict, Optional\nimport ast\nfrom collections import defaultdict\nfrom pyanalyze.name_check_visitor import NameCheckVisitor\nfrom pyanalyze.value import KnownValue","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"instance_count: Optional[int] = None\n\n\ndef get_number_of_instances(num_instances: int) -> None:\n    \"\"\"The very first message from the gateway will be the total number of instances to be served.\n    You don't need to edit this function.\n    \"\"\"\n    global instance_count\n    instance_count = num_instances","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from vllm import LLM, SamplingParams, RequestOutput\nimport warnings\nimport os\n\nwarnings.simplefilter(\"ignore\")\n\n# Global variables to store model and tokenizer\nllm = None\ntokenizer = None\n\ndef initialize_model() -> tuple:\n    \"\"\"\n    Initializes the LLM model and tokenizer if they are not already initialized.\n    Returns:\n        tuple: A tuple containing the initialized LLM model and tokenizer.\n    \"\"\"\n    global llm, tokenizer\n\n    # Check if model and tokenizer are already initialized\n    if llm is not None and tokenizer is not None:\n        return llm, tokenizer\n\n    # Environment configuration\n    os.environ[\"CUDA_VISIBLE_DEVICES\"] = \"0,1,2,3\"\n    os.environ[\"TOKENIZERS_PARALLELISM\"] = \"false\"\n\n    # Determine model path based on environment\n    if os.getenv(\"KAGGLE_KERNEL_RUN_TYPE\") or os.getenv(\"KAGGLE_IS_COMPETITION_RERUN\"):\n        llm_model_pth = \"/kaggle/input/deepseek-r1/transformers/qwen-qwq-32b-awq/1\"\n    else:\n        llm_model_pth = \"/root/volume/KirillR/QwQ-32B-Preview-AWQ\"\n\n    # LLM configuration\n    llm = LLM(\n        llm_model_pth,\n        max_num_seqs=6,\n        max_model_len=32_768,\n        trust_remote_code=True,\n        tensor_parallel_size=4,\n        enable_prefix_caching=True,\n        gpu_memory_utilization=0.95,\n        seed=2024,\n    )\n\n    # Tokenizer initialization\n    tokenizer = llm.get_tokenizer()\n\n    print(\"Model and tokenizer initialized successfully!\")\n    return llm, tokenizer\n\n\ndef count_tokens(text: str) -> int:\n    \"\"\"\n    Counts the number of tokens in a given text using the initialized tokenizer.\n    Args:\n        text (str): The input text for which to count tokens.\n    Returns:\n        int: The number of tokens in the input text.\n    \"\"\"\n    # Ensure model and tokenizer are initialized\n    _, tokenizer = initialize_model()\n    return len(tokenizer.encode(text))\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def save_repo_and_problem(repo_archive: io.BytesIO):\n    archive_path = '/tmp/repo_archive.tar'\n    repo_path = '/kaggle/working/repo'  # Path to save and display contents\n    \n    # Unpack the codebase to be patched into the defined directory\n    with open(archive_path, 'wb') as f:\n        f.write(repo_archive.read())\n\n    if os.path.exists(repo_path):\n        shutil.rmtree(repo_path)\n    os.makedirs(repo_path, exist_ok=True)\n    \n    shutil.unpack_archive(archive_path, extract_dir=repo_path)\n    os.remove(archive_path)\n\n    return repo_path","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Helper function to get all Python files in the repo\ndef get_python_files(repo_path):\n    python_files = []\n    for root, _, files in os.walk(repo_path):\n        for file in files:\n            if file.endswith(\".py\"):\n                python_files.append(os.path.join(root, file))\n    return python_files\n\n# Function to find all patterns of a substring across the entire file content\ndef find_code_patterns_in_repo(code_pattern, repo_path):\n    python_files = get_python_files(repo_path)\n    found_files = []  # List to store paths of files where the pattern is found\n    found = False  # Flag to check if any match is found\n\n    # Compile regex pattern for faster matching\n    pattern = re.compile(re.escape(code_pattern.strip()))\n\n    # Debug: Print the regex pattern we are searching for\n    print(f\"Searching for pattern: '{code_pattern.strip()}'\\n\")\n\n    for file in python_files:\n        with open(file, 'r', encoding='utf-8') as f:\n            # Read the entire file as a single string\n            file_content = f.read()\n\n        # Find all occurrences of the pattern in the file content\n        matches = list(pattern.finditer(file_content))\n\n        if matches:\n            found = True\n            found_files.append(file)  # Add the file path to the result list\n            print(f\"\\nFound in file: {file}\")\n            # Split the file content into lines for line number mapping\n            lines = file_content.splitlines()\n\n            # Print each match with its line number and context\n            for match in matches:\n                # Get the start position of the match\n                start_pos = match.start()\n                # Find the line number by counting newlines up to the match position\n                line_number = file_content.count('\\n', 0, start_pos) + 1\n                matched_line = lines[line_number - 1].strip()\n                # Print the matched line with line number\n                print(f\"Line {line_number}: {matched_line}\")\n                # Store the matched line and its line number\n                matched_lines[file].append((line_number, matched_line))\n\n    if not found:\n        print(\"The pattern was not found in any file.\")\n    else:\n        print(\"\\nSearch complete.\")\n    \n    return found_files,matched_lines  # Return list of files where the pattern was found\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Helper function to get all Python files in the repo\ndef get_python_files(repo_path):\n    python_files = []\n    for root, _, files in os.walk(repo_path):\n        for file in files:\n            if file.endswith(\".py\"):\n                python_files.append(os.path.join(root, file))\n    return python_files\n\ndef extract_nodes_from_line(code_line):\n    tree = ast.parse(code_line)\n    nodes = [node for node in ast.walk(tree)]  # Append all nodes without filtering by type\n    return nodes\n\ndef analyze_file(file_path):\n    with open(file_path, 'r', encoding='utf-8') as f:\n        source = f.read()\n    \n    # Remove BOM if present\n    if source.startswith('\\ufeff'):\n        source = source[1:]\n\n    tree = ast.parse(source)\n    node_map = defaultdict(list)\n    for node in ast.walk(tree):\n        if hasattr(node, 'lineno'):\n            node_map[type(node).__name__].append((node.lineno, node))\n    return node_map, source.splitlines()\n\ndef trace_back_nodes(repo_path, nodes):\n    python_files = get_python_files(repo_path)\n    traced_lines = defaultdict(list)\n    \n    for file in python_files:\n        node_map, lines = analyze_file(file)\n        for node in nodes:\n            node_type = type(node).__name__\n            if node_type in node_map:\n                for lineno, mapped_node in node_map[node_type]:\n                    # Simplified attribute comparison\n                    # Only check for key attributes like 'id', 'name', or 'func'\n                    if hasattr(node, 'id') and hasattr(mapped_node, 'id') and node.id == mapped_node.id:\n                        traced_lines[file].append((lineno, lines[lineno - 1]))\n                    elif hasattr(node, 'name') and hasattr(mapped_node, 'name') and node.name == mapped_node.name:\n                        traced_lines[file].append((lineno, lines[lineno - 1]))\n                    elif hasattr(node, 'func') and hasattr(mapped_node, 'func'):\n                        if hasattr(node.func, 'id') and hasattr(mapped_node.func, 'id') and node.func.id == mapped_node.func.id:\n                            traced_lines[file].append((lineno, lines[lineno - 1]))\n\n    return traced_lines\n\n# Display traced results without duplicate lines\ndef display_traced_lines(traced_lines, target_file_path=None):\n    \n    # Filter for the target file path if provided\n    if target_file_path:\n        traced_lines = {target_file_path: traced_lines.get(target_file_path, [])}\n\n    for file, lines in traced_lines.items():\n        if lines:  # Proceed only if there are lines to print\n            print(f\"\\nIn file: {file}\")\n            printed_lines = set()  # Set to keep track of printed lines for each file\n            for lineno, line in sorted(lines):\n                if (lineno, line) not in printed_lines:\n                    print(f\"Line {lineno}: {line}\")\n                    printed_lines.add((lineno, line))  # Add line to set after printing\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Function to get traced lines as a list based on line of interest and total lines required\ndef get_traced_lines(traced_lines, target_file_path=None, line_number=None, total_lines=9):\n    # Filter for the target file path if provided\n    if target_file_path:\n        traced_lines = {target_file_path: traced_lines.get(target_file_path, [])}\n\n    # Validate input parameters\n    if not line_number or total_lines < 9:\n        print(\"Invalid input: line_number must be specified and total_lines must be at least 9.\")\n        return []\n\n    # List to store the final result\n    final_lines = []\n\n    for file, lines in traced_lines.items():\n        if lines:  # Proceed only if there are lines to print\n            # Convert list to dict for easier line number access\n            line_dict = {lineno: line for lineno, line in lines}\n            sorted_lines = sorted(line_dict.keys())\n\n            # Initialize set for unique lines and list for ordered output\n            chosen_lines = set()\n            ordered_lines = []\n\n            # Extract 4 lines before, the line of interest, and 4 lines after (9 lines total)\n            start = max(line_number - 4, sorted_lines[0])\n            end = min(line_number + 4, sorted_lines[-1])\n            \n            # Add 9 main lines\n            for i in range(start, end + 1):\n                if i in line_dict:\n                    chosen_lines.add(i)\n                    ordered_lines.append((i, line_dict[i]))\n\n            # Calculate remaining lines to add\n            remaining_lines = total_lines - len(chosen_lines)\n\n            # Add remaining lines moving backwards nearest to the line of interest\n            if remaining_lines > 0:\n                for i in reversed(sorted_lines):\n                    if i < start and i not in chosen_lines:\n                        chosen_lines.add(i)\n                        ordered_lines.insert(0, (i, line_dict[i]))  # Insert at the beginning\n                        remaining_lines -= 1\n                    if remaining_lines == 0:\n                        break\n\n            # Append to final lines if not empty\n            if ordered_lines:\n                final_lines.extend(ordered_lines)\n\n    return final_lines  # Return the list of lines","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Function to find matching lines based on the condition\ndef find_adjacent_matches(matched_lines1, matched_lines2):\n    # Dictionary to store filtered results\n    filtered_matches = {}\n\n    # Iterate over files that exist in both matched_lines1 and matched_lines2\n    for file in matched_lines1:\n        if file in matched_lines2:\n            # Extract lines and line numbers for both sets\n            lines1 = matched_lines1[file]\n            lines2 = matched_lines2[file]\n\n            # Initialize list to store matched results for current file\n            filtered_matches[file] = []\n\n            # Iterate over lines in matched_lines1\n            for line_num1, line1 in lines1:\n                # Check if any line in matched_lines2 is 1 line before or after the current line in matched_lines1\n                for line_num2, line2 in lines2:\n                    if line_num2 == line_num1 - 1 or line_num2 == line_num1 + 1:\n                        # Store the result if condition is met\n                        filtered_matches[file].append((line_num2, line2, line_num1, line1))\n\n    # Print the results\n    if filtered_matches:\n        print(\"\\nFiltered Matches (Where matched_lines2 is 1 line before or after matched_lines1):\")\n        for file, matches in filtered_matches.items():\n            print(f\"\\nIn file: {file}\")\n            for line_num2, line2, line_num1, line1 in matches:\n                print(f\"Line {line_num2}: {line2}\")\n                print(f\"Line {line_num1}: {line1}\")\n    else:\n        print(\"No adjacent matches found.\")\n    \n    return filtered_matches  # Return the filtered matches if needed","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def predict(problem_statement: str, repo_archive: io.BytesIO, pip_packages_archive: io.BytesIO, env_setup_cmds_templates: list[str]) -> str:\n    \n    # llm, tokenizer = initialize_model()\n     # Define paths\n    repo_path = save_repo_and_problem(repo_archive)\n    # we will have an llm here for getting the line where the error occurs\n    files,matched_lines = find_code_patterns_in_repo(code_line, repo_path)\n    files2,matched_lines2 = find_code_patterns_in_repo(code_line2, repo_path)\n    filtered_matches = find_adjacent_matches(matched_lines1, matched_lines2)\n    # here we will have another llm to check the probable file causing error\n    \n    nodes = extract_nodes_from_line(code_line)\n    traced_lines = trace_back_nodes(repo_path, nodes)\n    final_lines = get_traced_lines(traced_lines, target_file,line_number,total_lines)\n    # use llm to get the corrected code (we would want the corrected code in the format of line no: line)\n    \n\n\n\n\n\n\n\n\n\n\n\n    \n    # # Delete the repo directory\n    # shutil.rmtree(repo_path)\n    # print(f\"Deleted temporary repo path: {repo_path}\")\n    # first_prediction = False\n    return \"Processed repo and deleted path.\"\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# import kaggle_evaluation.konwinski_prize_inference_server as inference_server\n\n# # Setup and run the inference server\n# inference_server = inference_server.KPrizeInferenceServer(\n#     get_number_of_instances,\n#     predict\n# )\n\n# # Run locally if not on Kaggle competition rerun\n# if os.getenv('KAGGLE_IS_COMPETITION_RERUN'):\n#     inference_server.serve()\n# else:\n#     inference_server.run_local_gateway(\n#         data_paths=(\n#             '/kaggle/input/konwinski-prize/',  # Path to the entire competition dataset\n#             '/kaggle/tmp/konwinski-prize/',   # Path to a scratch directory for unpacking data.a_zip.\n#         ),\n#         use_concurrency=True,  # Enable concurrency for efficiency\n#     )\n\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls /kaggle/working/repo","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"### testing","metadata":{}},{"cell_type":"code","source":"import io\nimport os\nimport shutil\n\ninstance_count = None\nfirst_prediction = True\ninstance_index = 0  # To differentiate repo directories\n\ndef get_number_of_instances(num_instances: int) -> None:\n    \"\"\" The very first message from the gateway will be the total number of instances to be served. \"\"\"\n    global instance_count\n    instance_count = num_instances\n\ndef predict(problem_statement: str, repo_archive: io.BytesIO, pip_packages_archive: io.BytesIO, env_setup_cmds_templates: list[str]) -> str:\n    \"\"\" Simple predict function to save repos and print problem statements. \"\"\"\n    global first_prediction, instance_index\n\n    # Create a directory to save repos if not exists\n    os.makedirs('repos', exist_ok=True)\n\n    # Define path for the current repo\n    repo_path = f'repos/instance_{instance_index}'\n    instance_index += 1\n\n    # Save the repo archive to the path\n    archive_path = f'{repo_path}.tar'\n    with open(archive_path, 'wb') as f:\n        f.write(repo_archive.read())\n\n    # Unpack the repo archive\n    if os.path.exists(repo_path):\n        shutil.rmtree(repo_path)\n    shutil.unpack_archive(archive_path, extract_dir=repo_path)\n    os.remove(archive_path)  # Clean up the archive file\n\n    # Print the problem statement\n    print(f'Instance {instance_index - 1} - Problem Statement:\\n{problem_statement}\\n')\n\n    # Skip issue after saving and printing\n    return None  # Skipping the issue\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import kaggle_evaluation.konwinski_prize_inference_server as inference_server\n\n# Setup and run the inference server\ninference_server = inference_server.KPrizeInferenceServer(\n    get_number_of_instances,\n    predict\n)\n\n# Run locally if not on Kaggle competition rerun\nif os.getenv('KAGGLE_IS_COMPETITION_RERUN'):\n    inference_server.serve()\nelse:\n    inference_server.run_local_gateway(\n        data_paths=(\n            '/kaggle/input/konwinski-prize/',  # Path to the entire competition dataset\n            '/kaggle/tmp/konwinski-prize/',   # Path to a scratch directory for unpacking data.a_zip.\n        ),\n        use_concurrency=True,  # Enable concurrency for efficiency\n    )\n\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls ./repos","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"### testing the llms","metadata":{}},{"cell_type":"code","source":"llm, tokenizer = initialize_model()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"### testing the working and creating of pyanalyze folder","metadata":{}},{"cell_type":"code","source":"!pip download codemod==1.0.0 -d ./codemod_wheel","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:03:02.285414Z","iopub.execute_input":"2025-03-11T21:03:02.285758Z","iopub.status.idle":"2025-03-11T21:03:05.223493Z","shell.execute_reply.started":"2025-03-11T21:03:02.285712Z","shell.execute_reply":"2025-03-11T21:03:05.222381Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip download pyanalyze==0.13.1 -d ./pyanalyze_wheels","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls kaggle/working/codemod_wheel/codemod-1.0.0.tar.gz","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:12:30.439256Z","iopub.execute_input":"2025-03-11T21:12:30.439549Z","iopub.status.idle":"2025-03-11T21:12:30.559886Z","shell.execute_reply.started":"2025-03-11T21:12:30.439525Z","shell.execute_reply":"2025-03-11T21:12:30.55897Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install build","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:10:04.157064Z","iopub.execute_input":"2025-03-11T21:10:04.157413Z","iopub.status.idle":"2025-03-11T21:10:09.943306Z","shell.execute_reply.started":"2025-03-11T21:10:04.157389Z","shell.execute_reply":"2025-03-11T21:10:09.942438Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!mkdir -p /kaggle/working/codemod_build\n!tar -xzf /kaggle/working/codemod_wheel/codemod-1.0.0.tar.gz -C /kaggle/working/codemod_build --strip-components=1\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:14:46.025001Z","iopub.execute_input":"2025-03-11T21:14:46.025332Z","iopub.status.idle":"2025-03-11T21:14:46.280421Z","shell.execute_reply.started":"2025-03-11T21:14:46.025305Z","shell.execute_reply":"2025-03-11T21:14:46.279065Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!cd /kaggle/working/codemod_build && python -m build --wheel","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:15:06.101365Z","iopub.execute_input":"2025-03-11T21:15:06.101671Z","iopub.status.idle":"2025-03-11T21:15:09.885957Z","shell.execute_reply.started":"2025-03-11T21:15:06.101643Z","shell.execute_reply":"2025-03-11T21:15:09.884869Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install --no-index --find-links=/kaggle/working/codemod_build/dist codemod\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:15:47.053076Z","iopub.execute_input":"2025-03-11T21:15:47.053344Z","iopub.status.idle":"2025-03-11T21:15:50.763461Z","shell.execute_reply.started":"2025-03-11T21:15:47.053324Z","shell.execute_reply":"2025-03-11T21:15:50.762718Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls ./codemod_build/build/bdist.linux-x86_64","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:17:38.845401Z","iopub.execute_input":"2025-03-11T21:17:38.845711Z","iopub.status.idle":"2025-03-11T21:17:38.964272Z","shell.execute_reply.started":"2025-03-11T21:17:38.845686Z","shell.execute_reply":"2025-03-11T21:17:38.963406Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!find /kaggle/working/codemod_build -name \"*.whl\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:19:04.804193Z","iopub.execute_input":"2025-03-11T21:19:04.804473Z","iopub.status.idle":"2025-03-11T21:19:04.927587Z","shell.execute_reply.started":"2025-03-11T21:19:04.804449Z","shell.execute_reply":"2025-03-11T21:19:04.9268Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!mkdir -p /kaggle/working/wheel_storage\n!mv /kaggle/working/codemod_build/dist/*.whl /kaggle/working/wheel_storage/\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:20:06.476273Z","iopub.execute_input":"2025-03-11T21:20:06.476549Z","iopub.status.idle":"2025-03-11T21:20:06.714011Z","shell.execute_reply.started":"2025-03-11T21:20:06.476527Z","shell.execute_reply":"2025-03-11T21:20:06.712912Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls /kaggle/working/wheel_storage/","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:20:34.541645Z","iopub.execute_input":"2025-03-11T21:20:34.542007Z","iopub.status.idle":"2025-03-11T21:20:34.661679Z","shell.execute_reply.started":"2025-03-11T21:20:34.541978Z","shell.execute_reply":"2025-03-11T21:20:34.660645Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!kaggle datasets create -p /kaggle/working/wheel_storage -m \"Wheel file for offline installation of codemod-1.0.0\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:25:22.293543Z","iopub.execute_input":"2025-03-11T21:25:22.2939Z","iopub.status.idle":"2025-03-11T21:25:23.414695Z","shell.execute_reply.started":"2025-03-11T21:25:22.293874Z","shell.execute_reply":"2025-03-11T21:25:23.413567Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!mkdir -p ~/.kaggle\n!cp /kaggle/input/kaggle-api/kaggle.json ~/.kaggle/\n!chmod 600 ~/.kaggle/kaggle.json","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:30:08.829818Z","iopub.execute_input":"2025-03-11T21:30:08.83011Z","iopub.status.idle":"2025-03-11T21:30:09.19904Z","shell.execute_reply.started":"2025-03-11T21:30:08.830088Z","shell.execute_reply":"2025-03-11T21:30:09.197976Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import json\n\ndataset_metadata = {\n    \"title\": \"Codemod Wheel Dataset\",\n    \"id\": \"charansv/codemod-wheel-dataset\",\n    \"licenses\": [{\"name\": \"CC0-1.0\"}]\n}\n\nwith open(\"/kaggle/working/wheel_storage/dataset-metadata.json\", \"w\") as f:\n    json.dump(dataset_metadata, f, indent=4)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:33:47.567343Z","iopub.execute_input":"2025-03-11T21:33:47.567625Z","iopub.status.idle":"2025-03-11T21:33:47.572554Z","shell.execute_reply.started":"2025-03-11T21:33:47.567603Z","shell.execute_reply":"2025-03-11T21:33:47.571668Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!kaggle datasets create -p /kaggle/working/wheel_storage/","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:33:52.20659Z","iopub.execute_input":"2025-03-11T21:33:52.206898Z","iopub.status.idle":"2025-03-11T21:34:08.293287Z","shell.execute_reply.started":"2025-03-11T21:33:52.206878Z","shell.execute_reply":"2025-03-11T21:34:08.292225Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls ./","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-11T21:33:00.93907Z","iopub.execute_input":"2025-03-11T21:33:00.939329Z","iopub.status.idle":"2025-03-11T21:33:01.057014Z","shell.execute_reply.started":"2025-03-11T21:33:00.93931Z","shell.execute_reply":"2025-03-11T21:33:01.056263Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install /kaggle/input/codemod-wheel-dataset/codemod-1.0.0-py3-none-any.whl","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-12T01:37:14.242087Z","iopub.execute_input":"2025-03-12T01:37:14.242419Z","iopub.status.idle":"2025-03-12T01:37:21.563336Z","shell.execute_reply.started":"2025-03-12T01:37:14.242382Z","shell.execute_reply":"2025-03-12T01:37:21.562221Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install /kaggle/input/pyanalyze-k-prize/pyanalyze/*.whl","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-12T01:39:26.765354Z","iopub.execute_input":"2025-03-12T01:39:26.765735Z","iopub.status.idle":"2025-03-12T01:39:33.207654Z","shell.execute_reply.started":"2025-03-12T01:39:26.765705Z","shell.execute_reply":"2025-03-12T01:39:33.206306Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import pyanalyze","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-12T01:39:54.808577Z","iopub.execute_input":"2025-03-12T01:39:54.809011Z","iopub.status.idle":"2025-03-12T01:39:56.955846Z","shell.execute_reply.started":"2025-03-12T01:39:54.808971Z","shell.execute_reply":"2025-03-12T01:39:56.954977Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}