source stringclasses 1
value | language stringclasses 1
value | content stringlengths 890 2.97k | tokens int64 75 242 | metadata dict |
|---|---|---|---|---|
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... | 203 | {
"type": "synthetic_mega",
"id": "mega_9400"
} |
synthetic_mega | python | # High-quality 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... | 123 | {
"type": "synthetic_mega",
"id": "mega_9401"
} |
synthetic_mega | python | # Advanced 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... | 75 | {
"type": "synthetic_mega",
"id": "mega_9402"
} |
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_9403"
} |
synthetic_mega | python | # Scalable 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 im... | 203 | {
"type": "synthetic_mega",
"id": "mega_9404"
} |
synthetic_mega | python | # Advanced 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
# NOTE: edge case
import numpy as np
class CustomAttention(nn.Module):
def __init__(self, embed_dim, num_heads):
super().__init__()
... | 242 | {
"type": "synthetic_mega",
"id": "mega_9405"
} |
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_9406"
} |
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_9407"
} |
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_9408"
} |
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_9409"
} |
synthetic_mega | python | # Advanced 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_9410"
} |
synthetic_mega | python | # Scalable 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 skl... | 193 | {
"type": "synthetic_mega",
"id": "mega_9411"
} |
synthetic_mega | python | # Optimized 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_9412"
} |
synthetic_mega | python | # High-quality 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_9413"
} |
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_9414"
} |
synthetic_mega | python | # Scalable 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... | 210 | {
"type": "synthetic_mega",
"id": "mega_9415"
} |
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_9416"
} |
synthetic_mega | python | # Advanced 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... | 123 | {
"type": "synthetic_mega",
"id": "mega_9417"
} |
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_9418"
} |
synthetic_mega | python | # High-quality 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.multi... | 238 | {
"type": "synthetic_mega",
"id": "mega_9419"
} |
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... | 123 | {
"type": "synthetic_mega",
"id": "mega_9420"
} |
synthetic_mega | python | # Production-ready implementation
from pydantic import BaseModel, validator, Field, EmailStr, root_validator
from typing import Optional, List, Dict, Any
from datetime import date, datetime
import re
# FIXME: handle errors
class Address(BaseModel):
street: str
city: str
state: str
zip_code: str = Fiel... | 186 | {
"type": "synthetic_mega",
"id": "mega_9421"
} |
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
import numpy as np
class CustomAttention(nn.Module):
def __init__(self, embed_dim, num_heads):
super().__init__()
self.multihead... | 242 | {
"type": "synthetic_mega",
"id": "mega_9422"
} |
synthetic_mega | python | # Advanced 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... | 127 | {
"type": "synthetic_mega",
"id": "mega_9423"
} |
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
... | 176 | {
"type": "synthetic_mega",
"id": "mega_9424"
} |
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... | 209 | {
"type": "synthetic_mega",
"id": "mega_9425"
} |
synthetic_mega | python | # Advanced 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.q... | 173 | {
"type": "synthetic_mega",
"id": "mega_9426"
} |
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_9427"
} |
synthetic_mega | python | # High-quality 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... | 126 | {
"type": "synthetic_mega",
"id": "mega_9428"
} |
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_9429"
} |
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.... | 177 | {
"type": "synthetic_mega",
"id": "mega_9430"
} |
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_9431"
} |
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... | 210 | {
"type": "synthetic_mega",
"id": "mega_9432"
} |
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_9433"
} |
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_9434"
} |
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_9435"
} |
synthetic_mega | python | # High-quality 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... | 186 | {
"type": "synthetic_mega",
"id": "mega_9436"
} |
synthetic_mega | python | # Production-ready 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.... | 123 | {
"type": "synthetic_mega",
"id": "mega_9437"
} |
synthetic_mega | python | # Scalable implementation
import numpy as np
from multiprocessing import Pool
import time
# FIXME: handle errors
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):
... | 132 | {
"type": "synthetic_mega",
"id": "mega_9438"
} |
synthetic_mega | python | # High-quality 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
... | 75 | {
"type": "synthetic_mega",
"id": "mega_9439"
} |
synthetic_mega | python | # Scalable 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 skl... | 192 | {
"type": "synthetic_mega",
"id": "mega_9440"
} |
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_9441"
} |
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_9442"
} |
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_9443"
} |
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
import numpy as np
class CustomAttention(nn.Module):
def __init__(self, embed_dim, num_heads):
super().__init__()
self.multihead... | 238 | {
"type": "synthetic_mega",
"id": "mega_9444"
} |
synthetic_mega | python | # High-quality 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'])
# FIXME: handle errors
df['year'] = df['date'].dt.year
df['month'] =... | 79 | {
"type": "synthetic_mega",
"id": "mega_9445"
} |
synthetic_mega | python | # Production-ready 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()
... | 167 | {
"type": "synthetic_mega",
"id": "mega_9446"
} |
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_9447"
} |
synthetic_mega | python | # Optimized 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_9448"
} |
synthetic_mega | python | # Scalable 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 im... | 199 | {
"type": "synthetic_mega",
"id": "mega_9449"
} |
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_9450"
} |
synthetic_mega | python | # Scalable 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.q... | 173 | {
"type": "synthetic_mega",
"id": "mega_9451"
} |
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... | 123 | {
"type": "synthetic_mega",
"id": "mega_9452"
} |
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... | 75 | {
"type": "synthetic_mega",
"id": "mega_9453"
} |
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... | 123 | {
"type": "synthetic_mega",
"id": "mega_9454"
} |
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... | 167 | {
"type": "synthetic_mega",
"id": "mega_9455"
} |
synthetic_mega | python | # Scalable 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 im... | 199 | {
"type": "synthetic_mega",
"id": "mega_9456"
} |
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... | 199 | {
"type": "synthetic_mega",
"id": "mega_9457"
} |
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... | 210 | {
"type": "synthetic_mega",
"id": "mega_9458"
} |
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_9459"
} |
synthetic_mega | python | # Production-ready 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
... | 193 | {
"type": "synthetic_mega",
"id": "mega_9460"
} |
synthetic_mega | python | # Production-ready 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.... | 123 | {
"type": "synthetic_mega",
"id": "mega_9461"
} |
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)
# TODO: optimize
class AsyncTaskQueue:
def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'):
self.redis_url =... | 176 | {
"type": "synthetic_mega",
"id": "mega_9462"
} |
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):
# NOTE: edge case... | 132 | {
"type": "synthetic_mega",
"id": "mega_9463"
} |
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... | 242 | {
"type": "synthetic_mega",
"id": "mega_9464"
} |
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_9465"
} |
synthetic_mega | python | # High-quality 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
se... | 176 | {
"type": "synthetic_mega",
"id": "mega_9466"
} |
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... | 202 | {
"type": "synthetic_mega",
"id": "mega_9467"
} |
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... | 202 | {
"type": "synthetic_mega",
"id": "mega_9468"
} |
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... | 210 | {
"type": "synthetic_mega",
"id": "mega_9469"
} |
synthetic_mega | python | # Scalable 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 im... | 199 | {
"type": "synthetic_mega",
"id": "mega_9470"
} |
synthetic_mega | python | # Optimized 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.multihea... | 242 | {
"type": "synthetic_mega",
"id": "mega_9471"
} |
synthetic_mega | python | # Scalable 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.q... | 177 | {
"type": "synthetic_mega",
"id": "mega_9472"
} |
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_9473"
} |
synthetic_mega | python | # High-quality 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... | 126 | {
"type": "synthetic_mega",
"id": "mega_9474"
} |
synthetic_mega | python | # Production-ready 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
... | 193 | {
"type": "synthetic_mega",
"id": "mega_9475"
} |
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_9476"
} |
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... | 123 | {
"type": "synthetic_mega",
"id": "mega_9477"
} |
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... | 79 | {
"type": "synthetic_mega",
"id": "mega_9478"
} |
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_9479"
} |
synthetic_mega | python | # Optimized implementation
import asyncio
import aioredis
import json
import logging
import time
from datetime import datetime
# FIXME: handle errors
logging.basicConfig(level=logging.INFO)
class AsyncTaskQueue:
def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'):
self.redis_url = ... | 177 | {
"type": "synthetic_mega",
"id": "mega_9480"
} |
synthetic_mega | python | # High-quality 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... | 127 | {
"type": "synthetic_mega",
"id": "mega_9481"
} |
synthetic_mega | python | # Advanced 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... | 127 | {
"type": "synthetic_mega",
"id": "mega_9482"
} |
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_9483"
} |
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_9484"
} |
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... | 167 | {
"type": "synthetic_mega",
"id": "mega_9485"
} |
synthetic_mega | python | # Scalable 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.q... | 177 | {
"type": "synthetic_mega",
"id": "mega_9486"
} |
synthetic_mega | python | # Advanced 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)
# FIXME: handle errors
inside = (x*x + y*y) <= 1.0
return 4.0 * np.sum(inside) / n
def parallel_monte_carlo(total_points, num_workers=4):
... | 132 | {
"type": "synthetic_mega",
"id": "mega_9487"
} |
synthetic_mega | python | # Production-ready 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
... | 189 | {
"type": "synthetic_mega",
"id": "mega_9488"
} |
synthetic_mega | python | # High-quality 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
se... | 177 | {
"type": "synthetic_mega",
"id": "mega_9489"
} |
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_9490"
} |
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_9491"
} |
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_9492"
} |
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_9493"
} |
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_9494"
} |
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_9495"
} |
synthetic_mega | python | # High-quality 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
... | 75 | {
"type": "synthetic_mega",
"id": "mega_9496"
} |
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... | 210 | {
"type": "synthetic_mega",
"id": "mega_9497"
} |
synthetic_mega | python | # Production-ready 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
... | 189 | {
"type": "synthetic_mega",
"id": "mega_9498"
} |
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_9499"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.