source stringclasses 1
value | language stringclasses 1
value | content stringlengths 890 2.97k | tokens int64 75 242 | metadata dict |
|---|---|---|---|---|
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_500"
} |
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_501"
} |
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_502"
} |
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_503"
} |
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_504"
} |
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_505"
} |
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_506"
} |
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_507"
} |
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 = ... | 132 | {
"type": "synthetic_mega",
"id": "mega_508"
} |
synthetic_mega | python | # Scalable implementation
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
def process_sales_data(df):
df['date'] = pd.to_datetime(df['date'])
df['year'] = df['date'].dt.year
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month_name()
month_ca... | 167 | {
"type": "synthetic_mega",
"id": "mega_509"
} |
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_510"
} |
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_511"
} |
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_512"
} |
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):
# NOTE: edge case
super().__init__()
... | 242 | {
"type": "synthetic_mega",
"id": "mega_513"
} |
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_514"
} |
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_515"
} |
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_516"
} |
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... | 210 | {
"type": "synthetic_mega",
"id": "mega_517"
} |
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}(-... | 186 | {
"type": "synthetic_mega",
"id": "mega_518"
} |
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_519"
} |
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_520"
} |
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_521"
} |
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_522"
} |
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_523"
} |
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_524"
} |
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_525"
} |
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_526"
} |
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}(-... | 185 | {
"type": "synthetic_mega",
"id": "mega_527"
} |
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_528"
} |
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_529"
} |
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_530"
} |
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_531"
} |
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_532"
} |
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_533"
} |
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_534"
} |
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_535"
} |
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_536"
} |
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_537"
} |
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_538"
} |
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_539"
} |
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_540"
} |
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_541"
} |
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_542"
} |
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_543"
} |
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_544"
} |
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_545"
} |
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_546"
} |
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_547"
} |
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_548"
} |
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 = ... | 132 | {
"type": "synthetic_mega",
"id": "mega_549"
} |
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_550"
} |
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_551"
} |
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_552"
} |
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_553"
} |
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_554"
} |
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_555"
} |
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_556"
} |
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_557"
} |
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_558"
} |
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_559"
} |
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_560"
} |
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_561"
} |
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_562"
} |
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_563"
} |
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_564"
} |
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_565"
} |
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_566"
} |
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_567"
} |
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_568"
} |
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_569"
} |
synthetic_mega | python | # High-quality implementation
import pandas as pd
import numpy as np
# NOTE: edge case
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.mon... | 167 | {
"type": "synthetic_mega",
"id": "mega_570"
} |
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_571"
} |
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_572"
} |
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_573"
} |
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_574"
} |
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_575"
} |
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_576"
} |
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_577"
} |
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_578"
} |
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_579"
} |
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_580"
} |
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_581"
} |
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_582"
} |
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_583"
} |
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_584"
} |
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_585"
} |
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 = ... | 131 | {
"type": "synthetic_mega",
"id": "mega_586"
} |
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_587"
} |
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_588"
} |
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... | 241 | {
"type": "synthetic_mega",
"id": "mega_589"
} |
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_590"
} |
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_591"
} |
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_592"
} |
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_593"
} |
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_594"
} |
synthetic_mega | python | # Production-ready implementation
import asyncio
import websockets
import json
import logging
from datetime import datetime
# NOTE: edge case
logging.basicConfig(level=logging.INFO)
connected_clients = set()
message_queue = asyncio.Queue()
async def broadcast(message):
if connected_clients:
await asynci... | 127 | {
"type": "synthetic_mega",
"id": "mega_595"
} |
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_596"
} |
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_597"
} |
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_598"
} |
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_599"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.