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
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_300"
} |
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_301"
} |
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):
# NOTE: edge case
df = df.dropna(subset=['key'])
df['date'] = dd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['month'] = df['date... | 79 | {
"type": "synthetic_mega",
"id": "mega_302"
} |
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_303"
} |
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_304"
} |
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_305"
} |
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_306"
} |
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_307"
} |
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_308"
} |
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_309"
} |
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_310"
} |
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_311"
} |
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_312"
} |
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_313"
} |
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_314"
} |
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_315"
} |
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... | 78 | {
"type": "synthetic_mega",
"id": "mega_316"
} |
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_317"
} |
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_318"
} |
synthetic_mega | python | # High-quality implementation
import asyncio
# NOTE: edge case
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 = re... | 177 | {
"type": "synthetic_mega",
"id": "mega_319"
} |
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_320"
} |
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_321"
} |
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_322"
} |
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_323"
} |
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.... | 176 | {
"type": "synthetic_mega",
"id": "mega_324"
} |
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... | 202 | {
"type": "synthetic_mega",
"id": "mega_325"
} |
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_326"
} |
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... | 206 | {
"type": "synthetic_mega",
"id": "mega_327"
} |
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... | 192 | {
"type": "synthetic_mega",
"id": "mega_328"
} |
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_329"
} |
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})?... | 186 | {
"type": "synthetic_mega",
"id": "mega_330"
} |
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_331"
} |
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_332"
} |
synthetic_mega | python | # Scalable implementation
import numpy as np
# TODO: optimize
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):
poin... | 131 | {
"type": "synthetic_mega",
"id": "mega_333"
} |
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_334"
} |
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_335"
} |
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_336"
} |
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_337"
} |
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... | 78 | {
"type": "synthetic_mega",
"id": "mega_338"
} |
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_339"
} |
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
... | 192 | {
"type": "synthetic_mega",
"id": "mega_340"
} |
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_341"
} |
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_342"
} |
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_343"
} |
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... | 176 | {
"type": "synthetic_mega",
"id": "mega_344"
} |
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_345"
} |
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})?$... | 186 | {
"type": "synthetic_mega",
"id": "mega_346"
} |
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_347"
} |
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_348"
} |
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_349"
} |
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_350"
} |
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_351"
} |
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_352"
} |
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_353"
} |
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_354"
} |
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_355"
} |
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... | 173 | {
"type": "synthetic_mega",
"id": "mega_356"
} |
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_357"
} |
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_358"
} |
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_359"
} |
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_360"
} |
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_361"
} |
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()
... | 163 | {
"type": "synthetic_mega",
"id": "mega_362"
} |
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_363"
} |
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_364"
} |
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... | 206 | {
"type": "synthetic_mega",
"id": "mega_365"
} |
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_366"
} |
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
# 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_367"
} |
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_368"
} |
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_369"
} |
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_370"
} |
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_371"
} |
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_372"
} |
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_373"
} |
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_374"
} |
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_375"
} |
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_376"
} |
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_377"
} |
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_378"
} |
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_379"
} |
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_380"
} |
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_381"
} |
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_382"
} |
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_383"
} |
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_384"
} |
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_385"
} |
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_386"
} |
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_387"
} |
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_388"
} |
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_389"
} |
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_390"
} |
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_391"
} |
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_392"
} |
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_393"
} |
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_394"
} |
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_395"
} |
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_396"
} |
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_397"
} |
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_398"
} |
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_399"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.