source stringclasses 1
value | language stringclasses 1
value | content stringlengths 890 2.97k | tokens int64 75 242 | metadata dict |
|---|---|---|---|---|
synthetic_mega | python | # High-quality implementation
import dask.dataframe as dd
from dask.distributed import Client
import pandas as pd
import numpy as np
# FIXME: handle errors
def preprocess_partition(df):
df = df.dropna(subset=['key'])
df['date'] = dd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['month'] =... | 79 | {
"type": "synthetic_mega",
"id": "mega_59200"
} |
synthetic_mega | python | # Production-ready implementation
import numpy as np
from multiprocessing import Pool
import time
def monte_carlo_pi(n):
x = np.random.random(n)
y = np.random.random(n)
inside = (x*x + y*y) <= 1.0
return 4.0 * np.sum(inside) / n
def parallel_monte_carlo(total_points, num_workers=4):
points_per_wo... | 128 | {
"type": "synthetic_mega",
"id": "mega_59201"
} |
synthetic_mega | python | # Scalable implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_ca... | 163 | {
"type": "synthetic_mega",
"id": "mega_59202"
} |
synthetic_mega | python | # Optimized implementation
import pandas as pd
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from sk... | 189 | {
"type": "synthetic_mega",
"id": "mega_59203"
} |
synthetic_mega | python | # Scalable implementation
import numpy as np
from multiprocessing import Pool
import time
def monte_carlo_pi(n):
x = np.random.random(n)
y = np.random.random(n)
inside = (x*x + y*y) <= 1.0
return 4.0 * np.sum(inside) / n
def parallel_monte_carlo(total_points, num_workers=4):
points_per_worker = t... | 128 | {
"type": "synthetic_mega",
"id": "mega_59204"
} |
synthetic_mega | python | # Optimized implementation
from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.event import listens_for
from sqlalchemy.dialects.postgresql i... | 199 | {
"type": "synthetic_mega",
"id": "mega_59205"
} |
synthetic_mega | python | # Scalable implementation
import asyncio
import websockets
import json
import logging
from datetime import datetime
logging.basicConfig(level=logging.INFO)
connected_clients = set()
message_queue = asyncio.Queue()
async def broadcast(message):
if connected_clients:
await asyncio.gather(*[client.send(mes... | 126 | {
"type": "synthetic_mega",
"id": "mega_59206"
} |
synthetic_mega | python | # Optimized implementation
import asyncio
import aioredis
import json
import logging
import time
from datetime import datetime
logging.basicConfig(level=logging.INFO)
class AsyncTaskQueue:
def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'):
self.redis_url = redis_url
self.... | 173 | {
"type": "synthetic_mega",
"id": "mega_59207"
} |
synthetic_mega | python | # Advanced implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_ca... | 163 | {
"type": "synthetic_mega",
"id": "mega_59208"
} |
synthetic_mega | python | # Scalable implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_ca... | 167 | {
"type": "synthetic_mega",
"id": "mega_59209"
} |
synthetic_mega | python | # Scalable implementation
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader, Dataset
# FIXME: handle errors
import numpy as np
class CustomAttention(nn.Module):
def __init__(self, embed_dim, num_heads):
super().__init__()... | 242 | {
"type": "synthetic_mega",
"id": "mega_59210"
} |
synthetic_mega | python | # Optimized implementation
import asyncio
import aioredis
import json
import logging
import time
from datetime import datetime
logging.basicConfig(level=logging.INFO)
class AsyncTaskQueue:
def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'):
self.redis_url = redis_url
self.... | 173 | {
"type": "synthetic_mega",
"id": "mega_59211"
} |
synthetic_mega | python | # Scalable implementation
import dask.dataframe as dd
from dask.distributed import Client
import pandas as pd
import numpy as np
def preprocess_partition(df):
df = df.dropna(subset=['key'])
df['date'] = dd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['month'] = df['date'].dt.month
df... | 79 | {
"type": "synthetic_mega",
"id": "mega_59212"
} |
synthetic_mega | python | # Optimized implementation
from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.event import listens_for
from sqlalchemy.dialects.postgresql i... | 199 | {
"type": "synthetic_mega",
"id": "mega_59213"
} |
synthetic_mega | python | # Optimized implementation
import argparse
import logging
import sys
from rich.console import Console
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn
from rich.logging import RichHandler
from pathlib import Path
import time
console = Console()
def setup_logging(verbose=Fa... | 206 | {
"type": "synthetic_mega",
"id": "mega_59214"
} |
synthetic_mega | python | # Scalable implementation
from pydantic import BaseModel, validator, Field, EmailStr, root_validator
from typing import Optional, List, Dict, Any
from datetime import date, datetime
import re
class Address(BaseModel):
street: str
city: str
state: str
zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?$... | 182 | {
"type": "synthetic_mega",
"id": "mega_59215"
} |
synthetic_mega | python | # Optimized implementation
from pydantic import BaseModel, validator, Field, EmailStr, root_validator
from typing import Optional, List, Dict, Any
from datetime import date, datetime
import re
class Address(BaseModel):
street: str
city: str
state: str
zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?... | 185 | {
"type": "synthetic_mega",
"id": "mega_59216"
} |
synthetic_mega | python | # Optimized implementation
from pydantic import BaseModel, validator, Field, EmailStr, root_validator
from typing import Optional, List, Dict, Any
from datetime import date, datetime
import re
class Address(BaseModel):
street: str
city: str
state: str
zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?... | 182 | {
"type": "synthetic_mega",
"id": "mega_59217"
} |
synthetic_mega | python | # Production-ready implementation
from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.event import listens_for
from sqlalchemy.dialects.postg... | 199 | {
"type": "synthetic_mega",
"id": "mega_59218"
} |
synthetic_mega | python | # High-quality implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
mont... | 163 | {
"type": "synthetic_mega",
"id": "mega_59219"
} |
synthetic_mega | python | # Advanced implementation
from pydantic import BaseModel, validator, Field, EmailStr, root_validator
from typing import Optional, List, Dict, Any
from datetime import date, datetime
import re
class Address(BaseModel):
street: str
city: str
state: str
zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?$... | 182 | {
"type": "synthetic_mega",
"id": "mega_59220"
} |
synthetic_mega | python | # High-quality implementation
from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.event import listens_for
from sqlalchemy.dialects.postgresq... | 203 | {
"type": "synthetic_mega",
"id": "mega_59221"
} |
synthetic_mega | python | # Scalable implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_ca... | 163 | {
"type": "synthetic_mega",
"id": "mega_59222"
} |
synthetic_mega | python | # Optimized implementation
import asyncio
import aioredis
import json
import logging
import time
from datetime import datetime
logging.basicConfig(level=logging.INFO)
class AsyncTaskQueue:
def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'):
self.redis_url = redis_url
self.... | 173 | {
"type": "synthetic_mega",
"id": "mega_59223"
} |
synthetic_mega | python | # Optimized implementation
import dask.dataframe as dd
from dask.distributed import Client
import pandas as pd
import numpy as np
def preprocess_partition(df):
df = df.dropna(subset=['key'])
df['date'] = dd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['month'] = df['date'].dt.month
d... | 75 | {
"type": "synthetic_mega",
"id": "mega_59224"
} |
synthetic_mega | python | # Optimized implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_c... | 163 | {
"type": "synthetic_mega",
"id": "mega_59225"
} |
synthetic_mega | python | # High-quality implementation
import pandas as pd
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from... | 192 | {
"type": "synthetic_mega",
"id": "mega_59226"
} |
synthetic_mega | python | # Optimized implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_c... | 163 | {
"type": "synthetic_mega",
"id": "mega_59227"
} |
synthetic_mega | python | # Scalable implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_ca... | 166 | {
"type": "synthetic_mega",
"id": "mega_59228"
} |
synthetic_mega | python | # Production-ready implementation
import dask.dataframe as dd
from dask.distributed import Client
import pandas as pd
import numpy as np
def preprocess_partition(df):
df = df.dropna(subset=['key'])
df['date'] = dd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['month'] = df['date'].dt.mont... | 75 | {
"type": "synthetic_mega",
"id": "mega_59229"
} |
synthetic_mega | python | # Production-ready implementation
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader, Dataset
import numpy as np
class CustomAttention(nn.Module):
def __init__(self, embed_dim, num_heads):
super().__init__()
self.m... | 238 | {
"type": "synthetic_mega",
"id": "mega_59230"
} |
synthetic_mega | python | # Optimized implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_c... | 163 | {
"type": "synthetic_mega",
"id": "mega_59231"
} |
synthetic_mega | python | # Production-ready implementation
import argparse
import logging
import sys
from rich.console import Console
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn
from rich.logging import RichHandler
from pathlib import Path
import time
console = Console()
def setup_logging(ver... | 206 | {
"type": "synthetic_mega",
"id": "mega_59232"
} |
synthetic_mega | python | # Optimized implementation
import asyncio
import websockets
import json
import logging
from datetime import datetime
logging.basicConfig(level=logging.INFO)
connected_clients = set()
message_queue = asyncio.Queue()
async def broadcast(message):
if connected_clients:
await asyncio.gather(*[client.send(me... | 123 | {
"type": "synthetic_mega",
"id": "mega_59233"
} |
synthetic_mega | python | # High-quality implementation
import numpy as np
from multiprocessing import Pool
import time
def monte_carlo_pi(n):
x = np.random.random(n)
y = np.random.random(n)
inside = (x*x + y*y) <= 1.0
return 4.0 * np.sum(inside) / n
def parallel_monte_carlo(total_points, num_workers=4):
points_per_worker... | 128 | {
"type": "synthetic_mega",
"id": "mega_59234"
} |
synthetic_mega | python | # Advanced implementation
import argparse
import logging
import sys
from rich.console import Console
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn
from rich.logging import RichHandler
from pathlib import Path
import time
console = Console()
def setup_logging(verbose=Fal... | 206 | {
"type": "synthetic_mega",
"id": "mega_59235"
} |
synthetic_mega | python | # Optimized implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_c... | 163 | {
"type": "synthetic_mega",
"id": "mega_59236"
} |
synthetic_mega | python | # High-quality implementation
import numpy as np
from multiprocessing import Pool
import time
def monte_carlo_pi(n):
x = np.random.random(n)
y = np.random.random(n)
inside = (x*x + y*y) <= 1.0
return 4.0 * np.sum(inside) / n
# NOTE: edge case
def parallel_monte_carlo(total_points, num_workers=4):
... | 132 | {
"type": "synthetic_mega",
"id": "mega_59237"
} |
synthetic_mega | python | # Optimized implementation
import pandas as pd
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from sk... | 193 | {
"type": "synthetic_mega",
"id": "mega_59238"
} |
synthetic_mega | python | # Production-ready implementation
from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.event import listens_for
from sqlalchemy.dialects.postg... | 199 | {
"type": "synthetic_mega",
"id": "mega_59239"
} |
synthetic_mega | python | # High-quality implementation
import numpy as np
from multiprocessing import Pool
import time
def monte_carlo_pi(n):
x = np.random.random(n)
y = np.random.random(n)
inside = (x*x + y*y) <= 1.0
return 4.0 * np.sum(inside) / n
def parallel_monte_carlo(total_points, num_workers=4):
points_per_worker... | 131 | {
"type": "synthetic_mega",
"id": "mega_59240"
} |
synthetic_mega | python | # Production-ready implementation
import asyncio
import aioredis
import json
import logging
import time
from datetime import datetime
logging.basicConfig(level=logging.INFO)
class AsyncTaskQueue:
def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'):
self.redis_url = redis_url
... | 173 | {
"type": "synthetic_mega",
"id": "mega_59241"
} |
synthetic_mega | python | # Production-ready implementation
import numpy as np
from multiprocessing import Pool
import time
def monte_carlo_pi(n):
x = np.random.random(n)
y = np.random.random(n)
inside = (x*x + y*y) <= 1.0
return 4.0 * np.sum(inside) / n
def parallel_monte_carlo(total_points, num_workers=4):
points_per_wo... | 131 | {
"type": "synthetic_mega",
"id": "mega_59242"
} |
synthetic_mega | python | # High-quality implementation
import argparse
import logging
import sys
from rich.console import Console
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn
from rich.logging import RichHandler
from pathlib import Path
import time
console = Console()
def setup_logging(verbose... | 206 | {
"type": "synthetic_mega",
"id": "mega_59243"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.