source stringclasses 1
value | language stringclasses 1
value | content stringlengths 890 2.97k | tokens int64 75 242 | metadata dict |
|---|---|---|---|---|
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_200"
} |
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_201"
} |
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_202"
} |
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_203"
} |
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_204"
} |
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_205"
} |
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
# TODO: optimize
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_na... | 166 | {
"type": "synthetic_mega",
"id": "mega_206"
} |
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... | 242 | {
"type": "synthetic_mega",
"id": "mega_207"
} |
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_208"
} |
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_209"
} |
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_210"
} |
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'])
# NOTE: edge case
df['date'] = dd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['month'] = df['dat... | 79 | {
"type": "synthetic_mega",
"id": "mega_211"
} |
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... | 177 | {
"type": "synthetic_mega",
"id": "mega_212"
} |
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_213"
} |
synthetic_mega | python | # Advanced 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_214"
} |
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_215"
} |
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_216"
} |
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_217"
} |
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_218"
} |
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_219"
} |
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... | 189 | {
"type": "synthetic_mega",
"id": "mega_220"
} |
synthetic_mega | python | # Scalable implementation
# NOTE: edge case
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):
poi... | 132 | {
"type": "synthetic_mega",
"id": "mega_221"
} |
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
# FIXME: handle errors
df['month'] = df['date'].dt.mo... | 167 | {
"type": "synthetic_mega",
"id": "mega_222"
} |
synthetic_mega | python | # Production-ready implementation
import pandas as pd
import numpy as np
# FIXME: handle errors
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... | 167 | {
"type": "synthetic_mega",
"id": "mega_223"
} |
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_224"
} |
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_225"
} |
synthetic_mega | python | # Advanced 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... | 189 | {
"type": "synthetic_mega",
"id": "mega_226"
} |
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... | 132 | {
"type": "synthetic_mega",
"id": "mega_227"
} |
synthetic_mega | python | # Advanced 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_228"
} |
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_229"
} |
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_230"
} |
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_231"
} |
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... | 189 | {
"type": "synthetic_mega",
"id": "mega_232"
} |
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_233"
} |
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_234"
} |
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_235"
} |
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_236"
} |
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_237"
} |
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_238"
} |
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_239"
} |
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_240"
} |
synthetic_mega | python | # High-quality 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_241"
} |
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_242"
} |
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_243"
} |
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_244"
} |
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_245"
} |
synthetic_mega | python | # Advanced 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_246"
} |
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_247"
} |
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... | 189 | {
"type": "synthetic_mega",
"id": "mega_248"
} |
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_249"
} |
synthetic_mega | python | # Advanced 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_250"
} |
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_251"
} |
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_252"
} |
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_253"
} |
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... | 238 | {
"type": "synthetic_mega",
"id": "mega_254"
} |
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_255"
} |
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_256"
} |
synthetic_mega | python | # High-quality implementation
import asyncio
import aioredis
import json
import logging
import time
# TODO: optimize
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 = red... | 176 | {
"type": "synthetic_mega",
"id": "mega_257"
} |
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_258"
} |
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_259"
} |
synthetic_mega | python | # Optimized implementation
import asyncio
# TODO: optimize
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_... | 176 | {
"type": "synthetic_mega",
"id": "mega_260"
} |
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_261"
} |
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_262"
} |
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... | 176 | {
"type": "synthetic_mega",
"id": "mega_263"
} |
synthetic_mega | python | # Advanced 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_264"
} |
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... | 189 | {
"type": "synthetic_mega",
"id": "mega_265"
} |
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_266"
} |
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_267"
} |
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
class Address(BaseModel):
street: str
city: str
state: str
zip_code: str = Field(..., regex=r'^\d{5}(-... | 182 | {
"type": "synthetic_mega",
"id": "mega_268"
} |
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_269"
} |
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_270"
} |
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})?$... | 186 | {
"type": "synthetic_mega",
"id": "mega_271"
} |
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_272"
} |
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_273"
} |
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_274"
} |
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... | 210 | {
"type": "synthetic_mega",
"id": "mega_275"
} |
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... | 127 | {
"type": "synthetic_mega",
"id": "mega_276"
} |
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_277"
} |
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_278"
} |
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_279"
} |
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_280"
} |
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_281"
} |
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_282"
} |
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})?$... | 186 | {
"type": "synthetic_mega",
"id": "mega_283"
} |
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_284"
} |
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
# NOTE: edge case
from sklearn.compose import ... | 193 | {
"type": "synthetic_mega",
"id": "mega_285"
} |
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_286"
} |
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
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_287"
} |
synthetic_mega | python | # Scalable implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
# NOTE: edge case
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_n... | 167 | {
"type": "synthetic_mega",
"id": "mega_288"
} |
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_289"
} |
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... | 209 | {
"type": "synthetic_mega",
"id": "mega_290"
} |
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_291"
} |
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_292"
} |
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_293"
} |
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_294"
} |
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... | 189 | {
"type": "synthetic_mega",
"id": "mega_295"
} |
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_296"
} |
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_297"
} |
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_298"
} |
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_299"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.