Datasets:
blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
08383286f37f34f683898e2b0b196b1cc9d8de5a | [
"if len(chordProgression) < 4:\n print('ERROR IN ChordProgression 2')\n return None\nelse:\n keysForReturn = []\n tempChords = []\n for chord in chordProgression:\n tempChords.append(chord[0])\n tempChords = np.array(tempChords)\n chords = [[tempChords[0], tempChords[1]], [tempChords[2],... | <|body_start_0|>
if len(chordProgression) < 4:
print('ERROR IN ChordProgression 2')
return None
else:
keysForReturn = []
tempChords = []
for chord in chordProgression:
tempChords.append(chord[0])
tempChords = np.arra... | SubMethods | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubMethods:
def cherryIntro(self, keyProgression, chordProgression):
"""INTROで使われているメソッド"""
<|body_0|>
def cherryB(self, keyProgression, chordProgression):
"""サビで使われているメソッド"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(chordProgression) < 4... | stack_v2_sparse_classes_10k_train_000000 | 12,440 | no_license | [
{
"docstring": "INTROで使われているメソッド",
"name": "cherryIntro",
"signature": "def cherryIntro(self, keyProgression, chordProgression)"
},
{
"docstring": "サビで使われているメソッド",
"name": "cherryB",
"signature": "def cherryB(self, keyProgression, chordProgression)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005988 | Implement the Python class `SubMethods` described below.
Class description:
Implement the SubMethods class.
Method signatures and docstrings:
- def cherryIntro(self, keyProgression, chordProgression): INTROで使われているメソッド
- def cherryB(self, keyProgression, chordProgression): サビで使われているメソッド | Implement the Python class `SubMethods` described below.
Class description:
Implement the SubMethods class.
Method signatures and docstrings:
- def cherryIntro(self, keyProgression, chordProgression): INTROで使われているメソッド
- def cherryB(self, keyProgression, chordProgression): サビで使われているメソッド
<|skeleton|>
class SubMethods:... | 172f486048825d989aac69945c463dd150b84a88 | <|skeleton|>
class SubMethods:
def cherryIntro(self, keyProgression, chordProgression):
"""INTROで使われているメソッド"""
<|body_0|>
def cherryB(self, keyProgression, chordProgression):
"""サビで使われているメソッド"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SubMethods:
def cherryIntro(self, keyProgression, chordProgression):
"""INTROで使われているメソッド"""
if len(chordProgression) < 4:
print('ERROR IN ChordProgression 2')
return None
else:
keysForReturn = []
tempChords = []
for chord in c... | the_stack_v2_python_sparse | SongGenerator/mikakunin/Composer/ChordProgression.py | ku70t6h1k6r1/auto_music | train | 0 | |
582f5f7cc2cbdc26dc47ba28039f489fab195fb4 | [
"self.output_path = output_path\nself.max_concurrent_invocations_per_instance = max_concurrent_invocations_per_instance\nself.kms_key_id = kms_key_id\nself.notification_config = notification_config\nself.failure_path = failure_path",
"request_dict = {'OutputConfig': {'S3OutputPath': self.output_path, 'S3FailurePa... | <|body_start_0|>
self.output_path = output_path
self.max_concurrent_invocations_per_instance = max_concurrent_invocations_per_instance
self.kms_key_id = kms_key_id
self.notification_config = notification_config
self.failure_path = failure_path
<|end_body_0|>
<|body_start_1|>
... | Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference | AsyncInferenceConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsyncInferenceConfig:
"""Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference"""
def __init__(self, output_path=N... | stack_v2_sparse_classes_10k_train_000001 | 4,694 | permissive | [
{
"docstring": "Initialize an AsyncInferenceConfig object for async inference configuration. Args: output_path (str): Optional. The Amazon S3 location that endpoints upload inference responses to. If no value is provided, Amazon SageMaker will use default Amazon S3 Async Inference output path. (Default: None) m... | 2 | null | Implement the Python class `AsyncInferenceConfig` described below.
Class description:
Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference
... | Implement the Python class `AsyncInferenceConfig` described below.
Class description:
Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference
... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class AsyncInferenceConfig:
"""Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference"""
def __init__(self, output_path=N... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AsyncInferenceConfig:
"""Configuration object passed in when deploying models to Amazon SageMaker Endpoints. This object specifies configuration related to async endpoint. Use this configuration when trying to create async endpoint and make async inference"""
def __init__(self, output_path=None, max_conc... | the_stack_v2_python_sparse | src/sagemaker/async_inference/async_inference_config.py | aws/sagemaker-python-sdk | train | 2,050 |
166e01d59ab41b7a1bc0e3e1ebd2ff273e943c2d | [
"\"\"\"\n 我的想法:\n Merge graph, 然後判斷此graph的toposort 是否唯一.\n\n a digraph has a unique topological ordering if and only if there is a\n (directed edge) between each pair of consecutive vertices in the\n topological order (i.e., the digraph has a Hamiltonian path).\n\n https://... | <|body_start_0|>
"""
我的想法:
Merge graph, 然後判斷此graph的toposort 是否唯一.
a digraph has a unique topological ordering if and only if there is a
(directed edge) between each pair of consecutive vertices in the
topological order (i.e., the d... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sequenceReconstruction(self, org, seqs):
""":type org: List[int] :type seqs: List[List[int]] :rtype: bool"""
<|body_0|>
def rewrite(self, org, seqs):
""":type org: List[int] :type seqs: List[List[int]] :rtype: bool"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_10k_train_000002 | 3,721 | no_license | [
{
"docstring": ":type org: List[int] :type seqs: List[List[int]] :rtype: bool",
"name": "sequenceReconstruction",
"signature": "def sequenceReconstruction(self, org, seqs)"
},
{
"docstring": ":type org: List[int] :type seqs: List[List[int]] :rtype: bool",
"name": "rewrite",
"signature": ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sequenceReconstruction(self, org, seqs): :type org: List[int] :type seqs: List[List[int]] :rtype: bool
- def rewrite(self, org, seqs): :type org: List[int] :type seqs: List[L... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sequenceReconstruction(self, org, seqs): :type org: List[int] :type seqs: List[List[int]] :rtype: bool
- def rewrite(self, org, seqs): :type org: List[int] :type seqs: List[L... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def sequenceReconstruction(self, org, seqs):
""":type org: List[int] :type seqs: List[List[int]] :rtype: bool"""
<|body_0|>
def rewrite(self, org, seqs):
""":type org: List[int] :type seqs: List[List[int]] :rtype: bool"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def sequenceReconstruction(self, org, seqs):
""":type org: List[int] :type seqs: List[List[int]] :rtype: bool"""
"""
我的想法:
Merge graph, 然後判斷此graph的toposort 是否唯一.
a digraph has a unique topological ordering if and only if there is a
... | the_stack_v2_python_sparse | graph/444_Sequence_Reconstruction.py | vsdrun/lc_public | train | 6 | |
bd0f1abfcf830758fb58ba5e12d93d44f79d7085 | [
"super(MultiHeadedAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attn = None\nself.dropout = nn.Dropout(p=dropout)",
"if mask is not None:\n mask = mask.unsqueeze(1)\nnbatches = query.size(0)\nquery, key, va... | <|body_start_0|>
super(MultiHeadedAttention, self).__init__()
assert d_model % h == 0
self.d_k = d_model // h
self.h = h
self.linears = clones(nn.Linear(d_model, d_model), 4)
self.attn = None
self.dropout = nn.Dropout(p=dropout)
<|end_body_0|>
<|body_start_1|>
... | Multi-headed attention block. | MultiHeadedAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiHeadedAttention:
"""Multi-headed attention block."""
def __init__(self, h, d_model, dropout=0.1):
""":param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability"""
<|body_0|>
def forward(self, query, key, value... | stack_v2_sparse_classes_10k_train_000003 | 21,238 | no_license | [
{
"docstring": ":param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability",
"name": "__init__",
"signature": "def __init__(self, h, d_model, dropout=0.1)"
},
{
"docstring": "Forward pass through the multi-head attention block. :param quer... | 2 | null | Implement the Python class `MultiHeadedAttention` described below.
Class description:
Multi-headed attention block.
Method signatures and docstrings:
- def __init__(self, h, d_model, dropout=0.1): :param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability
- def... | Implement the Python class `MultiHeadedAttention` described below.
Class description:
Multi-headed attention block.
Method signatures and docstrings:
- def __init__(self, h, d_model, dropout=0.1): :param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability
- def... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class MultiHeadedAttention:
"""Multi-headed attention block."""
def __init__(self, h, d_model, dropout=0.1):
""":param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability"""
<|body_0|>
def forward(self, query, key, value... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MultiHeadedAttention:
"""Multi-headed attention block."""
def __init__(self, h, d_model, dropout=0.1):
""":param h: number of attention heads :param d_model: input/output dimensionality :param dropout: dropout probability"""
super(MultiHeadedAttention, self).__init__()
assert d_mo... | the_stack_v2_python_sparse | generated/test_allegro_allRank.py | jansel/pytorch-jit-paritybench | train | 35 |
36535093f9dc5d03333aa1536ca60195e30bb2ea | [
"self._log_startup(input_dict, output_dict, exec_properties)\nexclude_splits = json_utils.loads(exec_properties.get(standard_component_specs.EXCLUDE_SPLITS_KEY, 'null')) or []\nif not isinstance(exclude_splits, list):\n raise ValueError('exclude_splits in execution properties needs to be a list. Got %s instead.'... | <|body_start_0|>
self._log_startup(input_dict, output_dict, exec_properties)
exclude_splits = json_utils.loads(exec_properties.get(standard_component_specs.EXCLUDE_SPLITS_KEY, 'null')) or []
if not isinstance(exclude_splits, list):
raise ValueError('exclude_splits in execution proper... | TensorFlow ExampleValidator component executor. | Executor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Executor:
"""TensorFlow ExampleValidator component executor."""
def Do(self, input_dict: Dict[str, List[types.Artifact]], output_dict: Dict[str, List[types.Artifact]], exec_properties: Dict[str, Any]) -> None:
"""TensorFlow ExampleValidator executor entrypoint. This validates statist... | stack_v2_sparse_classes_10k_train_000004 | 7,025 | permissive | [
{
"docstring": "TensorFlow ExampleValidator executor entrypoint. This validates statistics against the schema. Args: input_dict: Input dict from input key to a list of artifacts, including: - statistics: A list of type `standard_artifacts.ExampleStatistics` generated by StatisticsGen. - schema: A list of type `... | 2 | null | Implement the Python class `Executor` described below.
Class description:
TensorFlow ExampleValidator component executor.
Method signatures and docstrings:
- def Do(self, input_dict: Dict[str, List[types.Artifact]], output_dict: Dict[str, List[types.Artifact]], exec_properties: Dict[str, Any]) -> None: TensorFlow Exa... | Implement the Python class `Executor` described below.
Class description:
TensorFlow ExampleValidator component executor.
Method signatures and docstrings:
- def Do(self, input_dict: Dict[str, List[types.Artifact]], output_dict: Dict[str, List[types.Artifact]], exec_properties: Dict[str, Any]) -> None: TensorFlow Exa... | 1b328504fa08a70388691e4072df76f143631325 | <|skeleton|>
class Executor:
"""TensorFlow ExampleValidator component executor."""
def Do(self, input_dict: Dict[str, List[types.Artifact]], output_dict: Dict[str, List[types.Artifact]], exec_properties: Dict[str, Any]) -> None:
"""TensorFlow ExampleValidator executor entrypoint. This validates statist... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Executor:
"""TensorFlow ExampleValidator component executor."""
def Do(self, input_dict: Dict[str, List[types.Artifact]], output_dict: Dict[str, List[types.Artifact]], exec_properties: Dict[str, Any]) -> None:
"""TensorFlow ExampleValidator executor entrypoint. This validates statistics against t... | the_stack_v2_python_sparse | tfx/components/example_validator/executor.py | tensorflow/tfx | train | 2,116 |
b70e73edb101e6303b655e31f58aa1ebc22cac70 | [
"super(Decoder, self).__init__(parameters)\nself.num_layers = num_layers\nself.layer_list = add_conv_block(self.Conv, self.BatchNorm, in_channels=anatomy_factors, out_channels=self.base_filters)\nfor _ in range(self.num_layers - 2):\n self.layer_list += add_conv_block(self.Conv, self.BatchNorm, in_channels=self.... | <|body_start_0|>
super(Decoder, self).__init__(parameters)
self.num_layers = num_layers
self.layer_list = add_conv_block(self.Conv, self.BatchNorm, in_channels=anatomy_factors, out_channels=self.base_filters)
for _ in range(self.num_layers - 2):
self.layer_list += add_conv_bl... | Decoder | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
def __init__(self, parameters, anatomy_factors, num_layers=5):
"""Decoder module for SDNet. Args: parameters (dict): A dictionary containing model parameters. anatomy_factors (int): The number of anatomical factors to be considered. num_layers (int, optional): The number of laye... | stack_v2_sparse_classes_10k_train_000005 | 14,834 | permissive | [
{
"docstring": "Decoder module for SDNet. Args: parameters (dict): A dictionary containing model parameters. anatomy_factors (int): The number of anatomical factors to be considered. num_layers (int, optional): The number of layers in the Decoder. Defaults to 5. Attributes: num_layers (int): The number of layer... | 6 | stack_v2_sparse_classes_30k_train_005006 | Implement the Python class `Decoder` described below.
Class description:
Implement the Decoder class.
Method signatures and docstrings:
- def __init__(self, parameters, anatomy_factors, num_layers=5): Decoder module for SDNet. Args: parameters (dict): A dictionary containing model parameters. anatomy_factors (int): T... | Implement the Python class `Decoder` described below.
Class description:
Implement the Decoder class.
Method signatures and docstrings:
- def __init__(self, parameters, anatomy_factors, num_layers=5): Decoder module for SDNet. Args: parameters (dict): A dictionary containing model parameters. anatomy_factors (int): T... | 72eb99f68205afd5f8d49a3bb6cfc08cfd467582 | <|skeleton|>
class Decoder:
def __init__(self, parameters, anatomy_factors, num_layers=5):
"""Decoder module for SDNet. Args: parameters (dict): A dictionary containing model parameters. anatomy_factors (int): The number of anatomical factors to be considered. num_layers (int, optional): The number of laye... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Decoder:
def __init__(self, parameters, anatomy_factors, num_layers=5):
"""Decoder module for SDNet. Args: parameters (dict): A dictionary containing model parameters. anatomy_factors (int): The number of anatomical factors to be considered. num_layers (int, optional): The number of layers in the Deco... | the_stack_v2_python_sparse | GANDLF/models/sdnet.py | mlcommons/GaNDLF | train | 45 | |
eec45e2f079cf9cee3b69e75401bc71597575f0c | [
"available_taxon_slugs: List[str] = []\nfor attr in attributes:\n available_taxon_slugs.extend(attr.field_map)\nreturn available_taxon_slugs",
"if 'attributes' in values:\n attributes: List[FdqModelAttribute] = values['attributes']\n taxon_slugs = cls._get_available_attrs_taxon_slugs(attributes)\n tax... | <|body_start_0|>
available_taxon_slugs: List[str] = []
for attr in attributes:
available_taxon_slugs.extend(attr.field_map)
return available_taxon_slugs
<|end_body_0|>
<|body_start_1|>
if 'attributes' in values:
attributes: List[FdqModelAttribute] = values['attri... | FdqModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FdqModel:
def _get_available_attrs_taxon_slugs(cls, attributes: List[FdqModelAttribute]) -> List[str]:
"""Gets list of available taxon slugs for given attributes"""
<|body_0|>
def validate_unique_taxon_slugs(cls, values):
"""Validate that each taxon slug is used at m... | stack_v2_sparse_classes_10k_train_000006 | 8,280 | permissive | [
{
"docstring": "Gets list of available taxon slugs for given attributes",
"name": "_get_available_attrs_taxon_slugs",
"signature": "def _get_available_attrs_taxon_slugs(cls, attributes: List[FdqModelAttribute]) -> List[str]"
},
{
"docstring": "Validate that each taxon slug is used at most once i... | 5 | stack_v2_sparse_classes_30k_train_005494 | Implement the Python class `FdqModel` described below.
Class description:
Implement the FdqModel class.
Method signatures and docstrings:
- def _get_available_attrs_taxon_slugs(cls, attributes: List[FdqModelAttribute]) -> List[str]: Gets list of available taxon slugs for given attributes
- def validate_unique_taxon_s... | Implement the Python class `FdqModel` described below.
Class description:
Implement the FdqModel class.
Method signatures and docstrings:
- def _get_available_attrs_taxon_slugs(cls, attributes: List[FdqModelAttribute]) -> List[str]: Gets list of available taxon slugs for given attributes
- def validate_unique_taxon_s... | 210f037280793d5cb3b6d9d3e7ba3e22ca9b8bbc | <|skeleton|>
class FdqModel:
def _get_available_attrs_taxon_slugs(cls, attributes: List[FdqModelAttribute]) -> List[str]:
"""Gets list of available taxon slugs for given attributes"""
<|body_0|>
def validate_unique_taxon_slugs(cls, values):
"""Validate that each taxon slug is used at m... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FdqModel:
def _get_available_attrs_taxon_slugs(cls, attributes: List[FdqModelAttribute]) -> List[str]:
"""Gets list of available taxon slugs for given attributes"""
available_taxon_slugs: List[str] = []
for attr in attributes:
available_taxon_slugs.extend(attr.field_map)
... | the_stack_v2_python_sparse | src/panoramic/cli/husky/core/federated/model/models.py | panoramichq/panoramic-cli | train | 5 | |
3bc49a85876c37d609f9dcebfa908b298719650a | [
"self.capacity = capacity\nself.dict = OrderedDict()\nself.curr_len = 0",
"try:\n val = self.dict[key]\n del self.dict[key]\n self.dict[key] = val\n return val\nexcept KeyError:\n return -1",
"try:\n del self.dict[key]\n self.dict[key] = value\nexcept KeyError:\n if self.curr_len == self... | <|body_start_0|>
self.capacity = capacity
self.dict = OrderedDict()
self.curr_len = 0
<|end_body_0|>
<|body_start_1|>
try:
val = self.dict[key]
del self.dict[key]
self.dict[key] = val
return val
except KeyError:
return ... | Implement with OrderedDict | LRUCache1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache1:
"""Implement with OrderedDict"""
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
... | stack_v2_sparse_classes_10k_train_000007 | 3,068 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: nothing",
"name": "set",
"sig... | 3 | null | Implement the Python class `LRUCache1` described below.
Class description:
Implement with OrderedDict
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing | Implement the Python class `LRUCache1` described below.
Class description:
Implement with OrderedDict
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing
<|skeleton|>
class... | a64bca9c07a7be8d4060c4b96e89d8d429a7f1a3 | <|skeleton|>
class LRUCache1:
"""Implement with OrderedDict"""
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LRUCache1:
"""Implement with OrderedDict"""
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.dict = OrderedDict()
self.curr_len = 0
def get(self, key):
""":rtype: int"""
try:
val = self.dict[key]
... | the_stack_v2_python_sparse | Company Interview/SC/LRU.py | geniousisme/CodingInterview | train | 0 |
a5bec19a18ad7ebeda6e191272e9ba4e471ce6d9 | [
"if not root:\n return ''\nres = []\nq = collections.deque([root])\nwhile q:\n node = q.popleft()\n if node:\n res.append(str(node.val))\n q.append(node.left)\n q.append(node.right)\n else:\n res.append(str(-1))\nreturn ','.join(res)",
"if not data:\n return None\ndata_q... | <|body_start_0|>
if not root:
return ''
res = []
q = collections.deque([root])
while q:
node = q.popleft()
if node:
res.append(str(node.val))
q.append(node.left)
q.append(node.right)
else:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> Optional[TreeNode]:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_000008 | 1,442 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: Optional[TreeNode]) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> Optional[TreeNode... | 2 | stack_v2_sparse_classes_30k_train_006182 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree.
<... | c7a42753b2b16c7b9c66b8d7c2e67b683a15e27d | <|skeleton|>
class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> Optional[TreeNode]:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
if not root:
return ''
res = []
q = collections.deque([root])
while q:
node = q.popleft()
if node:
res.append(str(no... | the_stack_v2_python_sparse | medium/449.py | brandoneng000/LeetCode | train | 0 | |
26aff93bc0df9aa22e1b2e111b25105004d5a7c8 | [
"self._DebugPrintValue('Unknown1', f'0x{user_assist_entry.unknown1:08x}')\nself._DebugPrintDecimalValue('Number of executions', user_assist_entry.number_of_executions)\nif format_version == 5:\n self._DebugPrintDecimalValue('Application focus count', user_assist_entry.application_focus_count)\n self._DebugPri... | <|body_start_0|>
self._DebugPrintValue('Unknown1', f'0x{user_assist_entry.unknown1:08x}')
self._DebugPrintDecimalValue('Number of executions', user_assist_entry.number_of_executions)
if format_version == 5:
self._DebugPrintDecimalValue('Application focus count', user_assist_entry.app... | UserAssist data parser. | UserAssistDataParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserAssistDataParser:
"""UserAssist data parser."""
def _DebugPrintEntry(self, format_version, user_assist_entry):
"""Prints UserAssist entry value debug information. Args: format_version (int): format version. user_assist_entry (user_assist_entry_v3|user_assist_entry_v5): UserAssist... | stack_v2_sparse_classes_10k_train_000009 | 7,377 | permissive | [
{
"docstring": "Prints UserAssist entry value debug information. Args: format_version (int): format version. user_assist_entry (user_assist_entry_v3|user_assist_entry_v5): UserAssist entry.",
"name": "_DebugPrintEntry",
"signature": "def _DebugPrintEntry(self, format_version, user_assist_entry)"
},
... | 2 | stack_v2_sparse_classes_30k_train_006023 | Implement the Python class `UserAssistDataParser` described below.
Class description:
UserAssist data parser.
Method signatures and docstrings:
- def _DebugPrintEntry(self, format_version, user_assist_entry): Prints UserAssist entry value debug information. Args: format_version (int): format version. user_assist_entr... | Implement the Python class `UserAssistDataParser` described below.
Class description:
UserAssist data parser.
Method signatures and docstrings:
- def _DebugPrintEntry(self, format_version, user_assist_entry): Prints UserAssist entry value debug information. Args: format_version (int): format version. user_assist_entr... | d149aff1b8ff97e1cc8d7416fc583b964bad4ccd | <|skeleton|>
class UserAssistDataParser:
"""UserAssist data parser."""
def _DebugPrintEntry(self, format_version, user_assist_entry):
"""Prints UserAssist entry value debug information. Args: format_version (int): format version. user_assist_entry (user_assist_entry_v3|user_assist_entry_v5): UserAssist... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserAssistDataParser:
"""UserAssist data parser."""
def _DebugPrintEntry(self, format_version, user_assist_entry):
"""Prints UserAssist entry value debug information. Args: format_version (int): format version. user_assist_entry (user_assist_entry_v3|user_assist_entry_v5): UserAssist entry."""
... | the_stack_v2_python_sparse | winregrc/userassist.py | libyal/winreg-kb | train | 129 |
5bdbf11c4cfcb9a0185228801e2ea77cc24271a0 | [
"self.directions = self._listify_input(input_string.lower())\nself.steps = [0, 0, 0, 0]\nself.facing = 0\nself.locations = [(0, 0)]\nself.new_loc = (0, 0)",
"stripped_string = re.sub('\\\\s+', '', input_string.strip())\nsplit_list = stripped_string.split(',')\nreturn [(x[0], int(x[1:])) for x in split_list]",
"... | <|body_start_0|>
self.directions = self._listify_input(input_string.lower())
self.steps = [0, 0, 0, 0]
self.facing = 0
self.locations = [(0, 0)]
self.new_loc = (0, 0)
<|end_body_0|>
<|body_start_1|>
stripped_string = re.sub('\\s+', '', input_string.strip())
split... | Class for turning walking directions into distance from start. | Walker | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Walker:
"""Class for turning walking directions into distance from start."""
def __init__(self, input_string):
"""Initialize."""
<|body_0|>
def _listify_input(self, input_string):
"""Turn a string of inputs into a list."""
<|body_1|>
def make_rotatio... | stack_v2_sparse_classes_10k_train_000010 | 2,294 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, input_string)"
},
{
"docstring": "Turn a string of inputs into a list.",
"name": "_listify_input",
"signature": "def _listify_input(self, input_string)"
},
{
"docstring": "Turn left or right, and u... | 6 | stack_v2_sparse_classes_30k_train_003435 | Implement the Python class `Walker` described below.
Class description:
Class for turning walking directions into distance from start.
Method signatures and docstrings:
- def __init__(self, input_string): Initialize.
- def _listify_input(self, input_string): Turn a string of inputs into a list.
- def make_rotation(se... | Implement the Python class `Walker` described below.
Class description:
Class for turning walking directions into distance from start.
Method signatures and docstrings:
- def __init__(self, input_string): Initialize.
- def _listify_input(self, input_string): Turn a string of inputs into a list.
- def make_rotation(se... | 17c729af2af5f1d95ba6ff68771a82ca6d00b05d | <|skeleton|>
class Walker:
"""Class for turning walking directions into distance from start."""
def __init__(self, input_string):
"""Initialize."""
<|body_0|>
def _listify_input(self, input_string):
"""Turn a string of inputs into a list."""
<|body_1|>
def make_rotatio... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Walker:
"""Class for turning walking directions into distance from start."""
def __init__(self, input_string):
"""Initialize."""
self.directions = self._listify_input(input_string.lower())
self.steps = [0, 0, 0, 0]
self.facing = 0
self.locations = [(0, 0)]
... | the_stack_v2_python_sparse | 2016/day01_no_time_for_a_taxicab/python/src/part2.py | tlake/advent-of-code | train | 0 |
5460e94ca69e81da3dfbe356fc9545f03baab185 | [
"if target not in nums:\n return -1\nreturn nums.index(target)",
"left = 0\nright = len(nums) - 1\nif not nums:\n return -1\nwhile left + 1 < right:\n mid = (left + right) // 2\n if nums[mid] >= nums[left]:\n if nums[left] <= target <= nums[mid]:\n right = mid\n else:\n ... | <|body_start_0|>
if target not in nums:
return -1
return nums.index(target)
<|end_body_0|>
<|body_start_1|>
left = 0
right = len(nums) - 1
if not nums:
return -1
while left + 1 < right:
mid = (left + right) // 2
if nums[mid... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def search_binary(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_000011 | 2,370 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: int",
"name": "search",
"signature": "def search(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: int",
"name": "search_binary",
"signature": "def search_binary(self, nums, target)"
}... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int
- def search_binary(self, nums, target): :type nums: List[int] :type target: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int
- def search_binary(self, nums, target): :type nums: List[int] :type target: int :rtype: int
... | 2d5fa4cd696d5035ea8859befeadc5cc436959c9 | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def search_binary(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
if target not in nums:
return -1
return nums.index(target)
def search_binary(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
... | the_stack_v2_python_sparse | SourceCode/Python/Problem/00033.Search in Rotated Sorted Array.py | roger6blog/LeetCode | train | 0 | |
6744895894e45ee7455520b2fbc0baa617c56ff9 | [
"if root is None:\n return ''\nreturn f'{root.val},{self.serialize(root.left)}{self.serialize(root.right)}'",
"def insert(node, val):\n if node is None:\n return TreeNode(val)\n if val < node.val:\n node.left = insert(node.left, val)\n else:\n node.right = insert(node.right, val)\... | <|body_start_0|>
if root is None:
return ''
return f'{root.val},{self.serialize(root.left)}{self.serialize(root.right)}'
<|end_body_0|>
<|body_start_1|>
def insert(node, val):
if node is None:
return TreeNode(val)
if val < node.val:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> Optional[TreeNode]:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_000012 | 2,004 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: Optional[TreeNode]) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> Optional[TreeNode... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree.
<... | 157cbaeeff74130e5105e58a6b4cdf66403a8a6f | <|skeleton|>
class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> Optional[TreeNode]:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
if root is None:
return ''
return f'{root.val},{self.serialize(root.left)}{self.serialize(root.right)}'
def deserialize(self, data: str) -> Optional[TreeNode]:
... | the_stack_v2_python_sparse | Leetcode/449. Serialize and Deserialize BST.py | xiaohuanlin/Algorithms | train | 1 |
YAML Metadata Warning:The task_categories "code-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
Stack v2 Sparse Python Classes 10k
This is a 10,000-sample snapshot for Diffusion + Autoregressive hybrid code generation experiments.
Source
The data is extracted from bigcode/the-stack-v2-dedup, Python subset. The extraction uses Stack v2 metadata as source of truth, groups candidates by repo_name + revision_id, fetches files with git partial fetch + sparse checkout, then applies AST-level class filters.
Splits
train.jsonl: 9,000val.jsonl: 500test.jsonl: 500all.jsonl: 10,000
Record Format
Each JSONL row is one Python class sample. Important fields include:
prompt: natural-language class implementation promptskeleton: class/method signatures and docstrings with<|body_i|>slotsbodies: list of method bodies without docstringsbodies_text: body slots wrapped by<|body_start_i|>and<|end_body_i|>full_text: skeleton plus body slotssolution: reconstructed class codesource_repo,source_path,revision_id,blob_id,detected_licenses: source metadata
Filters
- 2 to 6 methods per class
- every method has a non-empty docstring
- every method body has 3 to 30 non-empty lines
- reconstructed class parses as Python AST
- tests/docs/examples/vendor/generated files are excluded by metadata/path filters
- simple ClassEval/HumanEval contamination filters are applied
Strict pyflakes is not used as a hard filter because isolated extracted classes often depend on module-level imports, constants, parent classes, or helper functions.
- Downloads last month
- 15